diff --git a/include/meson.build b/include/meson.build index 23dc254ee..4d2c4e075 100644 --- a/include/meson.build +++ b/include/meson.build @@ -16,6 +16,15 @@ conf_data.set('HAVE_TYPEOF', cc.compiles(''' ''', name: 'typeof()') ? '1' : false) +# For feature macros we're using either false (boolean) or '1', which correspond to the macro being +# not defined at all and defined to 1. This is to match autotools behavior and thus preserve +# backwards compatibility with all the existing code that uses #ifdef to check if feature is +# enabled. This ifdef would pass if the macro is defined to 0 which would silently break code +# in various places. +# +# As a complication when we read the configuration from conf_data back we get either string or +# bool. Meson does not like comparing things of different types so we always convert the returned +# value to an integer using to_int(). conf_data.set('MONOTONIC_CLOCK', cc.has_function('clock_gettime') and cc.compiles(''' #define _POSIX_C_SOURCE 200112L @@ -181,7 +190,7 @@ if cc.has_header_symbol('sys/socket.h', 'SCM_RIGHTS') conf_data.set('XTRANS_SEND_FDS', '1') endif -if conf_data.get('HAVE_GETPEEREID') == false and conf_data.get('HAVE_GETPEERUCRED') == false +if conf_data.get('HAVE_GETPEEREID').to_int() == 0 and conf_data.get('HAVE_GETPEERUCRED').to_int() == 0 if not cc.has_header_symbol('sys/socket.h', 'SO_PEERCRED') conf_data.set('NO_LOCAL_CLIENT_CRED', 1) endif diff --git a/os/meson.build b/os/meson.build index e1d2b697f..ab28fc4ed 100644 --- a/os/meson.build +++ b/os/meson.build @@ -21,32 +21,32 @@ srcs_os = [ # Wrapper code for missing C library functions. Note that conf_data contains either '1' or false. srcs_libc = [] -if conf_data.get('HAVE_REALLOCARRAY') == false +if conf_data.get('HAVE_REALLOCARRAY').to_int() == 0 srcs_libc += 'reallocarray.c' endif -if conf_data.get('HAVE_STRCASECMP') == false +if conf_data.get('HAVE_STRCASECMP').to_int() == 0 srcs_libc += 'strcasecmp.c' endif -if conf_data.get('HAVE_STRCASESTR') == false +if conf_data.get('HAVE_STRCASESTR').to_int() == 0 srcs_libc += 'strcasestr.c' endif -if conf_data.get('HAVE_STRLCAT') == false +if conf_data.get('HAVE_STRLCAT').to_int() == 0 srcs_libc += 'strlcat.c' endif -if conf_data.get('HAVE_STRLCPY') == false +if conf_data.get('HAVE_STRLCPY').to_int() == 0 srcs_libc += 'strlcpy.c' endif -if conf_data.get('HAVE_STRNDUP') == false +if conf_data.get('HAVE_STRNDUP').to_int() == 0 srcs_libc += 'strndup.c' endif -if conf_data.get('HAVE_TIMINGSAFE_MEMCMP') == false +if conf_data.get('HAVE_TIMINGSAFE_MEMCMP').to_int() == 0 srcs_libc += 'timingsafe_memcmp.c' endif -if conf_data.get('HAVE_POLL') == false +if conf_data.get('HAVE_POLL').to_int() == 0 srcs_os += 'xserver_poll.c' endif -if conf_data.get('BUSFAULT') != false +if conf_data.get('BUSFAULT').to_int() != 0 srcs_os += 'busfault.c' endif