diff options
author | cvs2hg <devnull@localhost> | 2000-09-30 04:26:33 +0000 |
---|---|---|
committer | cvs2hg <devnull@localhost> | 2000-09-30 04:26:33 +0000 |
commit | 243be6b0636ed58baea0d4b14e9205e17909b36b (patch) | |
tree | 77db407e06c6d9202b952d54017d654f01d05eda | |
parent | c946b6be47b3c83eef19f3347c17af256a08ef50 (diff) | |
download | nspr-hg-SeaMonkey_M18_BRANCH.tar.gz |
fixup commit for branch 'SeaMonkey_M18_BRANCH'SeaMonkey_M18_BRANCH
89 files changed, 1306 insertions, 541 deletions
@@ -44,6 +44,11 @@ ifdef PR_CLIENT_BUILD_UNIX endif endif +distclean:: + @echo "cd pr/tests; $(MAKE) $@" + @$(MAKE) -C pr/tests $@ + rm -f config/my_config.mk config/my_overrides.mk + release:: echo $(BUILD_NUMBER) > $(RELEASE_DIR)/$(BUILD_NUMBER)/version.df @if test -f imports.df; then \ diff --git a/Makefile.in b/Makefile.in index 8ff221b8..46cfe727 100644 --- a/Makefile.in +++ b/Makefile.in @@ -31,6 +31,8 @@ PR_CLIENT_BUILD = 1 PR_CLIENT_BUILD_UNIX = 1 endif +DIST_GARBAGE = config.cache config.log config.status + include $(topsrcdir)/config/rules.mk # @@ -49,6 +51,12 @@ ifdef PR_CLIENT_BUILD_UNIX endif endif +# Delete config/autoconf.mk last because it is included by every makefile. +distclean:: + @echo "cd pr/tests; $(MAKE) $@" + @$(MAKE) -C pr/tests $@ + rm -f config/autoconf.mk + release:: echo $(BUILD_NUMBER) > $(RELEASE_DIR)/$(BUILD_NUMBER)/version.df @if test -f imports.df; then \ diff --git a/config/BSD_OS.mk b/config/BSD_OS.mk index f3d96ffe..dba353db 100644 --- a/config/BSD_OS.mk +++ b/config/BSD_OS.mk @@ -21,7 +21,7 @@ include $(MOD_DEPTH)/config/UNIX.mk -ifeq (,$(filter-out 1.1 4.0 4.0.1,$(OS_RELEASE))) +ifeq (,$(filter-out 1.1 4.%,$(OS_RELEASE))) CC = gcc -Wall -Wno-format CCC = g++ else @@ -64,7 +64,7 @@ OS_CFLAGS += -D_PR_STAT_HAS_ONLY_ST_ATIME -D_PR_NEED_H_ERRNO else OS_CFLAGS += -DHAVE_DLL -DUSE_DLFCN -D_PR_STAT_HAS_ST_ATIMESPEC OS_LIBS = -ldl -ifeq (,$(filter-out 4.0 4.0.1,$(OS_RELEASE))) +ifeq (,$(filter-out 4.%,$(OS_RELEASE))) MKSHLIB = $(CC) $(DSO_LDOPTS) DSO_CFLAGS = -fPIC DSO_LDOPTS = -shared -Wl,-soname,$(@:$(OBJDIR)/%.so=%.so) diff --git a/config/BeOS.mk b/config/BeOS.mk index 87dc2085..ef2a6a46 100644 --- a/config/BeOS.mk +++ b/config/BeOS.mk @@ -30,6 +30,7 @@ OBJ_SUFFIX = o LIB_SUFFIX = a DLL_SUFFIX = so AR = ar cr $@ +STRIP = strip ifdef BUILD_OPT DEFINES = -UDEBUG -DNDEBUG diff --git a/config/Linux.mk b/config/Linux.mk index 29832d08..c7aae11b 100644 --- a/config/Linux.mk +++ b/config/Linux.mk @@ -47,12 +47,10 @@ IMPL_STRATEGY = _PTH DEFINES += -D_REENTRANT endif -USE_IPV6 = 1 - ifeq (86,$(findstring 86,$(OS_TEST))) CPU_ARCH := x86 else -ifeq (,$(filter-out armv4l sa110,$(OS_TEST))) +ifeq (,$(filter-out arm% sa110,$(OS_TEST))) CPU_ARCH := arm else CPU_ARCH := $(OS_TEST) @@ -101,6 +99,8 @@ endif MKSHLIB = $(LD) $(DSO_LDOPTS) -soname $(notdir $@) ifdef BUILD_OPT OPTIMIZER = -O2 +# invoke 'strip' on *.so files in optimized builds +STRIP = strip endif ###################################################################### diff --git a/config/Makefile.in b/config/Makefile.in index a0004143..4302c6e1 100644 --- a/config/Makefile.in +++ b/config/Makefile.in @@ -27,6 +27,10 @@ include $(MOD_DEPTH)/config/autoconf.mk # Indicate that this directory builds build tools. INTERNAL_TOOLS = 1 +# autoconf.mk must be deleted last (from the top-level directory) +# because it is included by every makefile. +DIST_GARBAGE = nsprincl.mk nsprincl.sh + include $(topsrcdir)/config/config.mk CSRCS = nsinstall.c now.c diff --git a/config/NTO.mk b/config/NTO.mk index a0b53ecd..49eee1fe 100644 --- a/config/NTO.mk +++ b/config/NTO.mk @@ -55,7 +55,7 @@ OS_CFLAGS = -Wc,-Wall -Wc,-Wno-parentheses -DNTO \ -D_QNX_SOURCE -DHAVE_POINTER_LOCALTIME_R -shared COMPILER_TAG = _qcc -MKSHLIB = qcc -Vgcc_ntox86 -shared -Wl,-h$(@:$(OBJDIR)/%.so=%.so) -g2 -M +MKSHLIB = qcc -Vgcc_ntox86 -shared -Wl,-h$(@:$(OBJDIR)/%.so=%.so) -M RANLIB = ranlib G++INCLUDES = @@ -63,9 +63,9 @@ OS_LIBS = EXTRA_LIBS = -lsocket ifdef BUILD_OPT -OPTIMIZER = -O2 +OPTIMIZER = -O1 else -OPTIMIZER = -O2 -gdwarf-2 +OPTIMIZER = -O1 -gstabs endif NOSUCHFILE = /no-such-file diff --git a/config/NetBSD.mk b/config/NetBSD.mk index 1aeac473..cb2211ad 100644 --- a/config/NetBSD.mk +++ b/config/NetBSD.mk @@ -25,6 +25,10 @@ CC = gcc CCC = g++ RANLIB = ranlib +ifndef OBJECT_FMT +OBJECT_FMT := $(shell if echo __ELF__ | $${CC:-cc} -E - | grep -q __ELF__ ; then echo a.out ; else echo ELF ; fi) +endif + OS_REL_CFLAGS = ifeq (86,$(findstring 86,$(OS_TEST))) CPU_ARCH = x86 @@ -44,20 +48,15 @@ endif ARCH = netbsd +ifeq ($(OBJECT_FMT),ELF) +DLL_SUFFIX = so +else DLL_SUFFIX = so.1.0 +endif -DSO_CFLAGS = -fPIC +DSO_CFLAGS = -fPIC -DPIC DSO_LDFLAGS = -DSO_LDOPTS = -Bshareable -ifeq ($(OS_TEST),alpha) -DSO_LDOPTS = -shared -endif -ifeq ($(OS_TEST),mips) -DSO_LDOPTS = -shared -endif -ifeq ($(OS_TEST),pmax) -DSO_LDOPTS = -shared -endif +DSO_LDOPTS = -x -shared ifdef LIBRUNPATH DSO_LDOPTS += -R$(LIBRUNPATH) diff --git a/config/OS2.mk b/config/OS2.mk index 3f008cb9..dba3901d 100644 --- a/config/OS2.mk +++ b/config/OS2.mk @@ -49,10 +49,11 @@ SHELL = GBASH.EXE CC = icc -q -DXP_OS2 -N10 CCC = icc -q -DXP_OS2 -DOS2=4 -N10 -LINK = ilink -AR = ilib /noignorecase /nologo /Out:$(subst /,\\,$@) +LINK = -ilink +AR = -ilib /noignorecase /nologo /Out:$(subst /,\\,$@) RANLIB = @echo RANLIB BSDECHO = @echo BSDECHO +STRIP = @echo STRIP NSINSTALL = nsinstall INSTALL = $(NSINSTALL) MAKE_OBJDIR = if test ! -d $(OBJDIR); then mkdir $(OBJDIR); fi @@ -67,8 +68,8 @@ LIB_SUFFIX = lib DLL_SUFFIX = dll OBJ_SUFFIX = obj -OS_CFLAGS = -W3 -Wcnd- -gm -gd+ -sd- -su4 -ge- -OS_EXE_CFLAGS = -W3 -Wcnd- -gm -gd+ -sd- -su4 +OS_CFLAGS = -W3 -Wcnd- -gm -gd+ -sd- -su4 -ge- -Mp +OS_EXE_CFLAGS = -W3 -Wcnd- -gm -gd+ -sd- -su4 -Mp AR_EXTRA_ARGS = ifdef BUILD_OPT diff --git a/config/OpenBSD.mk b/config/OpenBSD.mk index 35d474fd..b3314605 100644 --- a/config/OpenBSD.mk +++ b/config/OpenBSD.mk @@ -35,16 +35,16 @@ endif OS_CFLAGS = $(DSO_CFLAGS) $(OS_REL_CFLAGS) -ansi -Wall -pipe $(THREAD_FLAG) -DOPENBSD -DHAVE_STRERROR -DHAVE_BSD_FLOCK ifeq ($(USE_PTHREADS),1) -OS_LIBS = -lc_r THREAD_FLAG += -pthread # XXX probably should define _THREAD_SAFE too. else -OS_LIBS = -lc DEFINES += -D_PR_LOCAL_THREADS_ONLY endif ARCH = openbsd +DLL_SUFFIX = so.1.0 + DSO_CFLAGS = -fPIC DSO_LDFLAGS = DSO_LDOPTS = -Bshareable diff --git a/config/Rhapsody.mk b/config/Rhapsody.mk index 7f3c9116..afc1352e 100644 --- a/config/Rhapsody.mk +++ b/config/Rhapsody.mk @@ -21,12 +21,19 @@ include $(MOD_DEPTH)/config/UNIX.mk -CC = cc -ifeq ($(OS_RELEASE),5.0) -CCC = cc++ +# +# The default implementation strategy for Rhapsody is pthreads. +# +ifeq ($(CLASSIC_NSPR),1) +IMPL_STRATEGY = _EMU +DEFINES += -D_PR_LOCAL_THREADS_ONLY else -CCC = c++ +USE_PTHREADS = 1 +IMPL_STRATEGY = _PTH endif + +CC = cc +CCC = c++ RANLIB = ranlib ifeq (86,$(findstring 86,$(OS_TEST))) @@ -49,8 +56,6 @@ endif OS_CFLAGS = $(DSO_CFLAGS) $(OS_REL_CFLAGS) -Wmost -fno-common -pipe -DRHAPSODY -DHAVE_STRERROR -DHAVE_BSD_FLOCK -DEFINES += -D_PR_LOCAL_THREADS_ONLY - ARCH = rhapsody # May override this with -bundle to create a loadable module. diff --git a/config/UNIX.mk b/config/UNIX.mk index b9868973..e3fab8d1 100644 --- a/config/UNIX.mk +++ b/config/UNIX.mk @@ -21,6 +21,7 @@ OBJ_SUFFIX = o LIB_SUFFIX = a DLL_SUFFIX = so AR = ar cr $@ +STRIP = true ifdef BUILD_OPT OPTIMIZER = -O diff --git a/config/WIN32.mk b/config/WIN32.mk index 375c80c3..9121d724 100644 --- a/config/WIN32.mk +++ b/config/WIN32.mk @@ -35,6 +35,7 @@ LINK = link AR = lib -NOLOGO -OUT:"$@" RANLIB = echo BSDECHO = echo +STRIP = echo NSINSTALL = nsinstall INSTALL = $(NSINSTALL) define MAKE_OBJDIR @@ -53,14 +54,7 @@ OS_CFLAGS = -W3 -nologo -GF -Gy ifdef BUILD_OPT OS_CFLAGS += -MD -# The -O2 optimization of MSVC 6.0 SP3 appears to generate -# code that is unsafe for our use of fibers and static thread -# local storage. We temporarily work around this problem by -# turning off global optimizations (-Og). OPTIMIZER = -O2 -ifeq ($(OS_TARGET),WINNT) -OPTIMIZER += -Og- -endif DEFINES = -UDEBUG -U_DEBUG -DNDEBUG DLLFLAGS = -OUT:"$@" OBJDIR_TAG = _OPT diff --git a/config/arch.mk b/config/arch.mk index 67734e44..35a448aa 100644 --- a/config/arch.mk +++ b/config/arch.mk @@ -50,6 +50,9 @@ OS_ARCH := UNIXWARE OS_RELEASE := $(shell uname -v) endif endif +ifeq ($(OS_ARCH),Mac OS) +OS_ARCH := Rhapsody +endif ifeq ($(OS_ARCH),ncr) OS_ARCH := NCR endif @@ -57,10 +60,6 @@ endif ifeq ($(OS_ARCH),NCR) OS_RELEASE := $(shell awk '{print $$3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$$/\2.\3/') endif -ifeq ($(OS_ARCH),procnto) -OS_ARCH := NTO -OS_RELEASE := _$(OS_TEST)$(OS_RELEASE) -endif ifeq ($(OS_ARCH),UNIX_System_V) OS_ARCH := NEC endif @@ -70,7 +69,12 @@ CPU_ARCH := $(shell uname -Wh) OS_RELEASE := $(shell uname -v) endif ifeq ($(OS_ARCH),QNX) -OS_RELEASE := $(shell uname -v | sed 's/^\([0-9]\)\([0-9]*\)$$/\1.\2/') + ifeq ($(OS_RELEASE),6.00) + OS_ARCH := NTO + OS_RELEASE := _$(OS_TEST)$(OS_RELEASE) + else + OS_RELEASE := $(shell uname -v | sed 's/^\([0-9]\)\([0-9]*\)$$/\1.\2/') + endif endif ifeq ($(OS_ARCH),SCO_SV) OS_ARCH := SCOOS diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in index 83b7a86f..8979f323 100644 --- a/config/autoconf.mk.in +++ b/config/autoconf.mk.in @@ -10,6 +10,8 @@ DLL_SUFFIX = @DLL_SUFFIX@ MOD_VERSION = @NSPR_VERSION@ MOD_NAME = @NSPR_MODNAME@ +BUILD_OPT = @MOZ_OPTIMIZE@ + USE_CPLUS = @USE_CPLUS@ USE_IPV6 = @USE_IPV6@ USE_N32 = @USE_N32@ @@ -32,6 +34,7 @@ PERL = @PERL@ DLLTOOL = @DLLTOOL@ WINDRES = @WINDRES@ RC = $(WINDRES) +STRIP = @STRIP@ OS_CFLAGS = @CFLAGS@ $(DSO_CFLAGS) OS_CXXFLAGS = @CXXFLAGS@ $(DSO_CFLAGS) diff --git a/config/config.mk b/config/config.mk index 4f7863f2..a3c1674d 100644 --- a/config/config.mk +++ b/config/config.mk @@ -75,6 +75,10 @@ endif GARBAGE += $(DEPENDENCIES) core $(wildcard core.[0-9]*) +ifdef USE_AUTOCONF +DIST_GARBAGE += Makefile +endif + DEFINES += -DFORCE_PR_LOG ifeq ($(_PR_NO_CLOCK_TIMER),1) @@ -184,6 +188,10 @@ ifeq ($(USE_IPV6),1) OS_CFLAGS += -D_PR_INET6 endif +ifdef GC_LEAK_DETECTOR +OS_CFLAGS += -DGC_LEAK_DETECTOR +endif + #################################################################### # # Configuration for the release process diff --git a/config/rules.mk b/config/rules.mk index b885c33e..0a3dc334 100644 --- a/config/rules.mk +++ b/config/rules.mk @@ -61,6 +61,7 @@ include $(topsrcdir)/config/config.mk endif ifdef USE_AUTOCONF +ifdef CROSS_COMPILE ifdef INTERNAL_TOOLS CC=$(HOST_CC) CCC=$(HOST_CXX) @@ -68,6 +69,7 @@ CFLAGS=$(HOST_CFLAGS) CXXFLAGS=$(HOST_CXXFLAGS) endif endif +endif # # This makefile contains rules for building the following kinds of @@ -193,6 +195,10 @@ realclean clobber_all:: rm -rf $(wildcard *.OBJ *.OBJD) dist $(ALL_TRASH) +$(LOOP_OVER_DIRS) +distclean:: + rm -rf $(wildcard *.OBJ *.OBJD) dist $(ALL_TRASH) $(DIST_GARBAGE) + +$(LOOP_OVER_DIRS) + release:: export ifdef RELEASE_BINS @echo "Copying executable programs and scripts to release directory" @@ -263,6 +269,9 @@ else $(CC) -o $@ $(CFLAGS) $(OBJS) $(LDFLAGS) endif endif +ifdef BUILD_OPT + $(STRIP) $@ +endif $(LIBRARY): $(OBJS) @$(MAKE_OBJDIR) @@ -349,6 +358,9 @@ endif # OS2 endif # WINNT endif # AIX 4.1 endif # USE_AUTOCONF +ifdef BUILD_OPT + $(STRIP) $@ +endif ifeq (,$(filter-out WINNT OS2,$(OS_ARCH))) diff --git a/config/win16.mk b/config/win16.mk index e1cfd938..d47ed561 100644 --- a/config/win16.mk +++ b/config/win16.mk @@ -55,6 +55,7 @@ AR = wlib -q $@ RC = wrc.exe /r /dWIN16=1 /bt=windows RANLIB = echo BSDECHO = echo +STRIP = echo NSINSTALL = nsinstall INSTALL = $(NSINSTALL) MAKE_OBJDIR = mkdir $(OBJDIR) @@ -668,25 +668,6 @@ test "$host_alias" != "$target_alias" && program_prefix=${target_alias}- - - echo $ac_n "checking cached system tuple""... $ac_c" 1>&6 -echo "configure:674: checking cached system tuple" >&5 - if { test x"${ac_cv_host_system_type+set}" = x"set" && - test x"$ac_cv_host_system_type" != x"$host"; } || - { test x"${ac_cv_build_system_type+set}" = x"set" && - test x"$ac_cv_build_system_type" != x"$build"; } || - { test x"${ac_cv_target_system_type+set}" = x"set" && - test x"$ac_cv_target_system_type" != x"$target"; }; then - echo "$ac_t""different" 1>&6 - { echo "configure: error: remove config.cache and re-run configure" 1>&2; exit 1; } - else - echo "$ac_t""ok" 1>&6 - fi - ac_cv_host_system_type="$host" - ac_cv_build_system_type="$build" - ac_cv_target_system_type="$target" - - cat >> confdefs.h <<\EOF #define USE_AUTOCONF 1 @@ -800,7 +781,7 @@ fi # Extract the first word of "whoami", so it can be a program name with args. set dummy whoami; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:804: checking for $ac_word" >&5 +echo "configure:785: 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 @@ -860,14 +841,14 @@ if test "$target" != "$host"; then _SAVE_LDFLAGS="$LDFLAGS" echo $ac_n "checking for $host compiler""... $ac_c" 1>&6 -echo "configure:864: checking for $host compiler" >&5 +echo "configure:845: checking for $host compiler" >&5 if test -z "$HOST_CC"; then for ac_prog in gcc cc /usr/ucb/cc do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:871: checking for $ac_word" >&5 +echo "configure:852: 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 @@ -914,16 +895,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:918: checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works" >&5 +echo "configure:899: checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works" >&5 cat > conftest.$ac_ext <<EOF -#line 920 "configure" +#line 901 "configure" #include "confdefs.h" int main() { return(0); ; return 0; } EOF -if { (eval echo configure:927: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:908: \"$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 @@ -944,7 +925,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:948: checking for $ac_word" >&5 +echo "configure:929: 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 @@ -979,7 +960,7 @@ test -n "$CC" || CC=":" # 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:983: checking for $ac_word" >&5 +echo "configure:964: 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 @@ -1009,7 +990,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:1013: checking for $ac_word" >&5 +echo "configure:994: 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 @@ -1060,7 +1041,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:1064: checking for $ac_word" >&5 +echo "configure:1045: 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 @@ -1092,7 +1073,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1096: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1077: 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. @@ -1103,12 +1084,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 1107 "configure" +#line 1088 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1112: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1093: \"$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 @@ -1134,12 +1115,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:1138: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1119: 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:1143: checking whether we are using GNU C" >&5 +echo "configure:1124: 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 @@ -1148,7 +1129,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1152: \"$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:1133: \"$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 @@ -1167,7 +1148,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:1171: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1152: 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 @@ -1204,7 +1185,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:1208: checking for $ac_word" >&5 +echo "configure:1189: 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 @@ -1241,7 +1222,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:1245: checking for $ac_word" >&5 +echo "configure:1226: 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 @@ -1273,7 +1254,7 @@ test -n "$CXX" || CXX="gcc" echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1277: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 +echo "configure:1258: 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. @@ -1284,12 +1265,12 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext << EOF -#line 1288 "configure" +#line 1269 "configure" #include "confdefs.h" int main(){return(0);} EOF -if { (eval echo configure:1293: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1274: \"$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 @@ -1315,12 +1296,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:1319: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1300: 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:1324: checking whether we are using GNU C++" >&5 +echo "configure:1305: 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 @@ -1329,7 +1310,7 @@ else yes; #endif EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1333: \"$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:1314: \"$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 @@ -1348,7 +1329,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:1352: checking whether ${CXX-g++} accepts -g" >&5 +echo "configure:1333: 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 @@ -1385,7 +1366,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:1389: checking for $ac_word" >&5 +echo "configure:1370: 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 @@ -1422,7 +1403,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:1426: checking for $ac_word" >&5 +echo "configure:1407: 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 @@ -1459,7 +1440,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:1463: checking for $ac_word" >&5 +echo "configure:1444: 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 @@ -1496,7 +1477,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:1500: checking for $ac_word" >&5 +echo "configure:1481: 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 @@ -1533,7 +1514,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:1537: checking for $ac_word" >&5 +echo "configure:1518: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1570,7 +1551,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:1574: checking for $ac_word" >&5 +echo "configure:1555: 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 @@ -1605,7 +1586,7 @@ 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:1609: checking for $ac_word" >&5 +echo "configure:1590: 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 @@ -1635,7 +1616,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:1639: checking for $ac_word" >&5 +echo "configure:1620: 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 @@ -1686,7 +1667,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:1690: checking for $ac_word" >&5 +echo "configure:1671: 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 @@ -1718,7 +1699,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1722: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1703: 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. @@ -1729,12 +1710,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 1733 "configure" +#line 1714 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1738: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1719: \"$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 @@ -1760,12 +1741,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:1764: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1745: 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:1769: checking whether we are using GNU C" >&5 +echo "configure:1750: 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 @@ -1774,7 +1755,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1778: \"$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:1759: \"$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 @@ -1793,7 +1774,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:1797: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1778: 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 @@ -1829,7 +1810,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1833: checking for $ac_word" >&5 +echo "configure:1814: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1861,7 +1842,7 @@ test -n "$CXX" || CXX="gcc" echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1865: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 +echo "configure:1846: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 ac_ext=C # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -1872,12 +1853,12 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext << EOF -#line 1876 "configure" +#line 1857 "configure" #include "confdefs.h" int main(){return(0);} EOF -if { (eval echo configure:1881: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1862: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cxx_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1903,12 +1884,12 @@ if test $ac_cv_prog_cxx_works = no; then { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1907: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1888: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 cross_compiling=$ac_cv_prog_cxx_cross echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 -echo "configure:1912: checking whether we are using GNU C++" >&5 +echo "configure:1893: checking whether we are using GNU C++" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1917,7 +1898,7 @@ else yes; #endif EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1921: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1902: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gxx=yes else ac_cv_prog_gxx=no @@ -1936,7 +1917,7 @@ ac_test_CXXFLAGS="${CXXFLAGS+set}" ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS= echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 -echo "configure:1940: checking whether ${CXX-g++} accepts -g" >&5 +echo "configure:1921: checking whether ${CXX-g++} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1970,7 +1951,7 @@ fi # 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:1974: checking for $ac_word" >&5 +echo "configure:1955: 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 @@ -2002,7 +1983,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:2006: checking for $ac_word" >&5 +echo "configure:1987: 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 @@ -2043,7 +2024,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:2047: checking for $ac_word" >&5 +echo "configure:2028: 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 @@ -2084,7 +2065,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:2088: checking for $ac_word" >&5 +echo "configure:2069: 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 @@ -2125,7 +2106,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:2129: checking for $ac_word" >&5 +echo "configure:2110: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_DLLTOOL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2166,7 +2147,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:2170: checking for $ac_word" >&5 +echo "configure:2151: 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 @@ -2230,7 +2211,7 @@ rm -f a.out # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:2234: checking for a BSD compatible install" >&5 +echo "configure:2215: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2283,7 +2264,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:2287: checking whether ln -s works" >&5 +echo "configure:2268: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2308,7 +2289,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2312: checking for $ac_word" >&5 +echo "configure:2293: 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 @@ -2344,6 +2325,47 @@ test -n "$PERL" && break done test -n "$PERL" || PERL=":" +for ac_prog in strip +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:2334: 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 + case "$STRIP" in + /*) + ac_cv_path_STRIP="$STRIP" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_STRIP="$STRIP" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_STRIP="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + ;; +esac +fi +STRIP="$ac_cv_path_STRIP" +if test -n "$STRIP"; then + echo "$ac_t""$STRIP" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$STRIP" && break +done +test -n "$STRIP" || STRIP=":" + OBJ_SUFFIX=o LIB_SUFFIX=a @@ -2353,6 +2375,7 @@ PR_MD_ASFILES= PR_MD_CSRCS= PR_MD_ARCH_DIR=unix AR_FLAGS='cr $@' +AS='$(CC)' OS_TARGET=`uname -s` OS_ARCH=`uname -s | sed -e 's|/|_|g'` @@ -2891,6 +2914,10 @@ EOF CXXFLAGS="$CXXFLAGS -mieee" _OPTIMIZE_FLAGS=-O2 ;; + i?86) + PR_MD_ASFILES=os_Linux_x86.s + _OPTIMIZE_FLAGS=-O2 + ;; m68k) _OPTIMIZE_FLAGS=-O CFLAGS="$CFLAGS -m68020-40" @@ -2972,11 +2999,11 @@ EOF MDCPUCFG_H=_nto.cfg PR_MD_CSRCS=nto.c - MKSHLIB='qcc -Vgcc_ntox86 -shared -Wl,-h$(@:$(OBJDIR)/%.so=%.so) -o $(@:$(OBJDIR)/%.so=%.so)' + MKSHLIB='qcc -Vgcc_ntox86 -shared -Wl,-h$(@:$(OBJDIR)/%.so=%.so) -M -o $(@:$(OBJDIR)/%.so=%.so)' CFLAGS="$CFLAGS -Wc,-Wall -Wc,-Wno-parentheses -DNTO -D_QNX_SOURCE -DHAVE_POINTER_LOCALTIME_R -shared" OS_LIBS="-lsocket" - _OPTIMIZE_FLAGS="-O2" - _DEBUG_FLAGS="-O2 -gdwarf-2" + _OPTIMIZE_FLAGS="-O1" + _DEBUG_FLAGS="-O1 -gstabs" COMPILER_TAG="_qcc" CC="qcc -Vgcc_ntox86 -w" CXX="QCC -Vgcc_ntox86 -w" @@ -3113,7 +3140,7 @@ fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:3117: checking how to run the C preprocessor" >&5 +echo "configure:3144: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -3128,13 +3155,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 3132 "configure" +#line 3159 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3138: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3165: \"$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 : @@ -3145,13 +3172,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 3149 "configure" +#line 3176 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3155: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3182: \"$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 : @@ -3162,13 +3189,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext <<EOF -#line 3166 "configure" +#line 3193 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3172: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3199: \"$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 : @@ -3194,13 +3221,13 @@ echo "$ac_t""$CPP" 1>&6 if test $ac_cv_prog_gcc = yes; then echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 -echo "configure:3198: checking whether ${CC-cc} needs -traditional" >&5 +echo "configure:3225: checking whether ${CC-cc} needs -traditional" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_pattern="Autoconf.*'x'" cat > conftest.$ac_ext <<EOF -#line 3204 "configure" +#line 3231 "configure" #include "confdefs.h" #include <sgtty.h> Autoconf TIOCGETP @@ -3218,7 +3245,7 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext <<EOF -#line 3222 "configure" +#line 3249 "configure" #include "confdefs.h" #include <termio.h> Autoconf TCGETA @@ -3242,12 +3269,12 @@ fi for ac_func in lchown strerror do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3246: checking for $ac_func" >&5 +echo "configure:3273: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3251 "configure" +#line 3278 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3270,7 +3297,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3274: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3301: \"$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 @@ -3298,7 +3325,7 @@ done echo $ac_n "checking for pthread_attr_init in -lpthread""... $ac_c" 1>&6 -echo "configure:3302: checking for pthread_attr_init in -lpthread" >&5 +echo "configure:3329: checking for pthread_attr_init in -lpthread" >&5 ac_lib_var=`echo pthread'_'pthread_attr_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3306,7 +3333,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpthread $LIBS" cat > conftest.$ac_ext <<EOF -#line 3310 "configure" +#line 3337 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3317,7 +3344,7 @@ int main() { pthread_attr_init() ; return 0; } EOF -if { (eval echo configure:3321: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3348: \"$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 @@ -3336,7 +3363,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_attr_init in -lc_r""... $ac_c" 1>&6 -echo "configure:3340: checking for pthread_attr_init in -lc_r" >&5 +echo "configure:3367: checking for pthread_attr_init in -lc_r" >&5 ac_lib_var=`echo c_r'_'pthread_attr_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3344,7 +3371,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lc_r $LIBS" cat > conftest.$ac_ext <<EOF -#line 3348 "configure" +#line 3375 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3355,7 +3382,7 @@ int main() { pthread_attr_init() ; return 0; } EOF -if { (eval echo configure:3359: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3386: \"$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 @@ -3374,7 +3401,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_attr_init in -lc""... $ac_c" 1>&6 -echo "configure:3378: checking for pthread_attr_init in -lc" >&5 +echo "configure:3405: checking for pthread_attr_init in -lc" >&5 ac_lib_var=`echo c'_'pthread_attr_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3382,7 +3409,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lc $LIBS" cat > conftest.$ac_ext <<EOF -#line 3386 "configure" +#line 3413 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3393,7 +3420,7 @@ int main() { pthread_attr_init() ; return 0; } EOF -if { (eval echo configure:3397: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3424: \"$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 @@ -3520,7 +3547,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:3524: checking whether ${CC-cc} accepts -pthread" >&5 +echo "configure:3551: 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 @@ -3590,12 +3617,12 @@ EOF esac echo $ac_n "checking for pthread_create""... $ac_c" 1>&6 -echo "configure:3594: checking for pthread_create" >&5 +echo "configure:3621: checking for pthread_create" >&5 if eval "test \"`echo '$''{'ac_cv_func_pthread_create'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3599 "configure" +#line 3626 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char pthread_create(); below. */ @@ -3618,7 +3645,7 @@ pthread_create(); ; return 0; } EOF -if { (eval echo configure:3622: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3649: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_pthread_create=yes" else @@ -3637,7 +3664,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 -echo "configure:3641: checking for pthread_create in -lpthread" >&5 +echo "configure:3668: checking for pthread_create in -lpthread" >&5 ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3645,7 +3672,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpthread $LIBS" cat > conftest.$ac_ext <<EOF -#line 3649 "configure" +#line 3676 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3656,7 +3683,7 @@ int main() { pthread_create() ; return 0; } EOF -if { (eval echo configure:3660: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3687: \"$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 @@ -3755,12 +3782,12 @@ EOF esac echo $ac_n "checking for dlopen""... $ac_c" 1>&6 -echo "configure:3759: checking for dlopen" >&5 +echo "configure:3786: checking for dlopen" >&5 if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3764 "configure" +#line 3791 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char dlopen(); below. */ @@ -3783,7 +3810,7 @@ dlopen(); ; return 0; } EOF -if { (eval echo configure:3787: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3814: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_dlopen=yes" else @@ -3802,7 +3829,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:3806: checking for dlopen in -ldl" >&5 +echo "configure:3833: 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 @@ -3810,7 +3837,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <<EOF -#line 3814 "configure" +#line 3841 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3821,7 +3848,7 @@ int main() { dlopen() ; return 0; } EOF -if { (eval echo configure:3825: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3852: \"$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 @@ -3916,6 +3943,51 @@ fi + + + +MAKEFILES=" +Makefile +config/Makefile +config/autoconf.mk +config/nsprincl.mk +config/nsprincl.sh +lib/Makefile +lib/ds/Makefile +lib/libc/Makefile +lib/libc/include/Makefile +lib/libc/src/Makefile +pr/Makefile +pr/include/Makefile +pr/include/md/Makefile +pr/include/obsolete/Makefile +pr/include/private/Makefile +pr/src/Makefile +pr/src/io/Makefile +pr/src/linking/Makefile +pr/src/malloc/Makefile +pr/src/md/Makefile +pr/src/md/${PR_MD_ARCH_DIR}/Makefile +pr/src/memory/Makefile +pr/src/misc/Makefile +pr/src/threads/Makefile +pr/tests/Makefile +pr/tests/dll/Makefile +" + + +if test -z "$USE_PTHREADS" && test -z "$USE_BTHREADS"; then + MAKEFILES="$MAKEFILES pr/src/threads/combined/Makefile" +elif test -n "$USE_PTHREADS"; then + MAKEFILES="$MAKEFILES pr/src/pthreads/Makefile" +elif test -n "$USE_BTHREADS"; then + MAKEFILES="$MAKEFILES pr/src/bthreads/Makefile" +fi + +if test -n "$USE_CPLUS"; then + MAKEFILES="$MAKEFILES pr/src/cplus/Makefile pr/src/cplus/tests/Makefile" +fi + trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure @@ -4029,50 +4101,7 @@ done ac_given_srcdir=$srcdir ac_given_INSTALL="$INSTALL" -trap 'rm -fr `echo " -Makefile -config/Makefile -config/autoconf.mk -config/nsprincl.mk -config/nsprincl.sh -lib/Makefile -lib/ds/Makefile -lib/libc/Makefile -lib/libc/include/Makefile -lib/libc/src/Makefile -lib/msgc/Makefile -lib/msgc/include/Makefile -lib/msgc/src/Makefile -lib/msgc/tests/Makefile -lib/prstreams/Makefile -lib/tests/Makefile -pr/Makefile -pr/include/Makefile -pr/include/md/Makefile -pr/include/obsolete/Makefile -pr/include/private/Makefile -pr/src/Makefile -pr/src/bthreads/Makefile -pr/src/cplus/Makefile -pr/src/cplus/tests/Makefile -pr/src/io/Makefile -pr/src/linking/Makefile -pr/src/malloc/Makefile -pr/src/md/Makefile -pr/src/md/beos/Makefile -pr/src/md/os2/Makefile -pr/src/md/unix/Makefile -pr/src/md/windows/Makefile -pr/src/memory/Makefile -pr/src/misc/Makefile -pr/src/pthreads/Makefile -pr/src/threads/Makefile -pr/src/threads/combined/Makefile -pr/tests/Makefile -pr/tests/dll/Makefile -pr/tests/w16gui/Makefile -tools/Makefile -" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +trap 'rm -fr `echo "$MAKEFILES" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS <<EOF @@ -4134,10 +4163,12 @@ s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g s%@INSTALL_DATA@%$INSTALL_DATA%g s%@LN_S@%$LN_S%g s%@PERL@%$PERL%g +s%@STRIP@%$STRIP%g s%@CPP@%$CPP%g s%@MOZILLA_CLIENT@%$MOZILLA_CLIENT%g s%@HOST_CFLAGS@%$HOST_CFLAGS%g s%@GNU_CC@%$GNU_CC%g +s%@MOZ_OPTIMIZE@%$MOZ_OPTIMIZE%g s%@USE_CPLUS@%$USE_CPLUS%g s%@USE_IPV6@%$USE_IPV6%g s%@USE_N32@%$USE_N32%g @@ -4215,49 +4246,7 @@ EOF cat >> $CONFIG_STATUS <<EOF -CONFIG_FILES=\${CONFIG_FILES-"Makefile -config/Makefile -config/autoconf.mk -config/nsprincl.mk -config/nsprincl.sh -lib/Makefile -lib/ds/Makefile -lib/libc/Makefile -lib/libc/include/Makefile -lib/libc/src/Makefile -lib/msgc/Makefile -lib/msgc/include/Makefile -lib/msgc/src/Makefile -lib/msgc/tests/Makefile -lib/prstreams/Makefile -lib/tests/Makefile -pr/Makefile -pr/include/Makefile -pr/include/md/Makefile -pr/include/obsolete/Makefile -pr/include/private/Makefile -pr/src/Makefile -pr/src/bthreads/Makefile -pr/src/cplus/Makefile -pr/src/cplus/tests/Makefile -pr/src/io/Makefile -pr/src/linking/Makefile -pr/src/malloc/Makefile -pr/src/md/Makefile -pr/src/md/beos/Makefile -pr/src/md/os2/Makefile -pr/src/md/unix/Makefile -pr/src/md/windows/Makefile -pr/src/memory/Makefile -pr/src/misc/Makefile -pr/src/pthreads/Makefile -pr/src/threads/Makefile -pr/src/threads/combined/Makefile -pr/tests/Makefile -pr/tests/dll/Makefile -pr/tests/w16gui/Makefile -tools/Makefile -"} +CONFIG_FILES=\${CONFIG_FILES-"$MAKEFILES"} EOF cat >> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then @@ -4328,4 +4317,3 @@ chmod +x $CONFIG_STATUS rm -fr confdefs* $ac_clean_files test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 - diff --git a/configure.in b/configure.in index aa7fa6a0..8301b599 100644 --- a/configure.in +++ b/configure.in @@ -31,7 +31,6 @@ fi AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf) AC_CANONICAL_SYSTEM -AC_VALIDATE_CACHED_SYSTEM_TUPLE AC_PREFIX_DEFAULT(\${MOD_DEPTH}/dist) dnl Set this define to make fixes w/o breaking anything else. @@ -235,6 +234,7 @@ dnl ======================================================== AC_PROG_INSTALL AC_PROG_LN_S AC_PATH_PROGS(PERL, perl5 perl, :) +AC_PATH_PROGS(STRIP, strip, :) dnl ======================================================== dnl Default platform specific options @@ -247,6 +247,7 @@ PR_MD_ASFILES= PR_MD_CSRCS= PR_MD_ARCH_DIR=unix AR_FLAGS='cr $@' +AS='$(CC)' OS_TARGET=`uname -s` OS_ARCH=`uname -s | sed -e 's|/|_|g'` @@ -578,6 +579,10 @@ case "$target" in CXXFLAGS="$CXXFLAGS -mieee" _OPTIMIZE_FLAGS=-O2 ;; + i?86) + PR_MD_ASFILES=os_Linux_x86.s + _OPTIMIZE_FLAGS=-O2 + ;; m68k) _OPTIMIZE_FLAGS=-O CFLAGS="$CFLAGS -m68020-40" @@ -638,11 +643,11 @@ case "$target" in AC_DEFINE(XP_UNIX) MDCPUCFG_H=_nto.cfg PR_MD_CSRCS=nto.c - MKSHLIB='qcc -Vgcc_ntox86 -shared -Wl,-h$(@:$(OBJDIR)/%.so=%.so) -o $(@:$(OBJDIR)/%.so=%.so)' + MKSHLIB='qcc -Vgcc_ntox86 -shared -Wl,-h$(@:$(OBJDIR)/%.so=%.so) -M -o $(@:$(OBJDIR)/%.so=%.so)' CFLAGS="$CFLAGS -Wc,-Wall -Wc,-Wno-parentheses -DNTO -D_QNX_SOURCE -DHAVE_POINTER_LOCALTIME_R -shared" OS_LIBS="-lsocket" - _OPTIMIZE_FLAGS="-O2" - _DEBUG_FLAGS="-O2 -gdwarf-2" + _OPTIMIZE_FLAGS="-O1" + _DEBUG_FLAGS="-O1 -gstabs" COMPILER_TAG="_qcc" CC="qcc -Vgcc_ntox86 -w" CXX="QCC -Vgcc_ntox86 -w" @@ -1023,6 +1028,8 @@ AC_SUBST(HOST_CFLAGS) AC_SUBST(LDFLAGS) AC_SUBST(GNU_CC) +AC_SUBST(MOZ_OPTIMIZE) + AC_SUBST(USE_CPLUS) AC_SUBST(USE_IPV6) AC_SUBST(USE_N32) @@ -1065,6 +1072,7 @@ AC_SUBST(DLLTOOL) AC_SUBST(WINDRES) AC_SUBST(RANLIB) AC_SUBST(PERL) +AC_SUBST(STRIP) AC_SUBST(OS_LIBS) AC_SUBST(RESOLVE_LINK_SYMBOLS) @@ -1077,7 +1085,7 @@ AC_SUBST(ULTRASPARC_FILTER_LIBRARY) dnl ======================================================== dnl Generate output files. dnl ======================================================== -AC_OUTPUT([ +MAKEFILES=" Makefile config/Makefile config/autoconf.mk @@ -1088,39 +1096,38 @@ lib/ds/Makefile lib/libc/Makefile lib/libc/include/Makefile lib/libc/src/Makefile -lib/msgc/Makefile -lib/msgc/include/Makefile -lib/msgc/src/Makefile -lib/msgc/tests/Makefile -lib/prstreams/Makefile -lib/tests/Makefile pr/Makefile pr/include/Makefile pr/include/md/Makefile pr/include/obsolete/Makefile pr/include/private/Makefile pr/src/Makefile -pr/src/bthreads/Makefile -pr/src/cplus/Makefile -pr/src/cplus/tests/Makefile pr/src/io/Makefile pr/src/linking/Makefile pr/src/malloc/Makefile pr/src/md/Makefile -pr/src/md/beos/Makefile -pr/src/md/os2/Makefile -pr/src/md/unix/Makefile -pr/src/md/windows/Makefile +pr/src/md/${PR_MD_ARCH_DIR}/Makefile pr/src/memory/Makefile pr/src/misc/Makefile -pr/src/pthreads/Makefile pr/src/threads/Makefile -pr/src/threads/combined/Makefile pr/tests/Makefile pr/tests/dll/Makefile -pr/tests/w16gui/Makefile -tools/Makefile -]) +" + +dnl lib/tests/Makefile +dnl pr/tests/w16gui/Makefile +dnl tools/Makefile + +if test -z "$USE_PTHREADS" && test -z "$USE_BTHREADS"; then + MAKEFILES="$MAKEFILES pr/src/threads/combined/Makefile" +elif test -n "$USE_PTHREADS"; then + MAKEFILES="$MAKEFILES pr/src/pthreads/Makefile" +elif test -n "$USE_BTHREADS"; then + MAKEFILES="$MAKEFILES pr/src/bthreads/Makefile" +fi + +if test -n "$USE_CPLUS"; then + MAKEFILES="$MAKEFILES pr/src/cplus/Makefile pr/src/cplus/tests/Makefile" +fi -dnl lib/prstreams/tests/testprstrm/Makefile -dnl lib/tests/windows/makefile +AC_OUTPUT([$MAKEFILES]) diff --git a/lib/ds/plhash.c b/lib/ds/plhash.c index 30b46fdc..c5837603 100644 --- a/lib/ds/plhash.c +++ b/lib/ds/plhash.c @@ -195,6 +195,34 @@ PL_HashTableRawLookup(PLHashTable *ht, PLHashNumber keyHash, const void *key) return hep; } +/* +** Same as PL_HashTableRawLookup but doesn't reorder the hash entries. +*/ +PR_IMPLEMENT(PLHashEntry **) +PL_HashTableRawLookupConst(PLHashTable *ht, PLHashNumber keyHash, + const void *key) +{ + PLHashEntry *he, **hep; + PLHashNumber h; + +#ifdef HASHMETER + ht->nlookups++; +#endif + h = keyHash * GOLDEN_RATIO; + h >>= ht->shift; + hep = &ht->buckets[h]; + while ((he = *hep) != 0) { + if (he->keyHash == keyHash && (*ht->keyCompare)(key, he->key)) { + break; + } + hep = &he->next; +#ifdef HASHMETER + ht->nsteps++; +#endif + } + return hep; +} + PR_IMPLEMENT(PLHashEntry *) PL_HashTableRawAdd(PLHashTable *ht, PLHashEntry **hep, PLHashNumber keyHash, const void *key, void *value) @@ -349,6 +377,23 @@ PL_HashTableLookup(PLHashTable *ht, const void *key) } /* +** Same as PL_HashTableLookup but doesn't reorder the hash entries. +*/ +PR_IMPLEMENT(void *) +PL_HashTableLookupConst(PLHashTable *ht, const void *key) +{ + PLHashNumber keyHash; + PLHashEntry *he, **hep; + + keyHash = (*ht->keyHash)(key); + hep = PL_HashTableRawLookupConst(ht, keyHash, key); + if ((he = *hep) != 0) { + return he->value; + } + return 0; +} + +/* ** Iterate over the entries in the hash table calling func for each ** entry found. Stop if "f" says to (return value & PR_ENUMERATE_STOP). ** Return a count of the number of elements scanned. diff --git a/lib/ds/plhash.h b/lib/ds/plhash.h index 3110d8ab..e3cd7a63 100644 --- a/lib/ds/plhash.h +++ b/lib/ds/plhash.h @@ -104,6 +104,9 @@ PL_HashTableRemove(PLHashTable *ht, const void *key); PR_EXTERN(void *) PL_HashTableLookup(PLHashTable *ht, const void *key); +PR_EXTERN(void *) +PL_HashTableLookupConst(PLHashTable *ht, const void *key); + PR_EXTERN(PRIntn) PL_HashTableEnumerateEntries(PLHashTable *ht, PLHashEnumerator f, void *arg); @@ -123,6 +126,10 @@ PL_CompareValues(const void *v1, const void *v2); PR_EXTERN(PLHashEntry **) PL_HashTableRawLookup(PLHashTable *ht, PLHashNumber keyHash, const void *key); +PR_EXTERN(PLHashEntry **) +PL_HashTableRawLookupConst(PLHashTable *ht, PLHashNumber keyHash, + const void *key); + PR_EXTERN(PLHashEntry *) PL_HashTableRawAdd(PLHashTable *ht, PLHashEntry **hep, PLHashNumber keyHash, const void *key, void *value); diff --git a/macbuild/NSPR20PPC.mcp b/macbuild/NSPR20PPC.mcp Binary files differindex fa75d4da..ba5ad553 100644 --- a/macbuild/NSPR20PPC.mcp +++ b/macbuild/NSPR20PPC.mcp diff --git a/macbuild/NSPRConfig.h b/macbuild/NSPRConfig.h index 07a9783f..36f467a5 100644 --- a/macbuild/NSPRConfig.h +++ b/macbuild/NSPRConfig.h @@ -24,4 +24,4 @@ #define FORCE_PR_LOG 1 #define NSPR20 1 #define NSPR_AS_SHARED_LIB - +#define TARGET_CARBON 0 diff --git a/pr/include/md/_aix32in6.cfg b/pr/include/md/_aix32in6.cfg index 0385e86a..fcaec9d9 100644 --- a/pr/include/md/_aix32in6.cfg +++ b/pr/include/md/_aix32in6.cfg @@ -73,9 +73,6 @@ #undef HAVE_ALIGNED_DOUBLES #undef HAVE_ALIGNED_LONGLONGS -#ifndef _PR_INET6 -#define _PR_INET6 -#endif #define PR_AF_INET6 24 /* same as AF_INET6 */ #ifndef NO_NSPR_10_SUPPORT diff --git a/pr/include/md/_aix64.cfg b/pr/include/md/_aix64.cfg index 59bb1a79..8606ff74 100644 --- a/pr/include/md/_aix64.cfg +++ b/pr/include/md/_aix64.cfg @@ -74,9 +74,6 @@ #undef HAVE_ALIGNED_DOUBLES #undef HAVE_ALIGNED_LONGLONGS -#ifndef _PR_INET6 -#define _PR_INET6 -#endif #define PR_AF_INET6 24 /* same as AF_INET6 */ #ifndef NO_NSPR_10_SUPPORT diff --git a/pr/include/md/_beos.cfg b/pr/include/md/_beos.cfg index a1e3d89d..cbdaecdd 100644 --- a/pr/include/md/_beos.cfg +++ b/pr/include/md/_beos.cfg @@ -27,6 +27,8 @@ #define BEOS #endif +#define PR_AF_INET6 5 /* same as AF_INET6 */ + #ifdef __powerpc__ #undef IS_LITTLE_ENDIAN #define IS_BIG_ENDIAN 1 diff --git a/pr/include/md/_bsdi.cfg b/pr/include/md/_bsdi.cfg index 8a9839a4..5b7fa33f 100644 --- a/pr/include/md/_bsdi.cfg +++ b/pr/include/md/_bsdi.cfg @@ -27,6 +27,8 @@ #define BSDI #endif +#define PR_AF_INET6 24 /* same as AF_INET6 */ + #if defined(__i386__) #define IS_LITTLE_ENDIAN 1 diff --git a/pr/include/md/_darwin.cfg b/pr/include/md/_darwin.cfg index 87a76c95..33da779e 100644 --- a/pr/include/md/_darwin.cfg +++ b/pr/include/md/_darwin.cfg @@ -27,6 +27,8 @@ #define RHAPOSDY #endif +#define PR_AF_INET6 30 /* same as AF_INET6 */ + #if defined(i386) #undef IS_BIG_ENDIAN #define IS_LITTLE_ENDIAN 1 diff --git a/pr/include/md/_darwin.h b/pr/include/md/_darwin.h index d97e6a3c..98a2f1ed 100644 --- a/pr/include/md/_darwin.h +++ b/pr/include/md/_darwin.h @@ -42,8 +42,8 @@ #define USE_MACH_DYLD #define _PR_HAVE_SOCKADDR_LEN #define _PR_STAT_HAS_ST_ATIMESPEC -#define _PR_TIMESPEC_HAS_TS_SEC #define _PR_NO_LARGE_FILES +#define PR_HAVE_SYSV_NAMED_SHARED_MEMORY #define USE_SETJMP diff --git a/pr/include/md/_freebsd.cfg b/pr/include/md/_freebsd.cfg index b61641cf..167cf8b6 100644 --- a/pr/include/md/_freebsd.cfg +++ b/pr/include/md/_freebsd.cfg @@ -33,6 +33,8 @@ #undef HAVE_ALIGNED_DOUBLES #undef HAVE_ALIGNED_LONGLONGS +#define PR_AF_INET6 28 /* same as AF_INET6 */ + #if defined(__i386__) #define PR_BYTES_PER_BYTE 1 diff --git a/pr/include/md/_linux.cfg b/pr/include/md/_linux.cfg index 33fa2683..6ad20d1b 100644 --- a/pr/include/md/_linux.cfg +++ b/pr/include/md/_linux.cfg @@ -65,9 +65,9 @@ #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_INT64 8 #define PR_ALIGN_OF_FLOAT 4 -#define PR_ALIGN_OF_DOUBLE 4 +#define PR_ALIGN_OF_DOUBLE 8 #define PR_ALIGN_OF_POINTER 4 #define PR_ALIGN_OF_WORD 4 @@ -359,11 +359,12 @@ #endif #define HAVE_LONG_LONG -/* - * XXX These two macros need to be investigated for different architectures. - */ -#undef HAVE_ALIGNED_DOUBLES -#undef HAVE_ALIGNED_LONGLONGS +#if PR_ALIGN_OF_DOUBLE == 8 +#define HAVE_ALIGNED_DOUBLES +#endif +#if PR_ALIGN_OF_INT64 == 8 +#define HAVE_ALIGNED_LONGLONGS +#endif #ifndef NO_NSPR_10_SUPPORT diff --git a/pr/include/md/_linux.h b/pr/include/md/_linux.h index 11885b41..96905cf2 100644 --- a/pr/include/md/_linux.h +++ b/pr/include/md/_linux.h @@ -59,6 +59,19 @@ #define HAVE_DLL #define USE_DLFCN +#if defined(__i386__) +#define _PR_HAVE_ATOMIC_OPS +#define _MD_INIT_ATOMIC() +extern PRInt32 _PR_x86_AtomicIncrement(PRInt32 *val); +#define _MD_ATOMIC_INCREMENT _PR_x86_AtomicIncrement +extern PRInt32 _PR_x86_AtomicDecrement(PRInt32 *val); +#define _MD_ATOMIC_DECREMENT _PR_x86_AtomicDecrement +extern PRInt32 _PR_x86_AtomicAdd(PRInt32 *ptr, PRInt32 val); +#define _MD_ATOMIC_ADD _PR_x86_AtomicAdd +extern PRInt32 _PR_x86_AtomicSet(PRInt32 *val, PRInt32 newval); +#define _MD_ATOMIC_SET _PR_x86_AtomicSet +#endif + #define USE_SETJMP #if defined(__GLIBC__) && __GLIBC__ >= 2 #define _PR_POLL_AVAILABLE @@ -70,7 +83,8 @@ #else #define _PR_NO_LARGE_FILES #endif -#ifdef _PR_INET6 +#if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) +#define _PR_INET6 #define _PR_HAVE_GETHOSTBYNAME2 #define _PR_INET6_PROBE #endif @@ -97,11 +111,11 @@ extern void _MD_CleanupBeforeExit(void); * On the PowerPC, the new style jmp_buf isn't used until glibc * 2.1. */ -#if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 +#if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) #define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[JB_GPR1] #else #define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__misc[0] -#endif /* __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 */ +#endif /* glibc 2.1 or later */ #define _MD_SET_FP(_t, val) #define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t)) #define _MD_GET_FP_PTR(_t) ((void *) 0) diff --git a/pr/include/md/_macos.h b/pr/include/md/_macos.h index cf38977f..5bb4d72d 100644 --- a/pr/include/md/_macos.h +++ b/pr/include/md/_macos.h @@ -382,6 +382,19 @@ extern char* _MD_ReadDir(struct _MDDir *md,PRIntn flags); ** Socket I/O Related definitions */ +#if UNIVERSAL_INTERFACES_VERSION >= 0x0330 +/* In Universal Interfaces 3.3 and later, these are enums. */ +#define IP_TTL IP_TTL +#define IP_TOS IP_TOS +#define IP_ADD_MEMBERSHIP IP_ADD_MEMBERSHIP +#define IP_DROP_MEMBERSHIP IP_DROP_MEMBERSHIP +#define IP_MULTICAST_IF IP_MULTICAST_IF +#define IP_MULTICAST_TTL IP_MULTICAST_TTL +#define IP_MULTICAST_LOOP IP_MULTICAST_LOOP +#define TCP_NODELAY TCP_NODELAY +#define TCP_MAXSEG TCP_MAXSEG +#endif + #define _MD_SOCKET _MD_socket #define _MD_BIND _MD_bind #define _MD_LISTEN _MD_listen diff --git a/pr/include/md/_netbsd.cfg b/pr/include/md/_netbsd.cfg index ef52198e..c8fc684a 100644 --- a/pr/include/md/_netbsd.cfg +++ b/pr/include/md/_netbsd.cfg @@ -27,6 +27,8 @@ #define NETBSD #endif +#define PR_AF_INET6 24 /* same as AF_INET6 */ + #if defined(__i386__) || defined(__arm32__) #define IS_LITTLE_ENDIAN 1 diff --git a/pr/include/md/_netbsd.h b/pr/include/md/_netbsd.h index 49aca74b..45b04493 100644 --- a/pr/include/md/_netbsd.h +++ b/pr/include/md/_netbsd.h @@ -39,7 +39,11 @@ #define _PR_SI_ARCHITECTURE "arm32" #endif +#if defined(__ELF__) +#define PR_DLL_SUFFIX ".so" +#else #define PR_DLL_SUFFIX ".so.1.0" +#endif #define _PR_VMBASE 0x30000000 #define _PR_STACK_VMBASE 0x50000000 @@ -52,6 +56,8 @@ #define _PR_HAVE_SOCKADDR_LEN #define _PR_NO_LARGE_FILES #define _PR_STAT_HAS_ST_ATIMESPEC +#define _PR_POLL_AVAILABLE +#define _PR_USE_POLL #define _PR_HAVE_SYSV_SEMAPHORES #define PR_HAVE_SYSV_NAMED_SHARED_MEMORY @@ -210,7 +216,10 @@ struct _MDCPU { * unwrapped version. */ #define _MD_SELECT(nfds,r,w,e,tv) syscall(SYS_select,nfds,r,w,e,tv) +#if defined(_PR_POLL_AVAILABLE) +#include <poll.h> #define _MD_POLL(fds,nfds,timeout) syscall(SYS_poll,fds,nfds,timeout) +#endif #if NetBSD1_3 == 1L typedef unsigned int nfds_t; diff --git a/pr/include/md/_nto.cfg b/pr/include/md/_nto.cfg index dd3a5aef..cae799f7 100644 --- a/pr/include/md/_nto.cfg +++ b/pr/include/md/_nto.cfg @@ -27,6 +27,8 @@ #define NTO #endif +#define PR_AF_INET6 24 /* same as AF_INET6 */ + #ifdef __i386__ #define IS_LITTLE_ENDIAN 1 diff --git a/pr/include/md/_nto.h b/pr/include/md/_nto.h index c3720ab3..c23d9f8a 100644 --- a/pr/include/md/_nto.h +++ b/pr/include/md/_nto.h @@ -46,6 +46,9 @@ #define PR_HAVE_POSIX_NAMED_SHARED_MEMORY #define _PR_HAVE_POSIX_SEMAPHORES +#define FD_SETSIZE 4096 +#include <sys/time.h> +#include <sys/types.h> #include <sys/select.h> #undef HAVE_STACK_GROWING_UP @@ -190,9 +193,6 @@ struct _MDCPU { ** We wrapped the select() call. _MD_SELECT refers to the built-in, ** unwrapped version. */ -#include <sys/time.h> -#include <sys/types.h> -#include <sys/select.h> #define _MD_SELECT select #endif /* nspr_nto_defs_h___ */ diff --git a/pr/include/md/_openbsd.cfg b/pr/include/md/_openbsd.cfg index ae3bfcda..994daf32 100644 --- a/pr/include/md/_openbsd.cfg +++ b/pr/include/md/_openbsd.cfg @@ -27,6 +27,8 @@ #define OPENBSD #endif +#define PR_AF_INET6 24 /* same as AF_INET6 */ + #if defined(__i386__) || defined(__arm32__) #define IS_LITTLE_ENDIAN 1 diff --git a/pr/include/md/_openvms.cfg b/pr/include/md/_openvms.cfg index b9dd6d97..17548c27 100644 --- a/pr/include/md/_openvms.cfg +++ b/pr/include/md/_openvms.cfg @@ -36,6 +36,8 @@ #undef IS_64 #endif +#define PR_AF_INET6 26 /* same as AF_INET6 */ + #define PR_BYTES_PER_BYTE 1 #define PR_BYTES_PER_SHORT 2 #define PR_BYTES_PER_INT 4 diff --git a/pr/include/md/_openvms.h b/pr/include/md/_openvms.h index 6f888b72..091f202b 100644 --- a/pr/include/md/_openvms.h +++ b/pr/include/md/_openvms.h @@ -81,6 +81,17 @@ struct ip_mreq { #define _PR_STAT_HAS_ONLY_ST_ATIME #define _PR_NO_LARGE_FILES +/* IPv6 support */ +#define _PR_HAVE_GETIPNODEBYNAME +#define _PR_HAVE_GETIPNODEBYADDR +#define _PR_INET6_PROBE +#ifndef _PR_INET6 +#define AF_INET6 26 +#define AI_V4MAPPED 0x00000010 +#define AI_ALL 0x00000008 +#define AI_ADDRCONFIG 0x00000020 +#endif + #undef USE_SETJMP #include <setjmp.h> diff --git a/pr/include/md/_os2.cfg b/pr/include/md/_os2.cfg index f72eab69..a11e7cf3 100644 --- a/pr/include/md/_os2.cfg +++ b/pr/include/md/_os2.cfg @@ -39,6 +39,8 @@ #define HAVE_LONG_LONG 1 #endif +#define PR_AF_INET6 24 /* same as AF_INET6 */ + #define PR_BYTES_PER_BYTE 1 #define PR_BYTES_PER_SHORT 2 #define PR_BYTES_PER_INT 4 diff --git a/pr/include/md/_pth.h b/pr/include/md/_pth.h index 6e2e90c0..2fe641ff 100644 --- a/pr/include/md/_pth.h +++ b/pr/include/md/_pth.h @@ -93,7 +93,7 @@ #elif defined(IRIX) || defined(OSF1) || defined(AIX) || defined(SOLARIS) \ || defined(HPUX) || defined(LINUX) || defined(FREEBSD) \ || defined(NETBSD) || defined(OPENBSD) || defined(BSDI) \ - || defined(VMS) || defined(NTO) + || defined(VMS) || defined(NTO) || defined(RHAPSODY) #define _PT_PTHREAD_ZERO_THR_HANDLE(t) (t) = 0 #define _PT_PTHREAD_THR_HANDLE_IS_ZERO(t) (t) == 0 #define _PT_PTHREAD_COPY_THR_HANDLE(st, dt) (dt) = (st) @@ -204,7 +204,7 @@ #define PT_PRIO_MIN 1 #define PT_PRIO_MAX 127 #elif defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \ - || defined(BSDI) /* XXX */ + || defined(BSDI) || defined(RHAPSODY) /* XXX */ #define PT_PRIO_MIN 0 #define PT_PRIO_MAX 126 #else @@ -237,7 +237,7 @@ extern int (*_PT_aix_yield_fcn)(); PR_END_MACRO #elif defined(HPUX) || defined(LINUX) || defined(SOLARIS) \ || defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \ - || defined(BSDI) || defined(NTO) + || defined(BSDI) || defined(NTO) || defined(RHAPSODY) #define _PT_PTHREAD_YIELD() sched_yield() #else #error "Need to define _PT_PTHREAD_YIELD for this platform" diff --git a/pr/include/md/_rhapsody.cfg b/pr/include/md/_rhapsody.cfg index 87a76c95..33da779e 100644 --- a/pr/include/md/_rhapsody.cfg +++ b/pr/include/md/_rhapsody.cfg @@ -27,6 +27,8 @@ #define RHAPOSDY #endif +#define PR_AF_INET6 30 /* same as AF_INET6 */ + #if defined(i386) #undef IS_BIG_ENDIAN #define IS_LITTLE_ENDIAN 1 diff --git a/pr/include/md/_rhapsody.h b/pr/include/md/_rhapsody.h index d97e6a3c..98a2f1ed 100644 --- a/pr/include/md/_rhapsody.h +++ b/pr/include/md/_rhapsody.h @@ -42,8 +42,8 @@ #define USE_MACH_DYLD #define _PR_HAVE_SOCKADDR_LEN #define _PR_STAT_HAS_ST_ATIMESPEC -#define _PR_TIMESPEC_HAS_TS_SEC #define _PR_NO_LARGE_FILES +#define PR_HAVE_SYSV_NAMED_SHARED_MEMORY #define USE_SETJMP diff --git a/pr/include/md/_solaris.h b/pr/include/md/_solaris.h index 081636e0..88c5a44e 100644 --- a/pr/include/md/_solaris.h +++ b/pr/include/md/_solaris.h @@ -70,8 +70,13 @@ #define _PR_POLL_AVAILABLE #define _PR_USE_POLL #define _PR_STAT_HAS_ST_ATIM +#ifdef SOLARIS2_5 +#define _PR_HAVE_SYSV_SEMAPHORES +#define PR_HAVE_SYSV_NAMED_SHARED_MEMORY +#else #define _PR_HAVE_POSIX_SEMAPHORES #define PR_HAVE_POSIX_NAMED_SHARED_MEMORY +#endif #define _PR_HAVE_GETIPNODEBYNAME #define _PR_HAVE_GETIPNODEBYADDR #define _PR_INET6_PROBE @@ -81,6 +86,24 @@ #define AI_V4MAPPED 0x0001 #define AI_ALL 0x0002 #define AI_ADDRCONFIG 0x0004 +#define _PR_HAVE_MD_SOCKADDR_IN6 +/* isomorphic to struct in6_addr on Solaris 8 */ +struct _md_in6_addr { + union { + PRUint8 _S6_u8[16]; + PRUint32 _S6_u32[4]; + PRUint32 __S6_align; + } _S6_un; +}; +/* isomorphic to struct sockaddr_in6 on Solaris 8 */ +struct _md_sockaddr_in6 { + PRUint16 sin6_family; + PRUint16 sin6_port; + PRUint32 sin6_flowinfo; + struct _md_in6_addr sin6_addr; + PRUint32 sin6_scope_id; + PRUint32 __sin6_src_id; +}; #endif #include "prinrval.h" diff --git a/pr/include/obsolete/protypes.h b/pr/include/obsolete/protypes.h index 631137e4..23be3aa2 100644 --- a/pr/include/obsolete/protypes.h +++ b/pr/include/obsolete/protypes.h @@ -51,7 +51,8 @@ typedef PRIntn intn; /* SVR4 typedef of uint is commonly found on UNIX machines. */ #ifdef XP_UNIX #include <sys/types.h> -#else +#endif +#if !defined(XP_UNIX) || defined(NTO) typedef PRUintn uint; #endif diff --git a/pr/include/prinit.h b/pr/include/prinit.h index 500182c3..dd319360 100644 --- a/pr/include/prinit.h +++ b/pr/include/prinit.h @@ -44,11 +44,11 @@ PR_BEGIN_EXTERN_C ** The format of the version string is ** "<major version>.<minor version> <build date>" */ -#define PR_VERSION "4.0" +#define PR_VERSION "4.0.2 Beta" #define PR_VMAJOR 4 #define PR_VMINOR 0 -#define PR_VPATCH 0 -#define PR_BETA PR_FALSE +#define PR_VPATCH 2 +#define PR_BETA PR_TRUE /* ** PRVersionCheck diff --git a/pr/include/prio.h b/pr/include/prio.h index 36017128..015e9be2 100644 --- a/pr/include/prio.h +++ b/pr/include/prio.h @@ -179,34 +179,6 @@ union PRNetAddr { }; /* -** The PR_NETADDR_SIZE macro can only be called on a PRNetAddr union -** whose 'family' field is set. It returns the size of the union -** member corresponding to the specified address family. -*/ - -#if defined(_PR_INET6) - -#define PR_NETADDR_SIZE(_addr) PR_NetAddrSize(_addr) - -#else - -#if defined(XP_UNIX) -#define PR_NETADDR_SIZE(_addr) \ - ((_addr)->raw.family == PR_AF_INET \ - ? sizeof((_addr)->inet) \ - : ((_addr)->raw.family == PR_AF_INET6 \ - ? sizeof((_addr)->ipv6) \ - : sizeof((_addr)->local))) -#else -#define PR_NETADDR_SIZE(_addr) \ - ((_addr)->raw.family == PR_AF_INET \ - ? sizeof((_addr)->inet) \ - : sizeof((_addr)->ipv6)) -#endif /* defined(XP_UNIX) */ - -#endif /* defined(_PR_INET6) */ - -/* *************************************************************************** ** PRSockOption ** @@ -1108,8 +1080,6 @@ NSPR_API(PRStatus) PR_MakeDir(const char *name, PRIntn mode); NSPR_API(PRStatus) PR_RmDir(const char *name); -NSPR_API(PRUintn) PR_NetAddrSize(const PRNetAddr* addr); - /* ************************************************************************* * FUNCTION: PR_NewUDPSocket diff --git a/pr/include/private/primpl.h b/pr/include/private/primpl.h index 926c2585..8c1d3e12 100644 --- a/pr/include/private/primpl.h +++ b/pr/include/private/primpl.h @@ -172,6 +172,14 @@ struct _PT_Notified (thr->interrupt_blocked = 1) #define _PT_THREAD_UNBLOCK_INTERRUPT(thr) \ (thr->interrupt_blocked = 0) + +#ifdef GC_LEAK_DETECTOR +/* All threads are GCable. */ +#define _PT_IS_GCABLE_THREAD(thr) 1 +#else +#define _PT_IS_GCABLE_THREAD(thr) ((thr)->state & PT_THREAD_GCABLE) +#endif /* GC_LEAK_DETECTOR */ + /* ** Possible values for thread's suspend field ** Note that the first two can be the same as they are really mutually exclusive, @@ -1268,6 +1276,69 @@ extern PRFileDesc *_PR_InvalidDesc(void); extern PRIOMethods _pr_faulty_methods; +/* +** The PR_NETADDR_SIZE macro can only be called on a PRNetAddr union +** whose 'family' field is set. It returns the size of the union +** member corresponding to the specified address family. +*/ + +extern PRUintn _PR_NetAddrSize(const PRNetAddr* addr); + +#if defined(_PR_INET6) + +#define PR_NETADDR_SIZE(_addr) _PR_NetAddrSize(_addr) + +#elif defined(_PR_HAVE_MD_SOCKADDR_IN6) + +/* +** Under the following conditions: +** 1. _PR_INET6 is not defined; +** 2. _PR_INET6_PROBE is defined; +** 3. struct sockaddr_in6 has nonstandard fields at the end +** (e.g., on Solaris 8), +** (_addr)->ipv6 is smaller than struct sockaddr_in6, and +** hence we can't pass sizeof((_addr)->ipv6) to socket +** functions such as connect because they would fail with +** EINVAL. +** +** To pass the correct socket address length to socket +** functions, define the macro _PR_HAVE_MD_SOCKADDR_IN6 and +** define struct _md_sockaddr_in6 to be isomorphic to +** struct sockaddr_in6. +*/ + +#if defined(XP_UNIX) +#define PR_NETADDR_SIZE(_addr) \ + ((_addr)->raw.family == PR_AF_INET \ + ? sizeof((_addr)->inet) \ + : ((_addr)->raw.family == PR_AF_INET6 \ + ? sizeof(struct _md_sockaddr_in6) \ + : sizeof((_addr)->local))) +#else +#define PR_NETADDR_SIZE(_addr) \ + ((_addr)->raw.family == PR_AF_INET \ + ? sizeof((_addr)->inet) \ + : sizeof(struct _md_sockaddr_in6) +#endif /* defined(XP_UNIX) */ + +#else + +#if defined(XP_UNIX) +#define PR_NETADDR_SIZE(_addr) \ + ((_addr)->raw.family == PR_AF_INET \ + ? sizeof((_addr)->inet) \ + : ((_addr)->raw.family == PR_AF_INET6 \ + ? sizeof((_addr)->ipv6) \ + : sizeof((_addr)->local))) +#else +#define PR_NETADDR_SIZE(_addr) \ + ((_addr)->raw.family == PR_AF_INET \ + ? sizeof((_addr)->inet) \ + : sizeof((_addr)->ipv6)) +#endif /* defined(XP_UNIX) */ + +#endif /* defined(_PR_INET6) */ + extern PRStatus _PR_MapOptionName( PRSockOption optname, PRInt32 *level, PRInt32 *name); extern void _PR_InitThreads( diff --git a/pr/include/prtypes.h b/pr/include/prtypes.h index 02ea6412..b84682ca 100644 --- a/pr/include/prtypes.h +++ b/pr/include/prtypes.h @@ -158,13 +158,9 @@ #define PR_IMPLEMENT(__type) __type #define PR_EXTERN_DATA(__type) extern __type #define PR_IMPLEMENT_DATA(__type) __type -#define PR_CALLBACK +#define PR_CALLBACK _Optlink #define PR_CALLBACK_DECL -#ifndef XP_OS2_VACPP -#define PR_STATIC_CALLBACK(__x) static __x -#else -#define PR_STATIC_CALLBACK(__x) static __x _Optlink -#endif +#define PR_STATIC_CALLBACK(__x) static __x PR_CALLBACK #else /* Unix */ diff --git a/pr/src/Makefile b/pr/src/Makefile index 9f584e48..89943d3b 100644 --- a/pr/src/Makefile +++ b/pr/src/Makefile @@ -141,10 +141,14 @@ endif ifeq ($(OS_ARCH),WINNT) ifneq ($(OS_TARGET),WIN16) -OS_LIBS = advapi32.lib wsock32.lib winmm.lib +OS_LIBS = advapi32.lib wsock32.lib endif endif +ifdef GC_LEAK_DETECTOR +OS_LIBS += -L$(DIST)/lib -lboehm +endif + # # Define platform-dependent OBJS # @@ -242,6 +246,10 @@ OBJS += \ cplus/$(OBJDIR)/rctime.$(OBJ_SUFFIX) endif +ifdef GC_LEAK_DETECTOR +OBJS += memory/$(OBJDIR)/prgcleak.$(OBJ_SUFFIX) +endif + ifeq ($(OS_ARCH), WINNT) ifneq ($(OS_TARGET),WIN16) DLLBASE=/BASE:0x30000000 @@ -374,6 +382,8 @@ endif DEFINES += -D_NSPR_BUILD_ +GARBAGE += $(TINC) + $(TINC): @$(MAKE_OBJDIR) @$(ECHO) '#define _BUILD_STRING "$(SH_DATE)"' > $(TINC) diff --git a/pr/src/Makefile.in b/pr/src/Makefile.in index bad88779..3e85803b 100644 --- a/pr/src/Makefile.in +++ b/pr/src/Makefile.in @@ -146,11 +146,15 @@ ifeq ($(OS_TARGET),OS2) # We define this in os2.mk. else ifneq ($(OS_TARGET),WIN16) -OS_LIBS = wsock32.lib winmm.lib +OS_LIBS = advapi32.lib wsock32.lib endif endif endif +ifdef GC_LEAK_DETECTOR +OS_LIBS += -L$(DIST)/lib -lboehm +endif + endif # USE_AUTOCONF # # Define platform-dependent OBJS @@ -244,6 +248,10 @@ OBJS += \ cplus/$(OBJDIR)/rctime.$(OBJ_SUFFIX) endif +ifdef GC_LEAK_DETECTOR +OBJS += memory/$(OBJDIR)/prgcleak.$(OBJ_SUFFIX) +endif + ifdef USE_AUTOCONF include $(srcdir)/md/$(PR_MD_ARCH_DIR)/objs.mk @@ -380,6 +388,8 @@ endif DEFINES += -D_NSPR_BUILD_ +GARBAGE += $(TINC) + $(TINC): @$(MAKE_OBJDIR) @$(ECHO) '#define _BUILD_STRING "$(SH_DATE)"' > $(TINC) diff --git a/pr/src/bthreads/btcvar.c b/pr/src/bthreads/btcvar.c index 9e77e27b..b151f332 100644 --- a/pr/src/bthreads/btcvar.c +++ b/pr/src/bthreads/btcvar.c @@ -88,34 +88,46 @@ PR_IMPLEMENT(PRStatus) PR_WaitCondVar (PRCondVar *cvar, PRIntervalTime timeout) { status_t result; - - /* - ** This is an entirely stupid bug, but... If you call - ** acquire_sem_etc with a timeout of exactly 1,000,000 microseconds - ** it returns immediately with B_NO_ERROR. 1,000,010 microseconds - ** returns as expected. Running BeOS/Intel R3.1 at this time. - ** Forwarded to Be, Inc. for resolution, Bug ID 980624-225956 - ** - ** Update: Be couldn't reproduce it, but removing timeout++ still - ** exhibits the problem on BeOS/Intel R4 and BeOS/PPC R4. - */ - - timeout++; + bigtime_t interval; PR_Unlock( cvar->lock ); - if( PR_INTERVAL_NO_WAIT != timeout ) - { - if( PR_INTERVAL_NO_TIMEOUT == timeout ) - { - if( acquire_sem( cvar->isem ) != B_NO_ERROR ) return PR_FAILURE; - - } else - { - result = acquire_sem_etc( cvar->isem, 1, B_TIMEOUT, PR_IntervalToMicroseconds( timeout ) ); - if( result != B_NO_ERROR && result != B_TIMED_OUT ) - return PR_FAILURE; - } + switch (timeout) { + case PR_INTERVAL_NO_WAIT: + /* nothing to do */ + break; + + case PR_INTERVAL_NO_TIMEOUT: + /* wait as long as necessary */ + if( acquire_sem( cvar->isem ) != B_NO_ERROR ) return PR_FAILURE; + break; + + default: + interval = (bigtime_t)PR_IntervalToMicroseconds(timeout); + + /* + ** in R5, this problem seems to have been resolved, so we + ** won't bother with it + */ +#if !defined(B_BEOS_VERSION_5) || (B_BEOS_VERSION < B_BEOS_VERSION_5) + /* + ** This is an entirely stupid bug, but... If you call + ** acquire_sem_etc with a timeout of exactly 1,000,000 microseconds + ** it returns immediately with B_NO_ERROR. 1,000,010 microseconds + ** returns as expected. Running BeOS/Intel R3.1 at this time. + ** Forwarded to Be, Inc. for resolution, Bug ID 980624-225956 + ** + ** Update: Be couldn't reproduce it, but removing timeout++ still + ** exhibits the problem on BeOS/Intel R4 and BeOS/PPC R4. + */ + if (interval == 1000000) + interval = 1000010; +#endif /* !defined(B_BEOS_VERSION_5) || (B_BEOS_VERSION < B_BEOS_VERSION_5) */ + + result = acquire_sem_etc( cvar->isem, 1, B_RELATIVE_TIMEOUT, interval); + if( result != B_NO_ERROR && result != B_TIMED_OUT ) + return PR_FAILURE; + break; } PR_Lock( cvar->lock ); @@ -162,4 +174,6 @@ PR_IMPLEMENT(PRStatus) if( release_sem_etc( cvar->isem, semInfo.count, 0 ) != B_NO_ERROR ) return PR_FAILURE; + + return PR_SUCCESS; } diff --git a/pr/src/bthreads/btthread.c b/pr/src/bthreads/btthread.c index fde9189a..e7e7997f 100644 --- a/pr/src/bthreads/btthread.c +++ b/pr/src/bthreads/btthread.c @@ -674,38 +674,34 @@ PR_IMPLEMENT(PRStatus) PRIntn rv; PR_ASSERT(thred != NULL); - rv = resume_thread( thred->md.tid ); - if( rv == B_BAD_THREAD_STATE ) - { - /* - ** We have a thread that's not suspended, but is - ** blocked. Suspend it THEN resume it. The - ** function call that's hanging will return - ** B_INTERRUPTED - */ + /* + ** there seems to be a bug in beos R5 in which calling + ** resume_thread() on a blocked thread returns B_OK instead + ** of B_BAD_THREAD_STATE (beos bug #20000422-19095). as such, + ** to interrupt a thread, we will simply suspend then resume it + ** (no longer call resume_thread(), check for B_BAD_THREAD_STATE, + ** the suspend/resume to wake up a blocked thread). this wakes + ** up blocked threads properly, and doesn't hurt unblocked threads + ** (they simply get stopped then re-started immediately) + */ - rv = suspend_thread( thred->md.tid ); - if( rv != B_NO_ERROR ) - { - PR_SetError( PR_UNKNOWN_ERROR, rv ); - return( PR_FAILURE ); - } - rv = resume_thread( thred->md.tid ); - if( rv != B_NO_ERROR ) - { - PR_SetError( PR_UNKNOWN_ERROR, rv ); - return( PR_FAILURE ); - } + rv = suspend_thread( thred->md.tid ); + if( rv != B_NO_ERROR ) + { + /* this doesn't appear to be a valid thread_id */ + PR_SetError( PR_UNKNOWN_ERROR, rv ); + return PR_FAILURE; } + rv = resume_thread( thred->md.tid ); if( rv != B_NO_ERROR ) { - PR_SetError( PR_UNKNOWN_ERROR, rv ); - return( PR_FAILURE ); + PR_SetError( PR_UNKNOWN_ERROR, rv ); + return PR_FAILURE; } - return( PR_SUCCESS ); + return PR_SUCCESS; } PR_IMPLEMENT(void) diff --git a/pr/src/io/pripv6.c b/pr/src/io/pripv6.c index 485e449d..f5635a59 100644 --- a/pr/src/io/pripv6.c +++ b/pr/src/io/pripv6.c @@ -149,6 +149,7 @@ static PRFileDesc* PR_CALLBACK Ipv6ToIpv4SocketAccept ( PRFileDesc *newfd; PRFileDesc *newstack; PRNetAddr tmp_ipv4addr; + PRNetAddr *addrlower = NULL; PR_ASSERT(fd != NULL); PR_ASSERT(fd->lower != NULL); @@ -161,13 +162,16 @@ static PRFileDesc* PR_CALLBACK Ipv6ToIpv4SocketAccept ( } *newstack = *fd; /* make a copy of the accepting layer */ - newfd = (fd->lower->methods->accept)(fd->lower, &tmp_ipv4addr, timeout); + if (addr) + addrlower = &tmp_ipv4addr; + newfd = (fd->lower->methods->accept)(fd->lower, addrlower, timeout); if (NULL == newfd) { PR_DELETE(newstack); return NULL; } - _PR_ConvertToIpv6NetAddr(&tmp_ipv4addr, addr); + if (addr) + _PR_ConvertToIpv6NetAddr(&tmp_ipv4addr, addr); rv = PR_PushIOLayer(newfd, PR_TOP_IO_LAYER, newstack); PR_ASSERT(PR_SUCCESS == rv); @@ -272,11 +276,29 @@ PRStatus _pr_init_ipv6() #if !defined(_PR_INET6) && defined(_PR_HAVE_GETIPNODEBYNAME) PRLibrary *lib; - _pr_getipnodebyname_fp = PR_FindSymbolAndLibrary("getipnodebyname", &lib); +#if defined(VMS) +#define GETIPNODEBYNAME "DECC$GETIPNODEBYNAME" +#define GETIPNODEBYADDR "DECC$GETIPNODEBYADDR" +#define FREEHOSTENT "DECC$FREEHOSTENT" +#define GAISTRERROR "DECC$GAISTRERROR" + typedef char * (*_pr_getstrerror_t)(int); + _pr_getstrerror_t _pr_gaistrerror_fp; + _pr_getipnodebyname_fp = NULL; + _pr_gaistrerror_fp = (_pr_getstrerror_t)PR_FindSymbolAndLibrary(GAISTRERROR, &lib); + if (NULL != _pr_gaistrerror_fp) { + if (NULL != (*_pr_gaistrerror_fp)(0)) + _pr_getipnodebyname_fp = PR_FindSymbol(lib, GETIPNODEBYNAME); + } +#else +#define GETIPNODEBYNAME "getipnodebyname" +#define GETIPNODEBYADDR "getipnodebyaddr" +#define FREEHOSTENT "freehostent" + _pr_getipnodebyname_fp = PR_FindSymbolAndLibrary(GETIPNODEBYNAME, &lib); +#endif if (NULL != _pr_getipnodebyname_fp) { - _pr_freehostent_fp = PR_FindSymbol(lib, "freehostent"); + _pr_freehostent_fp = PR_FindSymbol(lib, FREEHOSTENT); if (NULL != _pr_freehostent_fp) { - _pr_getipnodebyaddr_fp = PR_FindSymbol(lib, "getipnodebyaddr"); + _pr_getipnodebyaddr_fp = PR_FindSymbol(lib, GETIPNODEBYADDR); if (NULL != _pr_getipnodebyaddr_fp) _pr_ipv6_is_present = PR_TRUE; else diff --git a/pr/src/io/prlog.c b/pr/src/io/prlog.c index a43fe5a3..e5033bbd 100644 --- a/pr/src/io/prlog.c +++ b/pr/src/io/prlog.c @@ -14,6 +14,17 @@ * Communications Corporation. Portions created by Netscape are * Copyright (C) 1998 Netscape Communications Corporation. All Rights * Reserved. + * + * Contributors: + * + * This Original Code has been modified by IBM Corporation. + * Modifications made by IBM described herein are + * Copyright (c) International Business Machines Corporation, 2000. + * Modifications to Mozilla code or documentation identified per + * MPL Section 3.3 + * + * Date Modified by Description of modification + * 04/10/2000 IBM Corp. Added DebugBreak() definitions for OS/2 */ #include "primpl.h" @@ -55,7 +66,7 @@ static PRLock *_pr_logLock; #endif -#if defined(XP_PC) && !defined(XP_OS2_VACPP) +#if defined(XP_PC) #define strcasecmp stricmp #define strncasecmp strnicmp #endif @@ -104,7 +115,7 @@ static FILE *logFile = NULL; static PRFileDesc *logFile = 0; #endif -#define LINE_BUF_SIZE 200 +#define LINE_BUF_SIZE 512 #define DEFAULT_BUF_SIZE 16384 #ifdef _PR_NEED_STRCASECMP @@ -432,6 +443,24 @@ PR_IMPLEMENT(void) PR_Abort(void) } #ifdef DEBUG +#if defined(XP_OS2) +/* + * Added definitions for DebugBreak() for 2 different OS/2 compilers. + * Doing the int3 on purpose for Visual Age so that a developer can + * step over the instruction if so desired. Not always possible if + * trapping due to exception handling IBM-AKR + */ +#if defined(XP_OS2_VACPP) +#include <builtin.h> +static void DebugBreak(void) { _interrupt(3); } +#elif defined(XP_OS2_EMX) +/* Force a trap */ +static void DebugBreak(void) { int *pTrap=NULL; *pTrap = 1; } +#else +static void DebugBreak(void) { } +#endif +#endif /* XP_OS2 */ + PR_IMPLEMENT(void) PR_Assert(const char *s, const char *file, PRIntn ln) { PR_LogPrint("Assertion failure: %s, at %s:%d\n", s, file, ln); @@ -441,7 +470,7 @@ PR_IMPLEMENT(void) PR_Assert(const char *s, const char *file, PRIntn ln) #ifdef XP_MAC dprintf("Assertion failure: %s, at %s:%d\n", s, file, ln); #endif -#ifdef WIN32 +#if defined(WIN32) || defined(XP_OS2) DebugBreak(); #endif #ifndef XP_MAC diff --git a/pr/src/io/prsocket.c b/pr/src/io/prsocket.c index 4ee568fd..8a3493bf 100644 --- a/pr/src/io/prsocket.c +++ b/pr/src/io/prsocket.c @@ -1304,7 +1304,7 @@ PR_IMPLEMENT(PRStatus) PR_NewTCPSocketPair(PRFileDesc *f[]) } selfAddr.sin_family = AF_INET; selfAddr.sin_port = 0; - selfAddr.sin_addr.s_addr = htonl(INADDR_ANY); + selfAddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); /* BugZilla: 35408 */ addrLen = sizeof(selfAddr); if (bind(listenSock, (struct sockaddr *) &selfAddr, addrLen) == SOCKET_ERROR) { @@ -1382,7 +1382,7 @@ failed: if (listenSock == NULL) { goto failed; } - PR_InitializeNetAddr(PR_IpAddrAny, 0, &selfAddr); + PR_InitializeNetAddr(PR_IpAddrLoopback, 0, &selfAddr); /* BugZilla: 35408 */ if (PR_Bind(listenSock, &selfAddr) == PR_FAILURE) { goto failed; } diff --git a/pr/src/linking/prlink.c b/pr/src/linking/prlink.c index e4d093f1..d302e559 100644 --- a/pr/src/linking/prlink.c +++ b/pr/src/linking/prlink.c @@ -64,7 +64,8 @@ * On these platforms, symbols have a leading '_'. */ #if defined(SUNOS4) || defined(RHAPSODY) || defined(NEXTSTEP) \ - || defined(OPENBSD) || defined(WIN16) || defined(NETBSD) + || defined(OPENBSD) || defined(WIN16) \ + || (defined(NETBSD) && !defined(__ELF__)) #define NEED_LEADING_UNDERSCORE #endif @@ -480,6 +481,7 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags) { PRLibrary *lm; PRLibrary* result; + PRInt32 oserr; if (!_pr_initialized) _PR_ImplicitInitialization(); @@ -490,7 +492,10 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags) if (result != NULL) goto unlock; lm = PR_NEWZAP(PRLibrary); - if (lm == NULL) goto unlock; + if (lm == NULL) { + oserr = _MD_ERRNO(); + goto unlock; + } lm->staticTable = NULL; #ifdef XP_OS2 /* Why isn't all this stuff in MD code?! */ @@ -502,6 +507,7 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags) retry: ulRc = DosLoadModule(pszError, _MAX_PATH, (PSZ) name, &h); if (ulRc != NO_ERROR) { + oserr = ulRc; PR_DELETE(lm); goto unlock; } @@ -519,6 +525,7 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags) h = LoadLibrary(name); if (h < (HINSTANCE)HINSTANCE_ERROR) { + oserr = _MD_ERRNO(); PR_DELETE(lm); goto unlock; } @@ -538,7 +545,7 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags) } #endif /* WIN32 || WIN16 */ -#if defined(XP_MAC) && GENERATINGCFM +#if defined(XP_MAC) && TARGET_RT_MAC_CFM { OSErr err; Ptr main; @@ -562,7 +569,7 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags) 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 @@ -594,7 +601,10 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags) &connectionID, &main, errName); #endif if (err != noErr) + { + oserr = err; goto unlock; + } libName = name; } @@ -624,7 +634,10 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags) /* Copy the name: we'll change it */ cMacPath = strdup(name); if (cMacPath == NULL) + { + oserr = _MD_ERRNO(); goto unlock; + } /* First, get the vRefNum */ position = strchr(cMacPath, PR_PATH_SEPARATOR); @@ -646,6 +659,7 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags) index--; if (index == 0 || index == strlen(cMacPath)) { + oserr = _MD_ERRNO(); PR_DELETE(cMacPath); goto unlock; } @@ -653,10 +667,8 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags) cFileName = &(cMacPath[index + 1]); /* Convert the path and name into Pascal strings */ - strcpy((char*) &pName, cMacPath); - c2pstr((char*) &pName); - strcpy((char*) &fileSpec.name, cFileName); - c2pstr((char*) &fileSpec.name); + PStrFromCStr(cMacPath, pName); + PStrFromCStr(cFileName, fileSpec.name); strcpy(cName, cFileName); PR_DELETE(cMacPath); cMacPath = NULL; @@ -668,14 +680,20 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags) pb.dirInfo.ioFDirIndex = 0; err = PBGetCatInfoSync(&pb); if (err != noErr) + { + oserr = err; goto unlock; + } fileSpec.parID = pb.dirInfo.ioDrDirID; /* Resolve an alias if this was one */ err = ResolveAliasFile(&fileSpec, true, &tempUnusedBool, &tempUnusedBool); if (err != noErr) + { + oserr = err; goto unlock; + } /* Finally, try to load the library */ err = GetDiskFragment(&fileSpec, 0, kCFragGoesToEOF, fileSpec.name, @@ -683,7 +701,10 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags) libName = cName; if (err != noErr) + { + oserr = err; goto unlock; + } } lm->name = strdup(libName); @@ -691,7 +712,7 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags) lm->next = pr_loadmap; pr_loadmap = lm; } -#elif defined(XP_MAC) && !GENERATINGCFM +#elif defined(XP_MAC) && !TARGET_RT_MAC_CFM { } @@ -734,12 +755,13 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags) NSModule h = NULL; if (NSCreateObjectFileImageFromFile(name, &ofi) == NSObjectFileImageSuccess) { - h = NSLinkModule(ofi, name, TRUE); + h = NSLinkModule(ofi, name, NSLINKMODULE_OPTION_PRIVATE); } #else #error Configuration error #endif if (!h) { + oserr = _MD_ERRNO(); PR_DELETE(lm); goto unlock; } @@ -758,21 +780,76 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags) image_info info; int32 cookie = 0; image_id h = B_ERROR; + PRLibrary *p; - while(get_next_image_info(0, &cookie, &info) == B_OK) - if(strcmp(name, info.name + strlen(info.name) - strlen(name)) == 0) { + for (p = pr_loadmap; p != NULL; p = p->next) { + /* hopefully, our caller will always use the same string + to refer to the same library */ + if (strcmp(name, p->name) == 0) { + /* we've already loaded this library */ h = info.id; - lm->refCount++; /* it has been already loaded implcitly, so pretend it already had a control structure and ref */ + lm->refCount++; + break; } + } - if(h == B_ERROR) - h = load_add_on( name ); + if(h == B_ERROR) { + /* it appears the library isn't yet loaded - load it now */ + char stubName [B_PATH_NAME_LENGTH + 1]; + + /* the following is a work-around to a "bug" in the beos - + the beos system loader allows only 32M (system-wide) + to be used by code loaded as "add-ons" (code loaded + through the 'load_add_on()' system call, which includes + mozilla components), but allows 256M to be used by + shared libraries. + + unfortunately, mozilla is too large to fit into the + "add-on" space, so we must trick the loader into + loading some of the components as shared libraries. this + is accomplished by creating a "stub" add-on (an empty + shared object), and linking it with the component + (the actual .so file generated by the build process, + without any modifications). when this stub is loaded + by load_add_on(), the loader will automatically load the + component into the shared library space. + */ + + strcpy(stubName, name); + strcat(stubName, ".stub"); + + /* first, attempt to load the stub (thereby loading the + component as a shared library */ + if ((h = load_add_on(stubName)) > B_ERROR) { + /* the stub was loaded successfully. however, the stub + itself is useless (so useless, in fact, that we will + simply unload it) */ + unload_add_on(h); + h = B_FILE_NOT_FOUND; + + cookie = 0; + while (get_next_image_info(0, &cookie, &info) == B_OK) { + char *endOfName = info.name + strlen(info.name) - strlen(name); + if (endOfName < info.name) + continue; + + if (strcmp(name, endOfName) == 0) { + /* this is the actual component - remember it */ + h = info.id; + break; + } + } + + } else { + /* we failed to load the "stub" - try to load the + component directly as an add-on */ + h = load_add_on(name); + } + } - if( h == B_ERROR || h <= 0 ) { - h = 0; - result = NULL; + if (h <= B_ERROR) { + oserr = h; PR_DELETE( lm ); - lm = NULL; goto unlock; } lm->name = strdup(name); @@ -787,8 +864,8 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags) unlock: if (result == NULL) { - PR_SetError(PR_LOAD_LIBRARY_ERROR, _MD_ERRNO()); - DLLErrorInternal(_MD_ERRNO()); /* sets error text */ + PR_SetError(PR_LOAD_LIBRARY_ERROR, oserr); + DLLErrorInternal(oserr); /* sets error text */ } PR_ExitMonitor(pr_linker_lock); return result; @@ -976,7 +1053,7 @@ PR_UnloadLibrary(PRLibrary *lib) } #endif /* XP_PC */ -#if defined(XP_MAC) && GENERATINGCFM +#if defined(XP_MAC) && TARGET_RT_MAC_CFM /* Close the connection */ CloseConnection(&(lib->dlh)); #endif @@ -1083,7 +1160,14 @@ pr_FindSymbolInLib(PRLibrary *lm, const char *name) f = NULL; } #elif defined(USE_MACH_DYLD) - f = NSAddressOfSymbol(NSLookupAndBindSymbol(name)); + { + NSSymbol symbol; + symbol = NSLookupSymbolInModule(lm->dlh, name); + if (symbol != NULL) + f = NSAddressOfSymbol(symbol); + else + f = NULL; + } #endif #endif /* HAVE_DLL */ #endif /* XP_UNIX */ diff --git a/pr/src/md/mac/macdll.c b/pr/src/md/mac/macdll.c index bebf2356..ba9465d0 100644 --- a/pr/src/md/mac/macdll.c +++ b/pr/src/md/mac/macdll.c @@ -530,6 +530,15 @@ OSErr NSLoadIndexedFragment(const FSSpec *fileSpec, PRUint32 fragmentIndex, err = GetIndexedFragmentOffsets(fileSpec, fragmentIndex, &fragOffset, &fragLength, &fragNameBlock); if (err != noErr) return err; + if (fragNameBlock) + { + UInt32 nameLen = strlen(fragNameBlock); + if (nameLen > 63) + nameLen = 63; + BlockMoveData(fragNameBlock, &fragName[1], nameLen); + fragName[0] = nameLen; + } + err = GetDiskFragment(fileSpec, fragOffset, fragLength, fragName, kLoadCFrag, outConnectionID, &main, errName); if (err != noErr) diff --git a/pr/src/md/mac/macsockotpt.c b/pr/src/md/mac/macsockotpt.c index 7b6e4441..4fc643f2 100644 --- a/pr/src/md/mac/macsockotpt.c +++ b/pr/src/md/mac/macsockotpt.c @@ -29,6 +29,12 @@ #define GESTALT_OPEN_TPT_TCP_PRESENT gestaltOpenTptTCPPresentMask #include <OpenTptInternet.h> // All the internet typedefs + +#if (UNIVERSAL_INTERFACES_VERSION >= 0x0330) +// for some reason Apple removed this typedef. +typedef struct OTConfiguration OTConfiguration; +#endif + #include "primpl.h" typedef enum SndRcvOpCode { @@ -48,8 +54,8 @@ static struct { static PRBool gOTInitialized; static pascal void DNSNotifierRoutine(void * contextPtr, OTEventCode code, OTResult result, void * cookie); -static pascal void NotifierRoutine(void * contextPtr, OTEventCode code, - OTResult result, void * cookie); +static pascal void NotifierRoutine(void * contextPtr, OTEventCode code, OTResult result, void * cookie); +static pascal void RawEndpointNotifierRoutine(void * contextPtr, OTEventCode code, OTResult result, void * cookie); static PRBool GetState(PRFileDesc *fd, PRBool *readReady, PRBool *writeReady, PRBool *exceptReady); @@ -59,24 +65,20 @@ extern void DoneWaitingOnThisThread(PRThread *thread); #if TARGET_CARBON OTClientContextPtr clientContext = NULL; -OTNotifyUPP DNSNotifierRoutineUPP; -OTNotifyUPP notifierRoutineUPP; - -#define DNS_NOTIFIER_ROUTINE DNSNotifierRoutineUPP -#define NOTIFIER_ROUTINE notifierRoutineUPP -#define INIT_OPEN_TRANSPORT() InitOpenTransport(clientContext, kInitOTForExtensionMask) -#define OT_OPEN_INTERNET_SERVICES(config, flags, err) OTOpenInternetServices(config, flags, err, clientContext) -#define OT_OPEN_ENDPOINT(config, flags, info, err) OTOpenEndpoint(config, flags, info, err, clientContext) +#define INIT_OPEN_TRANSPORT() InitOpenTransportInContext(kInitOTForExtensionMask, &clientContext) +#define OT_OPEN_INTERNET_SERVICES(config, flags, err) OTOpenInternetServicesInContext(config, flags, err, clientContext) +#define OT_OPEN_ENDPOINT(config, flags, info, err) OTOpenEndpointInContext(config, flags, info, err, clientContext) #else -#define DNS_NOTIFIER_ROUTINE DNSNotifierRoutine -#define NOTIFIER_ROUTINE NotifierRoutine #define INIT_OPEN_TRANSPORT() InitOpenTransport() #define OT_OPEN_INTERNET_SERVICES(config, flags, err) OTOpenInternetServices(config, flags, err) #define OT_OPEN_ENDPOINT(config, flags, info, err) OTOpenEndpoint(config, flags, info, err) #endif /* TARGET_CARBON */ +static OTNotifyUPP DNSNotifierRoutineUPP; +static OTNotifyUPP NotifierRoutineUPP; +static OTNotifyUPP RawEndpointNotifierRoutineUPP; void _MD_InitNetAccess() { @@ -97,14 +99,9 @@ void _MD_InitNetAccess() PR_ASSERT(hasOTTCPIP == PR_TRUE); -#if TARGET_CARBON DNSNotifierRoutineUPP = NewOTNotifyUPP(DNSNotifierRoutine); - notifierRoutineUPP = NewOTNotifyUPP(NotifierRoutine); - - errOT = OTAllocClientContext((UInt32)0, &clientContext); - PR_ASSERT(err == kOTNoError); -#endif - + NotifierRoutineUPP = NewOTNotifyUPP(NotifierRoutine); + RawEndpointNotifierRoutineUPP = NewOTNotifyUPP(RawEndpointNotifierRoutine); errOT = INIT_OPEN_TRANSPORT(); PR_ASSERT(err == kOTNoError); @@ -129,7 +126,7 @@ static void _MD_FinishInitNetAccess() PR_ASSERT((dnsContext.serviceRef != NULL) && (errOT == kOTNoError)); /* Install notify function for DNR Address To String completion */ - errOT = OTInstallNotifier(dnsContext.serviceRef, DNS_NOTIFIER_ROUTINE, &dnsContext); + errOT = OTInstallNotifier(dnsContext.serviceRef, DNSNotifierRoutineUPP, &dnsContext); PR_ASSERT(errOT == kOTNoError); /* Put us into async mode */ @@ -140,7 +137,7 @@ static void _MD_FinishInitNetAccess() } -pascal void DNSNotifierRoutine(void * contextPtr, OTEventCode code, OTResult result, void * cookie) +static pascal void DNSNotifierRoutine(void * contextPtr, OTEventCode code, OTResult result, void * cookie) { #pragma unused(contextPtr) _PRCPU * cpu = _PR_MD_CURRENT_CPU(); @@ -262,7 +259,7 @@ WakeUpNotifiedThread(PRThread *thread, OTResult result) // Notification routine // Async callback routine. // A5 is OK. Cannot allocate memory here -pascal void NotifierRoutine(void * contextPtr, OTEventCode code, OTResult result, void * cookie) +static pascal void NotifierRoutine(void * contextPtr, OTEventCode code, OTResult result, void * cookie) { PRFilePrivate *secret = (PRFilePrivate *) contextPtr; _MDFileDesc * md = &(secret->md); @@ -1037,7 +1034,7 @@ typedef struct RawEndpointAndThread // Notification routine for raw endpoints not yet attached to a PRFileDesc. // Async callback routine. // A5 is OK. Cannot allocate memory here -pascal void RawEndpointNotifierRoutine(void * contextPtr, OTEventCode code, OTResult result, void * cookie) +static pascal void RawEndpointNotifierRoutine(void * contextPtr, OTEventCode code, OTResult result, void * cookie) { RawEndpointAndThread *endthr = (RawEndpointAndThread *) contextPtr; PRThread * thread = endthr->thread; @@ -1194,7 +1191,7 @@ PRInt32 _MD_accept(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen, PRInterva endthr->thread = me; endthr->endpoint = (EndpointRef) newosfd; - err = OTInstallNotifier((ProviderRef) newosfd, RawEndpointNotifierRoutine, endthr); + err = OTInstallNotifier((ProviderRef) newosfd, RawEndpointNotifierRoutineUPP, endthr); PR_ASSERT(err == kOTNoError); err = OTSetAsynchronous((EndpointRef) newosfd); @@ -1350,6 +1347,7 @@ static PRInt32 SendReceiveStream(PRFileDesc *fd, void *buf, PRInt32 amount, PRInt32 bytesLeft = amount; PR_ASSERT(flags == 0); + PR_ASSERT(opCode == kSTREAM_SEND || opCode == kSTREAM_RECEIVE); if (endpoint == NULL) { err = kEBADFErr; @@ -1361,11 +1359,6 @@ static PRInt32 SendReceiveStream(PRFileDesc *fd, void *buf, PRInt32 amount, goto ErrorExit; } - if (opCode != kSTREAM_SEND && opCode != kSTREAM_RECEIVE) { - err = kEINVALErr; - goto ErrorExit; - } - while (bytesLeft > 0) { PrepareForAsyncCompletion(me, fd->secret->md.osfd); @@ -1434,6 +1427,10 @@ static PRInt32 SendReceiveStream(PRFileDesc *fd, void *buf, PRInt32 amount, } me->io_pending = PR_FALSE; + if (opCode == kSTREAM_SEND) + fd->secret->md.write.thread = nil; + else + fd->secret->md.read.thread = nil; if (result > 0) { buf = (void *) ( (UInt32) buf + (UInt32)result ); @@ -1471,9 +1468,13 @@ static PRInt32 SendReceiveStream(PRFileDesc *fd, void *buf, PRInt32 amount, } } + PR_ASSERT(opCode == kSTREAM_SEND ? fd->secret->md.write.thread == nil : + fd->secret->md.read.thread == nil); return amount; ErrorExit: + PR_ASSERT(opCode == kSTREAM_SEND ? fd->secret->md.write.thread == nil : + fd->secret->md.read.thread == nil); macsock_map_error(err); return -1; } @@ -1789,7 +1790,7 @@ void _MD_makenonblock(PRFileDesc *fd) // fd changes, but the secret structure does not; // (b) the notifier func refers only to the secret data structure // anyway. - err = OTInstallNotifier(endpointRef, NOTIFIER_ROUTINE, fd->secret); + err = OTInstallNotifier(endpointRef, NotifierRoutineUPP, fd->secret); PR_ASSERT(err == kOTNoError); // Now that we have a NotifierRoutine installed, we can make the endpoint asynchronous @@ -1866,7 +1867,8 @@ PR_IMPLEMENT(unsigned long) inet_addr(const char *cp) _MD_FinishInitNetAccess(); err = OTInetStringToHost((char*) cp, &host); - PR_ASSERT(err == kOTNoError); + if (err != kOTNoError) + return -1; return host; } diff --git a/pr/src/md/mac/mdmac.c b/pr/src/md/mac/mdmac.c index c762baa7..bca487a7 100644 --- a/pr/src/md/mac/mdmac.c +++ b/pr/src/md/mac/mdmac.c @@ -344,7 +344,7 @@ void PR_InitMemory(void) { #if TARGET_CARBON extern OTClientContextPtr clientContext; -#define CLOSE_OPEN_TRANSPORT() CloseOpenTransport(clientContext) +#define CLOSE_OPEN_TRANSPORT() CloseOpenTransportInContext(clientContext) #else @@ -739,7 +739,7 @@ extern long _MD_GetArchitecture(char *buf, long count) { long len; -#if defined(GENERATINGPOWERPC) && GENERATINGPOWERPC +#if defined(TARGET_CPU_PPC) && TARGET_CPU_PPC len = PR_snprintf(buf, count, "PowerPC"); #else len = PR_snprintf(buf, count, "Motorola68k"); diff --git a/pr/src/md/mac/prcpucfg.h b/pr/src/md/mac/prcpucfg.h index bc203a42..9483f1f3 100644 --- a/pr/src/md/mac/prcpucfg.h +++ b/pr/src/md/mac/prcpucfg.h @@ -112,6 +112,6 @@ #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 /* NO_NSPR_10_SUPPORT */ #endif /* nspr_cpucfg___ */ diff --git a/pr/src/md/os2/os2io.c b/pr/src/md/os2/os2io.c index e6977ff7..e7e7b705 100644 --- a/pr/src/md/os2/os2io.c +++ b/pr/src/md/os2/os2io.c @@ -14,6 +14,23 @@ * Communications Corporation. Portions created by Netscape are * Copyright (C) 1998 Netscape Communications Corporation. All Rights * Reserved. + * + * This Original Code has been modified by IBM Corporation. + * Modifications made by IBM described herein are + * Copyright (c) International Business Machines + * Corporation, 2000 + * + * Modifications to Mozilla code or documentation + * identified per MPL Section 3.3 + * + * Date Modified by Description of modification + * 03/23/2000 IBM Corp. Changed write() to DosWrite(). EMX i/o + * calls cannot be intermixed with DosXXX + * calls since EMX remaps file/socket + * handles. + * 04/27/2000 IBM Corp. Changed open file to be more like NT and + * better handle PR_TRUNCATE | PR_CREATE_FILE + * and also fixed _PR_MD_SET_FD_INHERITABLE */ /* OS2 IO module @@ -107,25 +124,40 @@ _PR_MD_OPEN(const char *name, PRIntn osflags, int mode) { HFILE file; PRInt32 access = OPEN_SHARE_DENYNONE; - PRInt32 flags = OPEN_ACTION_OPEN_IF_EXISTS; + PRInt32 flags = 0L; PRInt32 rc; PRUword actionTaken; ULONG CurMaxFH = 0; LONG ReqCount = 1; ULONG fattr; - + + if (osflags & PR_SYNC) access |= OPEN_FLAGS_WRITE_THROUGH; + if (osflags & PR_RDONLY) access |= OPEN_ACCESS_READONLY; else if (osflags & PR_WRONLY) access |= OPEN_ACCESS_WRITEONLY; else if(osflags & PR_RDWR) access |= OPEN_ACCESS_READWRITE; - if (osflags & PR_CREATE_FILE) - flags |= OPEN_ACTION_CREATE_IF_NEW; - else if (osflags & PR_TRUNCATE){ - flags &= ~OPEN_ACTION_OPEN_IF_EXISTS; - flags |= OPEN_ACTION_REPLACE_IF_EXISTS; + + if ( osflags & PR_CREATE_FILE && osflags & PR_EXCL ) + { + flags = OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_FAIL_IF_EXISTS; + } + else if (osflags & PR_CREATE_FILE) + { + if (osflags & PR_TRUNCATE) + flags = OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_REPLACE_IF_EXISTS; + else + flags = OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS; + } + else + { + if (osflags & PR_TRUNCATE) + flags = OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_REPLACE_IF_EXISTS; + else + flags = OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS; } if (isxdigit(mode) == 0) /* file attribs are hex, UNIX modes octal */ @@ -182,23 +214,16 @@ _PR_MD_WRITE(PRFileDesc *fd, const void *buf, PRInt32 len) PRInt32 bytes; int rv; - /* No longer using DosWrite since it doesn't convert \n to \n\r like C runtime does */ -#if 0 rv = DosWrite((HFILE)fd->secret->md.osfd, (PVOID)buf, len, - &bytes); + (PULONG)&bytes); if (rv != NO_ERROR) { - _PR_MD_MAP_WRITE_ERROR(rv); + _PR_MD_MAP_WRITE_ERROR(rv); return -1; } -#else - bytes = write(fd->secret->md.osfd, buf, len); - if (bytes == -1) - _PR_MD_MAP_WRITE_ERROR(errno); -#endif return bytes; } /* --- end _PR_MD_WRITE() --- */ @@ -718,7 +743,7 @@ _PR_MD_SET_FD_INHERITABLE(PRFileDesc *fd, PRBool inheritable) } if (inheritable) - flags &= OPEN_FLAGS_NOINHERIT; + flags &= ~OPEN_FLAGS_NOINHERIT; else flags |= OPEN_FLAGS_NOINHERIT; diff --git a/pr/src/md/unix/Makefile b/pr/src/md/unix/Makefile index de8baadd..97248fb5 100644 --- a/pr/src/md/unix/Makefile +++ b/pr/src/md/unix/Makefile @@ -237,6 +237,12 @@ ifeq ($(OS_ARCH),SunOS) endif endif +ifeq ($(OS_ARCH),Linux) + ifeq ($(CPU_ARCH),x86) + ASFILES = os_Linux_x86.s + endif +endif + ifeq ($(OS_ARCH), SINIX) ifeq ($(CPU_ARCH),mips) ASFILES = os_ReliantUNIX.s diff --git a/pr/src/md/unix/Makefile.in b/pr/src/md/unix/Makefile.in index 9fb73bf8..6951873e 100644 --- a/pr/src/md/unix/Makefile.in +++ b/pr/src/md/unix/Makefile.in @@ -248,6 +248,12 @@ ifeq ($(OS_ARCH),SunOS) endif endif +ifeq ($(OS_ARCH),Linux) + ifeq ($(CPU_ARCH),x86) + ASFILES = os_Linux_x86.s + endif +endif + ifeq ($(OS_ARCH), SINIX) ifeq ($(CPU_ARCH),mips) ASFILES = os_ReliantUNIX.s diff --git a/pr/src/md/unix/darwin.c b/pr/src/md/unix/darwin.c index ff5f1ad7..93421318 100644 --- a/pr/src/md/unix/darwin.c +++ b/pr/src/md/unix/darwin.c @@ -87,13 +87,32 @@ _MD_CREATE_THREAD( } #endif /* ! _PR_PTHREADS */ +#if defined(_PR_PTHREADS) + /* -** Whoops, we don't have a syscall stub for this +** Stubs for unimplemented functions */ -int mprotect (caddr_t addr, size_t size, int prot) + +int pthread_condattr_init(pthread_condattr_t *attr) +{ + return 0; +} + +int pthread_kill(pthread_t thread, int sig) { - return -1; -} + return ENOSYS; +} + +typedef struct siginfo_t siginfo_t; + +int sigtimedwait(const sigset_t *set, siginfo_t *info, + const struct timespec *timeout) +{ + errno = ENOSYS; + return -1; +} + +#endif /* _PR_PTHREADS */ /* rhapsody.c */ diff --git a/pr/src/md/unix/objs.mk b/pr/src/md/unix/objs.mk index d8196c81..d2aa9cb4 100644 --- a/pr/src/md/unix/objs.mk +++ b/pr/src/md/unix/objs.mk @@ -235,6 +235,12 @@ ifeq ($(OS_ARCH),SunOS) endif endif +ifeq ($(OS_ARCH),Linux) + ifeq ($(CPU_ARCH),x86) + ASFILES = os_Linux_x86.s + endif +endif + ifeq ($(OS_ARCH), SINIX) ifeq ($(CPU_ARCH),mips) ASFILES = os_ReliantUNIX.s diff --git a/pr/src/md/unix/os_Linux_x86.s b/pr/src/md/unix/os_Linux_x86.s new file mode 100644 index 00000000..f72f28d2 --- /dev/null +++ b/pr/src/md/unix/os_Linux_x86.s @@ -0,0 +1,95 @@ +/ -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/ +/ The contents of this file are subject to the Netscape Public License +/ Version 1.1 (the "NPL"); you may not use this file except in +/ compliance with the NPL. You may obtain a copy of the NPL at +/ http://www.mozilla.org/NPL/ +/ +/ Software distributed under the NPL is distributed on an "AS IS" basis, +/ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +/ for the specific language governing rights and limitations under the +/ NPL. +/ +/ The Initial Developer of this code under the NPL is Netscape +/ Communications Corporation. Portions created by Netscape are +/ Copyright (C) 2000 Netscape Communications Corporation. All Rights +/ Reserved. +/ + +/ PRInt32 _PR_x86_AtomicIncrement(PRInt32 *val) +/ +/ Atomically increment the integer pointed to by 'val' and return +/ the result of the increment. +/ + .text + .globl _PR_x86_AtomicIncrement + .align 4 +_PR_x86_AtomicIncrement: + movl 4(%esp), %ecx + movl $1, %eax + lock + xaddl %eax, (%ecx) + incl %eax + ret + +/ PRInt32 _PR_x86_AtomicDecrement(PRInt32 *val) +/ +/ Atomically decrement the integer pointed to by 'val' and return +/ the result of the decrement. +/ + .text + .globl _PR_x86_AtomicDecrement + .align 4 +_PR_x86_AtomicDecrement: + movl 4(%esp), %ecx + movl $-1, %eax + lock + xaddl %eax, (%ecx) + decl %eax + ret + +/ PRInt32 _PR_x86_AtomicSet(PRInt32 *val, PRInt32 newval) +/ +/ Atomically set the integer pointed to by 'val' to the new +/ value 'newval' and return the old value. +/ +/ An alternative implementation: +/ .text +/ .globl _PR_x86_AtomicSet +/ .align 4 +/_PR_x86_AtomicSet: +/ movl 4(%esp), %ecx +/ movl 8(%esp), %edx +/ movl (%ecx), %eax +/retry: +/ lock +/ cmpxchgl %edx, (%ecx) +/ jne retry +/ ret +/ + .text + .globl _PR_x86_AtomicSet + .align 4 +_PR_x86_AtomicSet: + movl 4(%esp), %ecx + movl 8(%esp), %eax + lock + xchgl %eax, (%ecx) + ret + +/ PRInt32 _PR_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_x86_AtomicAdd + .align 4 +_PR_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/rhapsody.c b/pr/src/md/unix/rhapsody.c index ff5f1ad7..93421318 100644 --- a/pr/src/md/unix/rhapsody.c +++ b/pr/src/md/unix/rhapsody.c @@ -87,13 +87,32 @@ _MD_CREATE_THREAD( } #endif /* ! _PR_PTHREADS */ +#if defined(_PR_PTHREADS) + /* -** Whoops, we don't have a syscall stub for this +** Stubs for unimplemented functions */ -int mprotect (caddr_t addr, size_t size, int prot) + +int pthread_condattr_init(pthread_condattr_t *attr) +{ + return 0; +} + +int pthread_kill(pthread_t thread, int sig) { - return -1; -} + return ENOSYS; +} + +typedef struct siginfo_t siginfo_t; + +int sigtimedwait(const sigset_t *set, siginfo_t *info, + const struct timespec *timeout) +{ + errno = ENOSYS; + return -1; +} + +#endif /* _PR_PTHREADS */ /* rhapsody.c */ diff --git a/pr/src/md/unix/uxproces.c b/pr/src/md/unix/uxproces.c index 8c0a9b96..ac0c6ef8 100644 --- a/pr/src/md/unix/uxproces.c +++ b/pr/src/md/unix/uxproces.c @@ -27,7 +27,11 @@ #include <dlfcn.h> /* For dlopen, dlsym, dlclose */ #endif +#if defined(RHAPSODY) +#include <crt_externs.h> +#else extern char **environ; +#endif /* * HP-UX 9 doesn't have the SA_RESTART flag. @@ -156,7 +160,11 @@ ForkAndExec( childEnvp = envp; if (attr && attr->fdInheritBuffer) { if (NULL == childEnvp) { +#ifdef RHAPSODY + childEnvp = *(_NSGetEnviron()); +#else childEnvp = environ; +#endif } for (nEnv = 0; childEnvp[nEnv]; nEnv++) { } diff --git a/pr/src/md/unix/uxrng.c b/pr/src/md/unix/uxrng.c index 23b88705..305d13af 100644 --- a/pr/src/md/unix/uxrng.c +++ b/pr/src/md/unix/uxrng.c @@ -261,7 +261,8 @@ GetHighResClock(void *buf, size_t maxbytes) { return 0; } -#elif defined(SCO) || defined(UNIXWARE) || defined(BSDI) || defined(NTO) || defined(QNX) +#elif defined(SCO) || defined(UNIXWARE) || defined(BSDI) || defined(NTO) \ + || defined(QNX) || defined(RHAPSODY) #include <sys/times.h> static size_t diff --git a/pr/src/md/unix/uxshm.c b/pr/src/md/unix/uxshm.c index 162ffb46..070f9fba 100644 --- a/pr/src/md/unix/uxshm.c +++ b/pr/src/md/unix/uxshm.c @@ -609,7 +609,7 @@ extern PRFileMap * _md_ImportFileMapFromString( PRInt32 osfd; PRIntn prot; /* really: a PRFileMapProtect */ PRFileDesc *fd; - PRFileMap *fm; + PRFileMap *fm = NULL; /* default return value */ PRFileInfo64 info; PR_sscanf( fmstring, "%ld:%d", &osfd, &prot ); diff --git a/pr/src/md/windows/ntinrval.c b/pr/src/md/windows/ntinrval.c index ba5e1e8e..ea67302d 100644 --- a/pr/src/md/windows/ntinrval.c +++ b/pr/src/md/windows/ntinrval.c @@ -72,7 +72,7 @@ _PR_MD_GET_INTERVAL() #elif defined(WIN16) return clock(); /* milliseconds since application start */ #else - return timeGetTime(); /* milliseconds since system start */ + return GetTickCount(); /* milliseconds since system start */ #endif } diff --git a/pr/src/md/windows/ntio.c b/pr/src/md/windows/ntio.c index 5326be68..fb8cc5ff 100644 --- a/pr/src/md/windows/ntio.c +++ b/pr/src/md/windows/ntio.c @@ -744,7 +744,7 @@ void _PR_Unblock_IO_Wait(PRThread *thr) * this thread will continue to run on the same cpu until the * I/O is aborted by closing the FD or calling CancelIO */ - thr->md.thr_bound_cpu = me->cpu; + thr->md.thr_bound_cpu = cpu; PR_ASSERT(!(thr->flags & _PR_IDLE_THREAD)); _PR_AddThreadToRunQ(me, thr); @@ -2044,7 +2044,7 @@ _PR_MD_GETPEERNAME(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *len) PR_SetError(PR_NOT_CONNECTED_ERROR, 0); return PR_FAILURE; } - *len = PR_NETADDR_SIZE(addr); + *len = PR_NETADDR_SIZE(&fd->secret->md.peer_addr); memcpy(addr, &fd->secret->md.peer_addr, *len); return PR_SUCCESS; } else { @@ -3016,7 +3016,10 @@ _PR_MD_GETFILEINFO64(const char *fn, PRFileInfo64 *info) } len = GetFullPathName(fn, sizeof(pathbuf), pathbuf, &filePart); - PR_ASSERT(0 != len); + if (0 == len) { + _PR_MD_MAP_OPENDIR_ERROR(GetLastError()); + return -1; + } if (len > sizeof(pathbuf)) { PR_SetError(PR_NAME_TOO_LONG_ERROR, 0); return -1; diff --git a/pr/src/md/windows/w95io.c b/pr/src/md/windows/w95io.c index d80736fe..3832eb4b 100644 --- a/pr/src/md/windows/w95io.c +++ b/pr/src/md/windows/w95io.c @@ -773,7 +773,10 @@ _PR_MD_GETFILEINFO64(const char *fn, PRFileInfo64 *info) } len = GetFullPathName(fn, sizeof(pathbuf), pathbuf, &filePart); - PR_ASSERT(0 != len); + if (0 == len) { + _PR_MD_MAP_OPENDIR_ERROR(GetLastError()); + return -1; + } if (len > sizeof(pathbuf)) { PR_SetError(PR_NAME_TOO_LONG_ERROR, 0); return -1; diff --git a/pr/src/memory/Makefile b/pr/src/memory/Makefile index 25762308..28c15b13 100644 --- a/pr/src/memory/Makefile +++ b/pr/src/memory/Makefile @@ -30,6 +30,10 @@ endif CSRCS = prseg.c prshm.c prshma.c +ifdef GC_LEAK_DETECTOR +CSRCS += prgcleak.c +endif + TARGETS = $(OBJS) INCLUDES = -I$(DIST)/include -I$(MOD_DEPTH)/pr/include -I$(MOD_DEPTH)/pr/include/private diff --git a/pr/src/memory/Makefile.in b/pr/src/memory/Makefile.in index 7fa317e3..53c9dde1 100644 --- a/pr/src/memory/Makefile.in +++ b/pr/src/memory/Makefile.in @@ -37,6 +37,10 @@ endif #!USE_AUTOCONF CSRCS = prseg.c prshm.c prshma.c +ifdef GC_LEAK_DETECTOR +CSRCS += prgcleak.c +endif + TARGETS = $(OBJS) INCLUDES = -I$(DIST)/include -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private diff --git a/pr/src/memory/prgcleak.c b/pr/src/memory/prgcleak.c new file mode 100644 index 00000000..4006ad71 --- /dev/null +++ b/pr/src/memory/prgcleak.c @@ -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 Netscape Public License + * Version 1.1 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1999 Netscape Communications Corporation. All Rights + * Reserved. + * + * Contributor(s): + * Patrick Beard <beard@netscape.com> + */ + +/* + * prgcleak.c + */ + +#ifdef GC_LEAK_DETECTOR + +/* for FILE */ +#include <stdio.h> + +/* NSPR stuff */ +#include "generic_threads.h" +#include "primpl.h" + +extern FILE *GC_stdout, *GC_stderr; + +extern void GC_gcollect(void); +extern void GC_clear_roots(void); + +static PRStatus PR_CALLBACK scanner(PRThread* t, void** baseAddr, + PRUword count, void* closure) +{ + if (count) { + char* begin = (char*)baseAddr; + char* end = (char*)(baseAddr + count); + GC_mark_range_proc marker = (GC_mark_range_proc) closure; + marker(begin, end); + } + return PR_SUCCESS; +} + +static void mark_all_stacks(GC_mark_range_proc marker) +{ + PR_ScanStackPointers(&scanner, (void *)marker); +} + +#if defined(_PR_PTHREADS) +#define _PR_MD_CURRENT_CPU() 1 +#endif + +static void locker(void* mutex) +{ + if (_PR_MD_CURRENT_CPU()) + PR_EnterMonitor(mutex); +} + +static void unlocker(void* mutex) +{ + if (_PR_MD_CURRENT_CPU()) + PR_ExitMonitor(mutex); +} + +static void stopper(void* unused) +{ + if (_PR_MD_CURRENT_CPU()) + PR_SuspendAll(); +} + +static void starter(void* unused) +{ + if (_PR_MD_CURRENT_CPU()) + PR_ResumeAll(); +} + +void _PR_InitGarbageCollector() +{ + void* mutex; + + /* redirect GC's stderr to catch startup leaks. */ + GC_stderr = fopen("StartupLeaks", "w"); + + mutex = PR_NewMonitor(); + PR_ASSERT(mutex != NULL); + + GC_generic_init_threads(&mark_all_stacks, mutex, + &locker, &unlocker, + &stopper, &starter); +} + +void _PR_ShutdownGarbageCollector() +{ + /* do anything you need to shut down the collector. */ +} + +#endif /* GC_LEAK_DETECTOR */ diff --git a/pr/src/misc/prnetdb.c b/pr/src/misc/prnetdb.c index f31374b3..38b81cd1 100644 --- a/pr/src/misc/prnetdb.c +++ b/pr/src/misc/prnetdb.c @@ -863,7 +863,7 @@ PR_IMPLEMENT(PRStatus) PR_GetProtoByNumber( } -PR_IMPLEMENT(PRUintn) PR_NetAddrSize(const PRNetAddr* addr) +PRUintn _PR_NetAddrSize(const PRNetAddr* addr) { PRUintn addrsize; @@ -890,7 +890,7 @@ PR_IMPLEMENT(PRUintn) PR_NetAddrSize(const PRNetAddr* addr) else addrsize = 0; return addrsize; -} /* PR_NetAddrSize */ +} /* _PR_NetAddrSize */ PR_IMPLEMENT(PRIntn) PR_EnumerateHostEnt( PRIntn enumIndex, const PRHostEnt *hostEnt, PRUint16 port, PRNetAddr *address) diff --git a/pr/src/misc/prthinfo.c b/pr/src/misc/prthinfo.c index 2cfac1b2..a278e0ad 100644 --- a/pr/src/misc/prthinfo.c +++ b/pr/src/misc/prthinfo.c @@ -134,24 +134,14 @@ PR_ThreadScanStackPointers(PRThread* t, if (status != PR_SUCCESS) return status; +#ifndef GC_LEAK_DETECTOR + /* if thread is not allocated on stack, this is redundant. */ ptd = t->privateData; for (index = 0; index < t->tpdLength; index++, ptd++) { status = scanFun(t, (void**)ptd, 1, scanClosure); if (status != PR_SUCCESS) return status; } - -#ifdef GC_LEAK_DETECTOR - /* - ** if the thread was allocated on its own stack, conservatively - ** scan the thread object itself to keep all data structures - ** referenced by the thread visible to the garbage collector. - */ - if (t->threadAllocatedOnStack) { - status = scanFun(t, (void**)t, (sizeof(PRThread) + 3) / sizeof(void*), scanClosure); - if (status != PR_SUCCESS) - return status; - } #endif return PR_SUCCESS; diff --git a/pr/src/pthreads/ptio.c b/pr/src/pthreads/ptio.c index b301ebd5..9dfcffeb 100644 --- a/pr/src/pthreads/ptio.c +++ b/pr/src/pthreads/ptio.c @@ -123,7 +123,7 @@ static ssize_t (*pt_aix_sendfile_fptr)() = NULL; #define _PRSockOptVal_t char * #elif defined(IRIX) || defined(OSF1) || defined(AIX) || defined(HPUX) \ || defined(LINUX) || defined(FREEBSD) || defined(BSDI) || defined(VMS) \ - || defined(NTO) || defined(OPENBSD) + || defined(NTO) || defined(OPENBSD) || defined(RHAPSODY) #define _PRSockOptVal_t void * #else #error "Cannot determine architecture" @@ -137,7 +137,7 @@ static ssize_t (*pt_aix_sendfile_fptr)() = NULL; || defined(OSF1) || defined(SOLARIS) \ || defined(HPUX10_30) || defined(HPUX11) || defined(LINUX) \ || defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \ - || defined(BSDI) || defined(VMS) || defined(NTO) + || defined(BSDI) || defined(VMS) || defined(NTO) || defined(RHAPSODY) #define _PRSelectFdSetArg_t fd_set * #else #error "Cannot determine architecture" @@ -2424,7 +2424,8 @@ 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(OPENBSD) || defined(BSDI) || defined(VMS) || defined(NTO) \ + || defined(RHAPSODY) #define _PR_FCNTL_FLAGS O_NONBLOCK #else #error "Can't determine architecture" diff --git a/pr/src/pthreads/ptsynch.c b/pr/src/pthreads/ptsynch.c index b3ff68da..5cdd0fd3 100644 --- a/pr/src/pthreads/ptsynch.c +++ b/pr/src/pthreads/ptsynch.c @@ -248,7 +248,7 @@ static PRIntn pt_TimedWait( /* - * Notifies just get posted to the to the protecting mutex. The + * Notifies just get posted to the protecting mutex. The * actual notification is done when the lock is released so that * MP systems don't contend for a lock that they can't have. */ @@ -649,6 +649,14 @@ PR_IMPLEMENT(PRSemaphore*) PR_NewSem(PRUintn value) return NULL; } +/* + * Define the interprocess named semaphore functions. + * There are three implementations: + * 1. POSIX semaphore based; + * 2. System V semaphore based; + * 3. unsupported (fails with PR_NOT_IMPLEMENTED_ERROR). + */ + #ifdef _PR_HAVE_POSIX_SEMAPHORES #include <fcntl.h> @@ -750,9 +758,7 @@ PR_IMPLEMENT(PRStatus) PR_DeleteSemaphore(const char *name) return PR_SUCCESS; } -#endif /* _PR_HAVE_POSIX_SEMAPHORES */ - -#ifdef _PR_HAVE_SYSV_SEMAPHORES +#elif defined(_PR_HAVE_SYSV_SEMAPHORES) #include <fcntl.h> #include <sys/sem.h> @@ -961,7 +967,43 @@ PR_IMPLEMENT(PRStatus) PR_DeleteSemaphore(const char *name) return PR_SUCCESS; } -#endif /* _PR_HAVE_SYSV_SEMAPHORES */ +#else /* neither POSIX nor System V semaphores are available */ + +PR_IMPLEMENT(PRSem *) PR_OpenSemaphore( + const char *name, + PRIntn flags, + PRIntn mode, + PRUintn value) +{ + PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); + return NULL; +} + +PR_IMPLEMENT(PRStatus) PR_WaitSemaphore(PRSem *sem) +{ + PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); + return PR_FAILURE; +} + +PR_IMPLEMENT(PRStatus) PR_PostSemaphore(PRSem *sem) +{ + PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); + return PR_FAILURE; +} + +PR_IMPLEMENT(PRStatus) PR_CloseSemaphore(PRSem *sem) +{ + PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); + return PR_FAILURE; +} + +PR_IMPLEMENT(PRStatus) PR_DeleteSemaphore(const char *name) +{ + PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); + return PR_FAILURE; +} + +#endif /* end of interprocess named semaphore functions */ /**************************************************************/ /**************************************************************/ diff --git a/pr/src/pthreads/ptthread.c b/pr/src/pthreads/ptthread.c index 23189c53..af751db8 100644 --- a/pr/src/pthreads/ptthread.c +++ b/pr/src/pthreads/ptthread.c @@ -75,6 +75,42 @@ static PRIntn pt_PriorityMap(PRThreadPriority pri) } #endif +#if defined(GC_LEAK_DETECTOR) && (__GLIBC__ >= 2) && defined(__i386__) + +#include <setjmp.h> + +typedef struct stack_frame stack_frame; + +struct stack_frame { + stack_frame* next; + void* pc; +}; + +static stack_frame* GetStackFrame() +{ + jmp_buf jb; + stack_frame* currentFrame; + setjmp(jb); + currentFrame = (stack_frame*)(jb[0].__jmpbuf[JB_BP]); + currentFrame = currentFrame->next; + return currentFrame; +} + +static void* GetStackTop() +{ + stack_frame* frame; + frame = GetStackFrame(); + while (frame != NULL) + { + ptrdiff_t pc = (ptrdiff_t)frame->pc; + if ((pc < 0x08000000) || (pc > 0x7fffffff) || (frame->next < frame)) + return frame; + frame = frame->next; + } + return NULL; +} +#endif /* GC_LEAK_DETECTOR && (__GLIBC__ >= 2) && __i386__ */ + /* ** Initialize a stack for a native pthread thread */ @@ -91,9 +127,14 @@ static void _PR_InitializeStack(PRThreadStack *ts) ts->stackBottom = ts->allocBase + ts->stackSize; ts->stackTop = ts->allocBase; #else +#ifdef GC_LEAK_DETECTOR + ts->stackTop = GetStackTop(); + ts->stackBottom = ts->stackTop - ts->stackSize; +#else ts->stackTop = ts->allocBase; ts->stackBottom = ts->allocBase - ts->stackSize; #endif +#endif } } @@ -1031,7 +1072,7 @@ PR_IMPLEMENT(PRStatus) PR_EnumerateThreads(PREnumerator func, void *arg) */ PRThread* next = thred->next; - if (thred->state & PT_THREAD_GCABLE) + if (_PT_IS_GCABLE_THREAD(thred)) { #if !defined(_PR_DCETHREADS) PR_ASSERT((thred == me) || (thred->suspend & PT_THREAD_SUSPENDED)); @@ -1095,7 +1136,7 @@ static void suspend_signal_handler(PRIntn sig) PRThread *me = PR_CurrentThread(); PR_ASSERT(me != NULL); - PR_ASSERT(me->state & PT_THREAD_GCABLE); + PR_ASSERT(_PT_IS_GCABLE_THREAD(me)); PR_ASSERT((me->suspend & PT_THREAD_SUSPENDED) == 0); PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, @@ -1286,7 +1327,7 @@ PR_IMPLEMENT(void) PR_SuspendAll() #endif while (thred != NULL) { - if ((thred != me) && (thred->state & PT_THREAD_GCABLE)) + if ((thred != me) && _PT_IS_GCABLE_THREAD(thred)) PR_SuspendSet(thred); thred = thred->next; } @@ -1295,7 +1336,7 @@ PR_IMPLEMENT(void) PR_SuspendAll() thred = pt_book.first; while (thred != NULL) { - if ((thred != me) && (thred->state & PT_THREAD_GCABLE)) + if ((thred != me) && _PT_IS_GCABLE_THREAD(thred)) PR_SuspendTest(thred); thred = thred->next; } @@ -1328,7 +1369,7 @@ PR_IMPLEMENT(void) PR_ResumeAll() while (thred != NULL) { - if ((thred != me) && (thred->state & PT_THREAD_GCABLE)) + if ((thred != me) && _PT_IS_GCABLE_THREAD(thred)) PR_ResumeSet(thred); thred = thred->next; } @@ -1336,7 +1377,7 @@ PR_IMPLEMENT(void) PR_ResumeAll() thred = pt_book.first; while (thred != NULL) { - if ((thred != me) && (thred->state & PT_THREAD_GCABLE)) + if ((thred != me) && _PT_IS_GCABLE_THREAD(thred)) PR_ResumeTest(thred); thred = thred->next; } diff --git a/pr/src/threads/combined/pruthr.c b/pr/src/threads/combined/pruthr.c index 0025bcbb..0bada3d1 100644 --- a/pr/src/threads/combined/pruthr.c +++ b/pr/src/threads/combined/pruthr.c @@ -1248,6 +1248,14 @@ PR_IMPLEMENT(PRThread*) _PR_CreateThread(PRThreadType type, top = (char*)((PRUptrdiff)top & ~0x3f); } #endif +#if defined(GC_LEAK_DETECTOR) + /* + * sorry, it is not safe to allocate the thread on the stack, + * because we assign to this object before the GC can learn + * about this thread. we'll just leak thread objects instead. + */ + thread = PR_NEW(PRThread); +#endif stack->thr = thread; memset(thread, 0, sizeof(PRThread)); thread->threadAllocatedOnStack = 1; diff --git a/pr/tests/Makefile b/pr/tests/Makefile index d1851723..943eaa10 100644 --- a/pr/tests/Makefile +++ b/pr/tests/Makefile @@ -423,7 +423,7 @@ LIBPTHREAD = -lpthread ifeq ($(OS_ARCH),AIX) LIBPTHREAD = -lpthreads endif -ifeq (,$(filter-out FreeBSD OpenBSD BSD_OS NTO,$(OS_ARCH))) +ifeq (,$(filter-out FreeBSD OpenBSD BSD_OS NTO Rhapsody,$(OS_ARCH))) LIBPTHREAD = endif ifeq ($(OS_ARCH)$(basename $(OS_RELEASE)),HP-UXB.10) diff --git a/pr/tests/Makefile.in b/pr/tests/Makefile.in index 30dad6d7..56104459 100644 --- a/pr/tests/Makefile.in +++ b/pr/tests/Makefile.in @@ -425,7 +425,7 @@ LIBPTHREAD = -lpthread ifeq ($(OS_ARCH),AIX) LIBPTHREAD = -lpthreads endif -ifeq (,$(filter-out FreeBSD OpenBSD BSD_OS NTO,$(OS_ARCH))) +ifeq (,$(filter-out FreeBSD OpenBSD BSD_OS NTO Rhapsody,$(OS_ARCH))) LIBPTHREAD = endif ifeq ($(OS_ARCH)$(basename $(OS_RELEASE)),HP-UXB.10) diff --git a/pr/tests/ipv6.c b/pr/tests/ipv6.c index 4029fedd..5914cbda 100644 --- a/pr/tests/ipv6.c +++ b/pr/tests/ipv6.c @@ -16,15 +16,6 @@ * Reserved. */ -#ifdef XP_BEOS -#include <stdio.h> -int main() -{ - printf( "BeOS does not support IPv6\n" ); - return 0; -} -#else - #include "prio.h" #include "prenv.h" #include "prmem.h" @@ -45,6 +36,10 @@ int main() #define HOST_BUFFER 1024 #define PROTO_BUFFER 1500 +#define NETADDR_SIZE(addr) \ + (PR_AF_INET == (addr)->raw.family ? \ + sizeof((addr)->inet) : sizeof((addr)->ipv6)) + static PRFileDesc *err = NULL; static void Help(void) @@ -59,7 +54,7 @@ static void DumpAddr(const PRNetAddr* address, const char *msg) { PRUint32 *word = (PRUint32*)address; PRUint32 addr_len = sizeof(PRNetAddr); - PR_fprintf(err, "%s[%d]\t", msg, PR_NETADDR_SIZE(address)); + PR_fprintf(err, "%s[%d]\t", msg, NETADDR_SIZE(address)); while (addr_len > 0) { PR_fprintf(err, " %08x", *word++); @@ -73,7 +68,6 @@ static PRStatus PrintAddress(const PRNetAddr* address) PRNetAddr translation; char buffer[ADDR_BUFFER]; PRStatus rv = PR_NetAddrToString(address, buffer, sizeof(buffer)); - memset(&translation, 0, sizeof(PRNetAddr)); if (PR_FAILURE == rv) PL_FPrintError(err, "PR_NetAddrToString"); else { @@ -83,7 +77,7 @@ static PRStatus PrintAddress(const PRNetAddr* address) if (PR_FAILURE == rv) PL_FPrintError(err, "PR_StringToNetAddr"); else { - PRSize addr_len = PR_NETADDR_SIZE(address); + PRSize addr_len = NETADDR_SIZE(address); if (0 != memcmp(address, &translation, addr_len)) { PR_fprintf(err, "Address translations do not match\n"); @@ -102,7 +96,6 @@ PRIntn main(PRIntn argc, char **argv) PLOptStatus os; PRHostEnt host; PRProtoEnt proto; - PRBool ipv6 = PR_FALSE; const char *name = NULL; PRBool failed = PR_FALSE, version = PR_FALSE; PLOptState *opt = PL_CreateOptState(argc, argv, "Vh"); @@ -130,12 +123,10 @@ PRIntn main(PRIntn argc, char **argv) if (version) { -#if defined(XP_UNIX) || defined(XP_OS2) -#define NSPR_LIB "nspr21" -#elif defined(WIN32) -#define NSPR_LIB "libnspr21" +#if defined(WINNT) +#define NSPR_LIB "libnspr4" #else -#error "Architecture not supported" +#define NSPR_LIB "nspr4" #endif const PRVersionDescription *version_info; char *nspr_path = PR_GetEnv("LD_LIBRARY_PATH"); @@ -236,5 +227,3 @@ PRIntn main(PRIntn argc, char **argv) return (failed) ? 1 : 0; } - -#endif /* XP_BEOS */ diff --git a/pr/tests/tpd.c b/pr/tests/tpd.c index 62166937..42180949 100644 --- a/pr/tests/tpd.c +++ b/pr/tests/tpd.c @@ -109,7 +109,6 @@ static void PR_CALLBACK Thread(void *null) } PrintProgress(__LINE__); -#if !defined(DEBUG) did = should = PR_FALSE; for (keys = 4; keys < 8; ++keys) { @@ -117,7 +116,6 @@ static void PR_CALLBACK Thread(void *null) MY_ASSERT(PR_FAILURE == rv); } PrintProgress(__LINE__); -#endif did = PR_FALSE; should = PR_TRUE; for (keys = 0; keys < 4; ++keys) @@ -214,7 +212,8 @@ static PRIntn PR_CALLBACK Tpd(PRIntn argc, char **argv) } PrintProgress(__LINE__); -#if !defined(DEBUG) + for (keys = 4; keys < 8; ++keys) + key[keys] = 4096; /* set to invalid value */ did = should = PR_FALSE; for (keys = 4; keys < 8; ++keys) { @@ -222,7 +221,6 @@ static PRIntn PR_CALLBACK Tpd(PRIntn argc, char **argv) MY_ASSERT(PR_FAILURE == rv); } PrintProgress(__LINE__); -#endif did = PR_FALSE; should = PR_TRUE; for (keys = 0; keys < 4; ++keys) |