meson.build: registry list is dependent on getopt_long Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
diff --git a/meson.build b/meson.build
index cf01197..7de7702 100644
--- a/meson.build
+++ b/meson.build
@@ -118,6 +118,9 @@ elif cc.has_header_symbol('stdlib.h', '__secure_getenv', prefix: system_ext_defi
else
message('C library does not support secure_getenv, using getenv instead')
endif
+have_getopt_long = cc.has_header_symbol('getopt.h', 'getopt_long',
+ prefix: '#define _GNU_SOURCE')
+
# Silence some security & deprecation warnings on MSVC
# for some unix/C functions we use.
# https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4996?view=vs-2019
@@ -342,10 +345,12 @@ if get_option('enable-xkbregistry')
include_directories: include_directories('xkbcommon'),
link_with: libxkbregistry
)
- executable('xkbcommon-registry-list',
- 'tools/registry-list.c',
- dependencies: dep_libxkbregistry,
- install: false)
+ if have_getopt_long
+ executable('xkbcommon-registry-list',
+ 'tools/registry-list.c',
+ dependencies: dep_libxkbregistry,
+ install: false)
+ endif
endif
# Tests
@@ -534,7 +539,7 @@ tools_dep = declare_dependency(
link_with: libxkbcommon_tools_internal,
)
-if cc.has_header_symbol('getopt.h', 'getopt_long', prefix: '#define _GNU_SOURCE')
+if have_getopt_long
executable('xkbcommon-rmlvo-to-keymap', 'tools/rmlvo-to-keymap.c', dependencies: tools_dep)
executable('xkbcommon-how-to-type', 'tools/how-to-type.c', dependencies: tools_dep)
endif