]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
Revert "meson: revert to using the ccan configurator"
authorJeremy Kerr <jk@codeconstruct.com.au>
Thu, 21 Oct 2021 08:08:01 +0000 (16:08 +0800)
committerJeremy Kerr <jk@codeconstruct.com.au>
Thu, 21 Oct 2021 08:31:07 +0000 (16:31 +0800)
We have a fix queued for the issue that the original revert is
working-around.

This also includes adjustments to the examples/ & tests/ meson
definitions to suit.

This reverts commit b66a139f12357757c54adf7f38031f0f9105c501.
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
ccan/meson.build
examples/meson.build
meson.build
pynvme/meson.build
src/meson.build
test/meson.build

index c0143427c46fa953137a41f71696027a4b13e5ed..f24b94f5b9452e92e13c021051e3107e02280f8b 100644 (file)
@@ -11,7 +11,7 @@ configurator = executable(
     c_args: ['-D_GNU_SOURCE'],
 )
 
-ccan_config_h = custom_target(
+config_h = custom_target(
     'config.h',
     output:  'config.h',
     capture: true,
index 54ebbdac9fef197a9047995c7901abf21945d706..7c86c9d20a675ee28ca6c8087a4fac784db94bce 100644 (file)
@@ -7,7 +7,7 @@
 #
 executable(
     'telemetry-listen',
-    ['telemetry-listen.c', ccan_config_h],
+    ['telemetry-listen.c', config_h],
     link_with: libnvme,
     include_directories: incdir)
 
@@ -19,7 +19,7 @@ executable(
 
 executable(
     'discover-loop',
-    ['discover-loop.c', ccan_config_h],
+    ['discover-loop.c', config_h],
     link_with: libnvme,
     include_directories: incdir)
 
index b07497af6058381770866ed1e8193958e6e5202f..8251cf4f4c464123bc9cb0bdba9046dcc1cb03f2 100644 (file)
@@ -108,8 +108,87 @@ 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?')
 
-config_host_h = configure_file(
-    output: 'config-host.h',
+# 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',
     configuration: conf
 )
 
@@ -125,11 +204,10 @@ configure_file(
 )
 
 ################################################################################
-add_project_arguments(['-fomit-frame-pointer', '-D_GNU_SOURCE', '-include', 'config-host.h'], language : 'c')
+add_project_arguments(['-fomit-frame-pointer', '-D_GNU_SOURCE', '-include', 'config.h'], language : 'c')
 incdir = include_directories(['.', 'ccan', 'src'])
 
 ################################################################################
-subdir('ccan')
 subdir('src')
 subdir('pynvme')
 subdir('test')
index 2955959f3aad317ee59caf5e154724e33afa7891..bde1536befba56ecc700e228af9df16b5a8869d5 100644 (file)
@@ -19,7 +19,7 @@ endif
 if have_python_support
     pymod_swig = custom_target(
         'nvme.py',
-        input:   ['nvme.i', config_host_h, ccan_config_h],
+        input:   ['nvme.i', config_h],
         output:  ['nvme.py', 'nvme_wrap.c'],
         command: [swig, '-python', '-py3', '-o', '@OUTPUT1@', '@INPUT0@'],
         install: true,
index 10acb15ea98b7f1e9375f810393c71702d508b56..2a6069c65e868bddcc3de37ba56e437ccc52088a 100644 (file)
@@ -14,8 +14,7 @@ sources = [
     'nvme/log.c',
     'nvme/tree.c',
     'nvme/util.c',
-    ccan_config_h,
-    config_host_h,
+    config_h,
 ]
 
 if conf.get('CONFIG_JSONC')
index 6b776aa4d2bafbf578a65d572438373870613fbd..7adb963f646ce837465cc1269348b16145cae1d0 100644 (file)
@@ -7,7 +7,7 @@
 #
 main = executable(
     'main-test',
-    ['test.c', ccan_config_h],
+    ['test.c', config_h],
     dependencies: libuuid,
     link_with: libnvme,
     include_directories: incdir
@@ -22,14 +22,14 @@ cpp = executable(
 
 register = executable(
     'test-register',
-    ['register.c', ccan_config_h],
+    ['register.c', config_h],
     link_with: libnvme,
     include_directories: incdir
 )
 
 zns = executable(
     'test-zns',
-    ['zns.c', ccan_config_h],
+    ['zns.c', config_h],
     link_with: libnvme,
     include_directories: incdir
 )