diff options
author | jb <jb@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-01-31 20:52:00 +0000 |
---|---|---|
committer | jb <jb@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-01-31 20:52:00 +0000 |
commit | a2c0dc0f1141b57c2bbd2c6ce8ca6f4bed3f2b00 (patch) | |
tree | 218eeedfb68b9af80b02714d695e24e0effb0fbc /libgfortran/configure | |
parent | f58707cd85257fb6095cd0bceed1882f348f78d0 (diff) | |
download | gcc-a2c0dc0f1141b57c2bbd2c6ce8ca6f4bed3f2b00.tar.gz |
Use clock_gettime in libgfortran timing intrinsics, cleanup
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@169449 138bc75d-0d04-0410-961f-82ee72b054a4
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 b87210675a4..ec5c7ed999b 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 |