diff options
author | wtc%netscape.com <devnull@localhost> | 1998-10-08 21:31:09 +0000 |
---|---|---|
committer | wtc%netscape.com <devnull@localhost> | 1998-10-08 21:31:09 +0000 |
commit | 34cef88189d1eed5fb9a7fd29d8e8b901d44b081 (patch) | |
tree | 1d3141a95dceec0d631165818ee026c9f8965100 | |
parent | b983762245f1aa5ca23958bb15e08cbfcc32af23 (diff) | |
download | nspr-hg-MozillaSourceClassic_19981026_BASE.tar.gz |
Ports to many Unix variants. Added the OMIT_LIB_BUILD_TIME workaroundMozillaSourceClassic_19981026_BASEMozillaClassicLayout_19981021INCLUDE_SPRINGCLEANING_BASE
for platforms that don't have 'long long'. In pr/src/Makefile and
lib/libc/src/Makefile, use single quotes so that we can avoid
using backslashes in double quotes (that doesn't work under
MKS shell).
-rw-r--r-- | config/Makefile | 7 | ||||
-rw-r--r-- | config/UNIXWARE.mk | 11 | ||||
-rw-r--r-- | config/now.c | 29 | ||||
-rw-r--r-- | lib/libc/src/Makefile | 12 | ||||
-rw-r--r-- | lib/libc/src/plvrsion.c | 4 | ||||
-rw-r--r-- | pr/include/md/_aix.h | 5 | ||||
-rw-r--r-- | pr/include/md/_ncr.h | 2 | ||||
-rw-r--r-- | pr/include/md/_nec.h | 4 | ||||
-rw-r--r-- | pr/include/md/_scoos.h | 2 | ||||
-rw-r--r-- | pr/include/md/_unixware.h | 1 | ||||
-rw-r--r-- | pr/src/Makefile | 11 | ||||
-rw-r--r-- | pr/src/md/unix/unix.c | 42 | ||||
-rw-r--r-- | pr/src/prvrsion.c | 4 |
13 files changed, 109 insertions, 25 deletions
diff --git a/config/Makefile b/config/Makefile index f3e19971..e8002edf 100644 --- a/config/Makefile +++ b/config/Makefile @@ -31,6 +31,13 @@ else PROG_SUFFIX = endif +# Temporary workaround to disable the generation of +# library build time because now.c uses the 'long long' +# data type that's not available on some platforms. +ifeq (,$(filter-out NEC SCOOS UNIXWARE,$(OS_ARCH))) +DEFINES += -DOMIT_LIB_BUILD_TIME +endif + ifeq ($(OS_ARCH), IRIX) ifeq ($(basename $(OS_RELEASE)),6) ifeq ($(USE_N32),1) diff --git a/config/UNIXWARE.mk b/config/UNIXWARE.mk index f15a5a41..6403efa7 100644 --- a/config/UNIXWARE.mk +++ b/config/UNIXWARE.mk @@ -27,14 +27,25 @@ include $(MOD_DEPTH)/config/UNIX.mk +ifeq ($(OS_RELEASE),7) +CC = cc +CCC = CC +else CC = $(NSDEPTH)/build/hcc CCC = $(NSDEPTH)/build/hcpp +endif RANLIB = true DEFINES += -D_PR_LOCAL_THREADS_ONLY OS_CFLAGS = -DSVR4 -DSYSV -DUNIXWARE +ifeq ($(OS_RELEASE),7) +OS_CFLAGS += -D_LARGEFILE64_SOURCE -D_PR_HAVE_OFF64_T -D_PR_HAVE_SOCKADDR_LEN +else +OS_CFLAGS += -D_PR_NO_LARGE_FILES +endif + MKSHLIB = $(LD) $(DSO_LDOPTS) DSO_LDOPTS = -G diff --git a/config/now.c b/config/now.c index 0f270d98..a58c1a63 100644 --- a/config/now.c +++ b/config/now.c @@ -30,15 +30,30 @@ int main(int argc, char **argv) { -#if defined(XP_UNIX) - long long now; - struct timeval tv; +#if defined(OMIT_LIB_BUILD_TIME) + /* + * Some platforms don't have any 64-bit integer type + * such as 'long long'. Because we can't use NSPR's + * PR_snprintf in this program, it is difficult to + * print a static initializer for PRInt64 (a struct). + * So we print nothing. The makefiles that build the + * shared libraries will detect the empty output string + * of this program and omit the library build time + * in PRVersionDescription. + */ +#elif defined(XP_UNIX) + long long now; + struct timeval tv; +#ifdef HAVE_SVID_GETTOD + gettimeofday(&tv); +#else gettimeofday(&tv, NULL); +#endif now = ((1000000LL) * tv.tv_sec) + (long long)tv.tv_usec; #if defined(OSF1) - return fprintf(stdout, "%ld", now); + fprintf(stdout, "%ld", now); #else - return fprintf(stdout, "%lld", now); + fprintf(stdout, "%lld", now); #endif #elif defined(WIN32) @@ -48,10 +63,12 @@ int main(int argc, char **argv) now = b.time; now *= 1000000; now += (1000 * b.millitm); - return fprintf(stdout, "%I64d", now); + fprintf(stdout, "%I64d", now); #else #error "Architecture not supported" #endif + + return 0; } /* main */ /* now.c */ diff --git a/lib/libc/src/Makefile b/lib/libc/src/Makefile index e8550b9e..9c7fe4ea 100644 --- a/lib/libc/src/Makefile +++ b/lib/libc/src/Makefile @@ -99,9 +99,7 @@ include $(MOD_DEPTH)/config/rules.mk # # Version information generation (begin) # -RM = rm ECHO = echo -INCLUDES = -I$(DIST)/include TINC = $(OBJDIR)/_pl_bld.h PROD = libplc$(MOD_VERSION).$(DLL_SUFFIX) NOW = $(MOD_DEPTH)/config/$(OBJDIR)/now @@ -110,17 +108,17 @@ SH_NOW = $(shell $(NOW)) ifeq ($(OS_ARCH), WINNT) SUF = i64 - SH_QUOTE = else SUF = LL - SH_QUOTE = " endif $(TINC): @$(MAKE_OBJDIR) - @$(ECHO) $(SH_QUOTE)#define _BUILD_STRING \"$(SH_DATE)\"$(SH_QUOTE) > $(TINC) - @$(ECHO) $(SH_QUOTE)#define _BUILD_TIME $(SH_NOW)$(SUF)$(SH_QUOTE) >> $(TINC) - @$(ECHO) $(SH_QUOTE)#define _PRODUCTION \"$(PROD)\"$(SH_QUOTE) >> $(TINC) + @$(ECHO) '#define _BUILD_STRING "$(SH_DATE)"' > $(TINC) + @if test ! -z "$(SH_NOW)"; then \ + $(ECHO) '#define _BUILD_TIME $(SH_NOW)$(SUF)' >> $(TINC); \ + fi + @$(ECHO) '#define _PRODUCTION "$(PROD)"' >> $(TINC) $(OBJDIR)/plvrsion.$(OBJ_SUFFIX): $(TINC) diff --git a/lib/libc/src/plvrsion.c b/lib/libc/src/plvrsion.c index ea3b9c8b..2f803dcf 100644 --- a/lib/libc/src/plvrsion.c +++ b/lib/libc/src/plvrsion.c @@ -24,7 +24,11 @@ /************************************************************************/ #include "_pl_bld.h" #if !defined(_BUILD_TIME) +#ifdef HAVE_LONG_LONG #define _BUILD_TIME 0 +#else +#define _BUILD_TIME {0, 0} +#endif #endif #if !defined(_BUILD_STRING) #define _BUILD_STRING "" diff --git a/pr/include/md/_aix.h b/pr/include/md/_aix.h index cc7906c8..4ba958ea 100644 --- a/pr/include/md/_aix.h +++ b/pr/include/md/_aix.h @@ -25,13 +25,10 @@ #endif /* - * To pick up fd_set. In AIX 4.2, fd_set is defined in <sys/time.h>, - * which is included by _unixos.h. + * To pick up fd_set and the poll events. */ -#ifdef AIX4_1 #include <sys/select.h> #include <sys/poll.h> -#endif /* * Internal configuration macros diff --git a/pr/include/md/_ncr.h b/pr/include/md/_ncr.h index 82a84e63..2c5ebb0d 100644 --- a/pr/include/md/_ncr.h +++ b/pr/include/md/_ncr.h @@ -47,6 +47,8 @@ #define _PR_POLL_AVAILABLE #define _PR_USE_POLL +#define _PR_NO_LARGE_FILES +#define _PR_STAT_HAS_ST_ATIM_UNION #undef HAVE_STACK_GROWING_UP #define HAVE_NETCONFIG diff --git a/pr/include/md/_nec.h b/pr/include/md/_nec.h index 8c5e5b5e..6833f505 100644 --- a/pr/include/md/_nec.h +++ b/pr/include/md/_nec.h @@ -37,6 +37,10 @@ #define USE_DLFCN #define NEED_TIME_R #define NEED_STRFTIME_LOCK +#define _PR_POLL_AVAILABLE +#define _PR_USE_POLL +#define _PR_NO_LARGE_FILES +#define _PR_STAT_HAS_ST_ATIM_UNION #include <ucontext.h> #include <sys/regset.h> diff --git a/pr/include/md/_scoos.h b/pr/include/md/_scoos.h index faa8e9ff..515cd233 100644 --- a/pr/include/md/_scoos.h +++ b/pr/include/md/_scoos.h @@ -47,6 +47,8 @@ #define _PR_POLL_AVAILABLE #define _PR_USE_POLL +#define _PR_NO_LARGE_FILES +#define _PR_STAT_HAS_ONLY_ST_ATIME #define NEED_STRFTIME_LOCK #define NEED_TIME_R diff --git a/pr/include/md/_unixware.h b/pr/include/md/_unixware.h index b1ce660a..8d8828c2 100644 --- a/pr/include/md/_unixware.h +++ b/pr/include/md/_unixware.h @@ -38,6 +38,7 @@ #endif #define _PR_POLL_AVAILABLE #define _PR_USE_POLL +#define _PR_STAT_HAS_ST_ATIM_UNION #undef HAVE_STACK_GROWING_UP #define HAVE_NETCONFIG diff --git a/pr/src/Makefile b/pr/src/Makefile index e799af79..f718e85d 100644 --- a/pr/src/Makefile +++ b/pr/src/Makefile @@ -310,7 +310,6 @@ endif # # Version information generation (begin) # -RM = rm ECHO = echo INCLUDES = -I$(DIST)/include TINC = $(OBJDIR)/_pr_bld.h @@ -321,17 +320,17 @@ SH_NOW = $(shell $(NOW)) ifeq ($(OS_ARCH), WINNT) SUF = i64 - SH_QUOTE = else SUF = LL - SH_QUOTE = " endif $(TINC): @$(MAKE_OBJDIR) - @$(ECHO) $(SH_QUOTE)#define _BUILD_STRING \"$(SH_DATE)\"$(SH_QUOTE) > $(TINC) - @$(ECHO) $(SH_QUOTE)#define _BUILD_TIME $(SH_NOW)$(SUF)$(SH_QUOTE) >> $(TINC) - @$(ECHO) $(SH_QUOTE)#define _PRODUCTION \"$(PROD)\"$(SH_QUOTE) >> $(TINC) + @$(ECHO) '#define _BUILD_STRING "$(SH_DATE)"' > $(TINC) + @if test ! -z "$(SH_NOW)"; then \ + $(ECHO) '#define _BUILD_TIME $(SH_NOW)$(SUF)' >> $(TINC); \ + fi + @$(ECHO) '#define _PRODUCTION "$(PROD)"' >> $(TINC) $(OBJDIR)/prvrsion.$(OBJ_SUFFIX): $(TINC) diff --git a/pr/src/md/unix/unix.c b/pr/src/md/unix/unix.c index 57d167ba..62de2cab 100644 --- a/pr/src/md/unix/unix.c +++ b/pr/src/md/unix/unix.c @@ -2260,6 +2260,44 @@ static void _MD_set_fileinfo64_times( info->creationTime = ((PRTime)sb->st_ctim.tv_sec * PR_USEC_PER_SEC); info->creationTime += (sb->st_ctim.tv_nsec / 1000); } +#elif defined(_PR_STAT_HAS_ST_ATIM_UNION) +/* +** The st_atim, st_mtim, and st_ctim fields in struct stat are +** unions with a st__tim union member of type timestruc_t. +*/ +static void _MD_set_fileinfo_times( + const struct stat *sb, + PRFileInfo *info) +{ + PRInt64 us, s2us; + + LL_I2L(s2us, PR_USEC_PER_SEC); + LL_I2L(info->modifyTime, sb->st_mtim.st__tim.tv_sec); + LL_MUL(info->modifyTime, info->modifyTime, s2us); + LL_I2L(us, sb->st_mtim.st__tim.tv_nsec / 1000); + LL_ADD(info->modifyTime, info->modifyTime, us); + LL_I2L(info->creationTime, sb->st_ctim.st__tim.tv_sec); + LL_MUL(info->creationTime, info->creationTime, s2us); + LL_I2L(us, sb->st_ctim.st__tim.tv_nsec / 1000); + LL_ADD(info->creationTime, info->creationTime, us); +} + +static void _MD_set_fileinfo64_times( + const _MDStat64 *sb, + PRFileInfo64 *info) +{ + PRInt64 us, s2us; + + LL_I2L(s2us, PR_USEC_PER_SEC); + LL_I2L(info->modifyTime, sb->st_mtim.st__tim.tv_sec); + LL_MUL(info->modifyTime, info->modifyTime, s2us); + LL_I2L(us, sb->st_mtim.st__tim.tv_nsec / 1000); + LL_ADD(info->modifyTime, info->modifyTime, us); + LL_I2L(info->creationTime, sb->st_ctim.st__tim.tv_sec); + LL_MUL(info->creationTime, info->creationTime, s2us); + LL_I2L(us, sb->st_ctim.st__tim.tv_nsec / 1000); + LL_ADD(info->creationTime, info->creationTime, us); +} #elif defined(_PR_STAT_HAS_ST_ATIMESPEC) /* ** struct stat has st_atimespec, st_mtimespec, and st_ctimespec @@ -2572,7 +2610,7 @@ static void* _MD_Unix_mmap64( } /* _MD_Unix_mmap64 */ #endif /* defined(_PR_NO_LARGE_FILES) || defined(SOLARIS2_5) */ -#if defined(IRIX) +#if defined(IRIX) || defined(UNIXWARE) /* ** This function emulates a lock64 for IRIX using fcntl calls. It is a true @@ -2642,7 +2680,7 @@ static void _PR_InitIOV(void) ** $$$ IRIX does not have a lockf64. One must fabricate it from fcntl ** calls with 64 bit arguments. */ -#if defined(IRIX) +#if defined(IRIX) || defined(UNIXWARE) _md_iovector._lockf64 = _MD_irix_lockf64; #else _md_iovector._lockf64 = lockf64; diff --git a/pr/src/prvrsion.c b/pr/src/prvrsion.c index 588669d7..285f697b 100644 --- a/pr/src/prvrsion.c +++ b/pr/src/prvrsion.c @@ -24,7 +24,11 @@ /************************************************************************/ #include "_pr_bld.h" #if !defined(_BUILD_TIME) +#ifdef HAVE_LONG_LONG #define _BUILD_TIME 0 +#else +#define _BUILD_TIME {0, 0} +#endif #endif #if !defined(_BUILD_STRING) #define _BUILD_STRING "" |