From 555b07a98dcd7cac3878eb59cb072e3016fc8c18 Mon Sep 17 00:00:00 2001 From: cvs2hg Date: Fri, 4 May 2007 01:57:47 +0000 Subject: fixup commit for branch 'GECKO180_20071210_RELBRANCH' --- Makefile.in | 1 + admin/repackage.sh | 52 +++--- config/autoconf.mk.in | 8 + config/rules.mk | 1 + configure | 384 ++++++++++++++++++++++----------------- configure.in | 288 +++++++++++++++++++---------- lib/ds/Makefile.in | 5 - lib/libc/src/Makefile.in | 5 - lib/msgc/src/Makefile.in | 5 - lib/prstreams/Makefile.in | 1 - pkg/linux/Makefile.in | 6 +- pkg/solaris/SUNWprd/prototype | 1 + pr/include/md/_beos.cfg | 63 ++++--- pr/include/md/_darwin.cfg | 1 + pr/include/md/_darwin.h | 19 +- pr/include/md/_hpux.h | 46 ++++- pr/include/md/_netbsd.h | 179 +++++++----------- pr/include/md/_win95.h | 5 +- pr/include/obsolete/probslet.h | 9 + pr/include/obsolete/protypes.h | 2 - pr/include/prinet.h | 4 - pr/include/prinit.h | 6 +- pr/include/private/primpl.h | 2 + pr/include/prlink.h | 13 +- pr/include/prsystem.h | 7 +- pr/include/prtypes.h | 9 +- pr/src/Makefile.in | 9 +- pr/src/io/prfdcach.c | 8 + pr/src/io/prfile.c | 11 +- pr/src/io/prlog.c | 8 + pr/src/io/prprf.c | 19 +- pr/src/linking/Makefile.in | 7 +- pr/src/linking/prlink.c | 298 ++++++++++++++++++++++++++---- pr/src/md/beos/bfile.c | 63 ++++--- pr/src/md/beos/brng.c | 63 ++++--- pr/src/md/unix/os_Darwin_x86.s | 105 +++++++++++ pr/src/md/unix/os_HPUX_ia64.s | 108 +++++++++++ pr/src/md/unix/unix.c | 63 ++++--- pr/src/md/windows/ntinrval.c | 68 +------ pr/src/md/windows/ntio.c | 24 ++- pr/src/md/windows/w95io.c | 99 +++++----- pr/src/md/windows/w95sock.c | 112 ++++++++++++ pr/src/md/windows/w95thred.c | 2 + pr/src/md/windows/win32_errors.c | 3 + pr/src/misc/pratom.c | 2 + pr/src/misc/prdtoa.c | 2 +- pr/src/misc/prinit.c | 2 + pr/src/misc/prnetdb.c | 5 + pr/src/misc/prsystem.c | 24 +-- pr/src/misc/prtime.c | 162 +++++++++++------ pr/src/misc/prtrace.c | 16 +- pr/src/pthreads/Makefile.in | 5 - pr/src/pthreads/ptio.c | 4 +- pr/src/pthreads/ptthread.c | 1 + pr/tests/dll/Makefile.in | 5 - pr/tests/testfile.c | 63 ++++--- pr/tests/timetest.c | 128 +++++++------ pr/tests/tmocon.c | 63 ++++--- pr/tests/vercheck.c | 12 +- 59 files changed, 1723 insertions(+), 963 deletions(-) create mode 100644 pr/src/md/unix/os_Darwin_x86.s create mode 100644 pr/src/md/unix/os_HPUX_ia64.s diff --git a/Makefile.in b/Makefile.in index 9273b16d..42f07dd7 100644 --- a/Makefile.in +++ b/Makefile.in @@ -85,6 +85,7 @@ distclean:: @echo "cd pr/tests; $(MAKE) $@" @$(MAKE) -C pr/tests $@ rm -f config/autoconf.mk + rm -f `cat unallmakefiles` unallmakefiles release:: echo $(BUILD_NUMBER) > $(RELEASE_DIR)/$(BUILD_NUMBER)/version.df diff --git a/admin/repackage.sh b/admin/repackage.sh index fcdce44f..e9016cc2 100755 --- a/admin/repackage.sh +++ b/admin/repackage.sh @@ -64,36 +64,32 @@ # # ------------------------------------------------------------------ -FROMTOP=/share/builds/components/nspr20/v4.6.1 -TOTOP=./v4.6.1 -NSPRDIR=nspr-4.6.1 -SOURCETAG=NSPR_4_6_1_RTM +FROMTOP=/share/builds/components/nspr20/v4.6.7 +TOTOP=./v4.6.7 +NSPRDIR=nspr-4.6.7 +SOURCETAG=NSPR_4_6_7_RTM # # enumerate Unix object directories on /s/b/c UNIX_OBJDIRS=" -AIX4.3_64_DBG.OBJ -AIX4.3_64_OPT.OBJ -AIX4.3_DBG.OBJ -AIX4.3_OPT.OBJ -HP-UXB.11.00_64_DBG.OBJ -HP-UXB.11.00_64_OPT.OBJ -HP-UXB.11.00_DBG.OBJ -HP-UXB.11.00_OPT.OBJ -IRIX6.5_n32_PTH_DBG.OBJ -IRIX6.5_n32_PTH_OPT.OBJ -Linux2.2_x86_glibc_PTH_DBG.OBJ -Linux2.2_x86_glibc_PTH_OPT.OBJ +HP-UXB.11.11_64_DBG.OBJ +HP-UXB.11.11_64_OPT.OBJ +HP-UXB.11.11_DBG.OBJ +HP-UXB.11.11_OPT.OBJ +HP-UXB.11.23_ia64_32_DBG.OBJ +HP-UXB.11.23_ia64_32_OPT.OBJ +HP-UXB.11.23_ia64_64_DBG.OBJ +HP-UXB.11.23_ia64_64_OPT.OBJ Linux2.4_x86_glibc_PTH_DBG.OBJ Linux2.4_x86_glibc_PTH_OPT.OBJ -OSF1V5.0_DBG.OBJ -OSF1V5.0_OPT.OBJ -SunOS5.6_DBG.OBJ -SunOS5.6_OPT.OBJ -SunOS5.8_64_DBG.OBJ -SunOS5.8_64_OPT.OBJ -SunOS5.8_DBG.OBJ -SunOS5.8_OPT.OBJ +Linux2.6_x86_64_glibc_PTH_DBG.OBJ +Linux2.6_x86_64_glibc_PTH_OPT.OBJ +Linux2.6_x86_glibc_PTH_DBG.OBJ +Linux2.6_x86_glibc_PTH_OPT.OBJ +SunOS5.9_64_DBG.OBJ +SunOS5.9_64_OPT.OBJ +SunOS5.9_DBG.OBJ +SunOS5.9_OPT.OBJ " # # enumerate Windows object directories on /s/b/c @@ -101,9 +97,9 @@ WIN_OBJDIRS=" WIN954.0_DBG.OBJ WIN954.0_DBG.OBJD WIN954.0_OPT.OBJ -WINNT4.0_DBG.OBJ -WINNT4.0_DBG.OBJD -WINNT4.0_OPT.OBJ +WINNT5.0_DBG.OBJ +WINNT5.0_DBG.OBJD +WINNT5.0_OPT.OBJ " # @@ -183,7 +179,7 @@ for OBJDIR in $WIN_OBJDIRS; do cp -r $FROMTOP/$OBJDIR/bin $NSPRDIR echo "creating directory $TOTOP/$OBJDIR" - mkdir $TOTOP/$OBJDIR + mkdir -p $TOTOP/$OBJDIR echo "creating $TOTOP/$OBJDIR/$NSPRDIR.zip" zip -r $TOTOP/$OBJDIR/$NSPRDIR.zip $NSPRDIR done diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in index a01a8e55..a90cb28f 100644 --- a/config/autoconf.mk.in +++ b/config/autoconf.mk.in @@ -88,6 +88,7 @@ RESOLVE_LINK_SYMBOLS = @RESOLVE_LINK_SYMBOLS@ HOST_CC = @HOST_CC@ HOST_CFLAGS = @HOST_CFLAGS@ +HOST_LDFLAGS = @HOST_LDFLAGS@ DEFINES = @DEFINES@ @DEFS@ @@ -119,3 +120,10 @@ MACOSX_DEPLOYMENT_TARGET = @MACOSX_DEPLOYMENT_TARGET@ ifdef MACOSX_DEPLOYMENT_TARGET export MACOSX_DEPLOYMENT_TARGET endif + +MACOS_SDK_DIR = @MACOS_SDK_DIR@ + +NEXT_ROOT = @NEXT_ROOT@ +ifdef NEXT_ROOT +export NEXT_ROOT +endif diff --git a/config/rules.mk b/config/rules.mk index 492e0aeb..7dadc206 100644 --- a/config/rules.mk +++ b/config/rules.mk @@ -87,6 +87,7 @@ CC=$(HOST_CC) CCC=$(HOST_CXX) CFLAGS=$(HOST_CFLAGS) CXXFLAGS=$(HOST_CXXFLAGS) +LDFLAGS=$(HOST_LDFLAGS) endif endif endif diff --git a/configure b/configure index c15d109d..f53e9298 100755 --- a/configure +++ b/configure @@ -39,6 +39,8 @@ ac_help="$ac_help --enable-64bit Enable 64-bit support (on certain platforms)" ac_help="$ac_help --enable-mdupdate Enable use of certain compilers' mdupdate feature" +ac_help="$ac_help + --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)" ac_help="$ac_help --enable-macos-target=VER Set the minimum MacOS version needed at runtime @@ -621,7 +623,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:625: checking host system type" >&5 +echo "configure:627: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -642,7 +644,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:646: checking target system type" >&5 +echo "configure:648: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -660,7 +662,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:664: checking build system type" >&5 +echo "configure:666: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -685,7 +687,7 @@ test "$host_alias" != "$target_alias" && MOD_MAJOR_VERSION=4 MOD_MINOR_VERSION=6 -MOD_PATCH_VERSION=1 +MOD_PATCH_VERSION=7 NSPR_MODNAME=nspr20 _HAVE_PTHREADS= USE_PTHREADS= @@ -709,6 +711,8 @@ NOSUCHFILE=/no-such-file LIBNSPR='-L$(dist_libdir) -lnspr$(MOD_MAJOR_VERSION)' LIBPLC='-L$(dist_libdir) -lplc$(MOD_MAJOR_VERSION)' CYGWIN_WRAPPER= +MACOS_SDK_DIR= +NEXT_ROOT= RESOLVE_LINK_SYMBOLS= @@ -727,7 +731,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:731: checking for $ac_word" >&5 +echo "configure:735: 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 @@ -923,6 +927,13 @@ if test "${enable_mdupdate+set}" = set; then fi +# Check whether --with-macos-sdk or --without-macos-sdk was given. +if test "${with_macos_sdk+set}" = set; then + withval="$with_macos_sdk" + MACOS_SDK_DIR=$withval +fi + + # Check whether --enable-macos-target or --disable-macos-target was given. if test "${enable_macos_target+set}" = set; then enableval="$enable_macos_target" @@ -1027,7 +1038,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:1031: checking for $ac_word" >&5 +echo "configure:1042: 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 @@ -1098,13 +1109,13 @@ if test "$target" != "$host"; then _SAVE_LDFLAGS="$LDFLAGS" echo $ac_n "checking for $host compiler""... $ac_c" 1>&6 -echo "configure:1102: checking for $host compiler" >&5 +echo "configure:1113: checking for $host compiler" >&5 for ac_prog in $HOST_CC 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:1108: checking for $ac_word" >&5 +echo "configure:1119: 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 @@ -1150,16 +1161,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:1154: checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works" >&5 +echo "configure:1165: checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1174: \"$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 @@ -1174,12 +1185,21 @@ rm -f conftest* CFLAGS=$_SAVE_CFLAGS LDFLAGS=$_SAVE_LDFLAGS + case "$build:$target" in + powerpc-apple-darwin8*:i?86-apple-darwin*) + _SAVE_CFLAGS=$CFLAGS + _SAVE_CXXFLAGS=$CXXLAGS + CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CFLAGS" + CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CXXFLAGS" + ;; + esac + for ac_prog in $CC "${target_alias}-gcc" "${target}-gcc" 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:1183: checking for $ac_word" >&5 +echo "configure:1203: 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 @@ -1213,7 +1233,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:1217: checking for $ac_word" >&5 +echo "configure:1237: 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 @@ -1243,7 +1263,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:1247: checking for $ac_word" >&5 +echo "configure:1267: 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 @@ -1294,7 +1314,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:1298: checking for $ac_word" >&5 +echo "configure:1318: 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 @@ -1326,7 +1346,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1330: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1350: 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. @@ -1337,12 +1357,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 1341 "configure" +#line 1361 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1346: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1366: \"$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 @@ -1368,12 +1388,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:1372: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1392: 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:1377: checking whether we are using GNU C" >&5 +echo "configure:1397: 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 @@ -1382,7 +1402,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1386: \"$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:1406: \"$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 @@ -1401,7 +1421,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:1405: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1425: 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 @@ -1437,7 +1457,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:1441: checking for $ac_word" >&5 +echo "configure:1461: 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 @@ -1473,7 +1493,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:1477: checking for $ac_word" >&5 +echo "configure:1497: 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 @@ -1505,7 +1525,7 @@ test -n "$CXX" || CXX="gcc" echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1509: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 +echo "configure:1529: 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. @@ -1516,12 +1536,12 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext << EOF -#line 1520 "configure" +#line 1540 "configure" #include "confdefs.h" int main(){return(0);} EOF -if { (eval echo configure:1525: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1545: \"$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 @@ -1547,12 +1567,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:1551: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1571: 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:1556: checking whether we are using GNU C++" >&5 +echo "configure:1576: 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 @@ -1561,7 +1581,7 @@ else yes; #endif EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1565: \"$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:1585: \"$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 @@ -1580,7 +1600,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:1584: checking whether ${CXX-g++} accepts -g" >&5 +echo "configure:1604: 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 @@ -1611,12 +1631,20 @@ else fi fi + + case "$build:$target" in + powerpc-apple-darwin8*:i?86-apple-darwin*) + CFLAGS=$_SAVE_CFLAGS + CXXFLAGS=$_SAVE_CXXFLAGS + ;; + esac + for ac_prog in $RANLIB "${target_alias}-ranlib" "${target}-ranlib" 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:1620: checking for $ac_word" >&5 +echo "configure:1648: 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 @@ -1651,7 +1679,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:1655: checking for $ac_word" >&5 +echo "configure:1683: 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 @@ -1686,7 +1714,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:1690: checking for $ac_word" >&5 +echo "configure:1718: 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 @@ -1721,7 +1749,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:1725: checking for $ac_word" >&5 +echo "configure:1753: 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 @@ -1756,7 +1784,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:1760: checking for $ac_word" >&5 +echo "configure:1788: 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 @@ -1791,7 +1819,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:1795: checking for $ac_word" >&5 +echo "configure:1823: 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 @@ -1828,7 +1856,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:1832: checking for $ac_word" >&5 +echo "configure:1860: 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 @@ -1860,7 +1888,7 @@ test -n "$CXX" || CXX="gcc" echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1864: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 +echo "configure:1892: 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. @@ -1871,12 +1899,12 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext << EOF -#line 1875 "configure" +#line 1903 "configure" #include "confdefs.h" int main(){return(0);} EOF -if { (eval echo configure:1880: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1908: \"$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 @@ -1902,12 +1930,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:1906: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1934: 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:1911: checking whether we are using GNU C++" >&5 +echo "configure:1939: 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 @@ -1916,7 +1944,7 @@ else yes; #endif EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1920: \"$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:1948: \"$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 @@ -1935,7 +1963,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:1939: checking whether ${CXX-g++} accepts -g" >&5 +echo "configure:1967: 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 @@ -1972,7 +2000,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:1976: checking for $ac_word" >&5 +echo "configure:2004: 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 @@ -2002,7 +2030,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:2006: checking for $ac_word" >&5 +echo "configure:2034: 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 @@ -2053,7 +2081,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:2057: checking for $ac_word" >&5 +echo "configure:2085: 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 @@ -2085,7 +2113,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2089: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:2117: 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. @@ -2096,12 +2124,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 2100 "configure" +#line 2128 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:2105: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2133: \"$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 @@ -2127,12 +2155,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:2131: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2159: 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:2136: checking whether we are using GNU C" >&5 +echo "configure:2164: 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 @@ -2141,7 +2169,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2145: \"$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:2173: \"$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 @@ -2160,7 +2188,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:2164: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:2192: 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 @@ -2193,7 +2221,7 @@ fi fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:2197: checking how to run the C preprocessor" >&5 +echo "configure:2225: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -2208,13 +2236,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2218: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2246: \"$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 : @@ -2225,13 +2253,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2235: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2263: \"$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 : @@ -2242,13 +2270,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2252: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2280: \"$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 : @@ -2275,7 +2303,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:2279: checking for $ac_word" >&5 +echo "configure:2307: 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 @@ -2307,7 +2335,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:2311: checking for $ac_word" >&5 +echo "configure:2339: 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 @@ -2348,7 +2376,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:2352: checking for $ac_word" >&5 +echo "configure:2380: 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 @@ -2389,7 +2417,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:2393: checking for $ac_word" >&5 +echo "configure:2421: 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 @@ -2430,7 +2458,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:2434: checking for $ac_word" >&5 +echo "configure:2462: 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 @@ -2471,7 +2499,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:2475: checking for $ac_word" >&5 +echo "configure:2503: 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 @@ -2526,6 +2554,12 @@ if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then fi rm -f a.out +case "$build:$target" in + i?86-apple-darwin*:powerpc-apple-darwin*) + cross_compiling=yes + ;; +esac + if test "$cross_compiling" = "yes"; then CROSS_COMPILE=1 else @@ -2533,7 +2567,7 @@ else fi echo $ac_n "checking for gcc -pipe support""... $ac_c" 1>&6 -echo "configure:2537: checking for gcc -pipe support" >&5 +echo "configure:2571: checking for gcc -pipe support" >&5 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then echo '#include ' > dummy-hello.c echo 'int main() { printf("Hello World\n"); return 0; }' >> dummy-hello.c @@ -2548,14 +2582,14 @@ if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then _SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -pipe" cat > conftest.$ac_ext < int main() { printf("Hello World\n"); ; return 0; } EOF -if { (eval echo configure:2559: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2593: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* _res_gcc_pipe="yes" else @@ -2582,7 +2616,7 @@ fi if test "$GNU_CC"; then echo $ac_n "checking for visibility(hidden) attribute""... $ac_c" 1>&6 -echo "configure:2586: checking for visibility(hidden) attribute" >&5 +echo "configure:2620: checking for visibility(hidden) attribute" >&5 if eval "test \"`echo '$''{'ac_cv_visibility_hidden'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2606,7 +2640,7 @@ echo "$ac_t""$ac_cv_visibility_hidden" 1>&6 EOF echo $ac_n "checking for visibility pragma support""... $ac_c" 1>&6 -echo "configure:2610: checking for visibility pragma support" >&5 +echo "configure:2644: checking for visibility pragma support" >&5 if eval "test \"`echo '$''{'ac_cv_visibility_pragma'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2659,7 +2693,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:2663: checking for $ac_word" >&5 +echo "configure:2697: 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 @@ -2719,6 +2753,7 @@ if test -n "$CROSS_COMPILE"; then linux*) OS_ARCH=Linux ;; solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;; mingw*) OS_ARCH=WINNT ;; + darwin*) OS_ARCH=Darwin ;; esac else OS_ARCH=`uname -s | sed -e 's|/|_|g'` @@ -2905,17 +2940,17 @@ EOF DSO_LDOPTS='-brtl -bnortllib -bM:SRE -bnoentry -bexpall -blibpath:/usr/lib:/lib' 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:2909: checking for sys/atomic_op.h" >&5 +echo "configure:2944: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2919: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2954: \"$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* @@ -3072,7 +3107,7 @@ EOF _DEBUG_FLAGS='-gdwarf-2 -O0' MKSHLIB='$(CCC) $(DSO_LDOPTS) -o $@' echo $ac_n "checking for gethostbyaddr in -lbind""... $ac_c" 1>&6 -echo "configure:3076: checking for gethostbyaddr in -lbind" >&5 +echo "configure:3111: checking for gethostbyaddr in -lbind" >&5 ac_lib_var=`echo bind'_'gethostbyaddr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3080,7 +3115,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lbind $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3130: \"$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 @@ -3272,32 +3307,34 @@ EOF EOF CFLAGS="$CFLAGS -Wmost -fno-common" - if echo $OS_TEST | grep -c 86 2>/dev/null; then - cat >> confdefs.h <<\EOF + case "${target_cpu}" in + i*86*) + cat >> confdefs.h <<\EOF #define i386 1 EOF - CPU_ARCH=i386 - else - cat >> confdefs.h <<\EOF + CPU_ARCH=i386 + PR_MD_ASFILES=os_Darwin_x86.s + ;; + *) + cat >> confdefs.h <<\EOF #define ppc 1 EOF - CPU_ARCH=ppc - fi + CPU_ARCH=ppc + PR_MD_ASFILES=os_Darwin_ppc.s + ;; + esac DSO_CFLAGS=-fPIC DSO_LDOPTS='-dynamiclib -compatibility_version 1 -current_version 1 -all_load -install_name @executable_path/$@ -headerpad_max_install_names' # Use the standard preprocessor (cpp) CFLAGS="$CFLAGS -no-cpp-precomp" - MKSHLIB='$(CC) -arch $(CPU_ARCH) $(DSO_LDOPTS) -o $@' + MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@' STRIP="$STRIP -x -S" DLL_SUFFIX=dylib USE_PTHREADS=1 MDCPUCFG_H=_darwin.cfg PR_MD_CSRCS=darwin.c - if test "$CPU_ARCH" = "ppc"; then - PR_MD_ASFILES=os_Darwin_ppc.s - fi # Add Mac OS X support for loading CFM & CFBundle plugins if test -f /System/Library/Frameworks/Carbon.framework/Carbon; then @@ -3319,38 +3356,57 @@ EOF ;; esac fi - fi - # do the right thing for SDK support - if test "$NEXT_ROOT"; then - - - - CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'` - GCC_VERSION_FULL=`echo $CC_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'` - GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'` - - GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'` + + if test "$MACOS_SDK_DIR"; then + + if test ! -d "$MACOS_SDK_DIR"; then + { echo "configure: error: SDK not found. When using --with-macos-sdk, you must +specify a valid SDK. SDKs are installed when the optional cross-development +tools are selected during the Xcode/Developer Tools installation." 1>&2; exit 1; } + fi - if test "$GCC_VERSION_MAJOR" -lt "4" ; then - TARGET_ARCH_LIB="darwin" - TARGET_ARCH_INCLUDE="ppc-darwin" - SDK_C_INCLUDE="-isystem ${NEXT_ROOT}/usr/include/gcc/darwin/${GCC_VERSION} -isystem ${NEXT_ROOT}/usr/include -F${NEXT_ROOT}/System/Library/Frameworks" - else - TARGET_ARCH_LIB=${target_cpu}-${target_vendor}-darwin`echo $NEXT_ROOT | $PERL -pe 's/MacOSX10\.(\d*)//;if ($1) {$_=$1+4;} else {$_="'${target_os}'";s/(\d+)//;$_=$1;}'` - TARGET_ARCH_INCLUDE=$TARGET_ARCH_LIB - SDK_C_INCLUDE="-isystem ${NEXT_ROOT}/usr/lib/gcc/${TARGET_ARCH_LIB}/${GCC_VERSION_FULL}/include -isystem ${NEXT_ROOT}/usr/include -F${NEXT_ROOT}/System/Library/Frameworks" - fi + + CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'` + GCC_VERSION_FULL=`echo $CC_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'` + GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'` + + GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'` + if test "$GCC_VERSION_MAJOR" -lt "4" ; then + SDK_C_FRAMEWORK="-F${MACOS_SDK_DIR}/System/Library/Frameworks" + if test -d "${MACOS_SDK_DIR}/Library/Frameworks" ; then + SDK_C_FRAMEWORK="$SDK_C_FRAMEWORK -F${MACOS_SDK_DIR}/Library/Frameworks" + fi - if test -d "${NEXT_ROOT}/Library/Frameworks" ; then - SDK_C_INCLUDE="$SDK_C_INCLUDE -F${NEXT_ROOT}/Library/Frameworks" - fi + SDK_C_INCLUDE="-isystem ${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION} -isystem ${MACOS_SDK_DIR}/usr/include ${SDK_C_FRAMEWORK}" + + CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}" - CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}" + CPP="$CPP -nostdinc ${SDK_C_INCLUDE}" - CPP="$CPP -nostdinc ${SDK_C_INCLUDE}" + MACOS_SDK_LIBS="-L${MACOS_SDK_DIR}/usr/lib/gcc/darwin -L${MACOS_SDK_DIR}/usr/lib/gcc/darwin/${GCC_VERSION_FULL} -L${MACOS_SDK_DIR}/usr/lib ${SDK_C_FRAMEWORK}" + LDFLAGS="${MACOS_SDK_LIBS} $LDFLAGS" + DSO_LDOPTS="${MACOS_SDK_LIBS} $DSO_LDOPTS" + export NEXT_ROOT=$MACOS_SDK_DIR - OS_LIBS="-L${NEXT_ROOT}/usr/lib/gcc/${TARGET_ARCH_LIB} -L${NEXT_ROOT}/usr/lib/gcc/${TARGET_ARCH_LIB}/${GCC_VERSION_FULL} -L${NEXT_ROOT}/usr/lib $OS_LIBS" + if test -n "$CROSS_COMPILE" ; then + HOST_CC="NEXT_ROOT= $HOST_CC" + HOST_CXX="NEXT_ROOT= $HOST_CXX" + fi + else + CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}" + + CPP="$CPP -isysroot ${MACOS_SDK_DIR}" + + if test "$GCC_VERSION_FULL" != "4.0.0" ; then + LDFLAGS="$LDFLAGS -isysroot ${MACOS_SDK_DIR}" + DSO_LDOPTS="$DSO_LDOPTS -isysroot ${MACOS_SDK_DIR}" + else + LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}" + DSO_LDOPTS="$DSO_LDOPTS -Wl,-syslibroot,${MACOS_SDK_DIR}" + fi + fi + fi fi ;; @@ -3435,10 +3491,6 @@ EOF cat >> confdefs.h <<\EOF #define _HPUX_SOURCE 1 -EOF - - cat >> confdefs.h <<\EOF -#define hppa 1 EOF # OSF1 and HPUX report the POLLHUP event for a socket when the @@ -3453,10 +3505,22 @@ EOF #define _USE_BIG_FDS 1 EOF - DLL_SUFFIX=sl DSO_LDOPTS='-b +h $(notdir $@)' PR_MD_CSRCS=hpux.c - if test "$OS_TEST" != "ia64"; then + if test "$OS_TEST" = "ia64"; then + DLL_SUFFIX=so + DSO_LDOPTS="$DSO_LDOPTS +b '\$\$ORIGIN'" + CPU_ARCH_TAG=_$OS_TEST + if test -z "$USE_64"; then + COMPILER_TAG=_32 + fi + PR_MD_ASFILES=os_HPUX_ia64.s + else + cat >> confdefs.h <<\EOF +#define hppa 1 +EOF + + DLL_SUFFIX=sl PR_MD_ASFILES=os_HPUX.s fi if test -n "$USE_64"; then @@ -3517,10 +3581,10 @@ EOF fi - # HP-UX 11i (B.11.11) or higher + # HP-UX 11i v2 (B.11.23) or higher case "$OS_RELEASE" in - [C-Z]*|B.[2-9]*|B.1[2-9]*|B.11.[2-9]*|B.11.1[1-9]*) + [C-Z]*|B.[2-9]*|B.1[2-9]*|B.11.[3-9]*|B.11.2[3-9]*) USE_IPV6=1 ;; esac @@ -3774,19 +3838,7 @@ EOF EOF cat >> confdefs.h <<\EOF -#define _POSIX_SOURCE 1 -EOF - - cat >> confdefs.h <<\EOF -#define _BSD_SOURCE 1 -EOF - - cat >> confdefs.h <<\EOF -#define _SVID_SOURCE 1 -EOF - - cat >> confdefs.h <<\EOF -#define _LARGEFILE64_SOURCE 1 +#define _GNU_SOURCE 1 EOF cat >> confdefs.h <<\EOF @@ -3797,8 +3849,8 @@ EOF #define LINUX 1 EOF - CFLAGS="$CFLAGS -ansi -Wall" - CXXFLAGS="$CXXFLAGS -ansi -Wall" + CFLAGS="$CFLAGS -Wall" + CXXFLAGS="$CXXFLAGS -Wall" MDCPUCFG_H=_linux.cfg PR_MD_CSRCS=linux.c MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@' @@ -4336,17 +4388,17 @@ EOF _OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Olimit 4000" ac_safe=`echo "machine/builtins.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for machine/builtins.h""... $ac_c" 1>&6 -echo "configure:4340: checking for machine/builtins.h" >&5 +echo "configure:4392: checking for machine/builtins.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4350: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4402: \"$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* @@ -4908,7 +4960,7 @@ case $target in ;; *) echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:4912: checking for dlopen in -ldl" >&5 +echo "configure:4964: 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 @@ -4916,7 +4968,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4983: \"$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 @@ -4944,17 +4996,17 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_safe=`echo "dlfcn.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for dlfcn.h""... $ac_c" 1>&6 -echo "configure:4948: checking for dlfcn.h" >&5 +echo "configure:5000: checking for dlfcn.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4958: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5010: \"$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* @@ -4987,13 +5039,13 @@ esac if test $ac_cv_prog_gcc = yes; then echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 -echo "configure:4991: checking whether ${CC-cc} needs -traditional" >&5 +echo "configure:5043: 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 < Autoconf TIOCGETP @@ -5011,7 +5063,7 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext < Autoconf TCGETA @@ -5035,12 +5087,12 @@ fi for ac_func in lchown strerror do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5039: checking for $ac_func" >&5 +echo "configure:5091: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5119: \"$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 @@ -5104,7 +5156,7 @@ hpux*) if test -z "$GNU_CC"; then echo $ac_n "checking for +Olit support""... $ac_c" 1>&6 -echo "configure:5108: checking for +Olit support" >&5 +echo "configure:5160: checking for +Olit support" >&5 if eval "test \"`echo '$''{'ac_cv_hpux_usable_olit_option'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5143,7 +5195,7 @@ darwin*) *) echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6 -echo "configure:5147: checking for pthread_create in -lpthreads" >&5 +echo "configure:5199: checking for pthread_create in -lpthreads" >&5 echo " #include void *foo(void *v) { return v; } @@ -5165,7 +5217,7 @@ echo " echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 -echo "configure:5169: checking for pthread_create in -lpthread" >&5 +echo "configure:5221: checking for pthread_create in -lpthread" >&5 echo " #include void *foo(void *v) { return v; } @@ -5187,7 +5239,7 @@ echo " echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6 -echo "configure:5191: checking for pthread_create in -lc_r" >&5 +echo "configure:5243: checking for pthread_create in -lc_r" >&5 echo " #include void *foo(void *v) { return v; } @@ -5209,7 +5261,7 @@ echo " echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6 -echo "configure:5213: checking for pthread_create in -lc" >&5 +echo "configure:5265: checking for pthread_create in -lc" >&5 echo " #include void *foo(void *v) { return v; } @@ -5363,7 +5415,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:5367: checking whether ${CC-cc} accepts -pthread" >&5 +echo "configure:5419: 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 @@ -5386,7 +5438,7 @@ echo "configure:5367: 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:5390: checking whether ${CC-cc} accepts -pthreads" >&5 +echo "configure:5442: 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 @@ -5781,6 +5833,9 @@ esac + + + @@ -5851,6 +5906,8 @@ if test -n "$USE_CPLUS"; then MAKEFILES="$MAKEFILES pr/src/cplus/Makefile pr/src/cplus/tests/Makefile" fi +echo $MAKEFILES > unallmakefiles + trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure @@ -6029,6 +6086,7 @@ s%@PERL@%$PERL%g s%@SHELL_OVERRIDE@%$SHELL_OVERRIDE%g s%@MOZILLA_CLIENT@%$MOZILLA_CLIENT%g s%@HOST_CFLAGS@%$HOST_CFLAGS%g +s%@HOST_LDFLAGS@%$HOST_LDFLAGS%g s%@GNU_CC@%$GNU_CC%g s%@GCC_USE_GNU_LD@%$GCC_USE_GNU_LD%g s%@MSC_VER@%$MSC_VER%g @@ -6093,6 +6151,8 @@ s%@OS_DLLFLAGS@%$OS_DLLFLAGS%g s%@CYGWIN_WRAPPER@%$CYGWIN_WRAPPER%g s%@VISIBILITY_FLAGS@%$VISIBILITY_FLAGS%g s%@WRAP_SYSTEM_INCLUDES@%$WRAP_SYSTEM_INCLUDES%g +s%@MACOS_SDK_DIR@%$MACOS_SDK_DIR%g +s%@NEXT_ROOT@%$NEXT_ROOT%g CEOF EOF diff --git a/configure.in b/configure.in index 3b2d9780..98295583 100644 --- a/configure.in +++ b/configure.in @@ -1,38 +1,43 @@ dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*- dnl -dnl The contents of this file are subject to the Mozilla Public -dnl License Version 1.1 (the "License"); you may not use this file -dnl except in compliance with the License. You may obtain a copy of -dnl the License at http://www.mozilla.org/MPL/ -dnl -dnl Software distributed under the License is distributed on an "AS -dnl IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -dnl implied. See the License for the specific language governing -dnl rights and limitations under the License. -dnl +dnl ***** BEGIN LICENSE BLOCK ***** +dnl Version: MPL 1.1/GPL 2.0/LGPL 2.1 +dnl +dnl The contents of this file are subject to the Mozilla Public License Version +dnl 1.1 (the "License"); you may not use this file except in compliance with +dnl the License. You may obtain a copy of the License at +dnl http://www.mozilla.org/MPL/ +dnl +dnl Software distributed under the License is distributed on an "AS IS" basis, +dnl WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +dnl for the specific language governing rights and limitations under the +dnl License. +dnl dnl The Original Code is the Netscape Portable Runtime (NSPR). -dnl -dnl The Initial Developer of the Original Code is Netscape -dnl Communications Corporation. Portions created by Netscape are -dnl Copyright (C) 1998o-2000 Netscape Communications Corporation. All -dnl Rights Reserved. -dnl +dnl +dnl The Initial Developer of the Original Code is +dnl Netscape Communications Corporation. +dnl Portions created by the Initial Developer are Copyright (C) 1998 +dnl the Initial Developer. All Rights Reserved. +dnl dnl Contributor(s): -dnl Christopher Seawood -dnl Howard Chu -dnl -dnl Alternatively, the contents of this file may be used under the -dnl terms of the GNU General Public License Version 2 or later (the -dnl "GPL"), in which case the provisions of the GPL are applicable -dnl instead of those above. If you wish to allow use of your -dnl version of this file only under the terms of the GPL and not to -dnl allow others to use your version of this file under the MPL, -dnl indicate your decision by deleting the provisions above and -dnl replace them with the notice and other provisions required by -dnl the GPL. If you do not delete the provisions above, a recipient -dnl may use your version of this file under either the MPL or the -dnl GPL. -dnl +dnl Christopher Seawood +dnl Howard Chu +dnl Mark Mentovai +dnl +dnl Alternatively, the contents of this file may be used under the terms of +dnl either the GNU General Public License Version 2 or later (the "GPL"), or +dnl the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +dnl in which case the provisions of the GPL or the LGPL are applicable instead +dnl of those above. If you wish to allow use of your version of this file only +dnl under the terms of either the GPL or the LGPL, and not to allow others to +dnl use your version of this file under the terms of the MPL, indicate your +dnl decision by deleting the provisions above and replace them with the notice +dnl and other provisions required by the GPL or the LGPL. If you do not delete +dnl the provisions above, a recipient may use your version of this file under +dnl the terms of any one of the MPL, the GPL or the LGPL. +dnl +dnl ***** END LICENSE BLOCK ***** AC_PREREQ(2.12) AC_INIT(config/libc_r.h) @@ -45,7 +50,7 @@ dnl = Defaults dnl ======================================================== MOD_MAJOR_VERSION=4 MOD_MINOR_VERSION=6 -MOD_PATCH_VERSION=1 +MOD_PATCH_VERSION=7 NSPR_MODNAME=nspr20 _HAVE_PTHREADS= USE_PTHREADS= @@ -69,6 +74,8 @@ NOSUCHFILE=/no-such-file LIBNSPR='-L$(dist_libdir) -lnspr$(MOD_MAJOR_VERSION)' LIBPLC='-L$(dist_libdir) -lplc$(MOD_MAJOR_VERSION)' CYGWIN_WRAPPER= +MACOS_SDK_DIR= +NEXT_ROOT= dnl Link in libraries necessary to resolve all symbols for shared libs RESOLVE_LINK_SYMBOLS= @@ -226,6 +233,13 @@ AC_ARG_ENABLE(mdupdate, USE_MDUPDATE=1 fi ]) +dnl ======================================================== +dnl = Mac OS X SDK support +dnl ======================================================== +AC_ARG_WITH(macos-sdk, + [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)], + MACOS_SDK_DIR=$withval) + AC_ARG_ENABLE(macos-target, [ --enable-macos-target=VER Set the minimum MacOS version needed at runtime @@ -402,12 +416,37 @@ if test "$target" != "$host"; then CFLAGS=$_SAVE_CFLAGS LDFLAGS=$_SAVE_LDFLAGS + case "$build:$target" in + powerpc-apple-darwin8*:i?86-apple-darwin*) + dnl The Darwin cross compiler doesn't necessarily point itself at a + dnl root that has libraries for the proper architecture, it defaults + dnl to the system root. The libraries in the system root on current + dnl versions of PPC OS X 10.4 aren't fat, so these target compiler + dnl checks will fail. Fake a working SDK in that case. + _SAVE_CFLAGS=$CFLAGS + _SAVE_CXXFLAGS=$CXXLAGS + CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CFLAGS" + CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CXXFLAGS" + ;; + esac + AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", echo) unset ac_cv_prog_CC AC_PROG_CC AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", echo) unset ac_cv_prog_CXX AC_PROG_CXX + + case "$build:$target" in + powerpc-apple-darwin8*:i?86-apple-darwin*) + dnl Revert the changes made above. From this point on, the target + dnl compiler will never be used without applying the SDK to CFLAGS + dnl (see --with-macos-sdk below). + CFLAGS=$_SAVE_CFLAGS + CXXFLAGS=$_SAVE_CXXFLAGS + ;; + esac + AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", echo) AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", echo) AC_CHECK_PROGS(AS, $AS "${target_alias}-as" "${target}-as", echo) @@ -448,6 +487,15 @@ if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then fi rm -f a.out +case "$build:$target" in + i?86-apple-darwin*:powerpc-apple-darwin*) + dnl cross_compiling will have erroneously been set to "no" in this + dnl case, because the x86 build host is able to run ppc code in a + dnl translated environment, making a cross compiler appear native. + cross_compiling=yes + ;; +esac + if test "$cross_compiling" = "yes"; then CROSS_COMPILE=1 else @@ -581,6 +629,7 @@ if test -n "$CROSS_COMPILE"; then linux*) OS_ARCH=Linux ;; solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;; mingw*) OS_ARCH=WINNT ;; + darwin*) OS_ARCH=Darwin ;; esac else OS_ARCH=`uname -s | sed -e 's|/|_|g'` @@ -917,26 +966,28 @@ case "$target" in AC_DEFINE(DARWIN) AC_DEFINE(HAVE_BSD_FLOCK) CFLAGS="$CFLAGS -Wmost -fno-common" - if echo $OS_TEST | grep -c 86 2>/dev/null; then - AC_DEFINE(i386) - CPU_ARCH=i386 - else - AC_DEFINE(ppc) - CPU_ARCH=ppc - fi + case "${target_cpu}" in + i*86*) + AC_DEFINE(i386) + CPU_ARCH=i386 + PR_MD_ASFILES=os_Darwin_x86.s + ;; + *) + AC_DEFINE(ppc) + CPU_ARCH=ppc + PR_MD_ASFILES=os_Darwin_ppc.s + ;; + esac DSO_CFLAGS=-fPIC DSO_LDOPTS='-dynamiclib -compatibility_version 1 -current_version 1 -all_load -install_name @executable_path/$@ -headerpad_max_install_names' # Use the standard preprocessor (cpp) CFLAGS="$CFLAGS -no-cpp-precomp" - MKSHLIB='$(CC) -arch $(CPU_ARCH) $(DSO_LDOPTS) -o $@' + MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@' STRIP="$STRIP -x -S" DLL_SUFFIX=dylib USE_PTHREADS=1 MDCPUCFG_H=_darwin.cfg PR_MD_CSRCS=darwin.c - if test "$CPU_ARCH" = "ppc"; then - PR_MD_ASFILES=os_Darwin_ppc.s - fi # Add Mac OS X support for loading CFM & CFBundle plugins if test -f /System/Library/Frameworks/Carbon.framework/Carbon; then @@ -961,52 +1012,89 @@ case "$target" in ;; esac fi - fi - # do the right thing for SDK support - if test "$NEXT_ROOT"; then - dnl Synced to the MACOS_SDK_DIR block in Mozilla's top-level - dnl configure.in - - dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0. - dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for - dnl the environment and includedir purposes (when using an SDK, below), - dnl but remember the full version number for the libdir (SDK). - - changequote(,) - CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'` - GCC_VERSION_FULL=`echo $CC_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'` - GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'` - changequote([,]) - GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'` - - if test "$GCC_VERSION_MAJOR" -lt "4" ; then - dnl gcc < 4.0 only supports PowerPC, OK to hard-code - TARGET_ARCH_LIB="darwin" - TARGET_ARCH_INCLUDE="ppc-darwin" - SDK_C_INCLUDE="-isystem ${NEXT_ROOT}/usr/include/gcc/darwin/${GCC_VERSION} -isystem ${NEXT_ROOT}/usr/include -F${NEXT_ROOT}/System/Library/Frameworks" - else - dnl If gcc >= 4, use cpu-apple-darwin#, where # is the version - dnl of the Darwin release corresponding to the target Mac OS X - dnl release. For OS X >= 10.1.1, take the minor version number and - dnl add 4 to get the Darwin major version number. If it can't be - dnl determined, use current Darwin major version number and hope - dnl that there's a symlink. - TARGET_ARCH_LIB=${target_cpu}-${target_vendor}-darwin`echo $NEXT_ROOT | $PERL -pe 's/MacOSX10\.([\d]*)//;if ($1) {$_=$1+4;} else {$_="'${target_os}'";s/(\d+)//;$_=$1;}'` - TARGET_ARCH_INCLUDE=$TARGET_ARCH_LIB - SDK_C_INCLUDE="-isystem ${NEXT_ROOT}/usr/lib/gcc/${TARGET_ARCH_LIB}/${GCC_VERSION_FULL}/include -isystem ${NEXT_ROOT}/usr/include -F${NEXT_ROOT}/System/Library/Frameworks" - fi + dnl MACOS_SDK_DIR will be set to the SDK location whenever one is + dnl in use. NEXT_ROOT will be set and exported if it's needed for + dnl ld. - if test -d "${NEXT_ROOT}/Library/Frameworks" ; then - SDK_C_INCLUDE="$SDK_C_INCLUDE -F${NEXT_ROOT}/Library/Frameworks" - fi + if test "$MACOS_SDK_DIR"; then + dnl Sync this section with the one in Mozilla's top level. - CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}" + if test ! -d "$MACOS_SDK_DIR"; then + AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must +specify a valid SDK. SDKs are installed when the optional cross-development +tools are selected during the Xcode/Developer Tools installation.]) + fi - dnl CPP needs to be set for AC_CHECK_HEADER. - CPP="$CPP -nostdinc ${SDK_C_INCLUDE}" + changequote(,) + CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'` + GCC_VERSION_FULL=`echo $CC_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'` + GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'` + changequote([,]) + GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'` + if test "$GCC_VERSION_MAJOR" -lt "4" ; then + SDK_C_FRAMEWORK="-F${MACOS_SDK_DIR}/System/Library/Frameworks" + if test -d "${MACOS_SDK_DIR}/Library/Frameworks" ; then + SDK_C_FRAMEWORK="$SDK_C_FRAMEWORK -F${MACOS_SDK_DIR}/Library/Frameworks" + fi - OS_LIBS="-L${NEXT_ROOT}/usr/lib/gcc/${TARGET_ARCH_LIB} -L${NEXT_ROOT}/usr/lib/gcc/${TARGET_ARCH_LIB}/${GCC_VERSION_FULL} -L${NEXT_ROOT}/usr/lib $OS_LIBS" + SDK_C_INCLUDE="-isystem ${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION} -isystem ${MACOS_SDK_DIR}/usr/include ${SDK_C_FRAMEWORK}" + + CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}" + + dnl CPP needs to be set for AC_CHECK_HEADER. + CPP="$CPP -nostdinc ${SDK_C_INCLUDE}" + + dnl ld support for -syslibroot is compiler-agnostic, but only + dnl available on Tiger. Although it's possible to switch on + dnl the build host's OS release to use ld -syslibroot when + dnl available, ld -syslibroot cause warnings as long as + dnl NEXT_ROOT is set. NEXT_ROOT should be set because both + dnl both the compiler and linker use it. + dnl + dnl LDFLAGS is for the utilities built in config (now and + dnl nsinstall). DSO_LDOPTS is used when linking shared + dnl libraries. + MACOS_SDK_LIBS="-L${MACOS_SDK_DIR}/usr/lib/gcc/darwin -L${MACOS_SDK_DIR}/usr/lib/gcc/darwin/${GCC_VERSION_FULL} -L${MACOS_SDK_DIR}/usr/lib ${SDK_C_FRAMEWORK}" + LDFLAGS="${MACOS_SDK_LIBS} $LDFLAGS" + DSO_LDOPTS="${MACOS_SDK_LIBS} $DSO_LDOPTS" + export NEXT_ROOT=$MACOS_SDK_DIR + + if test -n "$CROSS_COMPILE" ; then + dnl NEXT_ROOT will be in the environment, but it + dnl shouldn't be set for the build host. HOST_CXX is + dnl presently unused. + HOST_CC="NEXT_ROOT= $HOST_CC" + HOST_CXX="NEXT_ROOT= $HOST_CXX" + fi + else + dnl gcc >= 4.0 uses different paths than above, but knows + dnl how to find them itself. + CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}" + + dnl CPP needs to be set for AC_CHECK_HEADER. + CPP="$CPP -isysroot ${MACOS_SDK_DIR}" + + dnl If gcc >= 4.0.0, we're guaranteed to be on Tiger, which + dnl has an ld that supports -syslibroot. Don't set + dnl NEXT_ROOT because it will be ignored and cause + dnl warnings when -syslibroot is specified. + dnl + dnl Both LDFLAGS and DSO_LDOPTS are set here, see the + dnl gcc < 4.0 case for the explanation. + if test "$GCC_VERSION_FULL" != "4.0.0" ; then + dnl gcc > 4.0.0 will pass -syslibroot to ld automatically + dnl based on the -isysroot it receives. + LDFLAGS="$LDFLAGS -isysroot ${MACOS_SDK_DIR}" + DSO_LDOPTS="$DSO_LDOPTS -isysroot ${MACOS_SDK_DIR}" + else + dnl gcc 4.0.0 doesn't pass -syslibroot to ld, it needs + dnl to be explicit. + LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}" + DSO_LDOPTS="$DSO_LDOPTS -Wl,-syslibroot,${MACOS_SDK_DIR}" + fi + fi + fi fi ;; @@ -1051,17 +1139,25 @@ case "$target" in AC_DEFINE(XP_UNIX) AC_DEFINE(HPUX) AC_DEFINE(_HPUX_SOURCE) - AC_DEFINE(hppa) # OSF1 and HPUX report the POLLHUP event for a socket when the # shutdown(SHUT_WR) operation is called for the remote end, even though # the socket is still writeable. Use select(), instead of poll(), to # workaround this problem. AC_DEFINE(_PR_POLL_WITH_SELECT) AC_DEFINE(_USE_BIG_FDS) - DLL_SUFFIX=sl DSO_LDOPTS='-b +h $(notdir $@)' PR_MD_CSRCS=hpux.c - if test "$OS_TEST" != "ia64"; then + if test "$OS_TEST" = "ia64"; then + DLL_SUFFIX=so + DSO_LDOPTS="$DSO_LDOPTS +b '\$\$ORIGIN'" + CPU_ARCH_TAG=_$OS_TEST + if test -z "$USE_64"; then + COMPILER_TAG=_32 + fi + PR_MD_ASFILES=os_HPUX_ia64.s + else + AC_DEFINE(hppa) + DLL_SUFFIX=sl PR_MD_ASFILES=os_HPUX.s fi if test -n "$USE_64"; then @@ -1104,10 +1200,10 @@ case "$target" in AC_DEFINE(HAVE_POINTER_LOCALTIME_R) fi - # HP-UX 11i (B.11.11) or higher + # HP-UX 11i v2 (B.11.23) or higher changequote(<<,>>) case "$OS_RELEASE" in - [C-Z]*|B.[2-9]*|B.1[2-9]*|B.11.[2-9]*|B.11.1[1-9]*) + [C-Z]*|B.[2-9]*|B.1[2-9]*|B.11.[3-9]*|B.11.2[3-9]*) USE_IPV6=1 ;; esac @@ -1292,14 +1388,11 @@ case "$target" in IMPL_STRATEGY=_PTH fi AC_DEFINE(XP_UNIX) - AC_DEFINE(_POSIX_SOURCE) - AC_DEFINE(_BSD_SOURCE) - AC_DEFINE(_SVID_SOURCE) - AC_DEFINE(_LARGEFILE64_SOURCE) + AC_DEFINE(_GNU_SOURCE) AC_DEFINE(HAVE_FCNTL_FILE_LOCKING) AC_DEFINE(LINUX) - CFLAGS="$CFLAGS -ansi -Wall" - CXXFLAGS="$CXXFLAGS -ansi -Wall" + CFLAGS="$CFLAGS -Wall" + CXXFLAGS="$CXXFLAGS -Wall" MDCPUCFG_H=_linux.cfg PR_MD_CSRCS=linux.c MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@' @@ -2578,6 +2671,7 @@ AC_SUBST(CPPFLAGS) AC_SUBST(HOST_CC) AC_SUBST(HOST_CFLAGS) AC_SUBST(LDFLAGS) +AC_SUBST(HOST_LDFLAGS) AC_SUBST(GNU_CC) AC_SUBST(GCC_USE_GNU_LD) AC_SUBST(MSC_VER) @@ -2659,6 +2753,8 @@ AC_SUBST(OS_DLLFLAGS) AC_SUBST(CYGWIN_WRAPPER) AC_SUBST(VISIBILITY_FLAGS) AC_SUBST(WRAP_SYSTEM_INCLUDES) +AC_SUBST(MACOS_SDK_DIR) +AC_SUBST(NEXT_ROOT) dnl ======================================================== dnl Generate output files. @@ -2715,4 +2811,6 @@ if test -n "$USE_CPLUS"; then MAKEFILES="$MAKEFILES pr/src/cplus/Makefile pr/src/cplus/tests/Makefile" fi +echo $MAKEFILES > unallmakefiles + AC_OUTPUT([$MAKEFILES], [chmod +x config/nspr-config]) diff --git a/lib/ds/Makefile.in b/lib/ds/Makefile.in index 2916ab70..5a2e0722 100644 --- a/lib/ds/Makefile.in +++ b/lib/ds/Makefile.in @@ -63,11 +63,6 @@ HEADERS = \ HEADERS := $(addprefix $(srcdir)/, $(HEADERS)) ifeq ($(OS_ARCH), WINNT) -ifdef NS_USE_GCC -DLLBASE=-Wl,--image-base -Wl,0x30000000 -else -DLLBASE=-BASE:0x30000000 -endif # GCC RES=$(OBJDIR)/plds.res RESNAME=plds.rc endif # WINNT diff --git a/lib/libc/src/Makefile.in b/lib/libc/src/Makefile.in index fcdbae60..a0f4295f 100644 --- a/lib/libc/src/Makefile.in +++ b/lib/libc/src/Makefile.in @@ -73,11 +73,6 @@ LIBRARY_VERSION = $(MOD_MAJOR_VERSION) RELEASE_LIBS = $(TARGETS) ifeq ($(OS_ARCH),WINNT) -ifdef NS_USE_GCC -DLLBASE=-Wl,--image-base -Wl,0x30000000 -else -DLLBASE=-BASE:0x30000000 -endif RES=$(OBJDIR)/plc.res RESNAME=plc.rc endif # WINNT diff --git a/lib/msgc/src/Makefile.in b/lib/msgc/src/Makefile.in index de834cc5..5d5a1146 100644 --- a/lib/msgc/src/Makefile.in +++ b/lib/msgc/src/Makefile.in @@ -69,11 +69,6 @@ EXTRA_LIBS += $(OS_LIBS) endif ifeq ($(OS_ARCH), WINNT) -ifdef NS_USE_GCC -DLLBASE=-Wl,--image-base -Wl,0x30000000 -else -DLLBASE=-BASE:0x30000000 -endif # GCC #RES=$(OBJDIR)/ds.res #RESNAME=$(MOD_DEPTH)/pr/src/nspr.rc #OS_LIBS = user32.lib diff --git a/lib/prstreams/Makefile.in b/lib/prstreams/Makefile.in index 679c03d9..a29af95d 100644 --- a/lib/prstreams/Makefile.in +++ b/lib/prstreams/Makefile.in @@ -88,7 +88,6 @@ CXXSRCS = \ OBJS = $(addprefix $(OBJDIR)/,$(CSRCS:.c=.$(OBJ_SUFFIX)) $(CXXSRCS:.cpp=.$(OBJ_SUFFIX))) ifeq ($(OS_ARCH), WINNT) - DLLBASE=-BASE:0x30000000 RES=$(OBJDIR)/prstrms.res RESNAME=prstrms.rc OS_LIBS = user32.lib diff --git a/pkg/linux/Makefile.in b/pkg/linux/Makefile.in index c2ef7e89..ebf62ea6 100644 --- a/pkg/linux/Makefile.in +++ b/pkg/linux/Makefile.in @@ -47,7 +47,9 @@ srcdir = @srcdir@ VPATH = @srcdir@ NAME = sun-nspr -RELEASE = 1 +ifndef RPM_RELEASE +RPM_RELEASE = 1 +endif TOPDIR = /usr/src/redhat VERSION = `grep PR_VERSION $(dist_includedir)/prinit.h \ | sed -e 's/"$$//' -e 's/.*"//' -e 's/ .*//'` @@ -76,7 +78,7 @@ publish: tar czvf SOURCES/$(NAME)-$(VERSION).tar.gz opt echo "%define name $(NAME)" >$(SPECFILE) echo "%define version $(VERSION)" >>$(SPECFILE) - echo "%define release $(RELEASE)" >>$(SPECFILE) + echo "%define release $(RPM_RELEASE)" >>$(SPECFILE) echo "%define buildroot `pwd`/$(NAME)-root" >>$(SPECFILE) echo "%define _topdir `pwd`" >>$(SPECFILE) echo "%define _unpackaged_files_terminate_build 0" >>$(SPECFILE) diff --git a/pkg/solaris/SUNWprd/prototype b/pkg/solaris/SUNWprd/prototype index d59914b4..fb57aa48 100755 --- a/pkg/solaris/SUNWprd/prototype +++ b/pkg/solaris/SUNWprd/prototype @@ -2,6 +2,7 @@ # Copyright 2005 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# ***** BEGIN LICENSE BLOCK ***** # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version diff --git a/pr/include/md/_beos.cfg b/pr/include/md/_beos.cfg index d15cf044..e1a4d313 100644 --- a/pr/include/md/_beos.cfg +++ b/pr/include/md/_beos.cfg @@ -1,36 +1,39 @@ /* -*- 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. - * +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * 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. - * + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998-2000 + * the Initial Developer. All Rights Reserved. + * * Contributor(s): - * - * 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. - */ + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ #ifndef nspr_cpucfg___ #define nspr_cpucfg___ diff --git a/pr/include/md/_darwin.cfg b/pr/include/md/_darwin.cfg index 349ef3ba..dc7e0e0c 100644 --- a/pr/include/md/_darwin.cfg +++ b/pr/include/md/_darwin.cfg @@ -94,6 +94,7 @@ #define PR_ALIGN_OF_FLOAT 4 #define PR_ALIGN_OF_DOUBLE 4 #define PR_ALIGN_OF_POINTER 4 +#define PR_ALIGN_OF_WORD 4 #ifndef NO_NSPR_10_SUPPORT diff --git a/pr/include/md/_darwin.h b/pr/include/md/_darwin.h index 6f409e36..3c599fa7 100644 --- a/pr/include/md/_darwin.h +++ b/pr/include/md/_darwin.h @@ -48,9 +48,9 @@ #define PR_LINKER_ARCH "darwin" #define _PR_SI_SYSNAME "DARWIN" -#ifdef i386 +#ifdef __i386__ #define _PR_SI_ARCHITECTURE "x86" -#else +#elif defined(__ppc__) #define _PR_SI_ARCHITECTURE "ppc" #endif #define PR_DLL_SUFFIX ".dylib" @@ -65,7 +65,7 @@ #define USE_MACH_DYLD #define _PR_HAVE_SOCKADDR_LEN #define _PR_STAT_HAS_ST_ATIMESPEC -#define _PR_NO_LARGE_FILES +#define _PR_HAVE_LARGE_OFF_T #define PR_HAVE_SYSV_NAMED_SHARED_MEMORY #define _PR_INET6 @@ -113,7 +113,18 @@ extern PRInt32 _PR_DarwinPPC_AtomicSet(PRInt32 *val, PRInt32 newval); #define _MD_ATOMIC_SET(val, newval) _PR_DarwinPPC_AtomicSet(val, newval) extern PRInt32 _PR_DarwinPPC_AtomicAdd(PRInt32 *ptr, PRInt32 val); #define _MD_ATOMIC_ADD(ptr, val) _PR_DarwinPPC_AtomicAdd(ptr, val) -#endif /* __ppc__ */ +#elif defined(__i386__) +#define _PR_HAVE_ATOMIC_OPS +#define _MD_INIT_ATOMIC() +extern PRInt32 _PR_Darwin_x86_AtomicIncrement(PRInt32 *val); +#define _MD_ATOMIC_INCREMENT(val) _PR_Darwin_x86_AtomicIncrement(val) +extern PRInt32 _PR_Darwin_x86_AtomicDecrement(PRInt32 *val); +#define _MD_ATOMIC_DECREMENT(val) _PR_Darwin_x86_AtomicDecrement(val) +extern PRInt32 _PR_Darwin_x86_AtomicSet(PRInt32 *val, PRInt32 newval); +#define _MD_ATOMIC_SET(val, newval) _PR_Darwin_x86_AtomicSet(val, newval) +extern PRInt32 _PR_Darwin_x86_AtomicAdd(PRInt32 *ptr, PRInt32 val); +#define _MD_ATOMIC_ADD(ptr, val) _PR_Darwin_x86_AtomicAdd(ptr, val) +#endif /* __i386__ */ #define USE_SETJMP diff --git a/pr/include/md/_hpux.h b/pr/include/md/_hpux.h index 73928313..2a6f177f 100644 --- a/pr/include/md/_hpux.h +++ b/pr/include/md/_hpux.h @@ -44,8 +44,18 @@ #define PR_LINKER_ARCH "hpux" #define _PR_SI_SYSNAME "HPUX" +#ifdef __ia64 +#define _PR_SI_ARCHITECTURE "ia64" +#define PR_DLL_SUFFIX ".so" +#else +/* + * _PR_SI_ARCHITECTURE must be "hppa1.1" for backward compatibility. + * It was changed to "hppa" in NSPR 4.6.2, but was changed back in + * NSPR 4.6.4. + */ #define _PR_SI_ARCHITECTURE "hppa1.1" #define PR_DLL_SUFFIX ".sl" +#endif #define _PR_VMBASE 0x30000000 #define _PR_STACK_VMBASE 0x50000000 @@ -80,14 +90,44 @@ #define PR_HAVE_POSIX_NAMED_SHARED_MEMORY #define _PR_ACCEPT_INHERIT_NONBLOCK -#undef _PR_HAVE_ATOMIC_OPS +#if defined(__ia64) +#define _PR_HAVE_ATOMIC_OPS +#define _MD_INIT_ATOMIC() +extern PRInt32 _PR_ia64_AtomicIncrement(PRInt32 *val); +#define _MD_ATOMIC_INCREMENT _PR_ia64_AtomicIncrement +extern PRInt32 _PR_ia64_AtomicDecrement(PRInt32 *val); +#define _MD_ATOMIC_DECREMENT _PR_ia64_AtomicDecrement +extern PRInt32 _PR_ia64_AtomicAdd(PRInt32 *ptr, PRInt32 val); +#define _MD_ATOMIC_ADD _PR_ia64_AtomicAdd +extern PRInt32 _PR_ia64_AtomicSet(PRInt32 *val, PRInt32 newval); +#define _MD_ATOMIC_SET _PR_ia64_AtomicSet +#endif -#ifdef _PR_INET6 -#define _PR_HAVE_INET_NTOP #define _PR_HAVE_GETIPNODEBYNAME #define _PR_HAVE_GETIPNODEBYADDR #define _PR_HAVE_GETADDRINFO +#ifdef _PR_INET6 +#define _PR_HAVE_INET_NTOP +#else #define _PR_INET6_PROBE +#define _PR_HAVE_MD_SOCKADDR_IN6 +/* isomorphic to struct in6_addr on HP-UX B.11.23 */ +struct _md_in6_addr { + union { + PRUint8 _S6_u8[16]; + PRUint16 _S6_u16[8]; + PRUint32 _S6_u32[4]; + PRUint32 __S6_align; + } _s6_un; +}; +/* isomorphic to struct sockaddr_in6 on HP-UX B.11.23 */ +struct _md_sockaddr_in6 { + PRUint16 sin6_family; + PRUint16 sin6_port; + PRUint32 sin6_flowinfo; + struct _md_in6_addr sin6_addr; + PRUint32 sin6_scope_id; +}; #endif #if !defined(_PR_PTHREADS) diff --git a/pr/include/md/_netbsd.h b/pr/include/md/_netbsd.h index cc16f105..db25bd89 100644 --- a/pr/include/md/_netbsd.h +++ b/pr/include/md/_netbsd.h @@ -1,36 +1,39 @@ /* -*- 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. - * +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * 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. - * + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998-2000 + * the Initial Developer. All Rights Reserved. + * * Contributor(s): - * - * 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. - */ + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ #ifndef nspr_netbsd_defs_h___ #define nspr_netbsd_defs_h___ @@ -104,100 +107,40 @@ #define CONTEXT(_th) ((_th)->md.context) +#if defined(__i386__) || defined(__sparc__) || defined(__m68k__) || defined(__powerpc__) +#define JB_SP_INDEX 2 +#elif defined(__mips__) +#define JB_SP_INDEX 4 +#elif defined(__alpha__) +#define JB_SP_INDEX 34 +#elif defined(__arm32__) /* -** Initialize a thread context to run "_main()" when started -*/ -#ifdef __i386__ -#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \ -{ \ - sigsetjmp(CONTEXT(_thread), 1); \ - CONTEXT(_thread)[2] = (unsigned char*) ((_sp) - 128); \ - CONTEXT(_thread)[0] = (int) _main; \ - *status = PR_TRUE; \ -} -#define _MD_GET_SP(_thread) CONTEXT(_thread)[2] -#endif -#ifdef __sparc_v9__ -#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \ -{ \ - sigsetjmp(CONTEXT(_thread), 1); \ - CONTEXT(_thread)[1] = (unsigned char*) ((_sp) - 176 - 0x7ff); \ - CONTEXT(_thread)[2] = (long) _main; \ - CONTEXT(_thread)[3] = (long) _main + 4; \ - *status = PR_TRUE; \ -} -#define _MD_GET_SP(_thread) (CONTEXT(_thread)[2]+0x7ff) -#elif defined(__sparc__) -#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \ -{ \ - sigsetjmp(CONTEXT(_thread), 1); \ - CONTEXT(_thread)[2] = (unsigned char*) ((_sp) - 128); \ - CONTEXT(_thread)[3] = (int) _main; \ - CONTEXT(_thread)[4] = (int) _main + 4; \ - *status = PR_TRUE; \ -} -#define _MD_GET_SP(_thread) CONTEXT(_thread)[2] -#endif -#ifdef __powerpc__ -#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \ -{ \ - sigsetjmp(CONTEXT(_thread), 1); \ - CONTEXT(_thread)[3] = (unsigned char*) ((_sp) - 128); \ - CONTEXT(_thread)[4] = (int) _main; \ - *status = PR_TRUE; \ -} -#define _MD_GET_SP(_thread) CONTEXT(_thread)[3] -#endif -#ifdef __m68k__ -#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \ -{ \ - sigsetjmp(CONTEXT(_thread), 1); \ - CONTEXT(_thread)[2] = (unsigned char*) ((_sp) - 128); \ - CONTEXT(_thread)[5] = (int) _main; \ - *status = PR_TRUE; \ -} -#define _MD_GET_SP(_thread) CONTEXT(_thread)[2] -#endif -#ifdef __mips__ -#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \ -{ \ - sigsetjmp(CONTEXT(_thread), 1); \ - CONTEXT(_thread)[32] = (unsigned char*) ((_sp) - 128); \ - CONTEXT(_thread)[2] = (int) _main; \ - CONTEXT(_thread)[28] = (int) _main; \ - *status = PR_TRUE; \ -} -#define _MD_GET_SP(_thread) CONTEXT(_thread)[32] -#endif -#if defined(__arm32__) || defined(__arm__) || defined(__armel__) \ - || defined(__armeb__) -#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \ -{ \ - sigsetjmp(CONTEXT(_thread), 1); \ - CONTEXT(_thread)[23] = (unsigned char*) ((_sp) - 128); \ - CONTEXT(_thread)[24] = (int) _main; \ - *status = PR_TRUE; \ -} -#define _MD_GET_SP(_thread) CONTEXT(_thread)[23] -#endif -#ifdef __alpha__ -#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \ -{ \ - sigsetjmp(CONTEXT(_thread), 1); \ - CONTEXT(_thread)[34] = (unsigned char*) ((_sp) - 128); \ - CONTEXT(_thread)[2] = (long) _main; \ - CONTEXT(_thread)[30] = (long) _main; \ - CONTEXT(_thread)[31] = (long) _main; \ - *status = PR_TRUE; \ -} -#define _MD_GET_SP(_thread) CONTEXT(_thread)[34] + * On the arm32, the jmpbuf regs underwent a name change after NetBSD 1.3. + */ +#ifdef JMPBUF_REG_R13 +#define JB_SP_INDEX JMPBUF_REG_R13 +#else +#define JB_SP_INDEX _JB_REG_R13 #endif -#ifndef _MD_INIT_CONTEXT -#error "Need to define _MD_INIT_CONTEXT for this platform" +#else +#error "Need to define SP index in jmp_buf here" #endif +#define _MD_GET_SP(_th) (_th)->md.context[JB_SP_INDEX] #define PR_NUM_GCREGS _JBLEN +/* +** Initialize a thread context to run "_main()" when started +*/ +#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \ +{ \ + *status = PR_TRUE; \ + if (sigsetjmp(CONTEXT(_thread), 1)) { \ + _main(); \ + } \ + _MD_GET_SP(_thread) = (unsigned char*) ((_sp) - 64); \ +} + #define _MD_SWITCH_CONTEXT(_thread) \ if (!sigsetjmp(CONTEXT(_thread), 1)) { \ (_thread)->md.errcode = errno; \ diff --git a/pr/include/md/_win95.h b/pr/include/md/_win95.h index cd26bd63..4569a2a3 100644 --- a/pr/include/md/_win95.h +++ b/pr/include/md/_win95.h @@ -265,8 +265,9 @@ extern PRInt32 _MD_CloseFile(PRInt32 osfd); #define _MD_TLOCKFILE _PR_MD_TLOCKFILE #define _MD_UNLOCKFILE _PR_MD_UNLOCKFILE -#ifdef MOZ_UNICODE /* --- UTF16 IO stuff --- */ +extern PRBool _pr_useUnicode; +#ifdef MOZ_UNICODE #define _MD_OPEN_FILE_UTF16 _PR_MD_OPEN_FILE_UTF16 #define _MD_OPEN_DIR_UTF16 _PR_MD_OPEN_DIR_UTF16 #define _MD_READ_DIR_UTF16 _PR_MD_READ_DIR_UTF16 @@ -275,6 +276,8 @@ extern PRInt32 _MD_CloseFile(PRInt32 osfd); #endif /* MOZ_UNICODE */ /* --- Socket IO stuff --- */ +extern void _PR_MD_InitSockets(void); +extern void _PR_MD_CleanupSockets(void); #define _MD_EACCES WSAEACCES #define _MD_EADDRINUSE WSAEADDRINUSE #define _MD_EADDRNOTAVAIL WSAEADDRNOTAVAIL diff --git a/pr/include/obsolete/probslet.h b/pr/include/obsolete/probslet.h index 374e696c..fffd1ed8 100644 --- a/pr/include/obsolete/probslet.h +++ b/pr/include/obsolete/probslet.h @@ -158,6 +158,15 @@ NSPR_API(void) PR_FD_NSET(PRInt32 osfd, PR_fd_set *set); NSPR_API(void) PR_FD_NCLR(PRInt32 osfd, PR_fd_set *set); NSPR_API(PRInt32) PR_FD_NISSET(PRInt32 osfd, PR_fd_set *set); +/* +** The next two entry points should not be in the API, but they are +** declared here for historical reasons. +*/ + +NSPR_API(PRInt32) PR_GetSysfdTableMax(void); + +NSPR_API(PRInt32) PR_SetSysfdTableSize(PRIntn table_size); + #ifndef NO_NSPR_10_SUPPORT #ifdef XP_MAC #include diff --git a/pr/include/obsolete/protypes.h b/pr/include/obsolete/protypes.h index c2a3c9b3..4405bfce 100644 --- a/pr/include/obsolete/protypes.h +++ b/pr/include/obsolete/protypes.h @@ -152,14 +152,12 @@ typedef PRInt64 int64; #if !defined(XP_BEOS) && !defined(VMS) \ && !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) && !defined(NTO) typedef PRInt32 int32; #else typedef long int32; #endif #endif -#endif /* * int16 diff --git a/pr/include/prinet.h b/pr/include/prinet.h index 2c733b0b..02dfef6f 100644 --- a/pr/include/prinet.h +++ b/pr/include/prinet.h @@ -60,10 +60,6 @@ #define prinet_h__ #if defined(XP_UNIX) || defined(XP_OS2) || defined(XP_BEOS) -#ifdef LINUX -#undef __STRICT_ANSI__ -#define __STRICT_ANSI__ -#endif #include #include /* AF_INET */ #include /* INADDR_ANY, ..., ntohl(), ... */ diff --git a/pr/include/prinit.h b/pr/include/prinit.h index e7ca7bce..8ccce840 100644 --- a/pr/include/prinit.h +++ b/pr/include/prinit.h @@ -63,11 +63,11 @@ PR_BEGIN_EXTERN_C ** The format of the version string is ** ".[.] []" */ -#define PR_VERSION "4.6.1 Beta" +#define PR_VERSION "4.6.7" #define PR_VMAJOR 4 #define PR_VMINOR 6 -#define PR_VPATCH 1 -#define PR_BETA PR_TRUE +#define PR_VPATCH 7 +#define PR_BETA PR_FALSE /* ** PRVersionCheck diff --git a/pr/include/private/primpl.h b/pr/include/private/primpl.h index eebcb841..1388f94f 100644 --- a/pr/include/private/primpl.h +++ b/pr/include/private/primpl.h @@ -1780,12 +1780,14 @@ extern void _PR_InitLinker(void); extern void _PR_InitAtomic(void); extern void _PR_InitCPUs(void); extern void _PR_InitDtoa(void); +extern void _PR_InitTime(void); extern void _PR_InitMW(void); extern void _PR_InitRWLocks(void); extern void _PR_NotifyCondVar(PRCondVar *cvar, PRThread *me); extern void _PR_CleanupThread(PRThread *thread); extern void _PR_CleanupCallOnce(void); extern void _PR_CleanupMW(void); +extern void _PR_CleanupTime(void); extern void _PR_CleanupDtoa(void); extern void _PR_ShutdownLinker(void); extern void _PR_CleanupEnv(void); diff --git a/pr/include/prlink.h b/pr/include/prlink.h index b2eb5141..f0cea829 100644 --- a/pr/include/prlink.h +++ b/pr/include/prlink.h @@ -118,15 +118,16 @@ NSPR_API(PRLibrary*) PR_LoadLibrary(const char *name); ** in a library, if code fragments are supported by the OS. ** A code fragment can be specified by name or by an integer index. ** -** Right now PRLibSpec supports three types of library specification: -** a pathname, a Mac code fragment by name, and a Mac code fragment -** by index. +** Right now PRLibSpec supports four types of library specification: +** a pathname in the native character encoding, a Mac code fragment +** by name, a Mac code fragment by index, and a UTF-16 pathname. */ typedef enum PRLibSpecType { PR_LibSpec_Pathname, PR_LibSpec_MacNamedFragment, /* obsolete (for Mac OS Classic) */ - PR_LibSpec_MacIndexedFragment /* obsolete (for Mac OS Classic) */ + PR_LibSpec_MacIndexedFragment, /* obsolete (for Mac OS Classic) */ + PR_LibSpec_PathnameU /* supported only on Win32 */ } PRLibSpecType; struct FSSpec; /* Mac OS FSSpec */ @@ -148,6 +149,9 @@ typedef struct PRLibSpec { const struct FSSpec *fsspec; PRUint32 index; } mac_indexed_fragment; /* obsolete (for Mac OS Classic) */ + + /* if type is PR_LibSpec_PathnameU */ + const PRUnichar *pathname_u; /* supported only on Win32 */ } value; } PRLibSpec; @@ -161,6 +165,7 @@ typedef struct PRLibSpec { #define PR_LD_NOW 0x2 /* equivalent to RTLD_NOW on Unix */ #define PR_LD_GLOBAL 0x4 /* equivalent to RTLD_GLOBAL on Unix */ #define PR_LD_LOCAL 0x8 /* equivalent to RTLD_LOCAL on Unix */ +/* 0x8000 reserved for NSPR internal use */ /* ** Load the specified library, in the manner specified by 'flags'. diff --git a/pr/include/prsystem.h b/pr/include/prsystem.h index b0dfcf9e..13cf8bab 100644 --- a/pr/include/prsystem.h +++ b/pr/include/prsystem.h @@ -70,10 +70,13 @@ NSPR_API(char) PR_GetPathSeparator(void); /* Types of information available via PR_GetSystemInfo(...) */ typedef enum { - PR_SI_HOSTNAME, + PR_SI_HOSTNAME, /* the hostname with the domain name (if any) + * removed */ PR_SI_SYSNAME, PR_SI_RELEASE, - PR_SI_ARCHITECTURE + PR_SI_ARCHITECTURE, + PR_SI_HOSTNAME_UNTRUNCATED /* the hostname exactly as configured + * on the system */ } PRSysInfo; diff --git a/pr/include/prtypes.h b/pr/include/prtypes.h index 3eb15548..09fe032a 100644 --- a/pr/include/prtypes.h +++ b/pr/include/prtypes.h @@ -178,7 +178,9 @@ #else /* Unix */ -#ifdef HAVE_VISIBILITY_PRAGMA +/* GCC 3.3 and later support the visibility attribute. */ +#if (__GNUC__ >= 4) || \ + (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) #define PR_VISIBILITY_DEFAULT __attribute__((visibility("default"))) #else #define PR_VISIBILITY_DEFAULT @@ -468,10 +470,6 @@ typedef PRUint8 PRPackedBool; */ typedef enum { PR_FAILURE = -1, PR_SUCCESS = 0 } PRStatus; -#ifdef MOZ_UNICODE -/* - * EXPERIMENTAL: This type may be removed in a future release. - */ #ifndef __PRUNICHAR__ #define __PRUNICHAR__ #if defined(WIN32) || defined(XP_MAC) @@ -480,7 +478,6 @@ typedef wchar_t PRUnichar; typedef PRUint16 PRUnichar; #endif #endif -#endif /* MOZ_UNICODE */ /* ** WARNING: The undocumented data types PRWord and PRUword are diff --git a/pr/src/Makefile.in b/pr/src/Makefile.in index cf2f5229..2d785bdc 100644 --- a/pr/src/Makefile.in +++ b/pr/src/Makefile.in @@ -198,9 +198,9 @@ endif ifeq ($(OS_ARCH),WINNT) ifdef NS_USE_GCC -OS_LIBS = -ladvapi32 -lwsock32 +OS_LIBS = -ladvapi32 -lwsock32 -lwinmm else -OS_LIBS = advapi32.lib wsock32.lib +OS_LIBS = advapi32.lib wsock32.lib winmm.lib endif endif @@ -316,11 +316,6 @@ OBJS += memory/$(OBJDIR)/prgcleak.$(OBJ_SUFFIX) endif ifeq ($(OS_ARCH), WINNT) -ifdef NS_USE_GCC -DLLBASE=-Wl,--image-base -Wl,0x30000000 -else -DLLBASE=-BASE:0x30000000 -endif # GCC RES=$(OBJDIR)/nspr.res RESNAME=nspr.rc endif # WINNT diff --git a/pr/src/io/prfdcach.c b/pr/src/io/prfdcach.c index aea19dff..d1277fcd 100644 --- a/pr/src/io/prfdcach.c +++ b/pr/src/io/prfdcach.c @@ -277,6 +277,14 @@ void _PR_InitFdCache(void) if (NULL != low) _pr_fd_cache.limit_low = atoi(low); if (NULL != high) _pr_fd_cache.limit_high = atoi(high); + if (_pr_fd_cache.limit_low < 0) + _pr_fd_cache.limit_low = 0; + if (_pr_fd_cache.limit_low > FD_SETSIZE) + _pr_fd_cache.limit_low = FD_SETSIZE; + + if (_pr_fd_cache.limit_high > FD_SETSIZE) + _pr_fd_cache.limit_high = FD_SETSIZE; + if (_pr_fd_cache.limit_high < _pr_fd_cache.limit_low) _pr_fd_cache.limit_high = _pr_fd_cache.limit_low; diff --git a/pr/src/io/prfile.c b/pr/src/io/prfile.c index d91bffa2..d5610bf2 100644 --- a/pr/src/io/prfile.c +++ b/pr/src/io/prfile.c @@ -99,10 +99,9 @@ static PRInt32 PR_CALLBACK FileWrite(PRFileDesc *fd, const void *buf, PRInt32 am count = 0; #if !defined(_PR_HAVE_O_APPEND) /* Bugzilla: 4090, 276330 */ - if ( PR_TRUE == fd->secret->appendMode ) { - rv = PR_Seek(fd, 0, PR_SEEK_END ); - if ( -1 == rv ) { - return rv; + if (fd->secret->appendMode) { + if (PR_Seek64(fd, 0, PR_SEEK_END) == -1) { + return -1; } } /* if (fd->secret->appendMode...) */ #endif /* _PR_HAVE_O_APPEND */ @@ -412,7 +411,7 @@ PR_IMPLEMENT(PRFileDesc*) PR_OpenFile( return fd; } -PRInt32 PR_GetSysfdTableMax(void) +PR_IMPLEMENT(PRInt32) PR_GetSysfdTableMax(void) { #if defined(XP_UNIX) && !defined(AIX) && !defined(NEXTSTEP) && !defined(QNX) struct rlimit rlim; @@ -445,7 +444,7 @@ PRInt32 PR_GetSysfdTableMax(void) #endif } -PRInt32 PR_SetSysfdTableSize(int table_size) +PR_IMPLEMENT(PRInt32) PR_SetSysfdTableSize(int table_size) { #if defined(XP_UNIX) && !defined(AIX) && !defined(NEXTSTEP) && !defined(QNX) struct rlimit rlim; diff --git a/pr/src/io/prlog.c b/pr/src/io/prlog.c index ab348d4f..d6c6e6c5 100644 --- a/pr/src/io/prlog.c +++ b/pr/src/io/prlog.c @@ -255,6 +255,12 @@ void _PR_InitLog(void) } PR_SetLogBuffering(isSync ? bufSize : 0); +#ifdef XP_UNIX + if ((getuid() != geteuid()) || (getgid() != getegid())) { + return; + } +#endif /* XP_UNIX */ + ev = PR_GetEnv("NSPR_LOG_FILE"); if (ev && ev[0]) { if (!PR_SetLogFile(ev)) { @@ -293,10 +299,12 @@ void _PR_LogCleanup(void) #endif ) { fclose(logFile); + logFile = NULL; } #else if (logFile && logFile != _pr_stdout && logFile != _pr_stderr) { PR_Close(logFile); + logFile = NULL; } #endif diff --git a/pr/src/io/prprf.c b/pr/src/io/prprf.c index cd5760a9..fa444e2c 100644 --- a/pr/src/io/prprf.c +++ b/pr/src/io/prprf.c @@ -373,7 +373,7 @@ static int cvt_f(SprintfState *ss, double d, const char *fmt0, const char *fmt1) ** width. "prec" is the maximum number of characters of "s" to output, ** where -1 means until NUL. */ -static int cvt_s(SprintfState *ss, const char *s, int width, int prec, +static int cvt_s(SprintfState *ss, const char *str, int width, int prec, int flags) { int slen; @@ -382,15 +382,22 @@ static int cvt_s(SprintfState *ss, const char *s, int width, int prec, return 0; /* Limit string length by precision value */ - slen = s ? strlen(s) : 6; + if (!str) { + str = "(null)"; + } if (prec > 0) { - if (prec < slen) { - slen = prec; - } + /* this is: slen = strnlen(str, prec); */ + register const char *s; + + for(s = str; prec && *s; s++, prec-- ) + ; + slen = s - str; + } else { + slen = strlen(str); } /* and away we go */ - return fill2(ss, s ? s : "(null)", slen, width, flags); + return fill2(ss, str, slen, width, flags); } /* diff --git a/pr/src/linking/Makefile.in b/pr/src/linking/Makefile.in index 71fbf571..9b82aca2 100644 --- a/pr/src/linking/Makefile.in +++ b/pr/src/linking/Makefile.in @@ -62,14 +62,9 @@ TARGETS = $(OBJS) INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private -# For Dl_info and dladdr. -ifeq ($(OS_TARGET),Linux) -DEFINES += -D_GNU_SOURCE -endif - # On Mac OS X use flat #includes. ifeq ($(OS_TARGET),MacOSX) -INCLUDES += -I$(NEXT_ROOT)/Developer/Headers/FlatCarbon +INCLUDES += -I$(MACOS_SDK_DIR)/Developer/Headers/FlatCarbon endif DEFINES += -D_NSPR_BUILD_ diff --git a/pr/src/linking/prlink.c b/pr/src/linking/prlink.c index 55831bf7..5f83f257 100644 --- a/pr/src/linking/prlink.c +++ b/pr/src/linking/prlink.c @@ -1,36 +1,40 @@ /* -*- 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. - * +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * 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): Steve Streeter (Hewlett-Packard Company) - * - * 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. - */ + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998-2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Steve Streeter (Hewlett-Packard Company) + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ #include "primpl.h" @@ -157,6 +161,8 @@ struct _imcb *IAC$GL_IMAGE_LIST = NULL; #define NEED_LEADING_UNDERSCORE #endif +#define PR_LD_PATHW 0x8000 /* for PR_LibSpec_PathnameU */ + /************************************************************************/ struct PRLibrary { @@ -204,6 +210,16 @@ static char* _pr_currentLibPath = NULL; static PRLibrary *pr_LoadLibraryByPathname(const char *name, PRIntn flags); +#ifdef WIN95 +typedef HMODULE (WINAPI *LoadLibraryWFn)(LPCWSTR); +static HMODULE WINAPI EmulateLoadLibraryW(LPCWSTR); +static LoadLibraryWFn loadLibraryW = LoadLibraryW; +#endif + +#ifdef WIN32 +static int pr_ConvertUTF16toUTF8(LPCWSTR wname, LPSTR name, int len); +#endif + /************************************************************************/ #if !defined(USE_DLFCN) && !defined(HAVE_STRERROR) @@ -244,6 +260,12 @@ void _PR_InitLinker(void) void *h; #endif +#ifdef WIN95 + if (!_pr_useUnicode) { + loadLibraryW = EmulateLoadLibraryW; + } +#endif + if (!pr_linker_lock) { pr_linker_lock = PR_NewNamedMonitor("linker-lock"); } @@ -556,6 +578,16 @@ PR_LoadLibraryWithFlags(PRLibSpec libSpec, PRIntn flags) switch (libSpec.type) { case PR_LibSpec_Pathname: return pr_LoadLibraryByPathname(libSpec.value.pathname, flags); +#ifdef WIN32 + case PR_LibSpec_PathnameU: + /* + * cast to |char *| and set PR_LD_PATHW flag so that + * it can be cast back to PRUnichar* in the callee. + */ + return pr_LoadLibraryByPathname((const char*) + libSpec.value.pathname_u, + flags | PR_LD_PATHW); +#endif default: PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0); return NULL; @@ -744,6 +776,25 @@ pr_LoadViaDyld(const char *name, PRLibrary *lm) #endif /* XP_MACOSX */ +#ifdef WIN95 +static HMODULE WINAPI +EmulateLoadLibraryW(LPCWSTR lpLibFileName) +{ + HMODULE h; + char nameA[MAX_PATH]; + + if (!WideCharToMultiByte(CP_ACP, 0, lpLibFileName, -1, + nameA, sizeof nameA, NULL, NULL)) { + return NULL; + } + /* Perhaps it's better to add a check for characters + * not representable in CP_ACP. + */ + h = LoadLibraryA(nameA); + return h; +} +#endif /* WIN95 */ + /* ** Dynamically load a library. Only load libraries once, so scan the load ** map first. @@ -752,15 +803,52 @@ static PRLibrary* pr_LoadLibraryByPathname(const char *name, PRIntn flags) { PRLibrary *lm; - PRLibrary* result; + PRLibrary* result = NULL; PRInt32 oserr; +#ifdef WIN32 + char utf8name_stack[MAX_PATH]; + char *utf8name_malloc = NULL; + char *utf8name = utf8name_stack; + PRUnichar wname_stack[MAX_PATH]; + PRUnichar *wname_malloc = NULL; + PRUnichar *wname = wname_stack; + int len; +#endif if (!_pr_initialized) _PR_ImplicitInitialization(); /* See if library is already loaded */ PR_EnterMonitor(pr_linker_lock); +#ifdef WIN32 + if (flags & PR_LD_PATHW) { + /* cast back what's cast to |char *| for the argument passing. */ + wname = (LPWSTR) name; + } else { + int wlen = MultiByteToWideChar(CP_ACP, 0, name, -1, NULL, 0); + if (wlen > MAX_PATH) + wname = wname_malloc = PR_Malloc(wlen * sizeof(PRUnichar)); + if (wname == NULL || + !MultiByteToWideChar(CP_ACP, 0, name, -1, wname, wlen)) { + oserr = _MD_ERRNO(); + goto unlock; + } + } + len = pr_ConvertUTF16toUTF8(wname, NULL, 0); + if (len > MAX_PATH) + utf8name = utf8name_malloc = PR_Malloc(len); + if (utf8name == NULL || + !pr_ConvertUTF16toUTF8(wname, utf8name, len)) { + oserr = _MD_ERRNO(); + goto unlock; + } + /* the list of loaded library names are always kept in UTF-8 + * on Win32 platforms */ + result = pr_UnlockedFindLibrary(utf8name); +#else result = pr_UnlockedFindLibrary(name); +#endif + if (result != NULL) goto unlock; lm = PR_NEWZAP(PRLibrary); @@ -793,13 +881,31 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags) { HINSTANCE h; +#ifdef WIN32 +#ifdef WIN95 + if (flags & PR_LD_PATHW) + h = loadLibraryW(wname); + else + h = LoadLibraryA(name); +#else + if (flags & PR_LD_PATHW) + h = LoadLibraryW(wname); + else + h = LoadLibraryA(name); +#endif /* WIN95 */ +#else h = LoadLibrary(name); +#endif if (h < (HINSTANCE)HINSTANCE_ERROR) { oserr = _MD_ERRNO(); PR_DELETE(lm); goto unlock; } +#ifdef WIN32 + lm->name = strdup(utf8name); +#else lm->name = strdup(name); +#endif lm->dlh = h; lm->next = pr_loadmap; pr_loadmap = lm; @@ -996,10 +1102,135 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags) PR_SetError(PR_LOAD_LIBRARY_ERROR, oserr); DLLErrorInternal(oserr); /* sets error text */ } +#ifdef WIN32 + if (utf8name_malloc) + PR_Free(utf8name_malloc); + if (wname_malloc) + PR_Free(wname_malloc); +#endif PR_ExitMonitor(pr_linker_lock); return result; } +#ifdef WIN32 +#ifdef WIN95 +/* + * CP_UTF8 is not supported by WideCharToMultiByte on Windows 95 so that + * we have to emulate it + */ +static PRStatus +pr_ConvertSingleCharToUTF8(PRUint32 usv, PRUint16 offset, int bufLen, + int *utf8Len, char * *buf) +{ + char* p = *buf; + PR_ASSERT(!bufLen || *buf); + if (!bufLen) { + *utf8Len += offset; + return PR_SUCCESS; + } + + if (*utf8Len + offset >= bufLen) + return PR_FAILURE; + + *utf8Len += offset; + if (offset == 1) { + *p++ = (char) usv; + } else if (offset == 2) { + *p++ = (char)0xc0 | (usv >> 6); + *p++ = (char)0x80 | (usv & 0x003f); + } else if (offset == 3) { + *p++ = (char)0xe0 | (usv >> 12); + *p++ = (char)0x80 | ((usv >> 6) & 0x003f); + *p++ = (char)0x80 | (usv & 0x003f); + } else { /* offset = 4 */ + *p++ = (char)0xf0 | (usv >> 18); + *p++ = (char)0x80 | ((usv >> 12) & 0x003f); + *p++ = (char)0x80 | ((usv >> 6) & 0x003f); + *p++ = (char)0x80 | (usv & 0x003f); + } + + *buf = p; + return PR_SUCCESS; +} + +static int pr_ConvertUTF16toUTF8(LPCWSTR wname, LPSTR name, int len) +{ + LPCWSTR pw = wname; + LPSTR p = name; + int utf8Len = 0; + PRBool highSurrogate = PR_FALSE; + + utf8Len = WideCharToMultiByte(CP_UTF8, 0, wname, -1, name, len, + NULL, NULL); + /* + * Windows 95 and NT 3.51 don't support CP_UTF8. + * WideCharToMultiByte(CP_UTF8, ...) fails with the error code + * ERROR_INVALID_PARAMETER on Windows 95 and NT 3.51. + */ + if (utf8Len || GetLastError() != ERROR_INVALID_PARAMETER) + return utf8Len; + + if (!wname || len < 0 || (len > 0 && !name)) { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + while (*pw) { + PRStatus status = PR_SUCCESS; + if (highSurrogate) { + if (*pw >= (PRUnichar) 0xDC00 && *pw < (PRUnichar) 0xE000) { + /* found a matching low surrogate */ + /* convert a surrogate pair to UCS4 */ + PRUint32 usv = ((*(pw-1) - (PRUnichar)0xD800) << 10) + + (*pw - (PRUnichar)0xDC00) + (PRUint32)0x10000; + if (pr_ConvertSingleCharToUTF8(usv, 4, len, &utf8Len, &p) == + PR_FAILURE) + return 0; + highSurrogate = PR_FALSE; + ++pw; + continue; + } else { + /* + * silently ignore a lone high surrogate + * as is done by WideCharToMultiByte by default + */ + highSurrogate = PR_FALSE; + } + } + if (*pw <= 0x7f) + status = pr_ConvertSingleCharToUTF8(*pw, 1, len, &utf8Len, &p); + else if (*pw <= 0x07ff) + status = pr_ConvertSingleCharToUTF8(*pw, 2, len, &utf8Len, &p); + else if (*pw < (PRUnichar) 0xD800 || *pw >= (PRUnichar) 0xE000) + status = pr_ConvertSingleCharToUTF8(*pw, 3, len, &utf8Len, &p); + else if (*pw < (PRUnichar) 0xDC00) + highSurrogate = PR_TRUE; + /* else */ + /* silently ignore a lone low surrogate as is done by + * WideCharToMultiByte by default */ + + if (status == PR_FAILURE) { + SetLastError(ERROR_INSUFFICIENT_BUFFER); + return 0; + } + ++pw; + } + + /* if we're concerned with a lone high surrogate, + * we have to take care of it here, but we just drop it + */ + if (len > 0) + *p = '\0'; + return utf8Len + 1; +} +#else +static int pr_ConvertUTF16toUTF8(LPCWSTR wname, LPSTR name, int len) +{ + return WideCharToMultiByte(CP_UTF8, 0, wname, -1, name, len, NULL, NULL); +} +#endif /* WIN95 */ +#endif /* WIN32 */ + /* ** Unload a shared library which was loaded via PR_LoadLibrary */ @@ -1036,7 +1267,8 @@ PR_UnloadLibrary(PRLibrary *lib) #elif defined(USE_HPSHL) result = shl_unload(lib->dlh); #elif defined(USE_MACH_DYLD) - result = NSUnLinkModule(lib->dlh, NSUNLINKMODULE_OPTION_NONE) ? 0 : -1; + if (lib->dlh) + result = NSUnLinkModule(lib->dlh, NSUNLINKMODULE_OPTION_NONE) ? 0 : -1; #else #error Configuration error #endif diff --git a/pr/src/md/beos/bfile.c b/pr/src/md/beos/bfile.c index 103fb8ef..4ab02d06 100644 --- a/pr/src/md/beos/bfile.c +++ b/pr/src/md/beos/bfile.c @@ -1,36 +1,39 @@ /* -*- Mode: C++; tab-width: 8; c-basic-offset: 8 -*- */ -/* - * 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. - * +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * 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. - * + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998-2000 + * the Initial Developer. All Rights Reserved. + * * Contributor(s): - * - * 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. - */ + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ #include "primpl.h" diff --git a/pr/src/md/beos/brng.c b/pr/src/md/beos/brng.c index 0aba8da3..f1bed4f3 100644 --- a/pr/src/md/beos/brng.c +++ b/pr/src/md/beos/brng.c @@ -1,36 +1,39 @@ /* -*- 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. - * +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * 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) 1999-2000 Netscape Communications Corporation. All - * Rights Reserved. - * + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1999-2000 + * the Initial Developer. All Rights Reserved. + * * Contributor(s): - * - * 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. - */ + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ #include diff --git a/pr/src/md/unix/os_Darwin_x86.s b/pr/src/md/unix/os_Darwin_x86.s new file mode 100644 index 00000000..d0042613 --- /dev/null +++ b/pr/src/md/unix/os_Darwin_x86.s @@ -0,0 +1,105 @@ +# -*- 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) 2003 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): +# Josh Aas +# +# 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. +# + +# +# Based on os_Linux_x86.s +# + +# +# PRInt32 __PR_Darwin_x86_AtomicIncrement(PRInt32 *val); +# +# Atomically increment the integer pointed to by 'val' and return +# the result of the increment. +# + .text + .globl __PR_Darwin_x86_AtomicIncrement + .align 4 +__PR_Darwin_x86_AtomicIncrement: + movl 4(%esp), %ecx + movl $1, %eax + lock + xaddl %eax, (%ecx) + incl %eax + ret + +# +# PRInt32 __PR_Darwin_x86_AtomicDecrement(PRInt32 *val); +# +# Atomically decrement the integer pointed to by 'val' and return +# the result of the decrement. +# + .text + .globl __PR_Darwin_x86_AtomicDecrement + .align 4 +__PR_Darwin_x86_AtomicDecrement: + movl 4(%esp), %ecx + movl $-1, %eax + lock + xaddl %eax, (%ecx) + decl %eax + ret + +# +# PRInt32 __PR_Darwin_x86_AtomicSet(PRInt32 *val, PRInt32 newval); +# +# Atomically set the integer pointed to by 'val' to the new +# value 'newval' and return the old value. +# + .text + .globl __PR_Darwin_x86_AtomicSet + .align 4 +__PR_Darwin_x86_AtomicSet: + movl 4(%esp), %ecx + movl 8(%esp), %eax + xchgl %eax, (%ecx) + ret + +# +# PRInt32 __PR_Darwin_x86_AtomicAdd(PRInt32 *ptr, PRInt32 val); +# +# Atomically add 'val' to the integer pointed to by 'ptr' +# and return the result of the addition. +# + .text + .globl __PR_Darwin_x86_AtomicAdd + .align 4 +__PR_Darwin_x86_AtomicAdd: + movl 4(%esp), %ecx + movl 8(%esp), %eax + movl %eax, %edx + lock + xaddl %eax, (%ecx) + addl %edx, %eax + ret diff --git a/pr/src/md/unix/os_HPUX_ia64.s b/pr/src/md/unix/os_HPUX_ia64.s new file mode 100644 index 00000000..d433f4fe --- /dev/null +++ b/pr/src/md/unix/os_HPUX_ia64.s @@ -0,0 +1,108 @@ +// -*- 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) 2000 Netscape Communications Corporation. All +// Rights Reserved. +// +// Contributor(s): +// +// 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. +// + +.text + +// PRInt32 _PR_ia64_AtomicIncrement(PRInt32 *val) +// +// Atomically increment the integer pointed to by 'val' and return +// the result of the increment. +// + .align 16 + .global _PR_ia64_AtomicIncrement# + .proc _PR_ia64_AtomicIncrement# +_PR_ia64_AtomicIncrement: +#ifndef _LP64 + addp4 r32 = 0, r32 ;; +#endif + fetchadd4.acq r8 = [r32], 1 ;; + adds r8 = 1, r8 + br.ret.sptk.many b0 + .endp _PR_ia64_AtomicIncrement# + +// PRInt32 _PR_ia64_AtomicDecrement(PRInt32 *val) +// +// Atomically decrement the integer pointed to by 'val' and return +// the result of the decrement. +// + .align 16 + .global _PR_ia64_AtomicDecrement# + .proc _PR_ia64_AtomicDecrement# +_PR_ia64_AtomicDecrement: +#ifndef _LP64 + addp4 r32 = 0, r32 ;; +#endif + fetchadd4.rel r8 = [r32], -1 ;; + adds r8 = -1, r8 + br.ret.sptk.many b0 + .endp _PR_ia64_AtomicDecrement# + +// PRInt32 _PR_ia64_AtomicAdd(PRInt32 *ptr, PRInt32 val) +// +// Atomically add 'val' to the integer pointed to by 'ptr' +// and return the result of the addition. +// + .align 16 + .global _PR_ia64_AtomicAdd# + .proc _PR_ia64_AtomicAdd# +_PR_ia64_AtomicAdd: +#ifndef _LP64 + addp4 r32 = 0, r32 ;; +#endif + ld4 r15 = [r32] ;; +.L3: + mov r14 = r15 + mov ar.ccv = r15 + add r8 = r15, r33 ;; + cmpxchg4.acq r15 = [r32], r8, ar.ccv ;; + cmp4.ne p6, p7 = r15, r14 + (p6) br.cond.dptk .L3 + br.ret.sptk.many b0 + .endp _PR_ia64_AtomicAdd# + +// PRInt32 _PR_ia64_AtomicSet(PRInt32 *val, PRInt32 newval) +// +// Atomically set the integer pointed to by 'val' to the new +// value 'newval' and return the old value. +// + .align 16 + .global _PR_ia64_AtomicSet# + .proc _PR_ia64_AtomicSet# +_PR_ia64_AtomicSet: +#ifndef _LP64 + addp4 r32 = 0, r32 ;; +#endif + xchg4 r8 = [r32], r33 + br.ret.sptk.many b0 + .endp _PR_ia64_AtomicSet# diff --git a/pr/src/md/unix/unix.c b/pr/src/md/unix/unix.c index 0776bf1a..c41a275f 100644 --- a/pr/src/md/unix/unix.c +++ b/pr/src/md/unix/unix.c @@ -1,36 +1,39 @@ /* -*- 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. - * +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * 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. - * + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998-2000 + * the Initial Developer. All Rights Reserved. + * * Contributor(s): - * - * 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. - */ + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ #include "primpl.h" diff --git a/pr/src/md/windows/ntinrval.c b/pr/src/md/windows/ntinrval.c index 494f6e83..b8d85831 100644 --- a/pr/src/md/windows/ntinrval.c +++ b/pr/src/md/windows/ntinrval.c @@ -42,83 +42,19 @@ #include "primpl.h" -#if defined(WIN16) -#include -#define QueryPerformanceFrequency(x) FALSE -#define QueryPerformanceCounter(x) FALSE -#endif - -static PRIntn _nt_bitShift = 0; -static PRInt32 _nt_ticksPerSec = -1; - void _PR_MD_INTERVAL_INIT() { - LARGE_INTEGER count; - - if (QueryPerformanceFrequency(&count)) { - /* - * HighPart is signed (LONG). Assert that its sign bit is 0 - * because we will be right shifting it. LowPart is unsigned - * (DWORD). - */ - PR_ASSERT(count.HighPart >= 0); - while(count.HighPart) { - count.LowPart = (count.HighPart << 31) + (count.LowPart >> 1); - count.HighPart >>= 1; - _nt_bitShift++; - } - while(count.LowPart > PR_INTERVAL_MAX) { - count.LowPart >>= 1; - _nt_bitShift++; - } - - /* - * We can't use the performance counter if after - * normalization we are left with fewer than 32 bits. - */ - if (_nt_bitShift <= 32) { - _nt_ticksPerSec = count.LowPart; - PR_ASSERT(_nt_ticksPerSec > PR_INTERVAL_MIN); - return; - } - } - _nt_ticksPerSec = -1; } PRIntervalTime _PR_MD_GET_INTERVAL() { - LARGE_INTEGER count; - - /* Sadly; nspr requires the interval to range from 1000 ticks per second - * to only 100000 ticks per second; QueryPerformanceCounter is too high - * resolution... - */ - if (_nt_ticksPerSec != -1) { - (void)QueryPerformanceCounter(&count); - PR_ASSERT(_nt_bitShift <= 32); - if (_nt_bitShift == 32) { - return (PRUint32)count.HighPart; - } else { - return (PRUint32)((count.HighPart << (32 - _nt_bitShift)) - + (count.LowPart >> _nt_bitShift)); - } - } else -#if defined(__MINGW32__) - return time(); -#elif defined(WIN16) - return clock(); /* milliseconds since application start */ -#else - return GetTickCount(); /* milliseconds since system start */ -#endif + return timeGetTime(); /* milliseconds since system start */ } PRIntervalTime _PR_MD_INTERVAL_PER_SEC() { - if (_nt_ticksPerSec != -1) - return _nt_ticksPerSec; - else - return 1000; + return 1000; } diff --git a/pr/src/md/windows/ntio.c b/pr/src/md/windows/ntio.c index defaae4d..6c7ae3b0 100644 --- a/pr/src/md/windows/ntio.c +++ b/pr/src/md/windows/ntio.c @@ -20,6 +20,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): + * Masayuki Nakano * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or @@ -108,6 +109,8 @@ static const PRTime _pr_filetime_offset = 116444736000000000LL; static const PRTime _pr_filetime_offset = 116444736000000000i64; #endif +static PRBool IsPrevCharSlash(const char *str, const char *current); + #define _NEED_351_FILE_LOCKING_HACK #ifdef _NEED_351_FILE_LOCKING_HACK #define _PR_LOCAL_FILE 1 @@ -2769,7 +2772,7 @@ _PR_MD_OPEN_DIR(_MDDir *d, const char *name) * If 'name' ends in a slash or backslash, do not append * another backslash. */ - if (filename[len - 1] == '/' || filename[len - 1] == '\\') { + if (IsPrevCharSlash(filename, filename + len)) { len--; } strcpy(&filename[len], "\\*.*"); @@ -2907,7 +2910,7 @@ _PR_MD_STAT(const char *fn, struct stat *info) int len = strlen(fn); if (len > 0 && len <= _MAX_PATH - && (fn[len - 1] == '\\' || fn[len - 1] == '/')) { + && IsPrevCharSlash(fn, fn + len)) { char newfn[_MAX_PATH + 1]; strcpy(newfn, fn); @@ -2924,6 +2927,17 @@ _PR_MD_STAT(const char *fn, struct stat *info) #define _PR_IS_SLASH(ch) ((ch) == '/' || (ch) == '\\') +static PRBool +IsPrevCharSlash(const char *str, const char *current) +{ + const char *prev; + + if (str >= current) + return PR_FALSE; + prev = _mbsdec(str, current); + return (prev == current - 1) && _PR_IS_SLASH(*prev); +} + /* * IsRootDirectory -- * @@ -2970,7 +2984,7 @@ IsRootDirectory(char *fn, size_t buflen) /* look for the next slash */ do { - p++; + p = _mbsinc(p); } while (*p != '\0' && !_PR_IS_SLASH(*p)); if (*p == '\0') { return PR_FALSE; @@ -2984,7 +2998,7 @@ IsRootDirectory(char *fn, size_t buflen) /* look for the final slash */ do { - p++; + p = _mbsinc(p); } while (*p != '\0' && !_PR_IS_SLASH(*p)); if (_PR_IS_SLASH(*p) && p[1] != '\0') { return PR_FALSE; @@ -3074,7 +3088,7 @@ _PR_MD_GETFILEINFO64(const char *fn, PRFileInfo64 *info) info->creationTime = 0; return 0; } - if (!_PR_IS_SLASH(pathbuf[len - 1])) { + if (!IsPrevCharSlash(pathbuf, pathbuf + len)) { _PR_MD_MAP_OPENDIR_ERROR(GetLastError()); return -1; } else { diff --git a/pr/src/md/windows/w95io.c b/pr/src/md/windows/w95io.c index 5d483cea..f418fce7 100644 --- a/pr/src/md/windows/w95io.c +++ b/pr/src/md/windows/w95io.c @@ -20,6 +20,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): + * Masayuki Nakano * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or @@ -80,9 +81,9 @@ static const PRTime _pr_filetime_offset = 116444736000000000LL; static const PRTime _pr_filetime_offset = 116444736000000000i64; #endif -#ifdef MOZ_UNICODE static void InitUnicodeSupport(void); -#endif + +static PRBool IsPrevCharSlash(const char *str, const char *current); void _PR_MD_INIT_IO() @@ -121,9 +122,9 @@ _PR_MD_INIT_IO() _PR_NT_InitSids(); -#ifdef MOZ_UNICODE InitUnicodeSupport(); -#endif + + _PR_MD_InitSockets(); } PRStatus @@ -516,7 +517,7 @@ _PR_MD_OPEN_DIR(_MDDir *d, const char *name) * If 'name' ends in a slash or backslash, do not append * another backslash. */ - if (filename[len - 1] == '/' || filename[len - 1] == '\\') { + if (IsPrevCharSlash(filename, filename + len)) { len--; } strcpy(&filename[len], "\\*.*"); @@ -654,7 +655,7 @@ _PR_MD_STAT(const char *fn, struct stat *info) int len = strlen(fn); if (len > 0 && len <= _MAX_PATH - && (fn[len - 1] == '\\' || fn[len - 1] == '/')) { + && IsPrevCharSlash(fn, fn + len)) { char newfn[_MAX_PATH + 1]; strcpy(newfn, fn); @@ -671,6 +672,17 @@ _PR_MD_STAT(const char *fn, struct stat *info) #define _PR_IS_SLASH(ch) ((ch) == '/' || (ch) == '\\') +static PRBool +IsPrevCharSlash(const char *str, const char *current) +{ + const char *prev; + + if (str >= current) + return PR_FALSE; + prev = _mbsdec(str, current); + return (prev == current - 1) && _PR_IS_SLASH(*prev); +} + /* * IsRootDirectory -- * @@ -717,7 +729,7 @@ IsRootDirectory(char *fn, size_t buflen) /* look for the next slash */ do { - p++; + p = _mbsinc(p); } while (*p != '\0' && !_PR_IS_SLASH(*p)); if (*p == '\0') { return PR_FALSE; @@ -731,7 +743,7 @@ IsRootDirectory(char *fn, size_t buflen) /* look for the final slash */ do { - p++; + p = _mbsinc(p); } while (*p != '\0' && !_PR_IS_SLASH(*p)); if (_PR_IS_SLASH(*p) && p[1] != '\0') { return PR_FALSE; @@ -821,7 +833,7 @@ _PR_MD_GETFILEINFO64(const char *fn, PRFileInfo64 *info) info->creationTime = 0; return 0; } - if (!_PR_IS_SLASH(pathbuf[len - 1])) { + if (!IsPrevCharSlash(pathbuf, pathbuf + len)) { _PR_MD_MAP_OPENDIR_ERROR(GetLastError()); return -1; } else { @@ -1106,38 +1118,49 @@ _PR_MD_PIPEAVAILABLE(PRFileDesc *fd) #ifdef MOZ_UNICODE typedef HANDLE (WINAPI *CreateFileWFn) (LPCWSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE); -static CreateFileWFn createFileW = NULL; +static CreateFileWFn createFileW = CreateFileW; typedef HANDLE (WINAPI *FindFirstFileWFn) (LPCWSTR, LPWIN32_FIND_DATAW); -static FindFirstFileWFn findFirstFileW = NULL; +static FindFirstFileWFn findFirstFileW = FindFirstFileW; typedef BOOL (WINAPI *FindNextFileWFn) (HANDLE, LPWIN32_FIND_DATAW); -static FindNextFileWFn findNextFileW = NULL; +static FindNextFileWFn findNextFileW = FindNextFileW; typedef DWORD (WINAPI *GetFullPathNameWFn) (LPCWSTR, DWORD, LPWSTR, LPWSTR *); -static GetFullPathNameWFn getFullPathNameW = NULL; +static GetFullPathNameWFn getFullPathNameW = GetFullPathNameW; typedef UINT (WINAPI *GetDriveTypeWFn) (LPCWSTR); -static GetDriveTypeWFn getDriveTypeW = NULL; +static GetDriveTypeWFn getDriveTypeW = GetDriveTypeW; + +#endif /* MOZ_UNICODE */ + +PRBool _pr_useUnicode = PR_FALSE; static void InitUnicodeSupport(void) { - HMODULE module; - /* - * The W functions do not exist on Win9x. NSPR won't run on Win9x - * if we call the W functions directly. Use GetProcAddress() to - * look up their addresses at run time. + * The W functions exist on Win9x as stubs that fail with the + * ERROR_CALL_NOT_IMPLEMENTED error. We plan to emulate the + * MSLU W functions on Win9x in the future. */ - module = GetModuleHandle("Kernel32.dll"); - if (!module) { - return; - } + /* Find out if we are running on a Unicode enabled version of Windows */ + OSVERSIONINFOA osvi = {0}; - createFileW = (CreateFileWFn)GetProcAddress(module, "CreateFileW"); - findFirstFileW = (FindFirstFileWFn)GetProcAddress(module, "FindFirstFileW"); - findNextFileW = (FindNextFileWFn)GetProcAddress(module, "FindNextFileW"); - getDriveTypeW = (GetDriveTypeWFn)GetProcAddress(module, "GetDriveTypeW"); - getFullPathNameW = (GetFullPathNameWFn)GetProcAddress(module, "GetFullPathNameW"); + osvi.dwOSVersionInfoSize = sizeof(osvi); + if (GetVersionExA(&osvi)) { + _pr_useUnicode = (osvi.dwPlatformId >= VER_PLATFORM_WIN32_NT); + } else { + _pr_useUnicode = PR_FALSE; + } +#ifdef DEBUG + /* + * In debug builds, allow explicit use of ANSI methods to simulate + * a Win9x environment for testing purposes. + */ + if (getenv("WINAPI_USE_ANSI")) + _pr_useUnicode = PR_FALSE; +#endif } +#ifdef MOZ_UNICODE + /* ================ UTF16 Interfaces ================================ */ void FlipSlashesW(PRUnichar *cp, int len) { @@ -1161,11 +1184,6 @@ _PR_MD_OPEN_FILE_UTF16(const PRUnichar *name, PRIntn osflags, int mode) PSECURITY_DESCRIPTOR pSD = NULL; PACL pACL = NULL; - if (!createFileW) { - PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); - return -1; - } - if (osflags & PR_CREATE_FILE) { if (_PR_NT_MakeSecurityDescriptorACL(mode, fileAccessTable, &pSD, &pACL) == PR_SUCCESS) { @@ -1221,11 +1239,6 @@ _PR_MD_OPEN_DIR_UTF16(_MDDirUTF16 *d, const PRUnichar *name) PRUnichar filename[ MAX_PATH ]; int len; - if (!findFirstFileW) { - PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); - return PR_FAILURE; - } - len = wcslen(name); /* Need 5 bytes for \*.* and the trailing null byte. */ if (len + 5 > MAX_PATH) { @@ -1261,11 +1274,6 @@ _PR_MD_READ_DIR_UTF16(_MDDirUTF16 *d, PRIntn flags) BOOL rv; PRUnichar *fileName; - if (!findNextFileW) { - PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); - return NULL; - } - if ( d ) { while (1) { if (d->firstEntry) { @@ -1411,11 +1419,6 @@ _PR_MD_GETFILEINFO64_UTF16(const PRUnichar *fn, PRFileInfo64 *info) WIN32_FIND_DATAW findFileData; PRUnichar pathbuf[MAX_PATH + 1]; - if (!findFirstFileW || !getFullPathNameW || !getDriveTypeW) { - PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); - return -1; - } - if (NULL == fn || L'\0' == *fn) { PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0); return -1; diff --git a/pr/src/md/windows/w95sock.c b/pr/src/md/windows/w95sock.c index 01c25258..1bcbaf21 100644 --- a/pr/src/md/windows/w95sock.c +++ b/pr/src/md/windows/w95sock.c @@ -53,6 +53,95 @@ static PRInt32 socket_io_wait( /* --- SOCKET IO --------------------------------------------------------- */ +/* + * we only want to call WSAIoctl() on Vista and later + * so don't pay for it at build time (and avoid including winsock2.h) + */ + +/* from ws2def.h */ +#define IOC_IN 0x80000000 /* copy in parameters */ +#define IOC_VENDOR 0x18000000 +#define _WSAIOW(x,y) (IOC_IN|(x)|(y)) +/* from MSWSockDef.h */ +#define SIO_SET_COMPATIBILITY_MODE _WSAIOW(IOC_VENDOR,300) + +typedef enum _WSA_COMPATIBILITY_BEHAVIOR_ID { + WsaBehaviorAll = 0, + WsaBehaviorReceiveBuffering, + WsaBehaviorAutoTuning +} WSA_COMPATIBILITY_BEHAVIOR_ID, *PWSA_COMPATIBILITY_BEHAVIOR_ID; + +/* from sdkddkver.h */ +#define NTDDI_LONGHORN 0x06000000 + +/* from winsock2.h */ +#define WSAEVENT HANDLE + +#define WSAOVERLAPPED OVERLAPPED +typedef struct _OVERLAPPED * LPWSAOVERLAPPED; + +typedef void (CALLBACK * LPWSAOVERLAPPED_COMPLETION_ROUTINE)( + IN DWORD dwError, + IN DWORD cbTransferred, + IN LPWSAOVERLAPPED lpOverlapped, + IN DWORD dwFlags +); + +typedef int (__stdcall * WSAIOCTLPROC) ( + SOCKET s, + DWORD dwIoControlCode, + LPVOID lpvInBuffer, + DWORD cbInBuffer, + LPVOID lpvOutBuffer, + DWORD cbOutBuffer, + LPDWORD lpcbBytesReturned, + LPWSAOVERLAPPED lpOverlapped, + LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine +); + +typedef struct _WSA_COMPATIBILITY_MODE { + WSA_COMPATIBILITY_BEHAVIOR_ID BehaviorId; + ULONG TargetOsVersion; +} WSA_COMPATIBILITY_MODE, *PWSA_COMPATIBILITY_MODE; + +static HMODULE libWinsock2 = NULL; +static WSAIOCTLPROC wsaioctlProc = NULL; +static PRBool socketSetCompatMode = PR_FALSE; + +void _PR_MD_InitSockets(void) +{ + OSVERSIONINFO osvi; + + memset(&osvi, 0, sizeof(osvi)); + osvi.dwOSVersionInfoSize = sizeof(osvi); + GetVersionEx(&osvi); + + /* if Vista or later... */ + if (osvi.dwMajorVersion >= 6) + { + libWinsock2 = LoadLibrary("Ws2_32.dll"); + if (libWinsock2) + { + wsaioctlProc = (WSAIOCTLPROC)GetProcAddress(libWinsock2, + "WSAIoctl"); + if (wsaioctlProc) + { + socketSetCompatMode = PR_TRUE; + } + } + } +} + +void _PR_MD_CleanupSockets(void) +{ + socketSetCompatMode = PR_FALSE; + wsaioctlProc = NULL; + if (libWinsock2) + { + FreeLibrary(libWinsock2); + libWinsock2 = NULL; + } +} PRInt32 _PR_MD_SOCKET(int af, int type, int flags) @@ -78,6 +167,29 @@ _PR_MD_SOCKET(int af, int type, int flags) return -1; } + if ((af == AF_INET || af == AF_INET6) && + type == SOCK_STREAM && socketSetCompatMode) + { + WSA_COMPATIBILITY_MODE mode; + char dummy[4]; + int ret_dummy; + + mode.BehaviorId = WsaBehaviorAutoTuning; + mode.TargetOsVersion = NTDDI_LONGHORN; + if (wsaioctlProc(sock, SIO_SET_COMPATIBILITY_MODE, + (char *)&mode, sizeof(mode), + dummy, 4, &ret_dummy, 0, NULL) == SOCKET_ERROR) + { + int err = WSAGetLastError(); + PR_LOG(_pr_io_lm, PR_LOG_DEBUG, ("WSAIoctl() failed with %d", err)); + + /* SIO_SET_COMPATIBILITY_MODE may not be supported. + ** If the call to WSAIoctl() fails with WSAEOPNOTSUPP, + ** don't close the socket. + */ + } + } + return (PRInt32)sock; } diff --git a/pr/src/md/windows/w95thred.c b/pr/src/md/windows/w95thred.c index a8d5f068..a8d64200 100644 --- a/pr/src/md/windows/w95thred.c +++ b/pr/src/md/windows/w95thred.c @@ -65,6 +65,8 @@ void _PR_MD_CLEANUP_BEFORE_EXIT(void) { _PR_NT_FreeSids(); + _PR_MD_CleanupSockets(); + WSACleanup(); #ifndef _PR_USE_STATIC_TLS diff --git a/pr/src/md/windows/win32_errors.c b/pr/src/md/windows/win32_errors.c index 0cf1bb58..ced1b7aa 100644 --- a/pr/src/md/windows/win32_errors.c +++ b/pr/src/md/windows/win32_errors.c @@ -89,6 +89,9 @@ void _MD_win32_map_default_error(PRInt32 err) case ERROR_ALREADY_EXISTS: prError = PR_FILE_EXISTS_ERROR; break; + case ERROR_CALL_NOT_IMPLEMENTED: + prError = PR_NOT_IMPLEMENTED_ERROR; + break; case ERROR_DISK_CORRUPT: prError = PR_IO_ERROR; break; diff --git a/pr/src/misc/pratom.c b/pr/src/misc/pratom.c index 24028e56..35b86c0d 100644 --- a/pr/src/misc/pratom.c +++ b/pr/src/misc/pratom.c @@ -120,6 +120,8 @@ int index; if (num_atomic_locks > MAX_ATOMIC_LOCKS) num_atomic_locks = MAX_ATOMIC_LOCKS; + else if (num_atomic_locks < 1) + num_atomic_locks = 1; else { num_atomic_locks = PR_FloorLog2(num_atomic_locks); num_atomic_locks = 1L << num_atomic_locks; diff --git a/pr/src/misc/prdtoa.c b/pr/src/misc/prdtoa.c index b7432a2f..07853967 100644 --- a/pr/src/misc/prdtoa.c +++ b/pr/src/misc/prdtoa.c @@ -3067,7 +3067,7 @@ dtoa goto no_digits; goto one_digit; } - for(i = 1;; i++, dval(d) *= 10.) { + for(i = 1; i <= k+1; i++, dval(d) *= 10.) { L = (Long)(dval(d) / ds); dval(d) -= L*ds; #ifdef Check_FLT_ROUNDS diff --git a/pr/src/misc/prinit.c b/pr/src/misc/prinit.c index 1ecfb3d1..db36b212 100644 --- a/pr/src/misc/prinit.c +++ b/pr/src/misc/prinit.c @@ -241,6 +241,7 @@ static void _PR_InitStuff(void) _PR_InitLinker(); _PR_InitCallOnce(); _PR_InitDtoa(); + _PR_InitTime(); _PR_InitMW(); _PR_InitRWLocks(); @@ -420,6 +421,7 @@ PR_IMPLEMENT(PRStatus) PR_Cleanup() #endif _PR_CleanupMW(); + _PR_CleanupTime(); _PR_CleanupDtoa(); _PR_CleanupCallOnce(); _PR_ShutdownLinker(); diff --git a/pr/src/misc/prnetdb.c b/pr/src/misc/prnetdb.c index 63b21070..515d9601 100644 --- a/pr/src/misc/prnetdb.c +++ b/pr/src/misc/prnetdb.c @@ -108,6 +108,11 @@ PRLock *_pr_dnsLock = NULL; #define _PR_HAVE_GETPROTO_R_INT #endif +#if __FreeBSD_version >= 602000 +#define _PR_HAVE_GETPROTO_R +#define _PR_HAVE_5_ARG_GETPROTO_R +#endif + #if (defined(LINUX) && defined(__GLIBC__) && __GLIBC__ >= 2) #define _PR_HAVE_GETPROTO_R #define _PR_HAVE_5_ARG_GETPROTO_R diff --git a/pr/src/misc/prsystem.c b/pr/src/misc/prsystem.c index f931e3af..1c6c2825 100644 --- a/pr/src/misc/prsystem.c +++ b/pr/src/misc/prsystem.c @@ -134,8 +134,12 @@ PR_IMPLEMENT(PRStatus) PR_GetSystemInfo(PRSysInfo cmd, char *buf, PRUint32 bufle switch(cmd) { case PR_SI_HOSTNAME: + case PR_SI_HOSTNAME_UNTRUNCATED: if (PR_FAILURE == _PR_MD_GETHOSTNAME(buf, (PRUintn)buflen)) return PR_FAILURE; + + if (cmd == PR_SI_HOSTNAME_UNTRUNCATED) + break; /* * On some platforms a system does not have a hostname and * its IP address is returned instead. The following code @@ -278,20 +282,20 @@ PR_IMPLEMENT(PRInt32) PR_GetNumberOfProcessors( void ) */ PR_IMPLEMENT(PRUint64) PR_GetPhysicalMemorySize(void) { - PRUint64 bytes = LL_ZERO; + PRUint64 bytes = 0; #if defined(LINUX) || defined(SOLARIS) long pageSize = sysconf(_SC_PAGESIZE); long pageCount = sysconf(_SC_PHYS_PAGES); - LL_I2L(bytes, pageSize * pageCount); + bytes = (PRUint64) pageSize * pageCount; #elif defined(HPUX) struct pst_static info; int result = pstat_getstatic(&info, sizeof(info), 1, 0); if (result == 1) - LL_I2L(bytes, info.physical_memory * info.page_size); + bytes = (PRUint64) info.physical_memory * info.page_size; #elif defined(DARWIN) @@ -303,7 +307,7 @@ PR_IMPLEMENT(PRUint64) PR_GetPhysicalMemorySize(void) (host_info_t) &hInfo, &count); if (result == KERN_SUCCESS) - LL_I2L(bytes, hInfo.memory_size); + bytes = hInfo.memory_size; #elif defined(WIN32) @@ -319,16 +323,16 @@ PR_IMPLEMENT(PRUint64) PR_GetPhysicalMemorySize(void) memStat.dwLength = sizeof(memStat); if (globalMemory(&memStat)) - LL_UI2L(bytes, memStat.ullTotalPhys); + bytes = memStat.ullTotalPhys; } } - if (LL_EQ(bytes, LL_ZERO)) { + if (!bytes) { /* Fall back to the older API. */ MEMORYSTATUS memStat; memset(&memStat, 0, sizeof(memStat)); GlobalMemoryStatus(&memStat); - LL_I2L(bytes, memStat.dwTotalPhys); + bytes = memStat.dwTotalPhys; } #elif defined(OS2) @@ -338,7 +342,7 @@ PR_IMPLEMENT(PRUint64) PR_GetPhysicalMemorySize(void) QSV_TOTPHYSMEM, &ulPhysMem, sizeof(ulPhysMem)); - LL_I2L(bytes, ulPhysMem); + bytes = ulPhysMem; #elif defined(AIX) @@ -346,9 +350,7 @@ PR_IMPLEMENT(PRUint64) PR_GetPhysicalMemorySize(void) int how_many; struct CuAt *obj = getattr("sys0", "realmem", 0, &how_many); if (obj != NULL) { - PRUint64 kbytes; - LL_I2L(kbytes, atoi(obj->value)); - LL_MUL(bytes, kbytes, 1024); + bytes = (PRUint64) atoi(obj->value) * 1024; free(obj); } odm_terminate(); diff --git a/pr/src/misc/prtime.c b/pr/src/misc/prtime.c index a3cd1c6e..3736d699 100644 --- a/pr/src/misc/prtime.c +++ b/pr/src/misc/prtime.c @@ -569,6 +569,8 @@ PR_NormalizeTime(PRExplodedTime *time, PRTimeParamFn params) extern struct tm *Maclocaltime(const time_t * t); #endif +#define HAVE_LOCALTIME_MONITOR 1 /* We use 'monitor' to serialize our calls + * to localtime(). */ static PRLock *monitor = NULL; static struct tm *MT_safe_localtime(const time_t *clock, struct tm *result) @@ -578,12 +580,7 @@ static struct tm *MT_safe_localtime(const time_t *clock, struct tm *result) * against NSPR threads only when the * NSPR thread system is activated. */ - if (needLock) { - if (monitor == NULL) { - monitor = PR_NewLock(); - } - PR_Lock(monitor); - } + if (needLock) PR_Lock(monitor); /* * Microsoft (all flavors) localtime() returns a NULL pointer if 'clock' @@ -628,6 +625,23 @@ static struct tm *MT_safe_localtime(const time_t *clock, struct tm *result) #endif /* definition of MT_safe_localtime() */ +void _PR_InitTime(void) +{ +#ifdef HAVE_LOCALTIME_MONITOR + monitor = PR_NewLock(); +#endif +} + +void _PR_CleanupTime(void) +{ +#ifdef HAVE_LOCALTIME_MONITOR + if (monitor) { + PR_DestroyLock(monitor); + monitor = NULL; + } +#endif +} + #if defined(XP_UNIX) || defined(XP_PC) || defined(XP_BEOS) PR_IMPLEMENT(PRTimeParameters) @@ -775,9 +789,53 @@ PR_LocalTimeParameters(const PRExplodedTime *gmt) *------------------------------------------------------------------------ */ +/* + * Returns the mday of the first sunday of the month, where + * mday and wday are for a given day in the month. + * mdays start with 1 (e.g. 1..31). + * wdays start with 0 and are in the range 0..6. 0 = Sunday. + */ +#define firstSunday(mday, wday) (((mday - wday + 7 - 1) % 7) + 1) + +/* + * Returns the mday for the N'th Sunday of the month, where + * mday and wday are for a given day in the month. + * mdays start with 1 (e.g. 1..31). + * wdays start with 0 and are in the range 0..6. 0 = Sunday. + * N has the following values: 0 = first, 1 = second (etc), -1 = last. + * ndays is the number of days in that month, the same value as the + * mday of the last day of the month. + */ +static PRInt32 +NthSunday(PRInt32 mday, PRInt32 wday, PRInt32 N, PRInt32 ndays) +{ + PRInt32 firstSun = firstSunday(mday, wday); + + if (N < 0) + N = (ndays - firstSun) / 7; + return firstSun + (7 * N); +} + +typedef struct DSTParams { + PRInt8 dst_start_month; /* 0 = January */ + PRInt8 dst_start_Nth_Sunday; /* N as defined above */ + PRInt8 dst_start_month_ndays; /* ndays as defined above */ + PRInt8 dst_end_month; /* 0 = January */ + PRInt8 dst_end_Nth_Sunday; /* N as defined above */ + PRInt8 dst_end_month_ndays; /* ndays as defined above */ +} DSTParams; + +static const DSTParams dstParams[2] = { + /* year < 2007: First April Sunday - Last October Sunday */ + { 3, 0, 30, 9, -1, 31 }, + /* year >= 2007: Second March Sunday - First November Sunday */ + { 2, 1, 31, 10, 0, 30 } +}; + PR_IMPLEMENT(PRTimeParameters) PR_USPacificTimeParameters(const PRExplodedTime *gmt) { + const DSTParams *dst; PRTimeParameters retVal; PRExplodedTime st; @@ -807,61 +865,51 @@ PR_USPacificTimeParameters(const PRExplodedTime *gmt) /* Apply the offset to GMT to obtain the local standard time */ ApplySecOffset(&st, retVal.tp_gmt_offset); + if (st.tm_year < 2007) { /* first April Sunday - Last October Sunday */ + dst = &dstParams[0]; + } else { /* Second March Sunday - First November Sunday */ + dst = &dstParams[1]; + } + /* * Apply the rules on standard time or GMT to obtain daylight saving * time offset. In this implementation, we use the US DST rule. */ - if (st.tm_month < 3) { + if (st.tm_month < dst->dst_start_month) { retVal.tp_dst_offset = 0L; - } else if (st.tm_month == 3) { - if (st.tm_wday == 0) { - /* A Sunday */ - if (st.tm_mday <= 7) { - /* First Sunday */ - /* 01:59:59 PST -> 03:00:00 PDT */ - if (st.tm_hour < 2) { - retVal.tp_dst_offset = 0L; - } else { - retVal.tp_dst_offset = 3600L; - } - } else { - /* Not first Sunday */ - retVal.tp_dst_offset = 3600L; - } - } else { - /* Not a Sunday. See if before first Sunday or after */ - if (st.tm_wday + 1 <= st.tm_mday) { - /* After first Sunday */ - retVal.tp_dst_offset = 3600L; - } else { - /* Before first Sunday */ - retVal.tp_dst_offset = 0L; - } + } else if (st.tm_month == dst->dst_start_month) { + int NthSun = NthSunday(st.tm_mday, st.tm_wday, + dst->dst_start_Nth_Sunday, + dst->dst_start_month_ndays); + if (st.tm_mday < NthSun) { /* Before starting Sunday */ + retVal.tp_dst_offset = 0L; + } else if (st.tm_mday == NthSun) { /* Starting Sunday */ + /* 01:59:59 PST -> 03:00:00 PDT */ + if (st.tm_hour < 2) { + retVal.tp_dst_offset = 0L; + } else { + retVal.tp_dst_offset = 3600L; + } + } else { /* After starting Sunday */ + retVal.tp_dst_offset = 3600L; } - } else if (st.tm_month < 9) { + } else if (st.tm_month < dst->dst_end_month) { retVal.tp_dst_offset = 3600L; - } else if (st.tm_month == 9) { - if (st.tm_wday == 0) { - if (31 - st.tm_mday < 7) { - /* Last Sunday */ - /* 01:59:59 PDT -> 01:00:00 PST */ - if (st.tm_hour < 1) { - retVal.tp_dst_offset = 3600L; - } else { - retVal.tp_dst_offset = 0L; - } - } else { - /* Not last Sunday */ - retVal.tp_dst_offset = 3600L; - } - } else { - /* See if before or after last Sunday */ - if (7 - st.tm_wday <= 31 - st.tm_mday) { - /* before last Sunday */ - retVal.tp_dst_offset = 3600L; - } else { - retVal.tp_dst_offset = 0L; - } + } else if (st.tm_month == dst->dst_end_month) { + int NthSun = NthSunday(st.tm_mday, st.tm_wday, + dst->dst_end_Nth_Sunday, + dst->dst_end_month_ndays); + if (st.tm_mday < NthSun) { /* Before ending Sunday */ + retVal.tp_dst_offset = 3600L; + } else if (st.tm_mday == NthSun) { /* Ending Sunday */ + /* 01:59:59 PDT -> 01:00:00 PST */ + if (st.tm_hour < 1) { + retVal.tp_dst_offset = 3600L; + } else { + retVal.tp_dst_offset = 0L; + } + } else { /* After ending Sunday */ + retVal.tp_dst_offset = 0L; } } else { retVal.tp_dst_offset = 0L; @@ -1242,13 +1290,9 @@ PR_ParseTimeString( else tmp_hour = (rest[0]-'0'); - while (*rest && *rest != ':') - rest++; - rest++; - /* move over the colon, and parse minutes */ - end = rest + 1; + rest = ++end; while (*end >= '0' && *end <= '9') end++; diff --git a/pr/src/misc/prtrace.c b/pr/src/misc/prtrace.c index d26f5027..e7d4c55d 100644 --- a/pr/src/misc/prtrace.c +++ b/pr/src/misc/prtrace.c @@ -45,15 +45,7 @@ */ #include -#include "prtrace.h" -#include "prclist.h" -#include "prlock.h" -#include "prcvar.h" -#include "prio.h" -#include "prlog.h" -#include "prenv.h" -#include "prmem.h" -#include "prerror.h" +#include "primpl.h" #define DEFAULT_TRACE_BUFSIZE ( 1024 * 1024 ) @@ -697,6 +689,12 @@ static PRFileDesc * InitializeRecording( void ) logLostData = 0; /* reset at entry */ logState = LogReset; +#ifdef XP_UNIX + if ((getuid() != geteuid()) || (getgid() != getegid())) { + return NULL; + } +#endif /* XP_UNIX */ + /* Get the filename for the logfile from the environment */ logFileName = PR_GetEnv( "NSPR_TRACE_LOG" ); if ( logFileName == NULL ) diff --git a/pr/src/pthreads/Makefile.in b/pr/src/pthreads/Makefile.in index ddda7091..006a3e8c 100644 --- a/pr/src/pthreads/Makefile.in +++ b/pr/src/pthreads/Makefile.in @@ -67,11 +67,6 @@ INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/incl DEFINES += -D_NSPR_BUILD_ -ifeq ($(OS_ARCH),Linux) -# for pthread_mutexattr_settype -DEFINES += -D_XOPEN_SOURCE=500 -endif - include $(topsrcdir)/config/rules.mk export:: $(TARGETS) diff --git a/pr/src/pthreads/ptio.c b/pr/src/pthreads/ptio.c index 7a4ce96f..1c2974aa 100644 --- a/pr/src/pthreads/ptio.c +++ b/pr/src/pthreads/ptio.c @@ -4583,7 +4583,7 @@ PR_IMPLEMENT(PRStatus) PR_UnlockFile(PRFileDesc *fd) * defined here for historical (or hysterical) reasons. */ -PRInt32 PR_GetSysfdTableMax(void) +PR_IMPLEMENT(PRInt32) PR_GetSysfdTableMax(void) { #if defined(XP_UNIX) && !defined(AIX) && !defined(VMS) struct rlimit rlim; @@ -4597,7 +4597,7 @@ PRInt32 PR_GetSysfdTableMax(void) #endif } -PRInt32 PR_SetSysfdTableSize(PRIntn table_size) +PR_IMPLEMENT(PRInt32) PR_SetSysfdTableSize(PRIntn table_size) { #if defined(XP_UNIX) && !defined(AIX) && !defined(VMS) struct rlimit rlim; diff --git a/pr/src/pthreads/ptthread.c b/pr/src/pthreads/ptthread.c index c8b41c11..778a4a7f 100644 --- a/pr/src/pthreads/ptthread.c +++ b/pr/src/pthreads/ptthread.c @@ -938,6 +938,7 @@ PR_IMPLEMENT(PRStatus) PR_Cleanup(void) PR_Unlock(pt_book.ml); _PR_CleanupMW(); + _PR_CleanupTime(); _PR_CleanupDtoa(); _PR_CleanupCallOnce(); _PR_ShutdownLinker(); diff --git a/pr/tests/dll/Makefile.in b/pr/tests/dll/Makefile.in index 906f5310..a9cbac43 100644 --- a/pr/tests/dll/Makefile.in +++ b/pr/tests/dll/Makefile.in @@ -68,11 +68,6 @@ ifeq ($(OS_ARCH), WINNT) ifeq ($(OS_TARGET), WIN16) # do nothing else -ifdef NS_USE_GCC -DLLBASE=-Wl,--image-base -Wl,0x30000000 -else -DLLBASE=-BASE:0x30000000 -endif RES=$(OBJDIR)/my.res RESNAME=../../../pr/src/nspr.rc endif diff --git a/pr/tests/testfile.c b/pr/tests/testfile.c index 4d2228e8..7e0d1db9 100644 --- a/pr/tests/testfile.c +++ b/pr/tests/testfile.c @@ -1,36 +1,39 @@ /* -*- 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. - * +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * 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. - * + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998-2000 + * the Initial Developer. All Rights Reserved. + * * Contributor(s): - * - * 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. - */ + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ #include "nspr.h" #include "prpriv.h" diff --git a/pr/tests/timetest.c b/pr/tests/timetest.c index 8560b719..c57c15e6 100644 --- a/pr/tests/timetest.c +++ b/pr/tests/timetest.c @@ -505,7 +505,7 @@ int main(int argc, char** argv) ** Stress test * ** Go through four years, starting from - ** 00:00:00 PST Jan. 1, 1993, incrementing + ** 00:00:00 PST Jan. 1, 2005, incrementing ** every 10 minutes. ** ************************************************************** @@ -522,22 +522,22 @@ int main(int argc, char** argv) printf("\n"); printf("*******************************************************\n"); printf("** **\n"); - printf("** Stress test **\n"); - printf("** Starting from midnight Jan. 1, 1993 PST, **\n"); + printf("** Stress test Pacific Time **\n"); + printf("** Starting from midnight Jan. 1, 2005 PST, **\n"); printf("** going through four years in 10-minute increment **\n"); printf("** **\n"); printf("*******************************************************\n\n"); } LL_I2L(usecPer10Min, 600000000L); - /* 00:00:00 PST Jan. 1, 1993 */ + /* 00:00:00 PST Jan. 1, 2005 */ et.tm_usec = 0; et.tm_sec = 0; et.tm_min = 0; et.tm_hour = 0; et.tm_mday = 1; et.tm_month = 0; - et.tm_year = 1993; + et.tm_year = 2005; et.tm_params.tp_gmt_offset = -8 * 3600; et.tm_params.tp_dst_offset = 0; usecs = PR_ImplodeTime(&et); @@ -553,20 +553,19 @@ int main(int argc, char** argv) PR_NormalizeTime(&et2, PR_USPacificTimeParameters); if (!ExplodedTimeIsEqual(&et1, &et2)) { - if (debug_mode) printf("ERROR: componentwise comparison failed\n"); + printf("ERROR: componentwise comparison failed\n"); PrintExplodedTime(&et1); - if (debug_mode) printf("\n"); + printf("\n"); PrintExplodedTime(&et2); - if (debug_mode) printf("\n"); + printf("\n"); failed_already=1; return 1; } if (LL_NE(usecs, PR_ImplodeTime(&et1))) { - if (debug_mode) - printf("ERROR: PR_ExplodeTime and PR_ImplodeTime are not inverse\n"); + printf("ERROR: PR_ExplodeTime and PR_ImplodeTime are not inverse\n"); PrintExplodedTime(&et1); - if (debug_mode) printf("\n"); + printf("\n"); failed_already=1; return 1; } @@ -574,18 +573,22 @@ int main(int argc, char** argv) if (!dstInEffect && et1.tm_params.tp_dst_offset) { dstInEffect = 1; - if (debug_mode) printf("DST changeover from "); - PrintExplodedTime(&et); - if (debug_mode) printf(" to "); - PrintExplodedTime(&et1); - if (debug_mode) printf(".\n"); + if (debug_mode) { + printf("DST changeover from "); + PrintExplodedTime(&et); + printf(" to "); + PrintExplodedTime(&et1); + printf(".\n"); + } } else if (dstInEffect && !et1.tm_params.tp_dst_offset) { dstInEffect = 0; - if (debug_mode) printf("DST changeover from "); - PrintExplodedTime(&et); - if (debug_mode) printf(" to "); - PrintExplodedTime(&et1); - if (debug_mode) printf(".\n"); + if (debug_mode) { + printf("DST changeover from "); + PrintExplodedTime(&et); + printf(" to "); + PrintExplodedTime(&et1); + printf(".\n"); + } } et = et1; @@ -609,8 +612,8 @@ int main(int argc, char** argv) printf("\n"); printf("*******************************************************\n"); printf("** **\n"); - printf("** Stress test **\n"); - printf("** Starting from midnight Jan. 1, 1993 PST, **\n"); + printf("** Stress test Local Time **\n"); + printf("** Starting from midnight Jan. 1, 2005 PST, **\n"); printf("** going through four years in 10-minute increment **\n"); printf("** **\n"); printf("*******************************************************\n\n"); @@ -618,14 +621,14 @@ int main(int argc, char** argv) LL_I2L(usecPer10Min, 600000000L); - /* 00:00:00 PST Jan. 1, 1993 */ + /* 00:00:00 PST Jan. 1, 2005 */ et.tm_usec = 0; et.tm_sec = 0; et.tm_min = 0; et.tm_hour = 0; et.tm_mday = 1; et.tm_month = 0; - et.tm_year = 1993; + et.tm_year = 2005; et.tm_params.tp_gmt_offset = -8 * 3600; et.tm_params.tp_dst_offset = 0; usecs = PR_ImplodeTime(&et); @@ -641,18 +644,18 @@ int main(int argc, char** argv) PR_NormalizeTime(&et2, PR_LocalTimeParameters); if (!ExplodedTimeIsEqual(&et1, &et2)) { - if (debug_mode) printf("ERROR: componentwise comparison failed\n"); + printf("ERROR: componentwise comparison failed\n"); PrintExplodedTime(&et1); - if (debug_mode) printf("\n"); + printf("\n"); PrintExplodedTime(&et2); - if (debug_mode) printf("\n"); + printf("\n"); return 1; } if (LL_NE(usecs, PR_ImplodeTime(&et1))) { printf("ERROR: PR_ExplodeTime and PR_ImplodeTime are not inverse\n"); PrintExplodedTime(&et1); - if (debug_mode) printf("\n"); + printf("\n"); failed_already=1; return 1; } @@ -660,18 +663,22 @@ int main(int argc, char** argv) if (!dstInEffect && et1.tm_params.tp_dst_offset) { dstInEffect = 1; - if (debug_mode) printf("DST changeover from "); - PrintExplodedTime(&et); - if (debug_mode) printf(" to "); - PrintExplodedTime(&et1); - if (debug_mode) printf(".\n"); + if (debug_mode) { + printf("DST changeover from "); + PrintExplodedTime(&et); + printf(" to "); + PrintExplodedTime(&et1); + printf(".\n"); + } } else if (dstInEffect && !et1.tm_params.tp_dst_offset) { dstInEffect = 0; - if (debug_mode) printf("DST changeover from "); - PrintExplodedTime(&et); - if (debug_mode) printf(" to "); - PrintExplodedTime(&et1); - if (debug_mode) printf(".\n"); + if (debug_mode) { + printf("DST changeover from "); + PrintExplodedTime(&et); + printf(" to "); + PrintExplodedTime(&et1); + printf(".\n"); + } } et = et1; @@ -694,8 +701,8 @@ int main(int argc, char** argv) printf("\n"); printf("*******************************************************\n"); printf("** **\n"); - printf("** Stress test **\n"); - printf("** Starting from midnight Jan. 1, 1997 PST, **\n"); + printf("** Stress test Local Time **\n"); + printf("** Starting from midnight Jan. 1, 2009 PST, **\n"); printf("** going back four years in 10-minute increment **\n"); printf("** **\n"); printf("*******************************************************\n\n"); @@ -703,14 +710,14 @@ int main(int argc, char** argv) LL_I2L(usecPer10Min, 600000000L); - /* 00:00:00 PST Jan. 1, 1997 */ + /* 00:00:00 PST Jan. 1, 2009 */ et.tm_usec = 0; et.tm_sec = 0; et.tm_min = 0; et.tm_hour = 0; et.tm_mday = 1; et.tm_month = 0; - et.tm_year = 1997; + et.tm_year = 2009; et.tm_params.tp_gmt_offset = -8 * 3600; et.tm_params.tp_dst_offset = 0; usecs = PR_ImplodeTime(&et); @@ -726,19 +733,18 @@ int main(int argc, char** argv) PR_NormalizeTime(&et2, PR_LocalTimeParameters); if (!ExplodedTimeIsEqual(&et1, &et2)) { - if (debug_mode) printf("ERROR: componentwise comparison failed\n"); + printf("ERROR: componentwise comparison failed\n"); PrintExplodedTime(&et1); - if (debug_mode) printf("\n"); + printf("\n"); PrintExplodedTime(&et2); - if (debug_mode) printf("\n"); + printf("\n"); return 1; } if (LL_NE(usecs, PR_ImplodeTime(&et1))) { - if (debug_mode) - printf("ERROR: PR_ExplodeTime and PR_ImplodeTime are not inverse\n"); + printf("ERROR: PR_ExplodeTime and PR_ImplodeTime are not inverse\n"); PrintExplodedTime(&et1); - if (debug_mode) printf("\n"); + printf("\n"); failed_already=1; return 1; } @@ -746,18 +752,22 @@ int main(int argc, char** argv) if (!dstInEffect && et1.tm_params.tp_dst_offset) { dstInEffect = 1; - if (debug_mode) printf("DST changeover from "); - PrintExplodedTime(&et); - if (debug_mode) printf(" to "); - PrintExplodedTime(&et1); - if (debug_mode) printf(".\n"); + if (debug_mode) { + printf("DST changeover from "); + PrintExplodedTime(&et); + printf(" to "); + PrintExplodedTime(&et1); + printf(".\n"); + } } else if (dstInEffect && !et1.tm_params.tp_dst_offset) { dstInEffect = 0; - if (debug_mode) printf("DST changeover from "); - PrintExplodedTime(&et); - if (debug_mode) printf(" to "); - PrintExplodedTime(&et1); - if (debug_mode) printf(".\n"); + if (debug_mode) { + printf("DST changeover from "); + PrintExplodedTime(&et); + printf(" to "); + PrintExplodedTime(&et1); + printf(".\n"); + } } et = et1; diff --git a/pr/tests/tmocon.c b/pr/tests/tmocon.c index 269e3003..1cd8f77f 100644 --- a/pr/tests/tmocon.c +++ b/pr/tests/tmocon.c @@ -1,36 +1,39 @@ /* -*- 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. - * +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * 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. - * + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998-2000 + * the Initial Developer. All Rights Reserved. + * * Contributor(s): - * - * 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. - */ + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ /*********************************************************************** ** diff --git a/pr/tests/vercheck.c b/pr/tests/vercheck.c index 5174c0b3..8f458bbb 100644 --- a/pr/tests/vercheck.c +++ b/pr/tests/vercheck.c @@ -52,14 +52,16 @@ #include /* - * This release (4.6.1) is backward compatible with the - * 4.0.x, 4.1.x, 4.2.x, 4.3.x, 4.4.x, 4.5.x, and 4.6 releases. - * It, of course, is compatible with itself. + * This release (4.6.7) is backward compatible with the + * 4.0.x, 4.1.x, 4.2.x, 4.3.x, 4.4.x, 4.5.x, 4.6, 4.6.1, 4.6.2, + * 4.6.3, 4.6.4, 4.6.5, and 4.6.6 releases. It, of course, + * is compatible with itself. */ static char *compatible_version[] = { "4.0", "4.0.1", "4.1", "4.1.1", "4.1.2", "4.1.3", "4.2", "4.2.1", "4.2.2", "4.3", "4.4", "4.4.1", - "4.5", "4.5.1", "4.6", PR_VERSION + "4.5", "4.5.1", "4.6", "4.6.1", "4.6.2", "4.6.3", + "4.6.4", "4.6.5", "4.6.6", PR_VERSION }; /* @@ -74,7 +76,7 @@ static char *incompatible_version[] = { "3.0", "3.0.1", "3.1", "3.1.1", "3.1.2", "3.1.3", "3.5", "3.5.1", - "4.6.3", + "4.6.8", "4.7", "4.7.1", "10.0", "11.1", "12.14.20" }; -- cgit v1.2.1