From: Fabian Groffen Date: Mon, 22 Oct 2007 09:10:10 +0000 (-0000) Subject: Patch from haubi to also compile on HPUX/ia64 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=b4abb49bd7aed3b986fbf3e85e6715667049e128;p=portage.git Patch from haubi to also compile on HPUX/ia64 svn path=/main/branches/prefix/; revision=8227 --- diff --git a/configure.in b/configure.in index eb5ba8321..87643d31d 100644 --- a/configure.in +++ b/configure.in @@ -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 + #include + #ifdef HAVE_FCNTL_H + #include + #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([ diff --git a/src/chpathtool.c b/src/chpathtool.c index b1295af04..0b16bcd6b 100644 --- a/src/chpathtool.c +++ b/src/chpathtool.c @@ -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));