dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([string.h strings.h errno.h unistd.h stdio.h stdlib.h])
-AC_CHECK_HEADERS([sys/stat.h sys/types.h dirent.h sys/time.h])
+AC_CHECK_HEADERS([sys/stat.h sys/types.h dirent.h sys/time.h alloca.h])
+AC_CHECK_HEADERS([fcntl.h])
AC_CHECK_LIB([c], [readdir])
AC_CHECK_LIB([c], [strcpy])
AC_CHECK_LIB([c], [strstr])
AC_CHECK_LIB([c], [memcpy])
+AC_TRY_LINK([
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #ifdef HAVE_FCNTL_H
+ #include <fcntl.h>
+ #endif
+ ], [
+ struct stat s;
+ s.st_atimespec.tv_sec = 0;
+ s.st_mtimespec.tv_sec = 0;
+ ], [
+ AC_DEFINE(ATIMESPEC, st_atimespec, [atime for this platform])
+ AC_DEFINE(MTIMESPEC, st_mtimespec, [mtime for this platform])
+ ], [
+AC_TRY_LINK([
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #ifdef HAVE_FCNTL_H
+ #include <fcntl.h>
+ #endif
+ ], [
+ struct stat s;
+ s.st_atim.tv_sec = 0;
+ s.st_mtim.tv_sec = 0;
+ ], [
+ AC_DEFINE(ATIMESPEC, st_atim, [atime for this platform])
+ AC_DEFINE(MTIMESPEC, st_mtim, [mtime for this platform])
+ ]
+)
+ ]
+)
+
AC_ARG_ENABLE(tbz2tool,
AC_HELP_STRING([--enable-tbz2tool],[build tbz2tool, tool for creating binpkgs (default yes)]),
[case "${enableval}" in
#include <alloca.h>
#endif
#include <sys/time.h>
+#include <fcntl.h>
/* Don't allocate too much, or you'll be paying for waiting on IO,
* size -1 to align in memory. */
trg, strerror(errno));
return(-1);
}
- times[0].tv_sec = s.st_atimespec.tv_sec;
- times[0].tv_usec = s.st_atimespec.tv_nsec;
- times[1].tv_sec = s.st_mtimespec.tv_sec;
- times[1].tv_usec = s.st_mtimespec.tv_nsec;
+ times[0].tv_sec = s.ATIMESPEC.tv_sec;
+ times[0].tv_usec = s.ATIMESPEC.tv_nsec;
+ times[1].tv_sec = s.MTIMESPEC.tv_sec;
+ times[1].tv_usec = s.MTIMESPEC.tv_nsec;
if (utimes(trg, times) != 0) {
fprintf(stderr, "failed to set utimes of %s: %s\n",
trg, strerror(errno));
trg, strerror(errno));
return(-1);
}
- times[0].tv_sec = s.st_atimespec.tv_sec;
- times[0].tv_usec = s.st_atimespec.tv_nsec;
- times[1].tv_sec = s.st_mtimespec.tv_sec;
- times[1].tv_usec = s.st_mtimespec.tv_nsec;
+ times[0].tv_sec = s.ATIMESPEC.tv_sec;
+ times[0].tv_usec = s.ATIMESPEC.tv_nsec;
+ times[1].tv_sec = s.MTIMESPEC.tv_sec;
+ times[1].tv_usec = s.MTIMESPEC.tv_nsec;
if (utimes(trg, times) != 0) {
fprintf(stderr, "failed to set utimes of %s: %s\n",
trg, strerror(errno));