Bug 371247: checked in some changes for OpenBSD. The patch is contributed NSPRPUB_PRE_4_2_CLIENT_BRANCH
authorwtc%google.com
Sat, 26 May 2007 00:16:38 +0000
branchNSPRPUB_PRE_4_2_CLIENT_BRANCH
changeset 3842 2002506978437762f8b9ba9966065440be6baa7c
parent 3840 1e5546f7bcae61d75bccb86481051327a24cb27b
child 3844 e290783d4531e078dcd63c1eefc223d03568aad8
push idunknown
push userunknown
push dateunknown
bugs371247
Bug 371247: checked in some changes for OpenBSD. The patch is contributed by Martynas Venckus <martynas@openbsd.org>. r=nelsonb,wtc. Modified Files: configure configure.in lib/tests/Makefile.in _openbsd.cfg _openbsd.h prnetdb.c Tag: NSPRPUB_PRE_4_2_CLIENT_BRANCH
configure
configure.in
lib/tests/Makefile.in
pr/include/md/_openbsd.cfg
pr/include/md/_openbsd.h
pr/src/misc/prnetdb.c
--- a/configure
+++ b/configure
@@ -4372,16 +4372,17 @@ EOF
 EOF
 
     CFLAGS="$CFLAGS -ansi -Wall"
     CXXFLAGS="$CXXFLAGS -ansi -Wall"
     DLL_SUFFIX=so.1.0
     DSO_CFLAGS=-fPIC
     MDCPUCFG_H=_openbsd.cfg
     PR_MD_CSRCS=openbsd.c
+    OS_LIBS="-lc"
     if test -z "$USE_NSPR_THREADS"; then
         USE_PTHREADS=1
     fi
     DSO_LDOPTS='-shared -fPIC'
     MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
     ;;
 
 *-openvms*)
--- a/configure.in
+++ b/configure.in
@@ -1746,16 +1746,17 @@ mips-sony-newsos*)
     AC_DEFINE(HAVE_BSD_FLOCK)
     AC_DEFINE(HAVE_SOCKLEN_T)
     CFLAGS="$CFLAGS -ansi -Wall"
     CXXFLAGS="$CXXFLAGS -ansi -Wall"
     DLL_SUFFIX=so.1.0
     DSO_CFLAGS=-fPIC
     MDCPUCFG_H=_openbsd.cfg
     PR_MD_CSRCS=openbsd.c
+    OS_LIBS="-lc"
     if test -z "$USE_NSPR_THREADS"; then
         USE_PTHREADS=1
     fi
     DSO_LDOPTS='-shared -fPIC'
     MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
     ;;
 
 *-openvms*)
--- a/lib/tests/Makefile.in
+++ b/lib/tests/Makefile.in
@@ -122,16 +122,22 @@ ifeq ($(OS_ARCH), Linux)
     else
         LDOPTS += -Xlinker -rpath $(PWD)/$(dist_libdir)
         ifeq ($(USE_PTHREADS),1)
             EXTRA_LIBS = -lpthread
         endif
     endif
 endif
 
+ifeq (,$(filter-out OpenBSD,$(OS_ARCH)))
+    ifeq ($(USE_PTHREADS),1)
+        EXTRA_LIBS = -lpthread
+    endif
+endif
+
 ifeq ($(OS_ARCH), OSF1)
 LDOPTS += -rpath $(PWD)/$(dist_libdir) -lpthread
 endif
 
 ifeq ($(OS_ARCH), HP-UX)
 LDOPTS += -Wl,+s,+b,$(PWD)/$(dist_libdir)
 endif
 
--- a/pr/include/md/_openbsd.cfg
+++ b/pr/include/md/_openbsd.cfg
@@ -43,17 +43,17 @@
 #endif
 
 #ifndef OPENBSD
 #define OPENBSD
 #endif
 
 #define PR_AF_INET6 24  /* same as AF_INET6 */
 
-#if defined(__i386__)
+#if defined(__i386__) || defined(__arm__)
 
 #define IS_LITTLE_ENDIAN 1
 #undef  IS_BIG_ENDIAN
 #define	HAVE_LONG_LONG
 #undef	HAVE_ALIGNED_DOUBLES
 #undef	HAVE_ALIGNED_LONGLONGS
 
 #define PR_BYTES_PER_BYTE   1
--- a/pr/include/md/_openbsd.h
+++ b/pr/include/md/_openbsd.h
@@ -49,19 +49,21 @@
 #elif defined(__amd64__)
 #define _PR_SI_ARCHITECTURE "amd64"
 #elif defined(__m68k__)
 #define _PR_SI_ARCHITECTURE "m68k"
 #elif defined(__powerpc__)
 #define _PR_SI_ARCHITECTURE "powerpc"
 #elif defined(__sparc__)
 #define _PR_SI_ARCHITECTURE "sparc"
+#elif defined(__arm__)
+#define _PR_SI_ARCHITECTURE "arm"
 #endif
 
-#define PR_DLL_SUFFIX		".so.1.0"
+#define PR_DLL_SUFFIX		".so"
 
 #define _PR_VMBASE              0x30000000
 #define _PR_STACK_VMBASE	0x50000000
 #define _MD_DEFAULT_STACK_SIZE	65536L
 #define _MD_MMAP_FLAGS          MAP_PRIVATE
 
 #undef  HAVE_STACK_GROWING_UP
 #define HAVE_DLL
@@ -92,16 +94,18 @@
 #if defined(__i386__) || defined(__sparc__) || defined(__m68k__)
 #define JB_SP_INDEX 2
 #elif defined(__powerpc__)
 #define JB_SP_INDEX 1
 #elif defined(__alpha__)
 #define JB_SP_INDEX 34
 #elif defined(__amd64__)
 #define JB_SP_INDEX 6
+#elif defined(__arm__)
+#define JB_SP_INDEX 23
 #else
 #error "Need to define SP index in jmp_buf here"
 #endif
 #define _MD_GET_SP(_th)    (_th)->md.context[JB_SP_INDEX]
 
 #define PR_NUM_GCREGS	_JBLEN
 
 /*
--- a/pr/src/misc/prnetdb.c
+++ b/pr/src/misc/prnetdb.c
@@ -98,17 +98,18 @@ PRLock *_pr_dnsLock = NULL;
         && !(defined(__GLIBC__) && __GLIBC__ >= 2))
 #define _PR_HAVE_GETPROTO_R
 #define _PR_HAVE_GETPROTO_R_POINTER
 #endif
 
 #if defined(OSF1) \
         || defined(AIX4_3_PLUS) || (defined(AIX) && defined(_THREAD_SAFE)) \
 	|| (defined(HPUX10_10) && defined(_REENTRANT)) \
-        || (defined(HPUX10_20) && defined(_REENTRANT))
+        || (defined(HPUX10_20) && defined(_REENTRANT)) \
+        || defined(OPENBSD)
 #define _PR_HAVE_GETPROTO_R
 #define _PR_HAVE_GETPROTO_R_INT
 #endif
 
 #if __FreeBSD_version >= 602000
 #define _PR_HAVE_GETPROTO_R
 #define _PR_HAVE_5_ARG_GETPROTO_R
 #endif