Mercurial > hg > octave-kai > gnulib-hg
changeset 1482:16e4e7a4526c
(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.
author | Jim Meyering <jim@meyering.net> |
---|---|
date | Sun, 30 Aug 1998 03:16:57 +0000 |
parents | 38288e14e209 |
children | d6fda9f41cc0 |
files | m4/st_mtim.m4 |
diffstat | 1 files changed, 23 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- 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. - -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)]) +# Define ST_MTIM_NSEC to be the nanoseconds member of struct stat's st_mtim, +# if it exists. - 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) +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_nsec != no; then + AC_DEFINE_UNQUOTED(ST_MTIM_NSEC, $ac_cv_struct_st_mtim_nsec) fi ] )