From: Fabian Groffen Date: Sat, 13 Oct 2007 14:29:13 +0000 (-0000) Subject: Solaris is slightly different, use configure to find out what we need. X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=d5c4d278d3a450b74117e887aa679fd166fa9a1d;p=portage.git Solaris is slightly different, use configure to find out what we need. We compile on Darwin, Solaris and FreeBSD now. Probably Linux breaks. svn path=/main/branches/prefix/; revision=8112 --- diff --git a/configure.in b/configure.in index cb92f2514..c23cc011b 100644 --- a/configure.in +++ b/configure.in @@ -49,13 +49,46 @@ GENTOO_PATH_GNUPROG(GREP, [grep]) 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 + #include + #ifdef HAVE_FCNTL_H + #include + #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 + #include + #ifdef HAVE_FCNTL_H + #include + #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 diff --git a/src/chpathtool.c b/src/chpathtool.c index 07c1d256a..032032def 100644 --- a/src/chpathtool.c +++ b/src/chpathtool.c @@ -25,6 +25,7 @@ #include #endif #include +#include /* Don't allocate too much, or you'll be paying for waiting on IO, * size -1 to align in memory. */ @@ -255,10 +256,10 @@ int dirwalk(char *src, char *srcp, char *trg, char *trgp) { 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)); @@ -327,10 +328,10 @@ int dirwalk(char *src, char *srcp, char *trg, char *trgp) { 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));