meson: Require 0.54.2 when building for Android ≤ 20

cc.has_function() provide false positive for Android-20 and earlier; the fix is in Meson 0.54.2. People attempting to cross-compile previously wouldn’t have been able to get it to work without manual intervention, so the dependency bump for this platform is not an additional obstacle for them.
This commit is contained in:
Vilius Sutkus 89 2020-06-08 11:29:24 +00:00 committed by Philip Withnall
parent 3fd3a246f6
commit fcfb1c6b9e

View File

@ -569,6 +569,19 @@ if host_system != 'windows' and cc.has_function('stpcpy', prefix : '#include <st
glib_conf.set('HAVE_STPCPY', 1)
endif
# When building for Android-20 and earlier, require Meson 0.54.2 or newer.
# This is needed, because Meson build versions prior to 0.54.2 return false
# positive for stpcpy has_function check when building for legacy Android.
if host_system.startswith('android-')
android_is_older = cc.compiles('''#if __ANDROID_API__ >= 21
#error Android is 21 or newer
#endif''')
if android_is_older and meson.version().version_compare('< 0.54.2')
error('Compiling for <Android-21 requires Meson 0.54.2 or newer')
endif
endif
# Check that posix_memalign() is usable; must use header
if host_system != 'windows' and cc.has_function('posix_memalign', prefix : '#include <stdlib.h>')
glib_conf.set('HAVE_POSIX_MEMALIGN', 1)