]> git.proxmox.com Git - mirror_lxc.git/commitdiff
build: use cc.get_define to detect FS_CONFIG_* symbols
authorAleksa Sarai <cyphar@cyphar.com>
Fri, 28 Oct 2022 01:50:41 +0000 (12:50 +1100)
committerAleksa Sarai <cyphar@cyphar.com>
Sun, 30 Oct 2022 13:07:55 +0000 (00:07 +1100)
For some reason, openSUSE has a very strange layout in sys/mount.h where
the definition of all of the FS_CONFIG_* idents are present but are
ifdef'd out in such a way that they will never be defined in an actual
build:

  #define FSOPEN_CLOEXEC          0x00000001
  /* ... */
  #ifndef FSOPEN_CLOEXEC
  enum fsconfig_command
  {
    FSCONFIG_SET_FLAG       = 0,    /* Set parameter, supplying no value */
  # define FSCONFIG_SET_FLAG FSCONFIG_SET_FLAG
  /* ... */
  };
  #endif

Unfortunately, while cc.has_header_symbol is faster, it cannot handle
this which results in compilation errors on openSUSE because the
FS_CONFIG_* symbols are actually not defined when compiling even though
the ident is present in the header. Switching to cc.get_define fixes
this issue.

Fixes: cbabe8abf11e ("build: check for FS_CONFIG_* header symbol in sys/mount.h")
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
meson.build

index 8390ee1a40b1d3151bd067759e7558f7fb5705f6..78da3680a10d3dda39b79c3816f66cbd934a9111 100644 (file)
@@ -674,7 +674,7 @@ else
     missing_types += 'struct mount_attr (sys/mount.h)' endif
 
 ## Check if sys/mount.h defines the fsconfig commands
-if cc.has_header_symbol('sys/mount.h', 'FSCONFIG_SET_FLAG')
+if cc.get_define('FSCONFIG_SET_FLAG', prefix: decl_headers) != ''
     srcconf.set10('HAVE_' + 'FSCONFIG_SET_FLAG'.underscorify().to_upper(), true)
     found_types += 'FSCONFIG_SET_FLAG (sys/mount.h)'
 else
@@ -682,7 +682,7 @@ else
     missing_types += 'FSCONFIG_SET_FLAG (sys/mount.h)'
 endif
 
-if cc.has_header_symbol('sys/mount.h', 'FS_CONFIG_SET_STRING')
+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)'
 else
@@ -690,7 +690,7 @@ else
     missing_types += 'FS_CONFIG_SET_STRING (sys/mount.h)'
 endif
 
-if cc.has_header_symbol('sys/mount.h', 'FS_CONFIG_SET_BINARY')
+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)'
 else
@@ -698,7 +698,7 @@ else
     missing_types += 'FS_CONFIG_SET_BINARY (sys/mount.h)'
 endif
 
-if cc.has_header_symbol('sys/mount.h', 'FS_CONFIG_SET_PATH_EMPTY')
+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)'
 else
@@ -706,7 +706,7 @@ else
     missing_types += 'FS_CONFIG_SET_PATH_EMPTY (sys/mount.h)'
 endif
 
-if cc.has_header_symbol('sys/mount.h', 'FS_CONFIG_SET_PATH_FD')
+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)'
 else
@@ -714,7 +714,7 @@ else
     missing_types += 'FS_CONFIG_SET_PATH_FD (sys/mount.h)'
 endif
 
-if cc.has_header_symbol('sys/mount.h', 'FS_CONFIG_SET_CMD_CREATE')
+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_CREAT (sys/mount.h)'
 else
@@ -722,7 +722,7 @@ else
     missing_types += 'FS_CONFIG_SET_CMD_CREATE (sys/mount.h)'
 endif
 
-if cc.has_header_symbol('sys/mount.h', 'FS_CONFIG_SET_CMD_RECONFIGURE')
+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)'
 else