From f2ff19d7c8ec214a0e5d33bde9f86179d871aec2 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 9 Feb 2024 16:25:56 +0000 Subject: [PATCH] build: Really check for close_range() as intended Signed-off-by: Simon McVittie --- libglnx.m4 | 4 ++++ meson.build | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/libglnx.m4 b/libglnx.m4 index bd0d580c..e0beac92 100644 --- a/libglnx.m4 +++ b/libglnx.m4 @@ -4,6 +4,7 @@ AC_DEFUN([LIBGLNX_CONFIGURE], [ +dnl This defines HAVE_DECL_FOO to 1 if found or 0 if not AC_CHECK_DECLS([ renameat2, memfd_create, @@ -19,6 +20,9 @@ AC_CHECK_DECLS([ #include #include ]]) +dnl This defines HAVE_FOO to 1 if found, or leaves it undefined if not: +dnl not the same! +AC_CHECK_FUNCS([close_range]) AC_ARG_ENABLE(otmpfile, [AS_HELP_STRING([--disable-otmpfile], diff --git a/meson.build b/meson.build index 70c938f9..c18c7aea 100644 --- a/meson.build +++ b/meson.build @@ -49,16 +49,16 @@ foreach check_function : check_functions ) conf.set10('HAVE_DECL_' + check_function.underscorify().to_upper(), have_it) endforeach -config_h = configure_file( - output : 'libglnx-config.h', - configuration : conf, -) check_functions = [ 'close_range', ] foreach check_function : check_functions + if cc.has_function(check_function) + conf.set('HAVE_' + check_function.underscorify().to_upper(), 1) + endif endforeach + config_h = configure_file( output : 'libglnx-config.h', configuration : conf,