From 0c2cc82facf1ab6a56613659c985524a54ffeb0a Mon Sep 17 00:00:00 2001 From: cvs2hg Date: Wed, 22 Feb 2006 23:03:12 +0000 Subject: fixup commit for branch 'CAMINO_1_0_1_MINIBRANCH' --- admin/repackage.sh | 8 +- config/autoconf.mk.in | 13 + config/rules.mk | 1 + configure | 634 ++++++++++++++++++++--------------------- configure.in | 361 +++++++++++++++-------- pkg/linux/Makefile.in | 40 ++- pkg/linux/sun-nspr.spec | 73 ----- pr/include/md/_darwin.cfg | 1 + pr/include/md/_darwin.h | 33 ++- pr/include/md/_linux.cfg | 48 +++- pr/include/md/_linux.h | 4 +- pr/include/md/_pth.h | 7 +- pr/include/md/_riscos.cfg | 141 +++++++++ pr/include/md/_riscos.h | 209 ++++++++++++++ pr/include/md/_win95.h | 16 ++ pr/include/md/_winnt.h | 16 ++ pr/include/md/prosdep.h | 3 + pr/include/prinit.h | 4 +- pr/include/private/primpl.h | 2 +- pr/include/prlink.h | 8 +- pr/include/prthread.h | 2 +- pr/src/Makefile.in | 4 +- pr/src/io/prprf.c | 4 +- pr/src/io/prscanf.c | 2 +- pr/src/linking/Makefile.in | 2 +- pr/src/linking/prlink.c | 414 ++++----------------------- pr/src/malloc/prmem.c | 13 + pr/src/md/unix/os_Darwin_x86.s | 105 +++++++ pr/src/md/unix/riscos.c | 120 ++++++++ pr/src/md/unix/unix.c | 2 +- pr/src/md/unix/uxrng.c | 2 +- pr/src/md/windows/ntinrval.c | 68 +---- pr/src/md/windows/ntio.c | 24 +- pr/src/md/windows/w95io.c | 24 +- pr/src/misc/prdtoa.c | 5 +- pr/src/misc/prnetdb.c | 4 +- pr/src/misc/prsystem.c | 22 +- pr/src/pthreads/ptio.c | 15 +- pr/src/pthreads/ptthread.c | 7 +- pr/tests/server_test.c | 9 +- pr/tests/servr_kk.c | 9 +- pr/tests/servr_ku.c | 9 +- pr/tests/servr_uk.c | 9 +- pr/tests/servr_uu.c | 9 +- pr/tests/vercheck.c | 8 +- 45 files changed, 1468 insertions(+), 1046 deletions(-) create mode 100644 pr/include/md/_riscos.cfg create mode 100644 pr/include/md/_riscos.h create mode 100644 pr/src/md/unix/os_Darwin_x86.s create mode 100644 pr/src/md/unix/riscos.c diff --git a/admin/repackage.sh b/admin/repackage.sh index d25b15a5..fcdce44f 100755 --- a/admin/repackage.sh +++ b/admin/repackage.sh @@ -64,10 +64,10 @@ # # ------------------------------------------------------------------ -FROMTOP=/share/builds/components/nspr20/v4.6 -TOTOP=./v4.6 -NSPRDIR=nspr-4.6 -SOURCETAG=NSPR_4_6_RTM +FROMTOP=/share/builds/components/nspr20/v4.6.1 +TOTOP=./v4.6.1 +NSPRDIR=nspr-4.6.1 +SOURCETAG=NSPR_4_6_1_RTM # # enumerate Unix object directories on /s/b/c diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in index 066832be..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@ @@ -114,3 +115,15 @@ endif VISIBILITY_FLAGS = @VISIBILITY_FLAGS@ WRAP_SYSTEM_INCLUDES = @WRAP_SYSTEM_INCLUDES@ + +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 aa42becb..9ad22fd8 100755 --- a/configure +++ b/configure @@ -40,8 +40,11 @@ ac_help="$ac_help ac_help="$ac_help --enable-mdupdate Enable use of certain compilers' mdupdate feature" ac_help="$ac_help - --enable-macos-target=VER (default=10.1) - Set the minimum MacOS version needed at runtime" + --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 + [10.1 for ppc, 10.4 for x86]" ac_help="$ac_help --enable-strip Enable stripping of shared libs and programs" ac_help="$ac_help @@ -51,9 +54,11 @@ ac_help="$ac_help ac_help="$ac_help --enable-nspr-threads Build using classic nspr threads" ac_help="$ac_help - --with-bthreads Use system bthreads library as thread subsystem (BeOS only)" + --with-bthreads Use system bthreads library as thread subsystem + (BeOS only)" ac_help="$ac_help - --with-native-threads Use native system threads as thread subsystem (Solaris only)" + --with-native-threads Use native system threads as thread subsystem + (Solaris only)" ac_help="$ac_help --enable-cplus Enable some c++ api routines" ac_help="$ac_help @@ -618,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:622: checking host system type" >&5 +echo "configure:627: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -639,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:643: checking target system type" >&5 +echo "configure:648: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -657,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:661: checking build system type" >&5 +echo "configure:666: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -682,7 +687,7 @@ test "$host_alias" != "$target_alias" && MOD_MAJOR_VERSION=4 MOD_MINOR_VERSION=6 -MOD_PATCH_VERSION=0 +MOD_PATCH_VERSION=1 NSPR_MODNAME=nspr20 _HAVE_PTHREADS= USE_PTHREADS= @@ -693,7 +698,7 @@ USE_64= USE_CPLUS= USE_IPV6= USE_MDUPDATE= -MACOS_DEPLOYMENT_TARGET= +_MACOSX_DEPLOYMENT_TARGET= _OPTIMIZE_FLAGS=-O _DEBUG_FLAGS=-g MOZ_DEBUG=1 @@ -706,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= @@ -724,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:728: 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 @@ -920,12 +927,17 @@ 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" - MACOS_DEPLOYMENT_TARGET_STR=$enableval -else - MACOS_DEPLOYMENT_TARGET_STR=10.1 + _MACOSX_DEPLOYMENT_TARGET=$enableval fi @@ -1026,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:1030: 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 @@ -1097,13 +1109,13 @@ if test "$target" != "$host"; then _SAVE_LDFLAGS="$LDFLAGS" echo $ac_n "checking for $host compiler""... $ac_c" 1>&6 -echo "configure:1101: 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:1107: 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 @@ -1149,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:1153: 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 @@ -1173,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:1182: 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 @@ -1212,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:1216: 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 @@ -1242,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:1246: 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 @@ -1293,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:1297: 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 @@ -1325,7 +1346,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1329: 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. @@ -1336,12 +1357,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 1340 "configure" +#line 1361 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1345: \"$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 @@ -1367,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:1371: 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:1376: 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 @@ -1381,7 +1402,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1385: \"$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 @@ -1400,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:1404: 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 @@ -1436,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:1440: 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 @@ -1472,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:1476: 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 @@ -1504,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:1508: 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. @@ -1515,12 +1536,12 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext << EOF -#line 1519 "configure" +#line 1540 "configure" #include "confdefs.h" int main(){return(0);} EOF -if { (eval echo configure:1524: \"$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 @@ -1546,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:1550: 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:1555: 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 @@ -1560,7 +1581,7 @@ else yes; #endif EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1564: \"$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 @@ -1579,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:1583: 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 @@ -1610,63 +1631,20 @@ else fi fi -for ac_declaration in \ - ''\ - '#include ' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' -do - cat > conftest.$ac_ext < -$ac_declaration -int main() { -exit (42); -; return 0; } -EOF -if { (eval echo configure:1632: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - : -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - continue -fi -rm -f conftest* - cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - break -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 -fi -rm -f conftest* -done -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h -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:1670: 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 @@ -1701,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:1705: 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 @@ -1736,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:1740: 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 @@ -1771,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:1775: 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 @@ -1806,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:1810: 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 @@ -1841,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:1845: 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 @@ -1878,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:1882: 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 @@ -1910,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:1914: 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. @@ -1921,12 +1899,12 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext << EOF -#line 1925 "configure" +#line 1903 "configure" #include "confdefs.h" int main(){return(0);} EOF -if { (eval echo configure:1930: \"$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 @@ -1952,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:1956: 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:1961: 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 @@ -1966,7 +1944,7 @@ else yes; #endif EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1970: \"$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 @@ -1985,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:1989: 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 @@ -2016,64 +1994,13 @@ else fi fi -for ac_declaration in \ - ''\ - '#include ' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' -do - cat > conftest.$ac_ext < -$ac_declaration -int main() { -exit (42); -; return 0; } -EOF -if { (eval echo configure:2038: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - : -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - continue -fi -rm -f conftest* - cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - break -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 -fi -rm -f conftest* -done -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h -fi - - if test "$CXX" = "cl" -a -z "$CC"; then CC=$CXX else # 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:2077: 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 @@ -2103,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:2107: 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 @@ -2154,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:2158: 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 @@ -2186,7 +2113,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2190: 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. @@ -2197,12 +2124,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 2201 "configure" +#line 2128 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:2206: \"$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 @@ -2228,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:2232: 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:2237: 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 @@ -2242,7 +2169,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2246: \"$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 @@ -2261,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:2265: 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 @@ -2294,7 +2221,7 @@ fi fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:2298: 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= @@ -2309,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:2319: \"$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 : @@ -2326,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:2336: \"$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 : @@ -2343,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:2353: \"$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 : @@ -2376,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:2380: 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 @@ -2408,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:2412: 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 @@ -2449,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:2453: 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 @@ -2490,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:2494: 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 @@ -2531,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:2535: 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 @@ -2572,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:2576: 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 @@ -2627,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 @@ -2634,7 +2567,7 @@ else fi echo $ac_n "checking for gcc -pipe support""... $ac_c" 1>&6 -echo "configure:2638: 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 @@ -2649,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:2660: \"$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 @@ -2683,7 +2616,7 @@ fi if test "$GNU_CC"; then echo $ac_n "checking for visibility(hidden) attribute""... $ac_c" 1>&6 -echo "configure:2687: 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 @@ -2707,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:2711: 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 @@ -2760,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:2764: 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 @@ -2820,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'` @@ -2874,33 +2808,41 @@ fi # It also accomodates for MKS's uname.exe. If you never intend # to do development on a WIN95 machine, you don't need this hack. # -if test "$OS_ARCH" = "WIN95"; then +case "$OS_ARCH" in +WIN95) OS_ARCH=WINNT OS_TARGET=WIN95 -elif test "$OS_ARCH" = 'Windows_95'; then + ;; +Windows_95) OS_ARCH=Windows_NT OS_TARGET=WIN95 -elif test "$OS_ARCH" = 'Windows_98'; then + ;; +Windows_98) OS_ARCH=Windows_NT OS_TARGET=WIN95 -elif test "`echo $OS_ARCH | egrep -c '^(CYGWIN_9|CYGWIN_ME)' 2>/dev/null`" != 0; then + ;; +CYGWIN_9*|CYGWIN_ME*) OS_ARCH='CYGWIN_NT-4.0' OS_TARGET=WIN95 -elif test "$OS_ARCH" = "OS_2"; then + ;; +OS_2) OS_ARCH=OS2 OS_TARGET=OS2 -fi + ;; +esac # # On WIN32, we also define the variable CPU_ARCH. # -if test "$OS_ARCH" = "WINNT"; then +case "$OS_ARCH" in +WINNT) CPU_ARCH=`uname -p` if test "$CPU_ARCH" = "I386"; then CPU_ARCH=x86 fi -elif test "$OS_ARCH" = "Windows_NT"; then + ;; +Windows_NT) # # If uname -s returns "Windows_NT", we assume that we are using # the uname.exe in MKS toolkit. @@ -2922,12 +2864,15 @@ elif test "$OS_ARCH" = "Windows_NT"; then if echo "$CPU_ARCH" | grep -c 86 >/dev/null; then CPU_ARCH=x86 fi -elif echo "$OS_ARCH" | grep -c CYGWIN_NT >/dev/null; then + ;; +CYGWIN_NT*|MINGW*_NT*) # # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using # the uname.exe in the Cygwin tools. +# If uname -s returns MINGW32_NT-5.1, we assume that we are using +# the uname.exe in the MSYS tools. # - OS_RELEASE=`echo $OS_ARCH | sed 's|^CYGWIN_NT-||'` + OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'` OS_ARCH=WINNT CPU_ARCH=`uname -m` # @@ -2936,21 +2881,8 @@ elif echo "$OS_ARCH" | grep -c CYGWIN_NT >/dev/null; then if echo "$CPU_ARCH" | grep -c 86 >/dev/null; then CPU_ARCH=x86 fi -elif test "$OS_ARCH" = "CYGWIN32_NT"; then -# -# Prior to the Beta 20 release, Cygwin was called GNU-Win32. -# If uname -s returns "CYGWIN32/NT", we assume that we are using -# the uname.exe in the GNU-Win32 tools. -# - OS_ARCH=WINNT - CPU_ARCH=`uname -m` - # - # GNU-Win32's uname -m returns "i686" on a Pentium Pro machine. - # - if echo "$CPU_ARCH" | grep -c 86 >/dev/null; then - CPU_ARCH=x86 - fi -fi + ;; +esac if test -n "$MOZILLA_CLIENT" && test "$OS_ARCH" = "WINNT"; then OS_TARGET=WIN95 @@ -2971,7 +2903,10 @@ OS_CONFIG="${OS_TARGET}${OS_RELEASE}" case "$host" in -*-mingw*|*-cygwin*|*-msvc*|*-mks*) +*-mingw*) + NSINSTALL=nsinstall + ;; +*-cygwin*|*-msvc*|*-mks*) NSINSTALL='$(CYGWIN_WRAPPER) nsinstall' if test `echo "${PATH}" | grep -c \;` = 0; then CYGWIN_WRAPPER='sh $(topsrcdir)/build/cygwin-wrapper' @@ -3005,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:3009: 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:3019: \"$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* @@ -3172,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:3176: 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 @@ -3180,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 @@ -3372,31 +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 @@ -3406,53 +3344,69 @@ EOF OS_TARGET=MacOSX - - MACOS_VERSION_MAJOR=`echo $MACOS_DEPLOYMENT_TARGET_STR | cut -d . -f 1` - MACOS_VERSION_MINOR=`echo $MACOS_DEPLOYMENT_TARGET_STR | cut -d . -f 2` - MACOS_VERSION_MICRO=`echo $MACOS_DEPLOYMENT_TARGET_STR | cut -d . -f 3` - if test -z "$MACOS_VERSION_MINOR"; then - MACOS_VERSION_MINOR=0 - fi - if test -z "$MACOS_VERSION_MICRO"; then - MACOS_VERSION_MICRO=0 + if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then + export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET + elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then + case "${target_cpu}" in + powerpc*) + export MACOSX_DEPLOYMENT_TARGET=10.1 + ;; + i*86*) + export MACOSX_DEPLOYMENT_TARGET=10.4 + ;; + esac fi - MACOS_DEPLOYMENT_TARGET=`printf "%02d%02d%02d" "$MACOS_VERSION_MAJOR" "$MACOS_VERSION_MINOR" "$MACOS_VERSION_MICRO"` - cat >> confdefs.h <&2; exit 1; } + 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/;'` + + 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 "$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=powerpc-apple-darwin`echo $NEXT_ROOT | $PERL -pe 's/MacOSX10\.(^\.*)//;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 + SDK_C_INCLUDE="-isystem ${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION} -isystem ${MACOS_SDK_DIR}/usr/include ${SDK_C_FRAMEWORK}" - if test -d "${NEXT_ROOT}/Library/Frameworks" ; then - SDK_C_INCLUDE="$SDK_C_INCLUDE -F${NEXT_ROOT}/Library/Frameworks" - fi + CFLAGS="$CFLAGS -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 - CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}" + 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 -nostdinc ${SDK_C_INCLUDE}" + CPP="$CPP -isysroot ${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 "$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 ;; @@ -3942,7 +3896,23 @@ EOF PR_MD_ASFILES=os_Linux_ia64.s ;; x86_64) - PR_MD_ASFILES=os_Linux_x86_64.s + if test -n "$USE_64"; then + PR_MD_ASFILES=os_Linux_x86_64.s + else + cat >> confdefs.h <<\EOF +#define i386 1 +EOF + + PR_MD_ASFILES=os_Linux_x86.s + CC="$CC -m32" + CXX="$CXX -m32" + fi + ;; + powerpc64) + if test -n "$USE_64"; then + CC="$CC -m64" + CXX="$CXX -m64" + fi ;; m68k) CFLAGS="$CFLAGS -m68020-60" @@ -4422,17 +4392,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:4426: checking for machine/builtins.h" >&5 +echo "configure:4396: 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:4436: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4406: \"$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* @@ -4505,6 +4475,26 @@ EOF PR_MD_CSRCS=qnx.c ;; +*-riscos*) + cat >> confdefs.h <<\EOF +#define XP_UNIX 1 +EOF + + cat >> confdefs.h <<\EOF +#define RISCOS 1 +EOF + + cat >> confdefs.h <<\EOF +#define _PR_NEED_H_ERRNO 1 +EOF + + USE_PTHREADS=1 + MDCPUCFG_H=_riscos.cfg + PR_MD_CSRCS=riscos.c + DLL_SUFFIX=a + LD="/home/riscos/env/ro-ar cr" + ;; + *-*-sco*) cat >> confdefs.h <<\EOF #define XP_UNIX 1 @@ -4974,7 +4964,7 @@ case $target in ;; *) echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:4978: checking for dlopen in -ldl" >&5 +echo "configure:4968: 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 @@ -4982,7 +4972,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:4987: \"$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 @@ -5010,17 +5000,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:5014: checking for dlfcn.h" >&5 +echo "configure:5004: 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:5024: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5014: \"$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* @@ -5053,13 +5043,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:5057: checking whether ${CC-cc} needs -traditional" >&5 +echo "configure:5047: 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 @@ -5077,7 +5067,7 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext < Autoconf TCGETA @@ -5101,12 +5091,12 @@ fi for ac_func in lchown strerror do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5105: checking for $ac_func" >&5 +echo "configure:5095: 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:5123: \"$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 @@ -5170,7 +5160,7 @@ hpux*) if test -z "$GNU_CC"; then echo $ac_n "checking for +Olit support""... $ac_c" 1>&6 -echo "configure:5174: checking for +Olit support" >&5 +echo "configure:5164: 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 @@ -5202,9 +5192,14 @@ esac - +case "$target_os" in +darwin*) + _HAVE_PTHREADS=1 + ;; +*) + echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6 -echo "configure:5208: checking for pthread_create in -lpthreads" >&5 +echo "configure:5203: checking for pthread_create in -lpthreads" >&5 echo " #include void *foo(void *v) { return v; } @@ -5226,7 +5221,7 @@ echo " echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 -echo "configure:5230: checking for pthread_create in -lpthread" >&5 +echo "configure:5225: checking for pthread_create in -lpthread" >&5 echo " #include void *foo(void *v) { return v; } @@ -5248,7 +5243,7 @@ echo " echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6 -echo "configure:5252: checking for pthread_create in -lc_r" >&5 +echo "configure:5247: checking for pthread_create in -lc_r" >&5 echo " #include void *foo(void *v) { return v; } @@ -5270,7 +5265,7 @@ echo " echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6 -echo "configure:5274: checking for pthread_create in -lc" >&5 +echo "configure:5269: checking for pthread_create in -lc" >&5 echo " #include void *foo(void *v) { return v; } @@ -5288,22 +5283,24 @@ echo " if test "$_res" = "0"; then echo "$ac_t""yes" 1>&6 _HAVE_PTHREADS=1 - + else echo "$ac_t""no" 1>&6 fi + + fi + fi fi + ;; +esac - fi - - # Check whether --with-pthreads or --without-pthreads was given. if test "${with_pthreads+set}" = set; then withval="$with_pthreads" @@ -5422,7 +5419,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:5426: checking whether ${CC-cc} accepts -pthread" >&5 +echo "configure:5423: 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 @@ -5445,7 +5442,7 @@ echo "configure:5426: 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:5449: checking whether ${CC-cc} accepts -pthreads" >&5 +echo "configure:5446: 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 @@ -5705,9 +5702,11 @@ EOF PR_MD_ASFILES=os_SunOS_x86.s fi else - PR_MD_ASFILES=os_SunOS.s if test -n "$USE_64"; then - PR_MD_ASFILES="$PR_MD_ASFILES os_SunOS_sparcv9.s" + PR_MD_ASFILES=os_SunOS_sparcv9.s + fi + if test -n "$USE_NATIVE_THREADS"; then + PR_MD_ASFILES="$PR_MD_ASFILES os_SunOS.s" fi fi fi @@ -5759,7 +5758,7 @@ fi RELEASE_OBJDIR_NAME="${OS_CONFIG}${CPU_ARCH_TAG}${COMPILER_TAG}${IMPL_STRATEGY}${OBJDIR_TAG}.${OBJDIR_SUFFIX}" case "$target_os" in -mingw*|cygwin*|msvc*|mks*) +cygwin*|msvc*|mks*) CC="\$(CYGWIN_WRAPPER) $CC" CXX="\$(CYGWIN_WRAPPER) $CXX" RC="\$(CYGWIN_WRAPPER) $RC" @@ -5838,6 +5837,9 @@ esac + + + @@ -5974,34 +5976,15 @@ trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. -# -# If the first sed substitution is executed (which looks for macros that -# take arguments), then we branch to the quote section. Otherwise, -# look for a macro that doesn't take arguments. -cat >confdef2opt.sed <<\_ACEOF -t clear -: clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g -t quote -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g -t quote -d -: quote -s,[ `~#$^&*(){}\\|;'"<>?],\\&,g -s,\[,\\&,g -s,\],\\&,g -s,\$,$$,g -p -_ACEOF -# We use echo to avoid assuming a particular line-breaking character. -# The extra dot is to prevent the shell from consuming trailing -# line-breaks from the sub-command output. A line-break within -# single-quotes doesn't work because, if this script is created in a -# platform that uses two characters for line-breaks (e.g., DOS), tr -# would break. -ac_LF_and_DOT=`echo; echo .` -DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` -rm -f confdef2opt.sed +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' ' | tr '\015' ' '` +rm -f conftest.defs # Without the "./", some shells look in PATH for config.status. @@ -6105,6 +6088,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 @@ -6144,7 +6128,7 @@ s%@OS_TARGET@%$OS_TARGET%g s%@OS_ARCH@%$OS_ARCH%g s%@OS_RELEASE@%$OS_RELEASE%g s%@OS_TEST@%$OS_TEST%g -s%@MACOS_DEPLOYMENT_TARGET@%$MACOS_DEPLOYMENT_TARGET%g +s%@MACOSX_DEPLOYMENT_TARGET@%$MACOSX_DEPLOYMENT_TARGET%g s%@DEFINES@%$DEFINES%g s%@AR_FLAGS@%$AR_FLAGS%g s%@ASFLAGS@%$ASFLAGS%g @@ -6169,6 +6153,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 04862258..c752bde1 100644 --- a/configure.in +++ b/configure.in @@ -19,6 +19,8 @@ dnl Rights Reserved. dnl dnl Contributor(s): dnl Christopher Seawood +dnl Howard Chu +dnl Mark Mentovai 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 @@ -44,7 +46,7 @@ dnl = Defaults dnl ======================================================== MOD_MAJOR_VERSION=4 MOD_MINOR_VERSION=6 -MOD_PATCH_VERSION=0 +MOD_PATCH_VERSION=1 NSPR_MODNAME=nspr20 _HAVE_PTHREADS= USE_PTHREADS= @@ -55,7 +57,7 @@ USE_64= USE_CPLUS= USE_IPV6= USE_MDUPDATE= -MACOS_DEPLOYMENT_TARGET= +_MACOSX_DEPLOYMENT_TARGET= _OPTIMIZE_FLAGS=-O _DEBUG_FLAGS=-g MOZ_DEBUG=1 @@ -68,6 +70,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= @@ -225,11 +229,18 @@ 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 (default=10.1) - Set the minimum MacOS version needed at runtime], - [MACOS_DEPLOYMENT_TARGET_STR=$enableval], - [MACOS_DEPLOYMENT_TARGET_STR=10.1]) + [ --enable-macos-target=VER + Set the minimum MacOS version needed at runtime + [10.1 for ppc, 10.4 for x86]], + [_MACOSX_DEPLOYMENT_TARGET=$enableval]) dnl ======================================================== dnl = @@ -401,12 +412,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) @@ -447,6 +483,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 @@ -580,6 +625,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'` @@ -634,33 +680,41 @@ fi # It also accomodates for MKS's uname.exe. If you never intend # to do development on a WIN95 machine, you don't need this hack. # -if test "$OS_ARCH" = "WIN95"; then +case "$OS_ARCH" in +WIN95) OS_ARCH=WINNT OS_TARGET=WIN95 -elif test "$OS_ARCH" = 'Windows_95'; then + ;; +Windows_95) OS_ARCH=Windows_NT OS_TARGET=WIN95 -elif test "$OS_ARCH" = 'Windows_98'; then + ;; +Windows_98) OS_ARCH=Windows_NT OS_TARGET=WIN95 -elif test "`echo $OS_ARCH | egrep -c '^(CYGWIN_9|CYGWIN_ME)' 2>/dev/null`" != 0; then + ;; +CYGWIN_9*|CYGWIN_ME*) OS_ARCH='CYGWIN_NT-4.0' OS_TARGET=WIN95 -elif test "$OS_ARCH" = "OS_2"; then + ;; +OS_2) OS_ARCH=OS2 OS_TARGET=OS2 -fi + ;; +esac # # On WIN32, we also define the variable CPU_ARCH. # -if test "$OS_ARCH" = "WINNT"; then +case "$OS_ARCH" in +WINNT) CPU_ARCH=`uname -p` if test "$CPU_ARCH" = "I386"; then CPU_ARCH=x86 fi -elif test "$OS_ARCH" = "Windows_NT"; then + ;; +Windows_NT) # # If uname -s returns "Windows_NT", we assume that we are using # the uname.exe in MKS toolkit. @@ -682,12 +736,15 @@ elif test "$OS_ARCH" = "Windows_NT"; then if echo "$CPU_ARCH" | grep -c 86 >/dev/null; then CPU_ARCH=x86 fi -elif echo "$OS_ARCH" | grep -c CYGWIN_NT >/dev/null; then + ;; +CYGWIN_NT*|MINGW*_NT*) # # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using # the uname.exe in the Cygwin tools. +# If uname -s returns MINGW32_NT-5.1, we assume that we are using +# the uname.exe in the MSYS tools. # - OS_RELEASE=`echo $OS_ARCH | sed 's|^CYGWIN_NT-||'` + OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'` OS_ARCH=WINNT CPU_ARCH=`uname -m` # @@ -696,21 +753,8 @@ elif echo "$OS_ARCH" | grep -c CYGWIN_NT >/dev/null; then if echo "$CPU_ARCH" | grep -c 86 >/dev/null; then CPU_ARCH=x86 fi -elif test "$OS_ARCH" = "CYGWIN32_NT"; then -# -# Prior to the Beta 20 release, Cygwin was called GNU-Win32. -# If uname -s returns "CYGWIN32/NT", we assume that we are using -# the uname.exe in the GNU-Win32 tools. -# - OS_ARCH=WINNT - CPU_ARCH=`uname -m` - # - # GNU-Win32's uname -m returns "i686" on a Pentium Pro machine. - # - if echo "$CPU_ARCH" | grep -c 86 >/dev/null; then - CPU_ARCH=x86 - fi -fi + ;; +esac if test -n "$MOZILLA_CLIENT" && test "$OS_ARCH" = "WINNT"; then OS_TARGET=WIN95 @@ -735,7 +779,10 @@ dnl ======================================================== dnl Override of system specific host options dnl ======================================================== case "$host" in -*-mingw*|*-cygwin*|*-msvc*|*-mks*) +*-mingw*) + NSINSTALL=nsinstall + ;; +*-cygwin*|*-msvc*|*-mks*) NSINSTALL='$(CYGWIN_WRAPPER) nsinstall' if test `echo "${PATH}" | grep -c \;` = 0; then CYGWIN_WRAPPER='sh $(topsrcdir)/build/cygwin-wrapper' @@ -915,91 +962,135 @@ 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 AC_DEFINE(XP_MACOSX) OS_TARGET=MacOSX - dnl The C preprocessor can only handle integers in comparisons, so - dnl convert the version to the form AABBCC where AA=major release, - dnl BB=minor release, and CC=point/micro release. - - MACOS_VERSION_MAJOR=`echo $MACOS_DEPLOYMENT_TARGET_STR | cut -d . -f 1` - MACOS_VERSION_MINOR=`echo $MACOS_DEPLOYMENT_TARGET_STR | cut -d . -f 2` - MACOS_VERSION_MICRO=`echo $MACOS_DEPLOYMENT_TARGET_STR | cut -d . -f 3` - if test -z "$MACOS_VERSION_MINOR"; then - MACOS_VERSION_MINOR=0 - fi - if test -z "$MACOS_VERSION_MICRO"; then - MACOS_VERSION_MICRO=0 - fi - MACOS_DEPLOYMENT_TARGET=`printf "%02d%02d%02d" "$MACOS_VERSION_MAJOR" "$MACOS_VERSION_MINOR" "$MACOS_VERSION_MICRO"` - AC_DEFINE_UNQUOTED(MACOS_DEPLOYMENT_TARGET, $MACOS_DEPLOYMENT_TARGET) - 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 - 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 powerpc-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=powerpc-apple-darwin`echo $NEXT_ROOT | $PERL -pe 's/MacOSX10\.([^\.]*)//;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" + if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then + dnl Use the specified value + export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET + elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then + dnl No value specified on the command line or in the environment, + dnl use the lesser of the library's minimum or the architecture's + dnl minimum. + case "${target_cpu}" in + powerpc*) + dnl Architecture minimum 10.1 + export MACOSX_DEPLOYMENT_TARGET=10.1 + ;; + i*86*) + dnl Architecture minimum 10.4 + export MACOSX_DEPLOYMENT_TARGET=10.4 + ;; + esac fi - if test -d "${NEXT_ROOT}/Library/Frameworks" ; then - SDK_C_INCLUDE="$SDK_C_INCLUDE -F${NEXT_ROOT}/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. - CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}" + if test "$MACOS_SDK_DIR"; then + dnl Sync this section with the one in Mozilla's top level. - dnl CPP needs to be set for AC_CHECK_HEADER. - CPP="$CPP -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 + + 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 ;; @@ -1325,7 +1416,20 @@ case "$target" in PR_MD_ASFILES=os_Linux_ia64.s ;; x86_64) - PR_MD_ASFILES=os_Linux_x86_64.s + if test -n "$USE_64"; then + PR_MD_ASFILES=os_Linux_x86_64.s + else + AC_DEFINE(i386) + PR_MD_ASFILES=os_Linux_x86.s + CC="$CC -m32" + CXX="$CXX -m32" + fi + ;; + powerpc64) + if test -n "$USE_64"; then + CC="$CC -m64" + CXX="$CXX -m64" + fi ;; m68k) CFLAGS="$CFLAGS -m68020-60" @@ -1679,6 +1783,17 @@ mips-sony-newsos*) PR_MD_CSRCS=qnx.c ;; +*-riscos*) + AC_DEFINE(XP_UNIX) + AC_DEFINE(RISCOS) + AC_DEFINE(_PR_NEED_H_ERRNO) + USE_PTHREADS=1 + MDCPUCFG_H=_riscos.cfg + PR_MD_CSRCS=riscos.c + DLL_SUFFIX=a + LD="/home/riscos/env/ro-ar cr" + ;; + *-*-sco*) AC_DEFINE(XP_UNIX) AC_DEFINE(SCO) @@ -2157,19 +2272,26 @@ echo " fi ]) -MOZ_CHECK_PTHREADS(pthreads, - _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads", - MOZ_CHECK_PTHREADS(pthread, - _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread", - MOZ_CHECK_PTHREADS(c_r, - _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r", - MOZ_CHECK_PTHREADS(c, - _HAVE_PTHREADS=1 +case "$target_os" in +darwin*) + _HAVE_PTHREADS=1 + ;; +*) + MOZ_CHECK_PTHREADS(pthreads, + _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads", + MOZ_CHECK_PTHREADS(pthread, + _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread", + MOZ_CHECK_PTHREADS(c_r, + _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r", + MOZ_CHECK_PTHREADS(c, + _HAVE_PTHREADS=1 + ) ) ) ) -) - + ;; +esac + AC_ARG_WITH(pthreads, [ --with-pthreads Use system pthreads library as thread subsystem], [ if test "$withval" = "yes"; then @@ -2213,7 +2335,8 @@ AC_ARG_ENABLE(nspr-threads, case "$target" in *-beos*) AC_ARG_WITH(bthreads, - [ --with-bthreads Use system bthreads library as thread subsystem (BeOS only)], + [ --with-bthreads Use system bthreads library as thread subsystem + (BeOS only)], [ if test "$withval" = "yes"; then USE_BTHREADS=1 USE_USER_PTHREADS= @@ -2223,7 +2346,8 @@ case "$target" in *-solaris*) AC_ARG_WITH(native-threads, - [ --with-native-threads Use native system threads as thread subsystem (Solaris only)], + [ --with-native-threads Use native system threads as thread subsystem + (Solaris only)], [ if test "$withval" = "yes"; then USE_NATIVE_THREADS=1 USE_USER_PTHREADS= @@ -2462,9 +2586,11 @@ case "$target" in PR_MD_ASFILES=os_SunOS_x86.s fi else - PR_MD_ASFILES=os_SunOS.s if test -n "$USE_64"; then - PR_MD_ASFILES="$PR_MD_ASFILES os_SunOS_sparcv9.s" + PR_MD_ASFILES=os_SunOS_sparcv9.s + fi + if test -n "$USE_NATIVE_THREADS"; then + PR_MD_ASFILES="$PR_MD_ASFILES os_SunOS.s" fi fi fi @@ -2512,10 +2638,10 @@ fi RELEASE_OBJDIR_NAME="${OS_CONFIG}${CPU_ARCH_TAG}${COMPILER_TAG}${IMPL_STRATEGY}${OBJDIR_TAG}.${OBJDIR_SUFFIX}" dnl ======================================================== -dnl Use cygwin wrapper for win32 builds +dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW dnl ======================================================== case "$target_os" in -mingw*|cygwin*|msvc*|mks*) +cygwin*|msvc*|mks*) CC="\$(CYGWIN_WRAPPER) $CC" CXX="\$(CYGWIN_WRAPPER) $CXX" RC="\$(CYGWIN_WRAPPER) $RC" @@ -2536,6 +2662,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) @@ -2582,7 +2709,7 @@ AC_SUBST(OS_TARGET) AC_SUBST(OS_ARCH) AC_SUBST(OS_RELEASE) AC_SUBST(OS_TEST) -AC_SUBST(MACOS_DEPLOYMENT_TARGET) +AC_SUBST(MACOSX_DEPLOYMENT_TARGET) AC_SUBST(DEFINES) AC_SUBST(DEFS) @@ -2617,6 +2744,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. diff --git a/pkg/linux/Makefile.in b/pkg/linux/Makefile.in index 473a616c..c2ef7e89 100644 --- a/pkg/linux/Makefile.in +++ b/pkg/linux/Makefile.in @@ -47,7 +47,7 @@ srcdir = @srcdir@ VPATH = @srcdir@ NAME = sun-nspr -RELEASE = 2 +RELEASE = 1 TOPDIR = /usr/src/redhat VERSION = `grep PR_VERSION $(dist_includedir)/prinit.h \ | sed -e 's/"$$//' -e 's/.*"//' -e 's/ .*//'` @@ -56,21 +56,51 @@ SPECFILE = $(NAME).spec include $(MOD_DEPTH)/config/autoconf.mk +# Force i386 for non 64 bit build +ifneq ($(USE_64),1) + RPMTARGET = "--target=i386" + RPMLIBDIR = lib +else + RPMLIBDIR = lib64 +endif + publish: $(MAKE) clean mkdir -p SOURCES SRPMS RPMS BUILD - (cd $(MOD_DEPTH)/../../dist/$(RELEASE_OBJDIR_NAME)/lib && tar cphf - .) \ - | (mkdir -p opt/sun/private/lib && cd opt/sun/private/lib && tar xvfBp -) - (cd $(MOD_DEPTH)/../../dist/$(RELEASE_OBJDIR_NAME)/include && tar cphf - .) \ + (cd $(dist_libdir) && tar cphf - libnspr4.so libplds4.so libplc4.so) \ + | (mkdir -p opt/sun/private/$(RPMLIBDIR) && cd opt/sun/private/$(RPMLIBDIR) && tar xvfBp -) + (cd $(dist_includedir) && tar cphf - .) \ | (mkdir -p opt/sun/private/include/nspr && cd opt/sun/private/include/nspr && tar xvfBp -) + (cd opt/sun/private/include/nspr && \ + rm -rf md private obsolete/pralarm.h obsolete/probslet.h obsolete/prsem.h) 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 buildroot `pwd`/$(NAME)-root" >>$(SPECFILE) echo "%define _topdir `pwd`" >>$(SPECFILE) + echo "%define _unpackaged_files_terminate_build 0" >>$(SPECFILE) cat $(srcdir)/$(NAME).spec >>$(SPECFILE) - rpm -ba $(SPECFILE) + echo "" >>$(SPECFILE) + echo "%files" >>$(SPECFILE) + echo "%defattr(-,root,root)" >>$(SPECFILE) + echo "%dir /opt" >>$(SPECFILE) + echo "%dir /opt/sun" >>$(SPECFILE) + echo "%dir /opt/sun/private" >>$(SPECFILE) + echo "%dir /opt/sun/private/$(RPMLIBDIR)" >>$(SPECFILE) + find opt \( -name "*.so" \) | sed -e "s-^-/-" >>$(SPECFILE) + echo "" >>$(SPECFILE) + echo "%files devel" >>$(SPECFILE) + echo "%defattr(-,root,root)" >>$(SPECFILE) + echo "%dir /opt" >>$(SPECFILE) + echo "%dir /opt/sun" >>$(SPECFILE) + echo "%dir /opt/sun/private" >>$(SPECFILE) + echo "%dir /opt/sun/private/include" >>$(SPECFILE) + echo "%dir /opt/sun/private/include/nspr" >>$(SPECFILE) + echo "%dir /opt/sun/private/include/nspr/obsolete" >>$(SPECFILE) + find opt -type f \( -name "*.h" \) \ + | sed -e "s-^-/-" >>$(SPECFILE) + rpmbuild $(RPMTARGET) -bb $(SPECFILE) clean: rm -rf $(TOPDIR)/BUILD/$(NAME) diff --git a/pkg/linux/sun-nspr.spec b/pkg/linux/sun-nspr.spec index 6006f4b2..f914736d 100644 --- a/pkg/linux/sun-nspr.spec +++ b/pkg/linux/sun-nspr.spec @@ -79,76 +79,3 @@ tar xvzf $RPM_SOURCE_DIR/%{name}-%{version}.tar.gz %clean rm -rf $RPM_BUILD_ROOT - -%files -%defattr(-,root,root) -%dir /opt -%dir /opt/sun -%dir /opt/sun/private -%dir /opt/sun/private/lib -/opt/sun/private/lib/libnspr4.so -/opt/sun/private/lib/libplc4.so -/opt/sun/private/lib/libplds4.so - -%files devel -%defattr(-,root,root) -%dir /opt -%dir /opt/sun -%dir /opt/sun/private -%dir /opt/sun/private/include -%dir /opt/sun/private/include/nspr -%dir /opt/sun/private/include/nspr/obsolete -/opt/sun/private/include/nspr/prcpucfg.h -/opt/sun/private/include/nspr/obsolete/protypes.h -/opt/sun/private/include/nspr/nspr.h -/opt/sun/private/include/nspr/pratom.h -/opt/sun/private/include/nspr/prbit.h -/opt/sun/private/include/nspr/prclist.h -/opt/sun/private/include/nspr/prcmon.h -/opt/sun/private/include/nspr/prcountr.h -/opt/sun/private/include/nspr/prcvar.h -/opt/sun/private/include/nspr/prdtoa.h -/opt/sun/private/include/nspr/prenv.h -/opt/sun/private/include/nspr/prerr.h -/opt/sun/private/include/nspr/prerror.h -/opt/sun/private/include/nspr/prinet.h -/opt/sun/private/include/nspr/prinit.h -/opt/sun/private/include/nspr/prinrval.h -/opt/sun/private/include/nspr/prio.h -/opt/sun/private/include/nspr/pripcsem.h -/opt/sun/private/include/nspr/prlink.h -/opt/sun/private/include/nspr/prlock.h -/opt/sun/private/include/nspr/prlog.h -/opt/sun/private/include/nspr/prlong.h -/opt/sun/private/include/nspr/prmem.h -/opt/sun/private/include/nspr/prmon.h -/opt/sun/private/include/nspr/prmwait.h -/opt/sun/private/include/nspr/prnetdb.h -/opt/sun/private/include/nspr/prolock.h -/opt/sun/private/include/nspr/prpdce.h -/opt/sun/private/include/nspr/prprf.h -/opt/sun/private/include/nspr/prproces.h -/opt/sun/private/include/nspr/prrng.h -/opt/sun/private/include/nspr/prrwlock.h -/opt/sun/private/include/nspr/prshma.h -/opt/sun/private/include/nspr/prshm.h -/opt/sun/private/include/nspr/prsystem.h -/opt/sun/private/include/nspr/prthread.h -/opt/sun/private/include/nspr/prtime.h -/opt/sun/private/include/nspr/prtpool.h -/opt/sun/private/include/nspr/prtrace.h -/opt/sun/private/include/nspr/prtypes.h -/opt/sun/private/include/nspr/prvrsion.h -/opt/sun/private/include/nspr/prwin16.h -/opt/sun/private/include/nspr/plarenas.h -/opt/sun/private/include/nspr/plarena.h -/opt/sun/private/include/nspr/plhash.h -/opt/sun/private/include/nspr/plbase64.h -/opt/sun/private/include/nspr/plerror.h -/opt/sun/private/include/nspr/plgetopt.h -/opt/sun/private/include/nspr/plresolv.h -/opt/sun/private/include/nspr/plstr.h - -%changelog -* Sat Jan 18 2003 Kirk Erickson -- http://bugzilla.mozilla.org/show_bug.cgi?id=189501 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 b5e8d04e..f4a1a4e0 100644 --- a/pr/include/md/_darwin.h +++ b/pr/include/md/_darwin.h @@ -42,11 +42,15 @@ #include +#ifdef XP_MACOSX +#include +#endif + #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" @@ -77,17 +81,21 @@ * if you pass an IPv4-mapped IPv6 address to it. */ #define _PR_GHBA_DISALLOW_V4MAPPED +#ifdef XP_MACOSX +#if !defined(MAC_OS_X_VERSION_10_3) || \ + MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_3 /* * socket(AF_INET6) fails with EPROTONOSUPPORT on Mac OS X 10.1. * IPv6 under OS X 10.2 and below is not complete (see bug 222031). */ -#if MACOS_DEPLOYMENT_TARGET < 100300 #define _PR_INET6_PROBE -#endif +#endif /* DT < 10.3 */ +#if defined(MAC_OS_X_VERSION_10_2) && \ + MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_2 /* Mac OS X 10.2 has inet_ntop and inet_pton. */ -#if MACOS_DEPLOYMENT_TARGET >= 100200 #define _PR_HAVE_INET_NTOP -#endif +#endif /* DT >= 10.2 */ +#endif /* XP_MACOSX */ #define _PR_IPV6_V6ONLY_PROBE /* The IPV6_V6ONLY socket option is not defined on Mac OS X 10.1. */ #ifndef IPV6_V6ONLY @@ -105,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/_linux.cfg b/pr/include/md/_linux.cfg index 465c64ea..776c21e0 100644 --- a/pr/include/md/_linux.cfg +++ b/pr/include/md/_linux.cfg @@ -48,7 +48,53 @@ #define PR_AF_INET6 10 /* same as AF_INET6 */ -#ifdef __powerpc__ +#ifdef __powerpc64__ + +#undef IS_LITTLE_ENDIAN +#define IS_BIG_ENDIAN 1 +#define IS_64 + +#define PR_BYTES_PER_BYTE 1 +#define PR_BYTES_PER_SHORT 2 +#define PR_BYTES_PER_INT 4 +#define PR_BYTES_PER_INT64 8 +#define PR_BYTES_PER_LONG 8 +#define PR_BYTES_PER_FLOAT 4 +#define PR_BYTES_PER_DOUBLE 8 +#define PR_BYTES_PER_WORD 8 +#define PR_BYTES_PER_DWORD 8 + +#define PR_BITS_PER_BYTE 8 +#define PR_BITS_PER_SHORT 16 +#define PR_BITS_PER_INT 32 +#define PR_BITS_PER_INT64 64 +#define PR_BITS_PER_LONG 64 +#define PR_BITS_PER_FLOAT 32 +#define PR_BITS_PER_DOUBLE 64 +#define PR_BITS_PER_WORD 64 + +#define PR_BITS_PER_BYTE_LOG2 3 +#define PR_BITS_PER_SHORT_LOG2 4 +#define PR_BITS_PER_INT_LOG2 5 +#define PR_BITS_PER_INT64_LOG2 6 +#define PR_BITS_PER_LONG_LOG2 6 +#define PR_BITS_PER_FLOAT_LOG2 5 +#define PR_BITS_PER_DOUBLE_LOG2 6 +#define PR_BITS_PER_WORD_LOG2 6 + +#define PR_ALIGN_OF_SHORT 2 +#define PR_ALIGN_OF_INT 4 +#define PR_ALIGN_OF_LONG 8 +#define PR_ALIGN_OF_INT64 8 +#define PR_ALIGN_OF_FLOAT 4 +#define PR_ALIGN_OF_DOUBLE 8 +#define PR_ALIGN_OF_POINTER 8 +#define PR_ALIGN_OF_WORD 8 + +#define PR_BYTES_PER_WORD_LOG2 3 +#define PR_BYTES_PER_DWORD_LOG2 3 + +#elif defined(__powerpc__) #undef IS_LITTLE_ENDIAN #define IS_BIG_ENDIAN 1 diff --git a/pr/include/md/_linux.h b/pr/include/md/_linux.h index 96e8f1c3..92a5f38a 100644 --- a/pr/include/md/_linux.h +++ b/pr/include/md/_linux.h @@ -46,7 +46,9 @@ #define PR_LINKER_ARCH "linux" #define _PR_SI_SYSNAME "LINUX" -#ifdef __powerpc__ +#ifdef __powerpc64__ +#define _PR_SI_ARCHITECTURE "ppc64" +#elif defined(__powerpc__) #define _PR_SI_ARCHITECTURE "ppc" #elif defined(__alpha) #define _PR_SI_ARCHITECTURE "alpha" diff --git a/pr/include/md/_pth.h b/pr/include/md/_pth.h index eb5c5dde..aadb45e0 100644 --- a/pr/include/md/_pth.h +++ b/pr/include/md/_pth.h @@ -146,7 +146,7 @@ || defined(HPUX) || defined(LINUX) || defined(FREEBSD) \ || defined(NETBSD) || defined(OPENBSD) || defined(BSDI) \ || defined(VMS) || defined(NTO) || defined(DARWIN) \ - || defined(UNIXWARE) + || defined(UNIXWARE) || defined(RISCOS) #define _PT_PTHREAD_INVALIDATE_THR_HANDLE(t) (t) = 0 #define _PT_PTHREAD_THR_HANDLE_IS_INVALID(t) (t) == 0 #define _PT_PTHREAD_COPY_THR_HANDLE(st, dt) (dt) = (st) @@ -259,7 +259,8 @@ #define PT_PRIO_MIN 0 #define PT_PRIO_MAX 31 #elif defined(NETBSD) \ - || defined(BSDI) || defined(DARWIN) || defined(UNIXWARE) /* XXX */ + || defined(BSDI) || defined(DARWIN) || defined(UNIXWARE) \ + || defined(RISCOS) /* XXX */ #define PT_PRIO_MIN 0 #define PT_PRIO_MAX 126 #else @@ -293,7 +294,7 @@ extern int (*_PT_aix_yield_fcn)(); #elif defined(HPUX) || defined(LINUX) || defined(SOLARIS) \ || defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \ || defined(BSDI) || defined(NTO) || defined(DARWIN) \ - || defined(UNIXWARE) + || defined(UNIXWARE) || defined(RISCOS) #define _PT_PTHREAD_YIELD() sched_yield() #else #error "Need to define _PT_PTHREAD_YIELD for this platform" diff --git a/pr/include/md/_riscos.cfg b/pr/include/md/_riscos.cfg new file mode 100644 index 00000000..86b88eb5 --- /dev/null +++ b/pr/include/md/_riscos.cfg @@ -0,0 +1,141 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** 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 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 + * 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___ + +#ifndef XP_UNIX +#define XP_UNIX +#endif + +#ifndef RISCOS +#define RISCOS +#endif + +#define IS_LITTLE_ENDIAN 1 +#undef IS_BIG_ENDIAN +#define HAVE_LONG_LONG +#undef HAVE_ALIGNED_DOUBLES +#undef HAVE_ALIGNED_LONGLONGS + +#define PR_BYTES_PER_BYTE 1 +#define PR_BYTES_PER_SHORT 2 +#define PR_BYTES_PER_INT 4 +#define PR_BYTES_PER_INT64 8 +#define PR_BYTES_PER_LONG 4 +#define PR_BYTES_PER_FLOAT 4 +#define PR_BYTES_PER_DOUBLE 8 +#define PR_BYTES_PER_WORD 4 +#define PR_BYTES_PER_DWORD 8 + +#define PR_BITS_PER_BYTE 8 +#define PR_BITS_PER_SHORT 16 +#define PR_BITS_PER_INT 32 +#define PR_BITS_PER_INT64 64 +#define PR_BITS_PER_LONG 32 +#define PR_BITS_PER_FLOAT 32 +#define PR_BITS_PER_DOUBLE 64 +#define PR_BITS_PER_WORD 32 + +#define PR_BITS_PER_BYTE_LOG2 3 +#define PR_BITS_PER_SHORT_LOG2 4 +#define PR_BITS_PER_INT_LOG2 5 +#define PR_BITS_PER_INT64_LOG2 6 +#define PR_BITS_PER_LONG_LOG2 5 +#define PR_BITS_PER_FLOAT_LOG2 5 +#define PR_BITS_PER_DOUBLE_LOG2 6 +#define PR_BITS_PER_WORD_LOG2 5 + +#define PR_ALIGN_OF_SHORT 2 +#define PR_ALIGN_OF_INT 4 +#define PR_ALIGN_OF_LONG 4 +#define PR_ALIGN_OF_INT64 4 +#define PR_ALIGN_OF_FLOAT 4 +#define PR_ALIGN_OF_DOUBLE 4 +#define PR_ALIGN_OF_POINTER 4 +#define PR_ALIGN_OF_WORD 4 + +#define PR_BYTES_PER_WORD_LOG2 2 +#define PR_BYTES_PER_DWORD_LOG2 3 +#define PR_WORDS_PER_DWORD_LOG2 1 + +#ifndef NO_NSPR_10_SUPPORT + +#define BYTES_PER_BYTE PR_BYTES_PER_BYTE +#define BYTES_PER_SHORT PR_BYTES_PER_SHORT +#define BYTES_PER_INT PR_BYTES_PER_INT +#define BYTES_PER_INT64 PR_BYTES_PER_INT64 +#define BYTES_PER_LONG PR_BYTES_PER_LONG +#define BYTES_PER_FLOAT PR_BYTES_PER_FLOAT +#define BYTES_PER_DOUBLE PR_BYTES_PER_DOUBLE +#define BYTES_PER_WORD PR_BYTES_PER_WORD +#define BYTES_PER_DWORD PR_BYTES_PER_DWORD + +#define BITS_PER_BYTE PR_BITS_PER_BYTE +#define BITS_PER_SHORT PR_BITS_PER_SHORT +#define BITS_PER_INT PR_BITS_PER_INT +#define BITS_PER_INT64 PR_BITS_PER_INT64 +#define BITS_PER_LONG PR_BITS_PER_LONG +#define BITS_PER_FLOAT PR_BITS_PER_FLOAT +#define BITS_PER_DOUBLE PR_BITS_PER_DOUBLE +#define BITS_PER_WORD PR_BITS_PER_WORD + +#define BITS_PER_BYTE_LOG2 PR_BITS_PER_BYTE_LOG2 +#define BITS_PER_SHORT_LOG2 PR_BITS_PER_SHORT_LOG2 +#define BITS_PER_INT_LOG2 PR_BITS_PER_INT_LOG2 +#define BITS_PER_INT64_LOG2 PR_BITS_PER_INT64_LOG2 +#define BITS_PER_LONG_LOG2 PR_BITS_PER_LONG_LOG2 +#define BITS_PER_FLOAT_LOG2 PR_BITS_PER_FLOAT_LOG2 +#define BITS_PER_DOUBLE_LOG2 PR_BITS_PER_DOUBLE_LOG2 +#define BITS_PER_WORD_LOG2 PR_BITS_PER_WORD_LOG2 + +#define ALIGN_OF_SHORT PR_ALIGN_OF_SHORT +#define ALIGN_OF_INT PR_ALIGN_OF_INT +#define ALIGN_OF_LONG PR_ALIGN_OF_LONG +#define ALIGN_OF_INT64 PR_ALIGN_OF_INT64 +#define ALIGN_OF_FLOAT PR_ALIGN_OF_FLOAT +#define ALIGN_OF_DOUBLE PR_ALIGN_OF_DOUBLE +#define ALIGN_OF_POINTER PR_ALIGN_OF_POINTER +#define ALIGN_OF_WORD PR_ALIGN_OF_WORD + +#define BYTES_PER_WORD_LOG2 PR_BYTES_PER_WORD_LOG2 +#define BYTES_PER_DWORD_LOG2 PR_BYTES_PER_DWORD_LOG2 +#define WORDS_PER_DWORD_LOG2 PR_WORDS_PER_DWORD_LOG2 + +#endif /* NO_NSPR_10_SUPPORT */ + +#endif /* nspr_cpucfg___ */ diff --git a/pr/include/md/_riscos.h b/pr/include/md/_riscos.h new file mode 100644 index 00000000..5a0309eb --- /dev/null +++ b/pr/include/md/_riscos.h @@ -0,0 +1,209 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** 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 the Initial Developer are Copyright (C) 1998-2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): Peter Naulls + * + * 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_riscos_defs_h___ +#define nspr_riscos_defs_h___ + +/* +** Internal configuration macros +*/ +#define PR_LINKER_ARCH "riscos" +#define _PR_SI_SYSNAME "RISCOS" +#define _PR_SI_ARCHITECTURE "arm" +#define PR_DLL_SUFFIX ".a" + +#define _PR_POLL_AVAILABLE +#define _PR_USE_POLL +#define _PR_HAVE_SOCKADDR_LEN +#undef HAVE_BSD_FLOCK +#define _PR_NO_LARGE_FILES +#define _PR_STAT_HAS_ONLY_ST_ATIME +#define _PR_HAVE_POSIX_SEMAPHORES + +#include +#include +#include + + +#undef HAVE_STACK_GROWING_UP +#undef HAVE_DLL +#undef USE_DLFCN +#define NEED_STRFTIME_LOCK +#define NEED_TIME_R +#define PT_NO_SIGTIMEDWAIT + +#ifndef HAVE_STRERROR +#define HAVE_STRERROR +#endif + +#define USE_SETJMP + +#include + +#define _SETJMP setjmp +#define _LONGJMP longjmp +#define _PR_CONTEXT_TYPE jmp_buf +#define _PR_NUM_GCREGS _JBLEN +#define _MD_GET_SP(_t) (_t)->md.context[7] + +#define CONTEXT(_th) ((_th)->md.context) + + +/* +** Initialize the thread context preparing it to execute _main. +*/ +#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \ +{ \ + *status = PR_TRUE; \ + if(_SETJMP(CONTEXT(_thread))) (*_main)(); \ + _MD_GET_SP(_thread) = (int) ((_sp) - 128); \ +} + +#define _MD_SWITCH_CONTEXT(_thread) \ + if (!_SETJMP(CONTEXT(_thread))) { \ + (_thread)->md.errcode = errno; \ + _PR_Schedule(); \ + } + +/* +** Restore a thread context, saved by _MD_SWITCH_CONTEXT +*/ +#define _MD_RESTORE_CONTEXT(_thread) \ +{ \ + errno = (_thread)->md.errcode; \ + _MD_SET_CURRENT_THREAD(_thread); \ + _LONGJMP(CONTEXT(_thread), 1); \ +} + +/* +** Machine-dependent (MD) data structures. +*/ +struct _MDThread { + _PR_CONTEXT_TYPE context; + int id; + int errcode; +}; + +struct _MDThreadStack { + PRInt8 notused; +}; + +struct _MDLock { + PRInt8 notused; +}; + +struct _MDSemaphore { + PRInt8 notused; +}; + +struct _MDCVar { + PRInt8 notused; +}; + +struct _MDSegment { + PRInt8 notused; +}; + +/* +** md-specific cpu structure field +*/ +#define _PR_MD_MAX_OSFD FD_SETSIZE + +struct _MDCPU_Unix { + PRCList ioQ; + PRUint32 ioq_timeout; + PRInt32 ioq_max_osfd; + PRInt32 ioq_osfd_cnt; +#ifndef _PR_USE_POLL + fd_set fd_read_set, fd_write_set, fd_exception_set; + PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD], fd_write_cnt[_PR_MD_MAX_OSFD], fd_exception_cnt[_PR_MD_MAX_OSFD]; +#else + struct pollfd *ioq_pollfds; + int ioq_pollfds_size; +#endif +}; + +#define _PR_IOQ(_cpu) /* */ ((_cpu)->md.md_unix.ioQ) +#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu)) +#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set) +#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt) +#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set) +#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt) +#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set) +#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt) +#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout) +#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd) +#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt) +#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds) +#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size) + +#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32 + +struct _MDCPU { + struct _MDCPU_Unix md_unix; +}; + +#define _MD_INIT_LOCKS() +#define _MD_NEW_LOCK(lock) PR_SUCCESS +#define _MD_FREE_LOCK(lock) +#define _MD_LOCK(lock) +#define _MD_UNLOCK(lock) +#define _MD_INIT_IO() +#define _MD_IOQ_LOCK() +#define _MD_IOQ_UNLOCK() + +#define _MD_GET_INTERVAL _PR_UNIX_GetInterval +#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond +#define _MD_EARLY_INIT _MD_EarlyInit +#define _MD_FINAL_INIT _PR_UnixInit +#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu) +#define _MD_INIT_THREAD _MD_InitializeThread +#define _MD_EXIT_THREAD(thread) +#define _MD_SUSPEND_THREAD(thread) +#define _MD_RESUME_THREAD(thread) +#define _MD_CLEAN_THREAD(_thread) + +/* +** We wrapped the select() call. _MD_SELECT refers to the built-in, +** unwrapped version. +*/ +#include +#include +#include +#define _MD_SELECT select + +#endif /* nspr_riscos_defs_h___ */ diff --git a/pr/include/md/_win95.h b/pr/include/md/_win95.h index 4e61fdf3..cd26bd63 100644 --- a/pr/include/md/_win95.h +++ b/pr/include/md/_win95.h @@ -72,6 +72,22 @@ struct addrinfo { struct addrinfo *ai_next; }; #endif +#define _PR_HAVE_MD_SOCKADDR_IN6 +/* isomorphic to struct in6_addr on Windows */ +struct _md_in6_addr { + union { + PRUint8 _S6_u8[16]; + PRUint16 _S6_u16[8]; + } _S6_un; +}; +/* isomorphic to struct sockaddr_in6 on Windows */ +struct _md_sockaddr_in6 { + PRInt16 sin6_family; + PRUint16 sin6_port; + PRUint32 sin6_flowinfo; + struct _md_in6_addr sin6_addr; + PRUint32 sin6_scope_id; +}; #endif #define _PR_HAVE_THREADSAFE_GETHOST #define _PR_HAVE_ATOMIC_OPS diff --git a/pr/include/md/_winnt.h b/pr/include/md/_winnt.h index 36cbcfae..0e6ce819 100644 --- a/pr/include/md/_winnt.h +++ b/pr/include/md/_winnt.h @@ -87,6 +87,22 @@ struct addrinfo { struct addrinfo *ai_next; }; #endif +#define _PR_HAVE_MD_SOCKADDR_IN6 +/* isomorphic to struct in6_addr on Windows */ +struct _md_in6_addr { + union { + PRUint8 _S6_u8[16]; + PRUint16 _S6_u16[8]; + } _S6_un; +}; +/* isomorphic to struct sockaddr_in6 on Windows */ +struct _md_sockaddr_in6 { + PRInt16 sin6_family; + PRUint16 sin6_port; + PRUint32 sin6_flowinfo; + struct _md_in6_addr sin6_addr; + PRUint32 sin6_scope_id; +}; #endif #define _PR_HAVE_THREADSAFE_GETHOST #define _PR_HAVE_ATOMIC_OPS diff --git a/pr/include/md/prosdep.h b/pr/include/md/prosdep.h index 93496520..3e141d02 100644 --- a/pr/include/md/prosdep.h +++ b/pr/include/md/prosdep.h @@ -138,6 +138,9 @@ PR_BEGIN_EXTERN_C #elif defined(NTO) #include "md/_nto.h" +#elif defined(RISCOS) +#include "md/_riscos.h" + #else #error unknown Unix flavor diff --git a/pr/include/prinit.h b/pr/include/prinit.h index 70b4567d..029cfccb 100644 --- a/pr/include/prinit.h +++ b/pr/include/prinit.h @@ -63,10 +63,10 @@ PR_BEGIN_EXTERN_C ** The format of the version string is ** ".[.] []" */ -#define PR_VERSION "4.6" +#define PR_VERSION "4.6.1" #define PR_VMAJOR 4 #define PR_VMINOR 6 -#define PR_VPATCH 0 +#define PR_VPATCH 1 #define PR_BETA PR_FALSE /* diff --git a/pr/include/private/primpl.h b/pr/include/private/primpl.h index 07d4a3ed..eebcb841 100644 --- a/pr/include/private/primpl.h +++ b/pr/include/private/primpl.h @@ -1409,7 +1409,7 @@ extern PRUintn _PR_NetAddrSize(const PRNetAddr* addr); #define PR_NETADDR_SIZE(_addr) \ ((_addr)->raw.family == PR_AF_INET \ ? sizeof((_addr)->inet) \ - : sizeof(struct _md_sockaddr_in6) + : sizeof(struct _md_sockaddr_in6)) #endif /* defined(XP_UNIX) */ #else diff --git a/pr/include/prlink.h b/pr/include/prlink.h index 06fb1b35..b2eb5141 100644 --- a/pr/include/prlink.h +++ b/pr/include/prlink.h @@ -125,8 +125,8 @@ NSPR_API(PRLibrary*) PR_LoadLibrary(const char *name); typedef enum PRLibSpecType { PR_LibSpec_Pathname, - PR_LibSpec_MacNamedFragment, - PR_LibSpec_MacIndexedFragment + PR_LibSpec_MacNamedFragment, /* obsolete (for Mac OS Classic) */ + PR_LibSpec_MacIndexedFragment /* obsolete (for Mac OS Classic) */ } PRLibSpecType; struct FSSpec; /* Mac OS FSSpec */ @@ -141,13 +141,13 @@ typedef struct PRLibSpec { struct { const struct FSSpec *fsspec; const char *name; - } mac_named_fragment; + } mac_named_fragment; /* obsolete (for Mac OS Classic) */ /* if type is PR_LibSpec_MacIndexedFragment */ struct { const struct FSSpec *fsspec; PRUint32 index; - } mac_indexed_fragment; + } mac_indexed_fragment; /* obsolete (for Mac OS Classic) */ } value; } PRLibSpec; diff --git a/pr/include/prthread.h b/pr/include/prthread.h index 7c44feb2..dba1c9b8 100644 --- a/pr/include/prthread.h +++ b/pr/include/prthread.h @@ -44,7 +44,7 @@ ** is not guaranteed, so programming using priority based synchronization ** is a no-no. ** -** NSPR threads are scheduled based loosly on their client set priority. +** NSPR threads are scheduled based loosely on their client set priority. ** In general, a thread of a higher priority has a statistically better ** chance of running relative to threads of lower priority. However, ** NSPR uses multiple strategies to provide execution vehicles for thread diff --git a/pr/src/Makefile.in b/pr/src/Makefile.in index cf2f5229..d3605901 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 diff --git a/pr/src/io/prprf.c b/pr/src/io/prprf.c index b7ac9812..cd5760a9 100644 --- a/pr/src/io/prprf.c +++ b/pr/src/io/prprf.c @@ -394,7 +394,7 @@ static int cvt_s(SprintfState *ss, const char *s, int width, int prec, } /* -** BiuldArgArray stands for Numbered Argument list Sprintf +** BuildArgArray stands for Numbered Argument list Sprintf ** for example, ** fmp = "%4$i, %2$d, %3s, %1d"; ** the number must start from 1, and no gap among them @@ -410,7 +410,7 @@ static struct NumArg* BuildArgArray( const char *fmt, va_list ap, int* rv, struc /* ** first pass: - ** detemine how many legal % I have got, then allocate space + ** determine how many legal % I have got, then allocate space */ p = fmt; diff --git a/pr/src/io/prscanf.c b/pr/src/io/prscanf.c index 6fad0f70..618f184f 100644 --- a/pr/src/io/prscanf.c +++ b/pr/src/io/prscanf.c @@ -639,7 +639,7 @@ StringGetChar(void *stream) return EOF; } else { *((char **) stream) = cPtr + 1; - return *cPtr; + return (unsigned char) *cPtr; } } diff --git a/pr/src/linking/Makefile.in b/pr/src/linking/Makefile.in index 71fbf571..ee418453 100644 --- a/pr/src/linking/Makefile.in +++ b/pr/src/linking/Makefile.in @@ -69,7 +69,7 @@ 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 325decb5..55831bf7 100644 --- a/pr/src/linking/prlink.c +++ b/pr/src/linking/prlink.c @@ -40,13 +40,11 @@ #include #endif -#if defined(XP_MAC) || defined(XP_MACOSX) +#ifdef XP_MACOSX #include #include #include #include - -#if TARGET_CARBON #include #include #include @@ -54,14 +52,6 @@ #include #endif -#if defined(XP_MACOSX) -#define PStrFromCStr(src, dst) c2pstrcpy(dst, src) -#else -#include "macdll.h" -#include "mdmac.h" -#endif /* XP_MACOSX */ -#endif - #ifdef XP_UNIX #ifdef USE_DLFCN #include @@ -183,19 +173,12 @@ struct PRLibrary { #endif #endif -#if defined(XP_MAC) || defined(XP_MACOSX) +#ifdef XP_MACOSX CFragConnectionID connection; - -#if TARGET_CARBON CFBundleRef bundle; -#endif - Ptr main; - -#if defined(XP_MACOSX) CFMutableDictionaryRef wrappers; const struct mach_header* image; -#endif /* XP_MACOSX */ #endif #ifdef XP_UNIX @@ -220,12 +203,6 @@ static PRMonitor *pr_linker_lock; static char* _pr_currentLibPath = NULL; static PRLibrary *pr_LoadLibraryByPathname(const char *name, PRIntn flags); -#ifdef XP_MAC -static PRLibrary *pr_Mac_LoadNamedFragment(const FSSpec *fileSpec, - const char* fragmentName); -static PRLibrary *pr_Mac_LoadIndexedFragment(const FSSpec *fileSpec, - PRUint32 fragIndex); -#endif /* XP_MAC */ /************************************************************************/ @@ -262,9 +239,7 @@ static void DLLErrorInternal(PRIntn oserr) void _PR_InitLinker(void) { -#if !defined(XP_MAC) && !defined(XP_BEOS) - PRLibrary *lm; -#endif + PRLibrary *lm = NULL; #if defined(XP_UNIX) void *h; #endif @@ -331,9 +306,10 @@ void _PR_InitLinker(void) #endif /* HAVE_DLL */ #endif /* XP_UNIX */ -#if !defined(XP_MAC) && !defined(XP_BEOS) - PR_LOG(_pr_linker_lm, PR_LOG_MIN, ("Loaded library %s (init)", lm?lm->name:"NULL")); -#endif + if (lm) { + PR_LOG(_pr_linker_lm, PR_LOG_MIN, + ("Loaded library %s (init)", lm->name)); + } PR_ExitMonitor(pr_linker_lock); } @@ -440,25 +416,6 @@ PR_GetLibraryPath(void) ev = strdup(ev); #endif -#ifdef XP_MAC - { - char *p; - int len; - - ev = getenv("LD_LIBRARY_PATH"); - - if (!ev) - ev = ""; - - len = strlen(ev) + 1; /* +1 for the null */ - p = (char*) malloc(len); - if (p) { - strcpy(p, ev); - } - ev = p; - } -#endif - #if defined(XP_UNIX) || defined(XP_BEOS) #if defined(USE_DLFCN) || defined(USE_MACH_DYLD) || defined(XP_BEOS) { @@ -532,13 +489,6 @@ PR_GetLibraryName(const char *path, const char *lib) } } #endif /* XP_PC */ -#ifdef XP_MAC - if (path) { - fullname = PR_smprintf("%s%s", path, lib); - } else { - fullname = PR_smprintf("%s", lib); - } -#endif #if defined(XP_UNIX) || defined(XP_BEOS) if (strstr(lib, PR_DLL_SUFFIX) == NULL) { @@ -606,16 +556,6 @@ PR_LoadLibraryWithFlags(PRLibSpec libSpec, PRIntn flags) switch (libSpec.type) { case PR_LibSpec_Pathname: return pr_LoadLibraryByPathname(libSpec.value.pathname, flags); -#ifdef XP_MAC - case PR_LibSpec_MacNamedFragment: - return pr_Mac_LoadNamedFragment( - libSpec.value.mac_named_fragment.fsspec, - libSpec.value.mac_named_fragment.name); - case PR_LibSpec_MacIndexedFragment: - return pr_Mac_LoadIndexedFragment( - libSpec.value.mac_indexed_fragment.fsspec, - libSpec.value.mac_indexed_fragment.index); -#endif /* XP_MAC */ default: PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0); return NULL; @@ -657,9 +597,8 @@ pr_LoadMachDyldModule(const char *name) } #endif -#if defined(XP_MAC) || defined(XP_MACOSX) - #ifdef XP_MACOSX + static void* TV2FP(CFMutableDictionaryRef dict, const char* name, void *tvp) { static uint32 glue[6] = { 0x3D800000, 0x618C0000, 0x800C0000, 0x804C0004, 0x7C0903A6, 0x4E800420 }; @@ -693,7 +632,6 @@ static void* TV2FP(CFMutableDictionaryRef dict, const char* name, void *tvp) return newGlue; } -#endif /* ** macLibraryLoadProc is a function definition for a Mac shared library @@ -709,117 +647,47 @@ static PRStatus pr_LoadViaCFM(const char *name, PRLibrary *lm) { OSErr err; - char cName[64]; Str255 errName; - -#if !defined(XP_MACOSX) - Str255 pName; + FSRef ref; + FSSpec fileSpec; + Boolean tempUnusedBool; + /* - * Algorithm: The "name" passed in could be either a shared - * library name that we should look for in the normal library - * search paths, or a full path name to a specific library on - * disk. Since the full path will always contain a ":" - * (shortest possible path is "Volume:File"), and since a - * library name can not contain a ":", we can test for the - * presence of a ":" to see which type of library we should load. - * or its a full UNIX path which we for now assume is Java - * enumerating all the paths (see below) + * Make an FSSpec from the path name and call GetDiskFragment. */ - if (strchr(name, PR_PATH_SEPARATOR) == NULL) { - if (strchr(name, PR_DIRECTORY_SEPARATOR) == NULL) { - /* - * The name did not contain a ":", so it must be a - * library name. Convert the name to a Pascal string - * and try to find the library. - */ - } else { - /* - * name contained a "/" which means we need to suck off - * the last part of the path and pass that on the - * NSGetSharedLibrary. this may not be what we really - * want to do .. because Java could be iterating through - * the whole LD path, and we'll find it if it's anywhere - * on that path -- it appears that's what UNIX and the - * PC do too...so we'll emulate but it could be wrong. - */ - name = strrchr(name, PR_DIRECTORY_SEPARATOR) + 1; - } - PStrFromCStr(name, pName); - - /* - * beard: NSGetSharedLibrary was so broken that I just decided to - * use GetSharedLibrary for now. This will need to change for - * plugins, but those should go in the Extensions folder anyhow. - */ - err = GetSharedLibrary(pName, kCompiledCFragArch, kReferenceCFrag, - &lm->connection, &lm->main, errName); - if (err != noErr) - return PR_FAILURE; - } - else -#endif - { - /* - * The name did contain a ":", so it must be a full path name. - * Now we have to do a lot of work to convert the path name to - * an FSSpec (silly, since we were probably just called from the - * MacFE plug-in code that already knew the FSSpec and converted - * it to a full path just to pass to us). Make an FSSpec from - * the full path and call GetDiskFragment. - */ - FSSpec fileSpec; - Boolean tempUnusedBool; - -#if defined(XP_MACOSX) - { - /* Use direct conversion of POSIX path to FSRef to FSSpec. */ - FSRef ref; - err = FSPathMakeRef((const UInt8*)name, &ref, NULL); - if (err == noErr) - err = FSGetCatalogInfo(&ref, kFSCatInfoNone, NULL, NULL, - &fileSpec, NULL); - } -#else - PStrFromCStr(name, pName); - err = FSMakeFSSpec(0, 0, pName, &fileSpec); -#endif - if (err != noErr) - return PR_FAILURE; - - /* Resolve an alias if this was one */ - err = ResolveAliasFile(&fileSpec, true, &tempUnusedBool, - &tempUnusedBool); - if (err != noErr) - return PR_FAILURE; + /* Use direct conversion of POSIX path to FSRef to FSSpec. */ + err = FSPathMakeRef((const UInt8*)name, &ref, NULL); + if (err != noErr) + return PR_FAILURE; + err = FSGetCatalogInfo(&ref, kFSCatInfoNone, NULL, NULL, + &fileSpec, NULL); + if (err != noErr) + return PR_FAILURE; - /* Finally, try to load the library */ - err = GetDiskFragment(&fileSpec, 0, kCFragGoesToEOF, fileSpec.name, - kLoadCFrag, &lm->connection, &lm->main, errName); + /* Resolve an alias if this was one */ + err = ResolveAliasFile(&fileSpec, true, &tempUnusedBool, + &tempUnusedBool); + if (err != noErr) + return PR_FAILURE; -#if TARGET_CARBON - p2cstrcpy(cName, fileSpec.name); -#else - memcpy(cName, fileSpec.name + 1, fileSpec.name[0]); - cName[fileSpec.name[0]] = '\0'; -#endif + /* Finally, try to load the library */ + err = GetDiskFragment(&fileSpec, 0, kCFragGoesToEOF, fileSpec.name, + kLoadCFrag, &lm->connection, &lm->main, errName); -#ifdef XP_MACOSX - if (err == noErr && lm->connection) { - /* - * if we're a mach-o binary, need to wrap all CFM function - * pointers. need a hash-table of already seen function - * pointers, etc. - */ - lm->wrappers = CFDictionaryCreateMutable(NULL, 16, - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); - if (lm->wrappers) { - lm->main = TV2FP(lm->wrappers, "main", lm->main); - } else - err = memFullErr; - } -#endif + if (err == noErr && lm->connection) { + /* + * if we're a mach-o binary, need to wrap all CFM function + * pointers. need a hash-table of already seen function + * pointers, etc. + */ + lm->wrappers = CFDictionaryCreateMutable(NULL, 16, + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + if (lm->wrappers) { + lm->main = TV2FP(lm->wrappers, "main", lm->main); + } else + err = memFullErr; } return (err == noErr) ? PR_SUCCESS : PR_FAILURE; } @@ -830,14 +698,11 @@ pr_LoadViaCFM(const char *name, PRLibrary *lm) ** deallocate. */ -#if TARGET_CARBON static PRStatus pr_LoadCFBundle(const char *name, PRLibrary *lm) { CFURLRef bundleURL; CFBundleRef bundle = NULL; - -#ifdef XP_MACOSX char pathBuf[PATH_MAX]; const char *resolvedPath; CFStringRef pathRef; @@ -857,34 +722,11 @@ pr_LoadCFBundle(const char *name, PRLibrary *lm) } CFRelease(pathRef); } -#else - OSErr err; - Str255 pName; - FSSpec fsSpec; - FSRef fsRef; - - if ((UInt32)(CFURLCreateFromFSRef) == kUnresolvedCFragSymbolAddress) - return PR_FAILURE; - PStrFromCStr(name, pName); - err = FSMakeFSSpec(0, 0, pName, &fsSpec); - if (err != noErr) - return PR_FAILURE; - err = FSpMakeFSRef(&fsSpec, &fsRef); - if (err != noErr) - return PR_FAILURE; - bundleURL = CFURLCreateFromFSRef(NULL, &fsRef); - if (bundleURL) { - bundle = CFBundleCreate(NULL, bundleURL); - CFRelease(bundleURL); - } -#endif lm->bundle = bundle; return (bundle != NULL) ? PR_SUCCESS : PR_FAILURE; } -#endif -#ifdef XP_MACOSX static PRStatus pr_LoadViaDyld(const char *name, PRLibrary *lm) { @@ -899,9 +741,8 @@ pr_LoadViaDyld(const char *name, PRLibrary *lm) } return (lm->dlh != NULL || lm->image != NULL) ? PR_SUCCESS : PR_FAILURE; } -#endif -#endif /* defined(XP_MAC) || defined(XP_MACOSX) */ +#endif /* XP_MACOSX */ /* ** Dynamically load a library. Only load libraries once, so scan the load @@ -965,19 +806,13 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags) } #endif /* WIN32 || WIN16 */ -#if defined(XP_MAC) || defined(XP_MACOSX) +#ifdef XP_MACOSX { int i; PRStatus status; static const macLibraryLoadProc loadProcs[] = { -#if defined(XP_MACOSX) pr_LoadViaDyld, pr_LoadCFBundle, pr_LoadViaCFM -#elif TARGET_CARBON - pr_LoadViaCFM, pr_LoadCFBundle -#else - pr_LoadViaCFM -#endif }; for (i = 0; i < sizeof(loadProcs) / sizeof(loadProcs[0]); i++) { @@ -1165,136 +1000,6 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags) return result; } - -#ifdef XP_MAC - -static PRLibrary* -pr_Mac_LoadNamedFragment(const FSSpec *fileSpec, const char* fragmentName) -{ - PRLibrary* newLib = NULL; - PRLibrary* result; - FSSpec resolvedSpec = *fileSpec; - CFragConnectionID connectionID = 0; - Boolean isFolder, wasAlias; - OSErr err = noErr; - - if (!_pr_initialized) _PR_ImplicitInitialization(); - - /* See if library is already loaded */ - PR_EnterMonitor(pr_linker_lock); - - result = pr_UnlockedFindLibrary(fragmentName); - if (result != NULL) goto unlock; - - newLib = PR_NEWZAP(PRLibrary); - if (newLib == NULL) goto unlock; - newLib->staticTable = NULL; - - - /* Resolve an alias if this was one */ - err = ResolveAliasFile(&resolvedSpec, true, &isFolder, &wasAlias); - if (err != noErr) - goto unlock; - - if (isFolder) - { - err = fnfErr; - goto unlock; - } - - /* Finally, try to load the library */ - err = NSLoadNamedFragment(&resolvedSpec, fragmentName, &connectionID); - if (err != noErr) - goto unlock; - - newLib->name = strdup(fragmentName); - newLib->connection = connectionID; - newLib->next = pr_loadmap; - pr_loadmap = newLib; - - result = newLib; /* success */ - PR_LOG(_pr_linker_lm, PR_LOG_MIN, ("Loaded library %s (load lib)", newLib->name)); - -unlock: - if (result == NULL) { - if (newLib != NULL) - PR_DELETE(newLib); - PR_SetError(PR_LOAD_LIBRARY_ERROR, _MD_ERRNO()); - DLLErrorInternal(_MD_ERRNO()); /* sets error text */ - } - PR_ExitMonitor(pr_linker_lock); - return result; -} - - -static PRLibrary* -pr_Mac_LoadIndexedFragment(const FSSpec *fileSpec, PRUint32 fragIndex) -{ - PRLibrary* newLib = NULL; - PRLibrary* result; - FSSpec resolvedSpec = *fileSpec; - char* fragmentName = NULL; - UInt32 fragOffset, fragLength; - CFragConnectionID connectionID = 0; - Boolean isFolder, wasAlias; - OSErr err = noErr; - - if (!_pr_initialized) _PR_ImplicitInitialization(); - - /* See if library is already loaded */ - PR_EnterMonitor(pr_linker_lock); - - /* Resolve an alias if this was one */ - err = ResolveAliasFile(&resolvedSpec, true, &isFolder, &wasAlias); - if (err != noErr) - goto unlock; - - if (isFolder) - { - err = fnfErr; - goto unlock; - } - err = GetIndexedFragmentOffsets(&resolvedSpec, fragIndex, &fragOffset, &fragLength, &fragmentName); - if (err != noErr) goto unlock; - - result = pr_UnlockedFindLibrary(fragmentName); - free(fragmentName); - fragmentName = NULL; - if (result != NULL) goto unlock; - - newLib = PR_NEWZAP(PRLibrary); - if (newLib == NULL) goto unlock; - newLib->staticTable = NULL; - - /* Finally, try to load the library */ - err = NSLoadIndexedFragment(&resolvedSpec, fragIndex, &fragmentName, &connectionID); - if (err != noErr) { - PR_DELETE(newLib); - goto unlock; - } - - newLib->name = fragmentName; /* was malloced in NSLoadIndexedFragment */ - newLib->connection = connectionID; - newLib->next = pr_loadmap; - pr_loadmap = newLib; - - result = newLib; /* success */ - PR_LOG(_pr_linker_lm, PR_LOG_MIN, ("Loaded library %s (load lib)", newLib->name)); - -unlock: - if (result == NULL) { - if (newLib != NULL) - PR_DELETE(newLib); - PR_SetError(PR_LOAD_LIBRARY_ERROR, _MD_ERRNO()); - DLLErrorInternal(_MD_ERRNO()); /* sets error text */ - } - PR_ExitMonitor(pr_linker_lock); - return result; -} - - -#endif - /* ** Unload a shared library which was loaded via PR_LoadLibrary */ @@ -1344,19 +1049,15 @@ PR_UnloadLibrary(PRLibrary *lib) } #endif /* XP_PC */ -#if defined(XP_MAC) || defined(XP_MACOSX) +#ifdef XP_MACOSX /* Close the connection */ if (lib->connection) CloseConnection(&(lib->connection)); -#if TARGET_CARBON if (lib->bundle) CFRelease(lib->bundle); -#endif -#if defined(XP_MACOSX) if (lib->wrappers) CFRelease(lib->wrappers); /* No way to unload an image (lib->image) */ -#endif #endif /* unlink from library search list */ @@ -1447,13 +1148,9 @@ pr_FindSymbolInLib(PRLibrary *lm, const char *name) f = GetProcAddress(lm->dlh, name); #endif /* WIN32 || WIN16 */ -#if defined(XP_MAC) || defined(XP_MACOSX) -#if defined(NEED_LEADING_UNDERSCORE) +#ifdef XP_MACOSX +/* add this offset to skip the leading underscore in name */ #define SYM_OFFSET 1 -#else -#define SYM_OFFSET 0 -#endif -#if TARGET_CARBON if (lm->bundle) { CFStringRef nameRef = CFStringCreateWithCString(NULL, name + SYM_OFFSET, kCFStringEncodingASCII); if (nameRef) { @@ -1461,7 +1158,6 @@ pr_FindSymbolInLib(PRLibrary *lm, const char *name) CFRelease(nameRef); } } -#endif if (lm->connection) { Ptr symAddr; CFragSymbolClass symClass; @@ -1469,24 +1165,17 @@ pr_FindSymbolInLib(PRLibrary *lm, const char *name) PR_LOG(_pr_linker_lm, PR_LOG_MIN, ("Looking up symbol: %s", name + SYM_OFFSET)); - PStrFromCStr(name + SYM_OFFSET, pName); + c2pstrcpy(pName, name + SYM_OFFSET); -#if defined(XP_MACOSX) f = (FindSymbol(lm->connection, pName, &symAddr, &symClass) == noErr) ? symAddr : NULL; -#else - f = (NSFindSymbol(lm->connection, pName, &symAddr, &symClass) == noErr) ? symAddr : NULL; -#endif -#if defined(XP_MACOSX) /* callers expect mach-o function pointers, so must wrap tvectors with glue. */ if (f && symClass == kTVectorCFragSymbol) { f = TV2FP(lm->wrappers, name + SYM_OFFSET, f); } -#endif if (f == NULL && strcmp(name + SYM_OFFSET, "main") == 0) f = lm->main; } -#if defined(XP_MACOSX) if (lm->image) { NSSymbol symbol; symbol = NSLookupSymbolInImage(lm->image, name, @@ -1497,9 +1186,8 @@ pr_FindSymbolInLib(PRLibrary *lm, const char *name) else f = NULL; } -#endif #undef SYM_OFFSET -#endif /* XP_MAC */ +#endif /* XP_MACOSX */ #ifdef XP_BEOS if( B_NO_ERROR != get_image_symbol( (image_id)lm->dlh, name, B_SYMBOL_TYPE_TEXT, &f ) ) { @@ -1670,11 +1358,7 @@ PR_LoadStaticLibrary(const char *name, const PRStaticLinkTable *slt) lm->name = strdup(name); lm->refCount = 1; -#if defined(XP_MAC) - lm->connection = pr_exe_loadmap ? pr_exe_loadmap->connection : 0; -#else lm->dlh = pr_exe_loadmap ? pr_exe_loadmap->dlh : 0; -#endif lm->staticTable = slt; lm->next = pr_loadmap; pr_loadmap = lm; diff --git a/pr/src/malloc/prmem.c b/pr/src/malloc/prmem.c index 59077c24..73fa59bc 100644 --- a/pr/src/malloc/prmem.c +++ b/pr/src/malloc/prmem.c @@ -115,6 +115,8 @@ _PR_DestroyZones(void) ** its address. */ +#ifdef HAVE_DLL + #ifdef USE_DLFCN #include @@ -163,6 +165,17 @@ pr_FindSymbolInProg(const char *name) #endif +#else /* !defined(HAVE_DLL) */ + +static void * +pr_FindSymbolInProg(const char *name) +{ + /* can't be implemented */ + return NULL; +} + +#endif /* HAVE_DLL */ + void _PR_InitZones(void) { 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/riscos.c b/pr/src/md/unix/riscos.c new file mode 100644 index 00000000..eee94d3d --- /dev/null +++ b/pr/src/md/unix/riscos.c @@ -0,0 +1,120 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** 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 the Initial Developer are Copyright (C) 1998-2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): Peter Naulls + * + * 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" + +void _MD_EarlyInit(void) +{ +} + +PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np) +{ +#ifndef _PR_PTHREADS + if (isCurrent) { + (void) setjmp(CONTEXT(t)); + } + *np = sizeof(CONTEXT(t)) / sizeof(PRWord); + return (PRWord *) CONTEXT(t); +#else + *np = 0; + return NULL; +#endif +} + +#ifdef _PR_PTHREADS + +void _MD_CleanupBeforeExit(void) +{ +} + +#else /* ! _PR_PTHREADS */ + +void +_MD_SET_PRIORITY(_MDThread *thread, PRUintn newPri) +{ + return; +} + +PRStatus +_MD_InitializeThread(PRThread *thread) +{ + /* + * set the pointers to the stack-pointer and frame-pointer words in the + * context structure; this is for debugging use. + */ + thread->md.sp = _MD_GET_SP_PTR(thread); + thread->md.fp = _MD_GET_FP_PTR(thread); + return PR_SUCCESS; +} + +PRStatus +_MD_WAIT(PRThread *thread, PRIntervalTime ticks) +{ + PR_ASSERT(!(thread->flags & _PR_GLOBAL_SCOPE)); + _PR_MD_SWITCH_CONTEXT(thread); + return PR_SUCCESS; +} + +PRStatus +_MD_WAKEUP_WAITER(PRThread *thread) +{ + if (thread) { + PR_ASSERT(!(thread->flags & _PR_GLOBAL_SCOPE)); + } + return PR_SUCCESS; +} + +/* These functions should not be called for RISC OS */ +void +_MD_YIELD(void) +{ + PR_NOT_REACHED("_MD_YIELD should not be called for RISC OS."); +} + +PRStatus +_MD_CREATE_THREAD( + PRThread *thread, + void (*start) (void *), + PRThreadPriority priority, + PRThreadScope scope, + PRThreadState state, + PRUint32 stackSize) +{ + PR_NOT_REACHED("_MD_CREATE_THREAD should not be called for RISC OS."); + return PR_FAILURE; +} +#endif /* ! _PR_PTHREADS */ diff --git a/pr/src/md/unix/unix.c b/pr/src/md/unix/unix.c index eb73f053..0776bf1a 100644 --- a/pr/src/md/unix/unix.c +++ b/pr/src/md/unix/unix.c @@ -75,7 +75,7 @@ #define _PRSockLen_t int #elif (defined(AIX) && !defined(AIX4_1)) || defined(FREEBSD) \ || defined(NETBSD) || defined(OPENBSD) || defined(UNIXWARE) \ - || defined(DGUX) || defined(VMS) || defined(NTO) + || defined(DGUX) || defined(VMS) || defined(NTO) || defined(RISCOS) #define _PRSockLen_t size_t #else #error "Cannot determine architecture" diff --git a/pr/src/md/unix/uxrng.c b/pr/src/md/unix/uxrng.c index 9099c5ff..9e912277 100644 --- a/pr/src/md/unix/uxrng.c +++ b/pr/src/md/unix/uxrng.c @@ -298,7 +298,7 @@ GetHighResClock(void *buf, size_t maxbytes) return 0; } #elif defined(SCO) || defined(UNIXWARE) || defined(BSDI) || defined(NTO) \ - || defined(QNX) || defined(DARWIN) + || defined(QNX) || defined(DARWIN) || defined(RISCOS) #include static size_t 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..88b33558 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 @@ -84,6 +85,8 @@ static const PRTime _pr_filetime_offset = 116444736000000000i64; static void InitUnicodeSupport(void); #endif +static PRBool IsPrevCharSlash(const char *str, const char *current); + void _PR_MD_INIT_IO() { @@ -516,7 +519,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 +657,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 +674,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 +731,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 +745,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 +835,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/misc/prdtoa.c b/pr/src/misc/prdtoa.c index 3f06feaf..b7432a2f 100644 --- a/pr/src/misc/prdtoa.c +++ b/pr/src/misc/prdtoa.c @@ -328,10 +328,11 @@ static double private_mem[PRIVATE_mem], *pmem_next = private_mem; * to allow 10.2 builds to run on 10.1, since we can't use fesetround() * (which does not exist on 10.1 either). */ -#if defined(MACOS_DEPLOYMENT_TARGET) && (MACOS_DEPLOYMENT_TARGET < 100200) +#if defined(XP_MACOSX) && (!defined(MAC_OS_X_VERSION_10_2) || \ + MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_2) #undef FLT_ROUNDS #define FLT_ROUNDS 1 -#endif +#endif /* DT < 10.2 */ #endif /* Bad_float_h */ #ifndef __MATH_H__ diff --git a/pr/src/misc/prnetdb.c b/pr/src/misc/prnetdb.c index edccde85..63b21070 100644 --- a/pr/src/misc/prnetdb.c +++ b/pr/src/misc/prnetdb.c @@ -188,8 +188,8 @@ static PRBool _pr_have_inet6_if = PR_FALSE; #if defined(AIX) \ || (defined(DARWIN) && (!defined(HAVE_GETIFADDRS) \ - || (defined(MACOS_DEPLOYMENT_TARGET) \ - && MACOS_DEPLOYMENT_TARGET < 100200))) + || (defined(XP_MACOSX) && (!defined(MAC_OS_X_VERSION_10_2) || \ + MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_2)))) /* * Use SIOCGIFCONF ioctl on platforms that don't have routing diff --git a/pr/src/misc/prsystem.c b/pr/src/misc/prsystem.c index d0775d34..40c6eaac 100644 --- a/pr/src/misc/prsystem.c +++ b/pr/src/misc/prsystem.c @@ -255,6 +255,8 @@ PR_IMPLEMENT(PRInt32) PR_GetNumberOfProcessors( void ) } #elif defined(IRIX) numCpus = sysconf( _SC_NPROC_ONLN ); +#elif defined(RISCOS) + numCpus = 1; #elif defined(XP_UNIX) numCpus = sysconf( _SC_NPROCESSORS_ONLN ); #else @@ -276,20 +278,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) @@ -301,7 +303,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) @@ -317,16 +319,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) @@ -336,7 +338,7 @@ PR_IMPLEMENT(PRUint64) PR_GetPhysicalMemorySize(void) QSV_TOTPHYSMEM, &ulPhysMem, sizeof(ulPhysMem)); - LL_I2L(bytes, ulPhysMem); + bytes = ulPhysMem; #elif defined(AIX) @@ -344,9 +346,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/pthreads/ptio.c b/pr/src/pthreads/ptio.c index 1479846d..7a4ce96f 100644 --- a/pr/src/pthreads/ptio.c +++ b/pr/src/pthreads/ptio.c @@ -199,17 +199,6 @@ static ssize_t (*pt_aix_sendfile_fptr)() = NULL; static PRBool _pr_ipv6_v6only_on_by_default; #endif -#if defined(SOLARIS) -#define _PRSockOptVal_t char * -#elif defined(IRIX) || defined(OSF1) || defined(AIX) || defined(HPUX) \ - || defined(LINUX) || defined(FREEBSD) || defined(BSDI) || defined(VMS) \ - || defined(NTO) || defined(OPENBSD) || defined(DARWIN) \ - || defined(UNIXWARE) || defined(NETBSD) -#define _PRSockOptVal_t void * -#else -#error "Cannot determine architecture" -#endif - #if (defined(HPUX) && !defined(HPUX10_30) && !defined(HPUX11)) #define _PRSelectFdSetArg_t int * #elif defined(AIX4_1) @@ -219,7 +208,7 @@ static PRBool _pr_ipv6_v6only_on_by_default; || defined(HPUX10_30) || defined(HPUX11) || defined(LINUX) \ || defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \ || defined(BSDI) || defined(VMS) || defined(NTO) || defined(DARWIN) \ - || defined(UNIXWARE) + || defined(UNIXWARE) || defined(RISCOS) #define _PRSelectFdSetArg_t fd_set * #else #error "Cannot determine architecture" @@ -3243,7 +3232,7 @@ static PRIOMethods _pr_socketpollfd_methods = { #if defined(HPUX) || defined(OSF1) || defined(SOLARIS) || defined (IRIX) \ || defined(AIX) || defined(LINUX) || defined(FREEBSD) || defined(NETBSD) \ || defined(OPENBSD) || defined(BSDI) || defined(VMS) || defined(NTO) \ - || defined(DARWIN) || defined(UNIXWARE) + || defined(DARWIN) || defined(UNIXWARE) || defined(RISCOS) #define _PR_FCNTL_FLAGS O_NONBLOCK #else #error "Can't determine architecture" diff --git a/pr/src/pthreads/ptthread.c b/pr/src/pthreads/ptthread.c index 4cd70dcc..c8b41c11 100644 --- a/pr/src/pthreads/ptthread.c +++ b/pr/src/pthreads/ptthread.c @@ -248,11 +248,11 @@ static void *_pt_root(void *arg) /* * Here we set the pthread's backpointer to the PRThread to NULL. - * Otherwise the desctructor would get called eagerly as the thread + * Otherwise the destructor would get called eagerly as the thread * returns to the pthread runtime. The joining thread would them be * the proud possessor of a dangling reference. However, this is the * last chance to delete the object if the thread is detached, so - * just let the destuctor do the work. + * just let the destructor do the work. */ if (PR_FALSE == detached) { @@ -1233,7 +1233,8 @@ static void suspend_signal_handler(PRIntn sig) while (me->suspend & PT_THREAD_SUSPENDED) { #if !defined(FREEBSD) && !defined(NETBSD) && !defined(OPENBSD) \ - && !defined(BSDI) && !defined(VMS) && !defined(UNIXWARE) && !defined(DARWIN) /*XXX*/ + && !defined(BSDI) && !defined(VMS) && !defined(UNIXWARE) \ + && !defined(DARWIN) && !defined(RISCOS) /*XXX*/ PRIntn rv; sigwait(&sigwait_set, &rv); #endif diff --git a/pr/tests/server_test.c b/pr/tests/server_test.c index ffe37a5e..8bb6d99b 100644 --- a/pr/tests/server_test.c +++ b/pr/tests/server_test.c @@ -230,9 +230,9 @@ WorkerThreadFunc(void *_listenSock) PR_UNJOINABLE_THREAD, THREAD_STACKSIZE); - if (!WorkerThread) + if (!WorkerThread) { if (debug_mode) printf("Error creating client thread %d\n", workerThreads); - else { + } else { PR_AtomicIncrement(&workerThreads); if (debug_mode) DPRINTF("\tServer creates worker (%d)\n", workerThreads); } @@ -259,11 +259,12 @@ WorkerThreadFunc(void *_listenSock) bytesToWrite, 0, PR_INTERVAL_NO_TIMEOUT); - if (bytesWritten != _server_data) + if (bytesWritten != _server_data) { if (debug_mode) printf("\tError sending data to client (%d, %d)\n", bytesWritten, PR_GetOSError()); - else + } else { if (debug_mode) DPRINTF("\tServer sent %d bytes\n", bytesWritten); + } PR_Close(newSock); PR_AtomicDecrement(&workerThreadsBusy); diff --git a/pr/tests/servr_kk.c b/pr/tests/servr_kk.c index a8fdf1df..9fbb9b00 100644 --- a/pr/tests/servr_kk.c +++ b/pr/tests/servr_kk.c @@ -196,9 +196,9 @@ WorkerThreadFunc(void *_listenSock) PR_UNJOINABLE_THREAD, THREAD_STACKSIZE); - if (!WorkerThread) + if (!WorkerThread) { if (debug_mode) printf("Error creating client thread %d\n", workerThreads); - else { + } else { PR_AtomicIncrement(&workerThreads); if (debug_mode) DPRINTF("\tServer creates worker (%d)\n", workerThreads); } @@ -225,11 +225,12 @@ WorkerThreadFunc(void *_listenSock) bytesToWrite, 0, PR_INTERVAL_NO_TIMEOUT); - if (bytesWritten != _server_data) + if (bytesWritten != _server_data) { if (debug_mode) printf("\tError sending data to client (%d, %d)\n", bytesWritten, PR_GetOSError()); - else + } else { if (debug_mode) DPRINTF("\tServer sent %d bytes\n", bytesWritten); + } PR_Close(newSock); PR_AtomicDecrement(&workerThreadsBusy); diff --git a/pr/tests/servr_ku.c b/pr/tests/servr_ku.c index fa0a168e..ab2083d0 100644 --- a/pr/tests/servr_ku.c +++ b/pr/tests/servr_ku.c @@ -197,9 +197,9 @@ WorkerThreadFunc(void *_listenSock) PR_UNJOINABLE_THREAD, THREAD_STACKSIZE); - if (!WorkerThread) + if (!WorkerThread) { if (debug_mode) printf("Error creating client thread %d\n", workerThreads); - else { + } else { PR_AtomicIncrement(&workerThreads); if (debug_mode) DPRINTF("\tServer creates worker (%d)\n", workerThreads); } @@ -226,11 +226,12 @@ WorkerThreadFunc(void *_listenSock) bytesToWrite, 0, PR_INTERVAL_NO_TIMEOUT); - if (bytesWritten != _server_data) + if (bytesWritten != _server_data) { if (debug_mode) printf("\tError sending data to client (%d, %d)\n", bytesWritten, PR_GetOSError()); - else + } else { if (debug_mode) DPRINTF("\tServer sent %d bytes\n", bytesWritten); + } PR_Close(newSock); PR_AtomicDecrement(&workerThreadsBusy); diff --git a/pr/tests/servr_uk.c b/pr/tests/servr_uk.c index 139081af..727b7b47 100644 --- a/pr/tests/servr_uk.c +++ b/pr/tests/servr_uk.c @@ -199,9 +199,9 @@ WorkerThreadFunc(void *_listenSock) PR_UNJOINABLE_THREAD, THREAD_STACKSIZE); - if (!WorkerThread) + if (!WorkerThread) { if (debug_mode) printf("Error creating client thread %d\n", workerThreads); - else { + } else { PR_AtomicIncrement(&workerThreads); if (debug_mode) DPRINTF("\tServer creates worker (%d)\n", workerThreads); } @@ -228,11 +228,12 @@ WorkerThreadFunc(void *_listenSock) bytesToWrite, 0, PR_INTERVAL_NO_TIMEOUT); - if (bytesWritten != _server_data) + if (bytesWritten != _server_data) { if (debug_mode) printf("\tError sending data to client (%d, %d)\n", bytesWritten, PR_GetOSError()); - else + } else { if (debug_mode) DPRINTF("\tServer sent %d bytes\n", bytesWritten); + } PR_Close(newSock); PR_AtomicDecrement(&workerThreadsBusy); diff --git a/pr/tests/servr_uu.c b/pr/tests/servr_uu.c index 3bd1d574..020fadf6 100644 --- a/pr/tests/servr_uu.c +++ b/pr/tests/servr_uu.c @@ -197,9 +197,9 @@ WorkerThreadFunc(void *_listenSock) PR_UNJOINABLE_THREAD, THREAD_STACKSIZE); - if (!WorkerThread) + if (!WorkerThread) { if (debug_mode) printf("Error creating client thread %d\n", workerThreads); - else { + } else { PR_AtomicIncrement(&workerThreads); if (debug_mode) DPRINTF("\tServer creates worker (%d)\n", workerThreads); } @@ -226,11 +226,12 @@ WorkerThreadFunc(void *_listenSock) bytesToWrite, 0, PR_INTERVAL_NO_TIMEOUT); - if (bytesWritten != _server_data) + if (bytesWritten != _server_data) { if (debug_mode) printf("\tError sending data to client (%d, %d)\n", bytesWritten, PR_GetOSError()); - else + } else { if (debug_mode) DPRINTF("\tServer sent %d bytes\n", bytesWritten); + } PR_Close(newSock); PR_AtomicDecrement(&workerThreadsBusy); diff --git a/pr/tests/vercheck.c b/pr/tests/vercheck.c index d1fdb96e..5174c0b3 100644 --- a/pr/tests/vercheck.c +++ b/pr/tests/vercheck.c @@ -52,14 +52,14 @@ #include /* - * This release (4.6) is backward compatible with the - * 4.0.x, 4.1.x, 4.2.x, 4.3.x, 4.4.x, and 4.5.x releases. It, of course, - * is compatible with itself. + * 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. */ 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", PR_VERSION + "4.5", "4.5.1", "4.6", PR_VERSION }; /* -- cgit v1.2.1