Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonojenkins <jo.shields+jenkins@xamarin.com>2020-09-16 18:24:16 +0300
committerGitHub <noreply@github.com>2020-09-16 18:24:16 +0300
commit163f4580d976654c59dc49feef4e31cd637740b5 (patch)
tree6f65ebb1b1df4758866d1ff0e05635ed452448df /configure.ac
parentc06f74755286a5068f7ec0401a5e13ac1ea80289 (diff)
[mono] Add proper check for clock_gettime (#20385)
Fixes mono/mono wasm build cc: @vargaz Co-authored-by: CoffeeFlux <CoffeeFlux@users.noreply.github.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac23
1 files changed, 22 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 24cfa42f05d..945618a2097 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2254,7 +2254,28 @@ if test x$host_win32 = xno; then
[#include <sys/types.h>])
dnl hires monotonic clock support
- AC_SEARCH_LIBS(clock_gettime, rt)
+
+ # Check for clock_gettime
+ if test x$target_osx = xyes; then
+ # On OSX, clock_gettime is only really available on 10.12 or later
+ # However, it exists as a weak symbol on earlier versions, so hard-code a version check
+ AC_MONO_APPLE_AVAILABLE(clock_gettime_available, [whether clock_gettime is available on OSX],
+ [(MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12)])
+ if test x$clock_gettime_available = xyes; then
+ AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [clock_gettime])
+ fi
+ else
+ AC_CHECK_FUNC(clock_gettime, [
+ AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [clock_gettime])
+ ], [
+ # Old glibc (< 2.17) has clock_gettime in librt, so check there too
+ AC_CHECK_LIB(rt, clock_gettime, [
+ AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [clock_gettime])
+ LIBS="$LIBS -lrt"
+ ])
+ ])
+ fi
+
AC_CHECK_FUNCS(clock_nanosleep)
dnl dynamic loader support