aboutsummaryrefslogtreecommitdiff
path: root/gcc/configure.ac
diff options
context:
space:
mode:
authorAndi Kleen <ak@gcc.gnu.org>2024-10-31 10:03:08 -0700
committerAndi Kleen <ak@gcc.gnu.org>2024-10-31 10:25:06 -0700
commitb23de8ec7694883b1c203e1f12e3ea6d249f23f8 (patch)
treef6a19a560dacb4374dd150fba490d489855602ae /gcc/configure.ac
parent1504073ad89f4dff7243dea608f385d3fa8cc89a (diff)
downloadgcc-b23de8ec7694883b1c203e1f12e3ea6d249f23f8.zip
gcc-b23de8ec7694883b1c203e1f12e3ea6d249f23f8.tar.gz
gcc-b23de8ec7694883b1c203e1f12e3ea6d249f23f8.tar.bz2
Add autoconf check for clock_gettime
Reported by Andrew Stubbs gcc/ChangeLog: * config.in: Regenerate. * configure: Regenerate. * configure.ac: Check for HAVE_CLOCK_GETTIME. * timevar.cc (get_time): Use HAVE_CLOCK_GETTIME.
Diffstat (limited to 'gcc/configure.ac')
-rw-r--r--gcc/configure.ac12
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/configure.ac b/gcc/configure.ac
index dc8346a..bdb22d5 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1557,7 +1557,17 @@ define(gcc_UNLOCKED_FUNCS, clearerr_unlocked feof_unlocked dnl
AC_CHECK_FUNCS(times clock kill getrlimit setrlimit atoq \
popen sysconf strsignal getrusage nl_langinfo \
gettimeofday mbstowcs wcswidth mmap posix_fallocate setlocale \
- gcc_UNLOCKED_FUNCS madvise mallinfo mallinfo2 fstatat getauxval)
+ gcc_UNLOCKED_FUNCS madvise mallinfo mallinfo2 fstatat getauxval \
+ clock_gettime)
+
+# 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.
+if test $ac_cv_func_clock_gettime = no; then
+ AC_CHECK_LIB(rt, clock_gettime,
+ [LIBS="-lrt $LIBS"
+ AC_DEFINE(HAVE_CLOCK_GETTIME, 1,
+ [Define to 1 if you have the `clock_gettime' function.])])
+fi
if test x$ac_cv_func_mbstowcs = xyes; then
AC_CACHE_CHECK(whether mbstowcs works, gcc_cv_func_mbstowcs_works,