aboutsummaryrefslogtreecommitdiffstats
path: root/meson.build
diff options
context:
space:
mode:
authorBernd Schubert <bschubert@ddn.com>2023-02-07 23:06:42 +0100
committerNikolaus Rath <Nikolaus@rath.org>2023-02-09 10:21:29 +0000
commitd7560cc9916b086bfe5d86459cc9f04033edd904 (patch)
treecd86f44f9ec63e666a272af3388f42f8f21d3ef6 /meson.build
parentbecc030e94a1ac7a5af2c530cd7526aadfaac3f5 (diff)
downloadlibfuse-d7560cc9916b086bfe5d86459cc9f04033edd904.tar.gz
Split config.h into private and public config
This addresses https://github.com/libfuse/libfuse/issues/729 commit db35a37def14b72181f3630efeea0e0433103c41 introduced a public config.h (rename to fuse_config.h to avoid conflicts) that was installed with the package and included by libfuse users through fuse_common.h. Probablem is that this file does not have unique defines so that they are unique to libfuse - on including the file conflicts with libfuse users came up. In principle all defines could be prefixed, but then most of them are internal for libfuse compilation only. So this splits out publically required defines to a new file 'libfuse_config.h' and changes back to include of "fuse_config.h" only when HAVE_LIBFUSE_PRIVATE_CONFIG_H is defined. This also renames HAVE_LIBC_VERSIONED_SYMBOLS to LIBFUSE_BUILT_WITH_VERSIONED_SYMBOLS, as it actually better explains for libfuse users what that variable is for.
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build45
1 files changed, 31 insertions, 14 deletions
diff --git a/meson.build b/meson.build
index eb7b477..fb6451a 100644
--- a/meson.build
+++ b/meson.build
@@ -16,11 +16,22 @@ elif platform == 'cygwin' or platform == 'windows'
'Take a look at http://www.secfs.net/winfsp/ instead')
endif
+cc = meson.get_compiler('c')
+
#
-# Feature detection
+# Feature detection, only available at libfuse compilation time,
+# but not for application linking to libfuse.
#
-cfg = configuration_data()
-cc = meson.get_compiler('c')
+private_cfg = configuration_data()
+
+#
+# Feature detection, the resulting config file is installed
+# with the package.
+# Note: Symbols need to be care fully named, to avoid conflicts
+# with applications linking to libfuse and including
+# this config.
+#
+public_cfg = configuration_data()
# Default includes when checking for presence of functions and
# struct members
@@ -35,27 +46,27 @@ include_default = '''
'''
args_default = [ '-D_GNU_SOURCE' ]
-cfg.set_quoted('PACKAGE_VERSION', meson.project_version())
+private_cfg.set_quoted('PACKAGE_VERSION', meson.project_version())
# Test for presence of some functions
test_funcs = [ 'fork', 'fstatat', 'openat', 'readlinkat', 'pipe2',
'splice', 'vmsplice', 'posix_fallocate', 'fdatasync',
'utimensat', 'copy_file_range', 'fallocate' ]
foreach func : test_funcs
- cfg.set('HAVE_' + func.to_upper(),
+ private_cfg.set('HAVE_' + func.to_upper(),
cc.has_function(func, prefix: include_default, args: args_default))
endforeach
-cfg.set('HAVE_SETXATTR',
+private_cfg.set('HAVE_SETXATTR',
cc.has_function('setxattr', prefix: '#include <sys/xattr.h>'))
-cfg.set('HAVE_ICONV',
+private_cfg.set('HAVE_ICONV',
cc.has_function('iconv', prefix: '#include <iconv.h>'))
# Test if structs have specific member
-cfg.set('HAVE_STRUCT_STAT_ST_ATIM',
+private_cfg.set('HAVE_STRUCT_STAT_ST_ATIM',
cc.has_member('struct stat', 'st_atim',
prefix: include_default,
args: args_default))
-cfg.set('HAVE_STRUCT_STAT_ST_ATIMESPEC',
+private_cfg.set('HAVE_STRUCT_STAT_ST_ATIMESPEC',
cc.has_member('struct stat', 'st_atimespec',
prefix: include_default,
args: args_default))
@@ -63,7 +74,7 @@ cfg.set('HAVE_STRUCT_STAT_ST_ATIMESPEC',
#
# Compiler configuration
#
-add_project_arguments('-D_REENTRANT', '-DHAVE_CONFIG_H', '-Wno-sign-compare',
+add_project_arguments('-D_REENTRANT', '-DHAVE_LIBFUSE_PRIVATE_CONFIG_H', '-Wno-sign-compare',
'-Wstrict-prototypes', '-Wmissing-declarations', '-Wwrite-strings',
'-fno-strict-aliasing', language: 'c')
add_project_arguments('-D_REENTRANT', '-DHAVE_CONFIG_H', '-D_GNU_SOURCE',
@@ -111,7 +122,7 @@ endif
if versioned_symbols == 1
message('Enabling versioned libc symbols')
- cfg.set('HAVE_LIBC_VERSIONED_SYMBOLS', 1)
+ public_cfg.set('LIBFUSE_BUILT_WITH_VERSIONED_SYMBOLS', 1)
# gcc-10 and newer support the symver attribute which we need to use if we
# want to support LTO
@@ -140,9 +151,15 @@ else
message('Disabling versioned libc symbols')
endif
-# Write the test results into config.h (stored in build directory)
-configure_file(output: 'fuse_config.h',
- configuration : cfg, install: true, install_dir: 'include/fuse3')
+# Write private test results into fuse_config.h (stored in build directory)
+configure_file(output: 'fuse_config.h', configuration : private_cfg)
+
+# Write the test results, installed with the package,
+# symbols need to be properly prefixed to avoid
+# symbol (define) conflicts
+configure_file(output: 'libfuse_config.h',
+ configuration : public_cfg,
+ install: true, install_dir: 'include/fuse3')
# '.' will refer to current build directory, which contains config.h
include_dirs = include_directories('include', 'lib', '.')