mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1524461 - Run the clock_gettime(CLOCK_MONOTONIC) configure check on OSX. r=froydnj
That will make it detected when we bump the MACOSX_DEPLOYMENT_TARGET to a value >= 10.12. Differential Revision: https://phabricator.services.mozilla.com/D18310 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
040b50d17f
commit
029e8b5700
@ -1003,35 +1003,31 @@ dnl ========================================================
|
|||||||
AC_CHECK_FUNCS([getc_unlocked _getc_nolock gmtime_r localtime_r pthread_getname_np pthread_get_name_np])
|
AC_CHECK_FUNCS([getc_unlocked _getc_nolock gmtime_r localtime_r pthread_getname_np pthread_get_name_np])
|
||||||
|
|
||||||
dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
|
dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
|
||||||
dnl avoid this on Darwin, since depending on your system config, we may think
|
AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
|
||||||
dnl it exists but it really doesn't
|
ac_cv_clock_monotonic,
|
||||||
case "$OS_TARGET" in
|
[for libs in "" -lrt; do
|
||||||
Darwin)
|
_SAVE_LIBS="$LIBS"
|
||||||
;;
|
LIBS="$LIBS $libs"
|
||||||
*)
|
dnl clock_gettime is available on OSX since 10.12, so depending on MACOSX_DEPLOYMENT_TARGET,
|
||||||
AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
|
dnl we should or not be able to use it. To detect if we can, we need to make the
|
||||||
ac_cv_clock_monotonic,
|
dnl availability attribute strict, so that compilation fails when the target is < 10.12.
|
||||||
[for libs in "" -lrt; do
|
AC_TRY_LINK([#define availability(os, ...) availability(os, strict, __VA_ARGS)
|
||||||
_SAVE_LIBS="$LIBS"
|
#include <time.h>],
|
||||||
LIBS="$LIBS $libs"
|
[ struct timespec ts;
|
||||||
AC_TRY_LINK([#include <time.h>],
|
clock_gettime(CLOCK_MONOTONIC, &ts); ],
|
||||||
[ struct timespec ts;
|
ac_cv_clock_monotonic=$libs
|
||||||
clock_gettime(CLOCK_MONOTONIC, &ts); ],
|
LIBS="$_SAVE_LIBS"
|
||||||
ac_cv_clock_monotonic=$libs
|
break,
|
||||||
LIBS="$_SAVE_LIBS"
|
ac_cv_clock_monotonic=no)
|
||||||
break,
|
LIBS="$_SAVE_LIBS"
|
||||||
ac_cv_clock_monotonic=no)
|
done])
|
||||||
LIBS="$_SAVE_LIBS"
|
if test "$ac_cv_clock_monotonic" != "no"; then
|
||||||
done])
|
HAVE_CLOCK_MONOTONIC=1
|
||||||
if test "$ac_cv_clock_monotonic" != "no"; then
|
REALTIME_LIBS=$ac_cv_clock_monotonic
|
||||||
HAVE_CLOCK_MONOTONIC=1
|
AC_DEFINE(HAVE_CLOCK_MONOTONIC)
|
||||||
REALTIME_LIBS=$ac_cv_clock_monotonic
|
AC_SUBST(HAVE_CLOCK_MONOTONIC)
|
||||||
AC_DEFINE(HAVE_CLOCK_MONOTONIC)
|
AC_SUBST_LIST(REALTIME_LIBS)
|
||||||
AC_SUBST(HAVE_CLOCK_MONOTONIC)
|
fi
|
||||||
AC_SUBST_LIST(REALTIME_LIBS)
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
dnl Checks for math functions.
|
dnl Checks for math functions.
|
||||||
dnl ========================================================
|
dnl ========================================================
|
||||||
|
@ -1278,35 +1278,31 @@ dnl ========================================================
|
|||||||
AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
|
AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
|
||||||
|
|
||||||
dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
|
dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
|
||||||
dnl avoid this on Darwin, since depending on your system config, we may think
|
AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
|
||||||
dnl it exists but it really doesn't
|
ac_cv_clock_monotonic,
|
||||||
case "$OS_TARGET" in
|
[for libs in "" -lrt; do
|
||||||
Darwin)
|
_SAVE_LIBS="$LIBS"
|
||||||
;;
|
LIBS="$LIBS $libs"
|
||||||
*)
|
dnl clock_gettime is available on OSX since 10.12, so depending on MACOSX_DEPLOYMENT_TARGET,
|
||||||
AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
|
dnl we should or not be able to use it. To detect if we can, we need to make the
|
||||||
ac_cv_clock_monotonic,
|
dnl availability attribute strict, so that compilation fails when the target is < 10.12.
|
||||||
[for libs in "" -lrt; do
|
AC_TRY_LINK([#define availability(os, ...) availability(os, strict, __VA_ARGS)
|
||||||
_SAVE_LIBS="$LIBS"
|
#include <time.h>],
|
||||||
LIBS="$LIBS $libs"
|
[ struct timespec ts;
|
||||||
AC_TRY_LINK([#include <time.h>],
|
clock_gettime(CLOCK_MONOTONIC, &ts); ],
|
||||||
[ struct timespec ts;
|
ac_cv_clock_monotonic=$libs
|
||||||
clock_gettime(CLOCK_MONOTONIC, &ts); ],
|
LIBS="$_SAVE_LIBS"
|
||||||
ac_cv_clock_monotonic=$libs
|
break,
|
||||||
LIBS="$_SAVE_LIBS"
|
ac_cv_clock_monotonic=no)
|
||||||
break,
|
LIBS="$_SAVE_LIBS"
|
||||||
ac_cv_clock_monotonic=no)
|
done])
|
||||||
LIBS="$_SAVE_LIBS"
|
if test "$ac_cv_clock_monotonic" != "no"; then
|
||||||
done])
|
HAVE_CLOCK_MONOTONIC=1
|
||||||
if test "$ac_cv_clock_monotonic" != "no"; then
|
REALTIME_LIBS=$ac_cv_clock_monotonic
|
||||||
HAVE_CLOCK_MONOTONIC=1
|
AC_DEFINE(HAVE_CLOCK_MONOTONIC)
|
||||||
REALTIME_LIBS=$ac_cv_clock_monotonic
|
AC_SUBST(HAVE_CLOCK_MONOTONIC)
|
||||||
AC_DEFINE(HAVE_CLOCK_MONOTONIC)
|
AC_SUBST_LIST(REALTIME_LIBS)
|
||||||
AC_SUBST(HAVE_CLOCK_MONOTONIC)
|
fi
|
||||||
AC_SUBST_LIST(REALTIME_LIBS)
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
dnl Turn on warnings-as-errors to prevent implicit declaration of
|
dnl Turn on warnings-as-errors to prevent implicit declaration of
|
||||||
dnl pthread_cond_timedwait_monotonic_np, which can cause this test to
|
dnl pthread_cond_timedwait_monotonic_np, which can cause this test to
|
||||||
|
Loading…
Reference in New Issue
Block a user