mirror of
https://github.com/gcc-mirror/gcc.git
synced 2024-11-21 13:40:47 +00:00
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.
This commit is contained in:
parent
1504073ad8
commit
b23de8ec76
@ -883,6 +883,12 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `clock_gettime' function. */
|
||||||
|
#ifndef USED_FOR_TARGET
|
||||||
|
#undef HAVE_CLOCK_GETTIME
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Define if <time.h> defines clock_t. */
|
/* Define if <time.h> defines clock_t. */
|
||||||
#ifndef USED_FOR_TARGET
|
#ifndef USED_FOR_TARGET
|
||||||
#undef HAVE_CLOCK_T
|
#undef HAVE_CLOCK_T
|
||||||
|
55
gcc/configure
vendored
55
gcc/configure
vendored
@ -10613,7 +10613,8 @@ fi
|
|||||||
for ac_func in times clock kill getrlimit setrlimit atoq \
|
for ac_func in times clock kill getrlimit setrlimit atoq \
|
||||||
popen sysconf strsignal getrusage nl_langinfo \
|
popen sysconf strsignal getrusage nl_langinfo \
|
||||||
gettimeofday mbstowcs wcswidth mmap posix_fallocate setlocale \
|
gettimeofday mbstowcs wcswidth mmap posix_fallocate setlocale \
|
||||||
clearerr_unlocked feof_unlocked ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked putchar_unlocked putc_unlocked madvise mallinfo mallinfo2 fstatat getauxval
|
clearerr_unlocked feof_unlocked ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked putchar_unlocked putc_unlocked madvise mallinfo mallinfo2 fstatat getauxval \
|
||||||
|
clock_gettime
|
||||||
do :
|
do :
|
||||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||||
ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||||
@ -10626,6 +10627,54 @@ fi
|
|||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
# 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
|
||||||
|
{ $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_cxx_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 :
|
||||||
|
LIBS="-lrt $LIBS"
|
||||||
|
|
||||||
|
$as_echo "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
if test x$ac_cv_func_mbstowcs = xyes; then
|
if test x$ac_cv_func_mbstowcs = xyes; then
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mbstowcs works" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mbstowcs works" >&5
|
||||||
$as_echo_n "checking whether mbstowcs works... " >&6; }
|
$as_echo_n "checking whether mbstowcs works... " >&6; }
|
||||||
@ -21405,7 +21454,7 @@ else
|
|||||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||||
lt_status=$lt_dlunknown
|
lt_status=$lt_dlunknown
|
||||||
cat > conftest.$ac_ext <<_LT_EOF
|
cat > conftest.$ac_ext <<_LT_EOF
|
||||||
#line 21408 "configure"
|
#line 21457 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
|
|
||||||
#if HAVE_DLFCN_H
|
#if HAVE_DLFCN_H
|
||||||
@ -21511,7 +21560,7 @@ else
|
|||||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||||
lt_status=$lt_dlunknown
|
lt_status=$lt_dlunknown
|
||||||
cat > conftest.$ac_ext <<_LT_EOF
|
cat > conftest.$ac_ext <<_LT_EOF
|
||||||
#line 21514 "configure"
|
#line 21563 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
|
|
||||||
#if HAVE_DLFCN_H
|
#if HAVE_DLFCN_H
|
||||||
|
@ -1557,7 +1557,17 @@ define(gcc_UNLOCKED_FUNCS, clearerr_unlocked feof_unlocked dnl
|
|||||||
AC_CHECK_FUNCS(times clock kill getrlimit setrlimit atoq \
|
AC_CHECK_FUNCS(times clock kill getrlimit setrlimit atoq \
|
||||||
popen sysconf strsignal getrusage nl_langinfo \
|
popen sysconf strsignal getrusage nl_langinfo \
|
||||||
gettimeofday mbstowcs wcswidth mmap posix_fallocate setlocale \
|
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
|
if test x$ac_cv_func_mbstowcs = xyes; then
|
||||||
AC_CACHE_CHECK(whether mbstowcs works, gcc_cv_func_mbstowcs_works,
|
AC_CACHE_CHECK(whether mbstowcs works, gcc_cv_func_mbstowcs_works,
|
||||||
|
@ -158,7 +158,7 @@ get_time (struct timevar_time_def *now)
|
|||||||
now->wall = 0;
|
now->wall = 0;
|
||||||
now->ggc_mem = timevar_ggc_mem_total;
|
now->ggc_mem = timevar_ggc_mem_total;
|
||||||
|
|
||||||
#if _POSIX_C_SOURCE >= 199309L
|
#ifdef HAVE_CLOCK_GETTIME
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
clock_gettime (CLOCK_MONOTONIC, &ts);
|
clock_gettime (CLOCK_MONOTONIC, &ts);
|
||||||
now->wall = ts.tv_sec * 1000000000 + ts.tv_nsec;
|
now->wall = ts.tv_sec * 1000000000 + ts.tv_nsec;
|
||||||
|
Loading…
Reference in New Issue
Block a user