actually check for clock_nanosleep()

This commit is contained in:
pooka 2014-11-05 00:50:17 +00:00
parent e0e4b98687
commit 6d2cad6b7c
3 changed files with 42 additions and 40 deletions

View File

@ -3877,30 +3877,9 @@ fi
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
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 :
else
{ $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 "$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 :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@ -3914,39 +3893,58 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
#ifdef __cplusplus
extern "C"
#endif
char clock_gettime ();
char clock_nanosleep ();
int
main ()
{
return clock_gettime ();
return clock_nanosleep ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_rt_clock_gettime=yes
ac_cv_lib_rt_clock_nanosleep=yes
else
ac_cv_lib_rt_clock_gettime=no
ac_cv_lib_rt_clock_nanosleep=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 :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBRT 1
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_clock_nanosleep" >&5
$as_echo "$ac_cv_lib_rt_clock_nanosleep" >&6; }
if test "x$ac_cv_lib_rt_clock_nanosleep" = xyes; then :
$as_echo "#define HAVE_CLOCK_NANOSLEEP 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_nanosleep ();
int
main ()
{
return clock_nanosleep ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
LIBS="-lrt $LIBS"
fi
$as_echo "#define HAVE_CLOCK_NANOSLEEP 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 dlinfo in -ldl" >&5
$as_echo_n "checking for dlinfo in -ldl... " >&6; }
if ${ac_cv_lib_dl_dlinfo+:} false; then :

View File

@ -33,9 +33,10 @@ AC_CHECK_FUNCS([kqueue chflags strsuftoll setprogname getprogname \
AC_TRY_LINK_FUNC([clock_nanosleep],,
AC_CHECK_LIB([rt], [clock_nanosleep])
)
AC_TRY_LINK_FUNC([clock_gettime],,
AC_CHECK_LIB([rt], [clock_gettime])
)
AC_CHECK_LIB([rt], [clock_nanosleep],
AC_DEFINE([HAVE_CLOCK_NANOSLEEP], 1, [clock_nanosleep]),
AC_TRY_LINK_FUNC([clock_nanosleep],
AC_DEFINE([HAVE_CLOCK_NANOSLEEP], 1, [clock_nanosleep])))
AC_CHECK_LIB([dl], [dlinfo],
AC_DEFINE([HAVE_DLINFO], 1, [dlinfo]),
AC_TRY_LINK_FUNC([dlinfo], AC_DEFINE([HAVE_DLINFO], 1, [dlinfo])))

View File

@ -15,6 +15,9 @@
/* Define to 1 if you have the `clock_gettime' function. */
#undef HAVE_CLOCK_GETTIME
/* clock_nanosleep */
#undef HAVE_CLOCK_NANOSLEEP
/* dlinfo */
#undef HAVE_DLINFO