summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcvs2hg <devnull@localhost>2001-11-03 05:57:08 +0000
committercvs2hg <devnull@localhost>2001-11-03 05:57:08 +0000
commitf6dd8f7c4f7ed8e5eef31003d65612b754ebe1d0 (patch)
tree50971fd343d2dedc55d26a5732eee1815225b309
parentf7b843b8dec17be6d612b30c52e39cfb35e62848 (diff)
downloadnspr-hg-SVG_0_9_6_BRANCH.tar.gz
fixup commit for branch 'SVG_0_9_6_BRANCH'SVG_0_9_6_BRANCH
-rwxr-xr-xbuild/autoconf/config.guess376
-rwxr-xr-xbuild/autoconf/config.sub177
-rw-r--r--config/autoconf.mk.in4
-rw-r--r--config/nsinstall.c2
-rwxr-xr-xconfig/nspr-config.in2
-rw-r--r--config/prdepend.h1
-rwxr-xr-xconfigure304
-rw-r--r--configure.in86
-rw-r--r--lib/libc/include/plstr.h25
-rw-r--r--lib/libc/src/Makefile.in1
-rw-r--r--lib/libc/src/strtok.c86
-rw-r--r--lib/tests/string.c54
-rw-r--r--macbuild/NSPR20PPC.mcpbin167357 -> 163973 bytes
-rw-r--r--pr/include/gencfg.c4
-rw-r--r--pr/include/md/Makefile.in4
-rw-r--r--pr/include/md/_darwin.cfg4
-rw-r--r--pr/include/md/_darwin.h10
-rw-r--r--pr/include/md/_macos.h55
-rw-r--r--pr/include/md/_nto.h1
-rw-r--r--pr/include/md/_pth.h50
-rw-r--r--pr/include/md/_unixos.h4
-rw-r--r--pr/include/md/prosdep.h4
-rw-r--r--pr/include/obsolete/protypes.h4
-rw-r--r--pr/include/private/primpl.h14
-rw-r--r--pr/src/Makefile.in15
-rw-r--r--pr/src/linking/prlink.c7
-rw-r--r--pr/src/md/beos/beos_errors.c34
-rw-r--r--pr/src/md/mac/macio.c72
-rw-r--r--pr/src/md/mac/macrng.c7
-rw-r--r--pr/src/md/mac/macsockotpt.c309
-rw-r--r--pr/src/md/mac/macthr.c223
-rw-r--r--pr/src/md/mac/mdcriticalregion.c169
-rw-r--r--pr/src/md/mac/mdcriticalregion.h56
-rw-r--r--pr/src/md/mac/mdmac.c3
-rw-r--r--pr/src/md/os2/os2cv.c8
-rw-r--r--pr/src/md/prosdep.c2
-rw-r--r--pr/src/md/unix/unix.c2
-rw-r--r--pr/src/md/unix/unix_errors.c5
-rw-r--r--pr/src/md/unix/uxproces.c46
-rw-r--r--pr/src/md/unix/uxrng.c2
-rw-r--r--pr/src/misc/prnetdb.c2
-rw-r--r--pr/src/misc/prsystem.c2
-rw-r--r--pr/src/misc/prtime.c7
-rw-r--r--pr/src/pthreads/ptio.c6
-rw-r--r--pr/src/pthreads/ptsynch.c41
-rw-r--r--pr/tests/Makefile.in2
-rw-r--r--pr/tests/dll/Makefile.in2
47 files changed, 1529 insertions, 765 deletions
diff --git a/build/autoconf/config.guess b/build/autoconf/config.guess
index 95e52667..dc37b18b 100755
--- a/build/autoconf/config.guess
+++ b/build/autoconf/config.guess
@@ -3,7 +3,7 @@
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
# Free Software Foundation, Inc.
-timestamp='2001-03-30'
+timestamp='2001-10-05'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -24,8 +24,9 @@ timestamp='2001-03-30'
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
-# Written by Per Bothner <bothner@cygnus.com>.
-# Please send patches to <config-patches@gnu.org>.
+# Originally written by Per Bothner <bothner@cygnus.com>.
+# Please send patches to <config-patches@gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
#
# This script attempts to guess a canonical system name similar to
# config.sub. If it succeeds, it prints the system name on stdout, and
@@ -52,7 +53,7 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
-Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99, 2000
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
@@ -95,25 +96,25 @@ trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15
# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
# use `HOST_CC' if defined, but it is deprecated.
-case $CC_FOR_BUILD,$HOST_CC,$CC in
- ,,) echo "int dummy(){}" > $dummy.c
+set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,) echo "int dummy(){}" > $dummy.c ;
for c in cc gcc c89 ; do
- ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1
+ ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ;
if test $? = 0 ; then
- CC_FOR_BUILD="$c"; break
- fi
- done
- rm -f $dummy.c $dummy.o $dummy.rel
+ CC_FOR_BUILD="$c"; break ;
+ fi ;
+ done ;
+ rm -f $dummy.c $dummy.o $dummy.rel ;
if test x"$CC_FOR_BUILD" = x ; then
- CC_FOR_BUILD=no_compiler_found
+ CC_FOR_BUILD=no_compiler_found ;
fi
;;
,,*) CC_FOR_BUILD=$CC ;;
,*,*) CC_FOR_BUILD=$HOST_CC ;;
-esac
+esac'
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
-# (ghazi@noc.rutgers.edu 8/24/94.)
+# (ghazi@noc.rutgers.edu 1994-08-24)
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
PATH=$PATH:/.attbin ; export PATH
fi
@@ -127,7 +128,7 @@ UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:NetBSD:*:*)
- # Netbsd (nbsd) targets should (where applicable) match one or
+ # NetBSD (nbsd) targets should (where applicable) match one or
# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
# switched to ELF, *-*-netbsd* would select the old
@@ -144,12 +145,14 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
macppc) machine=powerpc-apple ;;
hp3[0-9][05]) machine=m68k-hp ;;
ibmrt|romp-ibm) machine=romp-ibm ;;
+ sparc*) machine=`uname -p`-unknown ;;
*) machine=${UNAME_MACHINE}-unknown ;;
esac
# The Operating System including object format, if it has switched
# to ELF recently, or will in the future.
case "${UNAME_MACHINE}" in
i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k)
+ eval $set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep __ELF__ >/dev/null
then
@@ -171,6 +174,45 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
exit 0 ;;
+ amiga:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ arc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ hp300:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mac68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ macppc:OpenBSD:*:*)
+ echo powerpc-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme88k:OpenBSD:*:*)
+ echo m88k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvmeppc:OpenBSD:*:*)
+ echo powerpc-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ pmax:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sgi:OpenBSD:*:*)
+ echo mipseb-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sun3:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ wgrisc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ *:OpenBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
alpha:OSF1:*:*)
if test $UNAME_RELEASE = "V4.0"; then
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
@@ -204,6 +246,7 @@ main:
jsr \$26,exit
.end main
EOF
+ eval $set_cc_for_build
$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
if test "$?" = 0 ; then
case `./$dummy` in
@@ -225,6 +268,9 @@ EOF
2-307)
UNAME_MACHINE="alphaev67"
;;
+ 2-1307)
+ UNAME_MACHINE="alphaev68"
+ ;;
esac
fi
rm -f $dummy.s $dummy
@@ -242,30 +288,9 @@ EOF
Amiga*:UNIX_System_V:4.0:*)
echo m68k-unknown-sysv4
exit 0;;
- amiga:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
*:[Aa]miga[Oo][Ss]:*:*)
echo ${UNAME_MACHINE}-unknown-amigaos
exit 0 ;;
- arc64:OpenBSD:*:*)
- echo mips64el-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- arc:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- hkmips:OpenBSD:*:*)
- echo mips-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- pmax:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- sgi:OpenBSD:*:*)
- echo mips-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- wgrisc:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
*:OS/390:*:*)
echo i370-ibm-openedition
exit 0 ;;
@@ -328,9 +353,6 @@ EOF
aushp:SunOS:*:*)
echo sparc-auspex-sunos${UNAME_RELEASE}
exit 0 ;;
- atari*:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
# The situation for MiNT is a little confusing. The machine name
# can be virtually everything (everything which is not
# "atarist" or "atariste" at least should have a processor
@@ -357,18 +379,6 @@ EOF
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
echo m68k-unknown-mint${UNAME_RELEASE}
exit 0 ;;
- sun3*:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mac68k:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mvme68k:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mvme88k:OpenBSD:*:*)
- echo m88k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE}
exit 0 ;;
@@ -385,6 +395,7 @@ EOF
echo clipper-intergraph-clix${UNAME_RELEASE}
exit 0 ;;
mips:*:*:UMIPS | mips:*:*:RISCos)
+ eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#ifdef __cplusplus
#include <stdio.h> /* for printf() prototype */
@@ -412,6 +423,9 @@ EOF
rm -f $dummy.c $dummy
echo mips-mips-riscos${UNAME_RELEASE}
exit 0 ;;
+ Motorola:PowerMAX_OS:*:*)
+ echo powerpc-motorola-powermax
+ exit 0 ;;
Night_Hawk:Power_UNIX:*:*)
echo powerpc-harris-powerunix
exit 0 ;;
@@ -459,7 +473,7 @@ EOF
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
- i?86:AIX:*:*)
+ i*86:AIX:*:*)
echo i386-ibm-aix
exit 0 ;;
ia64:AIX:*:*)
@@ -472,6 +486,7 @@ EOF
exit 0 ;;
*:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#include <sys/systemcfg.h>
@@ -533,10 +548,8 @@ EOF
9000/31? ) HP_ARCH=m68000 ;;
9000/[34]?? ) HP_ARCH=m68k ;;
9000/[678][0-9][0-9])
- case "${HPUX_REV}" in
- 11.[0-9][0-9])
- if [ -x /usr/bin/getconf ]; then
- sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+ if [ -x /usr/bin/getconf ]; then
+ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
case "${sc_cpu_version}" in
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
@@ -545,12 +558,13 @@ EOF
case "${sc_kernel_bits}" in
32) HP_ARCH="hppa2.0n" ;;
64) HP_ARCH="hppa2.0w" ;;
+ '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
esac ;;
esac
- fi ;;
- esac
- if [ "${HP_ARCH}" = "" ]; then
- sed 's/^ //' << EOF >$dummy.c
+ fi
+ if [ "${HP_ARCH}" = "" ]; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
#define _HPUX_SOURCE
#include <stdlib.h>
@@ -583,10 +597,10 @@ EOF
exit (0);
}
EOF
- (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
- if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
- rm -f $dummy.c $dummy
- fi ;;
+ (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy`
+ if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
+ rm -f $dummy.c $dummy
+ fi ;;
esac
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
exit 0 ;;
@@ -595,6 +609,7 @@ EOF
echo ia64-hp-hpux${HPUX_REV}
exit 0 ;;
3050*:HI-UX:*:*)
+ eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#include <unistd.h>
int
@@ -630,7 +645,7 @@ EOF
9000/8??:4.3bsd:*:*)
echo hppa1.0-hp-bsd
exit 0 ;;
- *9??*:MPE/iX:*:*)
+ *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
echo hppa1.0-hp-mpeix
exit 0 ;;
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
@@ -639,7 +654,7 @@ EOF
hp8??:OSF1:*:*)
echo hppa1.0-hp-osf
exit 0 ;;
- i?86:OSF1:*:*)
+ i*86:OSF1:*:*)
if [ -x /usr/sbin/sysversion ] ; then
echo ${UNAME_MACHINE}-unknown-osf1mk
else
@@ -649,9 +664,6 @@ EOF
parisc*:Lites*:*:*)
echo hppa1.1-hp-lites
exit 0 ;;
- hppa*:OpenBSD:*:*)
- echo hppa-unknown-openbsd
- exit 0 ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
exit 0 ;;
@@ -674,12 +686,13 @@ EOF
echo xmp-cray-unicos
exit 0 ;;
CRAY*Y-MP:*:*:*)
- echo ymp-cray-unicos${UNAME_RELEASE}
+ echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY*[A-Z]90:*:*:*)
echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
- -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+ -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY*TS:*:*:*)
echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
@@ -702,10 +715,7 @@ EOF
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit 0 ;;
- hp300:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- i?86:BSD/386:*:* | i?86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+ i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
exit 0 ;;
sparc*:BSD/OS:*:*)
@@ -717,9 +727,6 @@ EOF
*:FreeBSD:*:*)
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit 0 ;;
- *:OpenBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
- exit 0 ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit 0 ;;
@@ -731,6 +738,10 @@ EOF
xx:WINNT:* | xx:WIN95:*)
echo i586-pc-msvc
exit 0 ;;
+# MKS Toolkit
+ [34567]86:Windows_NT:*)
+ echo i386-pc-mksnt
+ exit 0 ;;
### End MozillaHack
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
@@ -766,97 +777,29 @@ EOF
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit 0 ;;
mips:Linux:*:*)
- cat >$dummy.c <<EOF
-#ifdef __cplusplus
-#include <stdio.h> /* for printf() prototype */
-int main (int argc, char *argv[]) {
-#else
-int main (argc, argv) int argc; char *argv[]; {
-#endif
-#ifdef __MIPSEB__
- printf ("%s-unknown-linux-gnu\n", argv[1]);
-#endif
-#ifdef __MIPSEL__
- printf ("%sel-unknown-linux-gnu\n", argv[1]);
-#endif
- return 0;
-}
-EOF
- $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0
- rm -f $dummy.c $dummy
+ case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in
+ big) echo mips-unknown-linux-gnu && exit 0 ;;
+ little) echo mipsel-unknown-linux-gnu && exit 0 ;;
+ esac
;;
ppc:Linux:*:*)
- # Determine Lib Version
- cat >$dummy.c <<EOF
-#include <features.h>
-#if defined(__GLIBC__)
-extern char __libc_version[];
-extern char __libc_release[];
-#endif
-main(argc, argv)
- int argc;
- char *argv[];
-{
-#if defined(__GLIBC__)
- printf("%s %s\n", __libc_version, __libc_release);
-#else
- printf("unknown\n");
-#endif
- return 0;
-}
-EOF
- LIBC=""
- $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null
- if test "$?" = 0 ; then
- ./$dummy | grep 1\.99 > /dev/null
- if test "$?" = 0 ; then LIBC="libc1" ; fi
- fi
- rm -f $dummy.c $dummy
- echo powerpc-unknown-linux-gnu${LIBC}
+ echo powerpc-unknown-linux-gnu
+ exit 0 ;;
+ ppc64:Linux:*:*)
+ echo powerpc64-unknown-linux-gnu
exit 0 ;;
alpha:Linux:*:*)
- cat <<EOF >$dummy.s
- .data
- \$Lformat:
- .byte 37,100,45,37,120,10,0 # "%d-%x\n"
- .text
- .globl main
- .align 4
- .ent main
- main:
- .frame \$30,16,\$26,0
- ldgp \$29,0(\$27)
- .prologue 1
- .long 0x47e03d80 # implver \$0
- lda \$2,-1
- .long 0x47e20c21 # amask \$2,\$1
- lda \$16,\$Lformat
- mov \$0,\$17
- not \$1,\$18
- jsr \$26,printf
- ldgp \$29,0(\$26)
- mov 0,\$16
- jsr \$26,exit
- .end main
-EOF
- LIBC=""
- $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
- if test "$?" = 0 ; then
- case `./$dummy` in
- 0-0) UNAME_MACHINE="alpha" ;;
- 1-0) UNAME_MACHINE="alphaev5" ;;
- 1-1) UNAME_MACHINE="alphaev56" ;;
- 1-101) UNAME_MACHINE="alphapca56" ;;
- 2-303) UNAME_MACHINE="alphaev6" ;;
- 2-307) UNAME_MACHINE="alphaev67" ;;
- esac
- objdump --private-headers $dummy | \
- grep ld.so.1 > /dev/null
- if test "$?" = 0 ; then
- LIBC="libc1"
- fi
- fi
- rm -f $dummy.s $dummy
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+ EV56) UNAME_MACHINE=alphaev56 ;;
+ PCA56) UNAME_MACHINE=alphapca56 ;;
+ PCA57) UNAME_MACHINE=alphapca56 ;;
+ EV6) UNAME_MACHINE=alphaev6 ;;
+ EV67) UNAME_MACHINE=alphaev67 ;;
+ EV68*) UNAME_MACHINE=alphaev68 ;;
+ esac
+ objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
exit 0 ;;
parisc:Linux:*:* | hppa:Linux:*:*)
@@ -882,44 +825,34 @@ EOF
x86_64:Linux:*:*)
echo x86_64-unknown-linux-gnu
exit 0 ;;
- i?86:Linux:*:*)
+ i*86:Linux:*:*)
# The BFD linker knows what the default object file format is, so
# first see if it will tell us. cd to the root directory to prevent
# problems with other programs or directories called `ld' in the path.
- ld_supported_emulations=`cd /; ld --help 2>&1 \
- | sed -ne '/supported emulations:/!d
+ ld_supported_targets=`cd /; ld --help 2>&1 \
+ | sed -ne '/supported targets:/!d
s/[ ][ ]*/ /g
- s/.*supported emulations: *//
+ s/.*supported targets: *//
s/ .*//
p'`
- case "$ld_supported_emulations" in
- i?86linux)
- echo "${UNAME_MACHINE}-pc-linux-gnuaout"
- exit 0
- ;;
- elf_i?86)
+ case "$ld_supported_targets" in
+ elf32-i386)
TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
;;
- i?86coff)
+ a.out-i386-linux)
+ echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+ exit 0 ;;
+ coff-i386)
echo "${UNAME_MACHINE}-pc-linux-gnucoff"
- exit 0
- ;;
- esac
- # Either a pre-BFD a.out linker (linux-gnuoldld)
- # or one that does not give us useful --help.
- # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
- # If ld does not provide *any* "supported emulations:"
- # that means it is gnuoldld.
- test -z "$ld_supported_emulations" && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
- case "${UNAME_MACHINE}" in
- i?86)
- VENDOR=pc;
- ;;
- *)
- VENDOR=unknown;
- ;;
+ exit 0 ;;
+ "")
+ # Either a pre-BFD a.out linker (linux-gnuoldld) or
+ # one that does not give us useful --help.
+ echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+ exit 0 ;;
esac
# Determine whether the default compiler is a.out or elf
+ eval $set_cc_for_build
cat >$dummy.c <<EOF
#include <features.h>
#ifdef __cplusplus
@@ -931,15 +864,15 @@ EOF
#ifdef __ELF__
# ifdef __GLIBC__
# if __GLIBC__ >= 2
- printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
+ printf ("%s-pc-linux-gnu\n", argv[1]);
# else
- printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
+ printf ("%s-pc-linux-gnulibc1\n", argv[1]);
# endif
# else
- printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
+ printf ("%s-pc-linux-gnulibc1\n", argv[1]);
# endif
#else
- printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
+ printf ("%s-pc-linux-gnuaout\n", argv[1]);
#endif
return 0;
}
@@ -948,12 +881,13 @@ EOF
rm -f $dummy.c $dummy
test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
;;
-# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
-# are messed up and put the nodename in both sysname and nodename.
- i?86:DYNIX/ptx:4*:*)
+ i*86:DYNIX/ptx:4*:*)
+ # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+ # earlier versions are messed up and put the nodename in both
+ # sysname and nodename.
echo i386-sequent-sysv4
exit 0 ;;
- i?86:UNIX_SV:4.2MP:2.*)
+ i*86:UNIX_SV:4.2MP:2.*)
# Unixware is an offshoot of SVR4, but it has its own version
# number series starting with 2...
# I am not positive that other SVR4 systems won't match this,
@@ -961,7 +895,7 @@ EOF
# Use sysv4.2uw... so that sysv4* matches it.
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
exit 0 ;;
- i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
+ i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
@@ -969,16 +903,15 @@ EOF
echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
fi
exit 0 ;;
- i?86:*:5:7*)
- # Fixed at (any) Pentium or better
- UNAME_MACHINE=i586
- if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then
- echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION}
- else
- echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
- fi
+ i*86:*:5:[78]*)
+ case `/bin/uname -X | grep "^Machine"` in
+ *486*) UNAME_MACHINE=i486 ;;
+ *Pentium) UNAME_MACHINE=i586 ;;
+ *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+ esac
+ echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
exit 0 ;;
- i?86:*:3.2:*)
+ i*86:*:3.2:*)
if test -f /usr/options/cb.name; then
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
@@ -996,7 +929,7 @@ EOF
echo ${UNAME_MACHINE}-pc-sysv32
fi
exit 0 ;;
- i?86:*DOS:*:*)
+ i*86:*DOS:*:*)
echo ${UNAME_MACHINE}-pc-msdosdjgpp
exit 0 ;;
pc:*:*:*)
@@ -1024,7 +957,7 @@ EOF
exit 0 ;;
M68*:*:R3V[567]*:*)
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
- 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
+ 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
@@ -1041,7 +974,7 @@ EOF
mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4
exit 0 ;;
- i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:* | i?86:LynxOS:4.0*:*)
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
TSUNAMI:LynxOS:2.*:*)
@@ -1070,8 +1003,8 @@ EOF
echo ns32k-sni-sysv
fi
exit 0 ;;
- PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
- # says <Richard.M.Bartel@ccMail.Census.GOV>
+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
echo i586-unisys-sysv4
exit 0 ;;
#### MozillaHack
@@ -1093,6 +1026,10 @@ EOF
# From seanf@swdc.stratus.com.
echo i860-stratus-sysv4
exit 0 ;;
+ *:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo hppa1.1-stratus-vos
+ exit 0 ;;
mc68*:A/UX:*:*)
echo m68k-apple-aux${UNAME_RELEASE}
exit 0 ;;
@@ -1162,7 +1099,7 @@ EOF
fi
echo ${UNAME_MACHINE}-unknown-plan9
exit 0 ;;
- i?86:OS/2:*:*)
+ i*86:OS/2:*:*)
# If we were able to find `uname', then EMX Unix compatibility
# is probably installed.
# echo ${UNAME_MACHINE}-pc-os2-emx
@@ -1192,11 +1129,18 @@ EOF
*:ITS:*:*)
echo pdp10-unknown-its
exit 0 ;;
+ i*86:XTS-300:*:STOP)
+ echo ${UNAME_MACHINE}-unknown-stop
+ exit 0 ;;
+ i*86:atheos:*:*)
+ echo ${UNAME_MACHINE}-unknown-atheos
+ exit 0 ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+eval $set_cc_for_build
cat >$dummy.c <<EOF
#ifdef _SEQUENT_
# include <sys/types.h>
diff --git a/build/autoconf/config.sub b/build/autoconf/config.sub
index a4b69bed..37799ea8 100755
--- a/build/autoconf/config.sub
+++ b/build/autoconf/config.sub
@@ -3,7 +3,7 @@
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
# Free Software Foundation, Inc.
-timestamp='2001-03-30'
+timestamp='2001-10-05'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@@ -29,7 +29,8 @@ timestamp='2001-03-30'
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
-# Please send patches to <config-patches@gnu.org>.
+# Please send patches to <config-patches@gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
#
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
@@ -117,7 +118,7 @@ esac
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
- nto-qnx* | linux-gnu* | storm-chaos* | os2-emx*)
+ nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
@@ -157,6 +158,14 @@ case $os in
os=-vxworks
basic_machine=$1
;;
+ -chorusos*)
+ os=-chorusos
+ basic_machine=$1
+ ;;
+ -chorusrdb)
+ os=-chorusrdb
+ basic_machine=$1
+ ;;
-hiux*)
os=-hiuxwe2
;;
@@ -215,25 +224,36 @@ esac
case $basic_machine in
# Recognize the basic CPU types without company name.
# Some are omitted here because they have special meanings below.
- tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc \
- | arm | arme[lb] | arm[bl]e | armv[2345] | armv[345][lb] | strongarm | xscale \
- | pyramid | mn10200 | mn10300 | tron | a29k \
- | 580 | i960 | h8300 \
- | x86 | ppcbe | mipsbe | mipsle | shbe | shle \
- | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \
- | hppa64 \
- | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \
- | alphaev6[78] \
- | we32k | ns16k | clipper | i370 | sh | sh[34] \
- | powerpc | powerpcle \
- | 1750a | dsp16xx | pdp10 | pdp11 \
- | mips16 | mips64 | mipsel | mips64el \
- | mips64orion | mips64orionel | mipstx39 | mipstx39el \
- | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \
- | mips64vr5000 | miprs64vr5000el | mcore | s390 | s390x \
- | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \
- | thumb | d10v | d30v | fr30 | avr | openrisc | tic80 \
- | pj | pjl | h8500)
+ 1750a | 580 \
+ | a29k \
+ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+ | c4x | clipper \
+ | d10v | d30v | dsp16xx \
+ | fr30 \
+ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | i370 | i860 | i960 | ia64 \
+ | m32r | m68000 | m68k | m88k | mcore \
+ | mips16 | mips64 | mips64el | mips64orion | mips64orionel \
+ | mips64vr4100 | mips64vr4100el | mips64vr4300 \
+ | mips64vr4300el | mips64vr5000 | mips64vr5000el \
+ | mipsbe | mipseb | mips*el | mipsle | mipstx39 | mipstx39el \
+ | mipsisa32 \
+ | mn10200 | mn10300 \
+ | ns16k | ns32k \
+ | openrisc \
+ | pdp10 | pdp11 | pj | pjl \
+ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+ | pyramid \
+ | s390 | s390x \
+ | sh | sh[34] | sh[34]eb | shbe | shle \
+ | sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \
+ | stormy16 | strongarm \
+ | tahoe | thumb | tic80 | tron \
+ | v850 \
+ | we32k \
+ | x86 | xscale \
+ | z8k)
basic_machine=$basic_machine-unknown
;;
m6811 | m68hc11 | m6812 | m68hc12)
@@ -241,13 +261,13 @@ case $basic_machine in
basic_machine=$basic_machine-unknown
os=-none
;;
- m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | w65)
+ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
;;
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users.
- i[234567]86 | x86_64)
+ i*86 | x86_64)
basic_machine=$basic_machine-pc
;;
# Object if more than one company name word.
@@ -256,30 +276,44 @@ case $basic_machine in
exit 1
;;
# Recognize the basic CPU types with company name.
- # FIXME: clean up the formatting here.
- vax-* | tahoe-* | i[234567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \
- | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | c[123]* \
- | arm-* | armbe-* | armle-* | armv*-* | strongarm-* | xscale-* \
- | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
- | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \
- | xmp-* | ymp-* \
- | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* \
- | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \
- | hppa2.0n-* | hppa64-* \
- | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \
- | alphaev6[78]-* \
- | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \
- | clipper-* | orion-* \
- | sparclite-* | pdp10-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
- | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \
- | mips64el-* | mips64orion-* | mips64orionel-* \
- | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \
- | mipstx39-* | mipstx39el-* | mcore-* \
- | f30[01]-* | f700-* | s390-* | s390x-* | sv1-* | t3e-* \
- | [cjt]90-* \
- | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
- | thumb-* | v850-* | d30v-* | tic30-* | tic80-* | c30-* | fr30-* \
- | bs2000-* | tic54x-* | c54x-* | x86_64-* | pj-* | pjl-*)
+ 580-* \
+ | a29k-* \
+ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+ | alphapca5[67]-* | arc-* \
+ | arm-* | armbe-* | armle-* | armv*-* \
+ | avr-* \
+ | bs2000-* \
+ | c[123]* | c30-* | [cjt]90-* | c54x-* \
+ | clipper-* | cray2-* | cydra-* \
+ | d10v-* | d30v-* \
+ | elxsi-* \
+ | f30[01]-* | f700-* | fr30-* | fx80-* \
+ | h8300-* | h8500-* \
+ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+ | i*86-* | i860-* | i960-* | ia64-* \
+ | m32r-* \
+ | m68000-* | m680[01234]0-* | m68360-* | m683?2-* | m68k-* \
+ | m88110-* | m88k-* | mcore-* \
+ | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \
+ | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \
+ | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \
+ | mipsle-* | mips*el-* | mipstx39-* | mipstx39el-* \
+ | none-* | np1-* | ns16k-* | ns32k-* \
+ | orion-* \
+ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+ | pyramid-* \
+ | romp-* | rs6000-* \
+ | s390-* | s390x-* \
+ | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* \
+ | sparc-* | sparc64-* | sparc86x-* | sparclite-* \
+ | sparcv9-* | sparcv9b-* | stormy16-* | strongarm-* | sv1-* \
+ | t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \
+ | v850-* | vax-* \
+ | we32k-* \
+ | x86-* | x86_64-* | xmp-* | xps100-* | xscale-* \
+ | ymp-* \
+ | z8k-*)
;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
@@ -506,19 +540,19 @@ case $basic_machine in
basic_machine=i370-ibm
;;
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
- i[34567]86v32)
+ i*86v32)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv32
;;
- i[34567]86v4*)
+ i*86v4*)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv4
;;
- i[34567]86v)
+ i*86v)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv
;;
- i[34567]86sol2)
+ i*86sol2)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-solaris2
;;
@@ -564,6 +598,10 @@ case $basic_machine in
basic_machine=i386-pc
os=-msvc
;;
+ i386-mksnt)
+ basic_machine=i386-pc
+ os=-mksnt
+ ;;
#### End MozillaHack
miniframe)
basic_machine=m68000-convergent
@@ -698,7 +736,7 @@ case $basic_machine in
pc532 | pc532-*)
basic_machine=ns32k-pc532
;;
- pentium | p5 | k5 | k6 | nexgen)
+ pentium | p5 | k5 | k6 | nexgen | viac3)
basic_machine=i586-pc
;;
pentiumpro | p6 | 6x86 | athlon)
@@ -707,7 +745,7 @@ case $basic_machine in
pentiumii | pentium2)
basic_machine=i686-pc
;;
- pentium-* | p5-* | k5-* | k6-* | nexgen-*)
+ pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentiumpro-* | p6-* | 6x86-* | athlon-*)
@@ -731,6 +769,16 @@ case $basic_machine in
ppcle-* | powerpclittle-*)
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
+ ppc64) basic_machine=powerpc64-unknown
+ ;;
+ ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+ basic_machine=powerpc64le-unknown
+ ;;
+ ppc64le-* | powerpc64little-*)
+ basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
ps2)
basic_machine=i386-ibm
;;
@@ -759,7 +807,7 @@ case $basic_machine in
basic_machine=sh-hitachi
os=-hms
;;
- sparclite-wrs)
+ sparclite-wrs | simso-wrs)
basic_machine=sparclite-wrs
os=-vxworks
;;
@@ -885,6 +933,10 @@ case $basic_machine in
basic_machine=hppa1.1-winbond
os=-proelf
;;
+ windows32)
+ basic_machine=i386-pc
+ os=-windows32-msvcrt
+ ;;
xmp)
basic_machine=xmp-cray
os=-unicos
@@ -938,10 +990,10 @@ case $basic_machine in
we32k)
basic_machine=we32k-att
;;
- sh3 | sh4)
+ sh3 | sh4 | sh3eb | sh4eb)
basic_machine=sh-unknown
;;
- sparc | sparcv9)
+ sparc | sparcv9 | sparcv9b)
basic_machine=sparc-sun
;;
cydra)
@@ -1028,17 +1080,19 @@ case $os in
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -chorusos* | -chorusrdb* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
- | -msvc* \
+ | -msvc* | -mksnt* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
- | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -os2*)
+ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+ | -os2* | -vos*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
case $basic_machine in
- x86-* | i[34567]86-*)
+ x86-* | i*86-*)
;;
*)
os=-nto$os
@@ -1357,6 +1411,9 @@ case $basic_machine in
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
vendor=atari
;;
+ -vos*)
+ vendor=stratus
+ ;;
esac
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
;;
diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in
index bde370f2..3a049f60 100644
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -8,13 +8,13 @@ MOZILLA_CLIENT = @MOZILLA_CLIENT@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
-includedir = @includedir@/nspr
+includedir = @includedir@
libdir = @libdir@
datadir = @datadir@
dist_prefix = @dist_prefix@
dist_bindir = @dist_bindir@
-dist_includedir = @dist_includedir@/nspr
+dist_includedir = @dist_includedir@
dist_libdir = @dist_libdir@
DIST = $(dist_prefix)
diff --git a/config/nsinstall.c b/config/nsinstall.c
index f128cef1..0f3cd3e2 100644
--- a/config/nsinstall.c
+++ b/config/nsinstall.c
@@ -67,7 +67,7 @@
* Does getcwd() take NULL as the first argument and malloc
* the result buffer?
*/
-#if !defined(RHAPSODY) && !defined(NEXTSTEP) && !defined(VMS)
+#if !defined(DARWIN) && !defined(NEXTSTEP) && !defined(VMS)
#define GETCWD_CAN_MALLOC
#endif
diff --git a/config/nspr-config.in b/config/nspr-config.in
index d6776558..daae782d 100755
--- a/config/nspr-config.in
+++ b/config/nspr-config.in
@@ -107,7 +107,7 @@ if test "$echo_libs" = "yes"; then
fi
os_ldflags="@LDFLAGS@"
for i in $os_ldflags ; do
- if echo $i | grep ^-L >/dev/null; then
+ if echo $i | grep \^-L >/dev/null; then
libdirs="$libdirs $i"
fi
done
diff --git a/config/prdepend.h b/config/prdepend.h
index 8bebd56b..28c1b139 100644
--- a/config/prdepend.h
+++ b/config/prdepend.h
@@ -39,3 +39,4 @@
*/
#error "Do not include this header file."
+
diff --git a/configure b/configure
index bb0e2ae5..8ef37c3d 100755
--- a/configure
+++ b/configure
@@ -18,7 +18,7 @@ ac_help="$ac_help
--with-dist-bindir=DIR build execuatables in DIR [DIST_PREFIX/bin]"
ac_help="$ac_help
--with-dist-includedir=DIR
- build include files in DIR [DIST_PREFIX/include]"
+ build include files in DIR [DIST_PREFIX/include/nspr]"
ac_help="$ac_help
--with-dist-libdir=DIR build library files in DIR [DIST_PREFIX/lib]"
ac_help="$ac_help
@@ -727,6 +727,9 @@ case "$target" in
*-msvc*)
_WIN32_MSVC=1
;;
+*-mksnt*)
+ _WIN32_MSVC=1
+ ;;
esac
if test -n "$_WIN32_MSVC"; then
@@ -737,8 +740,11 @@ fi
dist_prefix='${MOD_DEPTH}/dist'
dist_bindir='${dist_prefix}/bin'
-dist_includedir='${dist_prefix}/include'
+dist_includedir='${dist_prefix}/include/nspr'
dist_libdir='${dist_prefix}/lib'
+if test "${includedir}" = '${prefix}/include'; then
+ includedir='${prefix}/include/nspr'
+fi
# Check whether --with-dist-prefix or --without-dist-prefix was given.
if test "${with_dist_prefix+set}" = set; then
@@ -954,7 +960,7 @@ if test -z "$SKIP_PATH_CHECKS"; then
# Extract the first word of "$WHOAMI whoami", so it can be a program name with args.
set dummy $WHOAMI whoami; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:958: checking for $ac_word" >&5
+echo "configure:964: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_WHOAMI'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1019,14 +1025,14 @@ if test "$target" != "$host"; then
_SAVE_LDFLAGS="$LDFLAGS"
echo $ac_n "checking for $host compiler""... $ac_c" 1>&6
-echo "configure:1023: checking for $host compiler" >&5
+echo "configure:1029: checking for $host compiler" >&5
if test -z "$HOST_CC"; then
for ac_prog in gcc cc /usr/ucb/cc
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1030: checking for $ac_word" >&5
+echo "configure:1036: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_HOST_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1073,16 +1079,16 @@ test -n "$HOST_CC" || HOST_CC=""""
LDFLAGS="$HOST_LDFLAGS"
echo $ac_n "checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1077: checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works" >&5
+echo "configure:1083: checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works" >&5
cat > conftest.$ac_ext <<EOF
-#line 1079 "configure"
+#line 1085 "configure"
#include "confdefs.h"
int main() {
return(0);
; return 0; }
EOF
-if { (eval echo configure:1086: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1092: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_prog_host_cc_works=1 echo "$ac_t""yes" 1>&6
else
@@ -1103,7 +1109,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1107: checking for $ac_word" >&5
+echo "configure:1113: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1138,7 +1144,7 @@ test -n "$CC" || CC="echo"
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1142: checking for $ac_word" >&5
+echo "configure:1148: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1168,7 +1174,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1172: checking for $ac_word" >&5
+echo "configure:1178: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1219,7 +1225,7 @@ fi
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1223: checking for $ac_word" >&5
+echo "configure:1229: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1251,7 +1257,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1255: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1261: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -1262,12 +1268,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
-#line 1266 "configure"
+#line 1272 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:1271: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1277: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@@ -1293,12 +1299,12 @@ if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1297: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1303: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:1302: checking whether we are using GNU C" >&5
+echo "configure:1308: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1307,7 +1313,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1311: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1317: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@@ -1326,7 +1332,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1330: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1336: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1363,7 +1369,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1367: checking for $ac_word" >&5
+echo "configure:1373: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1400,7 +1406,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1404: checking for $ac_word" >&5
+echo "configure:1410: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1432,7 +1438,7 @@ test -n "$CXX" || CXX="gcc"
echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1436: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
+echo "configure:1442: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -1443,12 +1449,12 @@ cross_compiling=$ac_cv_prog_cxx_cross
cat > conftest.$ac_ext << EOF
-#line 1447 "configure"
+#line 1453 "configure"
#include "confdefs.h"
int main(){return(0);}
EOF
-if { (eval echo configure:1452: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1458: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cxx_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@@ -1474,12 +1480,12 @@ if test $ac_cv_prog_cxx_works = no; then
{ echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1478: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1484: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6
cross_compiling=$ac_cv_prog_cxx_cross
echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
-echo "configure:1483: checking whether we are using GNU C++" >&5
+echo "configure:1489: checking whether we are using GNU C++" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1488,7 +1494,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1492: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1498: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gxx=yes
else
ac_cv_prog_gxx=no
@@ -1507,7 +1513,7 @@ ac_test_CXXFLAGS="${CXXFLAGS+set}"
ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=
echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
-echo "configure:1511: checking whether ${CXX-g++} accepts -g" >&5
+echo "configure:1517: checking whether ${CXX-g++} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1544,7 +1550,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1548: checking for $ac_word" >&5
+echo "configure:1554: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1581,7 +1587,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1585: checking for $ac_word" >&5
+echo "configure:1591: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1618,7 +1624,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1622: checking for $ac_word" >&5
+echo "configure:1628: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1655,7 +1661,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1659: checking for $ac_word" >&5
+echo "configure:1665: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1692,7 +1698,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1696: checking for $ac_word" >&5
+echo "configure:1702: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1729,7 +1735,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1733: checking for $ac_word" >&5
+echo "configure:1739: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1766,7 +1772,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1770: checking for $ac_word" >&5
+echo "configure:1776: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1804,7 +1810,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1808: checking for $ac_word" >&5
+echo "configure:1814: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1836,7 +1842,7 @@ test -n "$CXX" || CXX="gcc"
echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1840: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
+echo "configure:1846: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -1847,12 +1853,12 @@ cross_compiling=$ac_cv_prog_cxx_cross
cat > conftest.$ac_ext << EOF
-#line 1851 "configure"
+#line 1857 "configure"
#include "confdefs.h"
int main(){return(0);}
EOF
-if { (eval echo configure:1856: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1862: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cxx_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@@ -1878,12 +1884,12 @@ if test $ac_cv_prog_cxx_works = no; then
{ echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1882: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1888: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6
cross_compiling=$ac_cv_prog_cxx_cross
echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
-echo "configure:1887: checking whether we are using GNU C++" >&5
+echo "configure:1893: checking whether we are using GNU C++" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1892,7 +1898,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1896: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1902: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gxx=yes
else
ac_cv_prog_gxx=no
@@ -1911,7 +1917,7 @@ ac_test_CXXFLAGS="${CXXFLAGS+set}"
ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=
echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
-echo "configure:1915: checking whether ${CXX-g++} accepts -g" >&5
+echo "configure:1921: checking whether ${CXX-g++} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1948,7 +1954,7 @@ fi
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1952: checking for $ac_word" >&5
+echo "configure:1958: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1978,7 +1984,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1982: checking for $ac_word" >&5
+echo "configure:1988: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2029,7 +2035,7 @@ fi
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2033: checking for $ac_word" >&5
+echo "configure:2039: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2061,7 +2067,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:2065: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:2071: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -2072,12 +2078,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
-#line 2076 "configure"
+#line 2082 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:2081: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2087: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@@ -2103,12 +2109,12 @@ if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:2107: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:2113: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:2112: checking whether we are using GNU C" >&5
+echo "configure:2118: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2117,7 +2123,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2121: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2127: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@@ -2136,7 +2142,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:2140: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:2146: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2169,7 +2175,7 @@ fi
fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:2173: checking how to run the C preprocessor" >&5
+echo "configure:2179: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -2184,13 +2190,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 2188 "configure"
+#line 2194 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2194: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2200: \"$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
:
@@ -2201,13 +2207,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 2205 "configure"
+#line 2211 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2211: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2217: \"$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
:
@@ -2218,13 +2224,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 2222 "configure"
+#line 2228 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2228: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2234: \"$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
:
@@ -2251,7 +2257,7 @@ echo "$ac_t""$CPP" 1>&6
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2255: checking for $ac_word" >&5
+echo "configure:2261: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2283,7 +2289,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2287: checking for $ac_word" >&5
+echo "configure:2293: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_AS'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2324,7 +2330,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2328: checking for $ac_word" >&5
+echo "configure:2334: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_AR'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2365,7 +2371,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2369: checking for $ac_word" >&5
+echo "configure:2375: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2406,7 +2412,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2410: checking for $ac_word" >&5
+echo "configure:2416: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_STRIP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2447,7 +2453,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2451: checking for $ac_word" >&5
+echo "configure:2457: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_DLLTOOL'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2488,7 +2494,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2492: checking for $ac_word" >&5
+echo "configure:2498: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_WINDRES'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2554,7 +2560,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2558: checking for $ac_word" >&5
+echo "configure:2564: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2687,7 +2693,7 @@ elif test "$OS_ARCH" = "Windows_NT"; then
# Moreover, it doesn't have the -p option, so we need to use uname -m.
#
OS_ARCH=WINNT
-# OS_MINOR_RELEASE=`uname -v`
+ OS_MINOR_RELEASE=`uname -v`
if test "$OS_MINOR_RELEASE" = "00"; then
OS_MINOR_RELEASE=0
fi
@@ -2748,7 +2754,7 @@ OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
case "$host" in
-*-mingw*|*-cygwin*|*-msvc*)
+*-mingw*|*-cygwin*|*-msvc*|*-mksnt*)
;;
*-beos*)
HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE"
@@ -2778,17 +2784,17 @@ EOF
DSO_LDOPTS='-brtl -bM:SRE -bnoentry -bexpall'
ac_safe=`echo "sys/atomic_op.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for sys/atomic_op.h""... $ac_c" 1>&6
-echo "configure:2782: checking for sys/atomic_op.h" >&5
+echo "configure:2788: checking for sys/atomic_op.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 2787 "configure"
+#line 2793 "configure"
#include "confdefs.h"
#include <sys/atomic_op.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2792: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2798: \"$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*
@@ -3094,6 +3100,45 @@ EOF
;;
+*-darwin*)
+ cat >> confdefs.h <<\EOF
+#define XP_UNIX 1
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define DARWIN 1
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define HAVE_BSD_FLOCK 1
+EOF
+
+ CFLAGS="$CFLAGS -Wmost -fno-common -pipe"
+ if echo $OS_TEST | grep -c 86 2>/dev/null; then
+ CFLAGS="$CFLAGS -mno-486"
+ cat >> confdefs.h <<\EOF
+#define i386 1
+EOF
+
+ CPU_ARCH=i386
+ else
+ cat >> confdefs.h <<\EOF
+#define ppc 1
+EOF
+
+ CPU_ARCH=ppc
+ fi
+ DSO_LDOPTS='-dynamiclib -compatibility_version 1 -current_version 1 -all_load -install_name @executable_path/$@'
+ # Use the standard preprocessor (cpp)
+ CFLAGS="$CFLAGS -traditional-cpp"
+ MKSHLIB='$(CC) -arch $(CPU_ARCH) $(DSO_LDOPTS) -o $@'
+ STRIP="$STRIP -x -S"
+ DLL_SUFFIX=dylib
+ USE_PTHREADS=1
+ MDCPUCFG_H=_darwin.cfg
+ PR_MD_CSRCS=darwin.c
+ ;;
+
*-dgux*)
cat >> confdefs.h <<\EOF
#define XP_UNIX 1
@@ -3233,7 +3278,7 @@ EOF
fi
- if echo "$OS_RELEASE" | egrep '^(B.10.30|B.11.00)' >/dev/null; then
+ if echo "$OS_RELEASE" | egrep '^(B.10.30|B.11.00|B.11.11)' >/dev/null; then
cat >> confdefs.h <<\EOF
#define HAVE_POINTER_LOCALTIME_R 1
EOF
@@ -3292,7 +3337,7 @@ EOF
DEFAULT_IMPL_STRATEGY=_PTH
fi
- if test "$OS_RELEASE" = "B.11.00"; then
+ if echo "$OS_RELEASE" | egrep '^(B.11.00|B.11.11)' >/dev/null; then
cat >> confdefs.h <<\EOF
#define HPUX10 1
EOF
@@ -3557,7 +3602,7 @@ EOF
esac
;;
-*-mingw*|*-cygwin*|*-msvc*)
+*-mingw*|*-cygwin*|*-msvc*|*-mksnt*)
cat >> confdefs.h <<\EOF
#define XP_PC 1
EOF
@@ -3917,16 +3962,12 @@ EOF
MDCPUCFG_H=_nto.cfg
PR_MD_CSRCS=nto.c
- MKSHLIB='qcc -Vgcc_ntox86 -shared -Wl,-h$(@:$(OBJDIR)/%.so=%.so) -M -o $(@:$(OBJDIR)/%.so=%.so)'
- CFLAGS="$CFLAGS -Wc,-Wall -Wc,-Wno-parentheses -shared"
+ MKSHLIB='$(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(notdir $@) -o $@'
+ DSO_CFLAGS=-fPIC
+ DSO_LDOPTS=-shared
OS_LIBS="$OS_LIBS -lsocket"
_OPTIMIZE_FLAGS="-O1"
- _DEBUG_FLAGS="-O1 -gstabs"
- CC="qcc -Vgcc_ntox86 -w"
- CXX='$(CC)'
- LD="qcc -Vgcc_ntox86 -nostdlib"
- AR="qcc -Vgcc_ntox86 -M -a $@"
- AR_FLAGS=
+ _DEBUG_FLAGS="-gstabs"
;;
*-openbsd*)
@@ -4010,17 +4051,17 @@ EOF
ac_safe=`echo "machine/builtins.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for machine/builtins.h""... $ac_c" 1>&6
-echo "configure:4014: checking for machine/builtins.h" >&5
+echo "configure:4055: 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 4019 "configure"
+#line 4060 "configure"
#include "confdefs.h"
#include <machine/builtins.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4024: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4065: \"$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*
@@ -4101,42 +4142,6 @@ EOF
PR_MD_CSRCS=qnx.c
;;
-*-darwin*)
- cat >> confdefs.h <<\EOF
-#define XP_UNIX 1
-EOF
-
- cat >> confdefs.h <<\EOF
-#define RHAPSODY 1
-EOF
-
- cat >> confdefs.h <<\EOF
-#define HAVE_BSD_FLOCK 1
-EOF
-
- CFLAGS="$CFLAGS -Wmost -fno-common -pipe"
- if echo $OS_TEST | grep -c 86 2>/dev/null; then
- CFLAGS="$CFLAGS -mno-486"
- cat >> confdefs.h <<\EOF
-#define i386 1
-EOF
-
- CPU_ARCH=i386
- else
- cat >> confdefs.h <<\EOF
-#define ppc 1
-EOF
-
- CPU_ARCH=ppc
- fi
- DSO_LDOPTS='-dynamiclib -compatibility_version 1 -current_version 1 -all_load'
- MKSHLIB='$(CC) -arch $(CPU_ARCH) $(DSO_LDOPTS) -o $@'
- DLL_SUFFIX=dylib
- USE_PTHREADS=1
- MDCPUCFG_H=_rhapsody.cfg
- PR_MD_CSRCS=rhapsody.c
- ;;
-
*-*-sco*)
cat >> confdefs.h <<\EOF
#define XP_UNIX 1
@@ -4567,12 +4572,12 @@ esac
if test -z "$SKIP_LIBRARY_CHECKS"; then
echo $ac_n "checking for dlopen""... $ac_c" 1>&6
-echo "configure:4571: checking for dlopen" >&5
+echo "configure:4576: checking for dlopen" >&5
if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4576 "configure"
+#line 4581 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char dlopen(); below. */
@@ -4595,7 +4600,7 @@ dlopen();
; return 0; }
EOF
-if { (eval echo configure:4599: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4604: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_dlopen=yes"
else
@@ -4614,7 +4619,7 @@ else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:4618: checking for dlopen in -ldl" >&5
+echo "configure:4623: checking for dlopen in -ldl" >&5
ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4622,7 +4627,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4626 "configure"
+#line 4631 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -4633,7 +4638,7 @@ int main() {
dlopen()
; return 0; }
EOF
-if { (eval echo configure:4637: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4642: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -4661,13 +4666,13 @@ fi
if test $ac_cv_prog_gcc = yes; then
echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:4665: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:4670: checking whether ${CC-cc} needs -traditional" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_pattern="Autoconf.*'x'"
cat > conftest.$ac_ext <<EOF
-#line 4671 "configure"
+#line 4676 "configure"
#include "confdefs.h"
#include <sgtty.h>
Autoconf TIOCGETP
@@ -4685,7 +4690,7 @@ rm -f conftest*
if test $ac_cv_prog_gcc_traditional = no; then
cat > conftest.$ac_ext <<EOF
-#line 4689 "configure"
+#line 4694 "configure"
#include "confdefs.h"
#include <termio.h>
Autoconf TCGETA
@@ -4709,12 +4714,12 @@ fi
for ac_func in lchown strerror
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4713: checking for $ac_func" >&5
+echo "configure:4718: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4718 "configure"
+#line 4723 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4737,7 +4742,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4741: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4746: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -4775,7 +4780,7 @@ fi
echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6
-echo "configure:4779: checking for pthread_create in -lpthreads" >&5
+echo "configure:4784: checking for pthread_create in -lpthreads" >&5
echo "
#include <pthread.h>
void *foo(void *v) { int a = 1; }
@@ -4797,7 +4802,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
-echo "configure:4801: checking for pthread_create in -lpthread" >&5
+echo "configure:4806: checking for pthread_create in -lpthread" >&5
echo "
#include <pthread.h>
void *foo(void *v) { int a = 1; }
@@ -4819,7 +4824,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6
-echo "configure:4823: checking for pthread_create in -lc_r" >&5
+echo "configure:4828: checking for pthread_create in -lc_r" >&5
echo "
#include <pthread.h>
void *foo(void *v) { int a = 1; }
@@ -4841,7 +4846,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6
-echo "configure:4845: checking for pthread_create in -lc" >&5
+echo "configure:4850: checking for pthread_create in -lc" >&5
echo "
#include <pthread.h>
void *foo(void *v) { int a = 1; }
@@ -4991,7 +4996,7 @@ if test -n "$USE_PTHREADS"; then
rm -f conftest*
ac_cv_have_dash_pthread=no
echo $ac_n "checking whether ${CC-cc} accepts -pthread""... $ac_c" 1>&6
-echo "configure:4995: checking whether ${CC-cc} accepts -pthread" >&5
+echo "configure:5000: checking whether ${CC-cc} accepts -pthread" >&5
echo 'int main() { return 0; }' | cat > conftest.c
${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
if test $? -eq 0; then
@@ -5007,7 +5012,7 @@ echo "configure:4995: checking whether ${CC-cc} accepts -pthread" >&5
ac_cv_have_dash_pthreads=no
if test "$ac_cv_have_dash_pthread" = "no"; then
echo $ac_n "checking whether ${CC-cc} accepts -pthreads""... $ac_c" 1>&6
-echo "configure:5011: checking whether ${CC-cc} accepts -pthreads" >&5
+echo "configure:5016: checking whether ${CC-cc} accepts -pthreads" >&5
echo 'int main() { return 0; }' | cat > conftest.c
${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
if test $? -eq 0; then
@@ -5167,7 +5172,7 @@ EOF
fi
;;
-*-mingw*|*-cygwin*|*-uwin*|*-msvc*)
+*-mingw*|*-cygwin*|*-msvc*|*-mksnt*)
USE_PTHREADS=
_PTHREAD_LDFLAGS=
USE_USER_PTHREADS=
@@ -5233,6 +5238,18 @@ EOF
fi
fi
;;
+*-nto*)
+ if test -n "$USE_PTHREADS"; then
+ cat >> confdefs.h <<\EOF
+#define _PR_HAVE_GETHOST_R 1
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define _PR_HAVE_GETHOST_R_POINTER 1
+EOF
+
+ fi
+ ;;
esac
OS_LIBS="$_PTHREAD_LDFLAGS $OS_LIBS"
@@ -5364,6 +5381,7 @@ lib/ds/Makefile
lib/libc/Makefile
lib/libc/include/Makefile
lib/libc/src/Makefile
+lib/tests/Makefile
pr/Makefile
pr/include/Makefile
pr/include/md/Makefile
@@ -5468,7 +5486,7 @@ s%\[%\\&%g
s%\]%\\&%g
s%\$%$$%g
EOF
-DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
+DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '| tr '\015' ' '`
rm -f conftest.defs
diff --git a/configure.in b/configure.in
index b15eb304..ddb625fb 100644
--- a/configure.in
+++ b/configure.in
@@ -101,6 +101,9 @@ case "$target" in
*-msvc*)
_WIN32_MSVC=1
;;
+*-mksnt*)
+ _WIN32_MSVC=1
+ ;;
esac
if test -n "$_WIN32_MSVC"; then
@@ -116,8 +119,11 @@ dnl =
dnl ========================================================
dist_prefix='${MOD_DEPTH}/dist'
dist_bindir='${dist_prefix}/bin'
-dist_includedir='${dist_prefix}/include'
+dist_includedir='${dist_prefix}/include/nspr'
dist_libdir='${dist_prefix}/lib'
+if test "${includedir}" = '${prefix}/include'; then
+ includedir='${prefix}/include/nspr'
+fi
AC_ARG_WITH(dist-prefix,
[ --with-dist-prefix=DIST_PREFIX
@@ -130,7 +136,7 @@ AC_ARG_WITH(dist-bindir,
AC_ARG_WITH(dist-includedir,
[ --with-dist-includedir=DIR
- build include files in DIR [DIST_PREFIX/include]],
+ build include files in DIR [DIST_PREFIX/include/nspr]],
dist_includedir=$withval)
AC_ARG_WITH(dist-libdir,
@@ -537,7 +543,7 @@ elif test "$OS_ARCH" = "Windows_NT"; then
# Moreover, it doesn't have the -p option, so we need to use uname -m.
#
OS_ARCH=WINNT
-# OS_MINOR_RELEASE=`uname -v`
+ OS_MINOR_RELEASE=`uname -v`
if test "$OS_MINOR_RELEASE" = "00"; then
OS_MINOR_RELEASE=0
fi
@@ -602,7 +608,7 @@ dnl ========================================================
dnl Override of system specific host options
dnl ========================================================
case "$host" in
-*-mingw*|*-cygwin*|*-msvc*)
+*-mingw*|*-cygwin*|*-msvc*|*-mksnt*)
;;
*-beos*)
HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE"
@@ -778,6 +784,30 @@ case "$target" in
;;
+*-darwin*)
+ AC_DEFINE(XP_UNIX)
+ AC_DEFINE(DARWIN)
+ AC_DEFINE(HAVE_BSD_FLOCK)
+ CFLAGS="$CFLAGS -Wmost -fno-common -pipe"
+ if echo $OS_TEST | grep -c 86 2>/dev/null; then
+ CFLAGS="$CFLAGS -mno-486"
+ AC_DEFINE(i386)
+ CPU_ARCH=i386
+ else
+ AC_DEFINE(ppc)
+ CPU_ARCH=ppc
+ fi
+ DSO_LDOPTS='-dynamiclib -compatibility_version 1 -current_version 1 -all_load -install_name @executable_path/$@'
+ # Use the standard preprocessor (cpp)
+ CFLAGS="$CFLAGS -traditional-cpp"
+ MKSHLIB='$(CC) -arch $(CPU_ARCH) $(DSO_LDOPTS) -o $@'
+ STRIP="$STRIP -x -S"
+ DLL_SUFFIX=dylib
+ USE_PTHREADS=1
+ MDCPUCFG_H=_darwin.cfg
+ PR_MD_CSRCS=darwin.c
+ ;;
+
*-dgux*)
AC_DEFINE(XP_UNIX)
AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
@@ -860,7 +890,7 @@ case "$target" in
AC_DEFINE(HAVE_INT_LOCALTIME_R)
fi
- if echo "$OS_RELEASE" | egrep '^(B.10.30|B.11.00)' >/dev/null; then
+ if echo "$OS_RELEASE" | egrep '^(B.10.30|B.11.00|B.11.11)' >/dev/null; then
AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
fi
@@ -895,7 +925,7 @@ case "$target" in
DEFAULT_IMPL_STRATEGY=_PTH
fi
- if test "$OS_RELEASE" = "B.11.00"; then
+ if echo "$OS_RELEASE" | egrep '^(B.11.00|B.11.11)' >/dev/null; then
AC_DEFINE(HPUX10)
AC_DEFINE(HPUX11)
AC_DEFINE(_LARGEFILE64_SOURCE)
@@ -1083,7 +1113,7 @@ case "$target" in
esac
;;
-*-mingw*|*-cygwin*|*-msvc*)
+*-mingw*|*-cygwin*|*-msvc*|*-mksnt*)
AC_DEFINE(XP_PC)
AC_DEFINE(WIN32)
PR_MD_ARCH_DIR=windows
@@ -1320,16 +1350,12 @@ mips-sony-newsos*)
AC_DEFINE(HAVE_POINTER_LOCALTIME_R)
MDCPUCFG_H=_nto.cfg
PR_MD_CSRCS=nto.c
- MKSHLIB='qcc -Vgcc_ntox86 -shared -Wl,-h$(@:$(OBJDIR)/%.so=%.so) -M -o $(@:$(OBJDIR)/%.so=%.so)'
- CFLAGS="$CFLAGS -Wc,-Wall -Wc,-Wno-parentheses -shared"
+ MKSHLIB='$(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(notdir $@) -o $@'
+ DSO_CFLAGS=-fPIC
+ DSO_LDOPTS=-shared
OS_LIBS="$OS_LIBS -lsocket"
_OPTIMIZE_FLAGS="-O1"
- _DEBUG_FLAGS="-O1 -gstabs"
- CC="qcc -Vgcc_ntox86 -w"
- CXX='$(CC)'
- LD="qcc -Vgcc_ntox86 -nostdlib"
- AR="qcc -Vgcc_ntox86 -M -a $@"
- AR_FLAGS=
+ _DEBUG_FLAGS="-gstabs"
;;
*-openbsd*)
@@ -1415,27 +1441,6 @@ mips-sony-newsos*)
PR_MD_CSRCS=qnx.c
;;
-*-darwin*)
- AC_DEFINE(XP_UNIX)
- AC_DEFINE(RHAPSODY)
- AC_DEFINE(HAVE_BSD_FLOCK)
- CFLAGS="$CFLAGS -Wmost -fno-common -pipe"
- if echo $OS_TEST | grep -c 86 2>/dev/null; then
- CFLAGS="$CFLAGS -mno-486"
- AC_DEFINE(i386)
- CPU_ARCH=i386
- else
- AC_DEFINE(ppc)
- CPU_ARCH=ppc
- fi
- DSO_LDOPTS='-dynamiclib -compatibility_version 1 -current_version 1 -all_load'
- MKSHLIB='$(CC) -arch $(CPU_ARCH) $(DSO_LDOPTS) -o $@'
- DLL_SUFFIX=dylib
- USE_PTHREADS=1
- MDCPUCFG_H=_rhapsody.cfg
- PR_MD_CSRCS=rhapsody.c
- ;;
-
*-*-sco*)
AC_DEFINE(XP_UNIX)
AC_DEFINE(SCO)
@@ -2063,7 +2068,7 @@ case "$target" in
AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
fi
;;
-*-mingw*|*-cygwin*|*-uwin*|*-msvc*)
+*-mingw*|*-cygwin*|*-msvc*|*-mksnt*)
dnl win32 does not use pthreads
USE_PTHREADS=
_PTHREAD_LDFLAGS=
@@ -2109,6 +2114,12 @@ case "$target" in
fi
fi
;;
+*-nto*)
+ if test -n "$USE_PTHREADS"; then
+ AC_DEFINE(_PR_HAVE_GETHOST_R)
+ AC_DEFINE(_PR_HAVE_GETHOST_R_POINTER)
+ fi
+ ;;
esac
OS_LIBS="$_PTHREAD_LDFLAGS $OS_LIBS"
@@ -2248,6 +2259,7 @@ lib/ds/Makefile
lib/libc/Makefile
lib/libc/include/Makefile
lib/libc/src/Makefile
+lib/tests/Makefile
pr/Makefile
pr/include/Makefile
pr/include/md/Makefile
diff --git a/lib/libc/include/plstr.h b/lib/libc/include/plstr.h
index b619a934..551567e4 100644
--- a/lib/libc/include/plstr.h
+++ b/lib/libc/include/plstr.h
@@ -18,6 +18,7 @@
* Rights Reserved.
*
* Contributor(s):
+ * Roland Mainz <roland mainz@informatik.med.uni-giessen.de>
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU General Public License Version 2 or later (the
@@ -434,7 +435,29 @@ PR_EXTERN(char *)
PL_strncaserstr(const char *big, const char *little, PRUint32 max);
/*
- * Things not (yet?) included: strspn/strcspn, strtok/strtok_r, strsep.
+ * PL_strtok_r
+ *
+ * Splits the string s1 into tokens, separated by one or more characters
+ * from the separator string s2. The argument lasts points to a
+ * user-supplied char * pointer in which PL_strtok_r stores information
+ * for it to continue scanning the same string.
+ *
+ * In the first call to PL_strtok_r, s1 points to a string and the value
+ * of *lasts is ignored. PL_strtok_r returns a pointer to the first
+ * token, writes '\0' into the character following the first token, and
+ * updates *lasts.
+ *
+ * In subsequent calls, s1 is null and lasts must stay unchanged from the
+ * previous call. The separator string s2 may be different from call to
+ * call. PL_strtok_r returns a pointer to the next token in s1. When no
+ * token remains in s1, PL_strtok_r returns null.
+ */
+
+PR_EXTERN(char *)
+PL_strtok_r(char *s1, const char *s2, char **lasts);
+
+/*
+ * Things not (yet?) included: strspn/strcspn, strsep.
* memchr, memcmp, memcpy, memccpy, index, rindex, bcmp, bcopy, bzero.
* Any and all i18n/l10n stuff.
*/
diff --git a/lib/libc/src/Makefile.in b/lib/libc/src/Makefile.in
index d79b9c9a..2977399e 100644
--- a/lib/libc/src/Makefile.in
+++ b/lib/libc/src/Makefile.in
@@ -57,6 +57,7 @@ CSRCS =\
strpbrk.c \
strstr.c \
strcstr.c \
+ strtok.c \
base64.c \
plerror.c \
plgetopt.c \
diff --git a/lib/libc/src/strtok.c b/lib/libc/src/strtok.c
new file mode 100644
index 00000000..243a8981
--- /dev/null
+++ b/lib/libc/src/strtok.c
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is the Netscape Portable Runtime (NSPR).
+ *
+ * The Initial Developer of the Original Code is Netscape
+ * Communications Corporation. Portions created by Netscape are
+ * Copyright (C) 2001 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ * Roland Mainz <roland mainz@informatik.med.uni-giessen.de>
+ *
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU General Public License Version 2 or later (the
+ * "GPL"), in which case the provisions of the GPL are applicable
+ * instead of those above. If you wish to allow use of your
+ * version of this file only under the terms of the GPL and not to
+ * allow others to use your version of this file under the MPL,
+ * indicate your decision by deleting the provisions above and
+ * replace them with the notice and other provisions required by
+ * the GPL. If you do not delete the provisions above, a recipient
+ * may use your version of this file under either the MPL or the
+ * GPL.
+ */
+
+#include "plstr.h"
+
+PR_IMPLEMENT(char *)
+PL_strtok_r(char *s1, const char *s2, char **lasts)
+{
+ const char *sepp;
+ int c, sc;
+ char *tok;
+
+ if( s1 == NULL )
+ {
+ if( *lasts == NULL )
+ return NULL;
+
+ s1 = *lasts;
+ }
+
+ for( ; (c = *s1) != 0; s1++ )
+ {
+ for( sepp = s2 ; (sc = *sepp) != 0 ; sepp++ )
+ {
+ if( c == sc )
+ break;
+ }
+ if( sc == 0 )
+ break;
+ }
+
+ if( c == 0 )
+ {
+ *lasts = NULL;
+ return NULL;
+ }
+
+ tok = s1++;
+
+ for( ; (c = *s1) != 0; s1++ )
+ {
+ for( sepp = s2; (sc = *sepp) != 0; sepp++ )
+ {
+ if( c == sc )
+ {
+ *s1++ = '\0';
+ *lasts = s1;
+ return tok;
+ }
+ }
+ }
+ *lasts = NULL;
+ return tok;
+}
diff --git a/lib/tests/string.c b/lib/tests/string.c
index 895189c3..ec839752 100644
--- a/lib/tests/string.c
+++ b/lib/tests/string.c
@@ -3003,6 +3003,59 @@ PRBool test_030(void)
return PR_TRUE;
}
+/* PL_strtok_r */
+PRBool test_031(void)
+{
+ static const char *tokens[] = {
+ "wtc", "relyea", "nelsonb", "jpierre", "nicolson",
+ "ian.mcgreer", "kirk.erickson", "sonja.mirtitsch", "mhein"
+ };
+
+ static const char *seps[] = {
+ ", ", ",", " ", "\t", ",,,", " ,", " ", " \t\t", ","
+ };
+
+ static const char s2[] = ", \t";
+
+ char string[ 1024 ];
+ char *s1;
+ char *token;
+ char *lasts;
+ unsigned int i;
+
+ printf("Test 031 (PL_strtok_r) ..."); fflush(stdout);
+
+ /* Build the string. */
+ string[0] = '\0';
+ for( i = 0; i < sizeof(tokens)/sizeof(tokens[0]); i++ )
+ {
+ PL_strcat(string, tokens[i]);
+ PL_strcat(string, seps[i]);
+ }
+
+ /* Scan the string for tokens. */
+ i = 0;
+ s1 = string;
+ while( (token = PL_strtok_r(s1, s2, &lasts)) != NULL)
+ {
+ if( PL_strcmp(token, tokens[i]) != 0 )
+ {
+ printf("FAIL wrong token scanned\n");
+ return PR_FALSE;
+ }
+ i++;
+ s1 = NULL;
+ }
+ if( i != sizeof(tokens)/sizeof(tokens[0]) )
+ {
+ printf("FAIL wrong number of tokens scanned\n");
+ return PR_FALSE;
+ }
+
+ printf("PASS\n");
+ return PR_TRUE;
+}
+
int
main
(
@@ -3044,6 +3097,7 @@ main
&& test_028()
&& test_029()
&& test_030()
+ && test_031()
)
{
printf("Suite passed.\n");
diff --git a/macbuild/NSPR20PPC.mcp b/macbuild/NSPR20PPC.mcp
index a0a17543..ee949c26 100644
--- a/macbuild/NSPR20PPC.mcp
+++ b/macbuild/NSPR20PPC.mcp
Binary files differ
diff --git a/pr/include/gencfg.c b/pr/include/gencfg.c
index b49f548c..87bf4912 100644
--- a/pr/include/gencfg.c
+++ b/pr/include/gencfg.c
@@ -94,8 +94,8 @@
#endif
#if defined(__APPLE__)
-#ifndef RHAPSODY
- error - RHAPSODY is not defined
+#ifndef DARWIN
+ error - DARWIN is not defined
#endif
#endif
diff --git a/pr/include/md/Makefile.in b/pr/include/md/Makefile.in
index 2a18192f..316c4540 100644
--- a/pr/include/md/Makefile.in
+++ b/pr/include/md/Makefile.in
@@ -41,11 +41,13 @@ VPATH = @srcdir@
include $(MOD_DEPTH)/config/autoconf.mk
HEADERS = $(wildcard $(srcdir)/*.h)
+CONFIGS = $(wildcard $(srcdir)/*.cfg)
include $(topsrcdir)/config/rules.mk
export:: $(MDCPUCFG_H)
$(INSTALL) -m 444 $(srcdir)/$(MDCPUCFG_H) $(dist_includedir)
+ $(INSTALL) -m 444 $(CONFIGS) $(HEADERS) $(dist_includedir)/md
ifneq ($(OS_ARCH),OpenVMS)
mv -f $(dist_includedir)/$(MDCPUCFG_H) $(dist_includedir)/prcpucfg.h
else
@@ -58,7 +60,7 @@ endif
real_install::
$(NSINSTALL) -D $(DESTDIR)$(includedir)/md
cp $(srcdir)/$(MDCPUCFG_H) $(DESTDIR)$(includedir)/prcpucfg.h
- $(NSINSTALL) -t -m 644 $(HEADERS) $(DESTDIR)$(includedir)/md
+ $(NSINSTALL) -t -m 644 $(CONFIG) $(HEADERS) $(DESTDIR)$(includedir)/md
release:: export
@echo "Copying machine-dependent prcpucfg.h"
diff --git a/pr/include/md/_darwin.cfg b/pr/include/md/_darwin.cfg
index c820eb30..d06492b8 100644
--- a/pr/include/md/_darwin.cfg
+++ b/pr/include/md/_darwin.cfg
@@ -39,8 +39,8 @@
#define XP_UNIX
#endif
-#ifndef RHAPOSDY
-#define RHAPOSDY
+#ifndef DARWIN
+#define DARWIN
#endif
#define PR_AF_INET6 30 /* same as AF_INET6 */
diff --git a/pr/include/md/_darwin.h b/pr/include/md/_darwin.h
index 996b8a85..d262849c 100644
--- a/pr/include/md/_darwin.h
+++ b/pr/include/md/_darwin.h
@@ -32,15 +32,15 @@
* GPL.
*/
-#ifndef nspr_rhapsody_defs_h___
-#define nspr_rhapsody_defs_h___
+#ifndef nspr_darwin_defs_h___
+#define nspr_darwin_defs_h___
#include "prthread.h"
#include <sys/syscall.h>
-#define PR_LINKER_ARCH "rhapsody"
-#define _PR_SI_SYSNAME "RHAPSODY"
+#define PR_LINKER_ARCH "darwin"
+#define _PR_SI_SYSNAME "DARWIN"
#ifdef i386
#define _PR_SI_ARCHITECTURE "x86"
#else
@@ -219,4 +219,4 @@ extern PRIntervalTime _PR_UNIX_TicksPerSecond(void);
/* For writev() */
#include <sys/uio.h>
-#endif /* nspr_rhapsody_defs_h___ */
+#endif /* nspr_darwin_defs_h___ */
diff --git a/pr/include/md/_macos.h b/pr/include/md/_macos.h
index 2cc737d7..caf73cb9 100644
--- a/pr/include/md/_macos.h
+++ b/pr/include/md/_macos.h
@@ -120,11 +120,10 @@ struct _MDFileDesc {
/* Server sockets: listen bit tells the notifier func what to do */
PRBool doListen;
-
+
_MDSocketCallerInfo misc;
_MDSocketCallerInfo read;
_MDSocketCallerInfo write;
- _MDSocketCallerInfo poll;
};
/*
@@ -138,6 +137,23 @@ struct _MDFileDesc {
** Interrupts Related definitions
*/
+#define _MD_GET_INTSOFF() (_pr_intsOff)
+
+#define _MD_INTSOFF(_is) \
+ PR_BEGIN_MACRO \
+ ENTER_CRITICAL_REGION(); \
+ (_is) = _PR_MD_GET_INTSOFF(); \
+ _PR_MD_SET_INTSOFF(1); \
+ LEAVE_CRITICAL_REGION(); \
+ PR_END_MACRO
+
+#if TARGET_CARBON
+extern void _MD_SetIntsOff(PRInt32 ints);
+#define _MD_SET_INTSOFF(_val) _MD_SetIntsOff(_val)
+#else /* not TARGET_CARBON */
+#define _MD_SET_INTSOFF(_val) (_pr_intsOff = _val)
+#endif /* TARGET_CARBON */
+
#define _MD_START_INTERRUPTS _MD_StartInterrupts
#define _MD_STOP_INTERRUPTS _MD_StopInterrupts
#define _MD_BLOCK_CLOCK_INTERRUPTS()
@@ -238,6 +254,8 @@ extern PRStatus _MD_InitThread(PRThread *thread);
/*
** Initialize the thread context preparing it to execute _main.
+** *sp = 0 zeros out the sp for the first stack frame so that
+** stack walking code can find the top of the stack.
*/
#if defined(powerc) || defined(__powerc)
#define _MD_INIT_CONTEXT(_thread, _sp, _main, _status) \
@@ -248,6 +266,7 @@ extern PRStatus _MD_InitThread(PRThread *thread);
*((PRBool *)_status) = PR_TRUE; \
(void) setjmp(jb); \
sp = INIT_STACKPTR(_sp); \
+ *sp = 0; \
(_MD_GET_SP(_thread)) = (long) sp; \
tvect = (unsigned long *)_main; \
(_MD_GET_PC(_thread)) = (int) *tvect; \
@@ -627,4 +646,36 @@ extern PRStatus _MD_CloseFileMap(struct PRFileMap *fmap);
extern void SetLogFileTypeCreator(const char *logFile);
extern int _MD_mac_get_nonblocking_connect_error(PRInt32 osfd);
+
+/*
+ * Critical section support
+ */
+
+#define MAC_CRITICAL_REGIONS TARGET_CARBON
+
+#if MAC_CRITICAL_REGIONS
+
+extern void InitCriticalRegion();
+extern void TermCriticalRegion();
+
+extern void EnterCritialRegion();
+extern void LeaveCritialRegion();
+
+#define INIT_CRITICAL_REGION() InitCriticalRegion()
+#define TERM_CRITICAL_REGION() TermCriticalRegion()
+
+#define ENTER_CRITICAL_REGION() EnterCritialRegion()
+#define LEAVE_CRITICAL_REGION() LeaveCritialRegion()
+
+#else
+
+#define INIT_CRITICAL_REGION()
+#define TERM_CRITICAL_REGION()
+
+#define ENTER_CRITICAL_REGION()
+#define LEAVE_CRITICAL_REGION()
+
+#endif
+
+
#endif /* prmacos_h___ */
diff --git a/pr/include/md/_nto.h b/pr/include/md/_nto.h
index 4786251e..de6b8033 100644
--- a/pr/include/md/_nto.h
+++ b/pr/include/md/_nto.h
@@ -62,6 +62,7 @@
#define PR_HAVE_POSIX_NAMED_SHARED_MEMORY
#define _PR_HAVE_POSIX_SEMAPHORES
+#undef FD_SETSIZE
#define FD_SETSIZE 4096
#include <sys/time.h>
#include <sys/types.h>
diff --git a/pr/include/md/_pth.h b/pr/include/md/_pth.h
index 997f32f7..21815728 100644
--- a/pr/include/md/_pth.h
+++ b/pr/include/md/_pth.h
@@ -96,6 +96,52 @@
#define _PT_PTHREAD_COND_INIT(m, a) pthread_cond_init(&(m), &(a))
#endif
+/* The pthreads standard does not specify an invalid value for the
+ * pthread_t handle. (0 is usually an invalid pthread identifier
+ * but there are exceptions, for example, DG/UX.) These macros
+ * define a way to set the handle to or compare the handle with an
+ * invalid identifier. These macros are not portable and may be
+ * more of a problem as we adapt to more pthreads implementations.
+ * They are only used in the PRMonitor functions. Do not use them
+ * in new code.
+ *
+ * Unfortunately some of our clients depend on certain properties
+ * of our PRMonitor implementation, preventing us from replacing
+ * it by a portable implementation.
+ * - High-performance servers like the fact that PR_EnterMonitor
+ * only calls PR_Lock and PR_ExitMonitor only calls PR_Unlock.
+ * (A portable implementation would use a PRLock and a PRCondVar
+ * to implement the recursive lock in a monitor and call both
+ * PR_Lock and PR_Unlock in PR_EnterMonitor and PR_ExitMonitor.)
+ * Unfortunately this forces us to read the monitor owner field
+ * without holding a lock.
+ * - One way to make it safe to read the monitor owner field
+ * without holding a lock is to make that field a PRThread*
+ * (one should be able to read a pointer with a single machine
+ * instruction). However, PR_GetCurrentThread calls calloc if
+ * it is called by a thread that was not created by NSPR. The
+ * malloc tracing tools in the Mozilla client use PRMonitor for
+ * locking in their malloc, calloc, and free functions. If
+ * PR_EnterMonitor calls any of these functions, infinite
+ * recursion ensues.
+ */
+#if defined(_PR_DCETHREADS)
+#define _PT_PTHREAD_INVALIDATE_THR_HANDLE(t) \
+ memset(&(t), 0, sizeof(pthread_t))
+#define _PT_PTHREAD_THR_HANDLE_IS_INVALID(t) \
+ (!memcmp(&(t), &pt_zero_tid, sizeof(pthread_t)))
+#define _PT_PTHREAD_COPY_THR_HANDLE(st, dt) (dt) = (st)
+#elif defined(IRIX) || defined(OSF1) || defined(AIX) || defined(SOLARIS) \
+ || defined(HPUX) || defined(LINUX) || defined(FREEBSD) \
+ || defined(NETBSD) || defined(OPENBSD) || defined(BSDI) \
+ || defined(VMS) || defined(NTO) || defined(DARWIN)
+#define _PT_PTHREAD_INVALIDATE_THR_HANDLE(t) (t) = 0
+#define _PT_PTHREAD_THR_HANDLE_IS_INVALID(t) (t) == 0
+#define _PT_PTHREAD_COPY_THR_HANDLE(st, dt) (dt) = (st)
+#else
+#error "pthreads is not supported for this architecture"
+#endif
+
#if defined(_PR_DCETHREADS)
#define _PT_PTHREAD_ATTR_INIT pthread_attr_create
#define _PT_PTHREAD_ATTR_DESTROY pthread_attr_delete
@@ -199,7 +245,7 @@
#define PT_PRIO_MIN 1
#define PT_PRIO_MAX 127
#elif defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
- || defined(BSDI) || defined(RHAPSODY) /* XXX */
+ || defined(BSDI) || defined(DARWIN) /* XXX */
#define PT_PRIO_MIN 0
#define PT_PRIO_MAX 126
#else
@@ -232,7 +278,7 @@ extern int (*_PT_aix_yield_fcn)();
PR_END_MACRO
#elif defined(HPUX) || defined(LINUX) || defined(SOLARIS) \
|| defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
- || defined(BSDI) || defined(NTO) || defined(RHAPSODY)
+ || defined(BSDI) || defined(NTO) || defined(DARWIN)
#define _PT_PTHREAD_YIELD() sched_yield()
#else
#error "Need to define _PT_PTHREAD_YIELD for this platform"
diff --git a/pr/include/md/_unixos.h b/pr/include/md/_unixos.h
index 676b3ab2..345c48d5 100644
--- a/pr/include/md/_unixos.h
+++ b/pr/include/md/_unixos.h
@@ -43,7 +43,7 @@
* Linux: FD_SETSIZE is defined in /usr/include/sys/select.h and should
* not be redefined.
*/
-#if !defined(LINUX) && !defined(RHAPSODY) && !defined(NEXTSTEP)
+#if !defined(LINUX) && !defined(DARWIN) && !defined(NEXTSTEP)
#ifndef FD_SETSIZE
#define FD_SETSIZE 4096
#endif
@@ -165,7 +165,7 @@ extern void _MD_unix_init_running_cpu(struct _PRCPU *cpu);
#define PROT_NONE 0x0
#endif
-#if defined(DEBUG) && !defined(RHAPSODY) && !defined(NEXTSTEP)
+#if defined(DEBUG) && !defined(DARWIN) && !defined(NEXTSTEP)
#if !defined(SOLARIS)
#include <string.h> /* for memset() */
#define _MD_INIT_STACK(ts,REDZONE) \
diff --git a/pr/include/md/prosdep.h b/pr/include/md/prosdep.h
index 9ca8cf68..7016cbb7 100644
--- a/pr/include/md/prosdep.h
+++ b/pr/include/md/prosdep.h
@@ -93,8 +93,8 @@ PR_BEGIN_EXTERN_C
#elif defined(OSF1)
#include "md/_osf1.h"
-#elif defined(RHAPSODY)
-#include "md/_rhapsody.h"
+#elif defined(DARWIN)
+#include "md/_darwin.h"
#elif defined(NEXTSTEP)
#include "md/_nextstep.h"
diff --git a/pr/include/obsolete/protypes.h b/pr/include/obsolete/protypes.h
index a569ff24..e96cfcf6 100644
--- a/pr/include/obsolete/protypes.h
+++ b/pr/include/obsolete/protypes.h
@@ -110,7 +110,7 @@ typedef PRUint64 uint64;
*/
#if !defined(XP_BEOS) && !defined(VMS)
-#if !defined(XP_MAC) && !defined(_WIN32) && !defined(XP_OS2)
+#if !defined(XP_MAC) && !defined(_WIN32) && !defined(XP_OS2) && !defined(NTO)
typedef PRUint32 uint32;
#else
typedef unsigned long uint32;
@@ -150,7 +150,7 @@ typedef PRInt64 int64;
&& !defined(_PR_AIX_HAVE_BSD_INT_TYPES) \
&& !defined(HPUX)
#if !defined(WIN32) || !defined(_WINSOCK2API_) /* defines its own "int32" */
-#if !defined(XP_MAC) && !defined(_WIN32) && !defined(XP_OS2)
+#if !defined(XP_MAC) && !defined(_WIN32) && !defined(XP_OS2) && !defined(NTO)
typedef PRInt32 int32;
#else
typedef long int32;
diff --git a/pr/include/private/primpl.h b/pr/include/private/primpl.h
index eb1dd716..1a0b0b08 100644
--- a/pr/include/private/primpl.h
+++ b/pr/include/private/primpl.h
@@ -328,8 +328,10 @@ NSPR_API(PRInt32) _pr_intsOff;
#define _MD_LAST_THREAD() (_pr_lastThread)
#define _MD_SET_LAST_THREAD(t) (_pr_lastThread = t)
+#ifndef XP_MAC
#define _MD_GET_INTSOFF() (_pr_intsOff)
#define _MD_SET_INTSOFF(_val) (_pr_intsOff = _val)
+#endif
/* The unbalanced curly braces in these two macros are intentional */
@@ -374,12 +376,20 @@ extern PRInt32 _native_threads_only;
#else
+#ifdef XP_MAC
+
+#define _PR_INTSOFF(_is) _MD_INTSOFF(_is)
+
+#else /* XP_MAC */
+
#define _PR_INTSOFF(_is) \
PR_BEGIN_MACRO \
(_is) = _PR_MD_GET_INTSOFF(); \
_PR_MD_SET_INTSOFF(1); \
PR_END_MACRO
+#endif /* XP_MAC */
+
#define _PR_FAST_INTSON(_is) \
PR_BEGIN_MACRO \
_PR_MD_SET_INTSOFF(_is); \
@@ -1450,7 +1460,7 @@ struct PRMonitor {
const char* name; /* monitor name for debugging */
#if defined(_PR_PTHREADS)
PRLock lock; /* the lock structure */
- PRThread *owner; /* the owner of the lock or NULL */
+ pthread_t owner; /* the owner of the lock or invalid */
PRCondVar *cvar; /* condition variable queue */
#else /* defined(_PR_PTHREADS) */
PRCondVar *cvar; /* associated lock and condition variable queue */
@@ -1785,7 +1795,7 @@ extern PRFileDesc *_pr_stderr;
#if !defined(_PR_NO_PREEMPT) && defined(XP_UNIX) \
&& !defined(_PR_PTHREADS) && !defined(_PR_GLOBAL_THREADS_ONLY) \
&& !defined(PURIFY) \
- && !defined(RHAPSODY) \
+ && !defined(DARWIN) \
&& !defined(NEXTSTEP) \
&& !defined(QNX) \
&& !(defined (UNIXWARE) && defined (USE_SVR4_THREADS))
diff --git a/pr/src/Makefile.in b/pr/src/Makefile.in
index 64356527..d4af5676 100644
--- a/pr/src/Makefile.in
+++ b/pr/src/Makefile.in
@@ -69,13 +69,24 @@ ifeq ($(OS_ARCH),SunOS)
ifeq ($(OS_RELEASE),4.1.3_U1)
OS_LIBS = -lm
else # 4.1.3_U1
+
+#
+# In Solaris 2.6 or earlier, -lrt is called -lposix4.
+#
+LIBRT_TEST=$(firstword $(sort 5.7 $(OS_RELEASE)))
+ifeq (5.7, $(LIBRT_TEST))
+LIBRT=-lrt
+else
+LIBRT=-lposix4
+endif
+
ifdef USE_PTHREADS
-OS_LIBS = -lpthread -lthread -lposix4 -lsocket -lnsl -ldl
+OS_LIBS = -lpthread -lthread ${LIBRT} -lsocket -lnsl -ldl
else
ifdef LOCAL_THREADS_ONLY
OS_LIBS = -lsocket -lnsl -ldl
else
-OS_LIBS = -lthread -lposix4 -lsocket -lnsl -ldl
+OS_LIBS = -lthread ${LIBRT} -lsocket -lnsl -ldl
endif # LOCAL_THREADS_ONLY
endif # USE_PTHREADS
endif # 4.1.3_U1
diff --git a/pr/src/linking/prlink.c b/pr/src/linking/prlink.c
index 8d3a79ca..b3802055 100644
--- a/pr/src/linking/prlink.c
+++ b/pr/src/linking/prlink.c
@@ -85,7 +85,7 @@
/*
* On these platforms, symbols have a leading '_'.
*/
-#if defined(SUNOS4) || defined(RHAPSODY) || defined(NEXTSTEP) \
+#if defined(SUNOS4) || defined(DARWIN) || defined(NEXTSTEP) \
|| defined(OPENBSD) || defined(WIN16) \
|| (defined(NETBSD) && !defined(__ELF__))
#define NEED_LEADING_UNDERSCORE
@@ -748,7 +748,12 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags)
#ifdef HAVE_DLL
{
#if defined(USE_DLFCN)
+#ifdef NTO
+ /* Neutrino needs RTLD_GROUP to load Netscape plugins. (bug 71179) */
+ int dl_flags = RTLD_GROUP;
+#else
int dl_flags = 0;
+#endif
void *h;
if (flags & PR_LD_LAZY) {
diff --git a/pr/src/md/beos/beos_errors.c b/pr/src/md/beos/beos_errors.c
index 3af7179a..6532cc8e 100644
--- a/pr/src/md/beos/beos_errors.c
+++ b/pr/src/md/beos/beos_errors.c
@@ -176,12 +176,6 @@ void _MD_unix_map_unlink_error(int err)
case EROFS:
PR_SetError(PR_READ_ONLY_FILESYSTEM_ERROR, err);
break;
-#if !defined(OSF1) && !defined(FREEBSD) && !defined(BSDI) && !defined(RHAPSODY) && !defined(BEOS)
- case EMULTIHOP:
- case ENOLINK:
- PR_SetError(PR_REMOTE_FILE_ERROR, err);
- break;
-#endif
default:
PR_SetError(PR_UNKNOWN_ERROR, err);
break;
@@ -201,10 +195,6 @@ void _MD_unix_map_stat_error(int err)
PR_SetError(PR_PENDING_INTERRUPT_ERROR, err);
break;
case ETIMEDOUT:
-#if !defined(OSF1) && !defined(FREEBSD) && !defined(BSDI) && !defined(RHAPSODY) && !defined(BEOS)
- case EMULTIHOP:
- case ENOLINK:
-#endif
PR_SetError(PR_REMOTE_FILE_ERROR, err);
break;
case ELOOP:
@@ -294,12 +284,6 @@ void _MD_unix_map_rename_error(int err)
case ELOOP:
PR_SetError(PR_LOOP_ERROR, err);
break;
-#if !defined(OSF1) && !defined(FREEBSD) && !defined(BSDI) && !defined(RHAPSODY) && !defined(BEOS)
- case EMULTIHOP:
- case ENOLINK:
- PR_SetError(PR_REMOTE_FILE_ERROR, err);
- break;
-#endif
case ENAMETOOLONG:
PR_SetError(PR_NAME_TOO_LONG_ERROR, err);
break;
@@ -345,10 +329,6 @@ void _MD_unix_map_access_error(int err)
case ELOOP:
PR_SetError(PR_LOOP_ERROR, err);
break;
-#if !defined(OSF1) && !defined(FREEBSD) && !defined(BSDI) && !defined(RHAPSODY) && !defined(BEOS)
- case EMULTIHOP:
- case ENOLINK:
-#endif
case ETIMEDOUT:
PR_SetError(PR_REMOTE_FILE_ERROR, err);
break;
@@ -411,12 +391,6 @@ void _MD_unix_map_mkdir_error(int err)
case EIO:
PR_SetError(PR_IO_ERROR, err);
break;
-#if !defined(OSF1) && !defined(FREEBSD) && !defined(BSDI) && !defined(RHAPSODY) && !defined(BEOS)
- case EMULTIHOP:
- case ENOLINK:
- PR_SetError(PR_REMOTE_FILE_ERROR, err);
- break;
-#endif
default:
PR_SetError(PR_UNKNOWN_ERROR, err);
break;
@@ -448,10 +422,6 @@ void _MD_unix_map_rmdir_error(int err)
case ELOOP:
PR_SetError(PR_LOOP_ERROR, err);
break;
-#if !defined(OSF1) && !defined(FREEBSD) && !defined(BSDI) && !defined(RHAPSODY) && !defined(BEOS)
- case EMULTIHOP:
- case ENOLINK:
-#endif
case ETIMEDOUT:
PR_SetError(PR_REMOTE_FILE_ERROR, err);
break;
@@ -1397,10 +1367,6 @@ void _MD_unix_map_open_error(int err)
PR_SetError(PR_NO_ACCESS_RIGHTS_ERROR, err);
break;
case ETIMEDOUT:
-#if !defined(OSF1) && !defined(FREEBSD) && !defined(BSDI) && !defined(RHAPSODY) && !defined(BEOS)
- case EMULTIHOP:
- case ENOLINK:
-#endif
PR_SetError(PR_REMOTE_FILE_ERROR, err);
break;
case EROFS:
diff --git a/pr/src/md/mac/macio.c b/pr/src/md/mac/macio.c
index 9bc408dd..d1d58b2e 100644
--- a/pr/src/md/mac/macio.c
+++ b/pr/src/md/mac/macio.c
@@ -91,20 +91,21 @@ typedef struct ExtendedParamBlock ExtendedParamBlock;
static void AsyncIOCompletion (ExtendedParamBlock *pbAsyncPtr)
{
_PRCPU *cpu = _PR_MD_CURRENT_CPU();
- PRThread *thread = pbAsyncPtr->thread;
-
+ PRThread *thread = pbAsyncPtr->thread;
+ PRIntn is;
+
if (_PR_MD_GET_INTSOFF()) {
- cpu->u.missed[cpu->where] |= _PR_MISSED_IO;
thread->md.missedIONotify = PR_TRUE;
- return;
+ cpu->u.missed[cpu->where] |= _PR_MISSED_IO;
+ return;
}
- _PR_MD_SET_INTSOFF(1);
- thread->md.osErrCode = noErr;
- DoneWaitingOnThisThread(thread);
+ _PR_INTSOFF(is);
- _PR_MD_SET_INTSOFF(0);
+ thread->md.osErrCode = noErr;
+ DoneWaitingOnThisThread(thread);
+ _PR_FAST_INTSON(is);
}
void _MD_SetError(OSErr oserror)
@@ -247,9 +248,9 @@ PRInt32 ReadWriteProc(PRFileDesc *fd, void *buf, PRUint32 bytes, IOOperation op)
{
PRInt32 refNum = fd->secret->md.osfd;
OSErr err;
- ExtendedParamBlock pbAsync;
+ ExtendedParamBlock pbAsync;
PRThread *me = _PR_MD_CURRENT_THREAD();
- _PRCPU *cpu = _PR_MD_CURRENT_CPU();
+ _PRCPU *cpu = _PR_MD_CURRENT_CPU();
/* quick hack to allow PR_fprintf, etc to work with stderr, stdin, stdout */
/* note, if a user chooses "seek" or the like as an operation in another function */
@@ -270,12 +271,13 @@ PRInt32 ReadWriteProc(PRFileDesc *fd, void *buf, PRUint32 bytes, IOOperation op)
}
return (bytes);
-
}
else
{
static IOCompletionUPP sCompletionUPP = NULL;
+ PRBool doingAsync = PR_FALSE;
+
/* allocate the callback Universal Procedure Pointer (UPP). This actually allocates
a 32 byte Ptr in the heap, so only do this once
*/
@@ -296,9 +298,11 @@ PRInt32 ReadWriteProc(PRFileDesc *fd, void *buf, PRUint32 bytes, IOOperation op)
/*
** Issue the async read call and wait for the io semaphore associated
** with this thread.
- ** Don't compute error code from async call. Bug in OS returns a garbage value.
+ ** Async file system calls *never* return error values, so ignore their
+ ** results (see <http://developer.apple.com/technotes/fl/fl_515.html>);
+ ** the completion routine is always called.
*/
- me->io_fd = refNum;
+ me->io_fd = refNum;
me->md.osErrCode = noErr;
if (op == READ_ASYNC)
{
@@ -308,39 +312,33 @@ PRInt32 ReadWriteProc(PRFileDesc *fd, void *buf, PRUint32 bytes, IOOperation op)
*/
if ( bytes > 20480L )
{
- err = PBReadAsync(&pbAsync.pb);
- if (err != noErr && err != eofErr)
- goto ErrorExit;
+ doingAsync = PR_TRUE;
+ me->io_pending = PR_TRUE;
- me->io_pending = PR_TRUE; /* Only mark thread io pending if async call worked */
+ (void)PBReadAsync(&pbAsync.pb);
}
else
{
- (void) PBReadSync(&pbAsync.pb);
- /*
- ** This is probbaly redundant but want to make sure we indicate the read
- ** is complete so we don't wander off into the Sargasso Sea of Mac
- ** threading
- */
- pbAsync.pb.ioParam.ioResult = 0;
+ pbAsync.pb.ioParam.ioCompletion = NULL;
+ me->io_pending = PR_FALSE;
+
+ err = PBReadSync(&pbAsync.pb);
+ if (err != noErr && err != eofErr)
+ goto ErrorExit;
}
}
else
{
+ doingAsync = PR_TRUE;
+ me->io_pending = PR_TRUE;
+
/* writes are currently always async */
- err = PBWriteAsync(&pbAsync.pb);
- if (err != noErr)
- goto ErrorExit;
-
- /* Didn't get an error on the asyn call so mark thread io pending */
- me->io_pending = PR_TRUE;
+ (void)PBWriteAsync(&pbAsync.pb);
}
- /* See if the i/o call is still pending before we actually yield */
- if (pbAsync.pb.ioParam.ioResult == 1)
+ if (doingAsync) {
WaitOnThisThread(me, PR_INTERVAL_NO_TIMEOUT);
- else
- me->io_pending = PR_FALSE; /* io completed so don't mark thread io pending */
+ }
}
err = me->md.osErrCode;
@@ -350,13 +348,13 @@ PRInt32 ReadWriteProc(PRFileDesc *fd, void *buf, PRUint32 bytes, IOOperation op)
err = pbAsync.pb.ioParam.ioResult;
if (err != noErr && err != eofErr)
goto ErrorExit;
- else
- return pbAsync.pb.ioParam.ioActCount;
+
+ return pbAsync.pb.ioParam.ioActCount;
ErrorExit:
me->md.osErrCode = err;
_MD_SetError(err);
- return -1;
+ return -1;
}
/*
diff --git a/pr/src/md/mac/macrng.c b/pr/src/md/mac/macrng.c
index 332c375e..d9e18d1e 100644
--- a/pr/src/md/mac/macrng.c
+++ b/pr/src/md/mac/macrng.c
@@ -33,13 +33,6 @@
*/
-#if 0 /* XXX what the flip is this all about? No MAC Wizards here. */
-#ifdef notdef
-#include "xp_core.h"
-#include "xp_file.h"
-#endif
-#endif /* 0 */
-
/* XXX are all these headers required for a call to TickCount()? */
#include <Events.h>
#include <OSUtils.h>
diff --git a/pr/src/md/mac/macsockotpt.c b/pr/src/md/mac/macsockotpt.c
index 00cc9022..ef15a56b 100644
--- a/pr/src/md/mac/macsockotpt.c
+++ b/pr/src/md/mac/macsockotpt.c
@@ -171,8 +171,8 @@ static pascal void DNSNotifierRoutine(void * contextPtr, OTEventCode otEvent, O
switch (otEvent) {
case T_DNRSTRINGTOADDRCOMPLETE:
if (_PR_MD_GET_INTSOFF()) {
- cpu->u.missed[cpu->where] |= _PR_MISSED_IO;
dnsContext.thread->md.missedIONotify = PR_TRUE;
+ cpu->u.missed[cpu->where] |= _PR_MISSED_IO;
return;
}
DoneWaitingOnThisThread(dnsContext.thread);
@@ -187,8 +187,8 @@ static pascal void DNSNotifierRoutine(void * contextPtr, OTEventCode otEvent, O
dnsContext.serviceRef = nil;
if (_PR_MD_GET_INTSOFF()) {
- cpu->u.missed[cpu->where] |= _PR_MISSED_IO;
dnsContext.thread->md.missedIONotify = PR_TRUE;
+ cpu->u.missed[cpu->where] |= _PR_MISSED_IO;
return;
}
DoneWaitingOnThisThread(dnsContext.thread);
@@ -294,8 +294,8 @@ WakeUpNotifiedThread(PRThread *thread, OTResult result)
if (thread) {
thread->md.osErrCode = result;
if (_PR_MD_GET_INTSOFF()) {
- cpu->u.missed[cpu->where] |= _PR_MISSED_IO;
thread->md.missedIONotify = PR_TRUE;
+ cpu->u.missed[cpu->where] |= _PR_MISSED_IO;
return;
}
DoneWaitingOnThisThread(thread);
@@ -305,92 +305,89 @@ WakeUpNotifiedThread(PRThread *thread, OTResult result)
// Notification routine
// Async callback routine.
// A5 is OK. Cannot allocate memory here
+// Ref: http://gemma.apple.com/techpubs/mac/NetworkingOT/NetworkingWOT-100.html
+//
static pascal void NotifierRoutine(void * contextPtr, OTEventCode code, OTResult result, void * cookie)
{
- PRFilePrivate *secret = (PRFilePrivate *) contextPtr;
- _MDFileDesc * md = &(secret->md);
- EndpointRef endpoint = (EndpointRef)secret->md.osfd;
- PRThread * thread = NULL;
- PRThread * pollThread = md->poll.thread;
- OSStatus err;
- OTResult resultOT;
- TDiscon discon;
+ PRFilePrivate *secret = (PRFilePrivate *) contextPtr;
+ _MDFileDesc * md = &(secret->md);
+ EndpointRef endpoint = (EndpointRef)secret->md.osfd;
+ PRThread * readThread = NULL; // also used for 'misc'
+ PRThread * writeThread = NULL;
+ OSStatus err;
+ OTResult resultOT;
+ TDiscon discon;
switch (code)
{
// OTLook Events -
case T_LISTEN: // A connection request is available
- // If md->doListen is true, then PR_Listen has been
- // called on this endpoint; therefore, we're ready to
- // accept connections. But we'll do that with PR_Accept
- // (which calls OTListen, OTAccept, etc) instead of
- // doing it here.
- if (md->doListen) {
- thread = secret->md.misc.thread;
- secret->md.misc.thread = NULL;
- secret->md.misc.cookie = cookie;
- break;
- } else {
- // Reject the connection, we're not listening
- OTSndDisconnect(endpoint, NULL);
- }
+ // If md->doListen is true, then PR_Listen has been
+ // called on this endpoint; therefore, we're ready to
+ // accept connections. But we'll do that with PR_Accept
+ // (which calls OTListen, OTAccept, etc) instead of
+ // doing it here.
+ if (md->doListen) {
+ readThread = secret->md.misc.thread;
+ secret->md.misc.thread = NULL;
+ secret->md.misc.cookie = cookie;
+ break;
+ } else {
+ // Reject the connection, we're not listening
+ OTSndDisconnect(endpoint, NULL);
+ }
break;
-
+
case T_CONNECT: // Confirmation of a connect request
- // cookie = sndCall parameter from OTConnect()
+ // cookie = sndCall parameter from OTConnect()
err = OTRcvConnect(endpoint, NULL);
PR_ASSERT(err == kOTNoError);
- // wake up waiting thread, if any
- thread = secret->md.write.thread;
+ // wake up waiting thread, if any.
+ writeThread = secret->md.write.thread;
secret->md.write.thread = NULL;
- secret->md.write.cookie = cookie;
+ secret->md.write.cookie = cookie;
break;
case T_DATA: // Standard data is available
- // Mark this socket as readable.
- secret->md.readReady = PR_TRUE;
+ // Mark this socket as readable.
+ secret->md.readReady = PR_TRUE;
- // wake up waiting thread, if any
- thread = secret->md.read.thread;
+ // wake up waiting thread, if any
+ readThread = secret->md.read.thread;
secret->md.read.thread = NULL;
secret->md.read.cookie = cookie;
- break;
+ break;
case T_EXDATA: // Expedited data is available
PR_ASSERT(!"T_EXDATA Not implemented");
- return;
+ return;
case T_DISCONNECT: // A disconnect is available
discon.udata.len = 0;
err = OTRcvDisconnect(endpoint, &discon);
PR_ASSERT(err == kOTNoError);
- secret->md.exceptReady = PR_TRUE;
+ secret->md.exceptReady = PR_TRUE; // XXX Check this
- // wake up waiting threads, if any
- result = -3199 - discon.reason; // obtain the negative error code
+ // wake up waiting threads, if any
+ result = -3199 - discon.reason; // obtain the negative error code
+ if ((readThread = secret->md.read.thread) != NULL) {
+ secret->md.read.thread = NULL;
+ secret->md.read.cookie = cookie;
+ }
- if ((thread = secret->md.read.thread) != NULL) {
- secret->md.read.thread = NULL;
- secret->md.read.cookie = cookie;
- WakeUpNotifiedThread(thread, result);
- }
-
- if ((thread = secret->md.write.thread) != NULL) {
- secret->md.write.thread = NULL;
- secret->md.write.cookie = cookie;
- WakeUpNotifiedThread(thread, result);
- }
-
- thread = NULL; // already took care of notification here
+ if ((writeThread = secret->md.write.thread) != NULL) {
+ secret->md.write.thread = NULL;
+ secret->md.write.cookie = cookie;
+ }
break;
-
+
case T_ERROR: // obsolete/unused in library
PR_ASSERT(!"T_ERROR Not implemented");
- return;
-
+ return;
+
case T_UDERR: // UDP Send error; clear the error
- (void) OTRcvUDErr((EndpointRef) cookie, NULL);
+ (void) OTRcvUDErr((EndpointRef) cookie, NULL);
break;
case T_ORDREL: // An orderly release is available
@@ -398,28 +395,27 @@ static pascal void NotifierRoutine(void * contextPtr, OTEventCode code, OTResul
PR_ASSERT(err == kOTNoError);
secret->md.readReady = PR_TRUE; // mark readable (to emulate bsd sockets)
// remember connection is closed, so we can return 0 on read or receive
- secret->md.orderlyDisconnect = PR_TRUE;
-
- thread = secret->md.read.thread;
- secret->md.read.thread = NULL;
- secret->md.read.cookie = cookie;
-
+ secret->md.orderlyDisconnect = PR_TRUE;
+
+ readThread = secret->md.read.thread;
+ secret->md.read.thread = NULL;
+ secret->md.read.cookie = cookie;
break;
case T_GODATA: // Flow control lifted on standard data
secret->md.writeReady = PR_TRUE;
- resultOT = OTLook(endpoint); // clear T_GODATA event
- PR_ASSERT(resultOT == T_GODATA);
-
- // wake up waiting thread, if any
- thread = secret->md.write.thread;
+ resultOT = OTLook(endpoint); // clear T_GODATA event
+ PR_ASSERT(resultOT == T_GODATA);
+
+ // wake up waiting thread, if any
+ writeThread = secret->md.write.thread;
secret->md.write.thread = NULL;
secret->md.write.cookie = cookie;
break;
case T_GOEXDATA: // Flow control lifted on expedited data
PR_ASSERT(!"T_GOEXDATA Not implemented");
- return;
+ return;
case T_REQUEST: // An Incoming request is available
PR_ASSERT(!"T_REQUEST Not implemented");
@@ -430,13 +426,13 @@ static pascal void NotifierRoutine(void * contextPtr, OTEventCode code, OTResul
return;
case T_PASSCON: // State is now T_DATAXFER
- // OTAccept() complete, receiving endpoint in T_DATAXFER state
- // cookie = OTAccept() resRef parameter
- break;
+ // OTAccept() complete, receiving endpoint in T_DATAXFER state
+ // cookie = OTAccept() resRef parameter
+ break;
case T_RESET: // Protocol has been reset
PR_ASSERT(!"T_RESET Not implemented");
- return;
+ return;
// Async Completion Events
case T_BINDCOMPLETE:
@@ -444,39 +440,39 @@ static pascal void NotifierRoutine(void * contextPtr, OTEventCode code, OTResul
case T_ACCEPTCOMPLETE:
case T_OPTMGMTCOMPLETE:
case T_GETPROTADDRCOMPLETE:
- thread = secret->md.misc.thread;
+ readThread = secret->md.misc.thread;
secret->md.misc.thread = NULL;
secret->md.misc.cookie = cookie;
break;
-// case T_OPENCOMPLETE: // we open endpoints in synchronous mode
+// case T_OPENCOMPLETE: // we open endpoints in synchronous mode
// case T_REPLYCOMPLETE:
-// case T_DISCONNECTCOMPLETE: // we don't call OTSndDisconnect()
+// case T_DISCONNECTCOMPLETE: // we don't call OTSndDisconnect()
// case T_RESOLVEADDRCOMPLETE:
// case T_GETINFOCOMPLETE:
// case T_SYNCCOMPLETE:
-// case T_MEMORYRELEASED: // only if OTAckSends() called on endpoint
+// case T_MEMORYRELEASED: // only if OTAckSends() called on endpoint
// case T_REGNAMECOMPLETE:
// case T_DELNAMECOMPLETE:
// case T_LKUPNAMECOMPLETE:
// case T_LKUPNAMERESULT:
- // OpenTptInternet.h
-// case T_DNRSTRINGTOADDRCOMPLETE: // DNS is handled by dnsContext in DNSNotifierRoutine()
+ // OpenTptInternet.h
+// case T_DNRSTRINGTOADDRCOMPLETE: // DNS is handled by dnsContext in DNSNotifierRoutine()
// case T_DNRADDRTONAMECOMPLETE:
// case T_DNRSYSINFOCOMPLETE:
// case T_DNRMAILEXCHANGECOMPLETE:
// case T_DNRQUERYCOMPLETE:
default:
- // we should probably have a bit more sophisticated handling of kOTSystemSleep, etc.
- // PR_ASSERT(code != 0);
+ // we should probably have a bit more sophisticated handling of kOTSystemSleep, etc.
+ // PR_ASSERT(code != 0);
return;
}
- if (pollThread)
- WakeUpNotifiedThread(pollThread, kOTNoError);
+ if (readThread)
+ WakeUpNotifiedThread(readThread, result);
- if (thread && (thread != pollThread))
- WakeUpNotifiedThread(thread, result);
+ if (writeThread && (writeThread != readThread))
+ WakeUpNotifiedThread(writeThread, result);
}
@@ -488,8 +484,8 @@ static OSErr CreateSocket(int type, EndpointRef *endpoint)
OTConfiguration *config;
EndpointRef ep;
- // for now we just create the endpoint
- // we'll make it asynchronous and give it a notifier routine in _MD_makenonblock()
+ // for now we just create the endpoint
+ // we'll make it asynchronous and give it a notifier routine in _MD_makenonblock()
switch (type){
case SOCK_STREAM: configName = kTCPName; break;
@@ -519,7 +515,7 @@ PRInt32 _MD_socket(int domain, int type, int protocol)
OSStatus err;
EndpointRef endpoint;
- _MD_FinishInitNetAccess();
+ _MD_FinishInitNetAccess();
// We only deal with internet domain
if (domain != AF_INET) {
@@ -1171,8 +1167,8 @@ static pascal void RawEndpointNotifierRoutine(void * contextPtr, OTEventCode co
if (thread) {
thread->md.osErrCode = result;
if (_PR_MD_GET_INTSOFF()) {
- cpu->u.missed[cpu->where] |= _PR_MISSED_IO;
thread->md.asyncNotifyPending = PR_TRUE;
+ cpu->u.missed[cpu->where] |= _PR_MISSED_IO;
return;
}
DoneWaitingOnThisThread(thread);
@@ -1349,7 +1345,8 @@ PRInt32 _MD_connect(PRFileDesc *fd, PRNetAddr *addr, PRUint32 addrlen, PRInterva
sndCall.addr.buf = (UInt8*) addr;
if (!fd->secret->nonblocking) {
- PrepareForAsyncCompletion(me, fd->secret->md.osfd);
+ PrepareForAsyncCompletion(me, fd->secret->md.osfd);
+ PR_ASSERT(fd->secret->md.write.thread == NULL);
fd->secret->md.write.thread = me;
}
@@ -1407,7 +1404,10 @@ static PRInt32 SendReceiveStream(PRFileDesc *fd, void *buf, PRInt32 amount,
err = kEFAULTErr;
goto ErrorExit;
}
-
+
+ PR_ASSERT(opCode == kSTREAM_SEND ? fd->secret->md.write.thread == NULL :
+ fd->secret->md.read.thread == NULL);
+
while (bytesLeft > 0)
{
Boolean disabledNotifications = OTEnterNotifier(endpoint);
@@ -1416,7 +1416,6 @@ static PRInt32 SendReceiveStream(PRFileDesc *fd, void *buf, PRInt32 amount,
if (opCode == kSTREAM_SEND) {
do {
-
fd->secret->md.write.thread = me;
fd->secret->md.writeReady = PR_FALSE; // expect the worst
result = OTSnd(endpoint, buf, bytesLeft, NULL);
@@ -1500,8 +1499,10 @@ static PRInt32 SendReceiveStream(PRFileDesc *fd, void *buf, PRInt32 amount,
if (result > 0) {
buf = (void *) ( (UInt32) buf + (UInt32)result );
bytesLeft -= result;
- if (opCode == kSTREAM_RECEIVE)
- return result;
+ if (opCode == kSTREAM_RECEIVE) {
+ amount = result;
+ goto NormalExit;
+ }
} else {
switch (result) {
case kOTLookErr:
@@ -1513,8 +1514,15 @@ static PRInt32 SendReceiveStream(PRFileDesc *fd, void *buf, PRInt32 amount,
case kEAGAINErr:
case kEWOULDBLOCKErr:
if (fd->secret->nonblocking) {
- err = result;
- goto ErrorExit;
+
+ if (bytesLeft == amount) { // no data was sent
+ err = result;
+ goto ErrorExit;
+ }
+
+ // some data was sent
+ amount -= bytesLeft;
+ goto NormalExit;
}
WaitOnThisThread(me, timeout);
@@ -1524,8 +1532,11 @@ static PRInt32 SendReceiveStream(PRFileDesc *fd, void *buf, PRInt32 amount,
break;
case kOTOutStateErr: // if provider already closed, fall through to handle error
- if (fd->secret->md.orderlyDisconnect)
- return 0;
+ if (fd->secret->md.orderlyDisconnect) {
+ amount = 0;
+ goto NormalExit;
+ }
+ // else fall through
default:
err = result;
goto ErrorExit;
@@ -1533,30 +1544,31 @@ static PRInt32 SendReceiveStream(PRFileDesc *fd, void *buf, PRInt32 amount,
}
}
- PR_ASSERT(opCode == kSTREAM_SEND ? fd->secret->md.write.thread == nil :
- fd->secret->md.read.thread == nil);
+NormalExit:
+ PR_ASSERT(opCode == kSTREAM_SEND ? fd->secret->md.write.thread == NULL :
+ fd->secret->md.read.thread == NULL);
return amount;
ErrorExit:
- PR_ASSERT(opCode == kSTREAM_SEND ? fd->secret->md.write.thread == nil :
- fd->secret->md.read.thread == nil);
+ PR_ASSERT(opCode == kSTREAM_SEND ? fd->secret->md.write.thread == NULL :
+ fd->secret->md.read.thread == NULL);
macsock_map_error(err);
return -1;
-}
+}
PRInt32 _MD_recv(PRFileDesc *fd, void *buf, PRInt32 amount,
PRIntn flags, PRIntervalTime timeout)
{
return (SendReceiveStream(fd, buf, amount, flags, timeout, kSTREAM_RECEIVE));
-}
+}
PRInt32 _MD_send(PRFileDesc *fd,const void *buf, PRInt32 amount,
PRIntn flags, PRIntervalTime timeout)
{
return (SendReceiveStream(fd, (void *)buf, amount, flags, timeout, kSTREAM_SEND));
-}
+}
// Errors:
@@ -1638,7 +1650,7 @@ static PRInt32 SendReceiveDgram(PRFileDesc *fd, void *buf, PRInt32 amount,
ErrorExit:
macsock_map_error(err);
return -1;
-}
+}
PRInt32 _MD_recvfrom(PRFileDesc *fd, void *buf, PRInt32 amount,
@@ -1647,7 +1659,7 @@ PRInt32 _MD_recvfrom(PRFileDesc *fd, void *buf, PRInt32 amount,
{
return (SendReceiveDgram(fd, buf, amount, flags, addr, addrlen,
timeout, kDGRAM_RECEIVE));
-}
+}
PRInt32 _MD_sendto(PRFileDesc *fd,const void *buf, PRInt32 amount,
@@ -1656,7 +1668,7 @@ PRInt32 _MD_sendto(PRFileDesc *fd,const void *buf, PRInt32 amount,
{
return (SendReceiveDgram(fd, (void *)buf, amount, flags, addr, &addrlen,
timeout, kDGRAM_SEND));
-}
+}
PRInt32 _MD_closesocket(PRInt32 osfd)
@@ -1683,7 +1695,7 @@ PRInt32 _MD_closesocket(PRInt32 osfd)
ErrorExit:
macsock_map_error(err);
return -1;
-}
+}
PRInt32 _MD_writev(PRFileDesc *fd, const struct PRIOVec *iov, PRInt32 iov_size, PRIntervalTime timeout)
@@ -1693,9 +1705,11 @@ PRInt32 _MD_writev(PRFileDesc *fd, const struct PRIOVec *iov, PRInt32 iov_size,
PR_ASSERT(0);
_PR_MD_CURRENT_THREAD()->md.osErrCode = unimpErr;
return -1;
-}
-
+}
+// OT endpoint states are documented here:
+// http://gemma.apple.com/techpubs/mac/NetworkingOT/NetworkingWOT-27.html#MARKER-9-65
+//
static PRBool GetState(PRFileDesc *fd, PRBool *readReady, PRBool *writeReady, PRBool *exceptReady)
{
OTResult resultOT;
@@ -1706,14 +1720,32 @@ static PRBool GetState(PRFileDesc *fd, PRBool *readReady, PRBool *writeReady, PR
OTCountDataBytes((EndpointRef)fd->secret->md.osfd, &availableData);
*readReady = fd->secret->md.readReady && (availableData > 0);
- *exceptReady = fd->secret->md.exceptReady;
+ *exceptReady = fd->secret->md.exceptReady;
resultOT = OTGetEndpointState((EndpointRef)fd->secret->md.osfd);
- switch (resultOT) {
- case T_DATAXFER:
- case T_INREL:
- *writeReady = PR_TRUE;
+ switch (resultOT) {
+ case T_IDLE:
+ case T_UNBND:
+ // the socket is not connected. Emulating BSD sockets,
+ // we mark it readable and writable. The next PR_Read
+ // or PR_Write will then fail. Usually, in this situation,
+ // fd->secret->md.exceptReady is also set, and returned if
+ // anyone is polling for it.
+ *readReady = PR_FALSE;
+ *writeReady = PR_FALSE;
break;
+
+ case T_DATAXFER: // data transfer
+ *writeReady = fd->secret->md.writeReady;
+ break;
+
+ case T_INREL: // incoming orderly release
+ *writeReady = fd->secret->md.writeReady;
+ break;
+
+ case T_OUTCON: // outgoing connection pending
+ case T_INCON: // incoming connection pending
+ case T_OUTREL: // outgoing orderly release
default:
*writeReady = PR_FALSE;
}
@@ -1811,7 +1843,24 @@ static void SetDescPollThread(PRPollDesc *pds, PRIntn npds, PRThread* thread)
PRFileDesc *bottomFD = PR_GetIdentitiesLayer(pd->fd, PR_NSPR_IO_LAYER);
if (bottomFD && (_PR_FILEDESC_OPEN == bottomFD->secret->state))
{
- bottomFD->secret->md.poll.thread = thread;
+ if (pd->in_flags & PR_POLL_READ) {
+ PR_ASSERT(thread == NULL || bottomFD->secret->md.read.thread == NULL);
+ bottomFD->secret->md.read.thread = thread;
+ }
+
+ if (pd->in_flags & PR_POLL_WRITE) {
+ // it's possible for the writing thread to be non-null during
+ // a non-blocking connect, so we assert that we're on
+ // the same thread, or the thread is null.
+ // Note that it's strictly possible for the connect and poll
+ // to be on different threads, so ideally we need to assert
+ // that if md.write.thread is non-null, there is a non-blocking
+ // connect in progress.
+ PR_ASSERT(thread == NULL ||
+ (bottomFD->secret->md.write.thread == NULL ||
+ bottomFD->secret->md.write.thread == thread));
+ bottomFD->secret->md.write.thread = thread;
+ }
}
}
}
@@ -1822,9 +1871,8 @@ PRInt32 _MD_poll(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout)
PRThread *thread = _PR_MD_CURRENT_THREAD();
intn is;
PRInt32 ready;
- OSErr result;
- if (timeout == PR_INTERVAL_NO_WAIT) {
+ if (timeout == PR_INTERVAL_NO_WAIT) {
return CheckPollDescs(pds, npds);
}
@@ -1835,7 +1883,7 @@ PRInt32 _MD_poll(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout)
// need to set up the thread
PrepareForAsyncCompletion(thread, 0);
- SetDescPollThread(pds, npds, thread);
+ SetDescPollThread(pds, npds, thread);
ready = CheckPollDescs(pds, npds);
PR_Unlock(thread->md.asyncIOLock);
@@ -1843,13 +1891,8 @@ PRInt32 _MD_poll(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout)
if (ready == 0) {
WaitOnThisThread(thread, timeout);
- result = thread->md.osErrCode;
- if (result != noErr && result != kETIMEDOUTErr) {
- PR_ASSERT(0); /* debug: catch unexpected errors */
- ready = -1;
- } else {
- ready = CheckPollDescs(pds, npds);
- }
+ ready = CheckPollDescs(pds, npds);
+
} else {
thread->io_pending = PR_FALSE;
}
@@ -1937,7 +1980,7 @@ PR_IMPLEMENT(PRInt32) _MD_shutdown(PRFileDesc *fd, PRIntn how)
/* Just succeed silently!!! */
return (0);
-}
+}
PR_IMPLEMENT(PRStatus)
@@ -1987,7 +2030,7 @@ _MD_getpeername(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen)
ErrorExit:
macsock_map_error(err);
return PR_FAILURE;
-}
+}
PR_IMPLEMENT(unsigned long) inet_addr(const char *cp)
@@ -1995,7 +2038,7 @@ PR_IMPLEMENT(unsigned long) inet_addr(const char *cp)
OSStatus err;
InetHost host;
- _MD_FinishInitNetAccess();
+ _MD_FinishInitNetAccess();
err = OTInetStringToHost((char*) cp, &host);
if (err != kOTNoError)
@@ -2067,7 +2110,7 @@ PR_IMPLEMENT(struct hostent *) gethostbyaddr(const void *addr, int addrlen, int
PR_IMPLEMENT(char *) inet_ntoa(struct in_addr addr)
{
- _MD_FinishInitNetAccess();
+ _MD_FinishInitNetAccess();
OTInetHostToString((InetHost)addr.s_addr, sHostInfo.name);
@@ -2080,7 +2123,7 @@ PRStatus _MD_gethostname(char *name, int namelen)
OSStatus err;
InetInterfaceInfo info;
- _MD_FinishInitNetAccess();
+ _MD_FinishInitNetAccess();
/*
* On a Macintosh, we don't have the concept of a local host name.
@@ -2164,8 +2207,8 @@ int _MD_mac_get_nonblocking_connect_error(PRInt32 osfd)
case T_IDLE:
return -1;
case T_INREL:
- macsock_map_error(ENOTCONN);
- return -1;
+ macsock_map_error(ENOTCONN);
+ return -1;
default:
PR_ASSERT(0);
return -1;
diff --git a/pr/src/md/mac/macthr.c b/pr/src/md/mac/macthr.c
index 43f9a079..b01eda61 100644
--- a/pr/src/md/mac/macthr.c
+++ b/pr/src/md/mac/macthr.c
@@ -36,12 +36,15 @@
#include <string.h>
-#include <Types.h>
+#include <MacTypes.h>
#include <Timer.h>
#include <OSUtils.h>
#include <LowMem.h>
+#include <Multiprocessing.h>
+#include <Gestalt.h>
+#include "mdcriticalregion.h"
TimerUPP gTimerCallbackUPP = NULL;
PRThread * gPrimaryThread = NULL;
@@ -168,24 +171,26 @@ _PRInterruptTable _pr_interruptTable[] = {
pascal void TimerCallback(TMTaskPtr tmTaskPtr)
{
_PRCPU *cpu = _PR_MD_CURRENT_CPU();
+ PRIntn is;
if (_PR_MD_GET_INTSOFF()) {
cpu->u.missed[cpu->where] |= _PR_MISSED_CLOCK;
- PrimeTime((QElemPtr)tmTaskPtr, kMacTimerInMiliSecs);
- return;
+ PrimeTime((QElemPtr)tmTaskPtr, kMacTimerInMiliSecs);
+ return;
}
- _PR_MD_SET_INTSOFF(1);
- // And tell nspr that a clock interrupt occured.
- _PR_ClockInterrupt();
+ _PR_INTSOFF(is);
+
+ // And tell nspr that a clock interrupt occured.
+ _PR_ClockInterrupt();
- if ((_PR_RUNQREADYMASK(cpu)) >> ((_PR_MD_CURRENT_THREAD()->priority)))
- _PR_SET_RESCHED_FLAG();
+ if ((_PR_RUNQREADYMASK(cpu)) >> ((_PR_MD_CURRENT_THREAD()->priority)))
+ _PR_SET_RESCHED_FLAG();
- _PR_MD_SET_INTSOFF(0);
+ _PR_FAST_INTSON(is);
- // Reset the clock timer so that we fire again.
- PrimeTime((QElemPtr)tmTaskPtr, kMacTimerInMiliSecs);
+ // Reset the clock timer so that we fire again.
+ PrimeTime((QElemPtr)tmTaskPtr, kMacTimerInMiliSecs);
}
@@ -219,25 +224,22 @@ void _MD_StopInterrupts(void)
void _MD_PauseCPU(PRIntervalTime timeout)
{
-#pragma unused (timeout)
-
- /* unsigned long finalTicks; */
- EventRecord theEvent;
+ if (timeout != PR_INTERVAL_NO_WAIT)
+ {
+ EventRecord theEvent;
- if (timeout != PR_INTERVAL_NO_WAIT) {
- /* Delay(1,&finalTicks); */
+ /*
+ ** Calling WaitNextEvent() here is suboptimal. This routine should
+ ** pause the process until IO or the timeout occur, yielding time to
+ ** other processes on operating systems that require this (Mac OS classic).
+ ** WaitNextEvent() may incur too much latency, and has other problems,
+ ** such as the potential to drop suspend/resume events, and to handle
+ ** AppleEvents at a time at which we're not prepared to handle them.
+ */
+ (void) WaitNextEvent(nullEvent, &theEvent, 1, NULL);
- /*
- ** Rather than calling Delay() which basically just wedges the processor
- ** we'll instead call WaitNextEvent() with a mask that ignores all events
- ** which gives other apps a chance to get time rather than just locking up
- ** the machine when we're waiting for a long time (or in an infinite loop,
- ** whichever comes first)
- */
- (void)WaitNextEvent(nullEvent, &theEvent, 1, NULL);
-
- (void) _MD_IOInterrupt();
- }
+ (void) _MD_IOInterrupt();
+ }
}
@@ -276,6 +278,11 @@ void WaitOnThisThread(PRThread *thread, PRIntervalTime timeout)
PRIntervalTime timein = PR_IntervalNow();
PRStatus status = PR_SUCCESS;
+ // Turn interrupts off to avoid a race over lock ownership with the callback
+ // (which can fire at any time). Interrupts may stay off until we leave
+ // this function, or another NSPR thread turns them back on. They certainly
+ // stay off until PR_WaitCondVar() relinquishes the asyncIOLock lock, which
+ // is what we care about.
_PR_INTSOFF(is);
PR_Lock(thread->md.asyncIOLock);
if (timeout == PR_INTERVAL_NO_TIMEOUT) {
@@ -302,9 +309,24 @@ void DoneWaitingOnThisThread(PRThread *thread)
{
intn is;
+ PR_ASSERT(thread->md.asyncIOLock->owner == NULL);
+
+ // DoneWaitingOnThisThread() is called from OT notifiers and async file I/O
+ // callbacks that can run at "interrupt" time (Classic Mac OS) or on pthreads
+ // that may run concurrently with the main threads (Mac OS X). They can thus
+ // be called when any NSPR thread is running, or even while NSPR is in a
+ // thread context switch. It is therefore vital that we can guarantee to
+ // be able to get the asyncIOLock without blocking (thus avoiding code
+ // that makes assumptions about the current NSPR thread etc). To achieve
+ // this, we use NSPR interrrupts as a semaphore on the lock; all code
+ // that grabs the lock also disables interrupts for the time the lock
+ // is held. Callers of DoneWaitingOnThisThread() thus have to check whether
+ // interrupts are already off, and, if so, simply set the missed_IO flag on
+ // the CPU rather than calling this function.
+
_PR_INTSOFF(is);
PR_Lock(thread->md.asyncIOLock);
- thread->io_pending = PR_FALSE;
+ thread->io_pending = PR_FALSE;
/* let the waiting thread know that async IO completed */
PR_NotifyCondVar(thread->md.asyncIOCVar);
PR_Unlock(thread->md.asyncIOLock);
@@ -319,6 +341,7 @@ PR_IMPLEMENT(void) PR_Mac_WaitForAsyncNotify(PRIntervalTime timeout)
PRStatus status = PR_SUCCESS;
PRThread *thread = _PR_MD_CURRENT_THREAD();
+ // See commments in WaitOnThisThread()
_PR_INTSOFF(is);
PR_Lock(thread->md.asyncIOLock);
if (timeout == PR_INTERVAL_NO_TIMEOUT) {
@@ -344,11 +367,14 @@ void AsyncNotify(PRThread *thread)
{
intn is;
+ PR_ASSERT(thread->md.asyncIOLock->owner == NULL);
+
+ // See commments in DoneWaitingOnThisThread()
_PR_INTSOFF(is);
PR_Lock(thread->md.asyncIOLock);
- thread->md.asyncNotifyPending = PR_TRUE;
+ thread->md.asyncNotifyPending = PR_TRUE;
/* let the waiting thread know that async IO completed */
- PR_NotifyCondVar(thread->md.asyncIOCVar); // let thread know that async IO completed
+ PR_NotifyCondVar(thread->md.asyncIOCVar);
PR_Unlock(thread->md.asyncIOLock);
_PR_FAST_INTSON(is);
}
@@ -359,8 +385,8 @@ PR_IMPLEMENT(void) PR_Mac_PostAsyncNotify(PRThread *thread)
_PRCPU * cpu = _PR_MD_CURRENT_CPU();
if (_PR_MD_GET_INTSOFF()) {
- cpu->u.missed[cpu->where] |= _PR_MISSED_IO;
thread->md.missedAsyncNotify = PR_TRUE;
+ cpu->u.missed[cpu->where] |= _PR_MISSED_IO;
} else {
AsyncNotify(thread);
}
@@ -407,3 +433,136 @@ PRStatus _MD_KillProcess(PRProcess *process)
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, unimpErr);
return PR_FAILURE;
}
+//##############################################################################
+//##############################################################################
+#pragma mark -
+#pragma mark INTERRUPT SUPPORT
+
+#if TARGET_CARBON
+
+/*
+ This critical region support is required for Mac NSPR to work correctly on dual CPU
+ machines on Mac OS X. This note explains why.
+
+ NSPR uses a timer task, and has callbacks for async file I/O and Open Transport
+ whose runtime behaviour differs depending on environment. On "Classic" Mac OS
+ these run at "interrupt" time (OS-level interrupts, that is, not NSPR interrupts),
+ and can thus preempt other code, but they always run to completion.
+
+ On Mac OS X, these are all emulated using MP tasks, which sit atop pthreads. Thus,
+ they can be preempted at any time (and not necessarily run to completion), and can
+ also run *concurrently* with eachother, and with application code, on multiple
+ CPU machines. Note that all NSPR threads are emulated, and all run on the main
+ application MP task.
+
+ We thus have to use MP critical sections to protect data that is shared between
+ the various callbacks and the main MP thread. It so happens that NSPR has this
+ concept of software interrupts, and making interrupt-off times be critical
+ sections works.
+
+*/
+
+
+/*
+ Whether to use critical regions. True if running on Mac OS X and later
+*/
+
+PRBool gUseCriticalRegions;
+
+/*
+ Count of the number of times we've entered the critical region.
+ We need this because ENTER_CRITICAL_REGION() will *not* block when
+ called from different NSPR threads (which all run on one MP thread),
+ and we need to ensure that when code turns interrupts back on (by
+ settings _pr_intsOff to 0) we exit the critical section enough times
+ to leave it.
+*/
+
+PRInt32 gCriticalRegionEntryCount;
+
+
+void _MD_SetIntsOff(PRInt32 ints)
+{
+ ENTER_CRITICAL_REGION();
+ gCriticalRegionEntryCount ++;
+
+ _pr_intsOff = ints;
+
+ if (!ints)
+ {
+ PRInt32 i = gCriticalRegionEntryCount;
+
+ gCriticalRegionEntryCount = 0;
+ for ( ;i > 0; i --) {
+ LEAVE_CRITICAL_REGION();
+ }
+ }
+}
+
+
+#endif /* TARGET_CARBON */
+
+
+//##############################################################################
+//##############################################################################
+#pragma mark -
+#pragma mark CRITICAL REGION SUPPORT
+
+#if MAC_CRITICAL_REGIONS
+
+MDCriticalRegionID gCriticalRegion;
+
+void InitCriticalRegion()
+{
+ long systemVersion;
+ OSStatus err;
+
+ // we only need to do critical region stuff on Mac OS X
+ err = Gestalt(gestaltSystemVersion, &systemVersion);
+ gUseCriticalRegions = (err == noErr) && (systemVersion >= 0x00001000);
+
+ if (!gUseCriticalRegions) return;
+
+ err = MD_CriticalRegionCreate(&gCriticalRegion);
+ PR_ASSERT(err == noErr);
+}
+
+void TermCriticalRegion()
+{
+ OSStatus err;
+
+ if (!gUseCriticalRegions) return;
+
+ err = MD_CriticalRegionDelete(gCriticalRegion);
+ PR_ASSERT(err == noErr);
+}
+
+
+void EnterCritialRegion()
+{
+ OSStatus err;
+
+ if (!gUseCriticalRegions) return;
+
+ PR_ASSERT(gCriticalRegion != kInvalidID);
+
+ /* Change to a non-infinite timeout for debugging purposes */
+ err = MD_CriticalRegionEnter(gCriticalRegion, kDurationForever /* 10000 * kDurationMillisecond */ );
+ PR_ASSERT(err == noErr);
+}
+
+void LeaveCritialRegion()
+{
+ OSStatus err;
+
+ if (!gUseCriticalRegions) return;
+
+ PR_ASSERT(gCriticalRegion != kInvalidID);
+
+ err = MD_CriticalRegionExit(gCriticalRegion);
+ PR_ASSERT(err == noErr);
+}
+
+
+#endif // MAC_CRITICAL_REGIONS
+
diff --git a/pr/src/md/mac/mdcriticalregion.c b/pr/src/md/mac/mdcriticalregion.c
new file mode 100644
index 00000000..927b9246
--- /dev/null
+++ b/pr/src/md/mac/mdcriticalregion.c
@@ -0,0 +1,169 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: NULL; c-basic-offset: 2 -*- */
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is the Netscape Portable Runtime (NSPR).
+ *
+ * The Initial Developer of the Original Code is Netscape
+ * Communications Corporation. Portions created by Netscape are
+ * Copyright (C) 1998-2000 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ * George Warner, Apple Computer Inc.
+ * Simon Fraser <sfraser@netscape.com>
+ *
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU General Public License Version 2 or later (the
+ * "GPL"), in which case the provisions of the GPL are applicable
+ * instead of those above. If you wish to allow use of your
+ * version of this file only under the terms of the GPL and not to
+ * allow others to use your version of this file under the MPL,
+ * indicate your decision by deleting the provisions above and
+ * replace them with the notice and other provisions required by
+ * the GPL. If you do not delete the provisions above, a recipient
+ * may use your version of this file under either the MPL or the
+ * GPL.
+ */
+
+#include "mdcriticalregion.h"
+
+/*
+ This code is a replacement for MPEnterCriticalRegion/MPLeaveCriticalRegion,
+ which is broken on Mac OS 10.0.x builds, but fixed in 10.1. This code works
+ everywhere.
+*/
+
+
+typedef struct MDCriticalRegionData_struct {
+ MPTaskID mMPTaskID; /* Who's in the critical region? */
+ UInt32 mDepthCount; /* How deep? */
+ MPSemaphoreID mMPSemaphoreID; /* ready semaphore */
+} MDCriticalRegionData, *MDCriticalRegionDataPtr;
+
+
+OSStatus
+MD_CriticalRegionCreate(MDCriticalRegionID * outCriticalRegionID)
+{
+ MDCriticalRegionDataPtr newCriticalRegionPtr;
+ MPSemaphoreID mpSemaphoreID;
+ OSStatus err = noErr;
+
+ if (outCriticalRegionID == NULL)
+ return paramErr;
+
+ *outCriticalRegionID = NULL;
+
+ newCriticalRegionPtr = (MDCriticalRegionDataPtr)MPAllocateAligned(sizeof(MDCriticalRegionData),
+ kMPAllocateDefaultAligned, kMPAllocateClearMask);
+ if (newCriticalRegionPtr == NULL)
+ return memFullErr;
+
+ // Note: this semaphore is pre-fired (ready!)
+ err = MPCreateBinarySemaphore(&mpSemaphoreID);
+ if (err == noErr)
+ {
+ newCriticalRegionPtr->mMPTaskID = kInvalidID;
+ newCriticalRegionPtr->mDepthCount = 0;
+ newCriticalRegionPtr->mMPSemaphoreID = mpSemaphoreID;
+
+ *outCriticalRegionID = (MDCriticalRegionID)newCriticalRegionPtr;
+ }
+ else
+ {
+ MPFree((LogicalAddress)newCriticalRegionPtr);
+ }
+
+ return err;
+}
+
+OSStatus
+MD_CriticalRegionDelete(MDCriticalRegionID inCriticalRegionID)
+{
+ MDCriticalRegionDataPtr criticalRegion = (MDCriticalRegionDataPtr)inCriticalRegionID;
+ OSStatus err = noErr;
+
+ if (criticalRegion == NULL)
+ return paramErr;
+
+ if ((criticalRegion->mMPTaskID != kInvalidID) && (criticalRegion->mDepthCount > 0))
+ return kMPInsufficientResourcesErr;
+
+ if (criticalRegion->mMPSemaphoreID != kInvalidID)
+ err = MPDeleteSemaphore(criticalRegion->mMPSemaphoreID);
+ if (noErr != err) return err;
+
+ criticalRegion->mMPSemaphoreID = kInvalidID;
+ MPFree((LogicalAddress) criticalRegion);
+
+ return noErr;
+}
+
+OSStatus
+MD_CriticalRegionEnter(MDCriticalRegionID inCriticalRegionID, Duration inTimeout)
+{
+ MDCriticalRegionDataPtr criticalRegion = (MDCriticalRegionDataPtr)inCriticalRegionID;
+ MPTaskID currentTaskID = MPCurrentTaskID();
+ OSStatus err = noErr;
+
+ if (criticalRegion == NULL)
+ return paramErr;
+
+ // if I'm inside the critical region...
+ if (currentTaskID == criticalRegion->mMPTaskID)
+ {
+ // bump my depth
+ criticalRegion->mDepthCount++;
+ // and continue
+ return noErr;
+ }
+
+ // wait for the ready semaphore
+ err = MPWaitOnSemaphore(criticalRegion->mMPSemaphoreID, inTimeout);
+ // we didn't get it. return the error
+ if (noErr != err) return err;
+
+ // we got it!
+ criticalRegion->mMPTaskID = currentTaskID;
+ criticalRegion->mDepthCount = 1;
+
+ return noErr;
+}
+
+OSStatus
+MD_CriticalRegionExit(MDCriticalRegionID inCriticalRegionID)
+{
+ MDCriticalRegionDataPtr criticalRegion = (MDCriticalRegionDataPtr)inCriticalRegionID;
+ MPTaskID currentTaskID = MPCurrentTaskID();
+ OSStatus err = noErr;
+
+ // if we don't own the critical region...
+ if (currentTaskID != criticalRegion->mMPTaskID)
+ return kMPInsufficientResourcesErr;
+
+ // if we aren't at a depth...
+ if (criticalRegion->mDepthCount == 0)
+ return kMPInsufficientResourcesErr;
+
+ // un-bump my depth
+ criticalRegion->mDepthCount--;
+
+ // if we just bottomed out...
+ if (criticalRegion->mDepthCount == 0)
+ {
+ // release ownership of the structure
+ criticalRegion->mMPTaskID = kInvalidID;
+ // and signal the ready semaphore
+ err = MPSignalSemaphore(criticalRegion->mMPSemaphoreID);
+ }
+ return err;
+}
+
diff --git a/pr/src/md/mac/mdcriticalregion.h b/pr/src/md/mac/mdcriticalregion.h
new file mode 100644
index 00000000..eba4c82b
--- /dev/null
+++ b/pr/src/md/mac/mdcriticalregion.h
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is the Netscape Portable Runtime (NSPR).
+ *
+ * The Initial Developer of the Original Code is Netscape
+ * Communications Corporation. Portions created by Netscape are
+ * Copyright (C) 1998-2000 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ * George Warner, Apple Computer Inc.
+ * Simon Fraser <sfraser@netscape.com>
+ *
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU General Public License Version 2 or later (the
+ * "GPL"), in which case the provisions of the GPL are applicable
+ * instead of those above. If you wish to allow use of your
+ * version of this file only under the terms of the GPL and not to
+ * allow others to use your version of this file under the MPL,
+ * indicate your decision by deleting the provisions above and
+ * replace them with the notice and other provisions required by
+ * the GPL. If you do not delete the provisions above, a recipient
+ * may use your version of this file under either the MPL or the
+ * GPL.
+ */
+
+#ifndef mdcriticalregion_h___
+#define mdcriticalregion_h___
+
+
+#ifndef __MULTIPROCESSING__
+#include <Multiprocessing.h>
+#endif
+
+typedef struct OpaqueMDCriticalRegionID* MDCriticalRegionID;
+
+OSStatus MD_CriticalRegionCreate(MDCriticalRegionID * pMDCriticalRegionID);
+
+OSStatus MD_CriticalRegionDelete(MDCriticalRegionID pMDCriticalRegionID);
+
+OSStatus MD_CriticalRegionEnter(MDCriticalRegionID pMDCriticalRegionID, Duration pTimeout);
+
+OSStatus MD_CriticalRegionExit(MDCriticalRegionID pMDCriticalRegionID);
+
+#endif /* mdcriticalregion_h___ */
+
diff --git a/pr/src/md/mac/mdmac.c b/pr/src/md/mac/mdmac.c
index 8819492f..f7e9a4fa 100644
--- a/pr/src/md/mac/mdmac.c
+++ b/pr/src/md/mac/mdmac.c
@@ -288,6 +288,8 @@ void _MD_EarlyInit()
{
Handle environmentVariables;
+ INIT_CRITICAL_REGION();
+
#if !defined(MAC_NSPR_STANDALONE)
// MacintoshInitializeMemory(); Moved to mdmacmem.c: AllocateRawMemory(Size blockSize)
#else
@@ -374,6 +376,7 @@ void CleanupTermProc(void)
_MD_StopInterrupts(); // deactive Time Manager task
CLOSE_OPEN_TRANSPORT();
+ TERM_CRITICAL_REGION();
__NSTerminate();
}
diff --git a/pr/src/md/os2/os2cv.c b/pr/src/md/os2/os2cv.c
index 30e40f9b..e5c026e3 100644
--- a/pr/src/md/os2/os2cv.c
+++ b/pr/src/md/os2/os2cv.c
@@ -275,7 +275,9 @@ _PR_MD_WAIT_CV(_MDCVar *cv, _MDLock *lock, PRIntervalTime timeout )
/* Wait for notification or timeout; don't really care which */
rv = DosWaitEventSem(thred->md.blocked_sema.sem, msecs);
- DosResetEventSem(thred->md.blocked_sema.sem, &count);
+ if (rv == NO_ERROR) {
+ DosResetEventSem(thred->md.blocked_sema.sem, &count);
+ }
DosRequestMutexSem((lock->mutex), SEM_INDEFINITE_WAIT);
@@ -314,7 +316,9 @@ _PR_MD_WAIT_CV(_MDCVar *cv, _MDLock *lock, PRIntervalTime timeout )
* non-signaled. We assume this wait won't take long.
*/
rv = DosWaitEventSem(thred->md.blocked_sema.sem, SEM_INDEFINITE_WAIT);
- DosResetEventSem(thred->md.blocked_sema.sem, &count);
+ if (rv == NO_ERROR) {
+ DosResetEventSem(thred->md.blocked_sema.sem, &count);
+ }
PR_ASSERT(rv == NO_ERROR);
}
}
diff --git a/pr/src/md/prosdep.c b/pr/src/md/prosdep.c
index 8d81407c..66dec194 100644
--- a/pr/src/md/prosdep.c
+++ b/pr/src/md/prosdep.c
@@ -62,7 +62,7 @@ static void GetPageSize(void)
#ifdef XP_UNIX
#if defined SUNOS4 || defined LINUX || defined BSDI || defined AIX \
|| defined FREEBSD || defined NETBSD || defined OPENBSD \
- || defined RHAPSODY || defined NEXTSTEP
+ || defined DARWIN || defined NEXTSTEP
_pr_pageSize = getpagesize();
#elif defined(HPUX)
/* I have no idea. Don't get me started. --Rob */
diff --git a/pr/src/md/unix/unix.c b/pr/src/md/unix/unix.c
index 6352bcf8..69153f27 100644
--- a/pr/src/md/unix/unix.c
+++ b/pr/src/md/unix/unix.c
@@ -69,7 +69,7 @@
#elif defined(IRIX) || defined(HPUX) || defined(OSF1) || defined(SOLARIS) \
|| defined(AIX4_1) || defined(LINUX) || defined(SONY) \
|| defined(BSDI) || defined(SCO) || defined(NEC) || defined(SNI) \
- || defined(SUNOS4) || defined(NCR) || defined(RHAPSODY) \
+ || defined(SUNOS4) || defined(NCR) || defined(DARWIN) \
|| defined(NEXTSTEP) || defined(QNX)
#define _PRSockLen_t int
#elif (defined(AIX) && !defined(AIX4_1)) || defined(FREEBSD) \
diff --git a/pr/src/md/unix/unix_errors.c b/pr/src/md/unix/unix_errors.c
index 7164675b..1ce52e68 100644
--- a/pr/src/md/unix/unix_errors.c
+++ b/pr/src/md/unix/unix_errors.c
@@ -383,9 +383,14 @@ void _MD_unix_map_rmdir_error(int err)
PRErrorCode prError;
switch (err) {
+ /*
+ * On AIX 4.3, ENOTEMPTY is defined as EEXIST.
+ */
+#if ENOTEMPTY != EEXIST
case ENOTEMPTY:
prError = PR_DIRECTORY_NOT_EMPTY_ERROR;
break;
+#endif
case EEXIST:
prError = PR_DIRECTORY_NOT_EMPTY_ERROR;
break;
diff --git a/pr/src/md/unix/uxproces.c b/pr/src/md/unix/uxproces.c
index d7682494..58b5ab8a 100644
--- a/pr/src/md/unix/uxproces.c
+++ b/pr/src/md/unix/uxproces.c
@@ -43,7 +43,7 @@
#include <dlfcn.h> /* For dlopen, dlsym, dlclose */
#endif
-#if defined(RHAPSODY)
+#if defined(DARWIN)
#include <crt_externs.h>
#else
extern char **environ;
@@ -183,7 +183,7 @@ ForkAndExec(
childEnvp = envp;
if (attr && attr->fdInheritBuffer) {
if (NULL == childEnvp) {
-#ifdef RHAPSODY
+#ifdef DARWIN
childEnvp = *(_NSGetEnviron());
#else
childEnvp = environ;
@@ -267,6 +267,46 @@ ForkAndExec(
#ifdef AIX
process->md.pid = (*pr_wp.forkptr)();
+#elif defined(NTO)
+ /*
+ * fork() & exec() does not work in a multithreaded process.
+ * Use spawn() instead.
+ */
+ {
+ int fd_map[3] = { 0, 1, 2 };
+
+ if (attr) {
+ if (attr->stdinFd && attr->stdinFd->secret->md.osfd != 0) {
+ fd_map[0] = dup(attr->stdinFd->secret->md.osfd);
+ flags = fcntl(fd_map[0], F_GETFL, 0);
+ if (flags & O_NONBLOCK)
+ fcntl(fd_map[0], F_SETFL, flags & ~O_NONBLOCK);
+ }
+ if (attr->stdoutFd && attr->stdoutFd->secret->md.osfd != 1) {
+ fd_map[1] = dup(attr->stdoutFd->secret->md.osfd);
+ flags = fcntl(fd_map[1], F_GETFL, 0);
+ if (flags & O_NONBLOCK)
+ fcntl(fd_map[1], F_SETFL, flags & ~O_NONBLOCK);
+ }
+ if (attr->stderrFd && attr->stderrFd->secret->md.osfd != 2) {
+ fd_map[2] = dup(attr->stderrFd->secret->md.osfd);
+ flags = fcntl(fd_map[2], F_GETFL, 0);
+ if (flags & O_NONBLOCK)
+ fcntl(fd_map[2], F_SETFL, flags & ~O_NONBLOCK);
+ }
+
+ PR_ASSERT(attr->currentDirectory == NULL); /* not implemented */
+ }
+
+ process->md.pid = spawn(path, 3, fd_map, NULL, argv, childEnvp);
+
+ if (fd_map[0] != 0)
+ close(fd_map[0]);
+ if (fd_map[1] != 1)
+ close(fd_map[1]);
+ if (fd_map[2] != 2)
+ close(fd_map[2]);
+ }
#else
process->md.pid = fork();
#endif
@@ -285,6 +325,7 @@ ForkAndExec(
* the parent process's standard I/O data structures.
*/
+#if !defined(NTO)
#ifdef VMS
/* OpenVMS has already handled all this above */
#else
@@ -367,6 +408,7 @@ ForkAndExec(
#else
_exit(1);
#endif /* VMS */
+#endif /* !NTO */
}
if (newEnvp) {
diff --git a/pr/src/md/unix/uxrng.c b/pr/src/md/unix/uxrng.c
index 135018fb..64358289 100644
--- a/pr/src/md/unix/uxrng.c
+++ b/pr/src/md/unix/uxrng.c
@@ -278,7 +278,7 @@ GetHighResClock(void *buf, size_t maxbytes)
return 0;
}
#elif defined(SCO) || defined(UNIXWARE) || defined(BSDI) || defined(NTO) \
- || defined(QNX) || defined(RHAPSODY)
+ || defined(QNX) || defined(DARWIN)
#include <sys/times.h>
static size_t
diff --git a/pr/src/misc/prnetdb.c b/pr/src/misc/prnetdb.c
index 22a15dae..c8d33900 100644
--- a/pr/src/misc/prnetdb.c
+++ b/pr/src/misc/prnetdb.c
@@ -84,7 +84,7 @@ PRLock *_pr_dnsLock = NULL;
* an int.
*/
-#if defined(SOLARIS) \
+#if defined(SOLARIS) || (defined(BSDI) && defined(_REENTRANT)) \
|| (defined(LINUX) && defined(_REENTRANT) \
&& !(defined(__GLIBC__) && __GLIBC__ >= 2))
#define _PR_HAVE_GETPROTO_R
diff --git a/pr/src/misc/prsystem.c b/pr/src/misc/prsystem.c
index a624ea34..bb786766 100644
--- a/pr/src/misc/prsystem.c
+++ b/pr/src/misc/prsystem.c
@@ -51,7 +51,7 @@
/* BSD-derived systems use sysctl() to get the number of processors */
#if defined(BSDI) || defined(FREEBSD) || defined(NETBSD) \
- || defined(OPENBSD) || defined(RHAPSODY)
+ || defined(OPENBSD) || defined(DARWIN)
#define _PR_HAVE_SYSCTL
#include <sys/param.h>
#include <sys/sysctl.h>
diff --git a/pr/src/misc/prtime.c b/pr/src/misc/prtime.c
index 33df013f..e31ba74b 100644
--- a/pr/src/misc/prtime.c
+++ b/pr/src/misc/prtime.c
@@ -1583,12 +1583,13 @@ PR_ParseTimeString(
secs = mktime(&localTime);
if (secs != (time_t) -1)
{
-#if defined(XP_MAC)
+#if defined(XP_MAC) && (__MSL__ < 0x6000)
/*
* The mktime() routine in MetroWerks MSL C
* Runtime library returns seconds since midnight,
- * 1 Jan. 1900, not 1970. So we need to adjust
- * its return value to the NSPR epoch.
+ * 1 Jan. 1900, not 1970 - in versions of MSL (Metrowerks Standard
+ * Library) prior to version 6. Only for older versions of
+ * MSL do we adjust the value of secs to the NSPR epoch
*/
secs -= ((365 * 70UL) + 17) * 24 * 60 * 60;
#endif
diff --git a/pr/src/pthreads/ptio.c b/pr/src/pthreads/ptio.c
index c51dd02c..6205f42f 100644
--- a/pr/src/pthreads/ptio.c
+++ b/pr/src/pthreads/ptio.c
@@ -184,7 +184,7 @@ static ssize_t (*pt_aix_sendfile_fptr)() = NULL;
#define _PRSockOptVal_t char *
#elif defined(IRIX) || defined(OSF1) || defined(AIX) || defined(HPUX) \
|| defined(LINUX) || defined(FREEBSD) || defined(BSDI) || defined(VMS) \
- || defined(NTO) || defined(OPENBSD) || defined(RHAPSODY)
+ || defined(NTO) || defined(OPENBSD) || defined(DARWIN)
#define _PRSockOptVal_t void *
#else
#error "Cannot determine architecture"
@@ -198,7 +198,7 @@ static ssize_t (*pt_aix_sendfile_fptr)() = NULL;
|| defined(OSF1) || defined(SOLARIS) \
|| defined(HPUX10_30) || defined(HPUX11) || defined(LINUX) \
|| defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
- || defined(BSDI) || defined(VMS) || defined(NTO) || defined(RHAPSODY)
+ || defined(BSDI) || defined(VMS) || defined(NTO) || defined(DARWIN)
#define _PRSelectFdSetArg_t fd_set *
#else
#error "Cannot determine architecture"
@@ -2966,7 +2966,7 @@ static PRIOMethods _pr_socketpollfd_methods = {
#if defined(HPUX) || defined(OSF1) || defined(SOLARIS) || defined (IRIX) \
|| defined(AIX) || defined(LINUX) || defined(FREEBSD) || defined(NETBSD) \
|| defined(OPENBSD) || defined(BSDI) || defined(VMS) || defined(NTO) \
- || defined(RHAPSODY)
+ || defined(DARWIN)
#define _PR_FCNTL_FLAGS O_NONBLOCK
#else
#error "Can't determine architecture"
diff --git a/pr/src/pthreads/ptsynch.c b/pr/src/pthreads/ptsynch.c
index ecf69a1a..4400e8df 100644
--- a/pr/src/pthreads/ptsynch.c
+++ b/pr/src/pthreads/ptsynch.c
@@ -444,6 +444,8 @@ PR_IMPLEMENT(PRMonitor*) PR_NewMonitor(void)
rv = _PT_PTHREAD_MUTEX_INIT(mon->lock.mutex, _pt_mattr);
PR_ASSERT(0 == rv);
+ _PT_PTHREAD_INVALIDATE_THR_HANDLE(mon->owner);
+
mon->cvar = cvar;
rv = _PT_PTHREAD_COND_INIT(mon->cvar->cv, _pt_cvar_attr);
PR_ASSERT(0 == rv);
@@ -484,42 +486,43 @@ PR_IMPLEMENT(void) PR_DestroyMonitor(PRMonitor *mon)
*/
PR_IMPLEMENT(PRInt32) PR_GetMonitorEntryCount(PRMonitor *mon)
{
- PRThread *self = PR_GetCurrentThread();
- if (mon->owner == self)
+ pthread_t self = pthread_self();
+ if (pthread_equal(mon->owner, self))
return mon->entryCount;
return 0;
}
PR_IMPLEMENT(void) PR_EnterMonitor(PRMonitor *mon)
{
- PRThread *self = PR_GetCurrentThread();
+ pthread_t self = pthread_self();
PR_ASSERT(mon != NULL);
/*
- * This is safe only if mon->owner (a PRThread*) can be
- * read in one instruction.
+ * This is safe only if mon->owner (a pthread_t) can be
+ * read in one instruction. Perhaps mon->owner should be
+ * a "PRThread *"?
*/
- if (mon->owner != self)
+ if (!pthread_equal(mon->owner, self))
{
PR_Lock(&mon->lock);
/* and now I have the lock */
PR_ASSERT(0 == mon->entryCount);
- PR_ASSERT(NULL == mon->owner);
- mon->owner = self;
+ PR_ASSERT(_PT_PTHREAD_THR_HANDLE_IS_INVALID(mon->owner));
+ _PT_PTHREAD_COPY_THR_HANDLE(self, mon->owner);
}
mon->entryCount += 1;
} /* PR_EnterMonitor */
PR_IMPLEMENT(PRStatus) PR_ExitMonitor(PRMonitor *mon)
{
- PRThread *self = PR_GetCurrentThread();
+ pthread_t self = pthread_self();
PR_ASSERT(mon != NULL);
/* The lock better be that - locked */
PR_ASSERT(_PT_PTHREAD_MUTEX_IS_LOCKED(mon->lock.mutex));
/* we'd better be the owner */
- PR_ASSERT(mon->owner == self);
- if (mon->owner != self)
+ PR_ASSERT(pthread_equal(mon->owner, self));
+ if (!pthread_equal(mon->owner, self))
return PR_FAILURE;
/* if it's locked and we have it, then the entries should be > 0 */
@@ -528,7 +531,7 @@ PR_IMPLEMENT(PRStatus) PR_ExitMonitor(PRMonitor *mon)
if (mon->entryCount == 0)
{
/* and if it transitioned to zero - unlock */
- mon->owner = NULL; /* make the owner unknown */
+ _PT_PTHREAD_INVALIDATE_THR_HANDLE(mon->owner); /* make the owner unknown */
PR_Unlock(&mon->lock);
}
return PR_SUCCESS;
@@ -538,7 +541,7 @@ PR_IMPLEMENT(PRStatus) PR_Wait(PRMonitor *mon, PRIntervalTime timeout)
{
PRStatus rv;
PRInt16 saved_entries;
- PRThread *saved_owner;
+ pthread_t saved_owner;
PR_ASSERT(mon != NULL);
/* we'd better be locked */
@@ -546,19 +549,19 @@ PR_IMPLEMENT(PRStatus) PR_Wait(PRMonitor *mon, PRIntervalTime timeout)
/* and the entries better be positive */
PR_ASSERT(mon->entryCount > 0);
/* and it better be by us */
- PR_ASSERT(mon->owner == PR_GetCurrentThread());
+ PR_ASSERT(pthread_equal(mon->owner, pthread_self()));
/* tuck these away 'till later */
saved_entries = mon->entryCount;
mon->entryCount = 0;
- saved_owner = mon->owner;
- mon->owner = NULL;
+ _PT_PTHREAD_COPY_THR_HANDLE(mon->owner, saved_owner);
+ _PT_PTHREAD_INVALIDATE_THR_HANDLE(mon->owner);
rv = PR_WaitCondVar(mon->cvar, timeout);
/* reinstate the intresting information */
mon->entryCount = saved_entries;
- mon->owner = saved_owner;
+ _PT_PTHREAD_COPY_THR_HANDLE(saved_owner, mon->owner);
return rv;
} /* PR_Wait */
@@ -571,7 +574,7 @@ PR_IMPLEMENT(PRStatus) PR_Notify(PRMonitor *mon)
/* and the entries better be positive */
PR_ASSERT(mon->entryCount > 0);
/* and it better be by us */
- PR_ASSERT(mon->owner == PR_GetCurrentThread());
+ PR_ASSERT(pthread_equal(mon->owner, pthread_self()));
pt_PostNotifyToCvar(mon->cvar, PR_FALSE);
@@ -586,7 +589,7 @@ PR_IMPLEMENT(PRStatus) PR_NotifyAll(PRMonitor *mon)
/* and the entries better be positive */
PR_ASSERT(mon->entryCount > 0);
/* and it better be by us */
- PR_ASSERT(mon->owner == PR_GetCurrentThread());
+ PR_ASSERT(pthread_equal(mon->owner, pthread_self()));
pt_PostNotifyToCvar(mon->cvar, PR_TRUE);
diff --git a/pr/tests/Makefile.in b/pr/tests/Makefile.in
index c1931a47..fdbcfd28 100644
--- a/pr/tests/Makefile.in
+++ b/pr/tests/Makefile.in
@@ -424,7 +424,7 @@ LIBPTHREAD = -lpthread
ifeq ($(OS_ARCH),AIX)
LIBPTHREAD = -lpthreads
endif
-ifeq (,$(filter-out FreeBSD OpenBSD BSD_OS NTO Rhapsody,$(OS_ARCH)))
+ifeq (,$(filter-out FreeBSD OpenBSD BSD_OS NTO Darwin,$(OS_ARCH)))
LIBPTHREAD =
endif
ifeq ($(OS_ARCH)$(basename $(OS_RELEASE)),HP-UXB.10)
diff --git a/pr/tests/dll/Makefile.in b/pr/tests/dll/Makefile.in
index 37e2f006..cd0cca6e 100644
--- a/pr/tests/dll/Makefile.in
+++ b/pr/tests/dll/Makefile.in
@@ -91,7 +91,7 @@ endif
# To create a loadable module on Rhapsody, we must override
# -dynamiclib with -bundle.
#
-ifeq ($(OS_ARCH),Rhapsody)
+ifeq ($(OS_ARCH),Darwin)
DSO_LDOPTS = -bundle
endif