From: Klaus Jensen Date: Tue, 19 Oct 2021 20:13:53 +0000 (+0200) Subject: meson: revert to using the ccan configurator X-Git-Tag: v1.0-rc0~73^2~4 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=b66a139f12357757c54adf7f38031f0f9105c501;p=users%2Fsagi%2Flibnvme.git meson: revert to using the ccan configurator Something fishy is going on with the -include config.h and #include "config.h" in the ccan sources. If examples/tests use ccan, they end up with redefinitions caused by the ccan config defines not being properly set. Revert to generating a ccan-specific config.h using the configurator (like the Make-based setup). Signed-off-by: Klaus Jensen --- diff --git a/ccan/meson.build b/ccan/meson.build index f24b94f5..c0143427 100644 --- a/ccan/meson.build +++ b/ccan/meson.build @@ -11,7 +11,7 @@ configurator = executable( c_args: ['-D_GNU_SOURCE'], ) -config_h = custom_target( +ccan_config_h = custom_target( 'config.h', output: 'config.h', capture: true, diff --git a/meson.build b/meson.build index 8251cf4f..b07497af 100644 --- a/meson.build +++ b/meson.build @@ -108,87 +108,8 @@ conf.set('CONFIG_LIBUUID', libuuid.found(), description: 'Is libuuid required?') json_c = dependency('json-c', version: '>=0.13', fallback : ['json-c', 'json_c']) conf.set('CONFIG_JSONC', json_c.found(), description: 'Is json-c required?') -# local (cross-compilable) implementations of ccan configure steps -conf.set10( - 'HAVE_BUILTIN_TYPES_COMPATIBLE_P', - cc.compiles( - '''int main(void) { - return __builtin_types_compatible_p(int, long); - } - ''', - name: '__builtin_type_compatible_p' - ), - description: 'Is __builtin_types_compatible_p available?' -) -conf.set10( - 'HAVE_TYPEOF', - cc.compiles( - '''int main(void) { - int a = 1; - typeof(a) b; - b = a; - } - ''', - name: 'typeof' - ), - description: 'Is typeof available?' -) -conf.set10( - 'HAVE_BYTESWAP_H', - cc.compiles( - '''#include ''', - name: 'byteswap.h' - ), - description: 'Is byteswap.h include-able?' -) -conf.set10( - 'HAVE_BSWAP64', - cc.links( - '''#include - int main(void) { - return bswap_64(0); - } - ''', - name: 'bswap64' - ), - description: 'Is bswap_64 available?' -) -conf.set10( - 'HAVE_LITTLE_ENDIAN', - build_machine.endian() == 'little', - description: 'Building for little-endian' -) -conf.set10( - 'HAVE_BIG_ENDIAN', - build_machine.endian() == 'big', - description: 'Building for big-endian' -) -conf.set10( - 'HAVE_STATEMENT_EXPR', - cc.compiles( - '''int main(int argc, char **argv) { - return ({ int x = argc; x == 1; }); - } - ''', - name: 'statement-expr' - ), - description: 'Can we use a statement as an expression?' -) -conf.set10( - 'HAVE_ISBLANK', - cc.links( - '''#include - int main(int argc, char **argv) { - return isblank(argv[0][0]); - } - ''', - name: 'isblank' - ), - description: 'Is isblank() available?' -) - -config_h = configure_file( - output: 'config.h', +config_host_h = configure_file( + output: 'config-host.h', configuration: conf ) @@ -204,10 +125,11 @@ configure_file( ) ################################################################################ -add_project_arguments(['-fomit-frame-pointer', '-D_GNU_SOURCE', '-include', 'config.h'], language : 'c') +add_project_arguments(['-fomit-frame-pointer', '-D_GNU_SOURCE', '-include', 'config-host.h'], language : 'c') incdir = include_directories(['.', 'ccan', 'src']) ################################################################################ +subdir('ccan') subdir('src') subdir('pynvme') subdir('test') diff --git a/pynvme/meson.build b/pynvme/meson.build index 5e9c96d4..079536cf 100644 --- a/pynvme/meson.build +++ b/pynvme/meson.build @@ -10,7 +10,7 @@ swig = find_program('swig', required: false) if swig.found() pymod_swig = custom_target( 'nvme.py', - input: ['nvme.i', config_h], + input: ['nvme.i', config_host_h, ccan_config_h], output: ['nvme.py', 'nvme_wrap.c'], command: [swig, '-python', '-py3', '-o', '@OUTPUT1@', '@INPUT0@'], install: true, diff --git a/src/meson.build b/src/meson.build index 0d261c21..2b8fa638 100644 --- a/src/meson.build +++ b/src/meson.build @@ -13,7 +13,8 @@ sources = [ 'nvme/log.c', 'nvme/tree.c', 'nvme/util.c', - config_h, + ccan_config_h, + config_host_h, ] if conf.get('CONFIG_JSONC')