From: Wolfgang Bumiller Date: Mon, 4 Jul 2022 09:27:14 +0000 (+0200) Subject: meson: add remaining still-in-use config checks X-Git-Tag: lxc-5.0.1~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d441ee58519c93782044cd174f937f7db80d3aab;p=thirdparty%2Flxc.git meson: add remaining still-in-use config checks These are all still in use in the code but have not been added to meson.build when switching over from autoconf. Signed-off-by: Wolfgang Bumiller --- diff --git a/meson.build b/meson.build index f30eb0eb0..3748a9037 100644 --- a/meson.build +++ b/meson.build @@ -419,6 +419,9 @@ if want_capabilities if not libcap.found() # Compat with Ubuntu 14.04 which ships libcap w/o .pc file libcap = cc.find_library('cap', required: false) + else + have = cc.has_function('cap_get_file', dependencies: libcap, prefix: '#include ') + srcconf.set10('LIBCAP_SUPPORTS_FILE_CAPABILITIES', have) endif srcconf.set10('HAVE_LIBCAP', libcap.found()) pkgconfig_libs += libcap @@ -443,6 +446,9 @@ else srcconf.set10('HAVE_STATIC_LIBCAP', false) endif +libutil = cc.find_library('util', required: false) + +oss_fuzz_dependencies = [] if want_oss_fuzz srcconf.set10('FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION', true) srcconf.set10('RUN_ON_OSS_FUZZ', true) @@ -458,12 +464,21 @@ srcconf.set10('HAVE_PAM', pam.found()) pkgconfig_libs += pam ## Others. +have = cc.has_function('fmemopen', prefix: '#include ', args: '-D_GNU_SOURCE') +srcconf.set10('HAVE_FMEMOPEN', have) + +have_openpty = cc.has_function('openpty', dependencies: libutil, prefix: '#include ') +srcconf.set10('HAVE_OPENPTY', have_openpty) + +have = cc.has_function('pthread_setcancelstate', prefix: '#include ') +srcconf.set10('HAVE_PTHREAD_SETCANCELSTATE', have) + +have = cc.has_function('rand_r') +srcconf.set10('HAVE_RAND_R', have) + have = cc.has_function('strchrnul', prefix: '#include ', args: '-D_GNU_SOURCE') srcconf.set10('HAVE_STRCHRNUL', have) -have = cc.has_function('openpty', prefix: '#include ', args: '-D_GNU_SOURCE') -srcconf.set10('HAVE_OPENPTY', have) - have_func_strerror_r = cc.has_function('strerror_r', prefix: '#include ', args: '-D_GNU_SOURCE') srcconf.set10('HAVE_STRERROR_R', have_func_strerror_r) @@ -564,16 +579,18 @@ decl_headers = ''' #include #include #include -#include +#include #include #include +#include ''' foreach decl: [ '__aligned_u64', + 'struct clone_args', 'struct mount_attr', 'struct open_how', - 'struct clone_args', + 'struct rtnl_link_stats64', ] # We get -1 if the size cannot be determined @@ -593,6 +610,7 @@ foreach tuple: [ ['__aligned_u64'], ['struct mount_attr'], ['struct open_how'], + ['struct rtnl_link_stats64'], ] if tuple.length() >= 2 @@ -802,6 +820,13 @@ if has_sd_bus liblxc_dependencies += [libsystemd] endif +if have_openpty + liblxc_dependencies += [libutil] + if want_oss_fuzz + oss_fuzz_dependencies += [libutil] + endif +endif + liblxc_link_whole = [liblxc_static] liblxc = shared_library( diff --git a/src/tests/meson.build b/src/tests/meson.build index 625a4b6f7..03d9f2290 100644 --- a/src/tests/meson.build +++ b/src/tests/meson.build @@ -408,7 +408,7 @@ if want_oss_fuzz 'fuzz-lxc-cgroup-init', files('fuzz-lxc-cgroup-init.c') + tests_common_sources, include_directories: liblxc_includes, - dependencies: [fuzzing_engine], + dependencies: [fuzzing_engine, oss_fuzz_dependencies], link_with: [liblxc_static], install: false, install_dir: bindir) @@ -417,7 +417,7 @@ if want_oss_fuzz 'fuzz-lxc-config-read', files('fuzz-lxc-config-read.c') + tests_common_sources, include_directories: liblxc_includes, - dependencies: [fuzzing_engine], + dependencies: [fuzzing_engine, oss_fuzz_dependencies], link_with: [liblxc_static], install: false, install_dir: bindir) @@ -426,7 +426,7 @@ if want_oss_fuzz 'fuzz-lxc-define-load', files('fuzz-lxc-define-load.c') + tests_common_sources, include_directories: liblxc_includes, - dependencies: [fuzzing_engine], + dependencies: [fuzzing_engine, oss_fuzz_dependencies], link_with: [liblxc_static], install: false, install_dir: bindir)