diff options
author | Ian Lance Taylor <ian@airs.com> | 2009-11-06 15:47:06 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 2009-11-06 15:47:06 +0000 |
commit | 5d329b7db9afec533616070131d7bde5fe4b71fa (patch) | |
tree | bd5989a99f82204242b7612863579103c332f219 /gold | |
parent | dec397b2dec7738549bcb998dd64df8946bbd0d1 (diff) | |
download | gdb-5d329b7db9afec533616070131d7bde5fe4b71fa.zip gdb-5d329b7db9afec533616070131d7bde5fe4b71fa.tar.gz gdb-5d329b7db9afec533616070131d7bde5fe4b71fa.tar.bz2 |
* configure.ac: Check for (struct stat)::st_mtim
* fileread.cc (File_read::get_mtime): Use st_mtim if available.
* config.in: Regenerate.
* configure: Regenerate.
Diffstat (limited to 'gold')
-rw-r--r-- | gold/ChangeLog | 7 | ||||
-rw-r--r-- | gold/config.in | 3 | ||||
-rwxr-xr-x | gold/configure | 34 | ||||
-rw-r--r-- | gold/configure.ac | 12 | ||||
-rw-r--r-- | gold/fileread.cc | 6 |
5 files changed, 60 insertions, 2 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog index 63d12e4..c8210ba 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,10 @@ +2009-11-06 Mikolaj Zalewski <mikolaj@google.com> + + * configure.ac: Check for (struct stat)::st_mtim + * fileread.cc (File_read::get_mtime): Use st_mtim if available. + * config.in: Regenerate. + * configure: Regenerate. + 2009-11-05 Ian Lance Taylor <iant@google.com> PR 10910 diff --git a/gold/config.in b/gold/config.in index 93d7517..745510b 100644 --- a/gold/config.in +++ b/gold/config.in @@ -102,6 +102,9 @@ /* Define to 1 if you have the `readv' function. */ #undef HAVE_READV +/* Define if struct stat has a field st_mtim with timespec for mtime */ +#undef HAVE_STAT_ST_MTIM + /* Define to 1 if you have the <stdint.h> header file. */ #undef HAVE_STDINT_H diff --git a/gold/configure b/gold/configure index e4eb9fb..793af0d 100755 --- a/gold/configure +++ b/gold/configure @@ -6875,6 +6875,40 @@ $as_echo "#define HAVE_TEMPLATE_ATTRIBUTES 1" >>confdefs.h fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct stat::st_mtim." >&5 +$as_echo_n "checking for struct stat::st_mtim.... " >&6; } +if test "${gold_cv_stat_st_mtim+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include <sys/stat.h> +long bar() { struct stat s; return (long)(s.st_mtim.tv_sec + s.st_mtim.tv_sec);} + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + gold_cv_stat_st_mtim=yes +else + gold_cv_stat_st_mtim=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gold_cv_stat_st_mtim" >&5 +$as_echo "$gold_cv_stat_st_mtim" >&6; } +if test "$gold_cv_stat_st_mtim" = "yes"; then + +$as_echo "#define HAVE_STAT_ST_MTIM 1" >>confdefs.h + +fi + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' diff --git a/gold/configure.ac b/gold/configure.ac index 85e23f9..4307732 100644 --- a/gold/configure.ac +++ b/gold/configure.ac @@ -370,6 +370,18 @@ if test "$gold_cv_template_attribute" = "yes"; then [Define if attributes work on C++ templates]) fi +dnl Check if the system has struct stat::st_mtim. +AC_CACHE_CHECK([for struct stat::st_mtim.], +[gold_cv_stat_st_mtim], +[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include <sys/stat.h> +long bar() { struct stat s; return (long)(s.st_mtim.tv_sec + s.st_mtim.tv_sec);} +]])], [gold_cv_stat_st_mtim=yes], [gold_cv_stat_st_mtim=no])]) +if test "$gold_cv_stat_st_mtim" = "yes"; then + AC_DEFINE(HAVE_STAT_ST_MTIM, 1, + [Define if struct stat has a field st_mtim with timespec for mtime]) +fi + AC_LANG_POP(C++) AM_MAINTAINER_MODE diff --git a/gold/fileread.cc b/gold/fileread.cc index d183c57..ac30769 100644 --- a/gold/fileread.cc +++ b/gold/fileread.cc @@ -823,9 +823,11 @@ File_read::get_mtime() if (fstat(this->descriptor_, &file_stat) < 0) gold_fatal(_("%s: stat failed: %s"), this->name_.c_str(), strerror(errno)); - // TODO: do a configure check if st_mtim is present and get the - // nanoseconds part if it is. +#ifdef HAVE_STAT_ST_MTIM + return Timespec(file_stat.st_mtim.tv_sec, file_stat.st_mtim.tv_nsec); +#else return Timespec(file_stat.st_mtime, 0); +#endif } // Open the file. |