summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2016-10-18 09:38:04 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2016-10-18 11:24:57 +0530
commitc57cb35ae6766e3c8937afe2d89a2ed612866dd0 (patch)
tree5ebb40e61190fa01c15b42a853a5d2b9c4664c3a
parentdf5ac34dec6281b0a291fbe88d0f89d3226a2bdd (diff)
build: Apply XCode 8 workaround for iOS too
clock_gettime was also added for iOS 10.0, so don't use it if we're targetting an older version. That would've caused the symbol to not be found at runtime on older devices.
-rw-r--r--configure.ac15
-rw-r--r--meson.build26
2 files changed, 28 insertions, 13 deletions
diff --git a/configure.ac b/configure.ac
index 1f78e4f07a..0e81dca3cd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -693,14 +693,21 @@ AC_CHECK_FUNC(clock_gettime, [CLOCK_GETTIME_FOUND="yes"], [
# autoconf check does its own prototype declaration that doesn't trigger that
# compiler flag.
#
-# It's only starting from macOS 10.12, that clock_gettime is actually available,
-# so we can unconditionally disable it when targetting older versions.
+# It's only starting from macOS 10.12 and iOS 10.0 that clock_gettime is
+# actually available, so we can unconditionally disable it for older versions.
case "$host_os" in
darwin*)
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <AvailabilityMacros.h>
-#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12
-#error "Not compiling for OS X 10.12 or later"
+#include <TargetConditionals.h>
+#if defined(TARGET_OS_MAC)
+# if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12
+# error "Not compiling for OS X 10.12 or later"
+# endif
+#else
+# if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0
+# error "Not compiling for iOS 10.0 or later"
+# endif
#endif
]])], [], [
if test "$CLOCK_GETTIME_FOUND" = "yes"; then
diff --git a/meson.build b/meson.build
index 2a76d4dc9d..6fe6fa8c65 100644
--- a/meson.build
+++ b/meson.build
@@ -185,24 +185,32 @@ if cc.has_function('getpagesize', prefix : '#include<unistd.h>')
cdata.set('HAVE_GETPAGESIZE', 1)
endif
-# With OS X 10.11.6 and XCode 8, clock_gettime will be incorrectly detected as
-# being available because the symbol is available in the .tbd file as a weak
-# symbol. See: https://github.com/Homebrew/homebrew-core/issues/3727#issue-170086273
+# With XCode 8, clock_gettime will be incorrectly detected as being available
+# regardless of what version of OS X you target because the symbol is available
+# in the .tbd file as a weak symbol.
+# See: https://bugzilla.gnome.org/show_bug.cgi?id=772451
#
# We cannot simply do cc.has_function with -Wl,-no_weak_imports because the
# check does its own prototype decl that doesn't trigger that compiler flag.
#
-# It's only starting from macOS 10.12, that clock_gettime is actually available,
-# so we can unconditionally disable it for older versions.
-for_osx_10_12_src = '''#include <AvailabilityMacros.h>
-#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12
-#error "Not compiling for OS X 10.12 or later"
+# It's only starting from macOS 10.12 and iOS 10.0 that clock_gettime is
+# actually available, so we can unconditionally disable it for older versions.
+disable_clock_gettime_src = '''#include <AvailabilityMacros.h>
+#include <TargetConditionals.h>
+#if defined(TARGET_OS_MAC)
+# if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12
+# error "Not compiling for OS X 10.12 or later"
+# endif
+#else
+# if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0
+# error "Not compiling for iOS 10.0 or later"
+# endif
#endif
'''
if cc.has_function('clock_gettime', prefix : '#include <time.h>')
if host_machine.system() == 'darwin'
- if cc.compiles(for_osx_10_12_src, name : 'minimum OS X version required >= 10.12')
+ if cc.compiles(disable_clock_gettime_src, name : 'target darwin/ios version has clock_gettime')
cdata.set('HAVE_CLOCK_GETTIME', 1)
endif
else