diff options
author | Janne Blomqvist <jb@gcc.gnu.org> | 2011-01-31 22:52:00 +0200 |
---|---|---|
committer | Janne Blomqvist <jb@gcc.gnu.org> | 2011-01-31 22:52:00 +0200 |
commit | b6e7a3d1f97d5a2c611797ba52e75790888f0379 (patch) | |
tree | 218eeedfb68b9af80b02714d695e24e0effb0fbc /libgfortran/configure | |
parent | e1bcd685a28f47ae3b70b5a0f3f005e2d327b580 (diff) | |
download | gcc-b6e7a3d1f97d5a2c611797ba52e75790888f0379.zip gcc-b6e7a3d1f97d5a2c611797ba52e75790888f0379.tar.gz gcc-b6e7a3d1f97d5a2c611797ba52e75790888f0379.tar.bz2 |
Use clock_gettime in libgfortran timing intrinsics, cleanup
From-SVN: r169449
Diffstat (limited to 'libgfortran/configure')
-rwxr-xr-x | libgfortran/configure | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/libgfortran/configure b/libgfortran/configure index b872106..ec5c7ed 100755 --- a/libgfortran/configure +++ b/libgfortran/configure @@ -16380,6 +16380,17 @@ _ACEOF fi done +for ac_func in clock_gettime +do : + ac_fn_c_check_func "$LINENO" "clock_gettime" "ac_cv_func_clock_gettime" +if test "x$ac_cv_func_clock_gettime" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_CLOCK_GETTIME 1 +_ACEOF + +fi +done + # Check for glibc backtrace functions for ac_func in backtrace backtrace_symbols @@ -25249,6 +25260,58 @@ $as_echo "#define HAVE_FEENABLEEXCEPT 1" >>confdefs.h fi +# At least for glibc, clock_gettime is in librt. But don't pull that +# in if it still doesn't give us the function we want. +# This test is copied from libgomp. +if test $ac_cv_func_clock_gettime = no; then + { $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 test "${ac_cv_lib_rt_clock_gettime+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lrt $LIBS" +if test x$gcc_no_link = xyes; then + as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 +fi +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" = x""yes; then : + LIBS="-lrt $LIBS" + +$as_echo "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h + +fi + +fi + # Check for SysV fpsetmask { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether fpsetmask is present" >&5 |