meson: Make sure defines are either set to 1 or not defined

This will make the behavior of meson consistent with autotools. The
configuration macros are exposed to public headers so any inconsistency
is likely to break code for anyone who's not careful to use #ifdef
instead of #if.

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
This commit is contained in:
Povilas Kanapickas
2021-04-05 16:24:47 +03:00
parent faff5bbdf5
commit 68c2cfadd6
2 changed files with 138 additions and 134 deletions

View File

@@ -19,34 +19,34 @@ srcs_os = [
'log.c',
]
# Wrapper code for missing C library functions
# Wrapper code for missing C library functions. Note that conf_data contains either '1' or false.
srcs_libc = []
if not conf_data.get('HAVE_REALLOCARRAY')
if conf_data.get('HAVE_REALLOCARRAY') == false
srcs_libc += 'reallocarray.c'
endif
if not conf_data.get('HAVE_STRCASECMP')
if conf_data.get('HAVE_STRCASECMP') == false
srcs_libc += 'strcasecmp.c'
endif
if not conf_data.get('HAVE_STRCASESTR')
if conf_data.get('HAVE_STRCASESTR') == false
srcs_libc += 'strcasestr.c'
endif
if not conf_data.get('HAVE_STRLCAT')
if conf_data.get('HAVE_STRLCAT') == false
srcs_libc += 'strlcat.c'
endif
if not conf_data.get('HAVE_STRLCPY')
if conf_data.get('HAVE_STRLCPY') == false
srcs_libc += 'strlcpy.c'
endif
if not conf_data.get('HAVE_STRNDUP')
if conf_data.get('HAVE_STRNDUP') == false
srcs_libc += 'strndup.c'
endif
if not conf_data.get('HAVE_TIMINGSAFE_MEMCMP')
if conf_data.get('HAVE_TIMINGSAFE_MEMCMP') == false
srcs_libc += 'timingsafe_memcmp.c'
endif
if not conf_data.get('HAVE_POLL')
if conf_data.get('HAVE_POLL') == false
srcs_os += 'xserver_poll.c'
endif
if conf_data.get('BUSFAULT')
if conf_data.get('BUSFAULT') != false
srcs_os += 'busfault.c'
endif