+1998-05-14 Jim Meyering <meyering@ascend.com>
+
+ * Makefile.am (EXTRA_DIST): Add them.
+ * jm-macros.m4: New file.
+ * utimbuf.m4: New file.
+
1998-05-12 Jim Meyering <meyering@ascend.com>
* Makefile.am (EXTRA_DIST): Add isc-posix.m4.
# find . -type f -name '*.m4' -printf '%f\n'|sort |fmt |tr '\012' @ \
# |sed 's/@$/%/;s/@/ \\@/g' |tr @% '\012\012'
EXTRA_DIST = README \
-isc-posix.m4 \
-assert.m4 check-decl.m4 chown.m4 const.m4 d-ino.m4 d-type.m4 decl.m4 error.m4 \
-getgroups.m4 getline.m4 getloadavg.m4 inttypes_h.m4 jm-mktime.m4 jm-winsz1.m4 \
-jm-winsz2.m4 lfs.m4 lstat.m4 malloc.m4 memcmp.m4 perl.m4 prereq.m4 putenv.m4 \
-readdir.m4 realloc.m4 ssize_t.m4 stat.m4 strftime.m4 uintmax_t.m4 uptime.m4
+assert.m4 check-decl.m4 chown.m4 const.m4 d-ino.m4 d-type.m4 decl.m4 \
+error.m4 getgroups.m4 getline.m4 getloadavg.m4 inttypes_h.m4 isc-posix.m4 \
+jm-macros.m4 jm-mktime.m4 jm-winsz1.m4 jm-winsz2.m4 lfs.m4 lstat.m4 \
+malloc.m4 memcmp.m4 perl.m4 prereq.m4 putenv.m4 readdir.m4 realloc.m4 \
+ssize_t.m4 stat.m4 strftime.m4 uintmax_t.m4 uptime.m4 utimbuf.m4
l = @l@
EXTRA_DIST = README \
-isc-posix.m4 \
-assert.m4 check-decl.m4 chown.m4 const.m4 d-ino.m4 d-type.m4 decl.m4 error.m4 \
-getgroups.m4 getline.m4 getloadavg.m4 inttypes_h.m4 jm-mktime.m4 jm-winsz1.m4 \
-jm-winsz2.m4 lfs.m4 lstat.m4 malloc.m4 memcmp.m4 perl.m4 prereq.m4 putenv.m4 \
-readdir.m4 realloc.m4 ssize_t.m4 stat.m4 strftime.m4 uintmax_t.m4 uptime.m4
+assert.m4 check-decl.m4 chown.m4 const.m4 d-ino.m4 d-type.m4 decl.m4 \
+error.m4 getgroups.m4 getline.m4 getloadavg.m4 inttypes_h.m4 isc-posix.m4 \
+jm-macros.m4 jm-mktime.m4 jm-winsz1.m4 jm-winsz2.m4 lfs.m4 lstat.m4 \
+malloc.m4 memcmp.m4 perl.m4 prereq.m4 putenv.m4 readdir.m4 realloc.m4 \
+ssize_t.m4 stat.m4 strftime.m4 uintmax_t.m4 uptime.m4 utimbuf.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES =
--- /dev/null
+#serial 1
+
+dnl Misc type-related macros for fileutils, sh-utils, textutils.
+
+AC_DEFUN(jm_MACROS,
+[
+ dnl This macro actually runs replacement code. See isc-posix.m4.
+ AC_REQUIRE([AC_ISC_POSIX])dnl
+
+ AC_REQUIRE([jm_ASSERT])
+ AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
+ AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
+ AC_REQUIRE([jm_TYPE_SSIZE_T])
+ AC_REQUIRE([jm_STRUCT_UTIMBUF])
+ AC_REQUIRE([jm_STRUCT_DIRENT_D_TYPE])
+ AC_REQUIRE([jm_STRUCT_DIRENT_D_INO])
+ AC_REQUIRE([jm_CHECK_DECLS])
+
+ AC_REQUIRE([jm_PREREQ])
+
+ AC_REQUIRE([jm_FUNC_CHOWN])
+ AC_REQUIRE([jm_FUNC_GNU_STRFTIME])
+ AC_REQUIRE([jm_FUNC_MKTIME])
+ AC_REQUIRE([jm_FUNC_LSTAT])
+ AC_REQUIRE([jm_FUNC_STAT])
+ AC_REQUIRE([jm_FUNC_REALLOC])
+ AC_REQUIRE([jm_FUNC_MALLOC])
+ AC_REQUIRE([jm_FUNC_READDIR])
+ AC_REQUIRE([jm_FUNC_MEMCMP])
+])
--- /dev/null
+#serial 1
+
+dnl From Jim Meyering
+
+dnl Define HAVE_STRUCT_UTIMBUF if `struct utimbuf' is declared --
+dnl usually in <utime.h>.
+dnl Some systems have utime.h but don't declare the struct anywhere.
+
+AC_DEFUN(jm_STRUCT_UTIMBUF,
+[
+ AC_CHECK_HEADERS(utime.h)
+ AC_REQUIRE([AC_HEADER_TIME])
+ AC_CACHE_CHECK([for struct utimbuf], fu_cv_sys_struct_utimbuf,
+ [AC_TRY_COMPILE(
+ [
+#ifdef TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+#ifdef HAVE_UTIME_H
+# include <utime.h>
+#endif
+ ],
+ [static struct utimbuf x; x.actime = x.modtime;],
+ fu_cv_sys_struct_utimbuf=yes,
+ fu_cv_sys_struct_utimbuf=no)
+ ])
+
+ if test $fu_cv_sys_struct_utimbuf = 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 maintain the #undef in acconfig.h manually.
+ AC_CHECK_FUNCS(STRUCT_UTIMBUF)
+ 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_STRUCT_UTIMBUF
+ AC_DEFINE_UNQUOTED($ac_kludge)
+ fi
+])