Skip to content

Commit 0d8d0a5

Browse files
committed
build: do not include config.h globally
The python build breaks because of libnvme and the swig generator define variations of fallthrough. Let's only include the config.h for the libraries. Signed-off-by: Daniel Wagner <[email protected]>
1 parent 020b979 commit 0d8d0a5

4 files changed

Lines changed: 19 additions & 19 deletions

File tree

internal/meson.build

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,4 @@ config_dep = declare_dependency(
2121
sources: config_h)
2222

2323
config_h_path = meson.current_build_dir() / 'config.h'
24-
25-
add_project_arguments(
26-
[
27-
'-include', config_h_path,
28-
],
29-
language : 'c',
30-
)
24+
config_h_arg = [ '-include', config_h_path ]

meson.build

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -230,16 +230,6 @@ conf.set(
230230
),
231231
description: 'Is network address and service translation available'
232232
)
233-
conf.set(
234-
'HAVE_GLIBC_IOCTL',
235-
cc.compiles(
236-
'''#include <sys/ioctl.h>
237-
int ioctl(int fd, unsigned long request, ...);
238-
''',
239-
name: 'ioctl has glibc-style prototype'
240-
),
241-
description: 'Is ioctl the glibc interface (rather than POSIX)'
242-
)
243233
dl_dep = dependency('dl', required: false)
244234
conf.set(
245235
'HAVE_LIBC_DLSYM',

src/meson.build

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ libnvme = library(
5555
link_args: ['-Wl,--version-script=' + version_script_arg],
5656
dependencies: deps,
5757
link_depends: mapfile,
58+
c_args: config_h_arg,
5859
include_directories: [incdir, internal_incdir],
5960
install: true,
6061
link_with: libccan,
@@ -81,6 +82,7 @@ libnvme_mi = library(
8182
'nvme-mi', # produces libnvme-mi.so
8283
mi_sources,
8384
version: library_version,
85+
c_args: config_h_arg,
8486
link_args: ['-Wl,--version-script=' + mi_version_script_arg],
8587
dependencies: mi_deps,
8688
link_depends: mi_mapfile,
@@ -100,6 +102,7 @@ libnvme_mi_test = library(
100102
'nvme-mi-test', # produces libnvme-mi-test.so
101103
mi_sources,
102104
dependencies: mi_deps,
105+
c_args: config_h_arg,
103106
include_directories: [incdir, internal_incdir],
104107
install: false,
105108
link_with: libccan,

test/ioctl/meson.build

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
1+
mock_conf = configuration_data()
2+
3+
mock_conf.set(
4+
'HAVE_GLIBC_IOCTL',
5+
cc.compiles(
6+
'''#include <sys/ioctl.h>
7+
int ioctl(int fd, unsigned long request, ...);
8+
''',
9+
name: 'ioctl has glibc-style prototype'
10+
),
11+
description: 'Is ioctl the glibc interface (rather than POSIX)'
12+
)
13+
114
mock_ioctl = library(
215
'mock-ioctl',
316
['mock.c', 'util.c'],
4-
dependencies: [dl_dep]
5-
)
17+
dependencies: [dl_dep],
18+
c_args: ['-DHAVE_GLIBC_IOCTL=' + (mock_conf.get('HAVE_GLIBC_IOCTL') ? '1' : '0')])
619

720
# Add mock-ioctl to the LD_PRELOAD path so it overrides libc.
821
# Append to LD_PRELOAD so existing libraries, e.g. libasan, are kept.

0 commit comments

Comments
 (0)