Patch from haubi to also compile on HPUX/ia64
authorFabian Groffen <grobian@gentoo.org>
Mon, 22 Oct 2007 09:10:10 +0000 (09:10 -0000)
committerFabian Groffen <grobian@gentoo.org>
Mon, 22 Oct 2007 09:10:10 +0000 (09:10 -0000)
svn path=/main/branches/prefix/; revision=8227

configure.in
src/chpathtool.c

index eb5ba83217e8be406318928f72d1e85809214a55..87643d31d4b54dab3f746fc7bb0f1a8a33b17e3c 100644 (file)
@@ -52,7 +52,10 @@ 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 alloca.h])
 AC_CHECK_HEADERS([fcntl.h])
 
-AC_CHECK_LIB([c], [readdir])
+AC_SEARCH_LIBS([readdir], [c])
+AC_SEARCH_LIBS([strcpy], [c])
+AC_SEARCH_LIBS([strstr], [c])
+AC_SEARCH_LIBS([memcpy], [c])
 
 AC_MSG_CHECKING([for the *time fields in struct stat])
 AC_TRY_LINK([
@@ -66,8 +69,10 @@ AC_TRY_LINK([
                         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_DEFINE(ATIME_SEC, st_atimespec.tv_sec, [atime seconds for this platform])
+                        AC_DEFINE(ATIME_NSEC, st_atimespec.tv_nsec, [atime nanoseconds for this platform])
+                        AC_DEFINE(MTIME_SEC, st_mtimespec.tv_sec, [mtime seconds for this platform])
+                        AC_DEFINE(MTIME_NSEC, st_mtimespec.tv_nsec, [mtime nanoseconds for this platform])
                         AC_MSG_RESULT([st_*timespec])
                 ], [
 AC_TRY_LINK([
@@ -81,15 +86,34 @@ AC_TRY_LINK([
                         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_DEFINE(ATIME_SEC, st_atim, [atime seconds for this platform])
+                        AC_DEFINE(ATIME_NSEC, st_atim.tv_nsec, [atime nanoseconds for this platform])
+                        AC_DEFINE(MTIME_SEC, st_mtim, [mtime seconds for this platform])
+                        AC_DEFINE(MTIME_NSEC, st_mtim.tv_nsec, [mtime nanoseconds for this platform])
                         AC_MSG_RESULT([st_*tim])
-                ]
-)
+                ], [
+AC_TRY_LINK([
+                        #include <sys/types.h>
+                        #include <sys/stat.h>
+                        #ifdef HAVE_FCNTL_H
+                        #include <fcntl.h>
+                        #endif
+                ], [
+                        struct stat s;
+                        s.st_atime = 0;
+                        s.st_mtime = 0;
+                ], [
+                        AC_DEFINE(ATIME_SEC, st_atime, [atime seconds for this platform])
+                        AC_DEFINE(MTIME_SEC, st_mtime, [mtime seconds for this platform])
+                        AC_MSG_RESULT([st_*time])
                 ], [
                        AC_MSG_ERROR([cannot determine])
                 ]
 )
+                ]
+)
+                ]
+)
 
 AC_MSG_CHECKING([if S_ISWHT can be used])
 AC_TRY_LINK([
index b1295af040da0bb60d0a162198e5ad145eafaf54..0b16bcd6b1da2ce299e6f50f3e321ebdb2607534 100644 (file)
@@ -256,10 +256,18 @@ int dirwalk(char *src, char *srcp, char *trg, char *trgp) {
                                                trg, strerror(errno));
                                return(-1);
                        }
-                       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;
+                       times[0].tv_sec = s.ATIME_SEC;
+#ifdef ATIME_NSEC
+                       times[0].tv_usec = (s.ATIME_NSEC) / 1000;
+#else
+                       times[0].tv_usec = 0;
+#endif
+                       times[1].tv_sec = s.MTIME_SEC;
+#ifdef MTIME_NSEC
+                       times[1].tv_usec = (s.MTIME_NSEC) / 1000;
+#else
+                       times[1].tv_usec = 0;
+#endif
                        if (utimes(trg, times) != 0) {
                                fprintf(stderr, "failed to set utimes of %s: %s\n",
                                                trg, strerror(errno));
@@ -328,10 +336,18 @@ int dirwalk(char *src, char *srcp, char *trg, char *trgp) {
                                trg, strerror(errno));
                return(-1);
        }
-       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;
+       times[0].tv_sec = s.ATIME_SEC;
+#ifdef ATIME_NSEC
+       times[0].tv_usec = (s.ATIME_NSEC) / 1000;
+#else
+       times[0].tv_usec = 0;
+#endif
+       times[1].tv_sec = s.MTIME_SEC;
+#ifdef MTIME_NSEC
+       times[1].tv_usec = (s.MTIME_NSEC) / 1000;
+#else
+       times[1].tv_usec = 0;
+#endif
        if (utimes(trg, times) != 0) {
                fprintf(stderr, "failed to set utimes of %s: %s\n",
                                trg, strerror(errno));