Bug 1303212 - Don't check for CLOCK_MONOTONIC on darwin r=glandium

MozReview-Commit-ID: 9Ppn5jzcjbP
This commit is contained in:
Nicholas Hurley 2016-09-22 09:38:26 -07:00
Родитель 905a450ea2
Коммит f6db690c95
2 изменённых файлов: 58 добавлений и 42 удалений

Просмотреть файл

@ -1216,27 +1216,35 @@ AC_FUNC_MEMCMP
AC_CHECK_FUNCS([getc_unlocked _getc_nolock gmtime_r localtime_r pthread_getname_np])
dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
ac_cv_clock_monotonic,
[for libs in "" -lrt; do
_SAVE_LIBS="$LIBS"
LIBS="$LIBS $libs"
AC_TRY_LINK([#include <time.h>],
[ struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts); ],
ac_cv_clock_monotonic=$libs
LIBS="$_SAVE_LIBS"
break,
ac_cv_clock_monotonic=no)
LIBS="$_SAVE_LIBS"
done])
if test "$ac_cv_clock_monotonic" != "no"; then
HAVE_CLOCK_MONOTONIC=1
REALTIME_LIBS=$ac_cv_clock_monotonic
AC_DEFINE(HAVE_CLOCK_MONOTONIC)
AC_SUBST(HAVE_CLOCK_MONOTONIC)
AC_SUBST_LIST(REALTIME_LIBS)
fi
dnl avoid this on Darwin, since depending on your system config, we may think
dnl it exists but it really doesn't
case "$OS_TARGET" in
Darwin)
;;
*)
AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
ac_cv_clock_monotonic,
[for libs in "" -lrt; do
_SAVE_LIBS="$LIBS"
LIBS="$LIBS $libs"
AC_TRY_LINK([#include <time.h>],
[ struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts); ],
ac_cv_clock_monotonic=$libs
LIBS="$_SAVE_LIBS"
break,
ac_cv_clock_monotonic=no)
LIBS="$_SAVE_LIBS"
done])
if test "$ac_cv_clock_monotonic" != "no"; then
HAVE_CLOCK_MONOTONIC=1
REALTIME_LIBS=$ac_cv_clock_monotonic
AC_DEFINE(HAVE_CLOCK_MONOTONIC)
AC_SUBST(HAVE_CLOCK_MONOTONIC)
AC_SUBST_LIST(REALTIME_LIBS)
fi
;;
esac
dnl Checks for math functions.
dnl ========================================================

Просмотреть файл

@ -1667,27 +1667,35 @@ AC_FUNC_MEMCMP
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
AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
ac_cv_clock_monotonic,
[for libs in "" -lrt; do
_SAVE_LIBS="$LIBS"
LIBS="$LIBS $libs"
AC_TRY_LINK([#include <time.h>],
[ struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts); ],
ac_cv_clock_monotonic=$libs
LIBS="$_SAVE_LIBS"
break,
ac_cv_clock_monotonic=no)
LIBS="$_SAVE_LIBS"
done])
if test "$ac_cv_clock_monotonic" != "no"; then
HAVE_CLOCK_MONOTONIC=1
REALTIME_LIBS=$ac_cv_clock_monotonic
AC_DEFINE(HAVE_CLOCK_MONOTONIC)
AC_SUBST(HAVE_CLOCK_MONOTONIC)
AC_SUBST_LIST(REALTIME_LIBS)
fi
dnl avoid this on Darwin, since depending on your system config, we may think
dnl it exists but it really doesn't
case "$OS_TARGET" in
Darwin)
;;
*)
AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
ac_cv_clock_monotonic,
[for libs in "" -lrt; do
_SAVE_LIBS="$LIBS"
LIBS="$LIBS $libs"
AC_TRY_LINK([#include <time.h>],
[ struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts); ],
ac_cv_clock_monotonic=$libs
LIBS="$_SAVE_LIBS"
break,
ac_cv_clock_monotonic=no)
LIBS="$_SAVE_LIBS"
done])
if test "$ac_cv_clock_monotonic" != "no"; then
HAVE_CLOCK_MONOTONIC=1
REALTIME_LIBS=$ac_cv_clock_monotonic
AC_DEFINE(HAVE_CLOCK_MONOTONIC)
AC_SUBST(HAVE_CLOCK_MONOTONIC)
AC_SUBST_LIST(REALTIME_LIBS)
fi
;;
esac
AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
ac_cv_pthread_cond_timedwait_monotonic_np,