From: Li Lu <1487442471@qq.com> Date: Thu, 24 Jul 2025 02:06:41 +0000 (+0800) Subject: meson.build: fix checks for fsconfig and calls X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0267998bcc7d510728131cd8777f122ea9d215dd;p=thirdparty%2Flxc.git meson.build: fix checks for fsconfig and calls move Headers checks up to Calls. keep fsconfig checks on openSUSE #4176 Signed-off-by: Li Lu <1487442471@qq.com> --- diff --git a/meson.build b/meson.build index 20203fca7..3f1ac8704 100644 --- a/meson.build +++ b/meson.build @@ -514,6 +514,77 @@ foreach ccattr: [ srcconf.set10('HAVE_COMPILER_ATTR_' + ccattr.underscorify().to_upper(), cc.has_function_attribute(ccattr)) endforeach +## Headers. +foreach ident: [ + ['bpf', '''#include + #include '''], + ['close_range', '''#include '''], + ['execveat', '''#include '''], + ['endmntent', '''#include + #include '''], + ['faccessat', '''#include + #include '''], + ['fexecve', '''#include '''], + ['fgetln', '''#include '''], + ['fsconfig', '''#include '''], + ['fsmount', '''#include '''], + ['fsopen', '''#include '''], + ['fspick', '''#include '''], + ['getgrgid_r', '''#include + #include '''], + ['getline', '''#include '''], + ['getsubopt', '''#include '''], + ['gettid', '''#include + #include '''], + ['hasmntopt', '''#include + #include '''], + ['kcmp', '''#include '''], + ['keyctl', '''#include + #include '''], + ['memfd_create', '''#include '''], + ['mount_setattr', '''#include '''], + ['move_mount', '''#include '''], + ['openat2', '''#include + #include + #include '''], + ['open_tree', '''#include '''], + ['personality', '''#include '''], + ['pidfd_open', '''#include + #include + #include + #include '''], + ['pidfd_send_signal', '''#include + #include + #include + #include '''], + ['pivot_root', '''#include + #include '''], # no known header declares pivot_root + ['prlimit', '''#include + #include '''], + ['prlimit64', '''#include + #include '''], + ['renameat2', '''#include + #include '''], + ['sethostname', '''#include '''], + ['setmntent', '''#include + #include '''], + ['setns', '''#include '''], + ['sigdescr_np', '''#include '''], + ['signalfd', '''#include '''], + ['statvfs', '''#include '''], + ['statx', '''#include + #include + #include '''], + ['strchrnul', '''#include '''], + ['strlcat', '''#include '''], + ['strlcpy', '''#include '''], + ['unshare', '''#include '''], +] + + have = cc.has_function(ident[0], prefix: ident[1], args: '-D_GNU_SOURCE') + srcconf.set10('HAVE_' + ident[0].to_upper(), have) +endforeach + ## Syscalls. found_syscalls = [] missing_syscalls = [] @@ -639,7 +710,8 @@ else missing_types += 'struct mount_attr (sys/mount.h)' endif ## Check if sys/mount.h defines the fsconfig commands -if cc.get_define('FSCONFIG_SET_FLAG', prefix: decl_headers) != '' +if cc.get_define('FSCONFIG_SET_FLAG', prefix: decl_headers) != '' or \ + cc.has_header_symbol('sys/mount.h','FSCONFIG_SET_FLAG') srcconf.set10('HAVE_' + 'FSCONFIG_SET_FLAG'.underscorify().to_upper(), true) found_types += 'FSCONFIG_SET_FLAG (sys/mount.h)' else @@ -647,124 +719,68 @@ else missing_types += 'FSCONFIG_SET_FLAG (sys/mount.h)' endif -if cc.get_define('FS_CONFIG_SET_STRING', prefix: decl_headers) != '' - srcconf.set10('HAVE_' + 'FS_CONFIG_SET_STRING'.underscorify().to_upper(), true) - found_types += 'FS_CONFIG_SET_STRING (sys/mount.h)' +if cc.get_define('FS_CONFIG_SET_STRING', prefix: decl_headers) != '' or \ + cc.has_header_symbol('sys/mount.h','FSCONFIG_SET_STRING') + srcconf.set10('HAVE_' + 'FSCONFIG_SET_STRING'.underscorify().to_upper(), true) + found_types += 'FSCONFIG_SET_STRING (sys/mount.h)' else - srcconf.set10('HAVE_' + 'FS_CONFIG_SET_STRING'.underscorify().to_upper(), false) - missing_types += 'FS_CONFIG_SET_STRING (sys/mount.h)' + srcconf.set10('HAVE_' + 'FSCONFIG_SET_STRING'.underscorify().to_upper(), false) + missing_types += 'FSCONFIG_SET_STRING (sys/mount.h)' endif -if cc.get_define('FS_CONFIG_SET_BINARY', prefix: decl_headers) != '' - srcconf.set10('HAVE_' + 'FS_CONFIG_SET_BINARY'.underscorify().to_upper(), true) - found_types += 'FS_CONFIG_SET_BINARY (sys/mount.h)' +if cc.get_define('FS_CONFIG_SET_BINARY', prefix: decl_headers) != '' or \ + cc.has_header_symbol('sys/mount.h','FSCONFIG_SET_BINARY') + srcconf.set10('HAVE_' + 'FSCONFIG_SET_BINARY'.underscorify().to_upper(), true) + found_types += 'FSCONFIG_SET_BINARY (sys/mount.h)' else - srcconf.set10('HAVE_' + 'FS_CONFIG_SET_BINARY'.underscorify().to_upper(), false) - missing_types += 'FS_CONFIG_SET_BINARY (sys/mount.h)' + srcconf.set10('HAVE_' + 'FSCONFIG_SET_BINARY'.underscorify().to_upper(), false) + missing_types += 'FSCONFIG_SET_BINARY (sys/mount.h)' endif -if cc.get_define('FS_CONFIG_SET_PATH_EMPTY', prefix: decl_headers) != '' - srcconf.set10('HAVE_' + 'FS_CONFIG_SET_PATH_EMPTY'.underscorify().to_upper(), true) - found_types += 'FS_CONFIG_SET_PATH_EMPTY (sys/mount.h)' +if cc.get_define('FS_CONFIG_SET_PATH', prefix: decl_headers) != '' or \ + cc.has_header_symbol('sys/mount.h','FSCONFIG_SET_PATH') + srcconf.set10('HAVE_' + 'FSCONFIG_SET_PATH'.underscorify().to_upper(), true) + found_types += 'FSCONFIG_SET_PATH (sys/mount.h)' else - srcconf.set10('HAVE_' + 'FS_CONFIG_SET_PATH_EMPTY'.underscorify().to_upper(), false) - missing_types += 'FS_CONFIG_SET_PATH_EMPTY (sys/mount.h)' + srcconf.set10('HAVE_' + 'FSCONFIG_SET_PATH'.underscorify().to_upper(), false) + missing_types += 'FSCONFIG_SET_PATH (sys/mount.h)' endif -if cc.get_define('FS_CONFIG_SET_PATH_FD', prefix: decl_headers) != '' - srcconf.set10('HAVE_' + 'FS_CONFIG_SET_PATH_FD'.underscorify().to_upper(), true) - found_types += 'FS_CONFIG_SET_PATH_FD (sys/mount.h)' +if cc.get_define('FS_CONFIG_SET_PATH_EMPTY', prefix: decl_headers) != '' or \ + cc.has_header_symbol('sys/mount.h','FSCONFIG_SET_PATH_EMPTY') + srcconf.set10('HAVE_' + 'FSCONFIG_SET_PATH_EMPTY'.underscorify().to_upper(), true) + found_types += 'FSCONFIG_SET_PATH_EMPTY (sys/mount.h)' else - srcconf.set10('HAVE_' + 'FS_CONFIG_SET_PATH_FD'.underscorify().to_upper(), false) - missing_types += 'FS_CONFIG_SET_PATH_FD (sys/mount.h)' + srcconf.set10('HAVE_' + 'FSCONFIG_SET_PATH_EMPTY'.underscorify().to_upper(), false) + missing_types += 'FSCONFIG_SET_PATH_EMPTY (sys/mount.h)' endif -if cc.get_define('FS_CONFIG_SET_CMD_CREATE', prefix: decl_headers) != '' - srcconf.set10('HAVE_' + 'FS_CONFIG_SET_CMD_CREATE'.underscorify().to_upper(), true) - found_types += 'FS_CONFIG_SET_CMD_CREATE (sys/mount.h)' +if cc.get_define('FS_CONFIG_SET_PATH_FD', prefix: decl_headers) != '' or \ + cc.has_header_symbol('sys/mount.h','FSCONFIG_SET_FD') + srcconf.set10('HAVE_' + 'FSCONFIG_SET_FD'.underscorify().to_upper(), true) + found_types += 'FSCONFIG_SET_FD (sys/mount.h)' else - srcconf.set10('HAVE_' + 'FS_CONFIG_SET_CMD_CREATE'.underscorify().to_upper(), false) - missing_types += 'FS_CONFIG_SET_CMD_CREATE (sys/mount.h)' + srcconf.set10('HAVE_' + 'FSCONFIG_SET_FD'.underscorify().to_upper(), false) + missing_types += 'FSCONFIG_SET_FD (sys/mount.h)' endif -if cc.get_define('FS_CONFIG_SET_CMD_RECONFIGURE', prefix: decl_headers) != '' - srcconf.set10('HAVE_' + 'FS_CONFIG_SET_CMD_RECONFIGURE'.underscorify().to_upper(), true) - found_types += 'FS_CONFIG_SET_CMD_RECONFIGURE (sys/mount.h)' +if cc.get_define('FS_CONFIG_SET_CMD_CREATE', prefix: decl_headers) != '' or \ + cc.has_header_symbol('sys/mount.h','FSCONFIG_CMD_CREATE') + srcconf.set10('HAVE_' + 'FSCONFIG_CMD_CREATE'.underscorify().to_upper(), true) + found_types += 'FSCONFIG_CMD_CREATE (sys/mount.h)' else - srcconf.set10('HAVE_' + 'FS_CONFIG_SET_CMD_RECONFIGURE'.underscorify().to_upper(), false) - missing_types += 'FS_CONFIG_SET_CMD_RECONFIGURE (sys/mount.h)' + srcconf.set10('HAVE_' + 'FSCONFIG_CMD_CREATE'.underscorify().to_upper(), false) + missing_types += 'FSCONFIG_CMD_CREATE (sys/mount.h)' endif -## Headers. -foreach ident: [ - ['bpf', '''#include - #include '''], - ['close_range', '''#include '''], - ['execveat', '''#include '''], - ['endmntent', '''#include - #include '''], - ['faccessat', '''#include - #include '''], - ['fexecve', '''#include '''], - ['fgetln', '''#include '''], - ['fsconfig', '''#include '''], - ['fsmount', '''#include '''], - ['fsopen', '''#include '''], - ['fspick', '''#include '''], - ['getgrgid_r', '''#include - #include '''], - ['getline', '''#include '''], - ['getsubopt', '''#include '''], - ['gettid', '''#include - #include '''], - ['hasmntopt', '''#include - #include '''], - ['kcmp', '''#include '''], - ['keyctl', '''#include - #include '''], - ['memfd_create', '''#include '''], - ['mount_setattr', '''#include '''], - ['move_mount', '''#include '''], - ['openat2', '''#include - #include - #include '''], - ['open_tree', '''#include '''], - ['personality', '''#include '''], - ['pidfd_open', '''#include - #include - #include - #include '''], - ['pidfd_send_signal', '''#include - #include - #include - #include '''], - ['pivot_root', '''#include - #include '''], # no known header declares pivot_root - ['prlimit', '''#include - #include '''], - ['prlimit64', '''#include - #include '''], - ['renameat2', '''#include - #include '''], - ['sethostname', '''#include '''], - ['setmntent', '''#include - #include '''], - ['setns', '''#include '''], - ['sigdescr_np', '''#include '''], - ['signalfd', '''#include '''], - ['statvfs', '''#include '''], - ['statx', '''#include - #include - #include '''], - ['strchrnul', '''#include '''], - ['strlcat', '''#include '''], - ['strlcpy', '''#include '''], - ['unshare', '''#include '''], -] - - have = cc.has_function(ident[0], prefix: ident[1], args: '-D_GNU_SOURCE') - srcconf.set10('HAVE_' + ident[0].to_upper(), have) -endforeach +if cc.get_define('FS_CONFIG_SET_CMD_RECONFIGURE', prefix: decl_headers) != '' or \ + cc.has_header_symbol('sys/mount.h','FSCONFIG_CMD_RECONFIGURE') + srcconf.set10('HAVE_' + 'FSCONFIG_CMD_RECONFIGURE'.underscorify().to_upper(), true) + found_types += 'FSCONFIG_CMD_RECONFIGURE (sys/mount.h)' +else + srcconf.set10('HAVE_' + 'FSCONFIG_CMD_RECONFIGURE'.underscorify().to_upper(), false) + missing_types += 'FSCONFIG_CMD_RECONFIGURE (sys/mount.h)' +endif found_headers = [] missing_headers = []