diff options
author | Jim Meyering <jim@meyering.net> | 1998-08-30 03:16:57 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1998-08-30 03:16:57 +0000 |
commit | 4d87b9a10e532d7e732067247b422994985193d8 (patch) | |
tree | 308580fb3389c247497868a6eda77aaec0a2ecf0 | |
parent | 8fd24dfea93379eb45b55933667d30508805d81f (diff) | |
download | coreutils-4d87b9a10e532d7e732067247b422994985193d8.tar.xz |
(AC_STRUCT_ST_MTIM_NSEC): Renamed from AC_STRUCT_ST_MTIM.
(AC_STRUCT_ST_MTIM_NSEC): Generate name of ns member, instead of just 1 or undef.
Allow for UnixWare 2.1.2 and Solaris 2.6 if in pedantic mode.
-rw-r--r-- | m4/st_mtim.m4 | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/m4/st_mtim.m4 b/m4/st_mtim.m4 index 6a4c5b4b4..ed19c3d71 100644 --- a/m4/st_mtim.m4 +++ b/m4/st_mtim.m4 @@ -1,29 +1,30 @@ -#serial 2 +#serial 3 dnl From Paul Eggert. -# Define HAVE_ST_MTIM if struct stat has an st_mtim member. +# Define ST_MTIM_NSEC to be the nanoseconds member of struct stat's st_mtim, +# if it exists. -AC_DEFUN(AC_STRUCT_ST_MTIM, - [AC_CACHE_CHECK([for st_mtim in struct stat], ac_cv_struct_st_mtim, - [AC_TRY_COMPILE([#include <sys/types.h> -#include <sys/stat.h>], [struct stat s; s.st_mtim;], - ac_cv_struct_st_mtim=yes, - ac_cv_struct_st_mtim=no)]) +AC_DEFUN(AC_STRUCT_ST_MTIM_NSEC, + [AC_CACHE_CHECK([for nanoseconds member of struct stat.st_mtim], + ac_cv_struct_st_mtim_nsec, + [ac_save_CPPFLAGS="$CPPFLAGS" + ac_cv_struct_st_mtim_nsec=no + # tv_nsec -- the usual case + # _tv_nsec -- Solaris 2.6, if + # (defined _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED == 1 + # && !defined __EXTENSIONS__) + # st__tim.tv_nsec -- UnixWare 2.1.2 + for ac_val in tv_nsec _tv_nsec st__tim.tv_nsec; do + CPPFLAGS="$ac_save_CPPFLAGS -DST_MTIM_NSEC=$ac_val" + AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/stat.h>], [struct stat s; s.st_mtim.ST_MTIM_NSEC;], + [ac_cv_struct_st_mtim_nsec=$ac_val; break]) + done + CPPFLAGS="$ac_save_CPPFLAGS"]) - if test $ac_cv_struct_st_mtim = yes; then - if test x = y; then - # This code is deliberately never run via ./configure. - # FIXME: this is a hack to make autoheader put the corresponding - # HAVE_* undef for this symbol in config.h.in. This saves me the - # trouble of having to add the #undef in acconfig.h manually. - AC_CHECK_FUNCS(ST_MTIM) - fi - # Defining it this way (rather than via AC_DEFINE) short-circuits the - # autoheader check -- autoheader doesn't know it's already been taken - # care of by the hack above. - ac_kludge=HAVE_ST_MTIM - AC_DEFINE_UNQUOTED($ac_kludge) + if test $ac_cv_struct_st_mtim_nsec != no; then + AC_DEFINE_UNQUOTED(ST_MTIM_NSEC, $ac_cv_struct_st_mtim_nsec) fi ] ) |