]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
meson: revert to using the ccan configurator
authorKlaus Jensen <k.jensen@samsung.com>
Tue, 19 Oct 2021 20:13:53 +0000 (22:13 +0200)
committerKlaus Jensen <k.jensen@samsung.com>
Tue, 19 Oct 2021 20:13:53 +0000 (22:13 +0200)
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 <k.jensen@samsung.com>
ccan/meson.build
meson.build
pynvme/meson.build
src/meson.build

index f24b94f5b9452e92e13c021051e3107e02280f8b..c0143427c46fa953137a41f71696027a4b13e5ed 100644 (file)
@@ -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,
index 8251cf4f4c464123bc9cb0bdba9046dcc1cb03f2..b07497af6058381770866ed1e8193958e6e5202f 100644 (file)
@@ -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 <byteswap.h>''',
-        name: 'byteswap.h'
-    ),
-    description: 'Is byteswap.h include-able?'
-)
-conf.set10(
-    'HAVE_BSWAP64',
-    cc.links(
-        '''#include <byteswap.h>
-            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 <ctype.h>
-           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')
index 5e9c96d45046a117b1bdecfebf357f1dcb485b3d..079536cfd3b15d405e2e6139c9bd0cdecadc7331 100644 (file)
@@ -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,
index 0d261c21b6bb44f666d5384145205d7a3dac996a..2b8fa638967411070aa554ebd971ef61b200b13e 100644 (file)
@@ -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')