summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwtc%netscape.com <devnull@localhost>2002-06-14 03:22:14 +0000
committerwtc%netscape.com <devnull@localhost>2002-06-14 03:22:14 +0000
commit90d1188d42ca753aece9e167575101ea7fdf0b1f (patch)
tree67e2e60d5532d777d3f348b47bc9718bc572c47b
parent80d123ffe9dfff3071d6077e2ecb880181f4eff9 (diff)
downloadnspr-hg-90d1188d42ca753aece9e167575101ea7fdf0b1f.tar.gz
Bug 125819: fixed problems compiling using gcc on OSF1. The patch is
contributed by Chris Seawood <seawood@netscape.com>. Modified Files: configure configure.in unix.c uxrng.c Tag: NSPRPUB_PRE_4_2_CLIENT_BRANCH
-rwxr-xr-xconfigure30
-rw-r--r--configure.in2
-rw-r--r--pr/src/md/unix/unix.c27
-rw-r--r--pr/src/md/unix/uxrng.c4
4 files changed, 47 insertions, 16 deletions
diff --git a/configure b/configure
index a2704ef3..9f376868 100755
--- a/configure
+++ b/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
-#line 4158 "configure"
+#line 4169 "configure"
#include "confdefs.h"
#include <machine/builtins.h>
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/configure.in b/configure.in
index 8fb25e5e..bea07abc 100644
--- a/configure.in
+++ b/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/pr/src/md/unix/unix.c b/pr/src/md/unix/unix.c
index 42a0f1e8..704fa11a 100644
--- a/pr/src/md/unix/unix.c
+++ b/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, <sys/stat.h> 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/pr/src/md/unix/uxrng.c b/pr/src/md/unix/uxrng.c
index 5cfeeefd..6add3bf1 100644
--- a/pr/src/md/unix/uxrng.c
+++ b/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));
}