check for clock_gettime from librt too

This commit is contained in:
pooka 2014-11-05 01:40:30 +00:00
parent aeea18dfa5
commit e613b0fe74
3 changed files with 75 additions and 3 deletions

View File

@ -3793,7 +3793,7 @@ fi
for ac_func in kqueue chflags strsuftoll setprogname getprogname \
clock_gettime getenv_r posix_memalign memalign aligned_alloc \
getenv_r posix_memalign memalign aligned_alloc \
arc4random_buf getsubopt fsync_range __quotactl
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
@ -3877,6 +3877,74 @@ fi
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5
$as_echo_n "checking for clock_gettime in -lrt... " >&6; }
if ${ac_cv_lib_rt_clock_gettime+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lrt $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char clock_gettime ();
int
main ()
{
return clock_gettime ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_rt_clock_gettime=yes
else
ac_cv_lib_rt_clock_gettime=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_clock_gettime" >&5
$as_echo "$ac_cv_lib_rt_clock_gettime" >&6; }
if test "x$ac_cv_lib_rt_clock_gettime" = xyes; then :
$as_echo "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char clock_gettime ();
int
main ()
{
return clock_gettime ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
$as_echo "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_nanosleep in -lrt" >&5
$as_echo_n "checking for clock_nanosleep in -lrt... " >&6; }
if ${ac_cv_lib_rt_clock_nanosleep+:} false; then :

View File

@ -27,12 +27,16 @@ AC_CANONICAL_TARGET
AC_CHECK_TYPES([clockid_t, register_t])
AC_CHECK_FUNCS([kqueue chflags strsuftoll setprogname getprogname \
clock_gettime getenv_r posix_memalign memalign aligned_alloc \
getenv_r posix_memalign memalign aligned_alloc \
arc4random_buf getsubopt fsync_range __quotactl])
AC_TRY_LINK_FUNC([clock_nanosleep],,
AC_CHECK_LIB([rt], [clock_nanosleep])
)
AC_CHECK_LIB([rt], [clock_gettime],
AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [clock_gettime]),
AC_TRY_LINK_FUNC([clock_gettime],
AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [clock_gettime])))
AC_CHECK_LIB([rt], [clock_nanosleep],
AC_DEFINE([HAVE_CLOCK_NANOSLEEP], 1, [clock_nanosleep]),
AC_TRY_LINK_FUNC([clock_nanosleep],

View File

@ -12,7 +12,7 @@
/* Define to 1 if the system has the type `clockid_t'. */
#undef HAVE_CLOCKID_T
/* Define to 1 if you have the `clock_gettime' function. */
/* clock_gettime */
#undef HAVE_CLOCK_GETTIME
/* clock_nanosleep */