diff --git a/nsprpub/configure b/nsprpub/configure index a2704ef306c..9f376868db7 100755 --- a/nsprpub/configure +++ b/nsprpub/configure @@ -4147,19 +4147,30 @@ EOF #define _REENTRANT 1 EOF - ac_safe=`echo "machine/builtins.h" | sed 'y%./+-%__p_%'` + + if echo "$OS_RELEASE" | egrep -c '(V2.0|V3.2)' 2>/dev/null ; then + USE_NSPR_THREADS=1 + fi + + if test -z "$GNU_CC"; then + CC="$CC -std1 -ieee_with_inexact" + if test "$OS_RELEASE" != "V2.0"; then + CC="$CC -readonly_strings" + fi + _OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Olimit 4000" + ac_safe=`echo "machine/builtins.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for machine/builtins.h""... $ac_c" 1>&6 -echo "configure:4153: checking for machine/builtins.h" >&5 +echo "configure:4164: checking for machine/builtins.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4163: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4174: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4183,17 +4194,6 @@ else echo "$ac_t""no" 1>&6 fi - - if echo "$OS_RELEASE" | egrep -c '(V2.0|V3.2)' 2>/dev/null ; then - USE_NSPR_THREADS=1 - fi - - if test -z "$GNU_CC"; then - CC="$CC -std1 -ieee_with_inexact" - if test "$OS_RELEASE" != "V2.0"; then - CC="$CC -readonly_strings" - fi - _OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Olimit 4000" fi if echo $OS_RELEASE | egrep -c '(V2.0|V3.2)' 2>/dev/null; then diff --git a/nsprpub/configure.in b/nsprpub/configure.in index 8fb25e5ee73..bea07abccc0 100644 --- a/nsprpub/configure.in +++ b/nsprpub/configure.in @@ -1454,7 +1454,6 @@ mips-sony-newsos*) AC_DEFINE(XP_UNIX) AC_DEFINE(OSF1) AC_DEFINE(_REENTRANT) - AC_CHECK_HEADER(machine/builtins.h, AC_DEFINE(OSF1_HAVE_MACHINE_BUILTINS_H)) if echo "$OS_RELEASE" | egrep -c '(V2.0|V3.2)' 2>/dev/null ; then USE_NSPR_THREADS=1 @@ -1466,6 +1465,7 @@ mips-sony-newsos*) CC="$CC -readonly_strings" fi _OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Olimit 4000" + AC_CHECK_HEADER(machine/builtins.h, AC_DEFINE(OSF1_HAVE_MACHINE_BUILTINS_H)) fi if echo $OS_RELEASE | egrep -c '(V2.0|V3.2)' 2>/dev/null; then diff --git a/nsprpub/pr/src/md/unix/unix.c b/nsprpub/pr/src/md/unix/unix.c index 42a0f1e83c0..704fa11ace0 100644 --- a/nsprpub/pr/src/md/unix/unix.c +++ b/nsprpub/pr/src/md/unix/unix.c @@ -2727,6 +2727,28 @@ static void* _MD_Unix_mmap64( } /* _MD_Unix_mmap64 */ #endif /* defined(_PR_NO_LARGE_FILES) || defined(SOLARIS2_5) */ +#if defined(OSF1) && defined(__GNUC__) + +/* + * On OSF1 V5.0A, defines stat and fstat as + * macros when compiled under gcc, so it is rather tricky to + * take the addresses of the real functions the macros expend + * to. A simple solution is to define forwarder functions + * and take the addresses of the forwarder functions instead. + */ + +static int stat_forwarder(const char *path, struct stat *buffer) +{ + return stat(path, buffer); +} + +static int fstat_forwarder(int filedes, struct stat *buffer) +{ + return fstat(filedes, buffer); +} + +#endif + static void _PR_InitIOV(void) { #if defined(SOLARIS2_5) @@ -2771,8 +2793,13 @@ static void _PR_InitIOV(void) #elif defined(_PR_HAVE_LARGE_OFF_T) _md_iovector._open64 = open; _md_iovector._mmap64 = mmap; +#if defined(OSF1) && defined(__GNUC__) + _md_iovector._fstat64 = fstat_forwarder; + _md_iovector._stat64 = stat_forwarder; +#else _md_iovector._fstat64 = fstat; _md_iovector._stat64 = stat; +#endif _md_iovector._lseek64 = lseek; #else #error "I don't know yet" diff --git a/nsprpub/pr/src/md/unix/uxrng.c b/nsprpub/pr/src/md/unix/uxrng.c index 5cfeeefdcc7..6add3bf17de 100644 --- a/nsprpub/pr/src/md/unix/uxrng.c +++ b/nsprpub/pr/src/md/unix/uxrng.c @@ -101,7 +101,11 @@ GetHighResClock(void *buf, size_t maxbytes) { unsigned long t; +#ifdef __GNUC__ + __asm__("rpcc %0" : "=r" (t)); +#else t = asm("rpcc %v0"); +#endif return _pr_CopyLowBits(buf, maxbytes, &t, sizeof(t)); }