From c24dc97185327dc82f0839025b3e947ec71a4438 Mon Sep 17 00:00:00 2001 From: cvs2hg Date: Fri, 20 Apr 2001 01:25:00 +0000 Subject: fixup commit for branch 'Accessible_042501_Branch3' --- .cvsignore | 5 + Makefile | 105 - Makefile.in | 22 +- build/autoconf/config.guess | 946 ++++++--- build/autoconf/config.sub | 562 +++++- config/.cvsignore | 5 + config/BSD_OS.mk | 4 +- config/BeOS.mk | 1 + config/HP-UX.mk | 3 +- config/Linux.mk | 6 +- config/Makefile | 118 -- config/Makefile.in | 35 +- config/NTO.mk | 6 +- config/NetBSD.mk | 28 +- config/OS2.mk | 11 +- config/OSF1.mk | 2 +- config/OpenBSD.mk | 4 +- config/Rhapsody.mk | 17 +- config/UNIX.mk | 1 + config/WIN32.mk | 10 +- config/arch.mk | 14 +- config/autoconf.mk.in | 52 +- config/config.mk | 122 +- config/nsinstall.c | 2 + config/nspr-config.in | 111 + config/nspr.m4 | 67 + config/rules.mk | 103 +- config/win16.mk | 1 + configure | 3023 +++++++++++++++++++--------- configure.in | 1292 ++++++++++-- gmakefile.win | 76 + lib/.cvsignore | 1 + lib/Makefile | 32 - lib/Makefile.in | 1 - lib/ds/.cvsignore | 2 + lib/ds/Makefile | 174 -- lib/ds/Makefile.in | 90 +- lib/ds/plhash.c | 45 + lib/ds/plhash.h | 7 + lib/libc/.cvsignore | 1 + lib/libc/Makefile | 32 - lib/libc/Makefile.in | 1 - lib/libc/include/.cvsignore | 1 + lib/libc/include/Makefile | 37 - lib/libc/include/Makefile.in | 3 +- lib/libc/src/.cvsignore | 2 + lib/libc/src/Makefile | 174 -- lib/libc/src/Makefile.in | 87 +- lib/libc/src/strccmp.c | 18 +- lib/msgc/.cvsignore | 1 + lib/msgc/Makefile | 28 - lib/msgc/Makefile.in | 1 - lib/msgc/include/.cvsignore | 1 + lib/msgc/include/Makefile | 37 - lib/msgc/include/Makefile.in | 3 +- lib/msgc/src/.cvsignore | 1 + lib/msgc/src/Makefile | 121 -- lib/msgc/src/Makefile.in | 74 +- lib/msgc/tests/.cvsignore | 1 + lib/msgc/tests/Makefile | 290 --- lib/msgc/tests/Makefile.in | 84 +- lib/prstreams/.cvsignore | 1 + lib/prstreams/Makefile | 199 -- lib/prstreams/Makefile.in | 91 +- lib/prstreams/tests/testprstrm/.cvsignore | 1 + lib/prstreams/tests/testprstrm/Makefile | 230 --- lib/prstreams/tests/testprstrm/Makefile.in | 69 +- lib/tests/.cvsignore | 1 + lib/tests/Makefile | 235 --- lib/tests/Makefile.in | 73 +- macbuild/NSPR20PPC.mcp | Bin 97889 -> 167357 bytes macbuild/NSPRCarbon.Prefix | 11 + macbuild/NSPRCarbonDebug.Prefix | 12 + macbuild/NSPRConfig.h | 1 - makefile.win | 105 - pr/.cvsignore | 1 + pr/Makefile | 24 - pr/include/.cvsignore | 1 + pr/include/Makefile | 37 - pr/include/Makefile.in | 5 +- pr/include/md/.cvsignore | 1 + pr/include/md/Makefile | 189 -- pr/include/md/Makefile.in | 157 +- pr/include/md/_aix32in6.cfg | 3 - pr/include/md/_aix64.cfg | 3 - pr/include/md/_beos.cfg | 2 + pr/include/md/_beos.h | 5 +- pr/include/md/_bsdi.cfg | 2 + pr/include/md/_darwin.cfg | 2 + pr/include/md/_darwin.h | 2 +- pr/include/md/_freebsd.cfg | 2 + pr/include/md/_linux.cfg | 15 +- pr/include/md/_linux.h | 20 +- pr/include/md/_macos.h | 16 +- pr/include/md/_netbsd.cfg | 8 +- pr/include/md/_netbsd.h | 121 +- pr/include/md/_nto.cfg | 2 + pr/include/md/_nto.h | 6 +- pr/include/md/_openbsd.cfg | 2 + pr/include/md/_openvms.cfg | 2 + pr/include/md/_openvms.h | 12 + pr/include/md/_os2.cfg | 2 + pr/include/md/_os2.h | 7 + pr/include/md/_pth.h | 6 +- pr/include/md/_rhapsody.cfg | 2 + pr/include/md/_rhapsody.h | 2 +- pr/include/md/_solaris.h | 23 + pr/include/obsolete/.cvsignore | 1 + pr/include/obsolete/Makefile | 35 - pr/include/obsolete/Makefile.in | 7 +- pr/include/obsolete/protypes.h | 3 +- pr/include/prinet.h | 2 +- pr/include/prinit.h | 6 +- pr/include/prio.h | 30 - pr/include/private/.cvsignore | 1 + pr/include/private/Makefile | 35 - pr/include/private/Makefile.in | 7 +- pr/include/private/primpl.h | 71 + pr/include/prtypes.h | 8 +- pr/src/.cvsignore | 2 + pr/src/Makefile | 431 ---- pr/src/Makefile.in | 167 +- pr/src/bthreads/.cvsignore | 1 + pr/src/bthreads/Makefile | 33 - pr/src/bthreads/Makefile.in | 3 +- pr/src/bthreads/btcvar.c | 64 +- pr/src/bthreads/btthread.c | 740 +++---- pr/src/cplus/.cvsignore | 1 + pr/src/cplus/Makefile | 51 - pr/src/cplus/Makefile.in | 3 +- pr/src/cplus/tests/.cvsignore | 1 + pr/src/cplus/tests/Makefile | 263 --- pr/src/cplus/tests/Makefile.in | 64 +- pr/src/io/.cvsignore | 1 + pr/src/io/Makefile | 65 - pr/src/io/Makefile.in | 3 +- pr/src/io/pripv6.c | 32 +- pr/src/io/prlog.c | 39 +- pr/src/io/prprf.c | 4 +- pr/src/io/prsocket.c | 4 +- pr/src/linking/.cvsignore | 1 + pr/src/linking/Makefile | 45 - pr/src/linking/Makefile.in | 3 +- pr/src/linking/prlink.c | 140 +- pr/src/malloc/.cvsignore | 1 + pr/src/malloc/Makefile | 43 - pr/src/malloc/Makefile.in | 3 +- pr/src/md/.cvsignore | 1 + pr/src/md/Makefile | 59 - pr/src/md/Makefile.in | 26 +- pr/src/md/beos/.cvsignore | 1 + pr/src/md/beos/Makefile | 30 - pr/src/md/beos/Makefile.in | 3 +- pr/src/md/mac/macdll.c | 9 + pr/src/md/mac/macsockotpt.c | 240 ++- pr/src/md/mac/macthr.c | 2 + pr/src/md/mac/mdmac.c | 4 +- pr/src/md/mac/prcpucfg.h | 2 +- pr/src/md/os2/.cvsignore | 1 + pr/src/md/os2/Makefile | 53 - pr/src/md/os2/Makefile.in | 4 +- pr/src/md/os2/objs.mk | 37 + pr/src/md/os2/os2cv.c | 12 +- pr/src/md/os2/os2inrval.c | 6 +- pr/src/md/os2/os2io.c | 59 +- pr/src/md/os2/os2misc.c | 2 +- pr/src/md/os2/os2poll.c | 154 +- pr/src/md/os2/os2sem.c | 10 +- pr/src/md/os2/os2sock.c | 268 ++- pr/src/md/os2/os2thred.c | 26 +- pr/src/md/unix/.cvsignore | 1 + pr/src/md/unix/Makefile | 316 --- pr/src/md/unix/Makefile.in | 261 +-- pr/src/md/unix/darwin.c | 27 +- pr/src/md/unix/objs.mk | 217 -- pr/src/md/unix/os_Linux_x86.s | 95 + pr/src/md/unix/rhapsody.c | 27 +- pr/src/md/unix/uxproces.c | 108 +- pr/src/md/unix/uxrng.c | 3 +- pr/src/md/unix/uxshm.c | 2 +- pr/src/md/windows/.cvsignore | 1 + pr/src/md/windows/Makefile | 87 - pr/src/md/windows/Makefile.in | 9 +- pr/src/md/windows/ntinrval.c | 2 +- pr/src/md/windows/ntio.c | 9 +- pr/src/md/windows/objs.mk | 16 +- pr/src/md/windows/w95io.c | 5 +- pr/src/memory/.cvsignore | 1 + pr/src/memory/Makefile | 44 - pr/src/memory/Makefile.in | 16 +- pr/src/memory/prgcleak.c | 105 + pr/src/misc/.cvsignore | 1 + pr/src/misc/Makefile | 88 - pr/src/misc/Makefile.in | 23 +- pr/src/misc/prnetdb.c | 10 +- pr/src/misc/prthinfo.c | 14 +- pr/src/misc/prtime.c | 2 +- pr/src/prvrsion.c | 2 + pr/src/pthreads/.cvsignore | 1 + pr/src/pthreads/Makefile | 49 - pr/src/pthreads/Makefile.in | 3 +- pr/src/pthreads/ptio.c | 7 +- pr/src/pthreads/ptsynch.c | 52 +- pr/src/pthreads/ptthread.c | 72 +- pr/src/threads/.cvsignore | 1 + pr/src/threads/Makefile | 77 - pr/src/threads/Makefile.in | 12 +- pr/src/threads/combined/.cvsignore | 1 + pr/src/threads/combined/Makefile | 54 - pr/src/threads/combined/Makefile.in | 3 +- pr/src/threads/combined/pruthr.c | 8 + pr/tests/.cvsignore | 1 + pr/tests/Makefile | 571 ------ pr/tests/Makefile.in | 172 +- pr/tests/attach.c | 41 +- pr/tests/dll/.cvsignore | 1 + pr/tests/dll/Makefile | 96 - pr/tests/dll/Makefile.in | 13 +- pr/tests/ipv6.c | 29 +- pr/tests/tpd.c | 6 +- pr/tests/w16gui/.cvsignore | 1 + pr/tests/w16gui/Makefile | 75 - pr/tests/w16gui/Makefile.in | 7 +- tools/.cvsignore | 1 + tools/Makefile | 225 --- tools/Makefile.in | 52 +- 226 files changed, 7399 insertions(+), 8962 deletions(-) create mode 100644 .cvsignore delete mode 100644 Makefile delete mode 100644 config/Makefile create mode 100755 config/nspr-config.in create mode 100644 config/nspr.m4 create mode 100644 gmakefile.win create mode 100644 lib/.cvsignore delete mode 100644 lib/Makefile create mode 100644 lib/ds/.cvsignore delete mode 100644 lib/ds/Makefile create mode 100644 lib/libc/.cvsignore delete mode 100644 lib/libc/Makefile create mode 100644 lib/libc/include/.cvsignore delete mode 100644 lib/libc/include/Makefile create mode 100644 lib/libc/src/.cvsignore delete mode 100644 lib/libc/src/Makefile create mode 100644 lib/msgc/.cvsignore delete mode 100644 lib/msgc/Makefile create mode 100644 lib/msgc/include/.cvsignore delete mode 100644 lib/msgc/include/Makefile create mode 100644 lib/msgc/src/.cvsignore delete mode 100644 lib/msgc/src/Makefile create mode 100644 lib/msgc/tests/.cvsignore delete mode 100644 lib/msgc/tests/Makefile create mode 100644 lib/prstreams/.cvsignore delete mode 100644 lib/prstreams/Makefile create mode 100644 lib/prstreams/tests/testprstrm/.cvsignore delete mode 100644 lib/prstreams/tests/testprstrm/Makefile create mode 100644 lib/tests/.cvsignore delete mode 100644 lib/tests/Makefile create mode 100644 macbuild/NSPRCarbon.Prefix create mode 100644 macbuild/NSPRCarbonDebug.Prefix delete mode 100644 makefile.win create mode 100644 pr/.cvsignore delete mode 100644 pr/Makefile create mode 100644 pr/include/.cvsignore delete mode 100644 pr/include/Makefile create mode 100644 pr/include/md/.cvsignore delete mode 100644 pr/include/md/Makefile create mode 100644 pr/include/obsolete/.cvsignore delete mode 100644 pr/include/obsolete/Makefile create mode 100644 pr/include/private/.cvsignore delete mode 100644 pr/include/private/Makefile create mode 100644 pr/src/.cvsignore delete mode 100644 pr/src/Makefile create mode 100644 pr/src/bthreads/.cvsignore delete mode 100644 pr/src/bthreads/Makefile create mode 100644 pr/src/cplus/.cvsignore delete mode 100644 pr/src/cplus/Makefile create mode 100644 pr/src/cplus/tests/.cvsignore delete mode 100644 pr/src/cplus/tests/Makefile create mode 100644 pr/src/io/.cvsignore delete mode 100644 pr/src/io/Makefile create mode 100644 pr/src/linking/.cvsignore delete mode 100644 pr/src/linking/Makefile create mode 100644 pr/src/malloc/.cvsignore delete mode 100644 pr/src/malloc/Makefile create mode 100644 pr/src/md/.cvsignore delete mode 100644 pr/src/md/Makefile create mode 100644 pr/src/md/beos/.cvsignore delete mode 100644 pr/src/md/beos/Makefile create mode 100644 pr/src/md/os2/.cvsignore delete mode 100644 pr/src/md/os2/Makefile create mode 100644 pr/src/md/os2/objs.mk create mode 100644 pr/src/md/unix/.cvsignore delete mode 100644 pr/src/md/unix/Makefile create mode 100644 pr/src/md/unix/os_Linux_x86.s create mode 100644 pr/src/md/windows/.cvsignore delete mode 100644 pr/src/md/windows/Makefile create mode 100644 pr/src/memory/.cvsignore delete mode 100644 pr/src/memory/Makefile create mode 100644 pr/src/memory/prgcleak.c create mode 100644 pr/src/misc/.cvsignore delete mode 100644 pr/src/misc/Makefile create mode 100644 pr/src/pthreads/.cvsignore delete mode 100644 pr/src/pthreads/Makefile create mode 100644 pr/src/threads/.cvsignore delete mode 100644 pr/src/threads/Makefile create mode 100644 pr/src/threads/combined/.cvsignore delete mode 100644 pr/src/threads/combined/Makefile create mode 100644 pr/tests/.cvsignore delete mode 100644 pr/tests/Makefile create mode 100644 pr/tests/dll/.cvsignore delete mode 100644 pr/tests/dll/Makefile create mode 100644 pr/tests/w16gui/.cvsignore delete mode 100644 pr/tests/w16gui/Makefile create mode 100644 tools/.cvsignore delete mode 100644 tools/Makefile diff --git a/.cvsignore b/.cvsignore new file mode 100644 index 00000000..5a12c765 --- /dev/null +++ b/.cvsignore @@ -0,0 +1,5 @@ +Makefile +config-defs.h +config.cache +config.log +config.status diff --git a/Makefile b/Makefile deleted file mode 100644 index e92f2d40..00000000 --- a/Makefile +++ /dev/null @@ -1,105 +0,0 @@ -#! gmake - -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -MOD_DEPTH = . - -DIRS = config pr lib - -ifdef MOZILLA_CLIENT -PR_CLIENT_BUILD = 1 -PR_CLIENT_BUILD_UNIX = 1 -endif - -include $(MOD_DEPTH)/config/rules.mk - -# -# The -ll option of zip converts CR LF to LF. -# -ifeq ($(OS_ARCH),WINNT) -ZIP_ASCII_OPT = -ll -endif - -ifdef PR_CLIENT_BUILD -export:: - rm -r -f $(DIST)/../public/nspr -ifdef PR_CLIENT_BUILD_UNIX - rm -f $(DIST)/lib/libnspr.a - rm -f $(DIST)/bin/libnspr.$(DLL_SUFFIX) -endif -endif - -release:: - echo $(BUILD_NUMBER) > $(RELEASE_DIR)/$(BUILD_NUMBER)/version.df - @if test -f imports.df; then \ - echo "cp -f imports.df $(RELEASE_DIR)/$(BUILD_NUMBER)/imports.df"; \ - cp -f imports.df $(RELEASE_DIR)/$(BUILD_NUMBER)/imports.df; \ - else \ - echo "echo > $(RELEASE_DIR)/$(BUILD_NUMBER)/imports.df"; \ - echo > $(RELEASE_DIR)/$(BUILD_NUMBER)/imports.df; \ - fi - cd $(RELEASE_DIR)/$(BUILD_NUMBER)/$(OBJDIR_NAME); \ - rm -rf META-INF; mkdir META-INF; cd META-INF; \ - echo "Manifest-Version: 1.0" > MANIFEST.MF; \ - echo "" >> MANIFEST.MF; \ - cd ..; rm -f mdbinary.jar; zip -r mdbinary.jar META-INF bin lib; \ - rm -rf META-INF; \ - cd include; \ - rm -rf META-INF; mkdir META-INF; cd META-INF; \ - echo "Manifest-Version: 1.0" > MANIFEST.MF; \ - echo "" >> MANIFEST.MF; \ - cd ..; rm -f mdheader.jar; zip $(ZIP_ASCII_OPT) -r mdheader.jar *; \ - rm -rf META-INF -ifeq ($(OS_ARCH),WINNT) - @if test ! -d $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER); then \ - rm -rf $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER); \ - echo "making directory /m/dist/$(MOD_NAME)/$(BUILD_NUMBER)"; \ - config/prmkdir.bat $(MDIST_DOS)\\$(MOD_NAME)\\$(BUILD_NUMBER); \ - fi - @if test ! -d $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER)/$(OBJDIR_NAME); then \ - rm -rf $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER)/$(OBJDIR_NAME); \ - echo "making directory /m/dist/$(MOD_NAME)/$(BUILD_NUMBER)/$(OBJDIR_NAME)"; \ - config/prmkdir.bat $(MDIST_DOS)\\$(MOD_NAME)\\$(BUILD_NUMBER)\\$(OBJDIR_NAME); \ - fi -else - @if test ! -d $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER); then \ - rm -rf $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER); \ - echo "making directory /m/dist/$(MOD_NAME)/$(BUILD_NUMBER)"; \ - $(NSINSTALL) -D $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER); \ - chmod 775 $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER); \ - fi - @if test ! -d $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER)/$(OBJDIR_NAME); then \ - rm -rf $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER)/$(OBJDIR_NAME); \ - echo "making directory /m/dist/$(MOD_NAME)/$(BUILD_NUMBER)/$(OBJDIR_NAME)"; \ - $(NSINSTALL) -D $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER)/$(OBJDIR_NAME); \ - chmod 775 $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER)/$(OBJDIR_NAME); \ - fi -endif - cd $(RELEASE_DIR)/$(BUILD_NUMBER); \ - cp -f version.df imports.df $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER); \ - chmod 664 $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER)/version.df; \ - chmod 664 $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER)/imports.df; \ - cd $(OBJDIR_NAME); \ - cp -f mdbinary.jar $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER)/$(OBJDIR_NAME); \ - chmod 664 $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER)/$(OBJDIR_NAME)/mdbinary.jar; \ - cd include; \ - cp -f mdheader.jar $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER)/$(OBJDIR_NAME); \ - chmod 664 $(MDIST)/$(MOD_NAME)/$(BUILD_NUMBER)/$(OBJDIR_NAME)/mdheader.jar - -depend: - @echo "NSPR20 has no dependencies. Skipped." diff --git a/Makefile.in b/Makefile.in index 8ff221b8..a7ced32d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,5 +1,4 @@ #! gmake - # # 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 @@ -31,8 +30,19 @@ PR_CLIENT_BUILD = 1 PR_CLIENT_BUILD_UNIX = 1 endif +DIST_GARBAGE = config.cache config.log config.status + +all:: config.status export + include $(topsrcdir)/config/rules.mk +config.status:: configure +ifeq ($(OS_ARCH),WINNT) + sh $(srcdir)/configure --no-create --no-recursion +else + ./config.status --recheck && ./config.status +endif + # # The -ll option of zip converts CR LF to LF. # @@ -44,11 +54,17 @@ ifdef PR_CLIENT_BUILD export:: rm -r -f $(DIST)/../public/nspr ifdef PR_CLIENT_BUILD_UNIX - rm -f $(DIST)/lib/libnspr.a - rm -f $(DIST)/bin/libnspr.$(DLL_SUFFIX) + rm -f $(dist_libdir)/libnspr.a + rm -f $(dist_bindir)/libnspr.$(DLL_SUFFIX) 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/build/autoconf/config.guess b/build/autoconf/config.guess index 441894dc..95e52667 100755 --- a/build/autoconf/config.guess +++ b/build/autoconf/config.guess @@ -1,7 +1,10 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. -# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. + +timestamp='2001-03-30' + # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or @@ -22,18 +25,92 @@ # the same distribution terms that you use for the rest of that program. # Written by Per Bothner . -# The master version of this file is at the FSF in /home/gd/gnu/lib. +# Please send patches to . # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you -# don't specify an explicit system type (host/target name). -# -# Only a few systems have been added to this list; please add others -# (but try to keep the structure clean). -# +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99, 2000 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + + +dummy=dummy-$$ +trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int dummy(){}" > $dummy.c + for c in cc gcc c89 ; do + ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 + if test $? = 0 ; then + CC_FOR_BUILD="$c"; break + fi + done + rm -f $dummy.c $dummy.o $dummy.rel + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 8/24/94.) @@ -43,14 +120,57 @@ fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15 - # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # Netbsd (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # Determine the machine/vendor (is the vendor relevant). + case "${UNAME_MACHINE}" in + amiga) machine=m68k-unknown ;; + arm32) machine=arm-unknown ;; + atari*) machine=m68k-atari ;; + sun3*) machine=m68k-sun ;; + mac68k) machine=m68k-apple ;; + macppc) machine=powerpc-apple ;; + hp3[0-9][05]) machine=m68k-hp ;; + ibmrt|romp-ibm) machine=romp-ibm ;; + *) machine=${UNAME_MACHINE}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE}" in + i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` @@ -59,59 +179,75 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - cat <dummy.s + cat <$dummy.s + .data +\$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + + .text .globl main + .align 4 .ent main main: - .frame \$30,0,\$26,0 - .prologue 0 - .long 0x47e03d80 # implver $0 - lda \$2,259 - .long 0x47e20c21 # amask $2,$1 - srl \$1,8,\$2 - sll \$2,2,\$2 - sll \$0,3,\$0 - addl \$1,\$0,\$0 - addl \$2,\$0,\$0 - ret \$31,(\$26),1 + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit .end main EOF - ${CC-cc} dummy.s -o dummy 2>/dev/null + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null if test "$?" = 0 ; then - ./dummy - case "$?" in - 7) + case `./$dummy` in + 0-0) UNAME_MACHINE="alpha" ;; - 15) + 1-0) UNAME_MACHINE="alphaev5" ;; - 14) + 1-1) UNAME_MACHINE="alphaev56" ;; - 10) + 1-101) UNAME_MACHINE="alphapca56" ;; - 16) + 2-303) UNAME_MACHINE="alphaev6" ;; + 2-307) + UNAME_MACHINE="alphaev67" + ;; esac fi - rm -f dummy.s dummy - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]` + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix exit 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) - echo m68k-cbm-sysv4 + echo m68k-unknown-sysv4 exit 0;; - amiga:NetBSD:*:*) - echo m68k-cbm-netbsd${UNAME_RELEASE} - exit 0 ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; arc64:OpenBSD:*:*) echo mips64el-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -130,16 +266,16 @@ EOF wgrisc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; - arm32:NetBSD:*:*) - echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - exit 0 ;; - SR2?01:HI-UX/MPP:*:*) + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; - Pyramid*:OSx*:*:*|MIS*:OSx*:*:*) + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 @@ -147,9 +283,12 @@ EOF echo pyramid-pyramid-bsd fi exit 0 ;; - NILE:*:*:dcosx) + NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; @@ -189,21 +328,38 @@ EOF aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; - atari*:NetBSD:*:*) - echo m68k-atari-netbsd${UNAME_RELEASE} - exit 0 ;; atari*:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - sun3*:NetBSD:*:*) - echo m68k-sun-netbsd${UNAME_RELEASE} + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; sun3*:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - mac68k:NetBSD:*:*) - echo m68k-apple-netbsd${UNAME_RELEASE} - exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -225,12 +381,17 @@ EOF VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit 0 ;; - 2020:CLIX:*:*) + 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) - sed 's/^ //' << EOF >dummy.c - int main (argc, argv) int argc; char **argv; { + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); @@ -245,10 +406,10 @@ EOF exit (-1); } EOF - ${CC-cc} dummy.c -o dummy \ - && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy + $CC_FOR_BUILD $dummy.c -o $dummy \ + && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Night_Hawk:Power_UNIX:*:*) @@ -266,15 +427,18 @@ EOF AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \ - -o ${TARGET_BINARY_INTERFACE}x = x ] ; then + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then echo m88k-dg-dgux${UNAME_RELEASE} - else + else echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} fi - else echo i586-dg-dgux${UNAME_RELEASE} - fi exit 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 @@ -298,9 +462,17 @@ EOF i?86:AIX:*:*) echo i386-ibm-aix exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - sed 's/^ //' << EOF >dummy.c + sed 's/^ //' << EOF >$dummy.c #include main() @@ -311,8 +483,8 @@ EOF exit(0); } EOF - ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 @@ -320,8 +492,9 @@ EOF echo rs6000-ibm-aix3.2 fi exit 0 ;; - *:AIX:*:4) - if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc @@ -329,7 +502,7 @@ EOF if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else - IBM_REV=4.${UNAME_RELEASE} + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; @@ -339,7 +512,7 @@ EOF ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit 0 ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit 0 ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) @@ -354,18 +527,75 @@ EOF hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit 0 ;; - 9000/[3478]??:HP-UX:*:*) + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/7?? | 9000/8?[1679] ) HP_ARCH=hppa1.1 ;; - 9000/8?? ) HP_ARCH=hppa1.0 ;; + 9000/[678][0-9][0-9]) + case "${HPUX_REV}" in + 11.[0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + esac ;; + esac + fi ;; + esac + if [ "${HP_ARCH}" = "" ]; then + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` + if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi + rm -f $dummy.c $dummy + fi ;; esac - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; 3050*:HI-UX:*:*) - sed 's/^ //' << EOF >dummy.c + sed 's/^ //' << EOF >$dummy.c #include int main () @@ -390,8 +620,8 @@ EOF exit (0); } EOF - ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) @@ -400,6 +630,9 @@ EOF 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; + *9??*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit 0 ;; @@ -416,6 +649,9 @@ EOF parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; + hppa*:OpenBSD:*:*) + echo hppa-unknown-openbsd + exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; @@ -446,45 +682,70 @@ EOF -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ exit 0 ;; CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3D:*:*:*) + echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY-2:*:*:*) echo cray2-cray-unicos exit 0 ;; - F300:UNIX_System_V:*:*) - FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'` + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; - F301:UNIX_System_V:*:*) - echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` - exit 0 ;; - hp3[0-9][05]:NetBSD:*:*) - echo m68k-hp-netbsd${UNAME_RELEASE} - exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - i?86:BSD/386:*:* | *:BSD/OS:*:*) + i?86:BSD/386:*:* | i?86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; *:FreeBSD:*:*) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; - *:NetBSD:*:*) - echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` exit 0 ;; i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin32 + echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; +#### MozillaHack +# Netscape's hacked uname + xx:WINNT:* | xx:WIN95:*) + echo i586-pc-msvc + exit 0 ;; +### End MozillaHack + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i386-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin32 + echo powerpcle-unknown-cygwin exit 0 ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` @@ -492,85 +753,26 @@ EOF *:GNU:*:*) echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; - *:Linux:*:*) - # uname on the ARM produces all sorts of strangeness, and we need to - # filter it out. - case "$UNAME_MACHINE" in - arm* | sa110*) UNAME_MACHINE="arm" ;; - esac - - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. - ld_help_string=`ld --help 2>&1` - ld_supported_emulations=`echo $ld_help_string \ - | sed -ne '/supported emulations:/!d - s/[ ][ ]*/ /g - s/.*supported emulations: *// - s/ .*// - p'` - case "$ld_supported_emulations" in - i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;; - i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;; - sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;; - esac - - if test "${UNAME_MACHINE}" = "alpha" ; then - sed 's/^ //' <dummy.s - .globl main - .ent main - main: - .frame \$30,0,\$26,0 - .prologue 0 - .long 0x47e03d80 # implver $0 - lda \$2,259 - .long 0x47e20c21 # amask $2,$1 - srl \$1,8,\$2 - sll \$2,2,\$2 - sll \$0,3,\$0 - addl \$1,\$0,\$0 - addl \$2,\$0,\$0 - ret \$31,(\$26),1 - .end main -EOF - LIBC="" - ${CC-cc} dummy.s -o dummy 2>/dev/null - if test "$?" = 0 ; then - ./dummy - case "$?" in - 7) - UNAME_MACHINE="alpha" - ;; - 15) - UNAME_MACHINE="alphaev5" - ;; - 14) - UNAME_MACHINE="alphaev56" - ;; - 10) - UNAME_MACHINE="alphapca56" - ;; - 16) - UNAME_MACHINE="alphaev6" - ;; - esac - - objdump --private-headers dummy | \ - grep ld.so.1 > /dev/null - if test "$?" = 0 ; then - LIBC="libc1" - fi - fi - rm -f dummy.s dummy - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 - elif test "${UNAME_MACHINE}" = "mips" ; then - cat >dummy.c <$dummy.c < /* for printf() prototype */ +int main (int argc, char *argv[]) { +#else +int main (argc, argv) int argc; char *argv[]; { +#endif #ifdef __MIPSEB__ printf ("%s-unknown-linux-gnu\n", argv[1]); #endif @@ -580,32 +782,152 @@ main(argc, argv) return 0; } EOF - ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy - else - # Either a pre-BFD a.out linker (linux-gnuoldld) - # or one that does not give us useful --help. - # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. - # If ld does not provide *any* "supported emulations:" - # that means it is gnuoldld. - echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:" - test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 - - case "${UNAME_MACHINE}" in - i?86) - VENDOR=pc; - ;; - *) - VENDOR=unknown; - ;; - esac - # Determine whether the default compiler is a.out or elf - cat >dummy.c </dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + ;; + ppc:Linux:*:*) + # Determine Lib Version + cat >$dummy.c < +#if defined(__GLIBC__) +extern char __libc_version[]; +extern char __libc_release[]; +#endif main(argc, argv) int argc; char *argv[]; { +#if defined(__GLIBC__) + printf("%s %s\n", __libc_version, __libc_release); +#else + printf("unknown\n"); +#endif + return 0; +} +EOF + LIBC="" + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null + if test "$?" = 0 ; then + ./$dummy | grep 1\.99 > /dev/null + if test "$?" = 0 ; then LIBC="libc1" ; fi + fi + rm -f $dummy.c $dummy + echo powerpc-unknown-linux-gnu${LIBC} + exit 0 ;; + alpha:Linux:*:*) + cat <$dummy.s + .data + \$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + .text + .globl main + .align 4 + .ent main + main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main +EOF + LIBC="" + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + case `./$dummy` in + 0-0) UNAME_MACHINE="alpha" ;; + 1-0) UNAME_MACHINE="alphaev5" ;; + 1-1) UNAME_MACHINE="alphaev56" ;; + 1-101) UNAME_MACHINE="alphapca56" ;; + 2-303) UNAME_MACHINE="alphaev6" ;; + 2-307) UNAME_MACHINE="alphaev67" ;; + esac + objdump --private-headers $dummy | \ + grep ld.so.1 > /dev/null + if test "$?" = 0 ; then + LIBC="libc1" + fi + fi + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i?86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + ld_supported_emulations=`cd /; ld --help 2>&1 \ + | sed -ne '/supported emulations:/!d + s/[ ][ ]*/ /g + s/.*supported emulations: *// + s/ .*// + p'` + case "$ld_supported_emulations" in + i?86linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 + ;; + elf_i?86) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + i?86coff) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 + ;; + esac + # Either a pre-BFD a.out linker (linux-gnuoldld) + # or one that does not give us useful --help. + # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. + # If ld does not provide *any* "supported emulations:" + # that means it is gnuoldld. + test -z "$ld_supported_emulations" && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 + case "${UNAME_MACHINE}" in + i?86) + VENDOR=pc; + ;; + *) + VENDOR=unknown; + ;; + esac + # Determine whether the default compiler is a.out or elf + cat >$dummy.c < +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 @@ -622,9 +944,10 @@ main(argc, argv) return 0; } EOF - ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy - fi ;; + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions # are messed up and put the nodename in both sysname and nodename. i?86:DYNIX/ptx:4*:*) @@ -639,10 +962,20 @@ EOF echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE} + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i?86:*:5:7*) + # Fixed at (any) Pentium or better + UNAME_MACHINE=i586 + if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then + echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION} else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} + echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} fi exit 0 ;; i?86:*:3.2:*) @@ -654,12 +987,20 @@ EOF (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 + (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; + i?86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; pc:*:*:*) + # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp @@ -683,7 +1024,7 @@ EOF exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` @@ -694,24 +1035,30 @@ EOF 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; - m68*:LynxOS:2.*:*) + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; - i?86:LynxOS:2.*:*) + i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:* | i?86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; - rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) + rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; @@ -727,6 +1074,16 @@ EOF # says echo i586-unisys-sysv4 exit 0 ;; +#### MozillaHack + *:*OpenVMS*:*:*) + case "${UNAME_SYSTEM}" in + POSIX_for_OpenVMS_AXP) echo alpha-dec-openvmsposix ;; + POSIX_for_OpenVMS_VAX) echo vax-dec-openvmsposix ;; + OpenVMS) echo alpha-dec-openvms ;; + *) echo unknown-dec-openvms ;; + esac + exit 0 ;; +#### End MozillaHack *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm @@ -736,44 +1093,111 @@ EOF # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; - *:Rhapsody:*:*) - test ! -z "`echo ${UNAME_MACHINE} | grep Power`" && echo ppc-apple-rhapsody${UNAME_RELEASE} && exit 0 - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; - news*:NEWS-OS:*:6*) + news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit 0 ;; - R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*) + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit 0 ;; - *:QNX:*:*) - echo i386-pc-qnx`${UNAME_VERSION} | cut -c1-1` + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos exit 0 ;; - *:*nto:*:*) - echo `uname -p`-pc-nto + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + echo `uname -p`-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + if test "${UNAME_MACHINE}" = "x86pc"; then + UNAME_MACHINE=pc + fi + echo `uname -p`-${UNAME_MACHINE}-nto-qnx + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-[KW]:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + i?86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + # echo ${UNAME_MACHINE}-pc-os2-emx +#### MozillaHack + if test "$VACPP" = "yes"; then + echo "i386-pc-os2_vacpp" + else + echo "i386-pc-os2_emx" + fi +#### End MozillaHack + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its exit 0 ;; - BePC:BeOS:*:*) - echo i386-pc-beos${UNAME_RELEASE} - exit 0 ;; - BeMac:BeOS:*:*) - echo ppc-apple-beos${UNAME_RELEASE} - exit 0 ;; - BeBox:BeOS:*:*) - echo ppc-be-beos${UNAME_RELEASE} - exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 -cat >dummy.c <$dummy.c < # include @@ -811,7 +1235,10 @@ main () #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif @@ -856,11 +1283,24 @@ main () #endif #if defined (vax) -#if !defined (ultrix) - printf ("vax-dec-bsd\n"); exit (0); -#else - printf ("vax-dec-ultrix\n"); exit (0); -#endif +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif #endif #if defined (alliant) && defined (i860) @@ -871,8 +1311,8 @@ main () } EOF -${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0 -rm -f dummy.c dummy +$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 +rm -f $dummy.c $dummy # Apollos put the system type in the environment. @@ -904,6 +1344,48 @@ then esac fi -#echo '(Unable to guess system type)' 1>&2 +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/build/autoconf/config.sub b/build/autoconf/config.sub index 2e016f1f..a4b69bed 100755 --- a/build/autoconf/config.sub +++ b/build/autoconf/config.sub @@ -1,6 +1,10 @@ #! /bin/sh -# Configuration validation subroutine script, version 1.1. -# Copyright (C) 1991, 92-97, 1998 Free Software Foundation, Inc. +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. + +timestamp='2001-03-30' + # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. @@ -25,6 +29,8 @@ # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. +# Please send patches to . +# # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. @@ -45,30 +51,73 @@ # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. -if [ x$1 = x ] -then - echo Configuration name missing. 1>&2 - echo "Usage: $0 CPU-MFR-OPSYS" 1>&2 - echo "or $0 ALIAS" 1>&2 - echo where ALIAS is a recognized configuration type. 1>&2 - exit 1 -fi +me=`echo "$0" | sed -e 's,.*/,,'` -# First pass through any local machine types. -case $1 in - *local*) - echo $1 - exit 0 - ;; - *) - ;; +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit 0;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - linux-gnu*) + nto-qnx* | linux-gnu* | storm-chaos* | os2-emx*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; @@ -94,15 +143,25 @@ case $os in -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple) + -apple | -axis) os= basic_machine=$1 ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; -hiux*) os=-hiuxwe2 ;; -sco5) - os=sco3.2v5 + os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) @@ -121,6 +180,9 @@ case $os in os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` @@ -143,17 +205,9 @@ case $os in -psos*) os=-psos ;; - -qnx*) - basic_machine=x6-pc - os=-qnx`uname -v | cut -c1-1` - ;; - -nto*) - basic_machine=`uname -p`-pc - os=-nto - ;; - -rhapsody*) - basic_machine=ppc-apple - os=-rhapsody`uname -r` + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint ;; esac @@ -161,20 +215,39 @@ esac case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. - tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ - | arme[lb] | pyramid | mn10200 | mn10300 \ - | tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \ - | alpha | alphaev5 | alphaev56 | alphaev6 | alphapca56 | we32k | ns16k | clipper \ - | i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \ - | mips64 | mipsel | mips64el | mips64orion | mips64orionel \ - | mipstx39 | mipstx39el \ - | sparc | sparclet | sparclite | sparc64 | v850) + tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc \ + | arm | arme[lb] | arm[bl]e | armv[2345] | armv[345][lb] | strongarm | xscale \ + | pyramid | mn10200 | mn10300 | tron | a29k \ + | 580 | i960 | h8300 \ + | x86 | ppcbe | mipsbe | mipsle | shbe | shle \ + | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ + | hppa64 \ + | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \ + | alphaev6[78] \ + | we32k | ns16k | clipper | i370 | sh | sh[34] \ + | powerpc | powerpcle \ + | 1750a | dsp16xx | pdp10 | pdp11 \ + | mips16 | mips64 | mipsel | mips64el \ + | mips64orion | mips64orionel | mipstx39 | mipstx39el \ + | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ + | mips64vr5000 | miprs64vr5000el | mcore | s390 | s390x \ + | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \ + | thumb | d10v | d30v | fr30 | avr | openrisc | tic80 \ + | pj | pjl | h8500) basic_machine=$basic_machine-unknown ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | w65) + ;; + # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. - i[34567]86) + i[234567]86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. @@ -183,27 +256,51 @@ case $basic_machine in exit 1 ;; # Recognize the basic CPU types with company name. - vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \ - | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ + # FIXME: clean up the formatting here. + vax-* | tahoe-* | i[234567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ + | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | c[123]* \ + | arm-* | armbe-* | armle-* | armv*-* | strongarm-* | xscale-* \ | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ - | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \ - | xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* \ - | alpha-* | alphaev5-* | alphaev56-* | alphaev6-* | alphapca56-* | we32k-* | cydra-* \ - | ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \ - | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ - | sparc64-* | mips64-* | mipsel-* \ - | mips64el-* | mips64orion-* | mips64orionel-* \ - | mipstx39-* | mipstx39el-* \ - | f301-*) + | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ + | xmp-* | ymp-* \ + | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* \ + | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \ + | hppa2.0n-* | hppa64-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \ + | alphaev6[78]-* \ + | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ + | clipper-* | orion-* \ + | sparclite-* | pdp10-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ + | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \ + | mips64el-* | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ + | mipstx39-* | mipstx39el-* | mcore-* \ + | f30[01]-* | f700-* | s390-* | s390x-* | sv1-* | t3e-* \ + | [cjt]90-* \ + | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ + | thumb-* | v850-* | d30v-* | tic30-* | tic80-* | c30-* | fr30-* \ + | bs2000-* | tic54x-* | c54x-* | x86_64-* | pj-* | pjl-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; alliant | fx80) basic_machine=fx80-alliant ;; @@ -219,20 +316,24 @@ case $basic_machine in os=-sysv ;; amiga | amiga-*) - basic_machine=m68k-cbm + basic_machine=m68k-unknown ;; amigaos | amigados) - basic_machine=m68k-cbm + basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) - basic_machine=m68k-cbm + basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; aux) basic_machine=m68k-apple os=-aux @@ -269,13 +370,16 @@ case $basic_machine in basic_machine=cray2-cray os=-unicos ;; - [ctj]90-cray) - basic_machine=c90-cray + [cjt]90) + basic_machine=${basic_machine}-cray os=-unicos ;; crds | unos) basic_machine=m68k-crds ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; da30 | da30-*) basic_machine=m68k-da30 ;; @@ -309,6 +413,10 @@ case $basic_machine in encore | umax | mmax) basic_machine=ns32k-encore ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; fx2800) basic_machine=i860-alliant ;; @@ -319,6 +427,10 @@ case $basic_machine in basic_machine=tron-gmicro os=-sysv ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 @@ -327,6 +439,14 @@ case $basic_machine in basic_machine=h8300-hitachi os=-hms ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; harris) basic_machine=m88k-harris os=-sysv3 @@ -342,13 +462,30 @@ case $basic_machine in basic_machine=m68k-hp os=-hpux ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; - hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7) + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) @@ -357,9 +494,16 @@ case $basic_machine in hppa-next) os=-nextstep3 ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; i370-ibm* | ibm*) basic_machine=i370-ibm - os=-mvs ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i[34567]86v32) @@ -378,6 +522,14 @@ case $basic_machine in basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; iris | iris4d) basic_machine=mips-sgi case $os in @@ -403,9 +555,23 @@ case $basic_machine in basic_machine=ns32k-utek os=-sysv ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; +#### MozillaHack + i386-msvc | msvc) + basic_machine=i386-pc + os=-msvc + ;; +#### End MozillaHack miniframe) basic_machine=m68000-convergent ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; mipsel*-linux*) basic_machine=mipsel-unknown os=-linux-gnu @@ -420,10 +586,34 @@ case $basic_machine in mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos @@ -436,6 +626,10 @@ case $basic_machine in basic_machine=mips-sony os=-newsos ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; next | m*-next ) basic_machine=m68k-next case $os in @@ -461,9 +655,32 @@ case $basic_machine in basic_machine=i960-intel os=-nindy ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; np1) basic_machine=np1-gould ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 @@ -481,28 +698,28 @@ case $basic_machine in pc532 | pc532-*) basic_machine=ns32k-pc532 ;; - pentium | p5 | k5 | nexen) + pentium | p5 | k5 | k6 | nexgen) basic_machine=i586-pc ;; - pentiumpro | p6 | k6 | 6x86) + pentiumpro | p6 | 6x86 | athlon) basic_machine=i686-pc ;; pentiumii | pentium2) - basic_machine=i786-pc + basic_machine=i686-pc ;; - pentium-* | p5-* | k5-* | nexen-*) + pentium-* | p5-* | k5-* | k6-* | nexgen-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - pentiumpro-* | p6-* | k6-* | 6x86-*) + pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; - power) basic_machine=rs6000-ibm + power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; @@ -517,13 +734,13 @@ case $basic_machine in ps2) basic_machine=i386-ibm ;; - *qnx*) - basic_machine=x86-pc - os=-qnx`uname -v | cut -c1-1` + pw32) + basic_machine=i586-unknown + os=-pw32 ;; - *nto*) - basic_machine=`uname -p`-pc - os=-nto + rom68k) + basic_machine=m68k-rom68k + os=-coff ;; rm[46]00) basic_machine=mips-siemens @@ -531,6 +748,10 @@ case $basic_machine in rtpc | rtpc-*) basic_machine=romp-ibm ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; sequent) basic_machine=i386-sequent ;; @@ -538,6 +759,10 @@ case $basic_machine in basic_machine=sh-hitachi os=-hms ;; + sparclite-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; sps7) basic_machine=m68k-bull os=-sysv2 @@ -545,6 +770,13 @@ case $basic_machine in spur) basic_machine=spur-unknown ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; sun2) basic_machine=m68000-sun ;; @@ -585,10 +817,22 @@ case $basic_machine in sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; symmetry) basic_machine=i386-sequent os=-dynix ;; + t3e) + basic_machine=t3e-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; tx39) basic_machine=mipstx39-unknown ;; @@ -606,6 +850,10 @@ case $basic_machine in basic_machine=a29k-nyu os=-sym1 ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; vaxv) basic_machine=vax-dec os=-sysv @@ -629,6 +877,14 @@ case $basic_machine in basic_machine=a29k-wrs os=-vxworks ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; xmp) basic_machine=xmp-cray os=-unicos @@ -636,6 +892,10 @@ case $basic_machine in xps | xps100) basic_machine=xps100-honeywell ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; none) basic_machine=none-none os=-none @@ -643,6 +903,15 @@ case $basic_machine in # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; mips) if [ x$os = x-linux-gnu ]; then basic_machine=mips-unknown @@ -659,13 +928,20 @@ case $basic_machine in vax) basic_machine=vax-dec ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; - sparc) + sh3 | sh4) + basic_machine=sh-unknown + ;; + sparc | sparcv9) basic_machine=sparc-sun ;; cydra) @@ -677,6 +953,19 @@ case $basic_machine in orion105) basic_machine=clipper-highlevel ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + c4x*) + basic_machine=c4x-none + os=-coff + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 @@ -718,6 +1007,12 @@ case $os in -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; +#### MozillaHack + -os2_emx) + ;; + -os2_vacpp) + ;; +#### End MozillaHack # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. @@ -730,15 +1025,35 @@ case $os in | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ - | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -uxpv*) + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -msvc* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -os2*) # Remember, each alternative MUST END IN *, to match a version number. ;; - -beos*) - os=-beos + -qnx*) + case $basic_machine in + x86-* | i[34567]86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto*) + os=-nto-qnx + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` @@ -749,6 +1064,12 @@ case $os in -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; -osfrose*) os=-osfrose ;; @@ -764,12 +1085,18 @@ case $os in -acis*) os=-aos ;; + -386bsd) + os=-bsd + ;; -ctix* | -uts*) os=-sysv ;; -ns2 ) os=-nextstep2 ;; + -nsk*) + os=-nsk + ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` @@ -795,14 +1122,17 @@ case $os in # This must come after -sysvr4. -sysv*) ;; - -xenix) - os=-xenix + -ose*) + os=-ose ;; - -rhapsody*) + -es1800*) + os=-ose ;; - -qnx*) + -xenix) + os=-xenix ;; - -nto*) + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint ;; -none) ;; @@ -829,9 +1159,15 @@ case $basic_machine in *-acorn) os=-riscix1.2 ;; + arm*-rebel) + os=-linux + ;; arm*-semi) os=-aout ;; + pdp10-*) + os=-tops20 + ;; pdp11-*) os=-none ;; @@ -850,15 +1186,36 @@ case $basic_machine in # default. # os=-sunos4 ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; + *-be) + os=-beos + ;; *-ibm) os=-aix ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; *-hp) os=-hpux ;; @@ -919,9 +1276,21 @@ case $basic_machine in *-masscomp) os=-rtu ;; - f301-fujitsu) + f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; *) os=-none ;; @@ -943,9 +1312,15 @@ case $basic_machine in -aix*) vendor=ibm ;; + -beos*) + vendor=be + ;; -hpux*) vendor=hp ;; + -mpeix*) + vendor=hp + ;; -hiux*) vendor=hitachi ;; @@ -961,7 +1336,7 @@ case $basic_machine in -genix*) vendor=ns ;; - -mvs*) + -mvs* | -opened*) vendor=ibm ;; -ptx*) @@ -973,9 +1348,26 @@ case $basic_machine in -aux*) vendor=apple ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/config/.cvsignore b/config/.cvsignore index e6e162a9..6015884e 100644 --- a/config/.cvsignore +++ b/config/.cvsignore @@ -2,3 +2,8 @@ nfspwd revdepth my_config.mk my_overrides.mk +autoconf.mk +nsprincl.mk +nsprincl.sh +now +Makefile 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/HP-UX.mk b/config/HP-UX.mk index 371de60b..9b2fa853 100644 --- a/config/HP-UX.mk +++ b/config/HP-UX.mk @@ -38,7 +38,8 @@ RANLIB = echo CPU_ARCH = hppa -OS_CFLAGS += $(DSO_CFLAGS) -DHPUX -D$(CPU_ARCH) -D_HPUX_SOURCE +OS_CFLAGS += $(DSO_CFLAGS) -DHPUX -D$(CPU_ARCH) -D_HPUX_SOURCE -Dhpux + # # The header netdb.h on HP-UX 9 does not declare h_errno. 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 b/config/Makefile deleted file mode 100644 index e4ffc4d2..00000000 --- a/config/Makefile +++ /dev/null @@ -1,118 +0,0 @@ -#! gmake - -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -MOD_DEPTH = .. - -# Indicate that this directory builds build tools. -INTERNAL_TOOLS = 1 - -include $(MOD_DEPTH)/config/config.mk - -CSRCS = now.c - -# This version hasn't been ported for us; the one in mozilla/config has -ifneq ($(OS_ARCH),OS2) -CSRCS += nsinstall.c - -PLSRCS = nfspwd.pl -endif - -ifeq (,$(filter-out WINNT OS2,$(OS_ARCH))) -PROG_SUFFIX = .exe -else -PROG_SUFFIX = -endif - -# Temporary workaround to disable the generation of -# library build time because now.c uses the 'long long' -# data type that's not available on some platforms. -ifeq (,$(filter-out NEC NEXTSTEP QNX SCOOS UNIXWARE,$(OS_ARCH))) -DEFINES += -DOMIT_LIB_BUILD_TIME -endif - -ifeq ($(OS_ARCH), IRIX) - ifeq ($(basename $(OS_RELEASE)),6) - ifeq ($(USE_N32),1) - XLDOPTS += -n32 -Wl,-woff,85 - ifeq ($(OS_RELEASE), 6_2) - XLDOPTS += -Wl,-woff,85 - endif - else - ifeq ($(USE_64),1) - XLDOPTS += -64 - else - XLDOPTS += -32 - endif - endif - endif -endif - -ifeq ($(OS_ARCH), HP-UX) - ifeq ($(USE_64),1) - XLDOPTS += +DA2.0W - endif -endif - -ifeq ($(MOZ_OS2_TOOLS),EMX) -XCFLAGS = $(OS_EXE_CFLAGS) -ifeq ($(MOZ_OS2_EMX_OBJECTFORMAT),OMF) -XLDOPTS = -Zlinker /PM:VIO -endif -endif - -ifeq ($(MOZ_OS2_TOOLS),PGCC) -XCFLAGS = $(OS_EXE_CFLAGS) -XLDOPTS = -Zlinker /PM:VIO -endif - -ifeq ($(MOZ_OS2_TOOLS),VACPP) -OS_CFLAGS = $(OS_EXE_CFLAGS) -endif - -include $(MOD_DEPTH)/config/rules.mk - -PROGS = $(OBJDIR)/now$(PROG_SUFFIX) - -ifeq (,$(filter-out OS2 WINNT,$(OS_ARCH))) -TARGETS = $(PROGS) -else -PROGS += $(OBJDIR)/nsinstall$(PROG_SUFFIX) -TARGETS = $(PROGS) $(PLSRCS:.pl=) -endif - -OUTOPTION = -o # end of the line -ifeq (,$(filter-out WINNT WIN95,$(OS_TARGET))) -OUTOPTION = /Fe -endif - -# Redefine MAKE_OBJDIR for just this directory -define MAKE_OBJDIR -if test ! -d $(@D); then rm -rf $(@D); mkdir $(@D); else true; fi -endef - -export:: $(TARGETS) - -$(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX) - @$(MAKE_OBJDIR) -ifeq ($(MOZ_OS2_TOOLS),VACPP) - $(LINK) $(EXEFLAGS) $< -else - $(CC) $(XCFLAGS) $< $(XLDOPTS) $(OUTOPTION)$@ -endif - diff --git a/config/Makefile.in b/config/Makefile.in index a0004143..e9a60a4b 100644 --- a/config/Makefile.in +++ b/config/Makefile.in @@ -27,13 +27,24 @@ 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 nspr-config + +RELEASE_BINS = nspr-config + include $(topsrcdir)/config/config.mk -CSRCS = nsinstall.c now.c +CSRCS = now.c +# This version hasn't been ported for us; the one in mozilla/config has +ifneq ($(OS_ARCH),OS2) +CSRCS += nsinstall.c + PLSRCS = nfspwd.pl +endif -ifeq ($(OS_ARCH), WINNT) +ifeq (,$(filter-out WINNT OS2,$(OS_ARCH))) PROG_SUFFIX = .exe else PROG_SUFFIX = @@ -69,20 +80,23 @@ ifeq ($(OS_ARCH), HP-UX) endif endif -ifdef XP_OS2_EMX -XCFLAGS = $(OS_EXE_CFLAGS) +ifeq ($(MOZ_OS2_TOOLS),EMX) +XCFLAGS = $(OS_CFLAGS) +ifeq ($(MOZ_OS2_EMX_OBJECTFORMAT),OMF) XLDOPTS = -Zlinker /PM:VIO endif +endif -ifeq ($(MOZ_OS2_TOOLS),VACPP) -OS_CFLAGS = $(OS_EXE_CFLAGS) +ifeq ($(MOZ_OS2_TOOLS),PGCC) +XCFLAGS = $(OS_CFLAGS) +XLDOPTS = -Zlinker /PM:VIO endif include $(topsrcdir)/config/rules.mk PROGS = $(OBJDIR)/now$(PROG_SUFFIX) -ifeq ($(OS_ARCH),WINNT) +ifeq (,$(filter-out OS2 WINNT,$(OS_ARCH))) TARGETS = $(PROGS) else PROGS += $(OBJDIR)/nsinstall$(PROG_SUFFIX) @@ -100,11 +114,16 @@ if test ! -d $(@D); then rm -rf $(@D); mkdir $(@D); else true; fi endef export:: $(TARGETS) + $(RM) -f $(dist_bindir)/nspr-config $(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX) @$(MAKE_OBJDIR) ifeq ($(MOZ_OS2_TOOLS),VACPP) - $(LINK) $(EXEFLAGS) $< + $(LD) $(EXEFLAGS) $< else $(CC) $(XCFLAGS) $< $(XLDOPTS) $(OUTOPTION)$@ endif + +real_install:: nspr.m4 + $(NSINSTALL) -D $(DESTDIR)$(datadir)/aclocal + $(NSINSTALL) -t -m 0644 $< $(DESTDIR)$(datadir)/aclocal 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..2eca2afb 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,25 +48,27 @@ endif ARCH = netbsd +ifeq ($(OBJECT_FMT),ELF) +DLL_SUFFIX = so +else DLL_SUFFIX = so.1.0 +# XXX work around a bug in the a.out ld(1). +OS_LIBS = +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 +ifeq ($(OBJECT_FMT),ELF) +DSO_LDOPTS +=-Wl,-soname,lib$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX) endif ifdef LIBRUNPATH -DSO_LDOPTS += -R$(LIBRUNPATH) +#DSO_LDOPTS += -R$(LIBRUNPATH) +DSO_LDOPTS += -Wl,-R$(LIBRUNPATH) endif -MKSHLIB = $(LD) $(DSO_LDOPTS) +#MKSHLIB = $(LD) $(DSO_LDOPTS) +MKSHLIB = $(CC) $(DSO_LDOPTS) G++INCLUDES = -I/usr/include/g++ diff --git a/config/OS2.mk b/config/OS2.mk index 3f008cb9..7dbfb248 100644 --- a/config/OS2.mk +++ b/config/OS2.mk @@ -45,14 +45,15 @@ endif # # On OS/2 we proudly support gbash... # -SHELL = GBASH.EXE +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/OSF1.mk b/config/OSF1.mk index cf00f193..7e3b4c95 100644 --- a/config/OSF1.mk +++ b/config/OSF1.mk @@ -24,7 +24,7 @@ # which we use to stop LOOP_OVER_DIRS submakes as soon as any # submake fails. So we use the Korn shell instead. # -SHELL = /usr/bin/ksh +SHELL := /usr/bin/ksh include $(MOD_DEPTH)/config/UNIX.mk 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..238915f9 100644 --- a/config/WIN32.mk +++ b/config/WIN32.mk @@ -26,7 +26,7 @@ # flipped, so that gmake won't interpret them as escape characters. # ifdef PR_CLIENT_BUILD_WINDOWS -SHELL = $(MOZ_TOOLS_FLIPPED)/bin/shmsdos.exe +SHELL := $(MOZ_TOOLS_FLIPPED)/bin/shmsdos.exe endif CC = cl @@ -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..9ac9c31e 100644 --- a/config/autoconf.mk.in +++ b/config/autoconf.mk.in @@ -1,19 +1,45 @@ +# -*- Mode: Makefile -*- +INCLUDED_AUTOCONF_MK = 1 USE_AUTOCONF = 1 MOZILLA_CLIENT = @MOZILLA_CLIENT@ -DIST = @prefix@ -OBJDIR_NAME = . -OBJDIR = . + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +includedir = @includedir@/nspr +libdir = @libdir@ +datadir = @datadir@ + +dist_prefix = @dist_prefix@ +dist_bindir = @dist_bindir@ +dist_includedir = @dist_includedir@/nspr +dist_libdir = @dist_libdir@ + +DIST = $(dist_prefix) + +OBJDIR_NAME = @OBJDIR_NAME@ +OBJDIR = @OBJDIR@ OBJ_SUFFIX = @OBJ_SUFFIX@ LIB_SUFFIX = @LIB_SUFFIX@ DLL_SUFFIX = @DLL_SUFFIX@ -MOD_VERSION = @NSPR_VERSION@ MOD_NAME = @NSPR_MODNAME@ +MOD_MAJOR_VERSION = @MOD_MAJOR_VERSION@ +MOD_MINOR_VERSION = @MOD_MINOR_VERSION@ +MOD_REVISION_VERSION = @MOD_REVISION_VERSION@ + +LIBNSPR = @LIBNSPR@ +LIBPLC = @LIBPLC@ + +CROSS_COMPILE = @CROSS_COMPILE@ +BUILD_OPT = @MOZ_OPTIMIZE@ + USE_CPLUS = @USE_CPLUS@ USE_IPV6 = @USE_IPV6@ USE_N32 = @USE_N32@ USE_64 = @USE_64@ +GC_LEAK_DETECTOR = @GC_LEAK_DETECTOR@ USE_PTHREADS = @USE_PTHREADS@ USE_BTHREADS = @USE_BTHREADS@ @@ -31,12 +57,21 @@ RANLIB = @RANLIB@ PERL = @PERL@ DLLTOOL = @DLLTOOL@ WINDRES = @WINDRES@ -RC = $(WINDRES) +RC = @RC@ +STRIP = @STRIP@ +NSINSTALL = @NSINSTALL@ +FILTER = @FILTER@ +IMPLIB = @IMPLIB@ -OS_CFLAGS = @CFLAGS@ $(DSO_CFLAGS) -OS_CXXFLAGS = @CXXFLAGS@ $(DSO_CFLAGS) +OS_CPPFLAGS = @CPPFLAGS@ +OS_CFLAGS = $(OS_CPPFLAGS) @CFLAGS@ $(DSO_CFLAGS) +OS_CXXFLAGS = $(OS_CPPFLAGS) @CXXFLAGS@ $(DSO_CFLAGS) OS_LIBS = @OS_LIBS@ OS_LDFLAGS = @LDFLAGS@ +OS_DLLFLAGS = @OS_DLLFLAGS@ +DLLFLAGS = @DLLFLAGS@ +EXEFLAGS = @EXEFLAGS@ +OPTIMIZER = @OPTIMIZER@ MKSHLIB = @MKSHLIB@ DSO_CFLAGS = @DSO_CFLAGS@ @@ -50,10 +85,11 @@ HOST_CFLAGS = @HOST_CFLAGS@ DEFINES = @DEFINES@ @DEFS@ MDCPUCFG_H = @MDCPUCFG_H@ -MOZ_TARGET = @MOZ_TARGET@ +MOZ_WIN32_TARGET= @MOZ_WIN32_TARGET@ PR_MD_CSRCS = @PR_MD_CSRCS@ PR_MD_ASFILES = @PR_MD_ASFILES@ PR_MD_ARCH_DIR = @PR_MD_ARCH_DIR@ +CPU_ARCH = @CPU_ARCH@ OS_TARGET = @OS_TARGET@ OS_ARCH = @OS_ARCH@ diff --git a/config/config.mk b/config/config.mk index 4f7863f2..4cc92889 100644 --- a/config/config.mk +++ b/config/config.mk @@ -40,8 +40,6 @@ ifndef srcdir srcdir=. endif -ifdef USE_AUTOCONF - NFSPWD = $(MOD_DEPTH)/config/nfspwd CFLAGS = $(CC_ONLY_FLAGS) $(OPTIMIZER) $(OS_CFLAGS)\ @@ -54,8 +52,17 @@ NOMD_CFLAGS = $(CC_ONLY_FLAGS) $(OPTIMIZER) $(NOMD_OS_CFLAGS)\ NOMD_CCFLAGS = $(CCC_ONLY_FLAGS) $(OPTIMIZER) $(NOMD_OS_CFLAGS)\ $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS) -NSINSTALL = $(MOD_DEPTH)/config/$(OBJDIR_NAME)/nsinstall +LDFLAGS = $(OS_LDFLAGS) + +define MAKE_OBJDIR +if test ! -d $(@D); then rm -rf $(@D); $(NSINSTALL) -D $(@D); fi +endef + +LINK_DLL = $(LD) $(OS_DLLFLAGS) $(DLLFLAGS) +ifneq (,$(filter WINNT OS2, $(OS_ARCH))) +INSTALL = $(NSINSTALL) +else ifeq ($(NSDISTMODE),copy) # copy files, but preserve source mtime INSTALL = $(NSINSTALL) -t @@ -68,6 +75,7 @@ else INSTALL = $(NSINSTALL) -R endif endif +endif # WINNT || OS2 ifdef BUILD_DEBUG_GC DEFINES += -DDEBUG_GC @@ -75,6 +83,8 @@ endif GARBAGE += $(DEPENDENCIES) core $(wildcard core.[0-9]*) +DIST_GARBAGE += Makefile + DEFINES += -DFORCE_PR_LOG ifeq ($(_PR_NO_CLOCK_TIMER),1) @@ -93,97 +103,6 @@ ifeq ($(USE_IPV6),1) DEFINES += -D_PR_INET6 endif -else # ! USE_AUTOCONF - -ifndef NSPR_MY_CONFIG_MK -NSPR_MY_CONFIG_MK = $(MOD_DEPTH)/config/my_config.mk -endif - -# -# The variable definitions in this file are used to -# override variable values set by NSPR's build system. -# This file, if present, is included at the end of config.mk. -# -# For example: -# -# DIST=/usr/local/nspr -# -ifndef NSPR_MY_OVERRIDES_MK -NSPR_MY_OVERRIDES_MK = $(MOD_DEPTH)/config/my_overrides.mk -endif - --include $(NSPR_MY_CONFIG_MK) - -include $(MOD_DEPTH)/config/module.df - -include $(MOD_DEPTH)/config/arch.mk - -ifndef NSDEPTH -NSDEPTH = $(MOD_DEPTH)/.. -endif - -# -# Default command macros; can be overridden in .mk. -# -# XXX FIXME: I removed CCF and LINKEXE. -AS = $(CC) -ASFLAGS = $(CFLAGS) -PURIFY = purify $(PURIFYOPTIONS) -LINK_DLL = $(LINK) $(OS_DLLFLAGS) $(DLLFLAGS) -NFSPWD = $(MOD_DEPTH)/config/nfspwd - -CFLAGS = $(CC_ONLY_FLAGS) $(OPTIMIZER) $(OS_CFLAGS)\ - $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS) -CCCFLAGS = $(CCC_ONLY_FLAGS) $(OPTIMIZER) $(OS_CFLAGS)\ - $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS) -# For purify -NOMD_CFLAGS = $(CC_ONLY_FLAGS) $(OPTIMIZER) $(NOMD_OS_CFLAGS)\ - $(XP_DEFINE) $(DEFINES) $(INCLUDES) $(XCFLAGS) - -include $(MOD_DEPTH)/config/$(OS_TARGET).mk - -# Figure out where the binary code lives. -BUILD = $(OBJDIR_NAME) -OBJDIR = $(OBJDIR_NAME) -DIST = $(NSDEPTH)/dist/$(OBJDIR_NAME) -ifeq ($(MOZ_BITS),16) -MOZ_INCL = $(NSDEPTH)/dist/public/win16 -MOZ_DIST = $(NSDEPTH)/dist/WIN16D_D.OBJ -endif - -VPATH = $(OBJDIR) -DEPENDENCIES = $(OBJDIR)/.md - -ifdef BUILD_DEBUG_GC -DEFINES += -DDEBUG_GC -endif - -GARBAGE += $(DEPENDENCIES) core $(wildcard core.[0-9]*) - -#################################################################### -# -# The NSPR-specific configuration -# -#################################################################### - -OS_CFLAGS += -DFORCE_PR_LOG - -ifeq ($(_PR_NO_CLOCK_TIMER),1) -OS_CFLAGS += -D_PR_NO_CLOCK_TIMER -endif - -ifeq ($(USE_PTHREADS), 1) -OS_CFLAGS += -D_PR_PTHREADS -UHAVE_CVAR_BUILT_ON_SEM -endif - -ifeq ($(PTHREADS_USER), 1) -OS_CFLAGS += -DPTHREADS_USER -UHAVE_CVAR_BUILT_ON_SEM -endif - -ifeq ($(USE_IPV6),1) -OS_CFLAGS += -D_PR_INET6 -endif - #################################################################### # # Configuration for the release process @@ -204,6 +123,17 @@ RELEASE_INCLUDE_DIR = $(RELEASE_DIR)/$(BUILD_NUMBER)/$(OBJDIR_NAME)/include RELEASE_BIN_DIR = $(RELEASE_DIR)/$(BUILD_NUMBER)/$(OBJDIR_NAME)/bin RELEASE_LIB_DIR = $(RELEASE_DIR)/$(BUILD_NUMBER)/$(OBJDIR_NAME)/lib --include $(NSPR_MY_OVERRIDES_MK) +# +# The variable definitions in this file are used to +# override variable values set by NSPR's build system. +# This file, if present, is included at the end of config.mk. +# +# For example: +# +# DIST=/usr/local/nspr +# +ifndef NSPR_MY_OVERRIDES_MK +NSPR_MY_OVERRIDES_MK = $(MOD_DEPTH)/config/my_overrides.mk +endif -endif # USE_AUTOCONF +-include $(NSPR_MY_OVERRIDES_MK) diff --git a/config/nsinstall.c b/config/nsinstall.c index 56d4d304..75e56a17 100644 --- a/config/nsinstall.c +++ b/config/nsinstall.c @@ -41,7 +41,9 @@ #include "pathsub.h" +#ifndef HAVE_LCHOWN #define HAVE_LCHOWN +#endif #if defined(AIX) || defined(BSDI) || defined(HPUX) || defined(LINUX) \ || defined(SUNOS4) || defined(SCO) || defined(UNIXWARE) \ diff --git a/config/nspr-config.in b/config/nspr-config.in new file mode 100755 index 00000000..23c0d70a --- /dev/null +++ b/config/nspr-config.in @@ -0,0 +1,111 @@ +#!/bin/sh + +prefix=@prefix@ +exec_prefix=@exec_prefix@ +exec_prefix_set=no + +major_version=@MOD_MAJOR_VERSION@ +minor_version=@MOD_MINOR_VERSION@ +revision_version=@MOD_REVISION_VERSION@ + +usage() +{ + cat <&2 +fi + +lib_nspr=yes +lib_plc=yes +lib_plds=yes + +while test $# -gt 0; do + case "$1" in + -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + case $1 in + --prefix=*) + prefix=$optarg + if test $exec_prefix_set = no ; then + exec_prefix=$optarg + fi + ;; + --prefix) + echo_prefix=yes + ;; + --exec-prefix=*) + exec_prefix=$optarg + exec_prefix_set=yes + ;; + --exec-prefix) + echo_exec_prefix=yes + ;; + --version) + echo ${major_version}.${minor_version}.${revision_version} + ;; + --cflags) + echo_cflags=yes + ;; + --libs) + echo_libs=yes + ;; + nspr) + lib_nspr=yes + ;; + plc) + lib_plc=yes + ;; + plds) + lib_plds=yes + ;; + *) + usage 1 1>&2 + ;; + esac + shift +done + +if test "$echo_prefix" = "yes"; then + echo $prefix +fi + +if test "$echo_exec_prefix" = "yes"; then + echo $exec_prefix +fi + +if test "$echo_cflags" = "yes"; then + echo -I${prefix}/include/nspr +fi + +if test "$echo_libs" = "yes"; then + libdirs=-L${exec_prefix}/lib + if test -n "$lib_plds"; then + libdirs="$libdirs -lplds${major_version}" + fi + if test -n "$lib_plc"; then + libdirs="$libdirs -lplc${major_version}" + fi + if test -n "$lib_nspr"; then + libdirs="$libdirs -lnspr${major_version}" + fi + + echo $libdirs @LDFLAGS@ @OS_LIBS@ +fi + diff --git a/config/nspr.m4 b/config/nspr.m4 new file mode 100644 index 00000000..8174bea9 --- /dev/null +++ b/config/nspr.m4 @@ -0,0 +1,67 @@ +# -*- tab-width: 4; -*- +# Configure paths for NSPR +# Public domain - Chris Seawood 2001-04-05 +# Based upon gtk.m4 (also PD) by Owen Taylor + +dnl AM_PATH_NSPR([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for NSPR, and define NSPR_CFLAGS and NSPR_LIBS +AC_DEFUN(AM_PATH_NSPR, +[dnl + +AC_ARG_WITH(nspr-prefix, + [ --with-nspr-prefix=PFX Prefix where NSPR is installed], + nspr_config_prefix="$withval", + nspr_config_prefix="") + +AC_ARG_WITH(nspr-exec-prefix, + [ --with-nspr-exec-prefix=PFX + Exec prefix where NSPR is installed], + nspr_config_exec_prefix="$withval", + nspr_config_exec_prefix="") + + if test -n "$nspr_config_exec_prefix"; then + nspr_config_args="$nspr_config_args --exec-prefix=$nspr_config_exec_prefix" + if test -z "$NSPR_CONFIG"; then + NSPR_CONFIG=$nspr_config_exec_prefix/bin/nspr-config + fi + fi + if test -n "$nspr_config_prefix"; then + nspr_config_args="$nspr_config_args --prefix=$nspr_config_prefix" + if test -z "$NSPR_CONFIG"; then + NSPR_CONFIG=$nspr_config_prefix/bin/nspr-config + fi + fi + + unset ac_cv_path_NSPR_CONFIG + AC_PATH_PROG(NSPR_CONFIG, nspr-config, no) + min_nspr_version=ifelse([$1], ,4.0.0,$1) + AC_MSG_CHECKING(for NSPR - version >= $min_nspr_version (skipping)) + + no_nspr="" + if test "$NSPR_CONFIG" = "no"; then + no_nspr="yes" + else + NSPR_CFLAGS=`$NSPR_CONFIG $nspr_config_args --cflags` + NSPR_LIBS=`$NSPR_CONFIG $nspr_config_args --libs` + + dnl Skip version check for now + nspr_config_major_version=`$NSPR_CONFIG $nspr_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + nspr_config_minor_version=`$NSPR_CONFIG $nspr_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + nspr_config_micro_version=`$NSPR_CONFIG $nspr_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + fi + + if test -z "$no_nspr"; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + fi + + + AC_SUBST(NSPR_CFLAGS) + AC_SUBST(NSPR_LIBS) + +]) diff --git a/config/rules.mk b/config/rules.mk index b885c33e..2e623a75 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 @@ -87,7 +89,7 @@ ifeq (,$(filter-out WINNT OS2,$(OS_ARCH))) # Win95, Win16, and OS/2 require library names conforming to the 8.3 rule. # other platforms do not. # -ifeq (,$(filter-out WIN95 WIN16 OS2,$(OS_TARGET))) +ifeq (,$(filter-out WIN95 OS2,$(OS_TARGET))) LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION)_s.$(LIB_SUFFIX) SHARED_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(DLL_SUFFIX) IMPORT_LIBRARY = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).$(LIB_SUFFIX) @@ -130,24 +132,12 @@ OBJS = $(addprefix $(OBJDIR)/,$(CSRCS:.c=.$(OBJ_SUFFIX))) \ $(addprefix $(OBJDIR)/,$(ASFILES:.s=.$(OBJ_SUFFIX))) endif -ifeq ($(OS_TARGET), WIN16) - comma := , - empty := - space := $(empty) $(empty) - W16OBJS = $(subst $(space),$(comma)$(space),$(strip $(OBJS))) - W16TEMP =$(OS_LIBS) $(EXTRA_LIBS) - ifeq ($(strip $(W16TEMP)),) - W16LIBS = - else - W16LIBS = library $(subst $(space),$(comma)$(space),$(strip $(W16TEMP))) - endif - W16DEF = $(notdir $(basename $(SHARED_LIBRARY))).DEF -endif - ifeq ($(OS_ARCH), WINNT) -ifneq ($(OS_TARGET), WIN16) OBJS += $(RES) endif + +ifeq ($(MOZ_OS2_TOOLS),VACPP) +EXTRA_LIBS := $(patsubst -l%,$(DIST)/lib/%.$(LIB_SUFFIX),$(EXTRA_LIBS)) endif ALL_TRASH = $(TARGETS) $(OBJS) $(filter-out . .., $(OBJDIR)) LOGS TAGS $(GARBAGE) \ @@ -170,16 +160,14 @@ endif ################################################################################ -all:: export libs install +all:: export export:: +$(LOOP_OVER_DIRS) -libs:: - +$(LOOP_OVER_DIRS) +libs:: export -install:: - +$(LOOP_OVER_DIRS) +install:: export clean:: rm -rf $(OBJS) so_locations $(NOSUCHFILE) $(GARBAGE) @@ -193,6 +181,22 @@ 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) + +real_install:: $(RELEASE_BINS) $(RELEASE_HEADERS) $(RELEASE_LIBS) +ifdef RELEASE_BINS + $(NSINSTALL) -t -m 0755 $(RELEASE_BINS) $(DESTDIR)$(bindir) +endif +ifdef RELEASE_HEADERS + $(NSINSTALL) -t -m 0644 $(RELEASE_HEADERS) $(DESTDIR)$(includedir) +endif +ifdef RELEASE_LIBS + $(NSINSTALL) -t -m 0755 $(RELEASE_LIBS) $(DESTDIR)$(libdir) +endif + +$(LOOP_OVER_DIRS) + release:: export ifdef RELEASE_BINS @echo "Copying executable programs and scripts to release directory" @@ -263,26 +267,20 @@ else $(CC) -o $@ $(CFLAGS) $(OBJS) $(LDFLAGS) endif endif +ifdef BUILD_OPT + $(STRIP) $@ +endif $(LIBRARY): $(OBJS) @$(MAKE_OBJDIR) rm -f $@ ifeq ($(MOZ_OS2_TOOLS),VACPP) - $(AR) $(subst /,\\,$(OBJS)) $(AR_EXTRA_ARGS) + $(AR) $(subst /,\\,$(OBJS)) $(AR_FLAGS) else -ifdef USE_AUTOCONF $(AR) $(AR_FLAGS) $(OBJS) $(AR_EXTRA_ARGS) -else - $(AR) $(OBJS) $(AR_EXTRA_ARGS) -endif # USE_AUTOCONF endif $(RANLIB) $@ -ifeq ($(OS_TARGET), WIN16) -$(IMPORT_LIBRARY): $(SHARED_LIBRARY) - wlib $(OS_LIB_FLAGS) $@ +$(SHARED_LIBRARY) -endif - ifeq ($(OS_TARGET), OS2) $(IMPORT_LIBRARY): $(SHARED_LIBRARY) $(IMPLIB) $@ $(SHARED_LIBRARY).def @@ -291,9 +289,6 @@ endif $(SHARED_LIBRARY): $(OBJS) @$(MAKE_OBJDIR) rm -f $@ -ifdef USE_AUTOCONF - $(MKSHLIB) $(OBJS) $(EXTRA_LIBS) $(OS_LIBS) -else ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1) echo "#!" > $(OBJDIR)/lib$(LIBRARY_NAME)_syms nm -B -C -g $(OBJS) \ @@ -304,25 +299,7 @@ ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1) -bM:SRE -bnoentry $(OS_LIBS) $(EXTRA_LIBS) else # AIX 4.1 ifeq ($(OS_ARCH), WINNT) -ifeq ($(OS_TARGET), WIN16) - echo system windows dll initinstance >w16link - echo option map >>w16link - echo option oneautodata >>w16link - echo option heapsize=32K >>w16link - echo option $(OS_DLL_OPTION) >>w16link - echo debug $(DEBUGTYPE) all >>w16link - echo name $@ >>w16link - echo file >>w16link - echo $(W16OBJS) >>w16link - echo $(W16IMPORTS) >>w16link - echo $(W16LIBS) >>w16link - echo $(W16_EXPORTS) >>w16link - echo libfile libentry >>w16link - $(LINK) @w16link. - rm w16link -else # WIN16 - $(LINK_DLL) -MAP $(DLLBASE) $(OS_LIBS) $(EXTRA_LIBS) $(OBJS) -endif # WINNT + $(LINK_DLL) -MAP $(DLLBASE) $(DLL_LIBS) $(EXTRA_LIBS) $(OBJS) else ifeq ($(OS_ARCH),OS2) # append ( >> ) doesn't seem to be working under OS/2 gmake. Run through OS/2 shell instead. @@ -338,27 +315,28 @@ ifeq ($(OS_TARGET), OpenVMS) @if test ! -f $(OBJDIR)/VMSuni.opt; then \ echo "Creating universal symbol option file $(OBJDIR)/VMSuni.opt";\ create_opt_uni $(OBJS); \ - mv VMSuni.opt $(OBJDIR); \ fi - $(MKSHLIB) -o $@ $(OBJS) $(EXTRA_LIBS) $(OS_LIBS) $(OBJDIR)/VMSuni.opt + $(MKSHLIB) -o $@ $(OBJS) $(EXTRA_LIBS) $(OBJDIR)/VMSuni.opt @echo "`translate $@`" > $(@:.$(DLL_SUFFIX)=.vms) else # OpenVMS - $(MKSHLIB) -o $@ $(OBJS) $(EXTRA_LIBS) $(OS_LIBS) + $(MKSHLIB) $(OBJS) $(EXTRA_LIBS) endif # OpenVMS endif # OS2 endif # WINNT endif # AIX 4.1 -endif # USE_AUTOCONF +ifdef BUILD_OPT + $(STRIP) $@ +endif ifeq (,$(filter-out WINNT OS2,$(OS_ARCH))) $(RES): $(RESNAME) @$(MAKE_OBJDIR) ifeq ($(OS_TARGET),OS2) - $(RC) -DOS2 -r $(RESNAME) $(RES) + $(RC) -DOS2 -r $< $@ else # The resource compiler does not understand the -U option. - $(RC) $(filter-out -U%,$(DEFINES)) $(INCLUDES) -Fo$(RES) $(RESNAME) + $(RC) $(filter-out -U%,$(DEFINES)) $(INCLUDES) -Fo$@ $< endif @echo $(RES) finished endif @@ -381,14 +359,7 @@ WCCFLAGS3 = $(subst -D,-d,$(WCCFLAGS2)) $(OBJDIR)/%.$(OBJ_SUFFIX): %.c @$(MAKE_OBJDIR) ifeq ($(OS_ARCH), WINNT) -ifeq ($(OS_TARGET), WIN16) -# $(MOD_DEPTH)/config/w16opt $(WCCFLAGS3) - echo $(WCCFLAGS3) >w16wccf - $(CC) -zq -fo$(OBJDIR)\\$*.$(OBJ_SUFFIX) @w16wccf $*.c - rm w16wccf -else $(CC) -Fo$@ -c $(CFLAGS) $< -endif else ifeq ($(MOZ_OS2_TOOLS),VACPP) $(CC) -Fo$@ -c $(CFLAGS) $< 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) diff --git a/configure b/configure index 56a87989..0cf81b44 100755 --- a/configure +++ b/configure @@ -11,19 +11,27 @@ ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: -ac_default_prefix=\${MOD_DEPTH}/dist +ac_help="$ac_help + --with-dist-prefix=DIST_PREFIX + place build files in DIST_PREFIX [dist]" +ac_help="$ac_help + --with-dist-bindir=DIR build execuatables in DIR [DIST_PREFIX/bin]" +ac_help="$ac_help + --with-dist-includedir=DIR + build include files in DIR [DIST_PREFIX/include]" +ac_help="$ac_help + --with-dist-libdir=DIR build library files in DIR [DIST_PREFIX/lib]" ac_help="$ac_help --with-mozilla Compile NSPR with Mozilla support" ac_help="$ac_help - --enable-optimize Enable code optimizations" + --enable-optimize(=val) Enable code optimizations (val, ie. -O2) " ac_help="$ac_help --disable-debug Do not compile in debugging symbols" ac_help="$ac_help - --disable-shared Do not compile into shared libraries" + --enable-win32-target=\$t + Specify win32 flavor. (WIN95 or WINNT)" ac_help="$ac_help - --enable-target=\$t Turn on features for target \$t when build has multiple targets" -ac_help="$ac_help - --enable-n32 Enable n32 support (IRIX only)" + --enable-n32 Enable n32 ABI support (IRIX only)" ac_help="$ac_help --enable-64bit Enable 64-bit support (on certain platforms)" ac_help="$ac_help @@ -39,9 +47,11 @@ ac_help="$ac_help ac_help="$ac_help --with-native-threads Use native system threads as thread subsystem (Solaris only)" ac_help="$ac_help - --enable-cplus Use cplus for whatever reason" + --enable-cplus Enable some c++ api routines" ac_help="$ac_help --enable-ipv6 Compile ipv6 support" +ac_help="$ac_help + --enable-boehm Enable the Boehm Garbage Collector" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -553,12 +563,6 @@ fi -d=`pwd` -if test "${srcdir}" = "$d" || test "${srcdir}" = "." ; then - echo "Do not build in the srcdir as it will override Makefiles used by non-autoconf build." - exit 1; -fi - ac_aux_dir= for ac_dir in ${srcdir}/build/autoconf $srcdir/${srcdir}/build/autoconf; do if test -f $ac_dir/install-sh; then @@ -606,7 +610,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:610: checking host system type" >&5 +echo "configure:614: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -627,7 +631,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:631: checking target system type" >&5 +echo "configure:635: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -645,7 +649,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:649: checking build system type" >&5 +echo "configure:653: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -668,32 +672,14 @@ 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 EOF -NSPR_VERSION=4 +MOD_MAJOR_VERSION=4 +MOD_MINOR_VERSION=0 +MOD_REVISION_VERSION=1 NSPR_MODNAME=nspr20 _HAVE_PTHREADS= USE_PTHREADS= @@ -708,6 +694,13 @@ _OPTIMIZE_FLAGS=-O _DEBUG_FLAGS=-g MOZ_DEBUG=1 MOZ_OPTIMIZE= +OBJDIR=. +OBJDIR_NAME=. +NSINSTALL='$(MOD_DEPTH)/config/$(OBJDIR_NAME)/nsinstall' +NOSUCHFILE=/no-such-file +LIBNSPR='-L$(dist_libdir) -lnspr$(MOD_MAJOR_VERSION)' +LIBPLC='-L$(dist_libdir) -lplc$(MOD_MAJOR_VERSION)' + RESOLVE_LINK_SYMBOLS= CFLAGS="${CFLAGS=}" @@ -716,6 +709,72 @@ LDFLAGS="${LDFLAGS=}" HOST_CFLAGS="${HOST_CFLAGS=}" HOST_LDFLAGS="${HOST_LDFLAGS=}" +case "$target" in +*-irix6*) + USE_N32=1 ;; +*-cygwin*) + # Check to see if we are really running in a msvc environemnt + _WIN32_MSVC= + if test "$CC" = "cl" || test "$CXX" = "cl"; then + _WIN32_MSVC=1 + elif test -z "$CC"; then + echo 'main() { return 0; }' > dummy.c + cl -o dummy dummy.c + if test $? = 0; then + _WIN32_MSVC=1 + fi + rm -f dummy dummy.o dummy.obj dummy.exe dummy.c + fi + ;; +*-msvc*) + _WIN32_MSVC=1 + ;; +esac + +if test -n "$_WIN32_MSVC"; then + SKIP_PATH_CHECKS=1 + SKIP_COMPILER_CHECKS=1 + SKIP_LIBRARY_CHECKS=1 +fi + +dist_prefix='${MOD_DEPTH}/dist' +dist_bindir='${dist_prefix}/bin' +dist_includedir='${dist_prefix}/include' +dist_libdir='${dist_prefix}/lib' + +# Check whether --with-dist-prefix or --without-dist-prefix was given. +if test "${with_dist_prefix+set}" = set; then + withval="$with_dist_prefix" + dist_prefix=$withval +fi + + +# Check whether --with-dist-bindir or --without-dist-bindir was given. +if test "${with_dist_bindir+set}" = set; then + withval="$with_dist_bindir" + dist_bindir=$withval +fi + + +# Check whether --with-dist-includedir or --without-dist-includedir was given. +if test "${with_dist_includedir+set}" = set; then + withval="$with_dist_includedir" + dist_includedir=$withval +fi + + +# Check whether --with-dist-libdir or --without-dist-libdir was given. +if test "${with_dist_libdir+set}" = set; then + withval="$with_dist_libdir" + dist_libdir=$withval +fi + + + + + + + # Check whether --with-mozilla or --without-mozilla was given. if test "${with_mozilla+set}" = set; then withval="$with_mozilla" @@ -741,7 +800,13 @@ fi # Check whether --enable-optimize or --disable-optimize was given. if test "${enable_optimize+set}" = set; then enableval="$enable_optimize" - MOZ_OPTIMIZE=1 + if test "$enableval" != "no"; then + MOZ_OPTIMIZE=1 + if test -n "$enableval" && test "$enableval" != "yes"; then + _OPTIMIZE_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'` + _SAVE_OPTIMIZE_FLAGS=$_OPTIMIZE_FLAGS + fi + fi fi @@ -754,19 +819,12 @@ if test "${enable_debug+set}" = set; then fi -# Check whether --enable-shared or --disable-shared was given. -if test "${enable_shared+set}" = set; then - enableval="$enable_shared" - : -fi - - -# Check whether --enable-target or --disable-target was given. -if test "${enable_target+set}" = set; then - enableval="$enable_target" - MOZ_TARGET=`echo $enableval | tr a-z A-Z` +# Check whether --enable-win32-target or --disable-win32-target was given. +if test "${enable_win32_target+set}" = set; then + enableval="$enable_win32_target" + MOZ_WIN32_TARGET=`echo $enableval | tr a-z A-Z` else - MOZ_TARGET= + MOZ_WIN32_TARGET= fi @@ -775,6 +833,9 @@ if test "${enable_n32+set}" = set; then enableval="$enable_n32" if test "$enableval" = "yes"; then USE_N32=1 + else if test "$enableval" = "no"; then + USE_N32= + fi fi fi @@ -797,10 +858,11 @@ if test "${enable_mdupdate+set}" = set; then fi -# Extract the first word of "whoami", so it can be a program name with args. -set dummy whoami; ac_word=$2 +if test -z "$SKIP_PATH_CHECKS"; then + # Extract the first word of "$WHOAMI whoami", so it can be a program name with args. +set dummy $WHOAMI whoami; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:804: checking for $ac_word" >&5 +echo "configure:866: 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 @@ -822,7 +884,7 @@ else fi done IFS="$ac_save_ifs" - test -z "$ac_cv_path_WHOAMI" && ac_cv_path_WHOAMI=":" + test -z "$ac_cv_path_WHOAMI" && ac_cv_path_WHOAMI="echo not_whoami" ;; esac fi @@ -833,6 +895,10 @@ else echo "$ac_t""no" 1>&6 fi +elif test -z "$WHOAMI"; then + WHOAMI=whoami +fi + if test -n "$MOZ_DEBUG"; then cat >> confdefs.h <<\EOF #define DEBUG 1 @@ -848,9 +914,10 @@ else #define NDEBUG 1 EOF - DEFINES="$DEFINES -UDEBUG" + DEFINES="$DEFINES -U_DEBUG -UDEBUG" fi +if test -z "$SKIP_COMPILER_CHECKS"; then if test "$target" != "$host"; then echo "cross compiling from $host to $target" cross_compiling=yes @@ -860,14 +927,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:931: 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:938: 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 +981,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:985: checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:994: \"$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 +1011,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:1015: 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 @@ -972,14 +1039,14 @@ fi test -n "$CC" && break done -test -n "$CC" || CC=":" +test -n "$CC" || CC="echo" fi unset ac_cv_prog_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:1050: 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 +1076,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:1080: 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 +1127,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:1131: 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 +1159,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:1163: 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 +1170,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 1107 "configure" +#line 1174 "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:1179: \"$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 +1201,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:1205: 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:1210: 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 +1215,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:1219: \"$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 +1234,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:1238: 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 +1271,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:1275: 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 @@ -1232,7 +1299,7 @@ fi test -n "$CXX" && break done -test -n "$CXX" || CXX=":" +test -n "$CXX" || CXX="echo" fi unset ac_cv_prog_CXX @@ -1241,7 +1308,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:1312: 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 +1340,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:1344: 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 +1351,12 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext << EOF -#line 1288 "configure" +#line 1355 "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:1360: \"$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 +1382,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:1386: 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:1391: 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 +1396,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:1400: \"$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 +1415,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:1419: 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 +1452,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:1456: 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 @@ -1413,7 +1480,7 @@ fi test -n "$RANLIB" && break done -test -n "$RANLIB" || RANLIB=":" +test -n "$RANLIB" || RANLIB="echo" fi if test -z "$AR"; then @@ -1422,7 +1489,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:1493: 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 @@ -1450,7 +1517,7 @@ fi test -n "$AR" && break done -test -n "$AR" || AR=":" +test -n "$AR" || AR="echo" fi if test -z "$AS"; then @@ -1459,7 +1526,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:1530: 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 @@ -1487,7 +1554,7 @@ fi test -n "$AS" && break done -test -n "$AS" || AS=":" +test -n "$AS" || AS="echo" fi if test -z "$LD"; then @@ -1496,7 +1563,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:1567: 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 @@ -1524,7 +1591,44 @@ fi test -n "$LD" && break done -test -n "$LD" || LD=":" +test -n "$LD" || LD="echo" + + fi + if test -z "$STRIP"; then + for ac_prog in "${target_alias}-strip" "${target}-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:1604: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else + 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_prog_STRIP="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +STRIP="$ac_cv_prog_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="echo" fi if test -z "$DLLTOOL"; then @@ -1533,7 +1637,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:1641: 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 @@ -1561,7 +1665,7 @@ fi test -n "$DLLTOOL" && break done -test -n "$DLLTOOL" || DLLTOOL=":" +test -n "$DLLTOOL" || DLLTOOL="echo" fi if test -z "$WINDRES"; then @@ -1570,7 +1674,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:1678: 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 @@ -1598,14 +1702,161 @@ fi test -n "$WINDRES" && break done -test -n "$WINDRES" || WINDRES=":" +test -n "$WINDRES" || WINDRES="echo" fi + else - # Extract the first word of "gcc", so it can be a program name with args. + for ac_prog in $CCC c++ g++ gcc CC cxx cc++ cl +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:1716: 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 + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else + 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_prog_CXX="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CXX="$ac_cv_prog_CXX" +if test -n "$CXX"; then + echo "$ac_t""$CXX" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$CXX" && break +done +test -n "$CXX" || CXX="gcc" + + +echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:1748: 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. +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cxx_cross + +cat > conftest.$ac_ext << EOF + +#line 1759 "configure" +#include "confdefs.h" + +int main(){return(0);} +EOF +if { (eval echo configure:1764: \"$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 + ac_cv_prog_cxx_cross=no + else + ac_cv_prog_cxx_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cxx_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cxx_works" 1>&6 +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:1790: 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:1795: 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 + cat > conftest.C <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gxx=yes +else + ac_cv_prog_gxx=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gxx" 1>&6 + +if test $ac_cv_prog_gxx = yes; then + GXX=yes +else + GXX= +fi + +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:1823: 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 + echo 'void f(){}' > conftest.cc +if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then + ac_cv_prog_cxx_g=yes +else + ac_cv_prog_cxx_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cxx_g" 1>&6 +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS="$ac_save_CXXFLAGS" +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi + + if test "$CXX" = "cl" -a -z "$CC"; then + CC=$CXX + else + # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1609: checking for $ac_word" >&5 +echo "configure:1860: 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 +1886,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:1890: 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 +1937,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:1941: 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 +1969,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:1973: 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 +1980,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 1733 "configure" +#line 1984 "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:1989: \"$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 +2011,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:2015: 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:2020: 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 +2025,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:2029: \"$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 +2044,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:2048: 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 @@ -1824,175 +2075,33 @@ else fi fi - for ac_prog in $CCC c++ g++ gcc CC cxx cc++ cl -do -# Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 + 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:1833: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then +echo "configure:2083: 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 - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else 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_prog_CXX="$ac_prog" + ac_cv_prog_RANLIB="ranlib" break fi done IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" fi fi -CXX="$ac_cv_prog_CXX" -if test -n "$CXX"; then - echo "$ac_t""$CXX" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -test -n "$CXX" && break -done -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 - -ac_ext=C -# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cxx_cross - -cat > conftest.$ac_ext << EOF - -#line 1876 "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 - 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 - ac_cv_prog_cxx_cross=no - else - ac_cv_prog_cxx_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cxx_works=no -fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cxx_works" 1>&6 -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 "$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 -if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.C <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gxx=yes -else - ac_cv_prog_gxx=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gxx" 1>&6 - -if test $ac_cv_prog_gxx = yes; then - GXX=yes -else - GXX= -fi - -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 -if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo 'void f(){}' > conftest.cc -if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then - ac_cv_prog_cxx_g=yes -else - ac_cv_prog_cxx_g=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_prog_cxx_g" 1>&6 -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS="$ac_save_CXXFLAGS" -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -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 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else - 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_prog_RANLIB="ranlib" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" -fi -fi -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 else echo "$ac_t""no" 1>&6 fi @@ -2002,7 +2111,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:2115: 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 +2152,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:2156: 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 @@ -2077,14 +2186,14 @@ fi test -n "$AR" && break done -test -n "$AR" || AR=":" +test -n "$AR" || AR="echo not_ar" - for ac_prog in ld + for ac_prog in ld link 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:2197: 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 @@ -2118,14 +2227,55 @@ fi test -n "$LD" && break done -test -n "$LD" || LD=":" +test -n "$LD" || LD="echo not_ld" + + 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:2238: 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="echo not_strip" for ac_prog in dlltool 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:2279: 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 @@ -2159,14 +2309,14 @@ fi test -n "$DLLTOOL" && break done -test -n "$DLLTOOL" || DLLTOOL=":" +test -n "$DLLTOOL" || DLLTOOL="echo not_dlltool" for ac_prog in windres 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:2320: 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 @@ -2200,7 +2350,7 @@ fi test -n "$WINDRES" && break done -test -n "$WINDRES" || WINDRES=":" +test -n "$WINDRES" || WINDRES="echo not_windres" if test -z "$HOST_CC"; then HOST_CC="$CC" @@ -2218,97 +2368,21 @@ if test "`echo | $AS -V 2>&1 | grep -c GNU`" != "0"; then fi rm -f a.out -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# 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 -if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +if test "$cross_compiling" = "yes"; then + CROSS_COMPILE=1 else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - if test -f $ac_dir/$ac_prog; then - if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 - fi - fi - done - ;; - esac - done - IFS="$ac_save_IFS" - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" - else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL="$ac_install_sh" - fi + CROSS_COMPILE= fi -echo "$ac_t""$INSTALL" 1>&6 -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -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 -if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - rm -f conftestdata -if ln -s X conftestdata 2>/dev/null -then - rm -f conftestdata - ac_cv_prog_LN_S="ln -s" -else - ac_cv_prog_LN_S=ln -fi -fi -LN_S="$ac_cv_prog_LN_S" -if test "$ac_cv_prog_LN_S" = "ln -s"; then - echo "$ac_t""yes" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi +fi # SKIP_COMPILER_CHECKS -for ac_prog in perl5 perl +if test -z "$SKIP_PATH_CHECKS"; then + for ac_prog in perl5 perl 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:2386: 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 @@ -2342,8 +2416,11 @@ fi test -n "$PERL" && break done -test -n "$PERL" || PERL=":" +test -n "$PERL" || PERL="echo not_perl" +elif test -z "$PERL"; then + PERL=perl +fi OBJ_SUFFIX=o LIB_SUFFIX=a @@ -2353,18 +2430,157 @@ 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'` OS_RELEASE=`uname -r` OS_TEST=`uname -m` +if test "$OS_ARCH" = "IRIX64"; then + OS_ARCH=IRIX +fi + +if test "$OS_ARCH" = "POSIX_for_OpenVMS_AXP"; then + OS_ARCH=OpenVMS +fi + +####################################################################### +# Master "Core Components" macros for getting the OS target # +####################################################################### + +# +# Note: OS_TARGET should be specified on the command line for gmake. +# When OS_TARGET=WIN95 is specified, then a Windows 95 target is built. +# The difference between the Win95 target and the WinNT target is that +# the WinNT target uses Windows NT specific features not available +# in Windows 95. The Win95 target will run on Windows NT, but (supposedly) +# at lesser performance (the Win95 target uses threads; the WinNT target +# uses fibers). +# +# When OS_TARGET=WIN16 is specified, then a Windows 3.11 (16bit) target +# is built. See: win16_3.11.mk for lots more about the Win16 target. +# +# If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no +# cross-compilation. +# + +# +# The following hack allows one to build on a WIN95 machine (as if +# s/he were cross-compiling on a WINNT host for a WIN95 target). +# It also accomodates for MKS's uname.exe. If you never intend +# to do development on a WIN95 machine, you don't need this hack. +# +if test "$OS_ARCH" = "WIN95"; then + OS_ARCH=WINNT + OS_TARGET=WIN95 +elif test "$OS_ARCH" = 'Windows_95'; then + OS_ARCH=Windows_NT + OS_TARGET=WIN95 +elif test "$OS_ARCH" = 'Windows_98'; then + OS_ARCH=Windows_NT + OS_TARGET=WIN95 +elif test "$OS_ARCH" = "CYGWIN_95-4.0"; then + OS_ARCH='CYGWIN_NT-4.0' + OS_TARGET=WIN95 +elif test "$OS_ARCH" = "CYGWIN_98-4.10"; then + OS_ARCH='CYGWIN_NT-4.0' + OS_TARGET=WIN95 +elif test "$OS_ARCH" = "OS_2"; then + OS_ARCH=OS2 + OS_TARGET=OS2 +fi + +# +# On WIN32, we also define the variable CPU_ARCH. +# + +if test "$OS_ARCH" = "WINNT"; then + CPU_ARCH=`uname -p` + if test "$CPU_ARCH" = "I386"; then + CPU_ARCH=x86 + fi +elif test "$OS_ARCH" = "Windows_NT"; then +# +# If uname -s returns "Windows_NT", we assume that we are using +# the uname.exe in MKS toolkit. +# +# The -r option of MKS uname only returns the major version number. +# So we need to use its -v option to get the minor version number. +# Moreover, it doesn't have the -p option, so we need to use uname -m. +# + OS_ARCH=WINNT +# OS_MINOR_RELEASE=`uname -v` + if test "$OS_MINOR_RELEASE" = "00"; then + OS_MINOR_RELEASE=0 + fi + OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}" + CPU_ARCH=`uname -m` + # + # MKS's uname -m returns "586" on a Pentium machine. + # + if echo "$CPU_ARCH" | grep -c 86 >/dev/null; then + CPU_ARCH=x86 + fi +elif echo "$OS_ARCH" | grep -c CYGWIN_NT >/dev/null; then +# +# If uname -s returns "CYGWIN_NT-4.0", we assume that we are using +# the uname.exe in the Cygwin tools. +# + OS_RELEASE=`echo $OS_ARCH | sed 's|^CYGWIN_NT-||'` + OS_ARCH=WINNT + CPU_ARCH=`uname -m` + # + # Cygwin's uname -m returns "i686" on a Pentium Pro machine. + # + if echo "$CPU_ARCH" | grep -c 86 >/dev/null; then + CPU_ARCH=x86 + fi +elif test "$OS_ARCH" = "CYGWIN32_NT"; then +# +# Prior to the Beta 20 release, Cygwin was called GNU-Win32. +# If uname -s returns "CYGWIN32/NT", we assume that we are using +# the uname.exe in the GNU-Win32 tools. +# + OS_ARCH=WINNT + CPU_ARCH=`uname -m` + # + # GNU-Win32's uname -m returns "i686" on a Pentium Pro machine. + # + if echo "$CPU_ARCH" | grep -c 86 >/dev/null; then + CPU_ARCH=x86 + fi +fi + +if test -n "$MOZILLA_CLIENT" && test "$OS_ARCH" = "WINNT"; then + OS_TARGET=WIN95 + MOZ_WIN32_TARGET=WIN95 + if test -n "$MOZ_DEBUG"; then + USE_DEBUG_RTL=1 + fi +fi +if test -z "$OS_TARGET"; then + OS_TARGET=$OS_ARCH +fi +if test "$OS_TARGET" = "WIN95"; then + OS_RELEASE="4.0" +fi +if test "$OS_TARGET" = "WIN16"; then + OS_RELEASE= +fi +if test -z "$MOZ_WIN32_TARGET"; then + MOZ_WIN32_TARGET=$OS_TARGET +fi +OS_CONFIG="${OS_TARGET}${OS_RELEASE}" + + case "$host" in -*-mingw*) +*-mingw*|*-cygwin*|*-msvc*) ;; *-beos*) HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE" ;; +*os2*) + ;; *) HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX" ;; @@ -2427,7 +2643,9 @@ EOF MKSHLIB= DSO_LDOPTS= + USE_PTHREADS=1 AIX_LINK_OPTS='-bnso -berok' + LIBNSPR='-L$(dist_libdir) -lnspr$(MOD_MAJOR_VERSION)_shr' ;; aix4.3*) cat >> confdefs.h <<\EOF @@ -2451,6 +2669,7 @@ EOF EOF USE_IPV6=1 + USE_PTHREADS=1 AIX_LINK_OPTS='-brtl -bnso -berok' ;; *) @@ -2470,7 +2689,7 @@ EOF ;; esac CFLAGS="$CFLAGS -qro -qroconst" - if test `grep -c xlC_r $CC`; then + if echo "$CC" | grep -c xlC_r; then CFLAGS="$CFLAGS -qarch=com" fi AIX_WRAP='$(DIST)/lib/aixwrap.o' @@ -2485,6 +2704,7 @@ EOF fi fi PR_MD_CSRCS=aix.c + RESOLVE_LINK_SYMBOLS=1 ;; *-beos*) @@ -2505,64 +2725,209 @@ EOF EOF DSO_LDOPTS=-nostart - MKSHLIB='$(CCC) $(DSO_LDOPTS) -o $@' MDCPUCFG_H=_beos.cfg USE_BTHREADS=1 PR_MD_ARCH_DIR=beos RESOLVE_LINK_SYMBOLS=1 + case "${target_cpu}" in + i?86) + _OPTIMIZE_FLAGS=-O2 + _DEBUG_FLAGS='-gdwarf-2 -O0' + MKSHLIB='$(CCC) $(DSO_LDOPTS) -o $@' + ;; + powerpc) + CC=mwcc + CCC=mwcc + LD=mwld + DSO_LDOPTS='-xms -export pragma -init _init_routine_ -term _term_routine_ -lroot -lnet /boot/develop/lib/ppc/glue-noinit.a /boot/develop/lib/ppc/init_term_dyn.o /boot/develop/lib/ppc/start_dyn.o' + _OPTIMIZE_FLAGS=-O2 + _DEBUG_FLAGS='-g -O0' + ;; + esac ;; -*-dgux*) +*-bsdi*) cat >> confdefs.h <<\EOF #define XP_UNIX 1 EOF cat >> confdefs.h <<\EOF -#define _PR_LOCAL_THREADS_ONLY 1 +#define BSDI 1 EOF cat >> confdefs.h <<\EOF -#define SVR4 1 +#define NEED_BSDREGEX 1 EOF - cat >> confdefs.h <<\EOF -#define SYSV 1 + + CFLAGS="$CFLAGS -Wall -Wno-format" + CXXFLAGS="$CXXFLAGS -Wall -Wno-format" + + if echo "$OS_TEST" | grep -c 86 >/dev/null; then + CPU_ARCH=x86 + elif echo "$OS_TEST" | grep -c sparc >/dev/null; then + CPU_ARCH=sparc + fi + + MDCPUCFG_H=_bsdi.cfg + PR_MD_CSRCS=bsdi.c + + DSO_LDOPTS=-r + + case "$target_os" in + bsdi1.1*) + cat >> confdefs.h <<\EOF +#define _PR_BSDI_JMPBUF_IS_ARRAY 1 EOF - cat >> confdefs.h <<\EOF -#define DGUX 1 + cat >> confdefs.h <<\EOF +#define _PR_STAT_HAS_ONLY_ST_ATIME 1 EOF - cat >> confdefs.h <<\EOF -#define _DGUX_SOURCE 1 + cat >> confdefs.h <<\EOF +#define _PR_NEED_H_ERRNO 1 EOF - cat >> confdefs.h <<\EOF -#define _POSIX4A_DRAFT6_SOURCE 1 + MKSHLIB= + DSO_CFLAGS= + DSO_LDOPTS= + ;; + + bsdi2.1*) + cat >> confdefs.h <<\EOF +#define _PR_TIMESPEC_HAS_TS_SEC 1 EOF - MKSHLIB='$(LD) $(DSO_LDOPTS)' - DSO_LDOPTS=-G - NOSUCHFILE=/no-such-file - _OPTIMIZE_FLAGS=-O2 - _DEBUG_FLAGS= - MDCPUCFG_H=_dgux.cfg - PR_MD_CSRCS=dgux.c - ;; + cat >> confdefs.h <<\EOF +#define _PR_BSDI_JMPBUF_IS_ARRAY 1 +EOF -*-freebsd*) - if test "${target_cpu}" != "alpha"; then cat >> confdefs.h <<\EOF -#define i386 1 +#define HAVE_DLL 1 EOF - fi - cat >> confdefs.h <<\EOF -#define FREEBSD 1 + cat >> confdefs.h <<\EOF +#define USE_DLFCN 1 EOF - cat >> confdefs.h <<\EOF -#define HAVE_BSD_FLOCK 1 + cat >> confdefs.h <<\EOF +#define _PR_STAT_HAS_ST_ATIMESPEC 1 +EOF + + PR_MD_ASFILES=os_BSD_OS_386_2.s + ;; + + bsdi4.*) + cat >> confdefs.h <<\EOF +#define _PR_SELECT_CONST_TIMEVAL 1 +EOF + + cat >> confdefs.h <<\EOF +#define _PR_BSDI_JMPBUF_IS_STRUCT 1 +EOF + + cat >> confdefs.h <<\EOF +#define HAVE_DLL 1 +EOF + + cat >> confdefs.h <<\EOF +#define USE_DLFCN 1 +EOF + + cat >> confdefs.h <<\EOF +#define _PR_STAT_HAS_ST_ATIMESPEC 1 +EOF + + MKSHLIB='$(CC) -o $@ $(DSO_LDOPTS)' + DSO_CFLAGS=-fPIC + DSO_LDOPTS='-shared -Wl,-soname,$(@:$(OBJDIR)/%.so=%.so)' + STRIP="$STRIP -d" + case "$target_os" in + bsdi4.2*) + cat >> confdefs.h <<\EOF +#define _PR_HAVE_GETPROTO_R 1 +EOF + + cat >> confdefs.h <<\EOF +#define _PR_HAVE_GETPROTO_R_POINTER 1 +EOF + + ;; + esac + ;; + *) + cat >> confdefs.h <<\EOF +#define _PR_SELECT_CONST_TIMEVAL 1 +EOF + + cat >> confdefs.h <<\EOF +#define _PR_BSDI_JMPBUF_IS_STRUCT 1 +EOF + + cat >> confdefs.h <<\EOF +#define HAVE_DLL 1 +EOF + + cat >> confdefs.h <<\EOF +#define USE_DLFCN 1 +EOF + + cat >> confdefs.h <<\EOF +#define _PR_STAT_HAS_ST_ATIMESPEC 1 +EOF + + ;; + esac + + ;; + +*-dgux*) + cat >> confdefs.h <<\EOF +#define XP_UNIX 1 +EOF + + cat >> confdefs.h <<\EOF +#define _PR_LOCAL_THREADS_ONLY 1 +EOF + + cat >> confdefs.h <<\EOF +#define SVR4 1 +EOF + + cat >> confdefs.h <<\EOF +#define SYSV 1 +EOF + + cat >> confdefs.h <<\EOF +#define DGUX 1 +EOF + + cat >> confdefs.h <<\EOF +#define _DGUX_SOURCE 1 +EOF + + cat >> confdefs.h <<\EOF +#define _POSIX4A_DRAFT6_SOURCE 1 +EOF + + DSO_LDOPTS=-G + _OPTIMIZE_FLAGS=-O2 + _DEBUG_FLAGS= + MDCPUCFG_H=_dgux.cfg + PR_MD_CSRCS=dgux.c + ;; + +*-freebsd*) + cat >> confdefs.h <<\EOF +#define XP_UNIX 1 +EOF + + cat >> confdefs.h <<\EOF +#define FREEBSD 1 +EOF + + cat >> confdefs.h <<\EOF +#define HAVE_BSD_FLOCK 1 EOF CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall -pipe" @@ -2579,6 +2944,10 @@ EOF ;; *-hpux*) + cat >> confdefs.h <<\EOF +#define XP_UNIX 1 +EOF + cat >> confdefs.h <<\EOF #define HPUX 1 EOF @@ -2587,10 +2956,18 @@ EOF #define _HPUX_SOURCE 1 EOF - DEFINES="$DEFINES -D${target_cpu}" + cat >> confdefs.h <<\EOF +#define hppa 1 +EOF + + cat >> confdefs.h <<\EOF +#define hpux 1 +EOF + DLL_SUFFIX=sl DSO_LDOPTS='-b +h $(notdir $@)' PR_MD_CSRCS=hpux.c + PR_MD_ASFILES=os_HPUX.s if test -n "$USE_64"; then MDCPUCFG_H=_hpux64.cfg else @@ -2605,79 +2982,106 @@ EOF else DSO_CFLAGS=-fPIC fi + if test -n "$MOZILLA_CLIENT"; then - USE_NSPR_THREADS=1 + DEFAULT_IMPL_STRATEGY=_EMU fi - case "${target_os}" in - hpuxA.09*) + + if echo "$OS_RELEASE" | grep ^A.09 >/dev/null; then cat >> confdefs.h <<\EOF -#define HPUX9 1 +#define _PR_NEED_H_ERRNO 1 EOF cat >> confdefs.h <<\EOF -#define _PR_NEED_H_ERRNO 1 +#define HPUX9 1 EOF + DEFAULT_IMPL_STRATEGY=_EMU + USE_NSPR_THREADS=1 + fi + + if echo "$OS_RELEASE" | egrep '^(A.09|B.10)' >/dev/null; then cat >> confdefs.h <<\EOF #define _PR_NO_LARGE_FILES 1 EOF - ;; - hpuxB.10.01*) + fi + + if echo "$OS_RELEASE" | egrep '^(B.10.10|B.10.20)' >/dev/null; then cat >> confdefs.h <<\EOF -#define HPUX10 1 +#define _PR_NEED_H_ERRNO 1 EOF - ;; - hpuxB.10.10*) + fi + + if echo "$OS_RELEASE" | egrep '^(B.10.10|B.10.20)' >/dev/null; then cat >> confdefs.h <<\EOF -#define HPUX10 1 +#define HAVE_INT_LOCALTIME_R 1 EOF + fi + + if echo "$OS_RELEASE" | egrep '^(B.10.30|B.11.00)' >/dev/null; then cat >> confdefs.h <<\EOF -#define HPUX10_10 1 +#define HAVE_POINTER_LOCALTIME_R 1 EOF + fi + + if test "$OS_RELEASE" = "B.10.01"; then cat >> confdefs.h <<\EOF -#define HAVE_INT_LOCALTIME_R 1 +#define HPUX10 1 EOF - USE_PTHREADS=1 - USE_NSPR_THREADS= - ;; - hpuxB.10.20*) + DEFAULT_IMPL_STRATEGY=_EMU + fi + + if test "$OS_RELEASE" = "B.10.10"; then cat >> confdefs.h <<\EOF #define HPUX10 1 EOF cat >> confdefs.h <<\EOF -#define HPUX10_20 1 +#define HPUX10_10 1 EOF + DEFAULT_IMPL_STRATEGY=_PTH + fi + + if test "$OS_RELEASE" = "B.10.20"; then cat >> confdefs.h <<\EOF -#define HAVE_INT_LOCALTIME_R 1 +#define HPUX10 1 EOF - if test -z "$GNU_CC"; then + cat >> confdefs.h <<\EOF +#define HPUX10_20 1 +EOF + + if test -z "$GNU_CC" && test 0 = 1; then CFLAGS="$CFLAGS +DAportable +DS1.1" CXXFLAGS="$CXXFLAGS +DAportable +DS1.1" fi - USE_PTHREADS=1 - USE_NSPR_THREADS= - ;; - hpuxB.10.30*) + DEFAULT_IMPL_STRATEGY=_EMU + fi + + if test "$OS_RELEASE" = "B.10.30"; then cat >> confdefs.h <<\EOF -#define HAVE_POINTER_LOCALTIME_R 1 +#define HPUX10 1 EOF - if test -z "$GNU_CC"; then + cat >> confdefs.h <<\EOF +#define HPUX10_30 1 +EOF + + #CXX="/opt/aCC/bin/aCC -ext" + if test -z "$GNU_CC" && test 0 = 1; then CFLAGS="$CFLAGS +DAportable +DS1.1" CXXFLAGS="$CXXFLAGS +DAportable +DS1.1" fi - USE_PTHREADS=1 - USE_NSPR_THREADS= - ;; - hpuxB.11.00*) + DEFAULT_IMPL_STRATEGY=_PTH + fi + + if test "$OS_RELEASE" = "B.11.00"; then cat >> confdefs.h <<\EOF #define HPUX10 1 EOF @@ -2699,6 +3103,7 @@ EOF EOF if test -z "$GNU_CC"; then + if test 0 = 1; then if test -z "$USE_64"; then CFLAGS="$CFLAGS +DAportable +DS2.0" CXXFLAGS="$CXXFLAGS +DAportable +DS2.0" @@ -2706,24 +3111,23 @@ EOF CFLAGS="$CFLAGS +DA2.0W +DS2.0" CXXFLAGS="$CXXFLAGS +DA2.0W +DS2.0" fi + fi fi - USE_PTHREADS=1 - USE_NSPR_THREADS= - ;; - esac - case "${target_os}" in - hpuxB.10*) - cat >> confdefs.h <<\EOF -#define _PR_NO_LARGE_FILES 1 -EOF - - ;; - esac - if test -n "$USE_NSPR_THREADS"; then - cat >> confdefs.h <<\EOF -#define _PR_LOCAL_THREADS_ONLY 1 -EOF + DEFAULT_IMPL_STRATEGY=_PTH + fi + if test "$DEFAULT_IMPL_STRATEGY" = "_EMU"; then + USE_NSPR_THREADS=1 + USE_PTHREADS= + USE_USER_THREADS= + elif test "$DEFAULT_IMPL_STRATEGY" = "_PTH"; then + USE_PTHREADS=1 + if test "$MOZILLA_CLIENT"; then + USE_PTHREADS= + fi + if test "$USE_USER_PTHREADS"; then + USE_PTHREADS= + fi fi ;; @@ -2746,19 +3150,30 @@ EOF PR_MD_CSRCS=irix.c PR_MD_ASFILES=os_Irix.s - MKSHLIB='$(LD) $(SHLIB_LD_OPTS) -rdata_shared -shared -soname $(notdir $@) -o $@' - DSO_LDOPTS='-elf -shared -all' + MKSHLIB='$(LD) $(DSO_LDOPTS) -rdata_shared -shared -soname $(notdir $@) -o $@' + #DSO_LDOPTS='-elf -shared -all' + STRIP="$STRIP -f" if test -n "$USE_64"; then MDCPUCFG_H=_irix64.cfg else MDCPUCFG_H=_irix32.cfg fi case "${target_os}" in + irix6*) + cat >> confdefs.h <<\EOF +#define IRIX6 1 +EOF + + USE_PTHREADS=1 + ;; irix5*) + cat >> confdefs.h <<\EOF +#define IRIX5 1 +EOF + USE_NSPR_THREADS=1 ;; *) - USE_N32=1 USE_PTHREADS=1 ;; esac @@ -2767,7 +3182,11 @@ EOF CFLAGS="$CFLAGS -Wall -Wno-format" _OPTIMIZE_FLAGS="-O6" else - AS="as -D_ASM $(INCLUDES) -n32" + if test -n "$USE_N32"; then + AS='as -D_ASM $(INCLUDES) -n32' + else + AS='as -D_ASM $(INCLUDES)' + fi CFLAGS="$CFLAGS -fullwarn -xansi" if test "$USE_N32"; then _OPTIMIZE_FLAGS="-O -OPT:Olimit=4000" @@ -2780,14 +3199,14 @@ EOF case "$target}" in *-irix6.*) CFLAGS="$CFLAGS -multigot" - SHLIB_LD_OPTS="-no_unresolved" - if test "USE_N32"; then + DSO_LDOPTS="-no_unresolved" + if test "$USE_N32"; then CFLAGS="$CFLAGS -n32 -woff 1209" LDFLAGS="$LDFLAGS -n32" - SHLIB_LD_OPTS="$SHLIB_LD_OPTS -n32" + DSO_LDOPTS="$DSO_LDOPTS -n32" if test "${target_os}" = "irix6.2"; then LDFLAGS="$LDFLAGS -Wl,-woff,85" - SHLIB_LD_OPTS="$SHLIB_LD_OPTS -woff 85" + DSO_LDOPTS="$DSO_LDOPTS -woff 85" fi else if test "$USE_64"; then @@ -2877,6 +3296,7 @@ EOF MKSHLIB='$(LD) $(DSO_LDOPTS) -soname $(notdir $@) -o $@' DSO_CFLAGS=-fPIC DSO_LDOPTS=-shared + OS_LIBS="$OS_LIBS -lc" case "${target_cpu}" in alpha) cat >> confdefs.h <<\EOF @@ -2891,6 +3311,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" @@ -2902,55 +3326,155 @@ EOF esac ;; -*-mingw*) +*-mingw*|*-cygwin*|*-msvc*) cat >> confdefs.h <<\EOF #define XP_PC 1 EOF cat >> confdefs.h <<\EOF -#define NONAMELESSUNION 1 +#define WIN32 1 EOF PR_MD_ARCH_DIR=windows - if test -z "$GNU_CC"; then + RESOLVE_LINK_SYMBOLS=1 + + if test -n "$GNU_CC"; then + cat >> confdefs.h <<\EOF +#define NONAMELESSUNION 1 +EOF + + MKSHLIB='$(DLLTOOL) --as=$(AS) -k --dllname $*.dll --output-lib $@' + else + CC=cl + CXX=cl + LD=link + AR='lib -NOLOGO -OUT:"$@"' + AR_FLAGS= + RANLIB='echo not_ranlib' + STRIP='echo not_strip' + NSINSTALL=nsinstall + RC=rc.exe + GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb' OBJ_SUFFIX=obj LIB_SUFFIX=lib DLL_SUFFIX=dll + + CFLAGS="$CFLAGS -W3 -nologo -GF -Gy" + _DEBUG_FLAGS= + + if test -n "$MOZ_OPTIMIZE"; then + CFLAGS="$CFLAGS -MD" + OPTIMIZER=-O2 + DLLFLAGS='-OUT:"$@"' + OBJDIR_TAG=_OPT + + if test -n "$MOZ_PROFILE"; then + OPTIMIZER="$OPTIMIZER -Z7" + DLLFLAGS="$DLLFLAGS -DEBUG -DEBUGTYPE:CV" + LDFLAGS="$LDFLAGS -DEBUG -DEBUGTYPE:CV" + fi + else + if test -n "$USE_DEBUG_RTL"; then + CFLAGS="$CFLAGS -MDd" + else + CFLAGS="$CFLAGS -MD" + fi + OPTIMIZER="-Od -Z7" + DLLFLAGS='-DEBUG -DEBUGTYPE:CV -OUT:"$@"' + if test -n "$GLOWCODE"; then + DLLFLAGS='-DEBUG -DEBUGTYPE:both -INCLUDE:_GlowCode -OUT:"$@"' + DLL_LIBS='$(GLOWDIR)/glowcode.lib' + fi + OBJDIR_TAG=_DBG + LDFLAGS="$LDFLAGS -DEBUG -DEBUGTYPE:CV" + if test -n "$PROFILE"; then + LDFLAGS="$LDFLAGS -PROFILE -MAP" + DLLFLAGS="$DLLFLAGS -PROFILE -MAP" + fi + fi + + if test "$OS_TARGET" = "WINNT"; then + CFLAGS="$CFLAGS -GT" + LIBNSPR='$(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)' + LIBPLC='$(dist_libdir)/libplc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)' + else + LIBNSPR='$(dist_libdir)/nspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)' + LIBPLC='$(dist_libdir)/plc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)' + fi + fi # GNU_CC + + if test -n "$USE_STATIC_TLS"; then + cat >> confdefs.h <<\EOF +#define _PR_USE_STATIC_TLS 1 +EOF + + fi + + if test "$OS_TARGET" = "WINNT"; then + if test "$CPU_ARCH" = "x86"; then + CFLAGS="$CFLAGS -G5" + fi + cat >> confdefs.h <<\EOF +#define WINNT 1 +EOF + + else + cat >> confdefs.h <<\EOF +#define WIN95 1 +EOF + + cat >> confdefs.h <<\EOF +#define _PR_GLOBAL_THREADS_ONLY 1 +EOF + + fi + + if test "$CPU_ARCH" = "x86"; then + CPU_ARCH_TAG= + else + CPU_ARCH_TAG=$CPU_ARCH fi - MKSHLIB='$(DLLTOOL) --as=$(AS) -k --dllname $*.dll --output-lib $@' - case "$MOZ_TARGET" in + if test -n "$USE_DEBUG_RTL"; then + OBJDIR_SUFFIX=OBJD + else + OBJDIR_SUFFIX=OBJ + fi + + OBJDIR_NAME="${OS_CONFIG}${CPU_ARCH_TAG}${OBJDIR_TAG}.${OBJDIR_SUFFIX}" + OBJDIR='${OBJDIR_NAME}' + + OS_DLLFLAGS='-nologo -DLL -SUBSYSTEM:WINDOWS -PDB:NONE' + + case "$MOZ_WIN32_TARGET" in WINNT) - DEFINES="$DEFINES -DWIN32 -DWINNT -DWin32_Winsock" MDCPUCFG_H=_winnt.cfg ;; WIN95) - DEFINES="$DEFINES -UWINNT -DWIN32 -DWIN95 -DWin32_Winsock -D_PR_GLOBAL_THREADS_ONLY" MDCPUCFG_H=_win95.cfg ;; WIN16) - DEFINES="$DEFINES -UWINNT" MDCPUCFG_H=_win16.cfg ;; *) - { echo "configure: error: Missing MOZ_TARGET for ${target}. Use --enable-target to set." 1>&2; exit 1; } + { echo "configure: error: Missing MOZ_WIN32_TARGET for ${target}. Use --enable-win32-target to set." 1>&2; exit 1; } ;; esac - case "$target" in - i?86-*) + case "$target_cpu" in + i?86) cat >> confdefs.h <<\EOF #define _X86_ 1 EOF ;; - alpha-*) + alpha) cat >> confdefs.h <<\EOF #define _ALPHA_ 1 EOF ;; - mips-*) + mips) cat >> confdefs.h <<\EOF #define _MIPS_ 1 EOF @@ -2963,36 +3487,503 @@ EOF ;; esac + ;; -*-nto*) +*-ncr-sysv*) cat >> confdefs.h <<\EOF #define XP_UNIX 1 EOF - MDCPUCFG_H=_nto.cfg - PR_MD_CSRCS=nto.c - MKSHLIB='qcc -Vgcc_ntox86 -shared -Wl,-h$(@:$(OBJDIR)/%.so=%.so) -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" - COMPILER_TAG="_qcc" - CC="qcc -Vgcc_ntox86 -w" - CXX="QCC -Vgcc_ntox86 -w" - CPP="qcc -Vgcc_ntox86 -w" - LD="qcc -Vgcc_ntox86 -nostdlib" - AR="qcc -Vgcc_ntox86 -M -a " - AR_FLAGS="$@" - ;; - -*-solaris*) cat >> confdefs.h <<\EOF -#define XP_UNIX 1 +#define SVR4 1 EOF cat >> confdefs.h <<\EOF -#define SVR4 1 +#define SYSV 1 +EOF + + cat >> confdefs.h <<\EOF +#define NCR 1 +EOF + + USE_NSPR_THREADS=1 + if test "$OS_RELEASE" = "2.03"; then + cat >> confdefs.h <<\EOF +#define _PR_STAT_HAS_ST_ATIM 1 +EOF + + else + cat >> confdefs.h <<\EOF +#define _PR_STAT_HAS_ST_ATIM_UNION 1 +EOF + + fi + + if test -z "$GNU_CC"; then + CFLAGS="$CFLAGS -Hnocopyr" + CXXFLAGS="$CXXFLAGS -Hnocopyr" + else + CFLAGS="$CFLAGS -fPIC -Wall -pipe" + CXXFLAGS="$CXXFLAGS -fPIC -Wall -pipe" + DSO_LDOPTS=-G + fi + MDCPUCFG_H=_ncr.cfg + PR_MD_CSRCS=ncr.c + ;; + +mips-nec-sysv*) + cat >> confdefs.h <<\EOF +#define XP_UNIX 1 +EOF + + cat >> confdefs.h <<\EOF +#define SVR4 1 +EOF + + cat >> confdefs.h <<\EOF +#define __SVR4 1 +EOF + + cat >> confdefs.h <<\EOF +#define NEC 1 +EOF + + cat >> confdefs.h <<\EOF +#define nec_ews 1 +EOF + + USE_NSPR_THREADS=1 + if test -z "$GNU_CC"; then + CC='$(NSDEPTH)/build/hcc cc -Xa -KGnum=0 -KOlimit=4000' + CXX=g++ + fi + OS_LIBS="$OS_LIBS -lsocket -lnsl -ldl" + DSO_LDOPTS=-G + MDCPUCFG_H=_nec.cfg + PR_MD_CSRCS=nec.c + ;; + +*-netbsd*) + cat >> confdefs.h <<\EOF +#define XP_UNIX 1 +EOF + + cat >> confdefs.h <<\EOF +#define NETBSD 1 +EOF + + cat >> confdefs.h <<\EOF +#define HAVE_BSD_FLOCK 1 +EOF + + if test -z "$OBJECT_FMT"; then + if echo __ELF__ | ${CC-cc} -E - | grep -q __ELF__ 2>/dev/null; then + OBJECT_FMT=a.out; + else + OBJECT_FMT=ELF + fi + fi + if test "$OBJECT_FMT" = "ELF"; then + DLL_SUFFIX=so + else + DLL_SUFFIX=so.1.0 + fi + CFLAGS="$CFLAGS -ansi -Wall -pipe" + CXXFLAGS="$CXXFLAGS -ansi -Wall -pipe" + DSO_CFLAGS='-fPIC -DPIC' + DSO_LDOPTS='-x -shared' + if test "$LIBRUNPATH"; then + DSO_LDOPTS="$DSO_LDOPTS -R$(LIBRUNPATH)" + fi + MDCPUCFG_H=_netbsd.cfg + PR_MD_CSRCS=netbsd.c + ;; + +mips-sony-newsos*) + cat >> confdefs.h <<\EOF +#define XP_UNIX 1 +EOF + + cat >> confdefs.h <<\EOF +#define SONY 1 +EOF + + cat >> confdefs.h <<\EOF +#define SYSV 1 +EOF + + cat >> confdefs.h <<\EOF +#define SVR4 1 +EOF + + cat >> confdefs.h <<\EOF +#define __svr4 1 +EOF + + cat >> confdefs.h <<\EOF +#define __svr4__ 1 +EOF + + cat >> confdefs.h <<\EOF +#define HAVE_SVID_GETTOD 1 +EOF + + USE_NSPR_THREADS=1 + CFLAGS="$CFLAGS -Xa -fullwarn" + CXXFLAGS="$CXXFLAGS -Xa -fullwarn" + DSO_LDOPTS=-G + MDCPUCFG_H=_sony.cfg + PR_MD_CSRCS=sony.c + ;; + +*-nextstep*|*-openstep*) + cat >> confdefs.h <<\EOF +#define XP_UNIX 1 +EOF + + cat >> confdefs.h <<\EOF +#define NEXTSTEP 1 +EOF + + cat >> confdefs.h <<\EOF +#define HAVE_BSD_FLOCK 1 +EOF + + cat >> confdefs.h <<\EOF +#define _POSIX_SOURCE 1 +EOF + + CFLAGS="$CFLAGS -Wall -fno-common -pipe -traditional-cpp -posix" + CXXFLAGS="$CXXFLAGS -Wall -fno-common -pipe -traditional-cpp -posix" + USE_NSPR_THREADS=1 + DLL_SUFFIX=dylib + MDCPUCFG_H=_nextstep.cfg + PR_MD_CSRCS=nextstep.c + ;; + + +*-nto*) + cat >> confdefs.h <<\EOF +#define XP_UNIX 1 +EOF + + cat >> confdefs.h <<\EOF +#define NTO 1 +EOF + + cat >> confdefs.h <<\EOF +#define _QNX_SOURCE 1 +EOF + + cat >> confdefs.h <<\EOF +#define HAVE_POINTER_LOCALTIME_R 1 +EOF + + MDCPUCFG_H=_nto.cfg + PR_MD_CSRCS=nto.c + MKSHLIB='qcc -Vgcc_ntox86 -shared -Wl,-h$(@:$(OBJDIR)/%.so=%.so) -M -o $(@:$(OBJDIR)/%.so=%.so)' + CFLAGS="$CFLAGS -Wc,-Wall -Wc,-Wno-parentheses -shared" + OS_LIBS="$OS_LIBS -lsocket" + _OPTIMIZE_FLAGS="-O1" + _DEBUG_FLAGS="-O1 -gstabs" + COMPILER_TAG="_qcc" + CC="qcc -Vgcc_ntox86 -w" + CXX='$(CC)' + LD="qcc -Vgcc_ntox86 -nostdlib" + AR="qcc -Vgcc_ntox86 -M -a $@" + AR_FLAGS= + ;; + +*-openbsd*) + cat >> confdefs.h <<\EOF +#define XP_UNIX 1 +EOF + + cat >> confdefs.h <<\EOF +#define OPENBSD 1 +EOF + + cat >> confdefs.h <<\EOF +#define HAVE_BSD_FLOCK 1 +EOF + + CFLAGS="$CFLAGS -ansi -Wall -pipe" + CXXFLAGS="$CXXFLAGS -ansi -Wall -pipe" + DLL_SUFFIX=so.1.0 + DSO_CFLAGS=-fPIC + MDCPUCFG_H=_openbsd.cfg + PR_MD_CSRCS=openbsd.c + USE_NSPR_THREADS=1 + case "$OS_TEST" in + alpha|mips|pmax) + DSO_LDOPTS=-shared ;; + *) + DSO_LDOPTS=-Bshareable ;; + esac + ;; + +*-openvms*) + cat >> confdefs.h <<\EOF +#define XP_UNIX 1 +EOF + + cat >> confdefs.h <<\EOF +#define VMS 1 +EOF + + cat >> confdefs.h <<\EOF +#define VMS_AS_IS 1 +EOF + + cat >> confdefs.h <<\EOF +#define GENERIC_PTHREAD_REDEFINES 1 +EOF + + RESOLVE_LINK_SYMBOLS=1 + CROSS_COMPILE=1 + _HAVE_PTHREADS=1 + HOST_CC=c89 + HOST_CXX=cxx + HOST_CFLAGS=-O + HOST_CXXFLAGS=-O + CC=ccc + CXX=ccc + CFLAGS="$CFLAGS -Wc,names=\(short,as\)" + CXXFLAGS="$CXXFLAGS -Wc,names=\(short,as\)" + MDCPUCFG_H=_openvms.cfg + PR_MD_CSRCS=openvms.c + MKSHLIB='vmsld $(OPTIMIZER)' + ;; + +*-osf*) + cat >> confdefs.h <<\EOF +#define XP_UNIX 1 +EOF + + cat >> confdefs.h <<\EOF +#define OSF1 1 +EOF + + + if echo "$OS_RELEASE" | egrep -c '(V2.0|V3.2)' 2>/dev/null ; then + USE_NSPR_THREADS=1 + fi + + if test -z "$GNU_CC"; then + CC="$CC -std1 -ieee_with_inexact" + if test "$OS_RELEASE" = "V2.0"; then + CC="$CC -readonly_strings" + fi + _OPTIMIZE_FLAGS='-Olimit 4000' + fi + + if echo $OS_RELEASE | egrep -c '(V2.0|V3.2)' 2>/dev/null; then + cat >> confdefs.h <<\EOF +#define HAVE_INT_LOCALTIME_R 1 +EOF + + else + cat >> confdefs.h <<\EOF +#define HAVE_POINTER_LOCALTIME_R 1 +EOF + + cat >> confdefs.h <<\EOF +#define OSF1_HAVE_MACHINE_BUILTINS_H 1 +EOF + + fi + DSO_LDOPTS='-shared -all -expect_unresolved "*" -soname $(notdir $@)' + MDCPUCFG_H=_osf1.cfg + PR_MD_CSRCS=osf1.c + ;; + +*-qnx*) + cat >> confdefs.h <<\EOF +#define XP_UNIX 1 +EOF + + cat >> confdefs.h <<\EOF +#define QNX 1 +EOF + + cat >> confdefs.h <<\EOF +#define _PR_NEED_H_ERRNO 1 +EOF + + USE_NSPR_THREADS=1 + MDCPUCFG_H=_qnx.cfg + PR_MD_CSRCS=qnx.c + ;; + +*-rhapsody*) + cat >> confdefs.h <<\EOF +#define XP_UNIX 1 +EOF + + cat >> confdefs.h <<\EOF +#define RHAPSODY 1 +EOF + + cat >> confdefs.h <<\EOF +#define HAVE_BSD_FLOCK 1 +EOF + + CFLAGS="$CFLAGS -Wmost -fno-common -pipe" + if echo $OS_TEST | grep -c 86 2>/dev/null; then + CFLAGS="$CFLAGS -mno-486" + cat >> confdefs.h <<\EOF +#define i386 1 +EOF + + CPU_ARCH=i386 + else + cat >> confdefs.h <<\EOF +#define ppc 1 +EOF + + CPU_ARCH=ppc + fi + DSO_LDOPTS='-dynamiclib -compatibility_version 1 -current_version 1 -all_load' + MKSHLIB='$(CC) -arch $(CPU_ARCH) $(DSO_LDOPTS) -o $@' + DLL_SUFFIX=dylib + USE_PTHREADS=1 + MDCPUCFG_H=_rhapsody.cfg + PR_MD_CSRCS=rhapsody.c + ;; + +*-*-sco*) + cat >> confdefs.h <<\EOF +#define XP_UNIX 1 +EOF + + cat >> confdefs.h <<\EOF +#define SCO 1 +EOF + + cat >> confdefs.h <<\EOF +#define sco 1 +EOF + + cat >> confdefs.h <<\EOF +#define SYSV 1 +EOF + + cat >> confdefs.h <<\EOF +#define _SVID3 1 +EOF + + cat >> confdefs.h <<\EOF +#define _PR_NEED_H_ERRNO 1 +EOF + + CC='cc -b elf -KPIC' + CXX='$(NSDEPTH)/build/hcpp CC +.cpp +w' + USE_NSPR_THREADS=1 + CPU_ARCH=x86 + DSO_LDOPTS='-b elf -G' + MDCPUCFG_H=_scoos.cfg + PR_MD_SRCS=scoos.c + ;; + +*-sinix*) + cat >> confdefs.h <<\EOF +#define XP_UNIX 1 +EOF + + cat >> confdefs.h <<\EOF +#define SVR4 1 +EOF + + cat >> confdefs.h <<\EOF +#define SNI 1 +EOF + + cat >> confdefs.h <<\EOF +#define RELIANTUNIX 1 +EOF + + cat >> confdefs.h <<\EOF +#define sinix 1 +EOF + + cat >> confdefs.h <<\EOF +#define HAVE_SVID_GETTOD 1 +EOF + + if echo "$OS_TEST" | grep -c 86 2>/dev/null; then + cat >> confdefs.h <<\EOF +#define i386 1 +EOF + + CPU_ARCH=x86 + else + CPU_ARCH=mips + fi + + if test "$GNU_CC"; then + AS='$(CC) -x assembler-with-cpp' + if test "$CPU_ARCH" = "mips"; then + LD=gld + CFLAGS="$CFLAGS -pipe" + fi + CFLAGS="$CFLAGS -Wall -Wno-format" + else + AS='/usr/bin/cc' + _OPTIMIZE_FLAGS='-O -F Olimit,4000' + fi + + DSO_LDOPTS='-G -z defs -h $(@:$(OBJDIR)/%.so=%.so)' + + if test "$OS_RELEASE" = "5.43"; then + cat >> confdefs.h <<\EOF +#define IP_MULTICAST 1 +EOF + + fi + + OS_LIBS="$OS_LIBS -lsocket -lnsl -lresolv -ldl -lc" + USE_NSPR_THREADS=1 + MDCPUCFG_H=_reliantunix.cfg + PR_MD_CSRCS=reliantunix.c + if test "${OS_ARCH}" = "mips"; then + PR_MD_ASFILES=os_ReliantUNIX.s + fi + ;; + +*-sunos*) + cat >> confdefs.h <<\EOF +#define XP_UNIX 1 +EOF + + cat >> confdefs.h <<\EOF +#define SUNOS4 1 +EOF + + CFLAGS="$CFLAGS -Wall -Wno-format" + if test "$USE_MDUPDATE"; then + CFLAGS="$CFLAGS -MDupdate \$(DEPENDENCIES)" + fi + CPU_ARCH=sparc + DLL_SUFFIX=so.1.0 + DSO_LDOPTS= + DSO_CFLAGS=-fPIC + USE_NSPR_THREADS=1 + if test "$OS_RELEASE" = "4.1.3_U1"; then + _OPTIMIZE_FLAGS= + OS_LIBS="$OS_LIBS -lm" + fi + MDCPUCFG_H=_sunos4.cfg + PR_MD_CSRCS=sunos4.c + ;; + +*-solaris*) + cat >> confdefs.h <<\EOF +#define XP_UNIX 1 +EOF + + cat >> confdefs.h <<\EOF +#define SVR4 1 EOF cat >> confdefs.h <<\EOF @@ -3027,11 +4018,10 @@ EOF if test -z "$GNU_AS"; then ASFLAGS="$ASFLAGS -Wa,-P" fi - NOSUCHFILE=/no-such-file if test -n "$GNU_CC"; then if test -n "$USE_MDUPDATE"; then - CFLAGS="$CFLAGS -MDupdate" - CXXFLAGS="$CXXFLAGS -MDupdate" + CFLAGS="$CFLAGS -MDupdate \$(DEPENDENCIES)" + CXXFLAGS="$CXXFLAGS -MDupdate \$(DEPENDENCIES)" fi else CC="$CC -xstrconst" @@ -3045,7 +4035,7 @@ EOF CC="$CC -xarch=v9" CXX="$CXX -xarch=v9" fi - if test "${target_cpu}" = "i386"; then + if test "$OS_TEST" = "i86pc"; then cat >> confdefs.h <<\EOF #define i386 1 EOF @@ -3081,39 +4071,283 @@ EOF #define _PR_HAVE_OFF64_T 1 EOF - if test -n "$GNU_CC"; then - cat >> confdefs.h <<\EOF -#define _LARGEFILE64_SOURCE 1 + if test -n "$GNU_CC"; then + cat >> confdefs.h <<\EOF +#define _LARGEFILE64_SOURCE 1 +EOF + + fi + ;; + esac + if test "$OS_TEST" = "sun4u"; then + ULTRASPARC_LIBRARY=ultrasparc + ULTRASPARC_FILTER_LIBRARY=libatomic.so + DSO_LDOPTS="$DSO_LDOPTS -f "'$(ULTRASPARC_FILTER_LIBRARY)' + fi + ;; + +*-sco-sysv5*) + cat >> confdefs.h <<\EOF +#define XP_UNIX 1 +EOF + + cat >> confdefs.h <<\EOF +#define UNIXWARE 1 +EOF + + cat >> confdefs.h <<\EOF +#define SVR4 1 +EOF + + cat >> confdefs.h <<\EOF +#define SYSV 1 +EOF + + USE_NSPR_THREADS=1 + if echo $OS_RELEASE | grep -c 2.1 2>/dev/null; then + cat >> confdefs.h <<\EOF +#define _PR_NO_LARGE_FILES 1 +EOF + + CC='$(NSDEPTH)/build/hcc cc' + CXX='$(NSDEPTH)/build/hcpp CC' + MDCPUCFG_H=_unixware.cfg + else + cat >> confdefs.h <<\EOF +#define _LARGEFILE64_SOURCE 1 +EOF + + cat >> confdefs.h <<\EOF +#define _PR_HAVE_OFF64_T 1 +EOF + + cat >> confdefs.h <<\EOF +#define _PR_HAVE_SOCKADDR_LEN 1 +EOF + + MDCPUCFG_H=_unixware7.cfg + fi + PR_MD_CSRCS=unixware.c + DSO_LDOPTS=-G + CPU_ARCH=x86 + ;; + +*-os2*) + cat >> confdefs.h <<\EOF +#define XP_OS2 1 +EOF + + cat >> confdefs.h <<\EOF +#define BSD_SELECT 1 +EOF + + cat >> confdefs.h <<\EOF +#define XP_PC 1 +EOF + + cat >> confdefs.h <<\EOF +#define _PR_GLOBAL_THREADS_ONLY 1 +EOF + + OBJ_SUFFIX=obj + LIB_SUFFIX=lib + DLL_SUFFIX=dll + DLLTOOL='' + RC=rc.exe + PR_MD_ARCH_DIR=os2 + PROG_SUFFIX=.exe + NSINSTALL=nsinstall + MDCPUCFG_H=_os2.cfg + RESOLVE_LINK_SYMBOLS=1 + + case "$target" in + *-os2_emx) + cat >> confdefs.h <<\EOF +#define XP_OS2_EMX 1 +EOF + + cat >> confdefs.h <<\EOF +#define OS2 1 +EOF + + AR=emxomfar + AR_FLAGS='-p256 r $@' + CFLAGS="-Zmtd -Zomf" + HOST_CFLAGS="$CFLAGS" + CXXFLAGS="-Zmtd -Zomf" + OS_LIBS="-lsocket -lemxio" + LD='$(CC)' + IMPLIB='emximp -o' + FILTER='emxexp' + OS_DLLFLAGS='$(DSO_LDOPTS) -o $@' + _OPTIMIZE_FLAGS=-O3 + _DEBUG_FLAGS=-g + if test -n "$MOZ_DEBUG"; then + DLLFLAGS='-g' + EXEFLAGS='-g $(OMF_FLAG) -Zmtd -L$(DIST)/lib -o $@' + DSO_LDOPTS='-g -Zomf -Zdll -Zmt -Zcrtdll -Zlinker /NOO' + else + DLLFLAGS= + EXEFLAGS='-Zmtd -o $@' + DSO_LDOPTS='-Zomf -Zdll -Zmt -Zcrtdll -Zlinker /NOO' + fi + ;; + *-os2_vacpp) + cat >> confdefs.h <<\EOF +#define XP_OS2_VACPP 1 +EOF + + cat >> confdefs.h <<\EOF +#define OS2 4 +EOF + + cat >> confdefs.h <<\EOF +#define TCPV40HDRS 1 +EOF + + cat >> confdefs.h <<\EOF +#define _X86_ 1 +EOF + + AR=-ilib + AR_FLAGS='/NOL /NOI /O:$(subst /,\\,$@)' + CFLAGS='/Q /qlibansi /Gd+ /Gm+ /Su4 /Mp /Tl-' + HOST_CFLAGS="$CFLAGS" + OS_CFLAGS='/Q /qlibansi /Gd+ /Gm+ /Su4 /Ge- /Tl-' + OS_EXE_CFLAGS='/Q /qlibansi /Gd+ /Gm+ /Su4 /Ge+ /Tl-' + CXXFLAGS='/Q /qlibansi /Gd+ /Gm+ /Su4 /Mp /Tl-' + OS_LIBS='so32dll.lib tcp32dll.lib' + LD='-ilink' + LDFLAGS='/FREE /DE /NOE /LINENUMBERS /nologo' + MKSHLIB='$(LD) $(DSO_LDOPTS)' + IMPLIB='implib -nologo -noignorecase' + FILTER='cppfilt -q -B -P' + _OPTIMIZE_FLAGS=/O+ + _DEBUG_FLAGS=/Ti+ + if test -n "$MOZ_DEBUG"; then + DLLFLAGS='/O:$@ /DLL /INC:_dllentry /MAP:$(@:.dll=.map) /nologo /DEBUG /NOE' + EXEFLAGS='/OUT:$@ /PMTYPE:VIO /MAP:$(@:.exe=.map) /nologo /DEBUG /NOE' + else + DLLFLAGS='/O:$@ /DLL /INC:_dllentry /MAP:$(@:.dll=.map) /nologo' + EXEFLAGS='/OUT:$@ /PMTYPE:VIO /MAP:$(@:.exe=.map) /nologo' + fi + LIBNSPR='$(dist_libdir)/nspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)' + LIBPLC='$(dist_libdir)/plc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)' + ;; + esac + + ;; + +*) + cat >> confdefs.h <<\EOF +#define XP_UNIX 1 +EOF + + ;; + +esac + +if test "$enable_shared" = no; then + MKSHLIB= +fi + +if test -z "$SKIP_LIBRARY_CHECKS"; then + +echo $ac_n "checking for dlopen""... $ac_c" 1>&6 +echo "configure:4258: 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 < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_dlopen) || defined (__stub___dlopen) +choke me +#else +dlopen(); +#endif + +; return 0; } +EOF +if { (eval echo configure:4286: \"$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 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_dlopen=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 + + echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 +echo "configure:4305: 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 +else + ac_save_LIBS="$LIBS" +LIBS="-ldl $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" - fi - ;; - esac - if test "${target_cpu}" = "sun4u"; then - ULTRASPARC_LIBRARY=ultrasparc - ULTRASPARC_FILTER_LIBRARY=libatomic.so - DSO_LDOPTS="$DSO_LDOPTS -f "'$(ULTRASPARC_FILTER_LIBRARY)' - fi - ;; - -*) - cat >> confdefs.h <<\EOF -#define XP_UNIX 1 -EOF +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + OS_LIBS="-ldl $OS_LIBS" +else + echo "$ac_t""no" 1>&6 +fi - ;; - -esac -if test "$enable_shared" = no; then - MKSHLIB= 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:4351: 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 +4362,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3138: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4372: \"$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 +4379,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3155: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4389: \"$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 +4396,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3172: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4406: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -3194,13 +4428,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:4432: checking whether ${CC-cc} needs -traditional" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_pattern="Autoconf.*'x'" cat > conftest.$ac_ext < Autoconf TIOCGETP @@ -3218,7 +4452,7 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext < Autoconf TCGETA @@ -3242,12 +4476,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:4480: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4508: \"$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 @@ -3297,129 +4531,110 @@ 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 -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 -else - ac_save_LIBS="$LIBS" -LIBS="-lpthread $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread" -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 -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 -else - ac_save_LIBS="$LIBS" -LIBS="-lc_r $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r" -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 -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 -else - ac_save_LIBS="$LIBS" -LIBS="-lc $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - _HAVE_PTHREADS=1 -else - echo "$ac_t""no" 1>&6 -fi +echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6 +echo "configure:4539: checking for pthread_create in -lpthreads" >&5 +echo " + #include + void *foo(void *v) { int a = 1; } + int main() { + pthread_t t; + if (!pthread_create(&t, 0, &foo, 0)) { + pthread_join(t, 0); + } + exit(0); + }" > dummy.c ; + echo "${CC-cc} -o dummy${ac_exeext} dummy.c $CFLAGS $CPPFLAGS -lpthreads $LDFLAGS $LIBS" 1>&5; + ${CC-cc} -o dummy${ac_exeext} dummy.c $CFLAGS $CPPFLAGS -lpthreads $LDFLAGS $LIBS 2>&5; + _res=$? ; + rm -f dummy.c dummy${ac_exeext} ; + if test "$_res" = "0"; then + echo "$ac_t""yes" 1>&6 + _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads" + else + echo "$ac_t""no" 1>&6 + +echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 +echo "configure:4561: checking for pthread_create in -lpthread" >&5 +echo " + #include + void *foo(void *v) { int a = 1; } + int main() { + pthread_t t; + if (!pthread_create(&t, 0, &foo, 0)) { + pthread_join(t, 0); + } + exit(0); + }" > dummy.c ; + echo "${CC-cc} -o dummy${ac_exeext} dummy.c $CFLAGS $CPPFLAGS -lpthread $LDFLAGS $LIBS" 1>&5; + ${CC-cc} -o dummy${ac_exeext} dummy.c $CFLAGS $CPPFLAGS -lpthread $LDFLAGS $LIBS 2>&5; + _res=$? ; + rm -f dummy.c dummy${ac_exeext} ; + if test "$_res" = "0"; then + echo "$ac_t""yes" 1>&6 + _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread" + else + echo "$ac_t""no" 1>&6 + +echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6 +echo "configure:4583: checking for pthread_create in -lc_r" >&5 +echo " + #include + void *foo(void *v) { int a = 1; } + int main() { + pthread_t t; + if (!pthread_create(&t, 0, &foo, 0)) { + pthread_join(t, 0); + } + exit(0); + }" > dummy.c ; + echo "${CC-cc} -o dummy${ac_exeext} dummy.c $CFLAGS $CPPFLAGS -lc_r $LDFLAGS $LIBS" 1>&5; + ${CC-cc} -o dummy${ac_exeext} dummy.c $CFLAGS $CPPFLAGS -lc_r $LDFLAGS $LIBS 2>&5; + _res=$? ; + rm -f dummy.c dummy${ac_exeext} ; + if test "$_res" = "0"; then + echo "$ac_t""yes" 1>&6 + _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r" + else + echo "$ac_t""no" 1>&6 + +echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6 +echo "configure:4605: checking for pthread_create in -lc" >&5 +echo " + #include + void *foo(void *v) { int a = 1; } + int main() { + pthread_t t; + if (!pthread_create(&t, 0, &foo, 0)) { + pthread_join(t, 0); + } + exit(0); + }" > dummy.c ; + echo "${CC-cc} -o dummy${ac_exeext} dummy.c $CFLAGS $CPPFLAGS -lc $LDFLAGS $LIBS" 1>&5; + ${CC-cc} -o dummy${ac_exeext} dummy.c $CFLAGS $CPPFLAGS -lc $LDFLAGS $LIBS 2>&5; + _res=$? ; + rm -f dummy.c dummy${ac_exeext} ; + if test "$_res" = "0"; then + echo "$ac_t""yes" 1>&6 + _HAVE_PTHREADS=1 + + else + echo "$ac_t""no" 1>&6 + + fi -fi + fi -fi + fi + + fi + # Check whether --with-pthreads or --without-pthreads was given. if test "${with_pthreads+set}" = set; then withval="$with_pthreads" @@ -3498,6 +4713,8 @@ fi ;; esac +fi # SKIP_LIBRARY_CHECKS + # Check whether --enable-cplus or --disable-cplus was given. if test "${enable_cplus+set}" = set; then enableval="$enable_cplus" @@ -3516,11 +4733,25 @@ if test "${enable_ipv6+set}" = set; then fi + +# Check whether --enable-boehm or --disable-boehm was given. +if test "${enable_boehm+set}" = set; then + enableval="$enable_boehm" + if test "$enableval" = "yes"; then + cat >> confdefs.h <<\EOF +#define GC_LEAK_DETECTOR 1 +EOF + + GC_LEAK_DETECTOR=1 + fi +fi + + 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:4755: 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 @@ -3533,192 +4764,140 @@ echo "configure:3524: checking whether ${CC-cc} accepts -pthread" >&5 rm -f conftest* echo "$ac_t""$ac_cv_have_dash_pthread" 1>&6 + ac_cv_have_dash_pthreads=no + if test "$ac_cv_have_dash_pthread" = "no"; then + echo $ac_n "checking whether ${CC-cc} accepts -pthreads""... $ac_c" 1>&6 +echo "configure:4771: checking whether ${CC-cc} accepts -pthreads" >&5 + echo 'int main() { return 0; }' | cat > conftest.c + ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1 + if test $? -eq 0; then + if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then + ac_cv_have_dash_pthreads=yes + CFLAGS="$CFLAGS -pthreads" + CXXFLAGS="$CXXFLAGS -pthreads" + fi + fi + rm -f conftest* + echo "$ac_t""$ac_cv_have_dash_pthreads" 1>&6 + fi + case "$target" in - *-mingw*|*-cygwin*|*-uwin*) + *-mingw*|*-cygwin*|*-uwin*|*-msvc*) ;; *-solaris*) cat >> confdefs.h <<\EOF #define _REENTRANT 1 -EOF - - ;; - *-freebsd*) - cat >> confdefs.h <<\EOF -#define _REENTRANT 1 -EOF - - cat >> confdefs.h <<\EOF -#define _THREAD_SAFE 1 -EOF - - if test "$ac_cv_have_dash_pthread" = "yes"; then - PTHREAD_LDFLAGS= - fi - ;; - *-hpuxB.10.10*) - cat >> confdefs.h <<\EOF -#define _REENTRANT 1 -EOF - - cat >> confdefs.h <<\EOF -#define _PR_DCETHREADS 1 -EOF - - ;; - *-hpuxB.10.20*) - cat >> confdefs.h <<\EOF -#define _REENTRANT 1 -EOF - - cat >> confdefs.h <<\EOF -#define _PR_DCETHREADS 1 -EOF - - ;; - *-hpux*) - cat >> confdefs.h <<\EOF -#define _POSIX_C_SOURCE=199506L 1 -EOF - - ;; - *) - cat >> confdefs.h <<\EOF -#define _REENTRANT 1 -EOF - - ;; - esac - - echo $ac_n "checking for pthread_create""... $ac_c" 1>&6 -echo "configure:3594: 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 < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char pthread_create(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_pthread_create) || defined (__stub___pthread_create) -choke me -#else -pthread_create(); -#endif - -; return 0; } -EOF -if { (eval echo configure:3622: \"$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 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_pthread_create=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'pthread_create`\" = yes"; then - echo "$ac_t""yes" 1>&6 - : -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 -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 -else - ac_save_LIBS="$LIBS" -LIBS="-lpthread $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" +EOF -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - OS_LIBS="-lpthread $OS_LIBS" -else - echo "$ac_t""no" 1>&6 -fi + if test "$ac_cv_have_dash_pthreads" = "yes"; then + _PTHREAD_LDFLAGS= + fi + ;; + *-freebsd*|*-openbsd*|*-bsdi*|*-netbsd*) + cat >> confdefs.h <<\EOF +#define _REENTRANT 1 +EOF - -fi + cat >> confdefs.h <<\EOF +#define _THREAD_SAFE 1 +EOF + + if test "$ac_cv_have_dash_pthread" = "yes"; then + _PTHREAD_LDFLAGS= + fi + ;; + *) + cat >> confdefs.h <<\EOF +#define _REENTRANT 1 +EOF + ;; + esac else if test -n "$USE_USER_PTHREADS"; then USE_PTHREADS= USE_NSPR_THREADS= else - USE_NSPR_THREADS=1 - fi + _PTHREAD_LDFLAGS= + if test -n "$USE_NSPR_THREADS"; then + cat >> confdefs.h <<\EOF +#define _PR_LOCAL_THREADS_ONLY 1 +EOF + + fi + fi fi case "$target" in -*-aix4.1*) - if test -z "$USE_PTHREADS"; then - cat >> confdefs.h <<\EOF +*-aix*) + if test -n "$USE_NSPR_THREADS"; then + OS_LIBS="$OS_LIBS -lc" + else + OS_LIBS="$OS_LIBS -lc_r" + fi + case "$target_os" in + aix4.1*) + if test -z "$USE_PTHREADS"; then + cat >> confdefs.h <<\EOF #define AIX_RENAME_SELECT 1 EOF - fi + fi + ;; + aix4.23*) + if test -z "$USE_NSPR_THREADS"; then + cat >> confdefs.h <<\EOF +#define HAVE_POINTER_LOCALTIME_R 1 +EOF + + fi + ;; + esac ;; -*-aix4.23*) - if test -z "$USE_NSPR_THREADS"; then +*-bsdi*) + if test -n "$USE_PTHREADS"; then cat >> confdefs.h <<\EOF -#define HAVE_POINTER_LOCALTIME_R 1 +#define _PR_NEED_PTHREAD_INIT 1 EOF fi ;; *-hpux*) - if test -n "$USE_USER_PTHREADS"; then - cat >> confdefs.h <<\EOF -#define _POSIX_C_SOURCE=199506L 1 + if test "$USE_PTHREADS"; then + if echo "$OS_RELEASE" | egrep '^(B.10.10|B.10.20)' >/dev/null; then + cat >> confdefs.h <<\EOF +#define REENTRANT 1 +EOF + + cat >> confdefs.h <<\EOF +#define _PR_DCETHREADS 1 +EOF + + else + cat >> confdefs.h <> confdefs.h <> confdefs.h <<\EOF @@ -3742,7 +4921,7 @@ EOF #define HAVE_POINTER_LOCALTIME_R 1 EOF - if test "${target_cpu}" = "i386"; then + if test "$OS_TEST" = "i86pc"; then PR_MD_ASFILES=os_SunOS_x86.s else PR_MD_ASFILES=os_SunOS.s @@ -3754,106 +4933,30 @@ EOF ;; esac -echo $ac_n "checking for dlopen""... $ac_c" 1>&6 -echo "configure:3759: 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 < -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dlopen(); - -int main() { +OS_LIBS="$_PTHREAD_LDFLAGS $OS_LIBS" -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_dlopen) || defined (__stub___dlopen) -choke me -#else -dlopen(); -#endif +if test -n "$_SAVE_OPTIMIZE_FLAGS"; then + _OPTIMIZE_FLAGS="$_SAVE_OPTIMIZE_FLAGS" +fi -; return 0; } -EOF -if { (eval echo configure:3787: \"$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 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_dlopen=no" +if test -n "$MOZ_OPTIMIZE"; then + CFLAGS="$CFLAGS $_OPTIMIZE_FLAGS" + CXXFLAGS="$CXXFLAGS $_OPTIMIZE_FLAGS" fi -rm -f conftest* + +if test -n "$MOZ_DEBUG"; then + CFLAGS="$CFLAGS $_DEBUG_FLAGS" + CXXFLAGS="$CXXFLAGS $_DEBUG_FLAGS" fi -if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then - echo "$ac_t""yes" 1>&6 - : -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 -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 -else - ac_save_LIBS="$LIBS" -LIBS="-ldl $LIBS" -cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - OS_LIBS="-ldl $OS_LIBS" -else - echo "$ac_t""no" 1>&6 -fi -fi -if test -n "$MOZ_OPTIMIZE"; then - CFLAGS="$CFLAGS $_OPTIMIZE_FLAGS" - CXXFLAGS="$CXXFLAGS $_OPTIMIZE_FLAGS" -fi -if test -n "$MOZ_DEBUG"; then - CFLAGS="$CFLAGS $_DEBUG_FLAGS" - CXXFLAGS="$CXXFLAGS $_DEBUG_FLAGS" -fi @@ -3915,6 +5018,64 @@ fi + + + + + + + + + + + + + + + + +MAKEFILES=" +Makefile +config/Makefile +config/autoconf.mk +config/nsprincl.mk +config/nsprincl.sh +config/nspr-config +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 @@ -4027,52 +5188,8 @@ do 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 <> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then @@ -4292,10 +5387,6 @@ for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then top_srcdir="$ac_dots$ac_given_srcdir" ;; esac - case "$ac_given_INSTALL" in - [/$]*) INSTALL="$ac_given_INSTALL" ;; - *) INSTALL="$ac_dots$ac_given_INSTALL" ;; - esac echo creating "$ac_file" rm -f "$ac_file" @@ -4311,7 +5402,6 @@ for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then s%@configure_input@%$configure_input%g s%@srcdir@%$srcdir%g s%@top_srcdir@%$top_srcdir%g -s%@INSTALL@%$INSTALL%g " $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file fi; done rm -f conftest.s* @@ -4321,11 +5411,10 @@ cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF - +chmod +x config/nspr-config exit 0 EOF 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..ca0df24b 100644 --- a/configure.in +++ b/configure.in @@ -23,16 +23,8 @@ dnl AC_PREREQ(2.12) AC_INIT(config/libc_r.h) -d=`pwd` -if test "${srcdir}" = "$d" || test "${srcdir}" = "." ; then - echo "Do not build in the srcdir as it will override Makefiles used by non-autoconf build." - exit 1; -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. AC_DEFINE(USE_AUTOCONF) @@ -40,7 +32,9 @@ AC_DEFINE(USE_AUTOCONF) dnl ======================================================== dnl = Defaults dnl ======================================================== -NSPR_VERSION=4 +MOD_MAJOR_VERSION=4 +MOD_MINOR_VERSION=0 +MOD_REVISION_VERSION=1 NSPR_MODNAME=nspr20 _HAVE_PTHREADS= USE_PTHREADS= @@ -55,6 +49,13 @@ _OPTIMIZE_FLAGS=-O _DEBUG_FLAGS=-g MOZ_DEBUG=1 MOZ_OPTIMIZE= +OBJDIR=. +OBJDIR_NAME=. +NSINSTALL='$(MOD_DEPTH)/config/$(OBJDIR_NAME)/nsinstall' +NOSUCHFILE=/no-such-file +LIBNSPR='-L$(dist_libdir) -lnspr$(MOD_MAJOR_VERSION)' +LIBPLC='-L$(dist_libdir) -lplc$(MOD_MAJOR_VERSION)' + dnl Link in libraries necessary to resolve all symbols for shared libs RESOLVE_LINK_SYMBOLS= @@ -71,11 +72,70 @@ LDFLAGS="${LDFLAGS=}" HOST_CFLAGS="${HOST_CFLAGS=}" HOST_LDFLAGS="${HOST_LDFLAGS=}" +dnl ======================================================== +dnl = Irix 6.x should use n32 ABI by default +dnl ======================================================== +case "$target" in +*-irix6*) + USE_N32=1 ;; +*-cygwin*) + # Check to see if we are really running in a msvc environemnt + _WIN32_MSVC= + if test "$CC" = "cl" || test "$CXX" = "cl"; then + _WIN32_MSVC=1 + elif test -z "$CC"; then + echo 'main() { return 0; }' > dummy.c + cl -o dummy dummy.c + if test $? = 0; then + _WIN32_MSVC=1 + fi + rm -f dummy dummy.o dummy.obj dummy.exe dummy.c + fi + ;; +*-msvc*) + _WIN32_MSVC=1 + ;; +esac + +if test -n "$_WIN32_MSVC"; then + SKIP_PATH_CHECKS=1 + SKIP_COMPILER_CHECKS=1 + SKIP_LIBRARY_CHECKS=1 +fi + dnl ======================================================== dnl = dnl = Check options that may affect the compiler dnl = dnl ======================================================== +dist_prefix='${MOD_DEPTH}/dist' +dist_bindir='${dist_prefix}/bin' +dist_includedir='${dist_prefix}/include' +dist_libdir='${dist_prefix}/lib' + +AC_ARG_WITH(dist-prefix, + [ --with-dist-prefix=DIST_PREFIX + place build files in DIST_PREFIX [dist]], + dist_prefix=$withval) + +AC_ARG_WITH(dist-bindir, + [ --with-dist-bindir=DIR build execuatables in DIR [DIST_PREFIX/bin]], + dist_bindir=$withval) + +AC_ARG_WITH(dist-includedir, + [ --with-dist-includedir=DIR + build include files in DIR [DIST_PREFIX/include]], + dist_includedir=$withval) + +AC_ARG_WITH(dist-libdir, + [ --with-dist-libdir=DIR build library files in DIR [DIST_PREFIX/lib]], + dist_libdir=$withval) + +AC_SUBST(dist_prefix) +AC_SUBST(dist_bindir) +AC_SUBST(dist_includedir) +AC_SUBST(dist_libdir) + dnl Check if NSPR is being compiled for Mozilla dnl Let --with-arg override environment setting dnl @@ -92,8 +152,14 @@ AC_ARG_WITH(mozilla, fi]) AC_ARG_ENABLE(optimize, - [ --enable-optimize Enable code optimizations], - MOZ_OPTIMIZE=1) + [ --enable-optimize(=val) Enable code optimizations (val, ie. -O2) ], + [ if test "$enableval" != "no"; then + MOZ_OPTIMIZE=1 + if test -n "$enableval" && test "$enableval" != "yes"; then + _OPTIMIZE_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'` + _SAVE_OPTIMIZE_FLAGS=$_OPTIMIZE_FLAGS + fi + fi ]) AC_ARG_ENABLE(debug, [ --disable-debug Do not compile in debugging symbols], @@ -101,18 +167,19 @@ AC_ARG_ENABLE(debug, MOZ_DEBUG= fi]) -AC_ARG_ENABLE(shared, - [ --disable-shared Do not compile into shared libraries]) - -AC_ARG_ENABLE(target, - [ --enable-target=\$t Turn on features for target \$t when build has multiple targets], - MOZ_TARGET=`echo $enableval | tr a-z A-Z`, - MOZ_TARGET=) +AC_ARG_ENABLE(win32-target, + [ --enable-win32-target=\$t + Specify win32 flavor. (WIN95 or WINNT)], + MOZ_WIN32_TARGET=`echo $enableval | tr a-z A-Z`, + MOZ_WIN32_TARGET=) AC_ARG_ENABLE(n32, - [ --enable-n32 Enable n32 support (IRIX only)], + [ --enable-n32 Enable n32 ABI support (IRIX only)], [ if test "$enableval" = "yes"; then USE_N32=1 + else if test "$enableval" = "no"; then + USE_N32= + fi fi ]) AC_ARG_ENABLE(64bit, @@ -127,16 +194,22 @@ AC_ARG_ENABLE(mdupdate, USE_MDUPDATE=1 fi ]) -AC_PATH_PROG(WHOAMI, whoami, :) +if test -z "$SKIP_PATH_CHECKS"; then + AC_PATH_PROG(WHOAMI, $WHOAMI whoami, echo not_whoami) +elif test -z "$WHOAMI"; then + WHOAMI=whoami +fi + if test -n "$MOZ_DEBUG"; then AC_DEFINE(DEBUG) AC_DEFINE_UNQUOTED(DEBUG_`$WHOAMI`) DEFINES="$DEFINES -UNDEBUG" else AC_DEFINE(NDEBUG) - DEFINES="$DEFINES -UDEBUG" + DEFINES="$DEFINES -U_DEBUG -UDEBUG" fi +if test -z "$SKIP_COMPILER_CHECKS"; then dnl ======================================================== dnl Checks for compilers. dnl ======================================================== @@ -177,42 +250,51 @@ if test "$target" != "$host"; then LDFLAGS=$_SAVE_LDFLAGS if test -z "$CC"; then - AC_CHECK_PROGS(CC, "${target_alias}-gcc" "${target}-gcc", :) + AC_CHECK_PROGS(CC, "${target_alias}-gcc" "${target}-gcc", echo) fi unset ac_cv_prog_CC AC_PROG_CC if test -z "$CXX"; then - AC_CHECK_PROGS(CXX, "${target_alias}-g++" "${target}-g++", :) + AC_CHECK_PROGS(CXX, "${target_alias}-g++" "${target}-g++", echo) fi unset ac_cv_prog_CXX AC_PROG_CXX if test -z "$RANLIB"; then - AC_CHECK_PROGS(RANLIB, "${target_alias}-ranlib" "${target}-ranlib", :) + AC_CHECK_PROGS(RANLIB, "${target_alias}-ranlib" "${target}-ranlib", echo) fi if test -z "$AR"; then - AC_CHECK_PROGS(AR, "${target_alias}-ar" "${target}-ar", :) + AC_CHECK_PROGS(AR, "${target_alias}-ar" "${target}-ar", echo) fi if test -z "$AS"; then - AC_CHECK_PROGS(AS, "${target_alias}-as" "${target}-as", :) + AC_CHECK_PROGS(AS, "${target_alias}-as" "${target}-as", echo) fi if test -z "$LD"; then - AC_CHECK_PROGS(LD, "${target_alias}-ld" "${target}-ld", :) + AC_CHECK_PROGS(LD, "${target_alias}-ld" "${target}-ld", echo) + fi + if test -z "$STRIP"; then + AC_CHECK_PROGS(STRIP, "${target_alias}-strip" "${target}-strip", echo) fi if test -z "$DLLTOOL"; then - AC_CHECK_PROGS(DLLTOOL, "${target_alias}-dlltool" "${target}-dlltool", :) + AC_CHECK_PROGS(DLLTOOL, "${target_alias}-dlltool" "${target}-dlltool", echo) fi if test -z "$WINDRES"; then - AC_CHECK_PROGS(WINDRES, "${target_alias}-windres" "${target}-windres", :) + AC_CHECK_PROGS(WINDRES, "${target_alias}-windres" "${target}-windres", echo) fi + else - AC_PROG_CC AC_PROG_CXX + if test "$CXX" = "cl" -a -z "$CC"; then + CC=$CXX + else + AC_PROG_CC + fi AC_PROG_RANLIB AC_PATH_PROGS(AS, as, $CC) - AC_PATH_PROGS(AR, ar, :) - AC_PATH_PROGS(LD, ld, :) - AC_PATH_PROGS(DLLTOOL, dlltool, :) - AC_PATH_PROGS(WINDRES, windres, :) + AC_PATH_PROGS(AR, ar, echo not_ar) + AC_PATH_PROGS(LD, ld link, echo not_ld) + AC_PATH_PROGS(STRIP, strip, echo not_strip) + AC_PATH_PROGS(DLLTOOL, dlltool, echo not_dlltool) + AC_PATH_PROGS(WINDRES, windres, echo not_windres) if test -z "$HOST_CC"; then HOST_CC="$CC" fi @@ -229,12 +311,22 @@ if test "`echo | $AS -V 2>&1 | grep -c GNU`" != "0"; then fi rm -f a.out +if test "$cross_compiling" = "yes"; then + CROSS_COMPILE=1 +else + CROSS_COMPILE= +fi + +fi # SKIP_COMPILER_CHECKS + dnl ======================================================== dnl Checks for programs. dnl ======================================================== -AC_PROG_INSTALL -AC_PROG_LN_S -AC_PATH_PROGS(PERL, perl5 perl, :) +if test -z "$SKIP_PATH_CHECKS"; then + AC_PATH_PROGS(PERL, perl5 perl, echo not_perl) +elif test -z "$PERL"; then + PERL=perl +fi dnl ======================================================== dnl Default platform specific options @@ -247,21 +339,161 @@ 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'` OS_RELEASE=`uname -r` OS_TEST=`uname -m` +if test "$OS_ARCH" = "IRIX64"; then + OS_ARCH=IRIX +fi + +if test "$OS_ARCH" = "POSIX_for_OpenVMS_AXP"; then + OS_ARCH=OpenVMS +fi + +####################################################################### +# Master "Core Components" macros for getting the OS target # +####################################################################### + +# +# Note: OS_TARGET should be specified on the command line for gmake. +# When OS_TARGET=WIN95 is specified, then a Windows 95 target is built. +# The difference between the Win95 target and the WinNT target is that +# the WinNT target uses Windows NT specific features not available +# in Windows 95. The Win95 target will run on Windows NT, but (supposedly) +# at lesser performance (the Win95 target uses threads; the WinNT target +# uses fibers). +# +# When OS_TARGET=WIN16 is specified, then a Windows 3.11 (16bit) target +# is built. See: win16_3.11.mk for lots more about the Win16 target. +# +# If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no +# cross-compilation. +# + +# +# The following hack allows one to build on a WIN95 machine (as if +# s/he were cross-compiling on a WINNT host for a WIN95 target). +# It also accomodates for MKS's uname.exe. If you never intend +# to do development on a WIN95 machine, you don't need this hack. +# +if test "$OS_ARCH" = "WIN95"; then + OS_ARCH=WINNT + OS_TARGET=WIN95 +elif test "$OS_ARCH" = 'Windows_95'; then + OS_ARCH=Windows_NT + OS_TARGET=WIN95 +elif test "$OS_ARCH" = 'Windows_98'; then + OS_ARCH=Windows_NT + OS_TARGET=WIN95 +elif test "$OS_ARCH" = "CYGWIN_95-4.0"; then + OS_ARCH='CYGWIN_NT-4.0' + OS_TARGET=WIN95 +elif test "$OS_ARCH" = "CYGWIN_98-4.10"; then + OS_ARCH='CYGWIN_NT-4.0' + OS_TARGET=WIN95 +elif test "$OS_ARCH" = "OS_2"; then + OS_ARCH=OS2 + OS_TARGET=OS2 +fi + +# +# On WIN32, we also define the variable CPU_ARCH. +# + +if test "$OS_ARCH" = "WINNT"; then + CPU_ARCH=`uname -p` + if test "$CPU_ARCH" = "I386"; then + CPU_ARCH=x86 + fi +elif test "$OS_ARCH" = "Windows_NT"; then +# +# If uname -s returns "Windows_NT", we assume that we are using +# the uname.exe in MKS toolkit. +# +# The -r option of MKS uname only returns the major version number. +# So we need to use its -v option to get the minor version number. +# Moreover, it doesn't have the -p option, so we need to use uname -m. +# + OS_ARCH=WINNT +# OS_MINOR_RELEASE=`uname -v` + if test "$OS_MINOR_RELEASE" = "00"; then + OS_MINOR_RELEASE=0 + fi + OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}" + CPU_ARCH=`uname -m` + # + # MKS's uname -m returns "586" on a Pentium machine. + # + if echo "$CPU_ARCH" | grep -c 86 >/dev/null; then + CPU_ARCH=x86 + fi +elif echo "$OS_ARCH" | grep -c CYGWIN_NT >/dev/null; then +# +# If uname -s returns "CYGWIN_NT-4.0", we assume that we are using +# the uname.exe in the Cygwin tools. +# + OS_RELEASE=`echo $OS_ARCH | sed 's|^CYGWIN_NT-||'` + OS_ARCH=WINNT + CPU_ARCH=`uname -m` + # + # Cygwin's uname -m returns "i686" on a Pentium Pro machine. + # + if echo "$CPU_ARCH" | grep -c 86 >/dev/null; then + CPU_ARCH=x86 + fi +elif test "$OS_ARCH" = "CYGWIN32_NT"; then +# +# Prior to the Beta 20 release, Cygwin was called GNU-Win32. +# If uname -s returns "CYGWIN32/NT", we assume that we are using +# the uname.exe in the GNU-Win32 tools. +# + OS_ARCH=WINNT + CPU_ARCH=`uname -m` + # + # GNU-Win32's uname -m returns "i686" on a Pentium Pro machine. + # + if echo "$CPU_ARCH" | grep -c 86 >/dev/null; then + CPU_ARCH=x86 + fi +fi + +if test -n "$MOZILLA_CLIENT" && test "$OS_ARCH" = "WINNT"; then + OS_TARGET=WIN95 + MOZ_WIN32_TARGET=WIN95 + if test -n "$MOZ_DEBUG"; then + USE_DEBUG_RTL=1 + fi +fi +if test -z "$OS_TARGET"; then + OS_TARGET=$OS_ARCH +fi +if test "$OS_TARGET" = "WIN95"; then + OS_RELEASE="4.0" +fi +if test "$OS_TARGET" = "WIN16"; then + OS_RELEASE= +fi +if test -z "$MOZ_WIN32_TARGET"; then + MOZ_WIN32_TARGET=$OS_TARGET +fi +OS_CONFIG="${OS_TARGET}${OS_RELEASE}" + +dnl ======================================================== + dnl ======================================================== dnl Override of system specific host options dnl ======================================================== case "$host" in -*-mingw*) +*-mingw*|*-cygwin*|*-msvc*) ;; *-beos*) HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE" ;; +*os2*) + ;; *) HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX" ;; @@ -294,7 +526,9 @@ case "$target" in AC_DEFINE(AIX4_1) MKSHLIB= DSO_LDOPTS= + USE_PTHREADS=1 AIX_LINK_OPTS='-bnso -berok' + LIBNSPR='-L$(dist_libdir) -lnspr$(MOD_MAJOR_VERSION)_shr' ;; aix4.3*) AC_DEFINE(AIX_HAVE_ATOMIC_OP_H) @@ -303,6 +537,7 @@ case "$target" in AC_DEFINE(AIX4_3) AC_DEFINE(HAVE_SOCKLEN_T) USE_IPV6=1 + USE_PTHREADS=1 AIX_LINK_OPTS='-brtl -bnso -berok' ;; *) @@ -313,7 +548,7 @@ case "$target" in ;; esac CFLAGS="$CFLAGS -qro -qroconst" - if test `grep -c xlC_r $CC`; then + if echo "$CC" | grep -c xlC_r; then CFLAGS="$CFLAGS -qarch=com" fi AIX_WRAP='$(DIST)/lib/aixwrap.o' @@ -328,6 +563,7 @@ case "$target" in fi fi PR_MD_CSRCS=aix.c + RESOLVE_LINK_SYMBOLS=1 ;; *-beos*) @@ -336,11 +572,91 @@ case "$target" in AC_DEFINE(BEOS) AC_DEFINE(_POSIX_SOURCE) DSO_LDOPTS=-nostart - MKSHLIB='$(CCC) $(DSO_LDOPTS) -o $@' MDCPUCFG_H=_beos.cfg USE_BTHREADS=1 PR_MD_ARCH_DIR=beos RESOLVE_LINK_SYMBOLS=1 + case "${target_cpu}" in + i?86) + _OPTIMIZE_FLAGS=-O2 + _DEBUG_FLAGS='-gdwarf-2 -O0' + MKSHLIB='$(CCC) $(DSO_LDOPTS) -o $@' + ;; + powerpc) + CC=mwcc + CCC=mwcc + LD=mwld + DSO_LDOPTS='-xms -export pragma -init _init_routine_ -term _term_routine_ -lroot -lnet /boot/develop/lib/ppc/glue-noinit.a /boot/develop/lib/ppc/init_term_dyn.o /boot/develop/lib/ppc/start_dyn.o' + _OPTIMIZE_FLAGS=-O2 + _DEBUG_FLAGS='-g -O0' + ;; + esac + ;; + +*-bsdi*) + AC_DEFINE(XP_UNIX) + AC_DEFINE(BSDI) + AC_DEFINE(NEED_BSDREGEX) + + CFLAGS="$CFLAGS -Wall -Wno-format" + CXXFLAGS="$CXXFLAGS -Wall -Wno-format" + + if echo "$OS_TEST" | grep -c 86 >/dev/null; then + CPU_ARCH=x86 + elif echo "$OS_TEST" | grep -c sparc >/dev/null; then + CPU_ARCH=sparc + fi + + MDCPUCFG_H=_bsdi.cfg + PR_MD_CSRCS=bsdi.c + + DSO_LDOPTS=-r + + case "$target_os" in + bsdi1.1*) + AC_DEFINE(_PR_BSDI_JMPBUF_IS_ARRAY) + AC_DEFINE(_PR_STAT_HAS_ONLY_ST_ATIME) + AC_DEFINE(_PR_NEED_H_ERRNO) + MKSHLIB= + DSO_CFLAGS= + DSO_LDOPTS= + ;; + + bsdi2.1*) + AC_DEFINE(_PR_TIMESPEC_HAS_TS_SEC) + AC_DEFINE(_PR_BSDI_JMPBUF_IS_ARRAY) + AC_DEFINE(HAVE_DLL) + AC_DEFINE(USE_DLFCN) + AC_DEFINE(_PR_STAT_HAS_ST_ATIMESPEC) + PR_MD_ASFILES=os_BSD_OS_386_2.s + ;; + + bsdi4.*) + AC_DEFINE(_PR_SELECT_CONST_TIMEVAL) + AC_DEFINE(_PR_BSDI_JMPBUF_IS_STRUCT) + AC_DEFINE(HAVE_DLL) + AC_DEFINE(USE_DLFCN) + AC_DEFINE(_PR_STAT_HAS_ST_ATIMESPEC) + MKSHLIB='$(CC) -o $@ $(DSO_LDOPTS)' + DSO_CFLAGS=-fPIC + DSO_LDOPTS='-shared -Wl,-soname,$(@:$(OBJDIR)/%.so=%.so)' + STRIP="$STRIP -d" + case "$target_os" in + bsdi4.2*) + AC_DEFINE(_PR_HAVE_GETPROTO_R) + AC_DEFINE(_PR_HAVE_GETPROTO_R_POINTER) + ;; + esac + ;; + *) + AC_DEFINE(_PR_SELECT_CONST_TIMEVAL) + AC_DEFINE(_PR_BSDI_JMPBUF_IS_STRUCT) + AC_DEFINE(HAVE_DLL) + AC_DEFINE(USE_DLFCN) + AC_DEFINE(_PR_STAT_HAS_ST_ATIMESPEC) + ;; + esac + ;; *-dgux*) @@ -351,9 +667,7 @@ case "$target" in AC_DEFINE(DGUX) AC_DEFINE(_DGUX_SOURCE) AC_DEFINE(_POSIX4A_DRAFT6_SOURCE) - MKSHLIB='$(LD) $(DSO_LDOPTS)' DSO_LDOPTS=-G - NOSUCHFILE=/no-such-file _OPTIMIZE_FLAGS=-O2 _DEBUG_FLAGS= MDCPUCFG_H=_dgux.cfg @@ -361,9 +675,7 @@ case "$target" in ;; *-freebsd*) - if test "${target_cpu}" != "alpha"; then - AC_DEFINE(i386) - fi + AC_DEFINE(XP_UNIX) AC_DEFINE(FREEBSD) AC_DEFINE(HAVE_BSD_FLOCK) CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall -pipe" @@ -380,12 +692,15 @@ case "$target" in ;; *-hpux*) + AC_DEFINE(XP_UNIX) AC_DEFINE(HPUX) AC_DEFINE(_HPUX_SOURCE) - DEFINES="$DEFINES -D${target_cpu}" + AC_DEFINE(hppa) + AC_DEFINE(hpux) DLL_SUFFIX=sl DSO_LDOPTS='-b +h $(notdir $@)' PR_MD_CSRCS=hpux.c + PR_MD_ASFILES=os_HPUX.s if test -n "$USE_64"; then MDCPUCFG_H=_hpux64.cfg else @@ -400,52 +715,74 @@ case "$target" in else DSO_CFLAGS=-fPIC fi + if test -n "$MOZILLA_CLIENT"; then - USE_NSPR_THREADS=1 + DEFAULT_IMPL_STRATEGY=_EMU fi - case "${target_os}" in - hpuxA.09*) - AC_DEFINE(HPUX9) + + if echo "$OS_RELEASE" | grep ^A.09 >/dev/null; then AC_DEFINE(_PR_NEED_H_ERRNO) + AC_DEFINE(HPUX9) + DEFAULT_IMPL_STRATEGY=_EMU + USE_NSPR_THREADS=1 + fi + + if echo "$OS_RELEASE" | egrep '^(A.09|B.10)' >/dev/null; then AC_DEFINE(_PR_NO_LARGE_FILES) - ;; - hpuxB.10.01*) + fi + + if echo "$OS_RELEASE" | egrep '^(B.10.10|B.10.20)' >/dev/null; then + AC_DEFINE(_PR_NEED_H_ERRNO) + fi + + if echo "$OS_RELEASE" | egrep '^(B.10.10|B.10.20)' >/dev/null; then + AC_DEFINE(HAVE_INT_LOCALTIME_R) + fi + + if echo "$OS_RELEASE" | egrep '^(B.10.30|B.11.00)' >/dev/null; then + AC_DEFINE(HAVE_POINTER_LOCALTIME_R) + fi + + if test "$OS_RELEASE" = "B.10.01"; then AC_DEFINE(HPUX10) - ;; - hpuxB.10.10*) + DEFAULT_IMPL_STRATEGY=_EMU + fi + + if test "$OS_RELEASE" = "B.10.10"; then AC_DEFINE(HPUX10) AC_DEFINE(HPUX10_10) - AC_DEFINE(HAVE_INT_LOCALTIME_R) - USE_PTHREADS=1 - USE_NSPR_THREADS= - ;; - hpuxB.10.20*) + DEFAULT_IMPL_STRATEGY=_PTH + fi + + if test "$OS_RELEASE" = "B.10.20"; then AC_DEFINE(HPUX10) AC_DEFINE(HPUX10_20) - AC_DEFINE(HAVE_INT_LOCALTIME_R) - if test -z "$GNU_CC"; then + if test -z "$GNU_CC" && test 0 = 1; then CFLAGS="$CFLAGS +DAportable +DS1.1" CXXFLAGS="$CXXFLAGS +DAportable +DS1.1" fi - USE_PTHREADS=1 - USE_NSPR_THREADS= - ;; - hpuxB.10.30*) - AC_DEFINE(HAVE_POINTER_LOCALTIME_R) - if test -z "$GNU_CC"; then + DEFAULT_IMPL_STRATEGY=_EMU + fi + + if test "$OS_RELEASE" = "B.10.30"; then + AC_DEFINE(HPUX10) + AC_DEFINE(HPUX10_30) + #CXX="/opt/aCC/bin/aCC -ext" + if test -z "$GNU_CC" && test 0 = 1; then CFLAGS="$CFLAGS +DAportable +DS1.1" CXXFLAGS="$CXXFLAGS +DAportable +DS1.1" fi - USE_PTHREADS=1 - USE_NSPR_THREADS= - ;; - hpuxB.11.00*) + DEFAULT_IMPL_STRATEGY=_PTH + fi + + if test "$OS_RELEASE" = "B.11.00"; then AC_DEFINE(HPUX10) AC_DEFINE(HPUX11) AC_DEFINE(_LARGEFILE64_SOURCE) AC_DEFINE(_PR_HAVE_OFF64_T) AC_DEFINE(HAVE_POINTER_LOCALTIME_R) if test -z "$GNU_CC"; then + if test 0 = 1; then if test -z "$USE_64"; then CFLAGS="$CFLAGS +DAportable +DS2.0" CXXFLAGS="$CXXFLAGS +DAportable +DS2.0" @@ -453,18 +790,23 @@ case "$target" in CFLAGS="$CFLAGS +DA2.0W +DS2.0" CXXFLAGS="$CXXFLAGS +DA2.0W +DS2.0" fi + fi fi + DEFAULT_IMPL_STRATEGY=_PTH + fi + + if test "$DEFAULT_IMPL_STRATEGY" = "_EMU"; then + USE_NSPR_THREADS=1 + USE_PTHREADS= + USE_USER_THREADS= + elif test "$DEFAULT_IMPL_STRATEGY" = "_PTH"; then USE_PTHREADS=1 - USE_NSPR_THREADS= - ;; - esac - case "${target_os}" in - hpuxB.10*) - AC_DEFINE(_PR_NO_LARGE_FILES) - ;; - esac - if test -n "$USE_NSPR_THREADS"; then - AC_DEFINE(_PR_LOCAL_THREADS_ONLY) + if test "$MOZILLA_CLIENT"; then + USE_PTHREADS= + fi + if test "$USE_USER_PTHREADS"; then + USE_PTHREADS= + fi fi ;; @@ -475,19 +817,24 @@ case "$target" in AC_DEFINE(_SGI_MP_SOURCE) PR_MD_CSRCS=irix.c PR_MD_ASFILES=os_Irix.s - MKSHLIB='$(LD) $(SHLIB_LD_OPTS) -rdata_shared -shared -soname $(notdir $@) -o $@' - DSO_LDOPTS='-elf -shared -all' + MKSHLIB='$(LD) $(DSO_LDOPTS) -rdata_shared -shared -soname $(notdir $@) -o $@' + #DSO_LDOPTS='-elf -shared -all' + STRIP="$STRIP -f" if test -n "$USE_64"; then MDCPUCFG_H=_irix64.cfg else MDCPUCFG_H=_irix32.cfg fi case "${target_os}" in + irix6*) + AC_DEFINE(IRIX6) + USE_PTHREADS=1 + ;; irix5*) + AC_DEFINE(IRIX5) USE_NSPR_THREADS=1 ;; *) - USE_N32=1 USE_PTHREADS=1 ;; esac @@ -496,7 +843,11 @@ case "$target" in CFLAGS="$CFLAGS -Wall -Wno-format" _OPTIMIZE_FLAGS="-O6" else - AS="as -D_ASM $(INCLUDES) -n32" + if test -n "$USE_N32"; then + AS='as -D_ASM $(INCLUDES) -n32' + else + AS='as -D_ASM $(INCLUDES)' + fi CFLAGS="$CFLAGS -fullwarn -xansi" if test "$USE_N32"; then _OPTIMIZE_FLAGS="-O -OPT:Olimit=4000" @@ -509,14 +860,14 @@ case "$target" in case "$target}" in *-irix6.*) CFLAGS="$CFLAGS -multigot" - SHLIB_LD_OPTS="-no_unresolved" - if test "USE_N32"; then + DSO_LDOPTS="-no_unresolved" + if test "$USE_N32"; then CFLAGS="$CFLAGS -n32 -woff 1209" LDFLAGS="$LDFLAGS -n32" - SHLIB_LD_OPTS="$SHLIB_LD_OPTS -n32" + DSO_LDOPTS="$DSO_LDOPTS -n32" if test "${target_os}" = "irix6.2"; then LDFLAGS="$LDFLAGS -Wl,-woff,85" - SHLIB_LD_OPTS="$SHLIB_LD_OPTS -woff 85" + DSO_LDOPTS="$DSO_LDOPTS -woff 85" fi else if test "$USE_64"; then @@ -570,6 +921,7 @@ case "$target" in MKSHLIB='$(LD) $(DSO_LDOPTS) -soname $(notdir $@) -o $@' DSO_CFLAGS=-fPIC DSO_LDOPTS=-shared + OS_LIBS="$OS_LIBS -lc" case "${target_cpu}" in alpha) AC_DEFINE(_ALPHA_) @@ -578,6 +930,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" @@ -589,69 +945,429 @@ case "$target" in esac ;; -*-mingw*) +*-mingw*|*-cygwin*|*-msvc*) AC_DEFINE(XP_PC) - AC_DEFINE(NONAMELESSUNION) + AC_DEFINE(WIN32) PR_MD_ARCH_DIR=windows - if test -z "$GNU_CC"; then + RESOLVE_LINK_SYMBOLS=1 + + if test -n "$GNU_CC"; then + AC_DEFINE(NONAMELESSUNION) + MKSHLIB='$(DLLTOOL) --as=$(AS) -k --dllname $*.dll --output-lib $@' + else + CC=cl + CXX=cl + LD=link + AR='lib -NOLOGO -OUT:"$@"' + AR_FLAGS= + RANLIB='echo not_ranlib' + STRIP='echo not_strip' + NSINSTALL=nsinstall + RC=rc.exe + GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb' OBJ_SUFFIX=obj LIB_SUFFIX=lib DLL_SUFFIX=dll + + CFLAGS="$CFLAGS -W3 -nologo -GF -Gy" + _DEBUG_FLAGS= + + if test -n "$MOZ_OPTIMIZE"; then + CFLAGS="$CFLAGS -MD" + OPTIMIZER=-O2 + DLLFLAGS='-OUT:"$@"' + OBJDIR_TAG=_OPT + + if test -n "$MOZ_PROFILE"; then + OPTIMIZER="$OPTIMIZER -Z7" + DLLFLAGS="$DLLFLAGS -DEBUG -DEBUGTYPE:CV" + LDFLAGS="$LDFLAGS -DEBUG -DEBUGTYPE:CV" + fi + else + if test -n "$USE_DEBUG_RTL"; then + CFLAGS="$CFLAGS -MDd" + else + CFLAGS="$CFLAGS -MD" + fi + OPTIMIZER="-Od -Z7" + DLLFLAGS='-DEBUG -DEBUGTYPE:CV -OUT:"$@"' + if test -n "$GLOWCODE"; then + DLLFLAGS='-DEBUG -DEBUGTYPE:both -INCLUDE:_GlowCode -OUT:"$@"' + DLL_LIBS='$(GLOWDIR)/glowcode.lib' + fi + OBJDIR_TAG=_DBG + LDFLAGS="$LDFLAGS -DEBUG -DEBUGTYPE:CV" + if test -n "$PROFILE"; then + LDFLAGS="$LDFLAGS -PROFILE -MAP" + DLLFLAGS="$DLLFLAGS -PROFILE -MAP" + fi + fi + + if test "$OS_TARGET" = "WINNT"; then + CFLAGS="$CFLAGS -GT" + LIBNSPR='$(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)' + LIBPLC='$(dist_libdir)/libplc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)' + else + LIBNSPR='$(dist_libdir)/nspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)' + LIBPLC='$(dist_libdir)/plc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)' + fi + fi # GNU_CC + + if test -n "$USE_STATIC_TLS"; then + AC_DEFINE(_PR_USE_STATIC_TLS) + fi + + if test "$OS_TARGET" = "WINNT"; then + if test "$CPU_ARCH" = "x86"; then + CFLAGS="$CFLAGS -G5" + fi + AC_DEFINE(WINNT) + else + AC_DEFINE(WIN95) + AC_DEFINE(_PR_GLOBAL_THREADS_ONLY) + fi + + if test "$CPU_ARCH" = "x86"; then + CPU_ARCH_TAG= + else + CPU_ARCH_TAG=$CPU_ARCH fi - MKSHLIB='$(DLLTOOL) --as=$(AS) -k --dllname $*.dll --output-lib $@' - case "$MOZ_TARGET" in + if test -n "$USE_DEBUG_RTL"; then + OBJDIR_SUFFIX=OBJD + else + OBJDIR_SUFFIX=OBJ + fi + + OBJDIR_NAME="${OS_CONFIG}${CPU_ARCH_TAG}${OBJDIR_TAG}.${OBJDIR_SUFFIX}" + OBJDIR='${OBJDIR_NAME}' + + OS_DLLFLAGS='-nologo -DLL -SUBSYSTEM:WINDOWS -PDB:NONE' + + case "$MOZ_WIN32_TARGET" in WINNT) - DEFINES="$DEFINES -DWIN32 -DWINNT -DWin32_Winsock" MDCPUCFG_H=_winnt.cfg ;; WIN95) - DEFINES="$DEFINES -UWINNT -DWIN32 -DWIN95 -DWin32_Winsock -D_PR_GLOBAL_THREADS_ONLY" MDCPUCFG_H=_win95.cfg ;; WIN16) - DEFINES="$DEFINES -UWINNT" MDCPUCFG_H=_win16.cfg ;; *) - AC_MSG_ERROR([Missing MOZ_TARGET for ${target}. Use --enable-target to set.]) + AC_MSG_ERROR([Missing MOZ_WIN32_TARGET for ${target}. Use --enable-win32-target to set.]) ;; esac - case "$target" in - i?86-*) + case "$target_cpu" in + i?86) AC_DEFINE(_X86_) ;; - alpha-*) + alpha) AC_DEFINE(_ALPHA_) ;; - mips-*) + mips) AC_DEFINE(_MIPS_) ;; *) AC_DEFINE(_CPU_ARCH_NOT_DEFINED) ;; esac + ;; +*-ncr-sysv*) + AC_DEFINE(XP_UNIX) + AC_DEFINE(SVR4) + AC_DEFINE(SYSV) + AC_DEFINE(NCR) + USE_NSPR_THREADS=1 + if test "$OS_RELEASE" = "2.03"; then + AC_DEFINE(_PR_STAT_HAS_ST_ATIM) + else + AC_DEFINE(_PR_STAT_HAS_ST_ATIM_UNION) + fi + + if test -z "$GNU_CC"; then + CFLAGS="$CFLAGS -Hnocopyr" + CXXFLAGS="$CXXFLAGS -Hnocopyr" + else + CFLAGS="$CFLAGS -fPIC -Wall -pipe" + CXXFLAGS="$CXXFLAGS -fPIC -Wall -pipe" + DSO_LDOPTS=-G + fi + MDCPUCFG_H=_ncr.cfg + PR_MD_CSRCS=ncr.c + ;; + +mips-nec-sysv*) + AC_DEFINE(XP_UNIX) + AC_DEFINE(SVR4) + AC_DEFINE(__SVR4) + AC_DEFINE(NEC) + AC_DEFINE(nec_ews) + USE_NSPR_THREADS=1 + if test -z "$GNU_CC"; then + CC='$(NSDEPTH)/build/hcc cc -Xa -KGnum=0 -KOlimit=4000' + CXX=g++ + fi + OS_LIBS="$OS_LIBS -lsocket -lnsl -ldl" + DSO_LDOPTS=-G + MDCPUCFG_H=_nec.cfg + PR_MD_CSRCS=nec.c + ;; + +*-netbsd*) + AC_DEFINE(XP_UNIX) + AC_DEFINE(NETBSD) + AC_DEFINE(HAVE_BSD_FLOCK) + if test -z "$OBJECT_FMT"; then + if echo __ELF__ | ${CC-cc} -E - | grep -q __ELF__ 2>/dev/null; then + OBJECT_FMT=a.out; + else + OBJECT_FMT=ELF + fi + fi + if test "$OBJECT_FMT" = "ELF"; then + DLL_SUFFIX=so + else + DLL_SUFFIX=so.1.0 + fi + CFLAGS="$CFLAGS -ansi -Wall -pipe" + CXXFLAGS="$CXXFLAGS -ansi -Wall -pipe" + DSO_CFLAGS='-fPIC -DPIC' + DSO_LDOPTS='-x -shared' + if test "$LIBRUNPATH"; then + DSO_LDOPTS="$DSO_LDOPTS -R$(LIBRUNPATH)" + fi + MDCPUCFG_H=_netbsd.cfg + PR_MD_CSRCS=netbsd.c + ;; + +mips-sony-newsos*) + AC_DEFINE(XP_UNIX) + AC_DEFINE(SONY) + AC_DEFINE(SYSV) + AC_DEFINE(SVR4) + AC_DEFINE(__svr4) + AC_DEFINE(__svr4__) + AC_DEFINE(HAVE_SVID_GETTOD) + USE_NSPR_THREADS=1 + CFLAGS="$CFLAGS -Xa -fullwarn" + CXXFLAGS="$CXXFLAGS -Xa -fullwarn" + DSO_LDOPTS=-G + MDCPUCFG_H=_sony.cfg + PR_MD_CSRCS=sony.c + ;; + +*-nextstep*|*-openstep*) + AC_DEFINE(XP_UNIX) + AC_DEFINE(NEXTSTEP) + AC_DEFINE(HAVE_BSD_FLOCK) + AC_DEFINE(_POSIX_SOURCE) + CFLAGS="$CFLAGS -Wall -fno-common -pipe -traditional-cpp -posix" + CXXFLAGS="$CXXFLAGS -Wall -fno-common -pipe -traditional-cpp -posix" + USE_NSPR_THREADS=1 + DLL_SUFFIX=dylib + MDCPUCFG_H=_nextstep.cfg + PR_MD_CSRCS=nextstep.c + ;; + + *-nto*) AC_DEFINE(XP_UNIX) + AC_DEFINE(NTO) + AC_DEFINE(_QNX_SOURCE) + AC_DEFINE(HAVE_POINTER_LOCALTIME_R) MDCPUCFG_H=_nto.cfg PR_MD_CSRCS=nto.c - MKSHLIB='qcc -Vgcc_ntox86 -shared -Wl,-h$(@:$(OBJDIR)/%.so=%.so) -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" + MKSHLIB='qcc -Vgcc_ntox86 -shared -Wl,-h$(@:$(OBJDIR)/%.so=%.so) -M -o $(@:$(OBJDIR)/%.so=%.so)' + CFLAGS="$CFLAGS -Wc,-Wall -Wc,-Wno-parentheses -shared" + OS_LIBS="$OS_LIBS -lsocket" + _OPTIMIZE_FLAGS="-O1" + _DEBUG_FLAGS="-O1 -gstabs" COMPILER_TAG="_qcc" CC="qcc -Vgcc_ntox86 -w" - CXX="QCC -Vgcc_ntox86 -w" - CPP="qcc -Vgcc_ntox86 -w" + CXX='$(CC)' LD="qcc -Vgcc_ntox86 -nostdlib" - AR="qcc -Vgcc_ntox86 -M -a " - AR_FLAGS="$@" + AR="qcc -Vgcc_ntox86 -M -a $@" + AR_FLAGS= ;; +*-openbsd*) + AC_DEFINE(XP_UNIX) + AC_DEFINE(OPENBSD) + AC_DEFINE(HAVE_BSD_FLOCK) + CFLAGS="$CFLAGS -ansi -Wall -pipe" + CXXFLAGS="$CXXFLAGS -ansi -Wall -pipe" + DLL_SUFFIX=so.1.0 + DSO_CFLAGS=-fPIC + MDCPUCFG_H=_openbsd.cfg + PR_MD_CSRCS=openbsd.c + USE_NSPR_THREADS=1 + case "$OS_TEST" in + alpha|mips|pmax) + DSO_LDOPTS=-shared ;; + *) + DSO_LDOPTS=-Bshareable ;; + esac + ;; + +*-openvms*) + AC_DEFINE(XP_UNIX) + AC_DEFINE(VMS) + AC_DEFINE(VMS_AS_IS) + AC_DEFINE(GENERIC_PTHREAD_REDEFINES) + RESOLVE_LINK_SYMBOLS=1 + CROSS_COMPILE=1 + _HAVE_PTHREADS=1 + HOST_CC=c89 + HOST_CXX=cxx + HOST_CFLAGS=-O + HOST_CXXFLAGS=-O + CC=ccc + CXX=ccc + CFLAGS="$CFLAGS -Wc,names=\(short,as\)" + CXXFLAGS="$CXXFLAGS -Wc,names=\(short,as\)" + MDCPUCFG_H=_openvms.cfg + PR_MD_CSRCS=openvms.c + MKSHLIB='vmsld $(OPTIMIZER)' + ;; + +*-osf*) + AC_DEFINE(XP_UNIX) + AC_DEFINE(OSF1) + + if echo "$OS_RELEASE" | egrep -c '(V2.0|V3.2)' 2>/dev/null ; then + USE_NSPR_THREADS=1 + fi + + if test -z "$GNU_CC"; then + CC="$CC -std1 -ieee_with_inexact" + if test "$OS_RELEASE" = "V2.0"; then + CC="$CC -readonly_strings" + fi + _OPTIMIZE_FLAGS='-Olimit 4000' + fi + + if echo $OS_RELEASE | egrep -c '(V2.0|V3.2)' 2>/dev/null; then + AC_DEFINE(HAVE_INT_LOCALTIME_R) + else + AC_DEFINE(HAVE_POINTER_LOCALTIME_R) + AC_DEFINE(OSF1_HAVE_MACHINE_BUILTINS_H) + fi + DSO_LDOPTS='-shared -all -expect_unresolved "*" -soname $(notdir $@)' + MDCPUCFG_H=_osf1.cfg + PR_MD_CSRCS=osf1.c + ;; + +*-qnx*) + AC_DEFINE(XP_UNIX) + AC_DEFINE(QNX) + AC_DEFINE(_PR_NEED_H_ERRNO) + USE_NSPR_THREADS=1 + MDCPUCFG_H=_qnx.cfg + PR_MD_CSRCS=qnx.c + ;; + +*-rhapsody*) + AC_DEFINE(XP_UNIX) + AC_DEFINE(RHAPSODY) + AC_DEFINE(HAVE_BSD_FLOCK) + CFLAGS="$CFLAGS -Wmost -fno-common -pipe" + if echo $OS_TEST | grep -c 86 2>/dev/null; then + CFLAGS="$CFLAGS -mno-486" + AC_DEFINE(i386) + CPU_ARCH=i386 + else + AC_DEFINE(ppc) + CPU_ARCH=ppc + fi + DSO_LDOPTS='-dynamiclib -compatibility_version 1 -current_version 1 -all_load' + MKSHLIB='$(CC) -arch $(CPU_ARCH) $(DSO_LDOPTS) -o $@' + DLL_SUFFIX=dylib + USE_PTHREADS=1 + MDCPUCFG_H=_rhapsody.cfg + PR_MD_CSRCS=rhapsody.c + ;; + +*-*-sco*) + AC_DEFINE(XP_UNIX) + AC_DEFINE(SCO) + AC_DEFINE(sco) + AC_DEFINE(SYSV) + AC_DEFINE(_SVID3) + AC_DEFINE(_PR_NEED_H_ERRNO) + CC='cc -b elf -KPIC' + CXX='$(NSDEPTH)/build/hcpp CC +.cpp +w' + USE_NSPR_THREADS=1 + CPU_ARCH=x86 + DSO_LDOPTS='-b elf -G' + MDCPUCFG_H=_scoos.cfg + PR_MD_SRCS=scoos.c + ;; + +*-sinix*) + AC_DEFINE(XP_UNIX) + AC_DEFINE(SVR4) + AC_DEFINE(SNI) + AC_DEFINE(RELIANTUNIX) + AC_DEFINE(sinix) + AC_DEFINE(HAVE_SVID_GETTOD) + if echo "$OS_TEST" | grep -c 86 2>/dev/null; then + AC_DEFINE(i386) + CPU_ARCH=x86 + else + CPU_ARCH=mips + fi + + if test "$GNU_CC"; then + AS='$(CC) -x assembler-with-cpp' + if test "$CPU_ARCH" = "mips"; then + LD=gld + CFLAGS="$CFLAGS -pipe" + fi + CFLAGS="$CFLAGS -Wall -Wno-format" + else + AS='/usr/bin/cc' + _OPTIMIZE_FLAGS='-O -F Olimit,4000' + fi + + DSO_LDOPTS='-G -z defs -h $(@:$(OBJDIR)/%.so=%.so)' + + if test "$OS_RELEASE" = "5.43"; then + AC_DEFINE(IP_MULTICAST) + fi + + OS_LIBS="$OS_LIBS -lsocket -lnsl -lresolv -ldl -lc" + USE_NSPR_THREADS=1 + MDCPUCFG_H=_reliantunix.cfg + PR_MD_CSRCS=reliantunix.c + if test "${OS_ARCH}" = "mips"; then + PR_MD_ASFILES=os_ReliantUNIX.s + fi + ;; + +*-sunos*) + AC_DEFINE(XP_UNIX) + AC_DEFINE(SUNOS4) + CFLAGS="$CFLAGS -Wall -Wno-format" + if test "$USE_MDUPDATE"; then + CFLAGS="$CFLAGS -MDupdate \$(DEPENDENCIES)" + fi + CPU_ARCH=sparc + DLL_SUFFIX=so.1.0 + DSO_LDOPTS= + DSO_CFLAGS=-fPIC + USE_NSPR_THREADS=1 + if test "$OS_RELEASE" = "4.1.3_U1"; then + _OPTIMIZE_FLAGS= + OS_LIBS="$OS_LIBS -lm" + fi + MDCPUCFG_H=_sunos4.cfg + PR_MD_CSRCS=sunos4.c + ;; + *-solaris*) AC_DEFINE(XP_UNIX) AC_DEFINE(SVR4) @@ -675,11 +1391,10 @@ case "$target" in if test -z "$GNU_AS"; then ASFLAGS="$ASFLAGS -Wa,-P" fi - NOSUCHFILE=/no-such-file if test -n "$GNU_CC"; then if test -n "$USE_MDUPDATE"; then - CFLAGS="$CFLAGS -MDupdate" - CXXFLAGS="$CXXFLAGS -MDupdate" + CFLAGS="$CFLAGS -MDupdate \$(DEPENDENCIES)" + CXXFLAGS="$CXXFLAGS -MDupdate \$(DEPENDENCIES)" fi else CC="$CC -xstrconst" @@ -693,7 +1408,7 @@ case "$target" in CC="$CC -xarch=v9" CXX="$CXX -xarch=v9" fi - if test "${target_cpu}" = "i386"; then + if test "$OS_TEST" = "i86pc"; then AC_DEFINE(i386) if test -n "$MOZ_DEBUG" && test -n "$GNU_CC"; then _DEBUG_FLAGS="$_DEBUG_FLAGS -gstabs" @@ -719,13 +1434,111 @@ case "$target" in fi ;; esac - if test "${target_cpu}" = "sun4u"; then + if test "$OS_TEST" = "sun4u"; then ULTRASPARC_LIBRARY=ultrasparc ULTRASPARC_FILTER_LIBRARY=libatomic.so DSO_LDOPTS="$DSO_LDOPTS -f "'$(ULTRASPARC_FILTER_LIBRARY)' fi ;; +*-sco-sysv5*) + AC_DEFINE(XP_UNIX) + AC_DEFINE(UNIXWARE) + AC_DEFINE(SVR4) + AC_DEFINE(SYSV) + USE_NSPR_THREADS=1 + if echo $OS_RELEASE | grep -c 2.1 2>/dev/null; then + AC_DEFINE(_PR_NO_LARGE_FILES) + CC='$(NSDEPTH)/build/hcc cc' + CXX='$(NSDEPTH)/build/hcpp CC' + MDCPUCFG_H=_unixware.cfg + else + AC_DEFINE(_LARGEFILE64_SOURCE) + AC_DEFINE(_PR_HAVE_OFF64_T) + AC_DEFINE(_PR_HAVE_SOCKADDR_LEN) + MDCPUCFG_H=_unixware7.cfg + fi + PR_MD_CSRCS=unixware.c + DSO_LDOPTS=-G + CPU_ARCH=x86 + ;; + +*-os2*) + AC_DEFINE(XP_OS2) + AC_DEFINE(BSD_SELECT) + AC_DEFINE(XP_PC) + AC_DEFINE(_PR_GLOBAL_THREADS_ONLY) + OBJ_SUFFIX=obj + LIB_SUFFIX=lib + DLL_SUFFIX=dll + DLLTOOL='' + RC=rc.exe + PR_MD_ARCH_DIR=os2 + PROG_SUFFIX=.exe + NSINSTALL=nsinstall + MDCPUCFG_H=_os2.cfg + RESOLVE_LINK_SYMBOLS=1 + + case "$target" in + *-os2_emx) + AC_DEFINE(XP_OS2_EMX) + AC_DEFINE(OS2) + AR=emxomfar + AR_FLAGS='-p256 r $@' + CFLAGS="-Zmtd -Zomf" + HOST_CFLAGS="$CFLAGS" + CXXFLAGS="-Zmtd -Zomf" + OS_LIBS="-lsocket -lemxio" + LD='$(CC)' + IMPLIB='emximp -o' + FILTER='emxexp' + OS_DLLFLAGS='$(DSO_LDOPTS) -o $@' + _OPTIMIZE_FLAGS=-O3 + _DEBUG_FLAGS=-g + if test -n "$MOZ_DEBUG"; then + DLLFLAGS='-g' + EXEFLAGS='-g $(OMF_FLAG) -Zmtd -L$(DIST)/lib -o $@' + DSO_LDOPTS='-g -Zomf -Zdll -Zmt -Zcrtdll -Zlinker /NOO' + else + DLLFLAGS= + EXEFLAGS='-Zmtd -o $@' + DSO_LDOPTS='-Zomf -Zdll -Zmt -Zcrtdll -Zlinker /NOO' + fi + ;; + *-os2_vacpp) + AC_DEFINE(XP_OS2_VACPP) + AC_DEFINE(OS2,4) + AC_DEFINE(TCPV40HDRS) + AC_DEFINE(_X86_) + AR=-ilib + AR_FLAGS='/NOL /NOI /O:$(subst /,\\,$@)' + CFLAGS='/Q /qlibansi /Gd+ /Gm+ /Su4 /Mp /Tl-' + HOST_CFLAGS="$CFLAGS" + OS_CFLAGS='/Q /qlibansi /Gd+ /Gm+ /Su4 /Ge- /Tl-' + OS_EXE_CFLAGS='/Q /qlibansi /Gd+ /Gm+ /Su4 /Ge+ /Tl-' + CXXFLAGS='/Q /qlibansi /Gd+ /Gm+ /Su4 /Mp /Tl-' + OS_LIBS='so32dll.lib tcp32dll.lib' + LD='-ilink' + LDFLAGS='/FREE /DE /NOE /LINENUMBERS /nologo' + MKSHLIB='$(LD) $(DSO_LDOPTS)' + IMPLIB='implib -nologo -noignorecase' + FILTER='cppfilt -q -B -P' + _OPTIMIZE_FLAGS=/O+ + _DEBUG_FLAGS=/Ti+ + if test -n "$MOZ_DEBUG"; then + DLLFLAGS='/O:$@ /DLL /INC:_dllentry /MAP:$(@:.dll=.map) /nologo /DEBUG /NOE' + EXEFLAGS='/OUT:$@ /PMTYPE:VIO /MAP:$(@:.exe=.map) /nologo /DEBUG /NOE' + else + DLLFLAGS='/O:$@ /DLL /INC:_dllentry /MAP:$(@:.dll=.map) /nologo' + EXEFLAGS='/OUT:$@ /PMTYPE:VIO /MAP:$(@:.exe=.map) /nologo' + fi + LIBNSPR='$(dist_libdir)/nspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)' + LIBPLC='$(dist_libdir)/plc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)' + ;; + esac + + ;; + *) AC_DEFINE(XP_UNIX) ;; @@ -737,6 +1550,7 @@ if test "$enable_shared" = no; then MKSHLIB= fi +if test -z "$SKIP_LIBRARY_CHECKS"; then dnl ======================================================== dnl Check for system libraries dnl ======================================================== @@ -764,6 +1578,10 @@ dnl AC_CHECK_LIB(svld, main) dnl AC_CHECK_LIB(thread, main) dnl AC_CHECK_LIB(vms_jackets, main) +AC_CHECK_FUNC(dlopen,,[ + AC_CHECK_LIB(dl, dlopen, [OS_LIBS="-ldl $OS_LIBS"]) +]) + dnl ======================================================== dnl Check for system header files. dnl ======================================================== @@ -806,15 +1624,51 @@ dnl ======================================================== dnl Check options dnl ======================================================== -AC_CHECK_LIB(pthread, pthread_attr_init, - _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread", - AC_CHECK_LIB(c_r, pthread_attr_init, - _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r", - AC_CHECK_LIB(c, pthread_attr_init, - _HAVE_PTHREADS=1 ) +dnl +dnl Apparently, some systems cannot properly check for the pthread +dnl library unless is included so we need to test +dnl using it +dnl +dnl MOZ_CHECK_PTHREADS(lib, success, failure) +AC_DEFUN(MOZ_CHECK_PTHREADS, +[ +AC_MSG_CHECKING([for pthread_create in -l$1]) +echo " + #include + void *foo(void *v) { int a = 1; } + int main() { + pthread_t t; + if (!pthread_create(&t, 0, &foo, 0)) { + pthread_join(t, 0); + } + exit(0); + }" > dummy.c ; + echo "${CC-cc} -o dummy${ac_exeext} dummy.c $CFLAGS $CPPFLAGS -l[$1] $LDFLAGS $LIBS" 1>&5; + ${CC-cc} -o dummy${ac_exeext} dummy.c $CFLAGS $CPPFLAGS -l[$1] $LDFLAGS $LIBS 2>&5; + _res=$? ; + rm -f dummy.c dummy${ac_exeext} ; + if test "$_res" = "0"; then + AC_MSG_RESULT([yes]) + [$2] + else + AC_MSG_RESULT([no]) + [$3] + fi +]) + +MOZ_CHECK_PTHREADS(pthreads, + _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads", + MOZ_CHECK_PTHREADS(pthread, + _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread", + MOZ_CHECK_PTHREADS(c_r, + _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r", + MOZ_CHECK_PTHREADS(c, + _HAVE_PTHREADS=1 + ) ) ) - +) + AC_ARG_WITH(pthreads, [ --with-pthreads Use system pthreads library as thread subsystem], [ if test "$withval" = "yes"; then @@ -877,8 +1731,10 @@ case "$target" in ;; esac +fi # SKIP_LIBRARY_CHECKS + AC_ARG_ENABLE(cplus, - [ --enable-cplus Use cplus for whatever reason], + [ --enable-cplus Enable some c++ api routines], [ if test "$enableval" = "yes"; then USE_CPLUS=1 fi]) @@ -889,6 +1745,14 @@ AC_ARG_ENABLE(ipv6, USE_IPV6=1 fi]) + +AC_ARG_ENABLE(boehm, + [ --enable-boehm Enable the Boehm Garbage Collector], + [ if test "$enableval" = "yes"; then + AC_DEFINE(GC_LEAK_DETECTOR) + GC_LEAK_DETECTOR=1 + fi]) + if test -n "$USE_PTHREADS"; then dnl See if -pthread is supported. rm -f conftest* @@ -906,73 +1770,109 @@ if test -n "$USE_PTHREADS"; then rm -f conftest* AC_MSG_RESULT($ac_cv_have_dash_pthread) + dnl + dnl See if -pthreads is supported. + dnl + ac_cv_have_dash_pthreads=no + if test "$ac_cv_have_dash_pthread" = "no"; then + AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads) + echo 'int main() { return 0; }' | cat > conftest.c + ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1 + if test $? -eq 0; then + if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then + ac_cv_have_dash_pthreads=yes + CFLAGS="$CFLAGS -pthreads" + CXXFLAGS="$CXXFLAGS -pthreads" + fi + fi + rm -f conftest* + AC_MSG_RESULT($ac_cv_have_dash_pthreads) + fi + case "$target" in - *-mingw*|*-cygwin*|*-uwin*) + *-mingw*|*-cygwin*|*-uwin*|*-msvc*) ;; *-solaris*) AC_DEFINE(_REENTRANT) + if test "$ac_cv_have_dash_pthreads" = "yes"; then + _PTHREAD_LDFLAGS= + fi ;; - *-freebsd*) + *-freebsd*|*-openbsd*|*-bsdi*|*-netbsd*) AC_DEFINE(_REENTRANT) AC_DEFINE(_THREAD_SAFE) dnl -pthread links in -lc_r, so don't specify it explicitly. if test "$ac_cv_have_dash_pthread" = "yes"; then - PTHREAD_LDFLAGS= + _PTHREAD_LDFLAGS= fi ;; - *-hpuxB.10.10*) - AC_DEFINE(_REENTRANT) - AC_DEFINE(_PR_DCETHREADS) - ;; - *-hpuxB.10.20*) - AC_DEFINE(_REENTRANT) - AC_DEFINE(_PR_DCETHREADS) - ;; - *-hpux*) - AC_DEFINE(_POSIX_C_SOURCE=199506L) - ;; *) AC_DEFINE(_REENTRANT) ;; esac - AC_CHECK_FUNC(pthread_create,,[ - AC_CHECK_LIB(pthread, pthread_create, [OS_LIBS="-lpthread $OS_LIBS"]) - ]) - else if test -n "$USE_USER_PTHREADS"; then USE_PTHREADS= USE_NSPR_THREADS= else - USE_NSPR_THREADS=1 - dnl AC_DEFINE(_PR_LOCAL_THREADS_ONLY) + _PTHREAD_LDFLAGS= + if test -n "$USE_NSPR_THREADS"; then + AC_DEFINE(_PR_LOCAL_THREADS_ONLY) + fi fi fi dnl Special thread exceptions case "$target" in -*-aix4.1*) - if test -z "$USE_PTHREADS"; then - AC_DEFINE(AIX_RENAME_SELECT) +*-aix*) + if test -n "$USE_NSPR_THREADS"; then + OS_LIBS="$OS_LIBS -lc" + else + OS_LIBS="$OS_LIBS -lc_r" fi + case "$target_os" in + aix4.1*) + if test -z "$USE_PTHREADS"; then + AC_DEFINE(AIX_RENAME_SELECT) + fi + ;; + aix4.[23]*) + if test -z "$USE_NSPR_THREADS"; then + AC_DEFINE(HAVE_POINTER_LOCALTIME_R) + fi + ;; + esac ;; -*-aix4.[23]*) - if test -z "$USE_NSPR_THREADS"; then - AC_DEFINE(HAVE_POINTER_LOCALTIME_R) +*-bsdi*) + if test -n "$USE_PTHREADS"; then + AC_DEFINE(_PR_NEED_PTHREAD_INIT) fi ;; *-hpux*) - if test -n "$USE_USER_PTHREADS"; then - AC_DEFINE(_POSIX_C_SOURCE=199506L) + if test "$USE_PTHREADS"; then + if echo "$OS_RELEASE" | egrep '^(B.10.10|B.10.20)' >/dev/null; then + AC_DEFINE(REENTRANT) + AC_DEFINE(_PR_DCETHREADS) + else + AC_DEFINE_UNQUOTED(_POSIX_C_SOURCE,199506L) + fi + fi + if test "$USE_USER_PTHREADS"; then + AC_DEFINE_UNQUOTED(_POSIX_C_SOURCE,199506L) fi ;; -*-mingw*|*-cygwin*|*-uwin*) +*-mingw*|*-cygwin*|*-uwin*|*-msvc*) dnl win32 does not use pthreads USE_PTHREADS= - PTHREAD_LDFLAGS= + _PTHREAD_LDFLAGS= USE_USER_PTHREADS= ;; +*-netbsd*) + if test -z "$USE_PTHREADS"; then + OS_LIBS="$OS_LIBS -lc" + fi + ;; *-solaris*) if test -n "$USE_NATIVE_THREADS"; then AC_DEFINE(_PR_GLOBAL_THREADS_ONLY) @@ -984,7 +1884,7 @@ case "$target" in if test -z "$USE_USER_PTHREADS"; then AC_DEFINE(_REENTRANT) AC_DEFINE(HAVE_POINTER_LOCALTIME_R) - if test "${target_cpu}" = "i386"; then + if test "$OS_TEST" = "i86pc"; then PR_MD_ASFILES=os_SunOS_x86.s else PR_MD_ASFILES=os_SunOS.s @@ -996,9 +1896,13 @@ case "$target" in ;; esac -AC_CHECK_FUNC(dlopen,,[ - AC_CHECK_LIB(dl, dlopen, [OS_LIBS="-ldl $OS_LIBS"]) -]) +OS_LIBS="$_PTHREAD_LDFLAGS $OS_LIBS" + +dnl If the user passed in arg to --enable-optimize, +dnl make sure that we use it. +if test -n "$_SAVE_OPTIMIZE_FLAGS"; then + _OPTIMIZE_FLAGS="$_SAVE_OPTIMIZE_FLAGS" +fi if test -n "$MOZ_OPTIMIZE"; then CFLAGS="$CFLAGS $_OPTIMIZE_FLAGS" @@ -1018,15 +1922,20 @@ AC_SUBST(CC) AC_SUBST(CXX) AC_SUBST(CFLAGS) AC_SUBST(CXXFLAGS) +AC_SUBST(CPPFLAGS) AC_SUBST(HOST_CC) AC_SUBST(HOST_CFLAGS) AC_SUBST(LDFLAGS) AC_SUBST(GNU_CC) +AC_SUBST(CROSS_COMPILE) + +AC_SUBST(MOZ_OPTIMIZE) AC_SUBST(USE_CPLUS) AC_SUBST(USE_IPV6) AC_SUBST(USE_N32) AC_SUBST(USE_64) +AC_SUBST(GC_LEAK_DETECTOR) AC_SUBST(USE_PTHREADS) AC_SUBST(USE_BTHREADS) @@ -1034,13 +1943,19 @@ AC_SUBST(USE_USER_PTHREADS) AC_SUBST(USE_NATIVE_THREADS) AC_SUBST(USE_NSPR_THREADS) -AC_SUBST(NSPR_VERSION) +AC_SUBST(LIBNSPR) +AC_SUBST(LIBPLC) + +AC_SUBST(MOD_MAJOR_VERSION) +AC_SUBST(MOD_MINOR_VERSION) +AC_SUBST(MOD_REVISION_VERSION) AC_SUBST(NSPR_MODNAME) AC_SUBST(MDCPUCFG_H) -AC_SUBST(MOZ_TARGET) +AC_SUBST(MOZ_WIN32_TARGET) AC_SUBST(PR_MD_CSRCS) AC_SUBST(PR_MD_ASFILES) AC_SUBST(PR_MD_ARCH_DIR) +AC_SUBST(CPU_ARCH) AC_SUBST(OBJ_SUFFIX) AC_SUBST(LIB_SUFFIX) @@ -1065,6 +1980,9 @@ AC_SUBST(DLLTOOL) AC_SUBST(WINDRES) AC_SUBST(RANLIB) AC_SUBST(PERL) +AC_SUBST(STRIP) +AC_SUBST(FILTER) +AC_SUBST(IMPLIB) AC_SUBST(OS_LIBS) AC_SUBST(RESOLVE_LINK_SYMBOLS) @@ -1074,53 +1992,63 @@ AC_SUBST(MOZ_OBJFORMAT) AC_SUBST(ULTRASPARC_LIBRARY) AC_SUBST(ULTRASPARC_FILTER_LIBRARY) +AC_SUBST(OBJDIR) +AC_SUBST(OBJDIR_NAME) +AC_SUBST(NSINSTALL) +AC_SUBST(OPTIMIZER) +AC_SUBST(RC) +AC_SUBST(CPU_ARCH_TAG) +AC_SUBST(DLLFLAGS) +AC_SUBST(EXEFLAGS) +AC_SUBST(OS_DLLFLAGS) + dnl ======================================================== dnl Generate output files. dnl ======================================================== -AC_OUTPUT([ +MAKEFILES=" Makefile config/Makefile config/autoconf.mk config/nsprincl.mk config/nsprincl.sh +config/nspr-config 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/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], [chmod +x config/nspr-config]) diff --git a/gmakefile.win b/gmakefile.win new file mode 100644 index 00000000..f3a27f15 --- /dev/null +++ b/gmakefile.win @@ -0,0 +1,76 @@ +#!gmake +# -*- Mode: Makefile -*- +# +# The contents of this file are subject to the Mozilla Public License +# Version 1.1 (the "MPL"); you may not use this file except in +# compliance with the MPL. You may obtain a copy of the MPL at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the MPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the MPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the MPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 2001 Netscape Communications Corporation. All Rights +# Reserved. +# + + +ifndef MOZ_SRC_FLIPPED +$(error MOZ_SRC_FLIPPED is not set) +endif + +ifndef MOZ_TOP +MOZ_TOP=mozilla +endif + +MOZ_DIST_FLIPPED = $(MOZ_SRC_FLIPPED)/mozilla/dist + +ifdef MOZ_DEBUG +MOZ_OBJDIR = WIN32_D.OBJ +else +MOZ_OBJDIR = WIN32_O.OBJ +endif + +NSPR_CONFIGURE := ../configure \ + --with-mozilla \ + --with-dist-prefix=$(MOZ_DIST_FLIPPED) \ + --with-dist-bindir=$(MOZ_DIST_FLIPPED)/$(MOZ_OBJDIR)/bin \ + --with-dist-libdir=$(MOZ_DIST_FLIPPED)/$(MOZ_OBJDIR)/lib + +ifeq (,$(MOZ_DEBUG)) +NSPR_CONFIGURE := $(NSPR_CONFIGURE) --enable-optimize --disable-debug +endif + +define MAKE_OBJDIR +if test ! -d $(@D) ; then rm -rf $(@D) ; nsinstall -D $(@D) ; fi +endef + + +all:: build_all + +# Argh. nmake keeps the cwd from cmd to cmd and gmake does not +# Furthermore, shmsdos doesn't support '&&' so there's a chance the +# 'cd' could fail and configure would be run in the wrong dir +# +$(MOZ_OBJDIR)/config.status: configure configure.in + @$(MAKE_OBJDIR) + cd $(MOZ_OBJDIR)/ ; \ + sh $(NSPR_CONFIGURE) + +build_all: $(MOZ_OBJDIR)/config.status check_old + gmake -C $(MOZ_OBJDIR) + +clobber_all: $(MOZ_OBJDIR)/config.status check_old + gmake -C $(MOZ_OBJDIR) clobber_all + +distclean: check_old + rm -rf WIN32_D.OBJ WIN32_O.OBJ + +check_old: + @if test -f Makefile; then gmake distclean; fi + + + diff --git a/lib/.cvsignore b/lib/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/lib/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/lib/Makefile b/lib/Makefile deleted file mode 100644 index 9bb7d95c..00000000 --- a/lib/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -#! gmake - -MOD_DEPTH = .. - -export NSPR20=1 - -include $(MOD_DEPTH)/config/config.mk - -DIRS = ds libc - -include $(MOD_DEPTH)/config/rules.mk - -export:: $(TARGETS) - -install:: export diff --git a/lib/Makefile.in b/lib/Makefile.in index e6a1c312..826001ec 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -34,4 +34,3 @@ include $(topsrcdir)/config/rules.mk export:: $(TARGETS) -install:: export diff --git a/lib/ds/.cvsignore b/lib/ds/.cvsignore new file mode 100644 index 00000000..bcab60f5 --- /dev/null +++ b/lib/ds/.cvsignore @@ -0,0 +1,2 @@ +Makefile +_pl_bld.h diff --git a/lib/ds/Makefile b/lib/ds/Makefile deleted file mode 100644 index 2c5881d0..00000000 --- a/lib/ds/Makefile +++ /dev/null @@ -1,174 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -#! gmake - -MOD_DEPTH = ../.. - -include $(MOD_DEPTH)/config/config.mk - -# Disable optimization of the nspr on SunOS4.1.3 -ifeq ($(OS_ARCH),SunOS) -ifeq ($(OS_RELEASE),4.1.3_U1) -OPTIMIZER = -endif -endif - -INCLUDES = -I$(DIST)/include -I$(MOD_DEPTH)/pr/include - -CSRCS = \ - plarena.c \ - plhash.c \ - plvrsion.c \ - $(NULL) - -HEADERS = \ - plarenas.h \ - plarena.h \ - plhash.h \ - $(NULL) - -ifeq ($(OS_ARCH), WINNT) -ifeq ($(OS_TARGET), WIN16) -# OS_CFLAGS = $(OS_EXE_CFLAGS) -EXTRA_LIBS = $(DIST)/lib/nspr$(MOD_VERSION).$(LIB_SUFFIX) -else -DLLBASE=/BASE:0x30000000 -RES=$(OBJDIR)/plds.res -RESNAME=plds.rc -OS_LIBS = user32.lib -ifeq ($(OS_TARGET),WIN95) -EXTRA_LIBS = $(DIST)/lib/nspr$(MOD_VERSION).lib -else -EXTRA_LIBS = $(DIST)/lib/libnspr$(MOD_VERSION).lib -endif - -ifdef MOZ_DEBUG -ifdef GLOWCODE -EXTRA_LIBS += $(GLOWDIR)/glowcode.lib -endif -endif -endif - -else -ifeq ($(MOZ_OS2_TOOLS),VACPP) -EXTRA_LIBS = $(DIST)/lib/nspr$(MOD_VERSION).$(LIB_SUFFIX) - -else -ifeq ($(OS_ARCH), AIX) -ifeq ($(CLASSIC_NSPR),1) -OS_LIBS += -lc -else -OS_LIBS += -lc_r -endif -endif -ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1) -EXTRA_LIBS = -L$(DIST)/lib -lnspr$(MOD_VERSION)_shr -else -EXTRA_LIBS = -L$(DIST)/lib -lnspr$(MOD_VERSION) -endif -endif -endif - -# On NCR and SCOOS, we can't link with extra libraries when -# we build a shared library. If we do so, the linker doesn't -# complain, but we would run into weird problems at run-time. -# Therefore on these platforms, we link just the .o files. -ifeq ($(OS_ARCH),NCR) -EXTRA_LIBS = -endif -ifeq ($(OS_ARCH),SCOOS) -EXTRA_LIBS = -endif - -LIBRARY_NAME = plds -LIBRARY_VERSION = $(MOD_VERSION) - -RELEASE_HEADERS = $(HEADERS) -RELEASE_HEADERS_DEST = $(RELEASE_INCLUDE_DIR) -RELEASE_LIBS = $(TARGETS) - -include $(MOD_DEPTH)/config/rules.mk - -# -# Version information generation (begin) -# -ECHO = echo -TINC = $(OBJDIR)/_pl_bld.h -PROD = $(notdir $(SHARED_LIBRARY)) -NOW = $(MOD_DEPTH)/config/$(OBJDIR)/now -SH_DATE = $(shell date) -SH_NOW = $(shell $(NOW)) - -ifeq ($(OS_ARCH), WINNT) - SUF = i64 -else - SUF = LL -endif - -$(TINC): - @$(MAKE_OBJDIR) - @$(ECHO) '#define _BUILD_STRING "$(SH_DATE)"' > $(TINC) - @if test ! -z "$(SH_NOW)"; then \ - $(ECHO) '#define _BUILD_TIME $(SH_NOW)$(SUF)' >> $(TINC); \ - else \ - true; \ - fi - @$(ECHO) '#define _PRODUCTION "$(PROD)"' >> $(TINC) - - -$(OBJDIR)/plvrsion.$(OBJ_SUFFIX): plvrsion.c $(TINC) -ifeq ($(OS_ARCH), WINNT) - $(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) plvrsion.c -else -ifeq ($(MOZ_OS2_TOOLS), VACPP) - $(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) plvrsion.c -else - $(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) plvrsion.c -endif -endif -# -# Version information generation (end) -# - -# -# The Client build wants the shared libraries in $(DIST)/bin, -# so we also install them there. -# - -export:: $(TARGETS) - $(INSTALL) -m 444 $(HEADERS) $(DIST)/include - $(INSTALL) -m 444 $(TARGETS) $(DIST)/lib -ifdef SHARED_LIBRARY -ifeq ($(OS_ARCH),HP-UX) - $(INSTALL) -m 755 $(SHARED_LIBRARY) $(DIST)/lib - $(INSTALL) -m 755 $(SHARED_LIBRARY) $(DIST)/bin -else - $(INSTALL) -m 444 $(SHARED_LIBRARY) $(DIST)/bin -endif -ifeq ($(OS_ARCH), OpenVMS) - $(INSTALL) -m 444 $(SHARED_LIBRARY:.$(DLL_SUFFIX)=.vms) $(DIST)/lib -endif -endif -ifeq ($(MOZ_BITS),16) - $(INSTALL) -m 444 $(HEADERS) $(MOZ_INCL) - $(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/lib - $(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/bin -endif - -install:: export - diff --git a/lib/ds/Makefile.in b/lib/ds/Makefile.in index 0240723c..f300d04b 100644 --- a/lib/ds/Makefile.in +++ b/lib/ds/Makefile.in @@ -26,16 +26,7 @@ include $(MOD_DEPTH)/config/autoconf.mk include $(topsrcdir)/config/config.mk -ifndef USE_AUTOCONF -# Disable optimization of the nspr on SunOS4.1.3 -ifeq ($(OS_ARCH),SunOS) -ifeq ($(OS_RELEASE),4.1.3_U1) -OPTIMIZER = -endif -endif -endif #!USE_AUTOCONF - -INCLUDES = -I$(DIST)/include -I$(topsrcdir)/pr/include +INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include CSRCS = \ plarena.c \ @@ -51,66 +42,21 @@ HEADERS = \ HEADERS := $(addprefix $(srcdir)/, $(HEADERS)) -ifndef USE_AUTOCONF ifeq ($(OS_ARCH), WINNT) -ifeq (,$(filter-out WIN16 OS2,$(OS_TARGET))) -# OS_CFLAGS = $(OS_EXE_CFLAGS) -ifdef XP_OS2_EMX -EXTRA_LIBS = -L$(DIST)/lib -lnspr$(MOD_VERSION) -else -EXTRA_LIBS = $(DIST)/lib/nspr$(MOD_VERSION).$(LIB_SUFFIX) -endif -else DLLBASE=/BASE:0x30000000 RES=$(OBJDIR)/plds.res RESNAME=plds.rc OS_LIBS = user32.lib -ifeq ($(OS_TARGET),WIN95) -EXTRA_LIBS = $(DIST)/lib/nspr$(MOD_VERSION).lib -else -EXTRA_LIBS = $(DIST)/lib/libnspr$(MOD_VERSION).lib -endif - -ifdef MOZ_DEBUG -ifdef GLOWCODE -EXTRA_LIBS += $(GLOWDIR)/glowcode.lib -endif -endif - -endif -else -ifeq ($(OS_ARCH), AIX) -ifeq ($(CLASSIC_NSPR),1) -OS_LIBS += -lc -else -OS_LIBS += -lc_r -endif -endif -ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1) -EXTRA_LIBS = -L$(DIST)/lib -lnspr$(MOD_VERSION)_shr -else -EXTRA_LIBS = -L$(DIST)/lib -lnspr$(MOD_VERSION) -endif -endif +endif # WINNT -# On NCR and SCOOS, we can't link with extra libraries when -# we build a shared library. If we do so, the linker doesn't -# complain, but we would run into weird problems at run-time. -# Therefore on these platforms, we link just the .o files. -ifeq ($(OS_ARCH),NCR) -EXTRA_LIBS = -endif -ifeq ($(OS_ARCH),SCOOS) -EXTRA_LIBS = -endif -endif #!USE_AUTOCONF +EXTRA_LIBS = $(LIBNSPR) ifdef RESOLVE_LINK_SYMBOLS -EXTRA_LIBS := -L$(DIST)/lib -lnspr$(MOD_VERSION) +EXTRA_LIBS += $(OS_LIBS) endif LIBRARY_NAME = plds -LIBRARY_VERSION = $(MOD_VERSION) +LIBRARY_VERSION = $(MOD_MAJOR_VERSION) RELEASE_HEADERS = $(HEADERS) RELEASE_HEADERS_DEST = $(RELEASE_INCLUDE_DIR) @@ -131,11 +77,7 @@ SH_DATE = $(shell date) SH_NOW = $(shell $(NOW)) ifeq ($(OS_ARCH), WINNT) -ifeq ($(OS_TARGET),OS2) - SUF = -else SUF = i64 -endif else SUF = LL endif @@ -153,35 +95,36 @@ $(TINC): $(OBJDIR)/plvrsion.$(OBJ_SUFFIX): plvrsion.c $(TINC) ifeq ($(OS_ARCH), WINNT) -ifdef XP_OS2_EMX - $(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) $< + $(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $< else +ifeq ($(MOZ_OS2_TOOLS), VACPP) $(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $< -endif else $(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) $< endif +endif # # Version information generation (end) # # -# The Client build wants the shared libraries in $(DIST)/bin, +# The Client build wants the shared libraries in $(dist_bindir), # so we also install them there. # export:: $(TARGETS) - $(INSTALL) -m 444 $(HEADERS) $(DIST)/include - $(INSTALL) -m 444 $(TARGETS) $(DIST)/lib + $(INSTALL) -m 444 $(HEADERS) $(dist_includedir) + $(INSTALL) -m 444 $(TARGETS) $(dist_libdir) ifdef SHARED_LIBRARY ifeq ($(OS_ARCH),HP-UX) - $(INSTALL) -m 755 $(SHARED_LIBRARY) $(DIST)/lib - $(INSTALL) -m 755 $(SHARED_LIBRARY) $(DIST)/bin + $(INSTALL) -m 755 $(SHARED_LIBRARY) $(dist_libdir) + $(INSTALL) -m 755 $(SHARED_LIBRARY) $(dist_bindir) else - $(INSTALL) -m 444 $(SHARED_LIBRARY) $(DIST)/bin + $(INSTALL) -m 444 $(SHARED_LIBRARY) $(dist_bindir) endif ifeq ($(OS_ARCH), OpenVMS) - $(INSTALL) -m 444 $(SHARED_LIBRARY:.$(DLL_SUFFIX)=.vms) $(DIST)/lib + $(INSTALL) -m 444 $(SHARED_LIBRARY:.$(DLL_SUFFIX)=.vms) $(dist_libdir) + $(INSTALL) -m 444 $(SHARED_LIBRARY:.$(DLL_SUFFIX)=.vms) $(dist_bindir) endif endif ifeq ($(MOZ_BITS),16) @@ -190,5 +133,4 @@ ifeq ($(MOZ_BITS),16) $(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/bin endif -install:: export 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) @@ -348,6 +376,23 @@ PL_HashTableLookup(PLHashTable *ht, const void *key) return 0; } +/* +** 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). 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/lib/libc/.cvsignore b/lib/libc/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/lib/libc/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/lib/libc/Makefile b/lib/libc/Makefile deleted file mode 100644 index c9d9517b..00000000 --- a/lib/libc/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -#! gmake - -MOD_DEPTH = ../.. - -export NSPR20=1 - -include $(MOD_DEPTH)/config/config.mk - -DIRS = include src - -include $(MOD_DEPTH)/config/rules.mk - -export:: $(TARGETS) - -install:: export diff --git a/lib/libc/Makefile.in b/lib/libc/Makefile.in index 05cef709..8e059acc 100644 --- a/lib/libc/Makefile.in +++ b/lib/libc/Makefile.in @@ -34,4 +34,3 @@ include $(topsrcdir)/config/rules.mk export:: $(TARGETS) -install:: export diff --git a/lib/libc/include/.cvsignore b/lib/libc/include/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/lib/libc/include/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/lib/libc/include/Makefile b/lib/libc/include/Makefile deleted file mode 100644 index b00ff300..00000000 --- a/lib/libc/include/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -#! gmake - -MOD_DEPTH = ../../.. -include $(MOD_DEPTH)/config/config.mk - -HEADERS = $(wildcard *.h) - -RELEASE_HEADERS = $(HEADERS) -RELEASE_HEADERS_DEST = $(RELEASE_INCLUDE_DIR) - -include $(MOD_DEPTH)/config/rules.mk - -export:: $(HEADERS) - $(INSTALL) -m 444 $(HEADERS) $(DIST)/include -ifeq ($(MOZ_BITS),16) - $(INSTALL) -m 444 $(HEADERS) $(MOZ_INCL) -endif - -install:: export - diff --git a/lib/libc/include/Makefile.in b/lib/libc/include/Makefile.in index f4b1838d..8fe6997d 100644 --- a/lib/libc/include/Makefile.in +++ b/lib/libc/include/Makefile.in @@ -33,10 +33,9 @@ RELEASE_HEADERS_DEST = $(RELEASE_INCLUDE_DIR) include $(topsrcdir)/config/rules.mk export:: $(HEADERS) - $(INSTALL) -m 444 $(HEADERS) $(DIST)/include + $(INSTALL) -m 444 $(HEADERS) $(dist_includedir) ifeq ($(MOZ_BITS),16) $(INSTALL) -m 444 $(HEADERS) $(MOZ_INCL) endif -install:: export diff --git a/lib/libc/src/.cvsignore b/lib/libc/src/.cvsignore new file mode 100644 index 00000000..bcab60f5 --- /dev/null +++ b/lib/libc/src/.cvsignore @@ -0,0 +1,2 @@ +Makefile +_pl_bld.h diff --git a/lib/libc/src/Makefile b/lib/libc/src/Makefile deleted file mode 100644 index 9fb0a22a..00000000 --- a/lib/libc/src/Makefile +++ /dev/null @@ -1,174 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -#! gmake - -MOD_DEPTH = ../../.. - -include $(MOD_DEPTH)/config/config.mk - -# Disable optimization of the nspr on SunOS4.1.3 -ifeq ($(OS_ARCH),SunOS) -ifeq ($(OS_RELEASE),4.1.3_U1) -OPTIMIZER = -endif -endif - -INCLUDES = -I$(DIST)/include - -CSRCS =\ - plvrsion.c \ - strlen.c \ - strcpy.c \ - strdup.c \ - strcat.c \ - strcmp.c \ - strccmp.c \ - strchr.c \ - strpbrk.c \ - strstr.c \ - strcstr.c \ - base64.c \ - plerror.c \ - plgetopt.c \ - $(NULL) - -LIBRARY_NAME = plc -LIBRARY_VERSION = $(MOD_VERSION) - -RELEASE_LIBS = $(TARGETS) - -ifeq ($(OS_ARCH),WINNT) -ifeq ($(OS_TARGET), WIN16) -EXTRA_LIBS = $(DIST)/lib/nspr$(MOD_VERSION).lib -else -DLLBASE=/BASE:0x30000000 -RES=$(OBJDIR)/plc.res -RESNAME=plc.rc -ifeq ($(OS_TARGET),WIN95) -EXTRA_LIBS = $(DIST)/lib/nspr$(MOD_VERSION).lib -else -EXTRA_LIBS = $(DIST)/lib/libnspr$(MOD_VERSION).lib -endif - -ifdef MOZ_DEBUG -ifdef GLOWCODE -EXTRA_LIBS += $(GLOWDIR)/glowcode.lib -endif -endif -endif - -else -ifeq ($(MOZ_OS2_TOOLS),VACPP) -EXTRA_LIBS = $(DIST)/lib/nspr$(MOD_VERSION).$(LIB_SUFFIX) - -else -ifeq ($(OS_ARCH), AIX) -ifeq ($(CLASSIC_NSPR),1) -OS_LIBS += -lc -else -OS_LIBS += -lc_r -endif -endif -ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1) -EXTRA_LIBS = -L$(DIST)/lib -lnspr$(MOD_VERSION)_shr -else -EXTRA_LIBS = -L$(DIST)/lib -lnspr$(MOD_VERSION) -endif -endif -endif - -# On NCR and SCOOS, we can't link with extra libraries when -# we build a shared library. If we do so, the linker doesn't -# complain, but we would run into weird problems at run-time. -# Therefore on these platforms, we link just the .o files. -ifeq ($(OS_ARCH),NCR) -EXTRA_LIBS = -endif -ifeq ($(OS_ARCH),SCOOS) -EXTRA_LIBS = -endif - -include $(MOD_DEPTH)/config/rules.mk - -# -# Version information generation (begin) -# -ECHO = echo -TINC = $(OBJDIR)/_pl_bld.h -PROD = $(notdir $(SHARED_LIBRARY)) -NOW = $(MOD_DEPTH)/config/$(OBJDIR)/now -SH_DATE = $(shell date) -SH_NOW = $(shell $(NOW)) - -ifeq ($(OS_ARCH), WINNT) - SUF = i64 -else - SUF = LL -endif - -GARBAGE += $(TINC) - -$(TINC): - @$(MAKE_OBJDIR) - @$(ECHO) '#define _BUILD_STRING "$(SH_DATE)"' > $(TINC) - @if test ! -z "$(SH_NOW)"; then \ - $(ECHO) '#define _BUILD_TIME $(SH_NOW)$(SUF)' >> $(TINC); \ - else \ - true; \ - fi - @$(ECHO) '#define _PRODUCTION "$(PROD)"' >> $(TINC) - - -$(OBJDIR)/plvrsion.$(OBJ_SUFFIX): plvrsion.c $(TINC) -ifeq ($(OS_ARCH), WINNT) - $(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) plvrsion.c -else -ifeq ($(MOZ_OS2_TOOLS), VACPP) - $(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) plvrsion.c -else - $(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) plvrsion.c -endif -endif -# -# Version information generation (end) -# - -# -# The Client build wants the shared libraries in $(DIST)/bin, -# so we also install them there. -# - -export:: $(TARGETS) - $(INSTALL) -m 444 $(TARGETS) $(DIST)/lib -ifdef SHARED_LIBRARY -ifeq ($(OS_ARCH),HP-UX) - $(INSTALL) -m 755 $(SHARED_LIBRARY) $(DIST)/lib - $(INSTALL) -m 755 $(SHARED_LIBRARY) $(DIST)/bin -else - $(INSTALL) -m 444 $(SHARED_LIBRARY) $(DIST)/bin -endif -ifeq ($(OS_ARCH), OpenVMS) - $(INSTALL) -m 444 $(SHARED_LIBRARY:.$(DLL_SUFFIX)=.vms) $(DIST)/lib -endif -endif -ifeq ($(MOZ_BITS),16) - $(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/lib - $(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/bin -endif - -install:: export diff --git a/lib/libc/src/Makefile.in b/lib/libc/src/Makefile.in index ffd13253..c7b56c1a 100644 --- a/lib/libc/src/Makefile.in +++ b/lib/libc/src/Makefile.in @@ -26,16 +26,7 @@ include $(MOD_DEPTH)/config/autoconf.mk include $(topsrcdir)/config/config.mk -ifndef USE_AUTOCONF -# Disable optimization of the nspr on SunOS4.1.3 -ifeq ($(OS_ARCH),SunOS) -ifeq ($(OS_RELEASE),4.1.3_U1) -OPTIMIZER = -endif -endif -endif #!USE_AUTOCONF - -INCLUDES = -I$(DIST)/include +INCLUDES = -I$(dist_includedir) CSRCS =\ plvrsion.c \ @@ -55,64 +46,20 @@ CSRCS =\ $(NULL) LIBRARY_NAME = plc -LIBRARY_VERSION = $(MOD_VERSION) +LIBRARY_VERSION = $(MOD_MAJOR_VERSION) RELEASE_LIBS = $(TARGETS) -ifndef USE_AUTOCONF ifeq ($(OS_ARCH),WINNT) -ifeq (,$(filter-out WIN16 OS2,$(OS_TARGET))) -ifdef XP_OS2_EMX -EXTRA_LIBS = -L$(DIST)/lib -lnspr$(MOD_VERSION) -else -EXTRA_LIBS = $(DIST)/lib/nspr$(MOD_VERSION).lib -endif -else DLLBASE=/BASE:0x30000000 RES=$(OBJDIR)/plc.res RESNAME=plc.rc -ifeq ($(OS_TARGET),WIN95) -EXTRA_LIBS = $(DIST)/lib/nspr$(MOD_VERSION).lib -else -EXTRA_LIBS = $(DIST)/lib/libnspr$(MOD_VERSION).lib -endif - -ifdef MOZ_DEBUG -ifdef GLOWCODE -EXTRA_LIBS += $(GLOWDIR)/glowcode.lib -endif -endif - -endif -else -ifeq ($(OS_ARCH), AIX) -ifeq ($(CLASSIC_NSPR),1) -OS_LIBS += -lc -else -OS_LIBS += -lc_r -endif -endif -ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1) -EXTRA_LIBS = -L$(DIST)/lib -lnspr$(MOD_VERSION)_shr -else -EXTRA_LIBS = -L$(DIST)/lib -lnspr$(MOD_VERSION) -endif -endif +endif # WINNT -# On NCR and SCOOS, we can't link with extra libraries when -# we build a shared library. If we do so, the linker doesn't -# complain, but we would run into weird problems at run-time. -# Therefore on these platforms, we link just the .o files. -ifeq ($(OS_ARCH),NCR) -EXTRA_LIBS = -endif -ifeq ($(OS_ARCH),SCOOS) -EXTRA_LIBS = -endif -endif #!USE_AUTOCONF +EXTRA_LIBS = $(LIBNSPR) ifdef RESOLVE_LINK_SYMBOLS -EXTRA_LIBS := -L$(DIST)/lib -lnspr$(MOD_VERSION) +EXTRA_LIBS += $(OS_LIBS) endif GARBAGE += $(TINC) @@ -130,11 +77,7 @@ SH_DATE = $(shell date) SH_NOW = $(shell $(NOW)) ifeq ($(OS_ARCH), WINNT) -ifeq ($(OS_TARGET),OS2) - SUF = -else SUF = i64 -endif else SUF = LL endif @@ -152,34 +95,35 @@ $(TINC): $(OBJDIR)/plvrsion.$(OBJ_SUFFIX): plvrsion.c $(TINC) ifeq ($(OS_ARCH), WINNT) -ifdef XP_OS2_EMX - $(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) $< + $(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $< else +ifeq ($(MOZ_OS2_TOOLS), VACPP) $(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $< -endif else $(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) $< endif +endif # # Version information generation (end) # # -# The Client build wants the shared libraries in $(DIST)/bin, +# The Client build wants the shared libraries in $(dist_bindir), # so we also install them there. # export:: $(TARGETS) - $(INSTALL) -m 444 $(TARGETS) $(DIST)/lib + $(INSTALL) -m 444 $(TARGETS) $(dist_libdir) ifdef SHARED_LIBRARY ifeq ($(OS_ARCH),HP-UX) - $(INSTALL) -m 755 $(SHARED_LIBRARY) $(DIST)/lib - $(INSTALL) -m 755 $(SHARED_LIBRARY) $(DIST)/bin + $(INSTALL) -m 755 $(SHARED_LIBRARY) $(dist_libdir) + $(INSTALL) -m 755 $(SHARED_LIBRARY) $(dist_bindir) else - $(INSTALL) -m 444 $(SHARED_LIBRARY) $(DIST)/bin + $(INSTALL) -m 444 $(SHARED_LIBRARY) $(dist_bindir) endif ifeq ($(OS_ARCH), OpenVMS) - $(INSTALL) -m 444 $(SHARED_LIBRARY:.$(DLL_SUFFIX)=.vms) $(DIST)/lib + $(INSTALL) -m 444 $(SHARED_LIBRARY:.$(DLL_SUFFIX)=.vms) $(dist_libdir) + $(INSTALL) -m 444 $(SHARED_LIBRARY:.$(DLL_SUFFIX)=.vms) $(dist_bindir) endif endif ifeq ($(MOZ_BITS),16) @@ -187,4 +131,3 @@ ifeq ($(MOZ_BITS),16) $(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/bin endif -install:: export diff --git a/lib/libc/src/strccmp.c b/lib/libc/src/strccmp.c index 58ba559c..7d1e620c 100644 --- a/lib/libc/src/strccmp.c +++ b/lib/libc/src/strccmp.c @@ -35,7 +35,23 @@ static const unsigned char uc[] = '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', - 'X', 'Y', 'Z', '{', '|', '}', '~', '\177' + 'X', 'Y', 'Z', '{', '|', '}', '~', '\177', + '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', + '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', + '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', + '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', + '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247', + '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257', + '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267', + '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277', + '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307', + '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317', + '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327', + '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337', + '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', + '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', + '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', + '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377' }; PR_IMPLEMENT(PRIntn) diff --git a/lib/msgc/.cvsignore b/lib/msgc/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/lib/msgc/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/lib/msgc/Makefile b/lib/msgc/Makefile deleted file mode 100644 index 85028460..00000000 --- a/lib/msgc/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -MOD_DEPTH = ../.. - -include $(MOD_DEPTH)/config/config.mk - -DIRS = include src tests - -include $(MOD_DEPTH)/config/rules.mk - -export:: $(TARGETS) - -install:: export diff --git a/lib/msgc/Makefile.in b/lib/msgc/Makefile.in index 317908c0..d0f47c4c 100644 --- a/lib/msgc/Makefile.in +++ b/lib/msgc/Makefile.in @@ -30,4 +30,3 @@ include $(topsrcdir)/config/rules.mk export:: $(TARGETS) -install:: export diff --git a/lib/msgc/include/.cvsignore b/lib/msgc/include/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/lib/msgc/include/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/lib/msgc/include/Makefile b/lib/msgc/include/Makefile deleted file mode 100644 index 6a560871..00000000 --- a/lib/msgc/include/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -#! gmake - -MOD_DEPTH = ../../.. -include $(MOD_DEPTH)/config/config.mk - -EXPORT_HEADERS = prgc.h -HEADERS = $(EXPORT_HEADERS) gcint.h - -RELEASE_HEADERS = $(EXPORT_HEADERS) -RELEASE_HEADERS_DEST = $(RELEASE_INCLUDE_DIR) - -include $(MOD_DEPTH)/config/rules.mk - -export:: $(EXPORT_HEADERS) - $(INSTALL) -m 444 $(EXPORT_HEADERS) $(DIST)/include -ifeq ($(MOZ_BITS),16) - $(INSTALL) -m 444 $(EXPORT_HEADERS) $(MOZ_INCL) -endif - -install:: export diff --git a/lib/msgc/include/Makefile.in b/lib/msgc/include/Makefile.in index 2ed3a284..51514dab 100644 --- a/lib/msgc/include/Makefile.in +++ b/lib/msgc/include/Makefile.in @@ -34,9 +34,8 @@ RELEASE_HEADERS_DEST = $(RELEASE_INCLUDE_DIR) include $(topsrcdir)/config/rules.mk export:: $(EXPORT_HEADERS) - $(INSTALL) -m 444 $(EXPORT_HEADERS) $(DIST)/include + $(INSTALL) -m 444 $(EXPORT_HEADERS) $(dist_includedir) ifeq ($(MOZ_BITS),16) $(INSTALL) -m 444 $(EXPORT_HEADERS) $(MOZ_INCL) endif -install:: export diff --git a/lib/msgc/src/.cvsignore b/lib/msgc/src/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/lib/msgc/src/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/lib/msgc/src/Makefile b/lib/msgc/src/Makefile deleted file mode 100644 index bf1b2d93..00000000 --- a/lib/msgc/src/Makefile +++ /dev/null @@ -1,121 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -#! gmake - -MOD_DEPTH = ../../.. - -include $(MOD_DEPTH)/config/config.mk - -# Disable optimization of the nspr on SunOS4.1.3 -ifeq ($(OS_ARCH),SunOS) -ifeq ($(OS_RELEASE),4.1.3_U1) -OPTIMIZER = -endif -endif - -INCLUDES = -I$(DIST)/include -I../include - -CSRCS = prgcapi.c prmsgc.c - -ifeq ($(OS_ARCH),WINNT) -ifeq ($(OS_TARGET),WIN16) -CSRCS += win16gc.c -else -CSRCS += win32gc.c -endif -else -ifeq ($(OS_ARCH),OS2) -CSRCS += os2gc.c -else -CSRCS += unixgc.c -endif -endif - -NSPR_VERSION = $(MOD_VERSION) - -ifeq ($(OS_ARCH), WINNT) -ifeq ($(OS_TARGET), WIN16) -EXTRA_LIBS = $(DIST)/lib/nspr$(NSPR_VERSION).lib -else -DLLBASE=/BASE:0x30000000 -#RES=$(OBJDIR)/ds.res -#RESNAME=$(MOD_DEPTH)/pr/src/nspr.rc -#OS_LIBS = user32.lib -EXTRA_LIBS = $(DIST)/lib/libnspr$(NSPR_VERSION).lib - -ifdef MOZ_DEBUG -ifdef GLOWCODE -EXTRA_LIBS += $(GLOWDIR)/glowcode.lib -endif -endif -endif - -else -ifeq ($(MOZ_OS2_TOOLS),VACPP) -EXTRA_LIBS = $(DIST)/lib/nspr$(NSPR_VERSION).$(LIB_SUFFIX) - -else -ifeq ($(OS_ARCH), AIX) -ifeq ($(CLASSIC_NSPR),1) -OS_LIBS += -lc -else -OS_LIBS += -lc_r -endif -endif -ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1) -EXTRA_LIBS = -L$(DIST)/lib -lnspr$(NSPR_VERSION)_shr -else -EXTRA_LIBS = -L$(DIST)/lib -lnspr$(NSPR_VERSION) -endif -endif -endif - -# On NCR and SCOOS, we can't link with extra libraries when -# we build a shared library. If we do so, the linker doesn't -# complain, but we would run into weird problems at run-time. -# Therefore on these platforms, we link just the .o files. -ifeq ($(OS_ARCH),NCR) -EXTRA_LIBS = -endif -ifeq ($(OS_ARCH),SCOOS) -EXTRA_LIBS = -endif - -LIBRARY_NAME = msgc -LIBRARY_VERSION = $(MOD_VERSION) - -RELEASE_LIBS = $(TARGETS) - -include $(MOD_DEPTH)/config/rules.mk - -# -# The Client build wants the shared libraries in $(DIST)/bin, -# so we also install them there. -# - -export:: $(TARGETS) - $(INSTALL) -m 444 $(TARGETS) $(DIST)/lib -ifdef SHARED_LIBRARY - $(INSTALL) -m 444 $(SHARED_LIBRARY) $(DIST)/bin -endif -ifeq ($(MOZ_BITS),16) - $(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/lib - $(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/bin -endif - -install:: export diff --git a/lib/msgc/src/Makefile.in b/lib/msgc/src/Makefile.in index d486acc9..685d028d 100644 --- a/lib/msgc/src/Makefile.in +++ b/lib/msgc/src/Makefile.in @@ -26,96 +26,54 @@ include $(MOD_DEPTH)/config/autoconf.mk include $(topsrcdir)/config/config.mk -# Disable optimization of the nspr on SunOS4.1.3 -ifeq ($(OS_ARCH),SunOS) -ifeq ($(OS_RELEASE),4.1.3_U1) -OPTIMIZER = -endif -endif - -INCLUDES = -I$(DIST)/include -I../include +INCLUDES = -I$(dist_includedir) -I../include CSRCS = prgcapi.c prmsgc.c ifeq ($(OS_ARCH),WINNT) -ifeq ($(OS_TARGET),WIN16) -CSRCS += win16gc.c +CSRCS += win32gc.c else -ifeq ($(OS_TARGET),OS2) +ifeq ($(OS_ARCH),OS2) CSRCS += os2gc.c else -CSRCS += win32gc.c -endif -endif -else CSRCS += unixgc.c endif +endif -NSPR_VERSION = $(MOD_VERSION) +NSPR_VERSION = $(MOD_MAJOR_VERSION) + +EXTRA_LIBS = $(LIBNSPR) + +ifdef RESOLVE_LINK_SYMBOLS +EXTRA_LIBS += $(OS_LIBS) +endif ifeq ($(OS_ARCH), WINNT) -ifeq (,$(filter-out WIN16 OS2,$(OS_TARGET))) -EXTRA_LIBS = $(DIST)/lib/nspr$(NSPR_VERSION).lib -else DLLBASE=/BASE:0x30000000 #RES=$(OBJDIR)/ds.res #RESNAME=$(MOD_DEPTH)/pr/src/nspr.rc #OS_LIBS = user32.lib -EXTRA_LIBS = $(DIST)/lib/libnspr$(NSPR_VERSION).lib - -ifdef MOZ_DEBUG -ifdef GLOWCODE -EXTRA_LIBS += $(GLOWDIR)/glowcode.lib -endif -endif - -endif -else -ifeq ($(OS_ARCH), AIX) -ifeq ($(CLASSIC_NSPR),1) -OS_LIBS += -lc -else -OS_LIBS += -lc_r -endif -endif -ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1) -EXTRA_LIBS = -L$(DIST)/lib -lnspr$(NSPR_VERSION)_shr -else -EXTRA_LIBS = -L$(DIST)/lib -lnspr$(NSPR_VERSION) -endif -endif - -# On NCR and SCOOS, we can't link with extra libraries when -# we build a shared library. If we do so, the linker doesn't -# complain, but we would run into weird problems at run-time. -# Therefore on these platforms, we link just the .o files. -ifeq ($(OS_ARCH),NCR) -EXTRA_LIBS = -endif -ifeq ($(OS_ARCH),SCOOS) -EXTRA_LIBS = -endif +endif # WINNT LIBRARY_NAME = msgc -LIBRARY_VERSION = $(MOD_VERSION) +LIBRARY_VERSION = $(MOD_MAJOR_VERSION) RELEASE_LIBS = $(TARGETS) include $(topsrcdir)/config/rules.mk # -# The Client build wants the shared libraries in $(DIST)/bin, +# The Client build wants the shared libraries in $(dist_bindir), # so we also install them there. # export:: $(TARGETS) - $(INSTALL) -m 444 $(TARGETS) $(DIST)/lib + $(INSTALL) -m 444 $(TARGETS) $(dist_libdir) ifdef SHARED_LIBRARY - $(INSTALL) -m 444 $(SHARED_LIBRARY) $(DIST)/bin + $(INSTALL) -m 444 $(SHARED_LIBRARY) $(dist_bindir) endif ifeq ($(MOZ_BITS),16) $(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/lib $(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/bin endif -install:: export diff --git a/lib/msgc/tests/.cvsignore b/lib/msgc/tests/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/lib/msgc/tests/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/lib/msgc/tests/Makefile b/lib/msgc/tests/Makefile deleted file mode 100644 index 6716ead8..00000000 --- a/lib/msgc/tests/Makefile +++ /dev/null @@ -1,290 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -#! gmake - -MOD_DEPTH = ../../.. - -include $(MOD_DEPTH)/config/config.mk - -ifeq ($(OS_TARGET), WIN16) -OS_CFLAGS = $(OS_EXE_CFLAGS) -W16STDIO = $(MOD_DEPTH)/pr/src/md/windows/$(OBJDIR)/w16stdio.$(OBJ_SUFFIX) -endif - -ifeq ($(OS_TARGET), OS2) -OS_CFLAGS = $(OS_EXE_CFLAGS) -endif - -CSRCS = gc1.c thrashgc.c - -ifeq (,$(filter-out WINNT OS2,$(OS_ARCH))) -PROG_SUFFIX = .exe -else -PROG_SUFFIX = -endif - -PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(PROG_SUFFIX))) - -TARGETS = $(PROGS) $(OBJS) - -INCLUDES = -I$(DIST)/include - -# Setting the variables LDOPTS and LIBPR. We first initialize -# them to the default values, then adjust them for some platforms. -LDOPTS = -L$(DIST)/lib -NSPR_VERSION = $(MOD_VERSION) -GC_VERSION = $(MOD_VERSION) -LIBPR = -lnspr$(NSPR_VERSION) -LIBPLC = -lplc$(NSPR_VERSION) -LIBGC = -lmsgc$(GC_VERSION) - -ifeq ($(OS_ARCH), WINNT) -ifeq ($(OS_TARGET), WIN16) - LIBPR = $(DIST)/lib/nspr$(NSPR_VERSION).lib - LIBPLC = $(DIST)/lib/plc$(NSPR_VERSION).lib - LIBGC= $(DIST)/lib/msgc$(GC_VERSION).lib -else - LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO - LIBPR = $(DIST)/lib/libnspr$(NSPR_VERSION).$(LIB_SUFFIX) - LIBPLC = $(DIST)/lib/libplc$(NSPR_VERSION).$(LIB_SUFFIX) - LIBGC= $(DIST)/lib/libmsgc$(GC_VERSION).$(LIB_SUFFIX) -endif -endif - -ifeq ($(OS_ARCH),OS2) -ifeq ($(MOZ_OS2_TOOLS),VACPP) - LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO - LIBPR = $(DIST)/lib/nspr$(NSPR_VERSION).lib - LIBPLC = $(DIST)/lib/plc$(NSPR_VERSION).lib - LIBGC= $(DIST)/lib/msgc$(GC_VERSION).lib -else - LDOPTS += -Zomf -Zlinker /PM:VIO -endif -endif - -ifneq ($(OS_ARCH), WINNT) -PWD = $(shell pwd) -endif - -ifeq ($(OS_ARCH), IRIX) -LDOPTS += -rpath $(PWD)/$(DIST)/lib -rdata_shared - -# For 6.x machines, include this flag -ifeq ($(basename $(OS_RELEASE)),6) -ifeq ($(USE_N32),1) -LDOPTS += -n32 -else -LDOPTS += -32 -endif -endif - -endif - -ifeq ($(OS_ARCH), OSF1) -# I haven't figured out how to pass -rpath to cc on OSF1 V3.2, so -# we do static linking. -ifeq ($(OS_RELEASE), V3.2) - LIBPR = $(DIST)/lib/libnspr$(NSPR_VERSION).a - LIBPLC = $(DIST)/lib/libplc$(NSPR_VERSION).a - LIBGC = $(DIST)/lib/libmsgc$(GC_VERSION).a - EXTRA_LIBS = -lc_r -else - LDOPTS += -rpath $(PWD)/$(DIST)/lib -endif -endif - -ifeq ($(OS_ARCH), HP-UX) -LDOPTS += -z -Wl,+s,+b,$(PWD)/$(DIST)/lib -endif - -# AIX -ifeq ($(OS_ARCH),AIX) -LDOPTS += -blibpath:$(PWD)/$(DIST)/lib:/usr/lib:/lib -ifeq ($(OS_ARCH)$(OS_RELEASE),AIX4.1) -LIBPR = -lnspr$(NSPR_VERSION)_shr -LIBPLC = -lplc$(NSPR_VERSION)_shr -LIBGC = -lmsgc$(GC_VERSION)_shr -else -LDOPTS += -brtl -EXTRA_LIBS = -ldl -endif -endif - -# Solaris -ifeq ($(OS_ARCH), SunOS) -ifneq ($(OS_RELEASE), 4.1.3_U1) -ifdef NS_USE_GCC -LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(DIST)/lib -else -LDOPTS += -R $(PWD)/$(DIST)/lib -endif -endif - -ifneq ($(LOCAL_THREADS_ONLY),1) -# SunOS 5.4 and 5.5 need to link with -lthread or -lpthread, -# even though we already linked with these system libraries -# when we built libnspr.so. -ifeq ($(OS_RELEASE), 5.4) -EXTRA_LIBS = -lthread -endif - -ifeq ($(OS_RELEASE), 5.5) -ifdef USE_PTHREADS -EXTRA_LIBS = -lpthread -else -EXTRA_LIBS = -lthread -endif -endif -endif # LOCAL_THREADS_ONLY -endif # SunOS - -ifeq ($(OS_ARCH),NEC) -EXTRA_LIBS = $(OS_LIBS) -# This hardcodes in the executable programs the directory to find -# libnspr.so etc. at program startup. Equivalent to the -R or -rpath -# option for ld on other platforms. -export LD_RUN_PATH = $(PWD)/$(DIST)/lib -endif - -ifeq ($(OS_ARCH), NCR) -# XXX: We see some strange problems when we link with libnspr.so. -# So for now we use static libraries on NCR. The shared library -# stuff below is commented out. -LIBPR = $(DIST)/lib/libnspr$(NSPR_VERSION).a -LIBPLC = $(DIST)/lib/libplc$(NSPR_VERSION).a -LIBGC = $(DIST)/lib/libmsgc$(GC_VERSION).a -EXTRA_LIBS = -lsocket -lnsl -ldl - -# NCR needs to link against -lsocket -lnsl (and -lc, which is linked -# implicitly by $(CC)) again even though we already linked with these -# system libraries when we built libnspr.so. -#EXTRA_LIBS = -lsocket -lnsl -# This hardcodes in the executable programs the directory to find -# libnspr.so etc. at program startup. Equivalent to the -R or -rpath -# option for ld on other platforms. -#export LD_RUN_PATH = $(PWD)/$(DIST)/lib -endif - -ifeq ($(OS_ARCH), Linux) -ifeq ($(OS_RELEASE), 1.2) -EXTRA_LIBS = -ldl -endif -endif - -ifeq ($(OS_ARCH), SCOOS) -# SCO Unix needs to link against -lsocket again even though we -# already linked with these system libraries when we built libnspr.so. -EXTRA_LIBS = -lsocket -# This hardcodes in the executable programs the directory to find -# libnspr.so etc. at program startup. Equivalent to the -R or -rpath -# option for ld on other platforms. -export LD_RUN_PATH = $(PWD)/$(DIST)/lib -endif - -ifeq ($(OS_ARCH),SINIX) -EXTRA_LIBS = -lsocket -lnsl -lresolv -ldl -# This hardcodes in the executable programs the directory to find -# libnspr.so etc. at program startup. Equivalent to the -R or -rpath -# option for ld on other platforms. -export LD_RUN_PATH = $(PWD)/$(DIST)/lib -endif - -ifeq ($(OS_ARCH), UNIXWARE) -export LD_RUN_PATH = $(PWD)/$(DIST)/lib -endif - -ifeq ($(OS_ARCH),BSD_OS) -EXTRA_LIBS = -ldl -endif - -ifeq ($(OS_ARCH),DGUX) -EXTRA_LIBS = -lsocket -lnsl -ldl -endif - -##################################################### -# -# The rules -# -##################################################### - -include $(MOD_DEPTH)/config/rules.mk - -AIX_PRE_4_2 = 0 -ifeq ($(OS_ARCH),AIX) -ifneq ($(OS_RELEASE),4.2) -ifneq ($(USE_PTHREADS), 1) -#AIX_PRE_4_2 = 1 -endif -endif -endif - -ifeq ($(AIX_PRE_4_2),1) - -# AIX releases prior to 4.2 need a special two-step linking hack -# in order to both override the system select() and be able to -# get at the original system select(). -# -# We use a pattern rule in ns/nspr20/config/rules.mk to generate -# the .$(OBJ_SUFFIX) file from the .c source file, then do the -# two-step linking hack below. - -$(OBJDIR)/%: $(OBJDIR)/%.$(OBJ_SUFFIX) - @$(MAKE_OBJDIR) - rm -f $@ $(AIX_TMP) - $(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(DIST)/lib/libnspr$(NSPR_VERSION).a - $(CC) -o $@ $(AIX_TMP) $(AIX_WRAP) - rm -f $(AIX_TMP) - -else - -# All platforms that are not AIX pre-4.2. - -$(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX) - @$(MAKE_OBJDIR) -ifeq ($(OS_ARCH), WINNT) -ifeq ($(OS_TARGET),WIN16) - echo system windows >w16link - echo name $@ >>w16link - echo option map >>w16link -# echo option CASEEXACT >>w16link - echo option stack=16K >>w16link - echo debug $(DEBUGTYPE) all >>w16link - echo file >>w16link - echo $< , >>w16link - echo $(W16STDIO) >>w16link - echo library >>w16link - echo $(LIBPR), >>w16link - echo $(LIBPLC), >>w16link - echo $(LIBGC), >>w16link - echo winsock.lib >>w16link - wlink @w16link. -else - link $(LDOPTS) $< $(LIBGC) $(LIBPLC) $(LIBPR) wsock32.lib -out:$@ -else -ifeq ($(OS_ARCH),OS2) - $(LINK) $(LDOPTS) $< $(LIBGC) $(LIBPLC) $(LIBPR) $(OS_LIBS) $(EXTRA_LIBS) -o $@ -else - $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBGC) $(LIBPLC) $(LIBPR) $(EXTRA_LIBS) -o $@ -endif -endif -endif - -export:: $(TARGETS) -export:: install -clean:: - rm -f $(TARGETS) diff --git a/lib/msgc/tests/Makefile.in b/lib/msgc/tests/Makefile.in index 6d1e8b42..bd437a79 100644 --- a/lib/msgc/tests/Makefile.in +++ b/lib/msgc/tests/Makefile.in @@ -37,7 +37,7 @@ endif CSRCS = gc1.c thrashgc.c -ifeq ($(OS_ARCH), WINNT) +ifeq (,$(filter-out WINNT OS2,$(OS_ARCH))) PROG_SUFFIX = .exe else PROG_SUFFIX = @@ -47,34 +47,38 @@ PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(PROG_SUFFIX))) TARGETS = $(PROGS) $(OBJS) -INCLUDES = -I$(DIST)/include +INCLUDES = -I$(dist_includedir) # Setting the variables LDOPTS and LIBPR. We first initialize # them to the default values, then adjust them for some platforms. -LDOPTS = -L$(DIST)/lib -NSPR_VERSION = $(MOD_VERSION) -GC_VERSION = $(MOD_VERSION) +LDOPTS = -L$(dist_libdir) +NSPR_VERSION = $(MOD_MAJOR_VERSION) +GC_VERSION = $(MOD_MAJOR_VERSION) LIBPR = -lnspr$(NSPR_VERSION) LIBPLC = -lplc$(NSPR_VERSION) LIBGC = -lmsgc$(GC_VERSION) ifeq ($(OS_ARCH), WINNT) ifeq ($(OS_TARGET), WIN16) - LIBPR = $(DIST)/lib/nspr$(NSPR_VERSION).lib - LIBPLC = $(DIST)/lib/plc$(NSPR_VERSION).lib - LIBGC= $(DIST)/lib/msgc$(GC_VERSION).lib -else -ifeq ($(OS_TARGET),OS2) - LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO - LIBPR = $(DIST)/lib/nspr$(NSPR_VERSION).lib - LIBPLC = $(DIST)/lib/plc$(NSPR_VERSION).lib - LIBGC= $(DIST)/lib/msgc$(GC_VERSION).lib + LIBPR = $(dist_libdir)/nspr$(NSPR_VERSION).lib + LIBPLC = $(dist_libdir)/plc$(NSPR_VERSION).lib + LIBGC= $(dist_libdir)/msgc$(GC_VERSION).lib else LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO - LIBPR = $(DIST)/lib/libnspr$(NSPR_VERSION).$(LIB_SUFFIX) - LIBPLC = $(DIST)/lib/libplc$(NSPR_VERSION).$(LIB_SUFFIX) - LIBGC= $(DIST)/lib/libmsgc$(GC_VERSION).$(LIB_SUFFIX) + LIBPR = $(dist_libdir)/libnspr$(NSPR_VERSION).$(LIB_SUFFIX) + LIBPLC = $(dist_libdir)/libplc$(NSPR_VERSION).$(LIB_SUFFIX) + LIBGC= $(dist_libdir)/libmsgc$(GC_VERSION).$(LIB_SUFFIX) +endif endif + +ifeq ($(OS_ARCH),OS2) +ifeq ($(MOZ_OS2_TOOLS),VACPP) + LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO + LIBPR = $(dist_libdir)/nspr$(NSPR_VERSION).lib + LIBPLC = $(dist_libdir)/plc$(NSPR_VERSION).lib + LIBGC= $(dist_libdir)/msgc$(GC_VERSION).lib +else + LDOPTS += -Zomf -Zlinker /PM:VIO endif endif @@ -83,7 +87,7 @@ PWD = $(shell pwd) endif ifeq ($(OS_ARCH), IRIX) -LDOPTS += -rpath $(PWD)/$(DIST)/lib -rdata_shared +LDOPTS += -rpath $(PWD)/$(dist_libdir) -rdata_shared # For 6.x machines, include this flag ifeq ($(basename $(OS_RELEASE)),6) @@ -100,22 +104,22 @@ ifeq ($(OS_ARCH), OSF1) # I haven't figured out how to pass -rpath to cc on OSF1 V3.2, so # we do static linking. ifeq ($(OS_RELEASE), V3.2) - LIBPR = $(DIST)/lib/libnspr$(NSPR_VERSION).a - LIBPLC = $(DIST)/lib/libplc$(NSPR_VERSION).a - LIBGC = $(DIST)/lib/libmsgc$(GC_VERSION).a + LIBPR = $(dist_libdir)/libnspr$(NSPR_VERSION).a + LIBPLC = $(dist_libdir)/libplc$(NSPR_VERSION).a + LIBGC = $(dist_libdir)/libmsgc$(GC_VERSION).a EXTRA_LIBS = -lc_r else - LDOPTS += -rpath $(PWD)/$(DIST)/lib + LDOPTS += -rpath $(PWD)/$(dist_libdir) endif endif ifeq ($(OS_ARCH), HP-UX) -LDOPTS += -z -Wl,+s,+b,$(PWD)/$(DIST)/lib +LDOPTS += -z -Wl,+s,+b,$(PWD)/$(dist_libdir) endif # AIX ifeq ($(OS_ARCH),AIX) -LDOPTS += -blibpath:$(PWD)/$(DIST)/lib:/usr/lib:/lib +LDOPTS += -blibpath:$(PWD)/$(dist_libdir):/usr/lib:/lib ifeq ($(OS_ARCH)$(OS_RELEASE),AIX4.1) LIBPR = -lnspr$(NSPR_VERSION)_shr LIBPLC = -lplc$(NSPR_VERSION)_shr @@ -130,9 +134,9 @@ endif ifeq ($(OS_ARCH), SunOS) ifneq ($(OS_RELEASE), 4.1.3_U1) ifdef NS_USE_GCC -LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(DIST)/lib +LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(dist_libdir) else -LDOPTS += -R $(PWD)/$(DIST)/lib +LDOPTS += -R $(PWD)/$(dist_libdir) endif endif @@ -159,16 +163,16 @@ EXTRA_LIBS = $(OS_LIBS) # This hardcodes in the executable programs the directory to find # libnspr.so etc. at program startup. Equivalent to the -R or -rpath # option for ld on other platforms. -export LD_RUN_PATH = $(PWD)/$(DIST)/lib +export LD_RUN_PATH = $(PWD)/$(dist_libdir) endif ifeq ($(OS_ARCH), NCR) # XXX: We see some strange problems when we link with libnspr.so. # So for now we use static libraries on NCR. The shared library # stuff below is commented out. -LIBPR = $(DIST)/lib/libnspr$(NSPR_VERSION).a -LIBPLC = $(DIST)/lib/libplc$(NSPR_VERSION).a -LIBGC = $(DIST)/lib/libmsgc$(GC_VERSION).a +LIBPR = $(dist_libdir)/libnspr$(NSPR_VERSION).a +LIBPLC = $(dist_libdir)/libplc$(NSPR_VERSION).a +LIBGC = $(dist_libdir)/libmsgc$(GC_VERSION).a EXTRA_LIBS = -lsocket -lnsl -ldl # NCR needs to link against -lsocket -lnsl (and -lc, which is linked @@ -178,7 +182,7 @@ EXTRA_LIBS = -lsocket -lnsl -ldl # This hardcodes in the executable programs the directory to find # libnspr.so etc. at program startup. Equivalent to the -R or -rpath # option for ld on other platforms. -#export LD_RUN_PATH = $(PWD)/$(DIST)/lib +#export LD_RUN_PATH = $(PWD)/$(dist_libdir) endif ifeq ($(OS_ARCH), Linux) @@ -194,7 +198,7 @@ EXTRA_LIBS = -lsocket # This hardcodes in the executable programs the directory to find # libnspr.so etc. at program startup. Equivalent to the -R or -rpath # option for ld on other platforms. -export LD_RUN_PATH = $(PWD)/$(DIST)/lib +export LD_RUN_PATH = $(PWD)/$(dist_libdir) endif ifeq ($(OS_ARCH),SINIX) @@ -202,11 +206,11 @@ EXTRA_LIBS = -lsocket -lnsl -lresolv -ldl # This hardcodes in the executable programs the directory to find # libnspr.so etc. at program startup. Equivalent to the -R or -rpath # option for ld on other platforms. -export LD_RUN_PATH = $(PWD)/$(DIST)/lib +export LD_RUN_PATH = $(PWD)/$(dist_libdir) endif ifeq ($(OS_ARCH), UNIXWARE) -export LD_RUN_PATH = $(PWD)/$(DIST)/lib +export LD_RUN_PATH = $(PWD)/$(dist_libdir) endif ifeq ($(OS_ARCH),BSD_OS) @@ -247,7 +251,7 @@ ifeq ($(AIX_PRE_4_2),1) $(OBJDIR)/%: $(OBJDIR)/%.$(OBJ_SUFFIX) @$(MAKE_OBJDIR) rm -f $@ $(AIX_TMP) - $(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(DIST)/lib/libnspr$(NSPR_VERSION).a + $(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(dist_libdir)/libnspr$(NSPR_VERSION).a $(CC) -o $@ $(AIX_TMP) $(AIX_WRAP) rm -f $(AIX_TMP) @@ -274,17 +278,15 @@ ifeq ($(OS_TARGET),WIN16) echo $(LIBGC), >>w16link echo winsock.lib >>w16link wlink @w16link. -else -ifeq ($(OS_TARGET),OS2) - $(LINK) $(LDOPTS) $< $(LIBGC) $(LIBPLC) $(LIBPR) so32dll.lib tcp32dll.lib -MAP:$(@:.exe=.map) -out:$@ else link $(LDOPTS) $< $(LIBGC) $(LIBPLC) $(LIBPR) wsock32.lib -out:$@ -endif -endif +else +ifeq ($(OS_ARCH),OS2) + $(LINK) $(LDOPTS) $< $(LIBGC) $(LIBPLC) $(LIBPR) $(OS_LIBS) $(EXTRA_LIBS) -o $@ else $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBGC) $(LIBPLC) $(LIBPR) $(EXTRA_LIBS) -o $@ endif - +endif endif export:: $(TARGETS) diff --git a/lib/prstreams/.cvsignore b/lib/prstreams/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/lib/prstreams/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/lib/prstreams/Makefile b/lib/prstreams/Makefile deleted file mode 100644 index a4718ed1..00000000 --- a/lib/prstreams/Makefile +++ /dev/null @@ -1,199 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -#! gmake - -MOD_DEPTH = ../.. - -include $(MOD_DEPTH)/config/config.mk - -# Disable optimization of the nspr on SunOS4.1.3 -ifeq ($(OS_ARCH),SunOS) - ifeq ($(OS_RELEASE),4.1.3_U1) - OPTIMIZER = - else - # The C++ compiler in Workshop 5.0 uses standard - # iostreams as default. -library=iostream will - # allow Workshop 5.0 to work with classic iostreams. - ifndef NS_USE_GCC - CCC_VERSION := $(shell $(CCC) -V 2>&1) - ifneq (,$(findstring 5.0,$(CCC_VERSION))) - CCC_ONLY_FLAGS += -library=iostream - endif - endif - endif -endif - -ifeq ($(OS_ARCH), IRIX) - ifneq ($(OS_RELEASE),5.3) - CCC_ONLY_FLAGS += -exceptions - endif -endif - -ifeq ($(OS_ARCH), BeOS) - CFLAGS += -frtti -fexceptions -endif - -INCLUDES = -I$(DIST)/include - -HEADERS = $(wildcard *.h) - -CSRCS = \ - plvrsion.c \ - $(NULL) - -CXXSRCS = \ - prstrms.cpp \ - $(NULL) - -OBJS = $(addprefix $(OBJDIR)/,$(CSRCS:.c=.$(OBJ_SUFFIX)) $(CXXSRCS:.cpp=.$(OBJ_SUFFIX))) - -ifeq ($(OS_ARCH), WINNT) - ifeq ($(OS_TARGET), WIN16) - EXTRA_LIBS = $(DIST)/lib/nspr$(MOD_VERSION).lib - else - DLLBASE=/BASE:0x30000000 - RES=$(OBJDIR)/prstrms.res - RESNAME=prstrms.rc - OS_LIBS = user32.lib - ifeq ($(OS_TARGET), WIN95) - EXTRA_LIBS = $(DIST)/lib/nspr$(MOD_VERSION).lib - else - EXTRA_LIBS = $(DIST)/lib/libnspr$(MOD_VERSION).lib - endif - endif -else - ifeq ($(OS_ARCH),OS2) - ifeq ($(MOZ_OS2_TOOLS),VACPP) - EXTRA_LIBS = $(DIST)/lib/nspr$(MOD_VERSION).$(LIB_SUFFIX) - else - EXTRA_LIBS = -L$(DIST)/lib -lnspr$(MOD_VERSION) -lstdcpp - endif - else - ifeq ($(OS_ARCH), AIX) - ifeq ($(OS_RELEASE), 4.1) - ifeq ($(CLASSIC_NSPR),1) - OS_LIBS += -lC -lc - else - OS_LIBS += -lC_r -lc_r - endif - else - # makeC++SharedLib(_r) is in either /usr/lpp/xlC/bin - # or /usr/ibmcxx/bin. - ifeq ($(CLASSIC_NSPR),1) - MKSHLIB = makeC++SharedLib -p 0 - else - MKSHLIB = makeC++SharedLib_r -p 0 - endif - OS_LIBS += -ldl - endif - endif - ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1) - EXTRA_LIBS = -L$(DIST)/lib -lnspr$(MOD_VERSION)_shr - else - EXTRA_LIBS = -L$(DIST)/lib -lnspr$(MOD_VERSION) - endif -endif -endif - -# On NCR and SCOOS, we can't link with extra libraries when -# we build a shared library. If we do so, the linker doesn't -# complain, but we would run into weird problems at run-time. -# Therefore on these platforms, we link just the object files. -ifeq ($(OS_ARCH),NCR) - EXTRA_LIBS = -endif -ifeq ($(OS_ARCH),SCOOS) - EXTRA_LIBS = -endif -ifeq ($(OS_ARCH),BeOS) - EXTRA_LIBS = -lstdc++.r4 -L$(DIST)/lib -lnspr$(MOD_VERSION) -endif - -ifeq ($(OS_ARCH), UNIXWARE) - OS_LIBS += -lC -endif - -LIBRARY_NAME = prstrms -LIBRARY_VERSION = $(MOD_VERSION) - -RELEASE_HEADERS = $(HEADERS) -RELEASE_HEADERS_DEST = $(RELEASE_INCLUDE_DIR) -RELEASE_LIBS = $(TARGETS) - -include $(MOD_DEPTH)/config/rules.mk - -# -# Version information generation (begin) -# -ECHO = echo -TINC = $(OBJDIR)/_pl_bld.h -PROD = $(notdir $(SHARED_LIBRARY)) -NOW = $(MOD_DEPTH)/config/$(OBJDIR)/now -SH_DATE = $(shell date) -SH_NOW = $(shell $(NOW)) - -ifeq ($(OS_ARCH), WINNT) - SUF = i64 -else - SUF = LL -endif - -$(TINC): - @$(MAKE_OBJDIR) - @$(ECHO) '#define _BUILD_STRING "$(SH_DATE)"' > $(TINC) - @if test ! -z "$(SH_NOW)"; then \ - $(ECHO) '#define _BUILD_TIME $(SH_NOW)$(SUF)' >> $(TINC); \ - else \ - true; \ - fi - @$(ECHO) '#define _PRODUCTION "$(PROD)"' >> $(TINC) - - -$(OBJDIR)/plvrsion.$(OBJ_SUFFIX): plvrsion.c $(TINC) -ifeq ($(OS_ARCH), WINNT) - $(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) plvrsion.c -else -ifeq ($(MOZ_OS2_TOOLS), VACPP) - $(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) plvrsion.c -else - $(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) plvrsion.c -endif -endif -# -# Version information generation (end) -# - -export:: $(TARGETS) $(HEADERS) - $(INSTALL) -m 444 $(HEADERS) $(DIST)/include - $(INSTALL) -m 444 $(TARGETS) $(DIST)/lib -ifeq ($(OS_ARCH),OS2) - $(INSTALL) -m 444 $(TARGETS) $(DIST)/bin -endif -ifeq ($(OS_ARCH),HP-UX) -ifdef SHARED_LIBRARY - $(INSTALL) -m 755 $(SHARED_LIBRARY) $(DIST)/lib -endif -endif -ifeq ($(OS_ARCH),OpenVMS) - $(INSTALL) -m 444 $(SHARED_LIBRARY) $(DIST)/lib -ifdef SHARED_LIBRARY - $(INSTALL) -m 444 $(SHARED_LIBRARY:.$(DLL_SUFFIX)=.vms) $(DIST)/lib -endif -endif - -install:: export diff --git a/lib/prstreams/Makefile.in b/lib/prstreams/Makefile.in index 8e64814b..7bfc3358 100644 --- a/lib/prstreams/Makefile.in +++ b/lib/prstreams/Makefile.in @@ -26,36 +26,34 @@ include $(MOD_DEPTH)/config/autoconf.mk include $(topsrcdir)/config/config.mk -ifndef USE_AUTOCONF # Disable optimization of the nspr on SunOS4.1.3 ifeq ($(OS_ARCH),SunOS) ifeq ($(OS_RELEASE),4.1.3_U1) OPTIMIZER = else - # The C++ compiler in Workshop 5.0 uses standard - # iostreams as default. -library=iostream will - # allow Workshop 5.0 to work with classic iostreams. - ifndef NS_USE_GCC - CCC_VERSION := $(shell $(CCC) -V 2>&1) - ifneq (,$(findstring 5.0,$(CCC_VERSION))) - CCC_ONLY_FLAGS += -library=iostream - endif - endif + # The C++ compiler in Workshop 5.0 uses standard + # iostreams as default. -library=iostream will + # allow Workshop 5.0 to work with classic iostreams. + ifndef NS_USE_GCC + CCC_VERSION := $(shell $(CCC) -V 2>&1) + ifneq (,$(findstring 5.0,$(CCC_VERSION))) + CCC_ONLY_FLAGS += -library=iostream + endif + endif endif endif ifeq ($(OS_ARCH), IRIX) ifneq ($(OS_RELEASE),5.3) - CCC_ONLY_FLAGS += -exceptions + CCC_ONLY_FLAGS += -exceptions endif endif ifeq ($(OS_ARCH), BeOS) CFLAGS += -frtti -fexceptions endif -endif # !USE_AUTOCONF -INCLUDES = -I$(DIST)/include +INCLUDES = -I$(dist_includedir) HEADERS = $(wildcard $(srcdir)/*.h) @@ -69,21 +67,19 @@ CXXSRCS = \ OBJS = $(addprefix $(OBJDIR)/,$(CSRCS:.c=.$(OBJ_SUFFIX)) $(CXXSRCS:.cpp=.$(OBJ_SUFFIX))) -ifndef USE_AUTOCONF +LIBRARY_NAME = prstrms +LIBRARY_VERSION = $(MOD_MAJOR_VERSION) + +RELEASE_HEADERS = $(HEADERS) +RELEASE_HEADERS_DEST = $(RELEASE_INCLUDE_DIR) +RELEASE_LIBS = $(TARGETS) + +include $(topsrcdir)/config/rules.mk + ifeq ($(OS_ARCH), WINNT) - ifeq (,$(filter-out WIN16 OS2,$(OS_TARGET))) - EXTRA_LIBS = $(DIST)/lib/nspr$(MOD_VERSION).lib - else - DLLBASE=/BASE:0x30000000 + DLLBASE=/BASE:0x30000000 RES=$(OBJDIR)/prstrms.res RESNAME=prstrms.rc - OS_LIBS = user32.lib - ifeq ($(OS_TARGET), WIN95) - EXTRA_LIBS = $(DIST)/lib/nspr$(MOD_VERSION).lib - else - EXTRA_LIBS = $(DIST)/lib/libnspr$(MOD_VERSION).lib - endif - endif else ifeq ($(OS_ARCH), AIX) ifeq ($(OS_RELEASE), 4.1) @@ -103,11 +99,6 @@ else OS_LIBS += -ldl endif endif - ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1) - EXTRA_LIBS = -L$(DIST)/lib -lnspr$(MOD_VERSION)_shr - else - EXTRA_LIBS = -L$(DIST)/lib -lnspr$(MOD_VERSION) - endif endif # On NCR and SCOOS, we can't link with extra libraries when @@ -121,26 +112,23 @@ ifeq ($(OS_ARCH),SCOOS) EXTRA_LIBS = endif ifeq ($(OS_ARCH),BeOS) - EXTRA_LIBS = -lstdc++.r4 -L$(DIST)/lib -lnspr$(MOD_VERSION) + EXTRA_LIBS = -lstdc++.r4 -L$(dist_libdir) -lnspr$(MOD_MAJOR_VERSION) endif ifeq ($(OS_ARCH), UNIXWARE) OS_LIBS += -lC endif -endif # !USE_AUTOCONF -ifdef RESOLVE_LINK_SYMBOLS -EXTRA_LIBS := -L$(DIST)/lib -lnspr$(MOD_VERSION) +ifeq ($(OS_ARCH),WINNT) +OS_LIBS += user32.lib endif -LIBRARY_NAME = prstrms -LIBRARY_VERSION = $(MOD_VERSION) +EXTRA_LIBS = $(LIBNSPR) -RELEASE_HEADERS = $(HEADERS) -RELEASE_HEADERS_DEST = $(RELEASE_INCLUDE_DIR) -RELEASE_LIBS = $(TARGETS) +ifdef RESOLVE_LINK_SYMBOLS +EXTRA_LIBS += $(OS_LIBS) +endif -include $(topsrcdir)/config/rules.mk # # Version information generation (begin) @@ -153,11 +141,7 @@ SH_DATE = $(shell date) SH_NOW = $(shell $(NOW)) ifeq ($(OS_ARCH), WINNT) -ifeq ($(OS_TARGET),OS2) - SUF = -else SUF = i64 -endif else SUF = LL endif @@ -175,31 +159,34 @@ $(TINC): $(OBJDIR)/plvrsion.$(OBJ_SUFFIX): plvrsion.c $(TINC) ifeq ($(OS_ARCH), WINNT) -ifdef XP_OS2_EMX $(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) $< else +ifeq ($(MOZ_OS2_TOOLS), VACPP) $(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $< -endif else $(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) $< endif +endif # # Version information generation (end) # export:: $(TARGETS) $(HEADERS) - $(INSTALL) -m 444 $(HEADERS) $(DIST)/include - $(INSTALL) -m 444 $(TARGETS) $(DIST)/lib + $(INSTALL) -m 444 $(HEADERS) $(dist_includedir) + $(INSTALL) -m 444 $(TARGETS) $(dist_libdir) +ifeq ($(OS_ARCH),OS2) + $(INSTALL) -m 444 $(TARGETS) $(dist_bindir) +endif ifeq ($(OS_ARCH),HP-UX) ifdef SHARED_LIBRARY - $(INSTALL) -m 755 $(SHARED_LIBRARY) $(DIST)/lib + $(INSTALL) -m 755 $(SHARED_LIBRARY) $(dist_libdir) endif endif ifeq ($(OS_ARCH),OpenVMS) - $(INSTALL) -m 444 $(SHARED_LIBRARY) $(DIST)/lib + $(INSTALL) -m 444 $(SHARED_LIBRARY) $(dist_libdir) ifdef SHARED_LIBRARY - $(INSTALL) -m 444 $(SHARED_LIBRARY:.$(DLL_SUFFIX)=.vms) $(DIST)/lib + $(INSTALL) -m 444 $(SHARED_LIBRARY:.$(DLL_SUFFIX)=.vms) $(dist_libdir) + $(INSTALL) -m 444 $(SHARED_LIBRARY:.$(DLL_SUFFIX)=.vms) $(dist_bindir) endif endif -install:: export diff --git a/lib/prstreams/tests/testprstrm/.cvsignore b/lib/prstreams/tests/testprstrm/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/lib/prstreams/tests/testprstrm/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/lib/prstreams/tests/testprstrm/Makefile b/lib/prstreams/tests/testprstrm/Makefile deleted file mode 100644 index a14e1878..00000000 --- a/lib/prstreams/tests/testprstrm/Makefile +++ /dev/null @@ -1,230 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -#! gmake - -MOD_DEPTH = ../../../.. - -include $(MOD_DEPTH)/config/config.mk - -ifeq ($(OS_TARGET), WIN16) -OS_CFLAGS = $(OS_EXE_CFLAGS) -endif - -CXXSRCS = \ - testprstrm.cpp \ - $(NULL) - -OBJS = $(addprefix $(OBJDIR)/,$(CXXSRCS:.cpp=.$(OBJ_SUFFIX))) - -ifeq (,$(filter-out WINNT OS2,$(OS_ARCH))) -PROG_SUFFIX = .exe -else -PROG_SUFFIX = -endif - -PROGS = $(addprefix $(OBJDIR)/, $(CXXSRCS:.cpp=$(PROG_SUFFIX))) - -TARGETS = $(PROGS) $(OBJS) - -INCLUDES = -I$(DIST)/include - -# Setting the variables LDOPTS and LIBPR. We first initialize -# them to the default values, then adjust them for some platforms. -LDOPTS = -L$(DIST)/lib -LIBPR = -lnspr$(MOD_VERSION) -LIBPRSTRMS = -lprstrms$(MOD_VERSION) - -ifeq ($(OS_ARCH), WINNT) -ifeq ($(OS_TARGET), WIN16) - LIBPR = $(DIST)/lib/nspr$(MOD_VERSION).lib - LIBPRSTRMS = $(DIST)/lib/prstrms$(MOD_VERSION).lib -else - LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO - ifeq ($(OS_TARGET), WIN95) - LIBPR = $(DIST)/lib/nspr$(MOD_VERSION).$(LIB_SUFFIX) - LIBPRSTRMS = $(DIST)/lib/prstrms$(MOD_VERSION).$(LIB_SUFFIX) - else - LIBPR = $(DIST)/lib/libnspr$(MOD_VERSION).$(LIB_SUFFIX) - LIBPRSTRMS = $(DIST)/lib/libprstrms$(MOD_VERSION).$(LIB_SUFFIX) - endif -endif -endif - -ifeq ($(OS_ARCH),OS2) - ifeq ($(MOZ_OS2_TOOLS),VACPP) - LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO /S:32768 - LIBPR = $(DIST)/lib/nspr$(MOD_VERSION).lib - LIBPRSTRMS = $(DIST)/lib/prstrms$(MOD_VERSION).$(LIB_SUFFIX) - else - LDOPTS += -Zomf -Zlinker /PM:VIO -lstdcpp - endif -endif - -ifneq ($(OS_ARCH), WINNT) -PWD = $(shell pwd) -endif - -ifeq ($(OS_ARCH), IRIX) -LDOPTS += -rpath $(PWD)/$(DIST)/lib -endif - -ifeq ($(OS_ARCH), OSF1) -LDOPTS += -rpath $(PWD)/$(DIST)/lib -endif - -ifeq ($(OS_ARCH), HP-UX) -LDOPTS += -Wl,+s,+b,$(PWD)/$(DIST)/lib -endif - -# AIX -ifeq ($(OS_ARCH),AIX) -LDOPTS += -blibpath:$(PWD)/$(DIST)/lib:/usr/lib:/lib -ifeq ($(OS_ARCH)$(OS_RELEASE),AIX4.1) -LIBPR = -lnspr$(MOD_VERSION)_shr -LIBPRSTRMS = -lprstrms$(MOD_VERSION)_shr -else -LDOPTS += -brtl -EXTRA_LIBS = -ldl -endif -endif - -# Solaris -ifeq ($(OS_ARCH), SunOS) -ifneq ($(OS_RELEASE), 4.1.3_U1) -ifdef NS_USE_GCC -LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(DIST)/lib -else -LDOPTS += -R $(PWD)/$(DIST)/lib -# CC on SunOS 5.4 and 5.5.x need to link with -lthread or -lpthread -# (or use the -mt switch) even though we already linked with these -# system libraries when we built libnspr.so. -ifdef USE_PTHREADS -EXTRA_LIBS = -lpthread -else -EXTRA_LIBS = -lthread -endif # USE_PTHREADS -endif # NS_USE_GCC -endif # 4.1.3_U1 -endif # SunOS - -ifeq ($(OS_ARCH), NCR) -# XXX: We see some strange problems when we link with libnspr.so. -# So for now we use static libraries on NCR. The shared library -# stuff below is commented out. -LIBPR = $(DIST)/lib/libnspr$(MOD_VERSION).a -LIBPRSTRMS = $(DIST)/lib/libprstrms$(MOD_VERSION).a -EXTRA_LIBS = -lsocket -lnsl -ldl - -# NCR needs to link against -lsocket -lnsl (and -lc, which is linked -# implicitly by $(CC)) again even though we already linked with these -# system libraries when we built libnspr.so. -#EXTRA_LIBS = -lsocket -lnsl -# This hardcodes in the executable programs the directory to find -# libnspr.so etc. at program startup. Equivalent to the -R or -rpath -# option for ld on other platforms. -#export LD_RUN_PATH = $(PWD)/$(DIST)/lib -endif - -ifeq ($(OS_ARCH), SCOOS) -# SCO Unix needs to link against -lsocket again even though we -# already linked with these system libraries when we built libnspr.so. -EXTRA_LIBS = -lsocket -# This hardcodes in the executable programs the directory to find -# libnspr.so etc. at program startup. Equivalent to the -R or -rpath -# option for ld on other platforms. -export LD_RUN_PATH = $(PWD)/$(DIST)/lib -endif - -ifeq ($(OS_ARCH), UNIXWARE) -export LD_RUN_PATH = $(PWD)/$(DIST)/lib -endif - -##################################################### -# -# The rules -# -##################################################### - -include $(MOD_DEPTH)/config/rules.mk - -AIX_PRE_4_2 = 0 -ifeq ($(OS_ARCH),AIX) -ifneq ($(OS_RELEASE),4.2) -ifneq ($(USE_PTHREADS), 1) -#AIX_PRE_4_2 = 1 -endif -endif -endif - -ifeq ($(AIX_PRE_4_2),1) - -# AIX releases prior to 4.2 need a special two-step linking hack -# in order to both override the system select() and be able to -# get at the original system select(). -# -# We use a pattern rule in ns/nspr20/config/rules.mk to generate -# the .$(OBJ_SUFFIX) file from the .c source file, then do the -# two-step linking hack below. - -$(OBJDIR)/%: $(OBJDIR)/%.$(OBJ_SUFFIX) - @$(MAKE_OBJDIR) - rm -f $@ $(AIX_TMP) - $(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(DIST)/lib/libnspr$(MOD_VERSION).a - $(CC) -o $@ $(AIX_TMP) $(AIX_WRAP) - rm -f $(AIX_TMP) - -else - -# All platforms that are not AIX pre-4.2. - -$(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX) - @$(MAKE_OBJDIR) -ifeq ($(OS_ARCH), WINNT) -ifeq ($(OS_TARGET),WIN16) - echo system windows >w16link - echo option map >>w16link - echo option stack=10K >>w16link - echo option heapsize=32K >>w16link - echo debug $(DEBUGTYPE) all >>w16link - echo name $@ >>w16link - echo file >>w16link - echo $< >>w16link - echo library >>w16link - echo $(LIBPR), >>w16link - echo $(LIBPRSTRMS), >>w16link - echo winsock.lib >>w16link - wlink @w16link. -else - link $(LDOPTS) $< $(LIBPR) $(LIBPRSTRMS) wsock32.lib -out:$@ -endif -else -ifeq ($(OS_ARCH),OS2) - $(LINK) $(EXEFLAGS) $(LDOPTS) $< $(LIBPR) $(LIBPRSTRMS) $(OS_LIBS) $(EXTRA_LIBS) -else - $(CCC) $(XCFLAGS) $< $(LDOPTS) $(LIBPR) $(LIBPRSTRMS) $(EXTRA_LIBS) -o $@ -endif -endif -endif - -export:: $(TARGETS) -install:: export -clean:: - rm -f $(TARGETS) - -testlinker: - echo $(LINK) diff --git a/lib/prstreams/tests/testprstrm/Makefile.in b/lib/prstreams/tests/testprstrm/Makefile.in index d71ab690..8c1f938f 100644 --- a/lib/prstreams/tests/testprstrm/Makefile.in +++ b/lib/prstreams/tests/testprstrm/Makefile.in @@ -36,7 +36,7 @@ CXXSRCS = \ OBJS = $(addprefix $(OBJDIR)/,$(CXXSRCS:.cpp=.$(OBJ_SUFFIX))) -ifeq ($(OS_ARCH), WINNT) +ifeq (,$(filter-out WINNT OS2,$(OS_ARCH))) PROG_SUFFIX = .exe else PROG_SUFFIX = @@ -46,52 +46,62 @@ PROGS = $(addprefix $(OBJDIR)/, $(CXXSRCS:.cpp=$(PROG_SUFFIX))) TARGETS = $(PROGS) $(OBJS) -INCLUDES = -I$(DIST)/include +INCLUDES = -I$(dist_includedir) # Setting the variables LDOPTS and LIBPR. We first initialize # them to the default values, then adjust them for some platforms. -LDOPTS = -L$(DIST)/lib -LIBPR = -lnspr$(MOD_VERSION) -LIBPRSTRMS = -lprstrms$(MOD_VERSION) +LDOPTS = -L$(dist_libdir) +LIBPR = -lnspr$(MOD_MAJOR_VERSION) +LIBPRSTRMS = -lprstrms$(MOD_MAJOR_VERSION) ifeq ($(OS_ARCH), WINNT) ifeq ($(OS_TARGET), WIN16) - LIBPR = $(DIST)/lib/nspr$(MOD_VERSION).lib - LIBPRSTRMS = $(DIST)/lib/prstrms$(MOD_VERSION).lib + LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).lib + LIBPRSTRMS = $(dist_libdir)/prstrms$(MOD_MAJOR_VERSION).lib else LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO ifeq ($(OS_TARGET), WIN95) - LIBPR = $(DIST)/lib/nspr$(MOD_VERSION).$(LIB_SUFFIX) - LIBPRSTRMS = $(DIST)/lib/prstrms$(MOD_VERSION).$(LIB_SUFFIX) + LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX) + LIBPRSTRMS = $(dist_libdir)/prstrms$(MOD_MAJOR_VERSION).$(LIB_SUFFIX) else - LIBPR = $(DIST)/lib/libnspr$(MOD_VERSION).$(LIB_SUFFIX) - LIBPRSTRMS = $(DIST)/lib/libprstrms$(MOD_VERSION).$(LIB_SUFFIX) + LIBPR = $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX) + LIBPRSTRMS = $(dist_libdir)/libprstrms$(MOD_MAJOR_VERSION).$(LIB_SUFFIX) endif endif endif +ifeq ($(OS_ARCH),OS2) + ifeq ($(MOZ_OS2_TOOLS),VACPP) + LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO /S:32768 + LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).lib + LIBPRSTRMS = $(dist_libdir)/prstrms$(MOD_MAJOR_VERSION).$(LIB_SUFFIX) + else + LDOPTS += -Zomf -Zlinker /PM:VIO -lstdcpp + endif +endif + ifneq ($(OS_ARCH), WINNT) PWD = $(shell pwd) endif ifeq ($(OS_ARCH), IRIX) -LDOPTS += -rpath $(PWD)/$(DIST)/lib +LDOPTS += -rpath $(PWD)/$(dist_libdir) endif ifeq ($(OS_ARCH), OSF1) -LDOPTS += -rpath $(PWD)/$(DIST)/lib +LDOPTS += -rpath $(PWD)/$(dist_libdir) endif ifeq ($(OS_ARCH), HP-UX) -LDOPTS += -Wl,+s,+b,$(PWD)/$(DIST)/lib +LDOPTS += -Wl,+s,+b,$(PWD)/$(dist_libdir) endif # AIX ifeq ($(OS_ARCH),AIX) -LDOPTS += -blibpath:$(PWD)/$(DIST)/lib:/usr/lib:/lib +LDOPTS += -blibpath:$(PWD)/$(dist_libdir):/usr/lib:/lib ifeq ($(OS_ARCH)$(OS_RELEASE),AIX4.1) -LIBPR = -lnspr$(MOD_VERSION)_shr -LIBPRSTRMS = -lprstrms$(MOD_VERSION)_shr +LIBPR = -lnspr$(MOD_MAJOR_VERSION)_shr +LIBPRSTRMS = -lprstrms$(MOD_MAJOR_VERSION)_shr else LDOPTS += -brtl EXTRA_LIBS = -ldl @@ -102,9 +112,9 @@ endif ifeq ($(OS_ARCH), SunOS) ifneq ($(OS_RELEASE), 4.1.3_U1) ifdef NS_USE_GCC -LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(DIST)/lib +LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(dist_libdir) else -LDOPTS += -R $(PWD)/$(DIST)/lib +LDOPTS += -R $(PWD)/$(dist_libdir) # CC on SunOS 5.4 and 5.5.x need to link with -lthread or -lpthread # (or use the -mt switch) even though we already linked with these # system libraries when we built libnspr.so. @@ -121,8 +131,8 @@ ifeq ($(OS_ARCH), NCR) # XXX: We see some strange problems when we link with libnspr.so. # So for now we use static libraries on NCR. The shared library # stuff below is commented out. -LIBPR = $(DIST)/lib/libnspr$(MOD_VERSION).a -LIBPRSTRMS = $(DIST)/lib/libprstrms$(MOD_VERSION).a +LIBPR = $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).a +LIBPRSTRMS = $(dist_libdir)/libprstrms$(MOD_MAJOR_VERSION).a EXTRA_LIBS = -lsocket -lnsl -ldl # NCR needs to link against -lsocket -lnsl (and -lc, which is linked @@ -132,7 +142,7 @@ EXTRA_LIBS = -lsocket -lnsl -ldl # This hardcodes in the executable programs the directory to find # libnspr.so etc. at program startup. Equivalent to the -R or -rpath # option for ld on other platforms. -#export LD_RUN_PATH = $(PWD)/$(DIST)/lib +#export LD_RUN_PATH = $(PWD)/$(dist_libdir) endif ifeq ($(OS_ARCH), SCOOS) @@ -142,11 +152,11 @@ EXTRA_LIBS = -lsocket # This hardcodes in the executable programs the directory to find # libnspr.so etc. at program startup. Equivalent to the -R or -rpath # option for ld on other platforms. -export LD_RUN_PATH = $(PWD)/$(DIST)/lib +export LD_RUN_PATH = $(PWD)/$(dist_libdir) endif ifeq ($(OS_ARCH), UNIXWARE) -export LD_RUN_PATH = $(PWD)/$(DIST)/lib +export LD_RUN_PATH = $(PWD)/$(dist_libdir) endif ##################################################### @@ -179,7 +189,7 @@ ifeq ($(AIX_PRE_4_2),1) $(OBJDIR)/%: $(OBJDIR)/%.$(OBJ_SUFFIX) @$(MAKE_OBJDIR) rm -f $@ $(AIX_TMP) - $(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(DIST)/lib/libnspr$(MOD_VERSION).a + $(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).a $(CC) -o $@ $(AIX_TMP) $(AIX_WRAP) rm -f $(AIX_TMP) @@ -207,13 +217,18 @@ ifeq ($(OS_TARGET),WIN16) else link $(LDOPTS) $< $(LIBPR) $(LIBPRSTRMS) wsock32.lib -out:$@ endif +else +ifeq ($(OS_ARCH),OS2) + $(LINK) $(EXEFLAGS) $(LDOPTS) $< $(LIBPR) $(LIBPRSTRMS) $(OS_LIBS) $(EXTRA_LIBS) else $(CCC) $(XCFLAGS) $< $(LDOPTS) $(LIBPR) $(LIBPRSTRMS) $(EXTRA_LIBS) -o $@ endif - +endif endif export:: $(TARGETS) -install:: export clean:: rm -f $(TARGETS) + +testlinker: + echo $(LINK) diff --git a/lib/tests/.cvsignore b/lib/tests/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/lib/tests/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/lib/tests/Makefile b/lib/tests/Makefile deleted file mode 100644 index 5cafffa3..00000000 --- a/lib/tests/Makefile +++ /dev/null @@ -1,235 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -#! gmake - -MOD_DEPTH = ../.. - -include $(MOD_DEPTH)/config/config.mk - -ifeq ($(OS_ARCH), WINNT) -DIRS = windows -endif - -ifeq ($(OS_TARGET), WIN16) -OS_CFLAGS = $(OS_EXE_CFLAGS) -endif - -CSRCS = \ - string.c \ - event.c \ - base64t.c - -ifeq (,$(filter-out WINNT OS2,$(OS_ARCH))) -CSRCS += arena.c -endif - -ifeq (,$(filter-out WINNT OS2,$(OS_ARCH))) -PROG_SUFFIX = .exe -else -PROG_SUFFIX = -endif - -PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(PROG_SUFFIX))) - -TARGETS = $(PROGS) $(OBJS) - -INCLUDES = -I$(DIST)/include - -# Setting the variables LDOPTS and LIBPR. We first initialize -# them to the default values, then adjust them for some platforms. -LDOPTS = -L$(DIST)/lib -LIBPR = -lnspr$(MOD_VERSION) -LIBPLC = -lplc$(MOD_VERSION) -LIBPLDS = -lplds$(MOD_VERSION) - -ifeq ($(OS_ARCH), WINNT) -ifeq ($(OS_TARGET), WIN16) - LIBPR = $(DIST)/lib/nspr$(MOD_VERSION).lib - LIBPLC= $(DIST)/lib/plc$(MOD_VERSION).lib - LIBPLDS= $(DIST)/lib/plds$(MOD_VERSION).lib -else - LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO - ifeq ($(OS_TARGET), WIN95) - LIBPR = $(DIST)/lib/nspr$(MOD_VERSION).$(LIB_SUFFIX) - LIBPLC= $(DIST)/lib/plc$(MOD_VERSION).$(LIB_SUFFIX) - LIBPLDS= $(DIST)/lib/plds$(MOD_VERSION).$(LIB_SUFFIX) - else - LIBPR = $(DIST)/lib/libnspr$(MOD_VERSION).$(LIB_SUFFIX) - LIBPLC= $(DIST)/lib/libplc$(MOD_VERSION).$(LIB_SUFFIX) - LIBPLDS= $(DIST)/lib/libplds$(MOD_VERSION).$(LIB_SUFFIX) - endif -endif -endif - -ifeq ($(OS_ARCH),OS2) - ifeq ($(MOZ_OS2_TOOLS),VACPP) - LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO /S:32768 - LIBPR = $(DIST)/lib/nspr$(MOD_VERSION).lib - LIBPLC = $(DIST)/lib/plc$(MOD_VERSION).lib - LIBPLDS= $(DIST)/lib/plds$(MOD_VERSION).$(LIB_SUFFIX) - else - LDOPTS += -Zomf -Zlinker /PM:VIO - endif -endif - -ifneq ($(OS_ARCH), WINNT) -PWD = $(shell pwd) -endif - -ifeq ($(OS_ARCH), IRIX) -LDOPTS += -rpath $(PWD)/$(DIST)/lib -endif - -ifeq ($(OS_ARCH), Linux) - ifeq ($(OS_RELEASE), 1.2) - EXTRA_LIBS = -ldl - else - LDOPTS += -Xlinker -rpath $(PWD)/$(DIST)/lib - ifeq ($(USE_PTHREADS),1) - EXTRA_LIBS = -lpthread - endif - endif -endif - -ifeq ($(OS_ARCH), OSF1) -LDOPTS += -rpath $(PWD)/$(DIST)/lib -lpthread -endif - -ifeq ($(OS_ARCH), HP-UX) -LDOPTS += -Wl,+s,+b,$(PWD)/$(DIST)/lib -endif - -# AIX -ifeq ($(OS_ARCH),AIX) -LDOPTS += -blibpath:$(PWD)/$(DIST)/lib:/usr/lib:/lib -LIBPR = -lnspr$(MOD_VERSION)_shr -LIBPLC = -lplc$(MOD_VERSION)_shr -endif - -# Solaris -ifeq ($(OS_ARCH), SunOS) -ifneq ($(OS_RELEASE), 4.1.3_U1) -ifdef NS_USE_GCC -LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(DIST)/lib -else -LDOPTS += -R $(PWD)/$(DIST)/lib -endif -endif - -# SunOS 5.4 and 5.5 need to link with -lthread or -lpthread, -# even though we already linked with these system libraries -# when we built libnspr.so. -ifeq ($(OS_RELEASE), 5.4) -EXTRA_LIBS = -lthread -endif - -ifeq ($(OS_RELEASE), 5.5) -ifdef USE_PTHREADS -EXTRA_LIBS = -lpthread -else -EXTRA_LIBS = -lthread -endif -endif -endif # SunOS - -ifeq ($(OS_ARCH), NCR) -# NCR needs to link against -lsocket -lnsl (and -lc, which is linked -# implicitly by $(CC)) again even though we already linked with these -# system libraries when we built libnspr.so. -EXTRA_LIBS = -lsocket -lnsl -# This hardcodes in the executable programs the directory to find -# libnspr.so etc. at program startup. Equivalent to the -R or -rpath -# option for ld on other platforms. -export LD_RUN_PATH = $(PWD)/$(DIST)/lib -endif - -##################################################### -# -# The rules -# -##################################################### - -include $(MOD_DEPTH)/config/rules.mk - -AIX_PRE_4_2 = 0 -ifeq ($(OS_ARCH),AIX) -ifneq ($(OS_RELEASE),4.2) -ifneq ($(USE_PTHREADS), 1) -#AIX_PRE_4_2 = 1 -endif -endif -endif - -ifeq ($(AIX_PRE_4_2),1) - -# AIX releases prior to 4.2 need a special two-step linking hack -# in order to both override the system select() and be able to -# get at the original system select(). -# -# We use a pattern rule in ns/nspr20/config/rules.mk to generate -# the .$(OBJ_SUFFIX) file from the .c source file, then do the -# two-step linking hack below. - -$(OBJDIR)/%: $(OBJDIR)/%.$(OBJ_SUFFIX) - @$(MAKE_OBJDIR) - rm -f $@ $(AIX_TMP) - $(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(DIST)/lib/libnspr$(MOD_VERSION).a - $(CC) -o $@ $(AIX_TMP) $(AIX_WRAP) - rm -f $(AIX_TMP) - -else - -# All platforms that are not AIX pre-4.2. - -$(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX) - @$(MAKE_OBJDIR) - -ifeq ($(OS_ARCH), WINNT) -ifeq ($(OS_TARGET),WIN16) - echo system windows >w16link - echo option map >>w16link - echo option stack=10K >>w16link - echo option heapsize=32K >>w16link - echo debug $(DEBUGTYPE) all >>w16link - echo name $@ >>w16link - echo file >>w16link - echo $< >>w16link - echo library >>w16link - echo $(LIBPR), >>w16link - echo $(LIBPLC), >>w16link - echo winsock.lib >>w16link - wlink @w16link. -else - link $(LDOPTS) $< $(LIBPLC) $(LIBPLDS) $(LIBPR) wsock32.lib -out:$@ -endif -else -ifeq ($(OS_ARCH),OS2) - $(LINK) $(EXEFLAGS) $(LDOPTS) $< $(LIBPLC) $(LIBPLDS) $(LIBPR) $(OS_LIBS) $(EXTRA_LIBS) -else - $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPLDS) $(LIBPR) $(EXTRA_LIBS) -o $@ -endif -endif -endif - -export:: $(TARGETS) -install:: export -clean:: - rm -f $(TARGETS) - - - diff --git a/lib/tests/Makefile.in b/lib/tests/Makefile.in index a2c8bb36..99b86089 100644 --- a/lib/tests/Makefile.in +++ b/lib/tests/Makefile.in @@ -39,7 +39,11 @@ CSRCS = \ event.c \ base64t.c -ifeq ($(OS_ARCH), WINNT) +ifeq (,$(filter-out WINNT OS2,$(OS_ARCH))) +CSRCS += arena.c +endif + +ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)) PROG_SUFFIX = .exe else PROG_SUFFIX = @@ -49,47 +53,58 @@ PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(PROG_SUFFIX))) TARGETS = $(PROGS) $(OBJS) -INCLUDES = -I$(DIST)/include +INCLUDES = -I$(dist_includedir) # Setting the variables LDOPTS and LIBPR. We first initialize # them to the default values, then adjust them for some platforms. -LDOPTS = -L$(DIST)/lib -LIBPR = -lnspr$(MOD_VERSION) -LIBPLC = -lplc$(MOD_VERSION) -LIBPLDS = -lplds$(MOD_VERSION) +LDOPTS = -L$(dist_libdir) +LIBPR = -lnspr$(MOD_MAJOR_VERSION) +LIBPLC = -lplc$(MOD_MAJOR_VERSION) +LIBPLDS = -lplds$(MOD_MAJOR_VERSION) ifeq ($(OS_ARCH), WINNT) ifeq ($(OS_TARGET), WIN16) - LIBPR = $(DIST)/lib/nspr$(MOD_VERSION).lib - LIBPLC= $(DIST)/lib/plc$(MOD_VERSION).lib - LIBPLDS= $(DIST)/lib/plds$(MOD_VERSION).lib + LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).lib + LIBPLC= $(dist_libdir)/plc$(MOD_MAJOR_VERSION).lib + LIBPLDS= $(dist_libdir)/plds$(MOD_MAJOR_VERSION).lib else LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO ifeq ($(OS_TARGET), WIN95) - LIBPR = $(DIST)/lib/nspr$(MOD_VERSION).$(LIB_SUFFIX) - LIBPLC= $(DIST)/lib/plc$(MOD_VERSION).$(LIB_SUFFIX) - LIBPLDS= $(DIST)/lib/plds$(MOD_VERSION).$(LIB_SUFFIX) + LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX) + LIBPLC= $(dist_libdir)/plc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX) + LIBPLDS= $(dist_libdir)/plds$(MOD_MAJOR_VERSION).$(LIB_SUFFIX) else - LIBPR = $(DIST)/lib/libnspr$(MOD_VERSION).$(LIB_SUFFIX) - LIBPLC= $(DIST)/lib/libplc$(MOD_VERSION).$(LIB_SUFFIX) - LIBPLDS= $(DIST)/lib/libplds$(MOD_VERSION).$(LIB_SUFFIX) + LIBPR = $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX) + LIBPLC= $(dist_libdir)/libplc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX) + LIBPLDS= $(dist_libdir)/libplds$(MOD_MAJOR_VERSION).$(LIB_SUFFIX) endif endif endif +ifeq ($(OS_ARCH),OS2) + ifeq ($(MOZ_OS2_TOOLS),VACPP) + LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO /S:32768 + LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).lib + LIBPLC = $(dist_libdir)/plc$(MOD_MAJOR_VERSION).lib + LIBPLDS= $(dist_libdir)/plds$(MOD_MAJOR_VERSION).$(LIB_SUFFIX) + else + LDOPTS += -Zomf -Zlinker /PM:VIO + endif +endif + ifneq ($(OS_ARCH), WINNT) PWD = $(shell pwd) endif ifeq ($(OS_ARCH), IRIX) -LDOPTS += -rpath $(PWD)/$(DIST)/lib +LDOPTS += -rpath $(PWD)/$(dist_libdir) endif ifeq ($(OS_ARCH), Linux) ifeq ($(OS_RELEASE), 1.2) EXTRA_LIBS = -ldl else - LDOPTS += -Xlinker -rpath $(PWD)/$(DIST)/lib + LDOPTS += -Xlinker -rpath $(PWD)/$(dist_libdir) ifeq ($(USE_PTHREADS),1) EXTRA_LIBS = -lpthread endif @@ -97,27 +112,27 @@ ifeq ($(OS_ARCH), Linux) endif ifeq ($(OS_ARCH), OSF1) -LDOPTS += -rpath $(PWD)/$(DIST)/lib -lpthread +LDOPTS += -rpath $(PWD)/$(dist_libdir) -lpthread endif ifeq ($(OS_ARCH), HP-UX) -LDOPTS += -Wl,+s,+b,$(PWD)/$(DIST)/lib +LDOPTS += -Wl,+s,+b,$(PWD)/$(dist_libdir) endif # AIX ifeq ($(OS_ARCH),AIX) -LDOPTS += -blibpath:$(PWD)/$(DIST)/lib:/usr/lib:/lib -LIBPR = -lnspr$(MOD_VERSION)_shr -LIBPLC = -lplc$(MOD_VERSION)_shr +LDOPTS += -blibpath:$(PWD)/$(dist_libdir):/usr/lib:/lib +LIBPR = -lnspr$(MOD_MAJOR_VERSION)_shr +LIBPLC = -lplc$(MOD_MAJOR_VERSION)_shr endif # Solaris ifeq ($(OS_ARCH), SunOS) ifneq ($(OS_RELEASE), 4.1.3_U1) ifdef NS_USE_GCC -LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(DIST)/lib +LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(dist_libdir) else -LDOPTS += -R $(PWD)/$(DIST)/lib +LDOPTS += -R $(PWD)/$(dist_libdir) endif endif @@ -145,7 +160,7 @@ EXTRA_LIBS = -lsocket -lnsl # This hardcodes in the executable programs the directory to find # libnspr.so etc. at program startup. Equivalent to the -R or -rpath # option for ld on other platforms. -export LD_RUN_PATH = $(PWD)/$(DIST)/lib +export LD_RUN_PATH = $(PWD)/$(dist_libdir) endif ##################################################### @@ -178,7 +193,7 @@ ifeq ($(AIX_PRE_4_2),1) $(OBJDIR)/%: $(OBJDIR)/%.$(OBJ_SUFFIX) @$(MAKE_OBJDIR) rm -f $@ $(AIX_TMP) - $(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(DIST)/lib/libnspr$(MOD_VERSION).a + $(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).a $(CC) -o $@ $(AIX_TMP) $(AIX_WRAP) rm -f $(AIX_TMP) @@ -207,14 +222,16 @@ ifeq ($(OS_TARGET),WIN16) else link $(LDOPTS) $< $(LIBPLC) $(LIBPLDS) $(LIBPR) wsock32.lib -out:$@ endif +else +ifeq ($(OS_ARCH),OS2) + $(LINK) $(EXEFLAGS) $(LDOPTS) $< $(LIBPLC) $(LIBPLDS) $(LIBPR) $(OS_LIBS) $(EXTRA_LIBS) else $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPLDS) $(LIBPR) $(EXTRA_LIBS) -o $@ endif - +endif endif export:: $(TARGETS) -install:: export clean:: rm -f $(TARGETS) diff --git a/macbuild/NSPR20PPC.mcp b/macbuild/NSPR20PPC.mcp index fa75d4da..a0a17543 100644 Binary files a/macbuild/NSPR20PPC.mcp and b/macbuild/NSPR20PPC.mcp differ diff --git a/macbuild/NSPRCarbon.Prefix b/macbuild/NSPRCarbon.Prefix new file mode 100644 index 00000000..d36f5663 --- /dev/null +++ b/macbuild/NSPRCarbon.Prefix @@ -0,0 +1,11 @@ +// +// NSPR.Prefix +// +// Global prefix file for the non-debug NSPR project. +// +// + + +#include "NSPRConfig.h" + +#define TARGET_CARBON 1 diff --git a/macbuild/NSPRCarbonDebug.Prefix b/macbuild/NSPRCarbonDebug.Prefix new file mode 100644 index 00000000..4a67d9ef --- /dev/null +++ b/macbuild/NSPRCarbonDebug.Prefix @@ -0,0 +1,12 @@ +// +// NSPR.Prefix +// +// Global prefix file for the debug NSPR project. +// +// + + +#define DEBUG 1 +#define DEVELOPER_DEBUG 1 +#include "NSPRConfig.h" +#define TARGET_CARBON 1 diff --git a/macbuild/NSPRConfig.h b/macbuild/NSPRConfig.h index 07a9783f..d63e59b9 100644 --- a/macbuild/NSPRConfig.h +++ b/macbuild/NSPRConfig.h @@ -24,4 +24,3 @@ #define FORCE_PR_LOG 1 #define NSPR20 1 #define NSPR_AS_SHARED_LIB - diff --git a/makefile.win b/makefile.win deleted file mode 100644 index 5948366b..00000000 --- a/makefile.win +++ /dev/null @@ -1,105 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -# -# An NMAKE file to set up and adjust NSPR20's build system for -# Client build. Client build should invoke NMAKE on this file -# instead of invoking gmake directly. -# - -DEPTH = .. -include <$(DEPTH)\config\config.mak> - -# -# Backslashes are escape characters to gmake, so flip all backslashes -# in $(MOZ_TOOLS) to forward slashes and pass that to gmake. -# - -GMAKE = $(MOZ_TOOLS)\bin\gmake.exe - -GMAKE_FLAGS = MOZ_TOOLS_FLIPPED=$(MOZ_TOOLS:\=/) PR_CLIENT_BUILD=1 PR_CLIENT_BUILD_WINDOWS=1 - -# -# The Client's debug build uses MSVC's debug runtime library (/MDd). -# - -!ifdef MOZ_DEBUG -!else -GMAKE_FLAGS = $(GMAKE_FLAGS) BUILD_OPT=1 -!endif - -!if "$(MOZ_BITS)" == "16" -GMAKE_FLAGS = $(GMAKE_FLAGS) OS_TARGET=WIN16 -!else - -GMAKE_FLAGS = $(GMAKE_FLAGS) OS_TARGET=WIN95 -!ifdef MOZ_DEBUG -!ifdef MOZ_NO_DEBUG_RTL -!IF "$(CPU)" == "ALPHA" -PR_OBJDIR = WIN954.0ALPHA_DBG.OBJ -!else -PR_OBJDIR = WIN954.0_DBG.OBJ -!endif -!else -GMAKE_FLAGS = $(GMAKE_FLAGS) USE_DEBUG_RTL=1 -!IF "$(CPU)" == "ALPHA" -PR_OBJDIR = WIN954.0ALPHA_DBG.OBJD -!else -PR_OBJDIR = WIN954.0_DBG.OBJD -!endif -!endif -!else -!IF "$(CPU)" == "ALPHA" -PR_OBJDIR = WIN954.0ALPHA_OPT.OBJ -!else -PR_OBJDIR = WIN954.0_OPT.OBJ -!endif -!endif - -!endif - - -# -# The rules. Simply invoke gmake with the same target. -# The default target is 'all'. For Win16, set up the -# environment to use the Watcom compiler, Watcom headers, -# and Watcom libs. -# - -all:: export libs install - -export libs install clobber clobber_all clean depend:: -!if "$(MOZ_BITS)" == "16" - set PATH=%WATCPATH% - set INCLUDE=%WATC_INC% - set LIB=%WATC_LIB% -!endif - $(GMAKE) $(GMAKE_FLAGS) $@ -!if "$(MOZ_BITS)" == "16" - set PATH=%MSVCPATH% - set INCLUDE=%MSVC_INC% - set LIB=%MSVC_LIB% -!endif - -!if "$(MOZ_BITS)" != "16" -export:: - $(MAKE_INSTALL) $(XPDIST)\$(PR_OBJDIR)\include\*.h $(DIST)\include - $(MAKE_INSTALL) $(XPDIST)\$(PR_OBJDIR)\include\obsolete\*.h $(DIST)\include\obsolete - $(MAKE_INSTALL) $(XPDIST)\$(PR_OBJDIR)\include\private\*.h $(DIST)\include\private - $(MAKE_INSTALL) $(XPDIST)\$(PR_OBJDIR)\lib\*.lib $(DIST)\lib - $(MAKE_INSTALL) $(XPDIST)\$(PR_OBJDIR)\lib\*.dll $(DIST)\bin -!endif diff --git a/pr/.cvsignore b/pr/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/pr/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/pr/Makefile b/pr/Makefile deleted file mode 100644 index d56a49bd..00000000 --- a/pr/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -#! gmake - -MOD_DEPTH = .. - -DIRS = include src - -include $(MOD_DEPTH)/config/rules.mk diff --git a/pr/include/.cvsignore b/pr/include/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/pr/include/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/pr/include/Makefile b/pr/include/Makefile deleted file mode 100644 index 92fd718a..00000000 --- a/pr/include/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -#! gmake - -MOD_DEPTH = ../.. - -DIRS = md private obsolete - -include $(MOD_DEPTH)/config/config.mk - -HEADERS = $(wildcard *.h) - -RELEASE_HEADERS = $(HEADERS) -RELEASE_HEADERS_DEST = $(RELEASE_INCLUDE_DIR) - -include $(MOD_DEPTH)/config/rules.mk - -export:: $(RELEASE_HEADERS) - $(INSTALL) -m 444 $(RELEASE_HEADERS) $(DIST)/include -ifeq ($(MOZ_BITS),16) - $(INSTALL) -m 444 $(RELEASE_HEADERS) $(MOZ_INCL) -endif diff --git a/pr/include/Makefile.in b/pr/include/Makefile.in index d3f4a846..7ef8196f 100644 --- a/pr/include/Makefile.in +++ b/pr/include/Makefile.in @@ -36,7 +36,4 @@ RELEASE_HEADERS_DEST = $(RELEASE_INCLUDE_DIR) include $(topsrcdir)/config/rules.mk export:: $(RELEASE_HEADERS) - $(INSTALL) -m 444 $(RELEASE_HEADERS) $(DIST)/include -ifeq ($(MOZ_BITS),16) - $(INSTALL) -m 444 $(RELEASE_HEADERS) $(MOZ_INCL) -endif + $(INSTALL) -m 444 $(RELEASE_HEADERS) $(dist_includedir) diff --git a/pr/include/md/.cvsignore b/pr/include/md/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/pr/include/md/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/pr/include/md/Makefile b/pr/include/md/Makefile deleted file mode 100644 index 08b0efc7..00000000 --- a/pr/include/md/Makefile +++ /dev/null @@ -1,189 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -#! gmake - -MOD_DEPTH = ../../.. - -HEADERS = $(wildcard *.h) - -include $(MOD_DEPTH)/config/rules.mk - -ifeq ($(OS_ARCH),IRIX) -ifeq ($(USE_64), 1) -MDCPUCFG_H = _irix64.cfg -else -MDCPUCFG_H = _irix32.cfg -endif -endif - -ifeq ($(OS_ARCH),WINNT) -ifeq ($(OS_TARGET), WIN95) -MDCPUCFG_H = _win95.cfg -else -ifeq ($(OS_TARGET), WIN16) -MDCPUCFG_H = _win16.cfg -else -MDCPUCFG_H = _winnt.cfg -endif -endif -endif - -ifeq ($(OS_ARCH),OS2) -MDCPUCFG_H = _os2.cfg -endif - -ifeq ($(OS_ARCH),AIX) -ifeq ($(USE_64),1) -MDCPUCFG_H = _aix64.cfg -else -ifeq ($(USE_IPV6),1) -MDCPUCFG_H = _aix32in6.cfg -else -MDCPUCFG_H = _aix32.cfg -endif -endif -endif - -ifeq ($(OS_ARCH),BSD_OS) -MDCPUCFG_H = _bsdi.cfg -endif - -ifeq ($(OS_ARCH),FreeBSD) -MDCPUCFG_H = _freebsd.cfg -endif - -ifeq ($(OS_ARCH),OpenBSD) -MDCPUCFG_H = _openbsd.cfg -endif - -ifeq ($(OS_ARCH),OpenVMS) -MDCPUCFG_H = _openvms.cfg -endif - -ifeq ($(OS_ARCH),NetBSD) -MDCPUCFG_H = _netbsd.cfg -endif - -ifeq ($(OS_ARCH),HP-UX) -ifeq ($(USE_64), 1) -MDCPUCFG_H = _hpux64.cfg -else -MDCPUCFG_H = _hpux32.cfg -endif -endif - -ifeq ($(OS_ARCH),Linux) -MDCPUCFG_H = _linux.cfg -endif - -ifeq ($(OS_ARCH),OSF1) -MDCPUCFG_H = _osf1.cfg -endif - -ifeq ($(OS_ARCH),SunOS) -ifeq ($(OS_RELEASE),4.1.3_U1) -MDCPUCFG_H = _sunos4.cfg -else -ifeq ($(USE_64),1) -MDCPUCFG_H = _solaris64.cfg -else -MDCPUCFG_H = _solaris32.cfg -endif -endif -endif - -ifeq ($(OS_ARCH),SINIX) -MDCPUCFG_H = _reliantunix.cfg -endif - -ifeq ($(OS_ARCH),Rhapsody) -MDCPUCFG_H = _rhapsody.cfg -endif - -ifeq ($(OS_ARCH),NEXTSTEP) -MDCPUCFG_H = _nextstep.cfg -endif - -ifeq ($(OS_ARCH),NEWS-OS) -MDCPUCFG_H = _sony.cfg -endif - -ifeq ($(OS_ARCH),NEC) -MDCPUCFG_H = _nec.cfg -endif - -ifeq ($(OS_ARCH),SCOOS) -MDCPUCFG_H = _scoos.cfg -endif - -ifeq ($(OS_ARCH),UNIXWARE) -ifeq (,$(filter-out 2.1,$(OS_RELEASE))) -MDCPUCFG_H = _unixware.cfg -else -MDCPUCFG_H = _unixware7.cfg -endif -endif - -ifeq ($(OS_ARCH),NCR) -MDCPUCFG_H = _ncr.cfg -endif - -ifeq ($(OS_ARCH),DGUX) -MDCPUCFG_H = _dgux.cfg -endif - -ifeq ($(OS_ARCH),QNX) -MDCPUCFG_H = _qnx.cfg -endif - -ifeq ($(OS_TARGET),NTO) -MDCPUCFG_H = _nto.cfg -endif - -ifeq ($(OS_ARCH),BeOS) -MDCPUCFG_H = _beos.cfg -endif - -export:: $(MDCPUCFG_H) - $(INSTALL) -m 444 $(MDCPUCFG_H) $(DIST)/include -ifeq ($(MOZ_BITS),16) - cp $(DIST)/include/$(MDCPUCFG_H) $(DIST)/include/prcpucfg.h - $(INSTALL) -m 444 $(MDCPUCFG_H) $(MOZ_INCL) - mv -f $(DIST)/include/$(MDCPUCFG_H) $(MOZ_INCL)/prcpucfg.h -else -ifneq ($(OS_ARCH),OpenVMS) - mv -f $(DIST)/include/$(MDCPUCFG_H) $(DIST)/include/prcpucfg.h -else -# mv'ing a link causes the file itself to move, not the link. - rm -f $(DIST)/include/$(MDCPUCFG_H) - rm -f $(DIST)/include/prcpucfg.h - ln -fs `pwd`/$(MDCPUCFG_H) $(DIST)/include/prcpucfg.h -endif -endif - -release:: export - @echo "Copying machine-dependent prcpucfg.h" - @if test -z "$(BUILD_NUMBER)"; then \ - echo "BUILD_NUMBER must be defined"; \ - false; \ - fi - @if test ! -d $(RELEASE_INCLUDE_DIR); then \ - rm -rf $(RELEASE_INCLUDE_DIR); \ - $(NSINSTALL) -D $(RELEASE_INCLUDE_DIR);\ - fi - cp $(MDCPUCFG_H) $(RELEASE_INCLUDE_DIR)/prcpucfg.h diff --git a/pr/include/md/Makefile.in b/pr/include/md/Makefile.in index 0ab32b1d..2f3962c7 100644 --- a/pr/include/md/Makefile.in +++ b/pr/include/md/Makefile.in @@ -29,158 +29,23 @@ CONFIGS = $(wildcard $(srcdir)/*.cfg) include $(topsrcdir)/config/rules.mk -ifndef USE_AUTOCONF - -ifeq ($(OS_ARCH),IRIX) -ifeq ($(USE_64), 1) -MDCPUCFG_H = _irix64.cfg -else -MDCPUCFG_H = _irix32.cfg -endif -endif - -ifeq ($(OS_ARCH),WINNT) -ifeq ($(OS_TARGET), WIN95) -MDCPUCFG_H = _win95.cfg -else -ifeq ($(OS_TARGET), WIN16) -MDCPUCFG_H = _win16.cfg -else -ifeq ($(OS_TARGET),OS2) -MDCPUCFG_H = _os2.cfg -else -MDCPUCFG_H = _winnt.cfg -endif -endif -endif -endif - -ifeq ($(OS_ARCH),AIX) -ifeq ($(USE_64),1) -MDCPUCFG_H = _aix64.cfg -else -ifeq ($(USE_IPV6),1) -MDCPUCFG_H = _aix32in6.cfg -else -MDCPUCFG_H = _aix32.cfg -endif -endif -endif - -ifeq ($(OS_ARCH),BSD_OS) -MDCPUCFG_H = _bsdi.cfg -endif - -ifeq ($(OS_ARCH),FreeBSD) -MDCPUCFG_H = _freebsd.cfg -endif - -ifeq ($(OS_ARCH),OpenBSD) -MDCPUCFG_H = _openbsd.cfg -endif - -ifeq ($(OS_ARCH),OpenVMS) -MDCPUCFG_H = _openvms.cfg -endif - -ifeq ($(OS_ARCH),NetBSD) -MDCPUCFG_H = _netbsd.cfg -endif - -ifeq ($(OS_ARCH),HP-UX) -ifeq ($(USE_64), 1) -MDCPUCFG_H = _hpux64.cfg -else -MDCPUCFG_H = _hpux32.cfg -endif -endif - -ifeq ($(OS_ARCH),Linux) -MDCPUCFG_H = _linux.cfg -endif - -ifeq ($(OS_ARCH),OSF1) -MDCPUCFG_H = _osf1.cfg -endif - -ifeq ($(OS_ARCH),SunOS) -ifeq ($(OS_RELEASE),4.1.3_U1) -MDCPUCFG_H = _sunos4.cfg -else -ifeq ($(USE_64),1) -MDCPUCFG_H = _solaris64.cfg -else -MDCPUCFG_H = _solaris32.cfg -endif -endif -endif - -ifeq ($(OS_ARCH),SINIX) -MDCPUCFG_H = _reliantunix.cfg -endif - -ifeq ($(OS_ARCH),Rhapsody) -MDCPUCFG_H = _rhapsody.cfg -endif - -ifeq ($(OS_ARCH),NEXTSTEP) -MDCPUCFG_H = _nextstep.cfg -endif - -ifeq ($(OS_ARCH),NEWS-OS) -MDCPUCFG_H = _sony.cfg -endif - -ifeq ($(OS_ARCH),NEC) -MDCPUCFG_H = _nec.cfg -endif - -ifeq ($(OS_ARCH),SCOOS) -MDCPUCFG_H = _scoos.cfg -endif - -ifeq ($(OS_ARCH),UNIXWARE) -ifeq (,$(filter-out 2.1,$(OS_RELEASE))) -MDCPUCFG_H = _unixware.cfg -else -MDCPUCFG_H = _unixware7.cfg -endif -endif - -ifeq ($(OS_ARCH),NCR) -MDCPUCFG_H = _ncr.cfg -endif - -ifeq ($(OS_ARCH),DGUX) -MDCPUCFG_H = _dgux.cfg -endif - -ifeq ($(OS_ARCH),QNX) -MDCPUCFG_H = _qnx.cfg -endif - -ifeq ($(OS_TARGET),NTO) -MDCPUCFG_H = _nto.cfg -endif - -ifeq ($(OS_ARCH),BeOS) -MDCPUCFG_H = _beos.cfg -endif - -endif # ! USE_AUTOCONF - export:: $(MDCPUCFG_H) - $(INSTALL) -m 444 $(CONFIGS) $(DIST)/include/md - $(INSTALL) -m 444 $(srcdir)/$(MDCPUCFG_H) $(DIST)/include + $(INSTALL) -m 444 $(CONFIGS) $(dist_includedir)/md + $(INSTALL) -m 444 $(srcdir)/$(MDCPUCFG_H) $(dist_includedir) ifneq ($(OS_ARCH),OpenVMS) - mv -f $(DIST)/include/$(MDCPUCFG_H) $(DIST)/include/prcpucfg.h + mv -f $(dist_includedir)/$(MDCPUCFG_H) $(dist_includedir)/prcpucfg.h else # mv'ing a link causes the file itself to move, not the link. - rm -f $(DIST)/include/$(MDCPUCFG_H) - rm -f $(DIST)/include/prcpucfg.h - ln -fs `pwd`/$(MDCPUCFG_H) $(DIST)/include/prcpucfg.h + rm -f $(dist_includedir)/$(MDCPUCFG_H) + rm -f $(dist_includedir)/prcpucfg.h + ln -fs $(srcdir)/$(MDCPUCFG_H) $(dist_includedir)/prcpucfg.h endif +real_install:: + $(NSINSTALL) -D $(DESTDIR)$(includedir)/md + cp $(srcdir)/$(MDCPUCFG_H) $(DESTDIR)$(includedir)/prcpucfg.h + $(NSINSTALL) -t -m 644 $(CONFIGS) $(HEADERS) $(DESTDIR)$(includedir)/md + release:: export @echo "Copying machine-dependent prcpucfg.h" @if test -z "$(BUILD_NUMBER)"; then \ 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/_beos.h b/pr/include/md/_beos.h index 8b56dec3..2cb25407 100644 --- a/pr/include/md/_beos.h +++ b/pr/include/md/_beos.h @@ -72,8 +72,9 @@ /* Define threading functions and objects as native BeOS */ struct _MDThread { thread_id tid; /* BeOS thread handle */ - bool is_joinable; /* TRUE if PR_JOINABLE */ - bool is_joining; /* TRUE if we were woken up to join */ + sem_id joinSem; /* sems used to synchronzie joining */ + PRBool is_joining; /* TRUE if someone is currently waiting to + join this thread */ }; struct _MDThreadStack { 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..43318527 100644 --- a/pr/include/md/_macos.h +++ b/pr/include/md/_macos.h @@ -91,7 +91,7 @@ typedef struct _MDSocketCallerInfo { struct _MDFileDesc { PRInt32 osfd; - PRBool connectionOpen; + PRBool orderlyDisconnect; PRBool readReady; PRBool writeReady; PRBool exceptReady; @@ -103,6 +103,7 @@ struct _MDFileDesc { _MDSocketCallerInfo misc; _MDSocketCallerInfo read; _MDSocketCallerInfo write; + _MDSocketCallerInfo poll; }; /* @@ -382,6 +383,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..92a0b81c 100644 --- a/pr/include/md/_netbsd.cfg +++ b/pr/include/md/_netbsd.cfg @@ -27,7 +27,9 @@ #define NETBSD #endif -#if defined(__i386__) || defined(__arm32__) +#define PR_AF_INET6 24 /* same as AF_INET6 */ + +#if defined(__i386__) || defined(__arm32__) || defined(__MIPSEL__) #define IS_LITTLE_ENDIAN 1 #undef IS_BIG_ENDIAN @@ -73,9 +75,9 @@ #define PR_ALIGN_OF_DOUBLE 4 #define PR_ALIGN_OF_POINTER 4 -#elif defined(__sparc__) || defined(__mips__) +#elif defined(__sparc__) || defined(__MIPSEB__) -#undef IS_LITTLE_ENDIAN 1 +#undef IS_LITTLE_ENDIAN #define IS_BIG_ENDIAN 1 #define HAVE_LONG_LONG #define HAVE_ALIGNED_DOUBLES diff --git a/pr/include/md/_netbsd.h b/pr/include/md/_netbsd.h index 49aca74b..5145a664 100644 --- a/pr/include/md/_netbsd.h +++ b/pr/include/md/_netbsd.h @@ -20,6 +20,7 @@ #define nspr_netbsd_defs_h___ #include +#include /* for __NetBSD_Version__ */ #define PR_LINKER_ARCH "netbsd" #define _PR_SI_SYSNAME "NetBSD" @@ -39,7 +40,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,9 +57,17 @@ #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 +#if __NetBSD_Version__ >= 105000000 +#define _PR_INET6 +#define _PR_HAVE_GETHOSTBYNAME2 +#define _PR_INET6_PROBE +#endif + #define USE_SETJMP #ifndef _PR_PTHREADS @@ -64,40 +77,89 @@ #define CONTEXT(_th) ((_th)->md.context) -#if defined(__i386__) || defined(__sparc__) || defined(__m68k__) || defined(__powerpc__) -#define JB_SP_INDEX 2 -#elif defined(__mips__) -#define JB_SP_INDEX 4 -#elif defined(__alpha__) -#define JB_SP_INDEX 34 -#elif defined(__arm32__) /* - * On the arm32, the jmpbuf regs underwent a name change after NetBSD 1.3. - */ -#ifdef JMPBUF_REG_R13 -#define JB_SP_INDEX JMPBUF_REG_R13 -#else -#define JB_SP_INDEX _JB_REG_R13 +** Initialize a thread context to run "_main()" when started +*/ +#ifdef __i386__ +#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \ +{ \ + sigsetjmp(CONTEXT(_thread), 1); \ + CONTEXT(_thread)[2] = (unsigned char*) ((_sp) - 128); \ + CONTEXT(_thread)[0] = (int) _main; \ + *status = PR_TRUE; \ +} +#define _MD_GET_SP(_thread) CONTEXT(_thread)[2] #endif -#else -#error "Need to define SP index in jmp_buf here" +#ifdef __sparc__ +#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \ +{ \ + sigsetjmp(CONTEXT(_thread), 1); \ + CONTEXT(_thread)[2] = (unsigned char*) ((_sp) - 128); \ + CONTEXT(_thread)[3] = (int) _main; \ + CONTEXT(_thread)[4] = (int) _main + 4; \ + *status = PR_TRUE; \ +} +#define _MD_GET_SP(_thread) CONTEXT(_thread)[2] +#endif +#ifdef __powerpc__ +#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \ +{ \ + sigsetjmp(CONTEXT(_thread), 1); \ + CONTEXT(_thread)[3] = (unsigned char*) ((_sp) - 128); \ + CONTEXT(_thread)[4] = (int) _main; \ + *status = PR_TRUE; \ +} +#define _MD_GET_SP(_thread) CONTEXT(_thread)[3] +#endif +#ifdef __m68k__ +#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \ +{ \ + sigsetjmp(CONTEXT(_thread), 1); \ + CONTEXT(_thread)[2] = (unsigned char*) ((_sp) - 128); \ + CONTEXT(_thread)[5] = (int) _main; \ + *status = PR_TRUE; \ +} +#define _MD_GET_SP(_thread) CONTEXT(_thread)[2] +#endif +#ifdef __mips__ +#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \ +{ \ + sigsetjmp(CONTEXT(_thread), 1); \ + CONTEXT(_thread)[32] = (unsigned char*) ((_sp) - 128); \ + CONTEXT(_thread)[2] = (int) _main; \ + CONTEXT(_thread)[28] = (int) _main; \ + *status = PR_TRUE; \ +} +#define _MD_GET_SP(_thread) CONTEXT(_thread)[32] +#endif +#ifdef __arm32__ +#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \ +{ \ + sigsetjmp(CONTEXT(_thread), 1); \ + CONTEXT(_thread)[23] = (unsigned char*) ((_sp) - 128); \ + CONTEXT(_thread)[24] = (int) _main; \ + *status = PR_TRUE; \ +} +#define _MD_GET_SP(_thread) CONTEXT(_thread)[23] +#endif +#ifdef __alpha__ +#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \ +{ \ + sigsetjmp(CONTEXT(_thread), 1); \ + CONTEXT(_thread)[34] = (unsigned char*) ((_sp) - 128); \ + CONTEXT(_thread)[2] = (long) _main; \ + CONTEXT(_thread)[30] = (long) _main; \ + CONTEXT(_thread)[31] = (long) _main; \ + *status = PR_TRUE; \ +} +#define _MD_GET_SP(_thread) CONTEXT(_thread)[34] +#endif +#ifndef _MD_INIT_CONTEXT +#error "Need to define _MD_INIT_CONTEXT for this platform" #endif -#define _MD_GET_SP(_th) (_th)->md.context[JB_SP_INDEX] #define PR_NUM_GCREGS _JBLEN -/* -** Initialize a thread context to run "_main()" when started -*/ -#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \ -{ \ - *status = PR_TRUE; \ - if (sigsetjmp(CONTEXT(_thread), 1)) { \ - _main(); \ - } \ - _MD_GET_SP(_thread) = (unsigned char*) ((_sp) - 64); \ -} - #define _MD_SWITCH_CONTEXT(_thread) \ if (!sigsetjmp(CONTEXT(_thread), 1)) { \ (_thread)->md.errcode = errno; \ @@ -210,7 +272,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 #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 +#include #include #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 -#include -#include #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..97f55aa6 100644 --- a/pr/include/md/_openvms.h +++ b/pr/include/md/_openvms.h @@ -40,6 +40,7 @@ #define _PR_VMBASE 0x30000000 #define _PR_STACK_VMBASE 0x50000000 #define _MD_DEFAULT_STACK_SIZE 131072L +#define _MD_MINIMUM_STACK_SIZE 131072L /* ** This is not defined on OpenVMS. I believe its only used in GC code, and @@ -81,6 +82,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 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/_os2.h b/pr/include/md/_os2.h index 70e8d112..bcee5cbc 100644 --- a/pr/include/md/_os2.h +++ b/pr/include/md/_os2.h @@ -251,7 +251,14 @@ extern PRInt32 _MD_CloseSocket(PRInt32 osfd); #define _MD_GETPEERNAME (_PR_MD_GETPEERNAME) #define _MD_GETSOCKOPT (_PR_MD_GETSOCKOPT) #define _MD_SETSOCKOPT (_PR_MD_SETSOCKOPT) + +#ifdef XP_OS2_EMX +extern PRInt32 _MD_SELECT(int nfds, fd_set *readfds, fd_set *writefds, + fd_set *exceptfds, struct timeval *timeout); +#else #define _MD_SELECT select +#endif + #define _MD_FSYNC _PR_MD_FSYNC #define _MD_SET_FD_INHERITABLE (_PR_MD_SET_FD_INHERITABLE) 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/.cvsignore b/pr/include/obsolete/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/pr/include/obsolete/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/pr/include/obsolete/Makefile b/pr/include/obsolete/Makefile deleted file mode 100644 index 2aba1bae..00000000 --- a/pr/include/obsolete/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -#! gmake - -MOD_DEPTH = ../../.. - -include $(MOD_DEPTH)/config/config.mk - -HEADERS = $(wildcard *.h) - -RELEASE_HEADERS = $(HEADERS) -RELEASE_HEADERS_DEST = $(RELEASE_INCLUDE_DIR)/obsolete - -include $(MOD_DEPTH)/config/rules.mk - -export:: $(RELEASE_HEADERS) - $(INSTALL) -m 444 $(RELEASE_HEADERS) $(DIST)/include/obsolete -ifeq ($(MOZ_BITS),16) - $(INSTALL) -m 444 $(RELEASE_HEADERS) $(MOZ_INCL)/obsolete -endif diff --git a/pr/include/obsolete/Makefile.in b/pr/include/obsolete/Makefile.in index 1f7fc4b4..fd33428b 100644 --- a/pr/include/obsolete/Makefile.in +++ b/pr/include/obsolete/Makefile.in @@ -31,10 +31,9 @@ HEADERS = $(wildcard $(srcdir)/*.h) RELEASE_HEADERS = $(HEADERS) RELEASE_HEADERS_DEST = $(RELEASE_INCLUDE_DIR)/obsolete +includedir := $(includedir)/obsolete + include $(topsrcdir)/config/rules.mk export:: $(RELEASE_HEADERS) - $(INSTALL) -m 444 $(RELEASE_HEADERS) $(DIST)/include/obsolete -ifeq ($(MOZ_BITS),16) - $(INSTALL) -m 444 $(RELEASE_HEADERS) $(MOZ_INCL)/obsolete -endif + $(INSTALL) -m 444 $(RELEASE_HEADERS) $(dist_includedir)/obsolete 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 -#else +#endif +#if !defined(XP_UNIX) || defined(NTO) typedef PRUintn uint; #endif diff --git a/pr/include/prinet.h b/pr/include/prinet.h index 440352ed..994ce806 100644 --- a/pr/include/prinet.h +++ b/pr/include/prinet.h @@ -75,7 +75,7 @@ struct sockaddr_dl; * socket headers. */ #if defined(OS2) && !defined(INADDR_LOOPBACK) -#define INADDR_LOOPBACK gethostid() +#define INADDR_LOOPBACK 0x7f000001 #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 ** ". " */ -#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 @@ -178,34 +178,6 @@ union PRNetAddr { #endif }; -/* -** 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/.cvsignore b/pr/include/private/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/pr/include/private/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/pr/include/private/Makefile b/pr/include/private/Makefile deleted file mode 100644 index 25c6909a..00000000 --- a/pr/include/private/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -#! gmake - -MOD_DEPTH = ../../.. - -include $(MOD_DEPTH)/config/config.mk - -RELEASE_HEADERS = pprio.h pprthred.h prpriv.h -RELEASE_HEADERS_DEST = $(RELEASE_INCLUDE_DIR)/private - -HEADERS = $(RELEASE_HEADERS) pprmwait.h primpl.h - -include $(MOD_DEPTH)/config/rules.mk - -export:: $(RELEASE_HEADERS) - $(INSTALL) -m 444 $(RELEASE_HEADERS) $(DIST)/include/private -ifeq ($(MOZ_BITS),16) - $(INSTALL) -m 444 $(RELEASE_HEADERS) $(MOZ_INCL)/private -endif diff --git a/pr/include/private/Makefile.in b/pr/include/private/Makefile.in index 4197dbb5..8325ef72 100644 --- a/pr/include/private/Makefile.in +++ b/pr/include/private/Makefile.in @@ -32,10 +32,9 @@ RELEASE_HEADERS_DEST = $(RELEASE_INCLUDE_DIR)/private HEADERS = $(RELEASE_HEADERS) $(srcdir)/pprmwait.h $(srcdir)/primpl.h +includedir := $(includedir)/private + include $(topsrcdir)/config/rules.mk export:: $(RELEASE_HEADERS) - $(INSTALL) -m 444 $(RELEASE_HEADERS) $(DIST)/include/private -ifeq ($(MOZ_BITS),16) - $(INSTALL) -m 444 $(RELEASE_HEADERS) $(MOZ_INCL)/private -endif + $(INSTALL) -m 444 $(RELEASE_HEADERS) $(dist_includedir)/private 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/.cvsignore b/pr/src/.cvsignore new file mode 100644 index 00000000..41a1bd2b --- /dev/null +++ b/pr/src/.cvsignore @@ -0,0 +1,2 @@ +Makefile +_pr_bld.h diff --git a/pr/src/Makefile b/pr/src/Makefile deleted file mode 100644 index 9f584e48..00000000 --- a/pr/src/Makefile +++ /dev/null @@ -1,431 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -#! gmake - -MOD_DEPTH = ../.. - -include $(MOD_DEPTH)/config/config.mk - -DIRS = io linking malloc md memory misc threads - -# For VAC++ 4 geticcdata rule in config/OS2.mk -ifeq ($(MOZ_OS2_TOOLS),VACPP) -CSRCS = prvrsion.c -endif - -ifeq ($(USE_PTHREADS), 1) - DIRS += pthreads -endif - -ifeq ($(USE_BTHREADS), 1) - DIRS += bthreads -endif - -ifeq ($(USE_CPLUS), 1) - DIRS += cplus -endif - -# -# Define platform-dependent OS_LIBS -# - -# Disable optimization of the nspr on SunOS4.1.3 -ifeq ($(OS_ARCH),SunOS) -ifeq ($(OS_RELEASE),4.1.3_U1) -OPTIMIZER = -export OPTIMIZER -OS_LIBS = -lm -else # 4.1.3_U1 -ifdef USE_PTHREADS -OS_LIBS = -lpthread -lthread -lposix4 -lsocket -lnsl -ldl -else -ifdef LOCAL_THREADS_ONLY -OS_LIBS = -lsocket -lnsl -ldl -else -OS_LIBS = -lthread -lposix4 -lsocket -lnsl -ldl -endif # LOCAL_THREADS_ONLY -endif # USE_PTHREADS -endif # 4.1.3_U1 -endif # SunOS - -ifeq ($(OS_ARCH), IRIX) -ifeq ($(USE_PTHREADS), 1) -OS_LIBS = -lpthread -endif -endif - -ifeq ($(OS_ARCH),AIX) -ifeq ($(CLASSIC_NSPR),1) -ifeq ($(OS_RELEASE),4.1) -OS_LIBS = -lsvld -lc -else -OS_LIBS = -ldl -lc -endif -else -ifeq ($(OS_RELEASE),4.1) -OS_LIBS = -lpthreads -lsvld -lC_r -lC -lc_r -lm /usr/lib/libc.a -else -OS_LIBS = -lpthreads -ldl -lC_r -lC -lc_r -lm /usr/lib/libc.a -endif -endif -endif - -# On AIX, we override malloc in non-pthread versions. On AIX 4.2 or -# above, this requires that we use the rtl-enabled version of libc.a. -ifeq ($(OS_ARCH),AIX) -ifneq (,$(filter-out 3.2 4.1,$(OS_RELEASE))) -ifneq ($(USE_PTHREADS),1) -BUILD_AIX_RTL_LIBC = 1 -AIX_RTL_LIBC = $(OBJDIR)/libc.a -endif -endif -endif - -ifeq ($(OS_ARCH),OSF1) -ifeq ($(USE_PTHREADS), 1) -OS_LIBS = -lpthread -lrt -endif -ifneq ($(OS_RELEASE),V2.0) -OS_LIBS += -lc_r -endif -endif - -ifeq ($(OS_ARCH),Linux) -ifeq ($(USE_PTHREADS), 1) -OS_LIBS = -lpthread -ldl -lc -else -OS_LIBS = -ldl -lc -endif -endif - -ifeq ($(OS_ARCH),HP-UX) -ifeq ($(USE_PTHREADS), 1) -ifeq (,$(filter-out B.10.10 B.10.20,$(OS_RELEASE))) -OS_LIBS = -ldce -else -OS_LIBS = -lpthread -lrt -endif -endif -ifeq ($(PTHREADS_USER), 1) -OS_LIBS = -lpthread -endif -ifeq ($(basename $(OS_RELEASE)),A.09) -OS_LIBS += -ldld -L/lib/pa1.1 -lm -else -OS_LIBS += -ldld -lm -lc -endif -endif - -ifeq ($(OS_ARCH),UNIXWARE) -OS_LIBS = -lsocket -lc -endif - -ifeq ($(OS_ARCH),NEWS-OS) -OS_LIBS = -lsocket -lnsl -lgen -lresolv -endif - -ifeq ($(OS_ARCH),WINNT) -ifneq ($(OS_TARGET),WIN16) -OS_LIBS = advapi32.lib wsock32.lib winmm.lib -endif -endif - -# -# Define platform-dependent OBJS -# - -OBJS = \ - $(OBJDIR)/prvrsion.$(OBJ_SUFFIX) \ - io/$(OBJDIR)/prfdcach.$(OBJ_SUFFIX) \ - io/$(OBJDIR)/prmwait.$(OBJ_SUFFIX) \ - io/$(OBJDIR)/prmapopt.$(OBJ_SUFFIX) \ - io/$(OBJDIR)/priometh.$(OBJ_SUFFIX) \ - io/$(OBJDIR)/pripv6.$(OBJ_SUFFIX) \ - io/$(OBJDIR)/prlayer.$(OBJ_SUFFIX) \ - io/$(OBJDIR)/prlog.$(OBJ_SUFFIX) \ - io/$(OBJDIR)/prmmap.$(OBJ_SUFFIX) \ - io/$(OBJDIR)/prpolevt.$(OBJ_SUFFIX) \ - io/$(OBJDIR)/prprf.$(OBJ_SUFFIX) \ - io/$(OBJDIR)/prscanf.$(OBJ_SUFFIX) \ - io/$(OBJDIR)/prstdio.$(OBJ_SUFFIX) \ - threads/$(OBJDIR)/prcmon.$(OBJ_SUFFIX) \ - threads/$(OBJDIR)/prrwlock.$(OBJ_SUFFIX) \ - threads/$(OBJDIR)/prtpd.$(OBJ_SUFFIX) \ - linking/$(OBJDIR)/prlink.$(OBJ_SUFFIX) \ - malloc/$(OBJDIR)/prmem.$(OBJ_SUFFIX) \ - md/$(OBJDIR)/prosdep.$(OBJ_SUFFIX) \ - memory/$(OBJDIR)/prshm.$(OBJ_SUFFIX) \ - memory/$(OBJDIR)/prshma.$(OBJ_SUFFIX) \ - memory/$(OBJDIR)/prseg.$(OBJ_SUFFIX) \ - misc/$(OBJDIR)/pralarm.$(OBJ_SUFFIX) \ - misc/$(OBJDIR)/pratom.$(OBJ_SUFFIX) \ - misc/$(OBJDIR)/prcountr.$(OBJ_SUFFIX) \ - misc/$(OBJDIR)/prdtoa.$(OBJ_SUFFIX) \ - misc/$(OBJDIR)/prenv.$(OBJ_SUFFIX) \ - misc/$(OBJDIR)/prerr.$(OBJ_SUFFIX) \ - misc/$(OBJDIR)/prerror.$(OBJ_SUFFIX) \ - misc/$(OBJDIR)/prerrortable.$(OBJ_SUFFIX) \ - misc/$(OBJDIR)/prinit.$(OBJ_SUFFIX) \ - misc/$(OBJDIR)/prinrval.$(OBJ_SUFFIX) \ - misc/$(OBJDIR)/pripc.$(OBJ_SUFFIX) \ - misc/$(OBJDIR)/prlog2.$(OBJ_SUFFIX) \ - misc/$(OBJDIR)/prlong.$(OBJ_SUFFIX) \ - misc/$(OBJDIR)/prnetdb.$(OBJ_SUFFIX) \ - misc/$(OBJDIR)/prolock.$(OBJ_SUFFIX) \ - misc/$(OBJDIR)/prrng.$(OBJ_SUFFIX) \ - misc/$(OBJDIR)/prsystem.$(OBJ_SUFFIX) \ - misc/$(OBJDIR)/prthinfo.$(OBJ_SUFFIX) \ - misc/$(OBJDIR)/prtpool.$(OBJ_SUFFIX) \ - misc/$(OBJDIR)/prtrace.$(OBJ_SUFFIX) \ - misc/$(OBJDIR)/prtime.$(OBJ_SUFFIX) - -# ilib now rejects empty objects -ifneq ($(MOZ_OS2_TOOLS),VACPP) -OBJS += malloc/$(OBJDIR)/prmalloc.$(OBJ_SUFFIX) -endif - -ifdef USE_PTHREADS -OBJS += \ - pthreads/$(OBJDIR)/ptsynch.$(OBJ_SUFFIX) \ - pthreads/$(OBJDIR)/ptio.$(OBJ_SUFFIX) \ - pthreads/$(OBJDIR)/ptthread.$(OBJ_SUFFIX) \ - pthreads/$(OBJDIR)/ptmisc.$(OBJ_SUFFIX) -else -OBJS += \ - io/$(OBJDIR)/prdir.$(OBJ_SUFFIX) \ - io/$(OBJDIR)/prfile.$(OBJ_SUFFIX) \ - io/$(OBJDIR)/prio.$(OBJ_SUFFIX) \ - io/$(OBJDIR)/prsocket.$(OBJ_SUFFIX) \ - misc/$(OBJDIR)/pripcsem.$(OBJ_SUFFIX) - -ifndef USE_BTHREADS -OBJS += \ - threads/$(OBJDIR)/prcthr.$(OBJ_SUFFIX) \ - threads/$(OBJDIR)/prdump.$(OBJ_SUFFIX) \ - threads/$(OBJDIR)/prmon.$(OBJ_SUFFIX) \ - threads/$(OBJDIR)/prsem.$(OBJ_SUFFIX) \ - threads/combined/$(OBJDIR)/prucpu.$(OBJ_SUFFIX) \ - threads/combined/$(OBJDIR)/prucv.$(OBJ_SUFFIX) \ - threads/combined/$(OBJDIR)/prulock.$(OBJ_SUFFIX) \ - threads/combined/$(OBJDIR)/prustack.$(OBJ_SUFFIX) \ - threads/combined/$(OBJDIR)/pruthr.$(OBJ_SUFFIX) -endif - -endif - -ifeq ($(USE_CPLUS), 1) -OBJS += \ - cplus/$(OBJDIR)/rcbase.$(OBJ_SUFFIX) \ - cplus/$(OBJDIR)/rccv.$(OBJ_SUFFIX) \ - cplus/$(OBJDIR)/rcfileio.$(OBJ_SUFFIX) \ - cplus/$(OBJDIR)/rcinrval.$(OBJ_SUFFIX) \ - cplus/$(OBJDIR)/rcio.$(OBJ_SUFFIX) \ - cplus/$(OBJDIR)/rclock.$(OBJ_SUFFIX) \ - cplus/$(OBJDIR)/rcnetdb.$(OBJ_SUFFIX) \ - cplus/$(OBJDIR)/rcnetio.$(OBJ_SUFFIX) \ - cplus/$(OBJDIR)/rcthread.$(OBJ_SUFFIX) \ - cplus/$(OBJDIR)/rctime.$(OBJ_SUFFIX) -endif - -ifeq ($(OS_ARCH), WINNT) -ifneq ($(OS_TARGET),WIN16) -DLLBASE=/BASE:0x30000000 -RES=$(OBJDIR)/nspr.res -RESNAME=nspr.rc -ifdef MOZ_DEBUG -ifdef GLOWCODE -EXTRA_LIBS += $(GLOWDIR)/glowcode.lib -endif -endif -endif - -ifeq ($(OS_TARGET), WIN16) -OBJS += md/windows/$(OBJDIR)/w16null.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w16proc.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w16thred.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w16fmem.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w16sock.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w16mem.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w16io.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w16gc.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w16error.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w16callb.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/ntinrval.$(OBJ_SUFFIX) -EXTRA_LIBS += $(MOD_DEPTH)/tools/winsock.lib -W16_EXPORTS = EXPORT _malloc.2=_PR_MD_malloc RESIDENT, \ - _realloc.3=_PR_MD_realloc RESIDENT, \ - _calloc.4=_PR_MD_calloc RESIDENT, \ - _free.5=_PR_MD_free RESIDENT, \ - _getenv.9=_PR_MD_getenv RESIDENT, \ - _printf.11=_PR_MD_printf RESIDENT, \ - _strftime.13=_PR_MD_strftime RESIDENT, \ - _sscanf.33=_PR_MD_sscanf RESIDENT, \ - _putenv.10=_PR_MD_putenv RESIDENT, \ - _fprintf.12=_PR_MD_fprintf RESIDENT -else -ifeq ($(OS_TARGET), WIN95) -OBJS += md/windows/$(OBJDIR)/w95io.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w95sock.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w95thred.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w95cv.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/ntgc.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/ntmisc.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/ntinrval.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/ntsec.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/ntsem.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/win32_errors.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w32ipcsem.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w32poll.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w32rng.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w32shm.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w95dllmain.$(OBJ_SUFFIX) -else -OBJS += md/windows/$(OBJDIR)/ntdllmn.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/ntio.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/ntgc.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/ntthread.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/ntmisc.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/ntinrval.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/ntsec.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/ntsem.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/win32_errors.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w32ipcsem.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w32rng.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w32shm.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w32poll.$(OBJ_SUFFIX) -endif -endif - -else - -ifeq ($(OS_ARCH),OS2) -OBJS += md/os2/$(OBJDIR)/os2io.$(OBJ_SUFFIX) \ - md/os2/$(OBJDIR)/os2sock.$(OBJ_SUFFIX) \ - md/os2/$(OBJDIR)/os2thred.$(OBJ_SUFFIX) \ - md/os2/$(OBJDIR)/os2cv.$(OBJ_SUFFIX) \ - md/os2/$(OBJDIR)/os2gc.$(OBJ_SUFFIX) \ - md/os2/$(OBJDIR)/os2misc.$(OBJ_SUFFIX) \ - md/os2/$(OBJDIR)/os2inrval.$(OBJ_SUFFIX) \ - md/os2/$(OBJDIR)/os2sem.$(OBJ_SUFFIX) \ - md/os2/$(OBJDIR)/os2_errors.$(OBJ_SUFFIX) \ - md/os2/$(OBJDIR)/os2poll.$(OBJ_SUFFIX) \ - md/os2/$(OBJDIR)/os2rng.$(OBJ_SUFFIX) -else - -ifeq ($(OS_ARCH), BeOS) - include md/beos/objs.mk - include bthreads/objs.mk -else - # Unix - include md/unix/objs.mk -endif -endif -endif - -LIBRARY_NAME = nspr -LIBRARY_VERSION = $(MOD_VERSION) - -RELEASE_LIBS = $(TARGETS) - -include $(MOD_DEPTH)/config/rules.mk - -ifeq ($(BUILD_AIX_RTL_LIBC),1) -TARGETS += $(AIX_RTL_LIBC) -# XXX is this a shared library? -endif - -# -# Version information generation (begin) -# -ECHO = echo -INCLUDES = -I$(DIST)/include -TINC = $(OBJDIR)/_pr_bld.h - -ifeq ($(OS_TARGET),OS2) -PROD = nspr$(MOD_VERSION).$(DLL_SUFFIX) -else -PROD = $(notdir $(SHARED_LIBRARY)) -endif - -NOW = $(MOD_DEPTH)/config/$(OBJDIR)/now -SH_DATE = $(shell date) -SH_NOW = $(shell $(NOW)) - -ifeq ($(OS_ARCH), WINNT) - SUF = i64 -else - SUF = LL -endif - -DEFINES += -D_NSPR_BUILD_ - -$(TINC): - @$(MAKE_OBJDIR) - @$(ECHO) '#define _BUILD_STRING "$(SH_DATE)"' > $(TINC) - @if test ! -z "$(SH_NOW)"; then \ - $(ECHO) '#define _BUILD_TIME $(SH_NOW)$(SUF)' >> $(TINC); \ - else \ - true; \ - fi - @$(ECHO) '#define _PRODUCTION "$(PROD)"' >> $(TINC) - - -$(OBJDIR)/prvrsion.$(OBJ_SUFFIX): prvrsion.c $(TINC) -ifeq ($(OS_ARCH), WINNT) - $(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) prvrsion.c -else -ifeq ($(MOZ_OS2_TOOLS), VACPP) - $(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) prvrsion.c -else - $(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) prvrsion.c -endif -endif -# -# Version information generation (end) -# - - -# -# The Client build wants the shared libraries in $(DIST)/bin, -# so we also install them there. -# - -export:: $(TARGETS) - $(INSTALL) -m 444 $(TARGETS) $(DIST)/lib -ifdef SHARED_LIBRARY -ifeq ($(OS_ARCH),HP-UX) - $(INSTALL) -m 755 $(SHARED_LIBRARY) $(DIST)/lib - $(INSTALL) -m 755 $(SHARED_LIBRARY) $(DIST)/bin -else - $(INSTALL) -m 444 $(SHARED_LIBRARY) $(DIST)/bin -endif -ifeq ($(OS_ARCH), OpenVMS) - $(INSTALL) -m 444 $(SHARED_LIBRARY:.$(DLL_SUFFIX)=.vms) $(DIST)/lib -endif -endif -ifeq ($(MOZ_BITS),16) - $(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/lib - $(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/bin -endif - -ifeq ($(BUILD_AIX_RTL_LIBC),1) -$(AIX_RTL_LIBC): /usr/ccs/lib/libc.a - rtl_enable -o $@ $< -endif - -install:: export diff --git a/pr/src/Makefile.in b/pr/src/Makefile.in index bad88779..55e96907 100644 --- a/pr/src/Makefile.in +++ b/pr/src/Makefile.in @@ -28,6 +28,11 @@ include $(topsrcdir)/config/config.mk DIRS = io linking malloc md memory misc threads +# For VAC++ 4 geticcdata rule in config/OS2.mk +ifeq ($(MOZ_OS2_TOOLS),VACPP) +CSRCS = prvrsion.c +endif + ifeq ($(USE_PTHREADS), 1) DIRS += pthreads endif @@ -40,8 +45,6 @@ ifeq ($(USE_CPLUS), 1) DIRS += cplus endif -ifndef USE_AUTOCONF - # # Define platform-dependent OS_LIBS # @@ -49,8 +52,6 @@ ifndef USE_AUTOCONF # Disable optimization of the nspr on SunOS4.1.3 ifeq ($(OS_ARCH),SunOS) ifeq ($(OS_RELEASE),4.1.3_U1) -OPTIMIZER = -export OPTIMIZER OS_LIBS = -lm else # 4.1.3_U1 ifdef USE_PTHREADS @@ -100,7 +101,7 @@ endif ifeq ($(OS_ARCH),OSF1) ifeq ($(USE_PTHREADS), 1) -OS_LIBS = -lpthread +OS_LIBS = -lpthread -lrt endif ifneq ($(OS_RELEASE),V2.0) OS_LIBS += -lc_r @@ -120,7 +121,7 @@ ifeq ($(USE_PTHREADS), 1) ifeq (,$(filter-out B.10.10 B.10.20,$(OS_RELEASE))) OS_LIBS = -ldce else -OS_LIBS = -lpthread +OS_LIBS = -lpthread -lrt endif endif ifeq ($(PTHREADS_USER), 1) @@ -142,16 +143,15 @@ OS_LIBS = -lsocket -lnsl -lgen -lresolv endif ifeq ($(OS_ARCH),WINNT) -ifeq ($(OS_TARGET),OS2) -# We define this in os2.mk. -else -ifneq ($(OS_TARGET),WIN16) -OS_LIBS = wsock32.lib winmm.lib -endif +OS_LIBS = advapi32.lib wsock32.lib endif + +ifdef GC_LEAK_DETECTOR +EXTRA_LIBS = -L$(dist_libdir) -lboehm endif -endif # USE_AUTOCONF +EXTRA_LIBS += $(OS_LIBS) + # # Define platform-dependent OBJS # @@ -174,7 +174,6 @@ OBJS = \ threads/$(OBJDIR)/prrwlock.$(OBJ_SUFFIX) \ threads/$(OBJDIR)/prtpd.$(OBJ_SUFFIX) \ linking/$(OBJDIR)/prlink.$(OBJ_SUFFIX) \ - malloc/$(OBJDIR)/prmalloc.$(OBJ_SUFFIX) \ malloc/$(OBJDIR)/prmem.$(OBJ_SUFFIX) \ md/$(OBJDIR)/prosdep.$(OBJ_SUFFIX) \ memory/$(OBJDIR)/prshm.$(OBJ_SUFFIX) \ @@ -198,9 +197,15 @@ OBJS = \ misc/$(OBJDIR)/prrng.$(OBJ_SUFFIX) \ misc/$(OBJDIR)/prsystem.$(OBJ_SUFFIX) \ misc/$(OBJDIR)/prthinfo.$(OBJ_SUFFIX) \ + misc/$(OBJDIR)/prtpool.$(OBJ_SUFFIX) \ misc/$(OBJDIR)/prtrace.$(OBJ_SUFFIX) \ misc/$(OBJDIR)/prtime.$(OBJ_SUFFIX) +# ilib now rejects empty objects +ifneq ($(MOZ_OS2_TOOLS),VACPP) +OBJS += malloc/$(OBJDIR)/prmalloc.$(OBJ_SUFFIX) +endif + ifdef USE_PTHREADS OBJS += \ pthreads/$(OBJDIR)/ptsynch.$(OBJ_SUFFIX) \ @@ -244,109 +249,23 @@ OBJS += \ cplus/$(OBJDIR)/rctime.$(OBJ_SUFFIX) endif -ifdef USE_AUTOCONF - -include $(srcdir)/md/$(PR_MD_ARCH_DIR)/objs.mk -ifdef USE_BTHREADS -include $(srcdir)/bthreads/objs.mk +ifdef GC_LEAK_DETECTOR +OBJS += memory/$(OBJDIR)/prgcleak.$(OBJ_SUFFIX) endif -else - ifeq ($(OS_ARCH), WINNT) -ifneq (,$(filter-out WIN16 OS2,$(OS_TARGET))) DLLBASE=/BASE:0x30000000 RES=$(OBJDIR)/nspr.res RESNAME=nspr.rc -ifdef MOZ_DEBUG -ifdef GLOWCODE -EXTRA_LIBS += $(GLOWDIR)/glowcode.lib -endif -endif -endif - -ifeq ($(OS_TARGET), WIN16) -OBJS += md/windows/$(OBJDIR)/w16null.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w16proc.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w16thred.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w16fmem.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w16sock.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w16mem.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w16io.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w16gc.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w16error.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w16callb.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/ntinrval.$(OBJ_SUFFIX) -EXTRA_LIBS += $(MOD_DEPTH)/tools/winsock.lib -W16_EXPORTS = EXPORT _malloc.2=_PR_MD_malloc RESIDENT, \ - _realloc.3=_PR_MD_realloc RESIDENT, \ - _calloc.4=_PR_MD_calloc RESIDENT, \ - _free.5=_PR_MD_free RESIDENT, \ - _getenv.9=_PR_MD_getenv RESIDENT, \ - _printf.11=_PR_MD_printf RESIDENT, \ - _strftime.13=_PR_MD_strftime RESIDENT, \ - _sscanf.33=_PR_MD_sscanf RESIDENT, \ - _putenv.10=_PR_MD_putenv RESIDENT, \ - _fprintf.12=_PR_MD_fprintf RESIDENT -else -ifeq ($(OS_TARGET), WIN95) -OBJS += md/windows/$(OBJDIR)/w95io.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w95sock.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w95thred.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w95cv.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/ntgc.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/ntmisc.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/ntinrval.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/ntsem.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/win32_errors.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w32ipcsem.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w32poll.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w32rng.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w32shm.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w95dllmain.$(OBJ_SUFFIX) -else -ifeq ($(OS_TARGET),OS2) -OBJS += md/os2/$(OBJDIR)/os2io.$(OBJ_SUFFIX) \ - md/os2/$(OBJDIR)/os2sock.$(OBJ_SUFFIX) \ - md/os2/$(OBJDIR)/os2thred.$(OBJ_SUFFIX) \ - md/os2/$(OBJDIR)/os2cv.$(OBJ_SUFFIX) \ - md/os2/$(OBJDIR)/os2gc.$(OBJ_SUFFIX) \ - md/os2/$(OBJDIR)/os2misc.$(OBJ_SUFFIX) \ - md/os2/$(OBJDIR)/os2inrval.$(OBJ_SUFFIX) \ - md/os2/$(OBJDIR)/os2sem.$(OBJ_SUFFIX) \ - md/os2/$(OBJDIR)/os2_errors.$(OBJ_SUFFIX) \ - md/os2/$(OBJDIR)/os2poll.$(OBJ_SUFFIX) -else -OBJS += md/windows/$(OBJDIR)/ntdllmn.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/ntio.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/ntgc.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/ntthread.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/ntmisc.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/ntinrval.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/ntsem.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/win32_errors.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w32ipcsem.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w32rng.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w32shm.$(OBJ_SUFFIX) \ - md/windows/$(OBJDIR)/w32poll.$(OBJ_SUFFIX) -endif -endif -endif - -else +endif # WINNT -ifeq ($(OS_ARCH), BeOS) - include $(srcdir)/md/beos/objs.mk - include $(srcdir)/bthreads/objs.mk -else - # Unix - include $(srcdir)/md/unix/objs.mk -endif +include $(srcdir)/md/$(PR_MD_ARCH_DIR)/objs.mk +ifdef USE_BTHREADS +include $(srcdir)/bthreads/objs.mk endif -endif # !USE_AUTOCONF LIBRARY_NAME = nspr -LIBRARY_VERSION = $(MOD_VERSION) +LIBRARY_VERSION = $(MOD_MAJOR_VERSION) RELEASE_LIBS = $(TARGETS) @@ -361,25 +280,29 @@ endif # Version information generation (begin) # ECHO = echo -INCLUDES = -I$(DIST)/include +INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private TINC = $(OBJDIR)/_pr_bld.h + +ifeq ($(OS_TARGET),OS2) +PROD = nspr$(MOD_MAJOR_VERSION).$(DLL_SUFFIX) +else PROD = $(notdir $(SHARED_LIBRARY)) +endif + NOW = $(MOD_DEPTH)/config/$(OBJDIR)/now SH_DATE = $(shell date) SH_NOW = $(shell $(NOW)) ifeq ($(OS_ARCH), WINNT) -ifeq ($(OS_TARGET),OS2) - SUF = -else SUF = i64 -endif else SUF = LL endif DEFINES += -D_NSPR_BUILD_ +GARBAGE += $(TINC) + $(TINC): @$(MAKE_OBJDIR) @$(ECHO) '#define _BUILD_STRING "$(SH_DATE)"' > $(TINC) @@ -393,35 +316,36 @@ $(TINC): $(OBJDIR)/prvrsion.$(OBJ_SUFFIX): prvrsion.c $(TINC) ifeq ($(OS_ARCH), WINNT) -ifdef XP_OS2_EMX - $(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) $< + $(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $< else +ifeq ($(MOZ_OS2_TOOLS), VACPP) $(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $< -endif else $(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) $< endif +endif # # Version information generation (end) # # -# The Client build wants the shared libraries in $(DIST)/bin, +# The Client build wants the shared libraries in $(dist_bindir) # so we also install them there. # export:: $(TARGETS) - $(INSTALL) -m 444 $(TARGETS) $(DIST)/lib + $(INSTALL) -m 444 $(TARGETS) $(dist_libdir) ifdef SHARED_LIBRARY ifeq ($(OS_ARCH),HP-UX) - $(INSTALL) -m 755 $(SHARED_LIBRARY) $(DIST)/lib - $(INSTALL) -m 755 $(SHARED_LIBRARY) $(DIST)/bin + $(INSTALL) -m 755 $(SHARED_LIBRARY) $(dist_libdir) + $(INSTALL) -m 755 $(SHARED_LIBRARY) $(dist_bindir) else - $(INSTALL) -m 444 $(SHARED_LIBRARY) $(DIST)/bin + $(INSTALL) -m 444 $(SHARED_LIBRARY) $(dist_bindir) endif ifeq ($(OS_ARCH), OpenVMS) - $(INSTALL) -m 444 $(SHARED_LIBRARY:.$(DLL_SUFFIX)=.vms) $(DIST)/lib + $(INSTALL) -m 444 $(SHARED_LIBRARY:.$(DLL_SUFFIX)=.vms) $(dist_libdir) + $(INSTALL) -m 444 $(SHARED_LIBRARY:.$(DLL_SUFFIX)=.vms) $(dist_bindir) endif endif ifeq ($(MOZ_BITS),16) @@ -434,5 +358,4 @@ $(AIX_RTL_LIBC): /usr/ccs/lib/libc.a rtl_enable -o $@ $< endif -install:: export diff --git a/pr/src/bthreads/.cvsignore b/pr/src/bthreads/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/pr/src/bthreads/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/pr/src/bthreads/Makefile b/pr/src/bthreads/Makefile deleted file mode 100644 index 1bddbdc0..00000000 --- a/pr/src/bthreads/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -# -# The contents of this file are subject to the Mozilla Public License -# Version 1.1 (the "MPL"); you may not use this file except in -# compliance with the MPL. You may obtain a copy of the MPL at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the MPL is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the MPL -# for the specific language governing rights and limitations under the -# MPL. -# - -#! gmake - -MOD_DEPTH = ../../.. - -include $(MOD_DEPTH)/config/config.mk - -include bsrcs.mk -CSRCS += $(BTCSRCS) - -TARGETS = $(OBJS) - -INCLUDES = -I$(DIST)/include -I$(MOD_DEPTH)/pr/include -I$(MOD_DEPTH)/pr/include/private - -include $(MOD_DEPTH)/config/rules.mk - -DEFINES += -D_NSPR_BUILD_ - -export:: $(TARGETS) - -install:: export - diff --git a/pr/src/bthreads/Makefile.in b/pr/src/bthreads/Makefile.in index e0300039..14f2acdd 100644 --- a/pr/src/bthreads/Makefile.in +++ b/pr/src/bthreads/Makefile.in @@ -26,7 +26,7 @@ CSRCS += $(BTCSRCS) TARGETS = $(OBJS) -INCLUDES = -I$(DIST)/include -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private +INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private include $(topsrcdir)/config/rules.mk @@ -34,5 +34,4 @@ DEFINES += -D_NSPR_BUILD_ export:: $(TARGETS) -install:: export 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..35fdba38 100644 --- a/pr/src/bthreads/btthread.c +++ b/pr/src/bthreads/btthread.c @@ -12,6 +12,7 @@ */ #include +#include #include "prlog.h" #include "primpl.h" @@ -22,67 +23,63 @@ #include #include +/* values for PRThread.state */ #define BT_THREAD_PRIMORD 0x01 /* this is the primordial thread */ #define BT_THREAD_SYSTEM 0x02 /* this is a system thread */ +#define BT_THREAD_JOINABLE 0x04 /* this is a joinable thread */ struct _BT_Bookeeping { PRLock *ml; /* a lock to protect ourselves */ - PRCondVar *cv; /* used to signal global things */ + sem_id cleanUpSem; /* the primoridal thread will block on this + sem while waiting for the user threads */ PRInt32 threadCount; /* user thred count */ -} bt_book = { 0 }; +} bt_book = { NULL, B_ERROR, 0 }; -/* -** A structure at the root of the thread private data. Each member of -** the array keys[] points to a hash table based on the thread's ID. -*/ -struct _BT_PrivateData -{ - PRLock *lock; /* A lock to coordinate access */ - struct _BT_PrivateHash *keys[128]; /* Up to 128 keys, pointing to a hash table */ +#define BT_TPD_LIMIT 128 /* number of TPD slots we'll provide (arbitrary) */ -} bt_privateRoot = { 0 }; +/* these will be used to map an index returned by PR_NewThreadPrivateIndex() + to the corresponding beos native TLS slot number, and to the destructor + for that slot - note that, because it is allocated globally, this data + will be automatically zeroed for us when the program begins */ +static int32 tpd_beosTLSSlots[BT_TPD_LIMIT]; +static PRThreadPrivateDTOR tpd_dtors[BT_TPD_LIMIT]; -/* -** A dynamically allocated structure that contains 256 hash buckets that -** contain a linked list of thread IDs. The hash is simply the last 8 bits -** of the thread_id. ( current thread_id & 0x000000FF ) -*/ +static vint32 tpd_slotsUsed=0; /* number of currently-allocated TPD slots */ +static int32 tls_prThreadSlot; /* TLS slot in which PRThread will be stored */ -struct _BT_PrivateHash -{ - void (PR_CALLBACK *destructor)(void *arg); /* The destructor */ - struct _BT_PrivateEntry *next[256]; /* Pointer to the first element in the list */ -}; +/* this mutex will be used to synchronize access to every + PRThread.md.joinSem and PRThread.md.is_joining (we could + actually allocate one per thread, but that seems a bit excessive, + especially considering that there will probably be little + contention, PR_JoinThread() is allowed to block anyway, and the code + protected by the mutex is short/fast) */ +static PRLock *joinSemLock; -/* -** A dynamically allocated structure that is a member of a linked list of -** thread IDs. -*/ - -struct _BT_PrivateEntry -{ - struct _BT_PrivateEntry *next; /* Pointer to the next thread */ - thread_id threadID; /* The BeOS thread ID */ - void *data; /* The data */ -}; - -PRUint32 _bt_mapPriority( PRThreadPriority priority ); -PR_IMPLEMENT(void *) _bt_getThreadPrivate(PRUintn index); +static PRUint32 _bt_MapNSPRToNativePriority( PRThreadPriority priority ); +static PRThreadPriority _bt_MapNativeToNSPRPriority( PRUint32 priority ); +static void _bt_CleanupThread(void *arg); +static PRThread *_bt_AttachThread(); void _PR_InitThreads (PRThreadType type, PRThreadPriority priority, PRUintn maxPTDs) { PRThread *primordialThread; - PRLock *tempLock; - PRUintn tempKey; PRUint32 beThreadPriority; + /* allocate joinSem mutex */ + joinSemLock = PR_NewLock(); + if (joinSemLock == NULL) + { + PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0); + return; + } + /* - ** Create a NSPR structure for our primordial thread. + ** Create and initialize NSPR structure for our primordial thread. */ primordialThread = PR_NEWZAP(PRThread); @@ -92,82 +89,75 @@ _PR_InitThreads (PRThreadType type, PRThreadPriority priority, return; } + primordialThread->md.joinSem = B_ERROR; + /* ** Set the priority to the desired level. */ - beThreadPriority = _bt_mapPriority( priority ); + beThreadPriority = _bt_MapNSPRToNativePriority( priority ); set_thread_priority( find_thread( NULL ), beThreadPriority ); - primordialThread->state |= BT_THREAD_PRIMORD; primordialThread->priority = priority; - /* - ** Initialize the thread tracking data structures - */ - bt_privateRoot.lock = PR_NewLock(); - if( NULL == bt_privateRoot.lock ) - { - PR_SetError( PR_OUT_OF_MEMORY_ERROR, 0 ); - return; - } + /* set the thread's state - note that the thread is not joinable */ + primordialThread->state |= BT_THREAD_PRIMORD; + if (type == PR_SYSTEM_THREAD) + primordialThread->state |= BT_THREAD_SYSTEM; /* - ** Grab a key. We're guaranteed to be key #0, since we are - ** always the first one in. + ** Allocate a TLS slot for the PRThread structure (just using + ** native TLS, as opposed to NSPR TPD, will make PR_GetCurrentThread() + ** somewhat faster, and will leave one more TPD slot for our client) */ - - if( PR_NewThreadPrivateIndex( &tempKey, NULL ) != PR_SUCCESS ) - { - PR_SetError( PR_OUT_OF_MEMORY_ERROR, 0 ); - return; - } - PR_ASSERT( tempKey == 0 ); + tls_prThreadSlot = tls_allocate(); /* ** Stuff our new PRThread structure into our thread specific ** slot. */ - - if( PR_SetThreadPrivate( (PRUint8) 0, (void *) primordialThread ) == PR_FAILURE ) - { - PR_SetError( PR_OUT_OF_MEMORY_ERROR, 0 ); - return; - } - /* - ** Allocate some memory to hold our global lock. We never clean it - ** up later, but BeOS automatically frees memory when the thread - ** dies. - */ + tls_set(tls_prThreadSlot, primordialThread); + /* allocate lock for bt_book */ bt_book.ml = PR_NewLock(); if( NULL == bt_book.ml ) { PR_SetError( PR_OUT_OF_MEMORY_ERROR, 0 ); return; } +} - tempLock = PR_NewLock(); - if( NULL == tempLock ) +PRUint32 +_bt_MapNSPRToNativePriority( PRThreadPriority priority ) { - PR_SetError( PR_OUT_OF_MEMORY_ERROR, 0 ); - return; + switch( priority ) + { + case PR_PRIORITY_LOW: return( B_LOW_PRIORITY ); + case PR_PRIORITY_NORMAL: return( B_NORMAL_PRIORITY ); + case PR_PRIORITY_HIGH: return( B_DISPLAY_PRIORITY ); + case PR_PRIORITY_URGENT: return( B_URGENT_DISPLAY_PRIORITY ); + default: return( B_NORMAL_PRIORITY ); } +} - bt_book.cv = PR_NewCondVar( tempLock ); - if( NULL == bt_book.cv ) +PRThreadPriority +_bt_MapNativeToNSPRPriority(PRUint32 priority) { - PR_SetError( PR_OUT_OF_MEMORY_ERROR, 0 ); - return; - } + if (priority < B_NORMAL_PRIORITY) + return PR_PRIORITY_LOW; + if (priority < B_DISPLAY_PRIORITY) + return PR_PRIORITY_NORMAL; + if (priority < B_URGENT_DISPLAY_PRIORITY) + return PR_PRIORITY_HIGH; + return PR_PRIORITY_URGENT; } PRUint32 -_bt_mapPriority( PRThreadPriority priority ) +_bt_mapNativeToNSPRPriority( int32 priority ) { switch( priority ) { @@ -179,97 +169,97 @@ _bt_mapPriority( PRThreadPriority priority ) } } -/** - * This is a wrapper that all threads invoke that allows us to set some - * things up prior to a thread's invocation and clean up after a thread has - * exited. - */ -static void* -_bt_root (void* arg) +/* This method is called by all NSPR threads as they exit */ +void _bt_CleanupThread(void *arg) { - PRThread *thred = (PRThread*)arg; - PRIntn rv; - void *privData; - status_t result; - int i; - - struct _BT_PrivateHash *hashTable; - - /* Set within the current thread the pointer to our object. This - object will be deleted when the thread termintates. */ + PRThread *me = PR_GetCurrentThread(); + int32 i; - result = PR_SetThreadPrivate( 0, (void *) thred ); - PR_ASSERT( result == PR_SUCCESS ); + /* first, clean up all thread-private data */ + for (i = 0; i < tpd_slotsUsed; i++) + { + void *oldValue = tls_get(tpd_beosTLSSlots[i]); + if ( oldValue != NULL && tpd_dtors[i] != NULL ) + (*tpd_dtors[i])(oldValue); + } - thred->startFunc(thred->arg); /* run the dang thing */ + /* if this thread is joinable, wait for someone to join it */ + if (me->state & BT_THREAD_JOINABLE) + { + /* protect access to our joinSem */ + PR_Lock(joinSemLock); - /* - ** Call the destructor, if available. - */ + if (me->md.is_joining) + { + /* someone is already waiting to join us (they've + allocated a joinSem for us) - let them know we're + ready */ + delete_sem(me->md.joinSem); - PR_Lock( bt_privateRoot.lock ); + PR_Unlock(joinSemLock); - for( i = 0; i < 128; i++ ) + } + else { - hashTable = bt_privateRoot.keys[i]; + /* noone is currently waiting for our demise - it + is our responsibility to allocate the joinSem + and block on it */ + me->md.joinSem = create_sem(0, "join sem"); - if( hashTable != NULL ) - { - if( hashTable->destructor != NULL ) - { - privData = _bt_getThreadPrivate( i ); + /* we're done accessing our joinSem */ + PR_Unlock(joinSemLock); - if( privData != NULL ) - { - PR_Unlock( bt_privateRoot.lock ); - hashTable->destructor( privData ); - PR_Lock( bt_privateRoot.lock ); - } + /* wait for someone to join us */ + while (acquire_sem(me->md.joinSem) == B_INTERRUPTED); } } - } - - PR_Unlock( bt_privateRoot.lock ); - - /* decrement our thread counters */ + /* if this is a user thread, we must update our books */ + if ((me->state & BT_THREAD_SYSTEM) == 0) + { + /* synchronize access to bt_book */ PR_Lock( bt_book.ml ); - if (thred->state & BT_THREAD_SYSTEM) { -#if 0 - bt_book.system -= 1; -#endif - } else - { + /* decrement the number of currently-alive user threads */ bt_book.threadCount--; - if( 0 == bt_book.threadCount ) - { - PR_NotifyAllCondVar(bt_book.cv); + if (bt_book.threadCount == 0 && bt_book.cleanUpSem != B_ERROR) { + /* we are the last user thread, and the primordial thread is + blocked in PR_Cleanup() waiting for us to finish - notify + it */ + delete_sem(bt_book.cleanUpSem); } - } PR_Unlock( bt_book.ml ); + } - if( thred->md.is_joinable == 1 ) - { - /* - ** This is a joinable thread. Keep suspending - ** until is_joining is set to 1 - */ + /* finally, delete this thread's PRThread */ + PR_DELETE(me); +} - if( thred->md.is_joining == 0 ) +/** + * This is a wrapper that all threads invoke that allows us to set some + * things up prior to a thread's invocation and clean up after a thread has + * exited. + */ +static void* +_bt_root (void* arg) { - suspend_thread( thred->md.tid ); - } - } + PRThread *thred = (PRThread*)arg; + PRIntn rv; + void *privData; + status_t result; + int i; + + /* save our PRThread object into our TLS */ + tls_set(tls_prThreadSlot, thred); - /* delete the thread object */ - PR_DELETE(thred); + thred->startFunc(thred->arg); /* run the dang thing */ + + /* clean up */ + _bt_CleanupThread(NULL); - result = PR_SetThreadPrivate( (PRUint8) 0, (void *) NULL ); - PR_ASSERT( result == PR_SUCCESS ); - exit_thread( NULL ); + return 0; } PR_IMPLEMENT(PRThread*) @@ -279,62 +269,70 @@ PR_IMPLEMENT(PRThread*) { PRUint32 bePriority; - PRThread* thred = PR_NEWZAP(PRThread); + PRThread* thred; if (!_pr_initialized) _PR_ImplicitInitialization(); - if (thred != NULL) { + thred = PR_NEWZAP(PRThread); + if (thred == NULL) + { + PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0); + return NULL; + } + + thred->md.joinSem = B_ERROR; + thred->arg = arg; thred->startFunc = start; thred->priority = priority; if( state == PR_JOINABLE_THREAD ) { - thred->md.is_joinable = 1; - } - else - { - thred->md.is_joinable = 0; + thred->state |= BT_THREAD_JOINABLE; } - thred->md.is_joining = 0; - /* keep some books */ PR_Lock( bt_book.ml ); - if (PR_SYSTEM_THREAD == type) { - thred->state |= BT_THREAD_SYSTEM; -#if 0 - bt_book.system += 1; -#endif - } else { + if (type == PR_USER_THREAD) + { bt_book.threadCount++; } PR_Unlock( bt_book.ml ); - bePriority = _bt_mapPriority( priority ); + bePriority = _bt_MapNSPRToNativePriority( priority ); thred->md.tid = spawn_thread((thread_func)_bt_root, "moz-thread", bePriority, thred); if (thred->md.tid < B_OK) { PR_SetError(PR_UNKNOWN_ERROR, thred->md.tid); PR_DELETE(thred); - thred = NULL; + return NULL; } if (resume_thread(thred->md.tid) < B_OK) { PR_SetError(PR_UNKNOWN_ERROR, 0); PR_DELETE(thred); - thred = NULL; + return NULL; } - } else { - PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0); + return thred; } - return thred; +PR_IMPLEMENT(PRThread*) + PR_AttachThread(PRThreadType type, PRThreadPriority priority, + PRThreadStack *stack) +{ + /* PR_GetCurrentThread() will attach a thread if necessary */ + return PR_GetCurrentThread(); +} + +PR_IMPLEMENT(void) + PR_DetachThread() +{ + /* we don't support detaching */ } PR_IMPLEMENT(PRStatus) @@ -344,36 +342,71 @@ PR_IMPLEMENT(PRStatus) PR_ASSERT(thred != NULL); - if( thred->md.is_joinable != 1 ) + if ((thred->state & BT_THREAD_JOINABLE) == 0) { - PR_SetError( PR_UNKNOWN_ERROR, 0 ); + PR_SetError( PR_INVALID_ARGUMENT_ERROR, 0 ); return( PR_FAILURE ); } - thred->md.is_joining = 1; + /* synchronize access to the thread's joinSem */ + PR_Lock(joinSemLock); + + if (thred->md.is_joining) + { + /* another thread is already waiting to join the specified + thread - we must fail */ + PR_Unlock(joinSemLock); + return PR_FAILURE; + } + + /* let others know we are waiting to join */ + thred->md.is_joining = PR_TRUE; + + if (thred->md.joinSem == B_ERROR) + { + /* the thread hasn't finished yet - it is our responsibility to + allocate a joinSem and wait on it */ + thred->md.joinSem = create_sem(0, "join sem"); - status = wait_for_thread(thred->md.tid, &eval); + /* we're done changing the joinSem now */ + PR_Unlock(joinSemLock); - if (status < B_NO_ERROR) { + /* wait for the thread to finish */ + while (acquire_sem(thred->md.joinSem) == B_INTERRUPTED); - PR_SetError(PR_UNKNOWN_ERROR, status); - return PR_FAILURE; + } + else + { + /* the thread has already finished, and has allocated the + joinSem itself - let it know it can finally die */ + delete_sem(thred->md.joinSem); + + PR_Unlock(joinSemLock); } + /* make sure the thread is dead */ + wait_for_thread(thred->md.tid, &eval); + return PR_SUCCESS; } PR_IMPLEMENT(PRThread*) PR_GetCurrentThread () { - void* thred; + PRThread* thred; if (!_pr_initialized) _PR_ImplicitInitialization(); - thred = PR_GetThreadPrivate( (PRUint8) 0 ); + thred = (PRThread *)tls_get( tls_prThreadSlot); + if (thred == NULL) + { + /* this thread doesn't have a PRThread structure (it must be + a native thread not created by the NSPR) - assimilate it */ + thred = _bt_AttachThread(); + } PR_ASSERT(NULL != thred); - return (PRThread*)thred; + return thred; } PR_IMPLEMENT(PRThreadScope) @@ -395,7 +428,8 @@ PR_IMPLEMENT(PRThreadState) PR_GetThreadState (const PRThread* thred) { PR_ASSERT(thred != NULL); - return PR_JOINABLE_THREAD; + return (thred->state & BT_THREAD_JOINABLE)? + PR_JOINABLE_THREAD: PR_UNJOINABLE_THREAD; } PR_IMPLEMENT(PRThreadPriority) @@ -413,7 +447,7 @@ PR_IMPLEMENT(void) PR_SetThreadPriority(PRThread *thred, PR_ASSERT( thred != NULL ); thred->priority = newPri; - bePriority = _bt_mapPriority( newPri ); + bePriority = _bt_MapNSPRToNativePriority( newPri ); set_thread_priority( thred->md.tid, bePriority ); } @@ -421,56 +455,28 @@ PR_IMPLEMENT(PRStatus) PR_NewThreadPrivateIndex (PRUintn* newIndex, PRThreadPrivateDTOR destructor) { - PRUintn index; - struct _BT_PrivateHash *tempPointer; + int32 index; if (!_pr_initialized) _PR_ImplicitInitialization(); - /* - ** Grab the lock, or hang until it is free. This is critical code, - ** and only one thread at a time should be going through it. - */ - - PR_Lock( bt_privateRoot.lock ); - - /* - ** Run through the array of keys, find the first one that's zero. - ** Exit if we hit the top of the array. - */ - - index = 0; - - while( bt_privateRoot.keys[index] != 0 ) - { - index++; - - if( 128 == index ) + /* reserve the next available tpd slot */ + index = atomic_add( &tpd_slotsUsed, 1 ); + if (index >= BT_TPD_LIMIT) { - PR_Unlock( bt_privateRoot.lock ); + /* no slots left - decrement value, then fail */ + atomic_add( &tpd_slotsUsed, -1 ); + PR_SetError( PR_TPD_RANGE_ERROR, 0 ); return( PR_FAILURE ); } - } - - /* - ** Index has the first available zeroed slot. Allocate a - ** _BT_PrivateHash structure, all zeroed. Assuming that goes - ** well, return the index. - */ - - tempPointer = PR_NEWZAP( struct _BT_PrivateHash ); - - if( 0 == tempPointer ) { - - PR_Unlock( bt_privateRoot.lock ); - return( PR_FAILURE ); - } - bt_privateRoot.keys[index] = tempPointer; - tempPointer->destructor = destructor; + /* allocate a beos-native TLS slot for this index (the new slot + automatically contains NULL) */ + tpd_beosTLSSlots[index] = tls_allocate(); - PR_Unlock( bt_privateRoot.lock ); + /* remember the destructor */ + tpd_dtors[index] = destructor; - *newIndex = index; + *newIndex = (PRUintn)index; return( PR_SUCCESS ); } @@ -478,195 +484,44 @@ PR_IMPLEMENT(PRStatus) PR_IMPLEMENT(PRStatus) PR_SetThreadPrivate (PRUintn index, void* priv) { - thread_id currentThread; - PRUint8 hashBucket; - void *tempPointer; - - struct _BT_PrivateHash *hashTable; - struct _BT_PrivateEntry *currentEntry; - struct _BT_PrivateEntry *previousEntry; + void *oldValue; /* ** Sanity checking */ - if( index < 0 || index > 127 ) return( PR_FAILURE ); - - /* - ** Grab the thread ID for this thread. Assign it to a hash bucket. - */ - - currentThread = find_thread( NULL ); - hashBucket = currentThread & 0x000000FF; - - /* - ** Lock out all other threads then grab the proper hash table based - ** on the passed index. - */ - - PR_Lock( bt_privateRoot.lock ); - - hashTable = bt_privateRoot.keys[index]; - - if( 0 == hashTable ) + if(index < 0 || index >= tpd_slotsUsed || index >= BT_TPD_LIMIT) { - PR_Unlock( bt_privateRoot.lock ); + PR_SetError( PR_TPD_RANGE_ERROR, 0 ); return( PR_FAILURE ); } - /* - ** Search through the linked list the end is reached or an existing - ** entry is found. - */ - - currentEntry = hashTable->next[ hashBucket ]; - previousEntry = NULL; + /* if the old value isn't NULL, and the dtor for this slot isn't + NULL, we must destroy the data */ + oldValue = tls_get(tpd_beosTLSSlots[index]); + if (oldValue != NULL && tpd_dtors[index] != NULL) + (*tpd_dtors[index])(oldValue); - while( currentEntry != 0 ) - { - if( currentEntry->threadID == currentThread ) - { - /* - ** Found a structure previously created for this thread. - ** Is there a destructor to be called? - */ - - if( hashTable->destructor != NULL ) - { - if( currentEntry->data != NULL ) - { - PR_Unlock( bt_privateRoot.lock ); - hashTable->destructor( currentEntry->data ); - PR_Lock( bt_privateRoot.lock ); - } - } - - /* - ** If the data was not NULL, and there was a destructor, - ** it has already been called. Overwrite the existing - ** data and return with success. - */ + /* save new value */ + tls_set(tpd_beosTLSSlots[index], priv); - currentEntry->data = priv; - PR_Unlock( bt_privateRoot.lock ); return( PR_SUCCESS ); } - previousEntry = currentEntry; - currentEntry = previousEntry->next; - } - - /* - ** If we're here, we didn't find an entry for this thread. Create - ** one and attach it to the end of the list. - */ - - currentEntry = PR_NEWZAP( struct _BT_PrivateEntry ); - - if( 0 == currentEntry ) - { - PR_Unlock( bt_privateRoot.lock ); - return( PR_FAILURE ); - } - - currentEntry->threadID = currentThread; - currentEntry->data = priv; - - if( 0 == previousEntry ) - { - /* - ** This is a special case. This is the first entry in the list - ** so set the hash table to point to this entry. - */ - - hashTable->next[ hashBucket ] = currentEntry; - } - else - { - previousEntry->next = currentEntry; - } - - PR_Unlock( bt_privateRoot.lock ); - - return( PR_SUCCESS ); -} - PR_IMPLEMENT(void*) - _bt_getThreadPrivate(PRUintn index) + PR_GetThreadPrivate (PRUintn index) { - thread_id currentThread; - PRUint8 hashBucket; - void *tempPointer; - - struct _BT_PrivateHash *hashTable; - struct _BT_PrivateEntry *currentEntry; - - /* - ** Sanity checking - */ - - if( index < 0 || index > 127 ) return( NULL ); - - /* - ** Grab the thread ID for this thread. Assign it to a hash bucket. - */ - - currentThread = find_thread( NULL ); - hashBucket = currentThread & 0x000000FF; - - /* - ** Grab the proper hash table based on the passed index. - */ - - hashTable = bt_privateRoot.keys[index]; - - if( 0 == hashTable ) + /* make sure the index is valid */ + if (index < 0 || index >= tpd_slotsUsed || index >= BT_TPD_LIMIT) { - return( NULL ); + PR_SetError( PR_TPD_RANGE_ERROR, 0 ); + return NULL; } - /* - ** Search through the linked list the end is reached or an existing - ** entry is found. - */ - - currentEntry = hashTable->next[ hashBucket ]; - - while( currentEntry != 0 ) - { - if( currentEntry->threadID == currentThread ) - { - /* - ** Found a structure previously created for this thread. - ** Copy out the data, unlock, and return. - */ - - tempPointer = currentEntry->data; - return( tempPointer ); + /* return the value */ + return tls_get( tpd_beosTLSSlots[index] ); } - currentEntry = currentEntry->next; - } - - /* - ** Ooops, we ran out of entries. This thread isn't listed. - */ - - return( NULL ); -} - -PR_IMPLEMENT(void*) - PR_GetThreadPrivate (PRUintn index) -{ - void *returnValue; - - PR_Lock( bt_privateRoot.lock ); - returnValue = _bt_getThreadPrivate( index ); - PR_Unlock( bt_privateRoot.lock ); - - return( returnValue ); -} - PR_IMPLEMENT(PRStatus) PR_Interrupt (PRThread* thred) @@ -674,38 +529,34 @@ PR_IMPLEMENT(PRStatus) PRIntn rv; PR_ASSERT(thred != NULL); - rv = resume_thread( thred->md.tid ); - if( rv == B_BAD_THREAD_STATE ) + /* + ** 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 ) { - /* - ** 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 - */ - - 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 ); - } + /* 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) @@ -752,25 +603,19 @@ PR_IMPLEMENT(PRStatus) PR_Lock( bt_book.ml ); - while( bt_book.threadCount > 0 ) + if (bt_book.threadCount != 0) { - PR_Unlock( bt_book.ml ); - PR_WaitCondVar(bt_book.cv, PR_INTERVAL_NO_TIMEOUT); - PR_Lock( bt_book.ml ); + /* we'll have to wait for some threads to finish - create a + sem to block on */ + bt_book.cleanUpSem = create_sem(0, "cleanup sem"); } PR_Unlock( bt_book.ml ); -#if 0 - /* I am not sure if it's safe to delete the cv and lock here, since - * there may still be "system" threads around. If this call isn't - * immediately prior to exiting, then there's a problem. */ - if (0 == bt_book.system) { - PR_DestroyCondVar(bt_book.cv); bt_book.cv = NULL; - PR_DestroyLock(bt_book.ml); bt_book.ml = NULL; - } - PR_DELETE(me); -#endif + /* note that, if all the user threads were already dead, we + wouldn't have created a sem above, so this acquire_sem() + will fail immediately */ + while (acquire_sem(bt_book.cleanUpSem) == B_INTERRUPTED); return PR_SUCCESS; } @@ -780,3 +625,46 @@ PR_IMPLEMENT(void) { exit(status); } + +PRThread *_bt_AttachThread() +{ + PRThread *thread; + thread_info tInfo; + + /* make sure this thread doesn't already have a PRThread structure */ + PR_ASSERT(tls_get(tls_prThreadSlot) == NULL); + + /* allocate a PRThread structure for this thread */ + thread = PR_NEWZAP(PRThread); + if (thread == NULL) + { + PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0); + return NULL; + } + + /* get the native thread's current state */ + get_thread_info(find_thread(NULL), &tInfo); + + /* initialize new PRThread */ + thread->md.tid = tInfo.thread; + thread->md.joinSem = B_ERROR; + thread->priority = _bt_MapNativeToNSPRPriority(tInfo.priority); + + /* attached threads are always non-joinable user threads */ + thread->state = 0; + + /* increment user thread count */ + PR_Lock(bt_book.ml); + bt_book.threadCount++; + PR_Unlock(bt_book.ml); + + /* store this thread's PRThread */ + tls_set(tls_prThreadSlot, thread); + + /* the thread must call _bt_CleanupThread() before it dies, in order + to clean up its PRThread, synchronize with the primordial thread, + etc. */ + on_exit_thread(_bt_CleanupThread, NULL); + + return thread; +} diff --git a/pr/src/cplus/.cvsignore b/pr/src/cplus/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/pr/src/cplus/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/pr/src/cplus/Makefile b/pr/src/cplus/Makefile deleted file mode 100644 index fc75f115..00000000 --- a/pr/src/cplus/Makefile +++ /dev/null @@ -1,51 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -#! gmake - -MOD_DEPTH = ../../.. - -include $(MOD_DEPTH)/config/config.mk - -CXXSRCS = \ - rcbase.cpp \ - rccv.cpp \ - rcfileio.cpp \ - rcinrval.cpp \ - rcio.cpp \ - rclock.cpp \ - rcnetdb.cpp \ - rcnetio.cpp \ - rcthread.cpp \ - rctime.cpp \ - $(NULL) - -OBJS = $(addprefix $(OBJDIR)/,$(CXXSRCS:.cpp=.$(OBJ_SUFFIX))) - -TARGETS = $(OBJS) - -INCLUDES = -I$(DIST)/include - -DEFINES += -D_NSPR_BUILD_ - -include $(MOD_DEPTH)/config/rules.mk - -HEADERS = $(wildcard *.h) - -export:: $(TARGETS) - -install:: export diff --git a/pr/src/cplus/Makefile.in b/pr/src/cplus/Makefile.in index a7caae58..91a64d29 100644 --- a/pr/src/cplus/Makefile.in +++ b/pr/src/cplus/Makefile.in @@ -43,7 +43,7 @@ OBJS = $(addprefix $(OBJDIR)/,$(CXXSRCS:.cpp=.$(OBJ_SUFFIX))) TARGETS = $(OBJS) -INCLUDES = -I$(DIST)/include +INCLUDES = -I$(dist_includedir) include $(topsrcdir)/config/rules.mk @@ -53,4 +53,3 @@ HEADERS = $(srcdir)/*.h export:: $(TARGETS) -install:: export diff --git a/pr/src/cplus/tests/.cvsignore b/pr/src/cplus/tests/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/pr/src/cplus/tests/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/pr/src/cplus/tests/Makefile b/pr/src/cplus/tests/Makefile deleted file mode 100644 index b7e658d7..00000000 --- a/pr/src/cplus/tests/Makefile +++ /dev/null @@ -1,263 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -#! gmake - -MOD_DEPTH = ../../../.. - -include $(MOD_DEPTH)/config/config.mk - -ifeq ($(OS_TARGET), WIN16) -OS_CFLAGS = $(OS_EXE_CFLAGS) -endif - -CXXSRCS = \ - ranfile.cpp \ - thread.cpp \ - interval.cpp \ - time.cpp \ - fileio.cpp \ - switch.cpp \ - tpd.cpp \ - $(NULL) - -OBJS = $(addprefix $(OBJDIR)/,$(CXXSRCS:.cpp=.$(OBJ_SUFFIX))) - -ifeq (,$(filter-out WINNT OS2,$(OS_ARCH))) -PROG_SUFFIX = .exe -else -PROG_SUFFIX = -endif - -PROGS = $(addprefix $(OBJDIR)/, $(CXXSRCS:.cpp=$(PROG_SUFFIX))) - -TARGETS = $(PROGS) $(OBJS) - -INCLUDES = -I.. -I$(DIST)/include - -# Setting the variables LDOPTS and LIBPR. We first initialize -# them to the default values, then adjust them for some platforms. -LDOPTS = -L$(DIST)/lib -LIBPR = -lnspr$(MOD_VERSION) -LIBPL = -lplc$(MOD_VERSION) - -ifeq ($(OS_ARCH), IRIX) - LDOPTS += -rpath $(PWD)/$(DIST)/lib -rdata_shared - # For 6.x machines, include this flag - ifeq ($(basename $(OS_RELEASE)),6) - ifeq ($(USE_N32),1) - LDOPTS += -n32 - else - LDOPTS += -32 - endif - - ifeq ($(USE_PTHREADS), 1) - ifeq ($(OS_RELEASE), 6.2) - LDOPTS += -Wl,-woff,85 - endif - endif - endif -endif - -# Solaris -ifeq ($(OS_ARCH), SunOS) - ifneq ($(OS_RELEASE), 4.1.3_U1) - ifdef NS_USE_GCC - LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(DIST)/lib - else - LDOPTS += -R $(PWD)/$(DIST)/lib - endif - endif - - ifneq ($(LOCAL_THREADS_ONLY),1) -# SunOS 5.4 and 5.5 need to link with -lthread or -lpthread, -# even though we already linked with these system libraries -# when we built libnspr.so. - ifeq ($(OS_RELEASE), 5.4) - EXTRA_LIBS = -lthread - endif - - ifeq ($(OS_RELEASE), 5.5) - ifdef USE_PTHREADS - EXTRA_LIBS = -lpthread - else - EXTRA_LIBS = -lthread - endif - endif - endif # LOCAL_THREADS_ONLY -endif # SunOS - -ifeq ($(OS_ARCH), WINNT) -ifeq ($(OS_TARGET), WIN16) - LIBPR = $(DIST)/lib/nspr$(MOD_VERSION).lib - LIBPL = $(DIST)/lib/plc$(MOD_VERSION).lib -else - LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO - LIBPR = $(DIST)/lib/libnspr$(MOD_VERSION).$(LIB_SUFFIX) - LIBPL = $(DIST)/lib/libplc$(MOD_VERSION).$(LIB_SUFFIX) -endif -endif - -ifeq ($(OS_ARCH),OS2) - ifeq ($(MOZ_OS2_TOOLS),VACPP) - LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO - LIBPR = $(DIST)/lib/nspr$(MOD_VERSION).lib - LIBPLC = $(DIST)/lib/plc$(MOD_VERSION).lib - else - LDOPTS += -Zomf -Zlinker /PM:VIO -lstdcpp - endif -endif - -ifneq ($(OS_ARCH), WINNT) -PWD = $(shell pwd) -endif - -ifeq ($(OS_ARCH), OSF1) -LDOPTS += -rpath $(PWD)/$(DIST)/lib -endif - -ifeq ($(OS_ARCH), HP-UX) - LDOPTS += -Wl,+s,+b,$(PWD)/$(DIST)/lib -endif - -# AIX -ifeq ($(OS_ARCH),AIX) - LDOPTS += -blibpath:$(PWD)/$(DIST)/lib:/usr/lib:/lib - ifeq ($(OS_ARCH)$(OS_RELEASE),AIX4.1) - LIBPR = -lnspr$(MOD_VERSION)_shr - LIBPLC = -lplc$(MOD_VERSION)_shr - else - LDOPTS += -brtl - EXTRA_LIBS = -ldl - endif -endif - -ifeq ($(OS_ARCH), Linux) - ifeq ($(OS_RELEASE), 1.2) - EXTRA_LIBS = -ldl - else - LDOPTS += -Xlinker -rpath $(PWD)/$(DIST)/lib - ifeq ($(USE_PTHREADS),1) - EXTRA_LIBS = -lpthread - endif - endif -endif - -ifeq ($(OS_ARCH), NCR) -# XXX: We see some strange problems when we link with libnspr.so. -# So for now we use static libraries on NCR. The shared library -# stuff below is commented out. -LIBPR = $(DIST)/lib/libnspr$(MOD_VERSION).a -LIBPL = $(DIST)/lib/libplc$(MOD_VERSION).a -EXTRA_LIBS = -lsocket -lnsl -ldl - -# NCR needs to link against -lsocket -lnsl (and -lc, which is linked -# implicitly by $(CC)) again even though we already linked with these -# system libraries when we built libnspr.so. -#EXTRA_LIBS = -lsocket -lnsl -# This hardcodes in the executable programs the directory to find -# libnspr.so etc. at program startup. Equivalent to the -R or -rpath -# option for ld on other platforms. -#export LD_RUN_PATH = $(PWD)/$(DIST)/lib -endif - -ifeq ($(OS_ARCH), SCO_SV) -# SCO Unix needs to link against -lsocket again even though we -# already linked with these system libraries when we built libnspr.so. -EXTRA_LIBS = -lsocket -# This hardcodes in the executable programs the directory to find -# libnspr.so etc. at program startup. Equivalent to the -R or -rpath -# option for ld on other platforms. -export LD_RUN_PATH = $(PWD)/$(DIST)/lib -endif - -ifeq ($(OS_ARCH), UNIXWARE) -export LD_RUN_PATH = $(PWD)/$(DIST)/lib -endif - -##################################################### -# -# The rules -# -##################################################### - -include $(MOD_DEPTH)/config/rules.mk - -AIX_PRE_4_2 = 0 -ifeq ($(OS_ARCH),AIX) -ifneq ($(OS_RELEASE),4.2) -ifneq ($(USE_PTHREADS), 1) -#AIX_PRE_4_2 = 1 -endif -endif -endif - -ifeq ($(AIX_PRE_4_2),1) - -# AIX releases prior to 4.2 need a special two-step linking hack -# in order to both override the system select() and be able to -# get at the original system select(). -# -# We use a pattern rule in ns/nspr20/config/rules.mk to generate -# the .$(OBJ_SUFFIX) file from the .c source file, then do the -# two-step linking hack below. - -$(OBJDIR)/%: $(OBJDIR)/%.$(OBJ_SUFFIX) - @$(MAKE_OBJDIR) - rm -f $@ $(AIX_TMP) - $(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(DIST)/lib/libnspr$(MOD_VERSION).a - $(CC) -o $@ $(AIX_TMP) $(AIX_WRAP) - rm -f $(AIX_TMP) - -else - -# All platforms that are not AIX pre-4.2. - -$(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX) - @$(MAKE_OBJDIR) -ifeq ($(OS_ARCH), WINNT) -ifeq ($(OS_TARGET),WIN16) - echo system windows >w16link - echo option map >>w16link - echo option stack=10K >>w16link - echo option heapsize=32K >>w16link - echo debug $(DEBUGTYPE) all >>w16link - echo name $@ >>w16link - echo file >>w16link - echo $< >>w16link - echo library >>w16link - echo $(LIBPR), >>w16link - echo $(LIBPL), >>w16link - echo winsock.lib >>w16link - wlink @w16link. -else - link $(LDOPTS) $< $(LIBPR) $(LIBPL) wsock32.lib -out:$@ -endif -else -ifeq ($(OS_ARCH),OS2) - $(LINK) $(LDOPTS) $< $(LIBGC) $(LIBPLC) $(LIBPR) $(OS_LIBS) $(EXTRA_LIBS) -o $@ -else - $(CCC) $(XCFLAGS) $< $(LDOPTS) $(LIBPR) $(LIBPL) $(EXTRA_LIBS) -o $@ -endif -endif -endif - -export:: $(TARGETS) -install:: export -clean:: - rm -f $(TARGETS) - diff --git a/pr/src/cplus/tests/Makefile.in b/pr/src/cplus/tests/Makefile.in index 4a6f3907..371da8a6 100644 --- a/pr/src/cplus/tests/Makefile.in +++ b/pr/src/cplus/tests/Makefile.in @@ -42,7 +42,7 @@ CXXSRCS = \ OBJS = $(addprefix $(OBJDIR)/,$(CXXSRCS:.cpp=.$(OBJ_SUFFIX))) -ifeq ($(OS_ARCH), WINNT) +ifeq (,$(filter-out WINNT OS2,$(OS_ARCH))) PROG_SUFFIX = .exe else PROG_SUFFIX = @@ -52,16 +52,16 @@ PROGS = $(addprefix $(OBJDIR)/, $(CXXSRCS:.cpp=$(PROG_SUFFIX))) TARGETS = $(PROGS) $(OBJS) -INCLUDES = -I.. -I$(DIST)/include +INCLUDES = -I.. -I$(dist_includedir) # Setting the variables LDOPTS and LIBPR. We first initialize # them to the default values, then adjust them for some platforms. -LDOPTS = -L$(DIST)/lib -LIBPR = -lnspr$(MOD_VERSION) -LIBPL = -lplc$(MOD_VERSION) +LDOPTS = -L$(dist_libdir) +LIBPR = -lnspr$(MOD_MAJOR_VERSION) +LIBPL = -lplc$(MOD_MAJOR_VERSION) ifeq ($(OS_ARCH), IRIX) - LDOPTS += -rpath $(PWD)/$(DIST)/lib -rdata_shared + LDOPTS += -rpath $(PWD)/$(dist_libdir) -rdata_shared # For 6.x machines, include this flag ifeq ($(basename $(OS_RELEASE)),6) ifeq ($(USE_N32),1) @@ -82,9 +82,9 @@ endif ifeq ($(OS_ARCH), SunOS) ifneq ($(OS_RELEASE), 4.1.3_U1) ifdef NS_USE_GCC - LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(DIST)/lib + LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(dist_libdir) else - LDOPTS += -R $(PWD)/$(DIST)/lib + LDOPTS += -R $(PWD)/$(dist_libdir) endif endif @@ -108,13 +108,23 @@ endif # SunOS ifeq ($(OS_ARCH), WINNT) ifeq ($(OS_TARGET), WIN16) - LIBPR = $(DIST)/lib/nspr$(MOD_VERSION).lib - LIBPL = $(DIST)/lib/plc$(MOD_VERSION).lib + LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).lib + LIBPL = $(dist_libdir)/plc$(MOD_MAJOR_VERSION).lib else LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO - LIBPR = $(DIST)/lib/libnspr$(MOD_VERSION).$(LIB_SUFFIX) - LIBPL = $(DIST)/lib/libplc$(MOD_VERSION).$(LIB_SUFFIX) + LIBPR = $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX) + LIBPL = $(dist_libdir)/libplc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX) +endif endif + +ifeq ($(OS_ARCH),OS2) + ifeq ($(MOZ_OS2_TOOLS),VACPP) + LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO + LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).lib + LIBPLC = $(dist_libdir)/plc$(MOD_MAJOR_VERSION).lib + else + LDOPTS += -Zomf -Zlinker /PM:VIO -lstdcpp + endif endif ifneq ($(OS_ARCH), WINNT) @@ -122,19 +132,19 @@ PWD = $(shell pwd) endif ifeq ($(OS_ARCH), OSF1) -LDOPTS += -rpath $(PWD)/$(DIST)/lib +LDOPTS += -rpath $(PWD)/$(dist_libdir) endif ifeq ($(OS_ARCH), HP-UX) - LDOPTS += -Wl,+s,+b,$(PWD)/$(DIST)/lib + LDOPTS += -Wl,+s,+b,$(PWD)/$(dist_libdir) endif # AIX ifeq ($(OS_ARCH),AIX) - LDOPTS += -blibpath:$(PWD)/$(DIST)/lib:/usr/lib:/lib + LDOPTS += -blibpath:$(PWD)/$(dist_libdir):/usr/lib:/lib ifeq ($(OS_ARCH)$(OS_RELEASE),AIX4.1) - LIBPR = -lnspr$(MOD_VERSION)_shr - LIBPLC = -lplc$(MOD_VERSION)_shr + LIBPR = -lnspr$(MOD_MAJOR_VERSION)_shr + LIBPLC = -lplc$(MOD_MAJOR_VERSION)_shr else LDOPTS += -brtl EXTRA_LIBS = -ldl @@ -145,7 +155,7 @@ ifeq ($(OS_ARCH), Linux) ifeq ($(OS_RELEASE), 1.2) EXTRA_LIBS = -ldl else - LDOPTS += -Xlinker -rpath $(PWD)/$(DIST)/lib + LDOPTS += -Xlinker -rpath $(PWD)/$(dist_libdir) ifeq ($(USE_PTHREADS),1) EXTRA_LIBS = -lpthread endif @@ -156,8 +166,8 @@ ifeq ($(OS_ARCH), NCR) # XXX: We see some strange problems when we link with libnspr.so. # So for now we use static libraries on NCR. The shared library # stuff below is commented out. -LIBPR = $(DIST)/lib/libnspr$(MOD_VERSION).a -LIBPL = $(DIST)/lib/libplc$(MOD_VERSION).a +LIBPR = $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).a +LIBPL = $(dist_libdir)/libplc$(MOD_MAJOR_VERSION).a EXTRA_LIBS = -lsocket -lnsl -ldl # NCR needs to link against -lsocket -lnsl (and -lc, which is linked @@ -167,7 +177,7 @@ EXTRA_LIBS = -lsocket -lnsl -ldl # This hardcodes in the executable programs the directory to find # libnspr.so etc. at program startup. Equivalent to the -R or -rpath # option for ld on other platforms. -#export LD_RUN_PATH = $(PWD)/$(DIST)/lib +#export LD_RUN_PATH = $(PWD)/$(dist_libdir) endif ifeq ($(OS_ARCH), SCO_SV) @@ -177,11 +187,11 @@ EXTRA_LIBS = -lsocket # This hardcodes in the executable programs the directory to find # libnspr.so etc. at program startup. Equivalent to the -R or -rpath # option for ld on other platforms. -export LD_RUN_PATH = $(PWD)/$(DIST)/lib +export LD_RUN_PATH = $(PWD)/$(dist_libdir) endif ifeq ($(OS_ARCH), UNIXWARE) -export LD_RUN_PATH = $(PWD)/$(DIST)/lib +export LD_RUN_PATH = $(PWD)/$(dist_libdir) endif ##################################################### @@ -214,7 +224,7 @@ ifeq ($(AIX_PRE_4_2),1) $(OBJDIR)/%: $(OBJDIR)/%.$(OBJ_SUFFIX) @$(MAKE_OBJDIR) rm -f $@ $(AIX_TMP) - $(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(DIST)/lib/libnspr$(MOD_VERSION).a + $(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).a $(CC) -o $@ $(AIX_TMP) $(AIX_WRAP) rm -f $(AIX_TMP) @@ -242,14 +252,16 @@ ifeq ($(OS_TARGET),WIN16) else link $(LDOPTS) $< $(LIBPR) $(LIBPL) wsock32.lib -out:$@ endif +else +ifeq ($(OS_ARCH),OS2) + $(LINK) $(LDOPTS) $< $(LIBGC) $(LIBPLC) $(LIBPR) $(OS_LIBS) $(EXTRA_LIBS) -o $@ else $(CCC) $(XCFLAGS) $< $(LDOPTS) $(LIBPR) $(LIBPL) $(EXTRA_LIBS) -o $@ endif - +endif endif export:: $(TARGETS) -install:: export clean:: rm -f $(TARGETS) diff --git a/pr/src/io/.cvsignore b/pr/src/io/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/pr/src/io/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/pr/src/io/Makefile b/pr/src/io/Makefile deleted file mode 100644 index d9cc321b..00000000 --- a/pr/src/io/Makefile +++ /dev/null @@ -1,65 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -#! gmake - -MOD_DEPTH = ../../.. - -include $(MOD_DEPTH)/config/config.mk - -# Disable optimization of the nspr on SunOS4.1.3 -ifeq ($(OS_ARCH),SunOS) -ifeq ($(OS_RELEASE),4.1.3_U1) -OPTIMIZER = -endif -endif - -CSRCS = \ - prfdcach.c \ - prmwait.c \ - priometh.c \ - pripv6.c \ - prmapopt.c \ - prlayer.c \ - prlog.c \ - prmmap.c \ - prpolevt.c \ - prprf.c \ - prscanf.c \ - prstdio.c \ - $(NULL) - -ifndef USE_PTHREADS - CSRCS += \ - prdir.c \ - prfile.c \ - prio.c \ - prsocket.c \ - $(NULL) -endif - -TARGETS = $(OBJS) - -INCLUDES = -I$(DIST)/include -I$(MOD_DEPTH)/pr/include -I$(MOD_DEPTH)/pr/include/private - -DEFINES += -D_NSPR_BUILD_ - -include $(MOD_DEPTH)/config/rules.mk - -export:: $(TARGETS) - -install:: export diff --git a/pr/src/io/Makefile.in b/pr/src/io/Makefile.in index b4272a8a..3c3e57d8 100644 --- a/pr/src/io/Makefile.in +++ b/pr/src/io/Makefile.in @@ -59,7 +59,7 @@ endif TARGETS = $(OBJS) -INCLUDES = -I$(DIST)/include -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private +INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private DEFINES += -D_NSPR_BUILD_ @@ -67,4 +67,3 @@ include $(topsrcdir)/config/rules.mk export:: $(TARGETS) -install:: export 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..398a2edd 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 @@ -170,7 +181,7 @@ void _PR_InitLog(void) PRInt32 bufSize = DEFAULT_BUF_SIZE; while (pos < evlen) { PRIntn level = 1, count = 0, delta = 0; - count = sscanf(&ev[pos], "%64[A-Za-z0-9]%n:%d%n", + count = sscanf(&ev[pos], "%64[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789]%n:%d%n", module, &delta, &level, &delta); pos += delta; if (count == 0) break; @@ -255,7 +266,7 @@ static void _PR_SetLogModuleLevel( PRLogModuleInfo *lm ) while (pos < evlen) { PRIntn level = 1, count = 0, delta = 0; - count = sscanf(&ev[pos], "%64[A-Za-z0-9]%n:%d%n", + count = sscanf(&ev[pos], "%64[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789]%n:%d%n", module, &delta, &level, &delta); pos += delta; if (count == 0) break; @@ -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 +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/prprf.c b/pr/src/io/prprf.c index 1da92e84..92856359 100644 --- a/pr/src/io/prprf.c +++ b/pr/src/io/prprf.c @@ -36,7 +36,9 @@ ** and requires array notation. */ #if (defined(LINUX) && defined(__powerpc__)) || defined(WIN16) || \ - defined(QNX) || (defined(__NetBSD__) && defined(__powerpc__)) + defined(QNX) || \ + (defined(__NetBSD__) && defined(__powerpc__) && \ + __NetBSD_Version__ < 105000000) #define VARARGS_ASSIGN(foo, bar) foo[0] = bar[0] #else #define VARARGS_ASSIGN(foo, bar) (foo) = (bar) 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/.cvsignore b/pr/src/linking/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/pr/src/linking/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/pr/src/linking/Makefile b/pr/src/linking/Makefile deleted file mode 100644 index 26baca79..00000000 --- a/pr/src/linking/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -#! gmake - -MOD_DEPTH = ../../.. - -include $(MOD_DEPTH)/config/config.mk - -# Disable optimization of the nspr on SunOS4.1.3 -ifeq ($(OS_ARCH),SunOS) -ifeq ($(OS_RELEASE),4.1.3_U1) -OPTIMIZER = -endif -endif - -CSRCS = \ - prlink.c \ - $(NULL) - -TARGETS = $(OBJS) - -INCLUDES = -I$(DIST)/include -I$(MOD_DEPTH)/pr/include -I$(MOD_DEPTH)/pr/include/private - -DEFINES += -D_NSPR_BUILD_ - -include $(MOD_DEPTH)/config/rules.mk - -export:: $(TARGETS) - -install:: export diff --git a/pr/src/linking/Makefile.in b/pr/src/linking/Makefile.in index d518a886..56637fb2 100644 --- a/pr/src/linking/Makefile.in +++ b/pr/src/linking/Makefile.in @@ -39,7 +39,7 @@ CSRCS = \ TARGETS = $(OBJS) -INCLUDES = -I$(DIST)/include -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private +INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private DEFINES += -D_NSPR_BUILD_ @@ -47,4 +47,3 @@ include $(topsrcdir)/config/rules.mk export:: $(TARGETS) -install:: export diff --git a/pr/src/linking/prlink.c b/pr/src/linking/prlink.c index e4d093f1..f10f6f94 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,82 @@ 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 *endOfSystemName = strrchr(info.name, '/'); + char *endOfPassedName = strrchr(name, '/'); + if( 0 == endOfSystemName ) + endOfSystemName=info.name; + else + endOfSystemName++; + if( 0 == endOfPassedName ) + endOfPassedName=name; + else + endOfPassedName++; + if (strcmp(endOfSystemName, endOfPassedName) == 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 +870,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; @@ -858,6 +941,8 @@ pr_Mac_LoadNamedFragment(const FSSpec *fileSpec, const char* fragmentName) unlock: if (result == NULL) { + if (newLib != NULL) + PR_DELETE(newLib); PR_SetError(PR_LOAD_LIBRARY_ERROR, _MD_ERRNO()); DLLErrorInternal(_MD_ERRNO()); /* sets error text */ } @@ -920,6 +1005,8 @@ pr_Mac_LoadIndexedFragment(const FSSpec *fileSpec, PRUint32 fragIndex) unlock: if (result == NULL) { + if (newLib != NULL) + PR_DELETE(newLib); PR_SetError(PR_LOAD_LIBRARY_ERROR, _MD_ERRNO()); DLLErrorInternal(_MD_ERRNO()); /* sets error text */ } @@ -976,7 +1063,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 +1170,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/malloc/.cvsignore b/pr/src/malloc/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/pr/src/malloc/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/pr/src/malloc/Makefile b/pr/src/malloc/Makefile deleted file mode 100644 index 1e85dc5c..00000000 --- a/pr/src/malloc/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -#! gmake - -MOD_DEPTH = ../../.. - -include $(MOD_DEPTH)/config/config.mk - -# Disable optimization of the nspr on SunOS4.1.3 -ifeq ($(OS_ARCH),SunOS) -ifeq ($(OS_RELEASE),4.1.3_U1) -OPTIMIZER = -endif -endif - -TARGETS = $(OBJS) - -INCLUDES = -I$(DIST)/include -I$(MOD_DEPTH)/pr/include -I$(MOD_DEPTH)/pr/include/private - -DEFINES += -D_NSPR_BUILD_ - -CSRCS = prmalloc.c prmem.c - -include $(MOD_DEPTH)/config/rules.mk - -export:: $(TARGETS) - -install:: export diff --git a/pr/src/malloc/Makefile.in b/pr/src/malloc/Makefile.in index d058996d..0dddedc5 100644 --- a/pr/src/malloc/Makefile.in +++ b/pr/src/malloc/Makefile.in @@ -35,7 +35,7 @@ endif TARGETS = $(OBJS) -INCLUDES = -I$(DIST)/include -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private +INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private DEFINES += -D_NSPR_BUILD_ @@ -45,4 +45,3 @@ include $(topsrcdir)/config/rules.mk export:: $(TARGETS) -install:: export diff --git a/pr/src/md/.cvsignore b/pr/src/md/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/pr/src/md/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/pr/src/md/Makefile b/pr/src/md/Makefile deleted file mode 100644 index cb047e20..00000000 --- a/pr/src/md/Makefile +++ /dev/null @@ -1,59 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -#! gmake - -MOD_DEPTH = ../../.. - -include $(MOD_DEPTH)/config/config.mk - -ifeq ($(OS_ARCH),WINNT) - DIRS = windows -else - ifeq ($(OS_ARCH),OS2) - DIRS = os2 - else - ifeq ($(OS_ARCH),BeOS) - DIRS = beos - else - DIRS = unix - endif - endif -endif - -# Disable optimization of the nspr on SunOS4.1.3 -ifeq ($(OS_ARCH),SunOS) -ifeq ($(OS_RELEASE),4.1.3_U1) -OPTIMIZER = -endif -endif - -CSRCS = \ - prosdep.c \ - $(NULL) - -TARGETS = $(OBJS) - -INCLUDES = -I$(DIST)/include -I$(MOD_DEPTH)/pr/include - -DEFINES += -D_NSPR_BUILD_ - -include $(MOD_DEPTH)/config/rules.mk - -export:: $(TARGETS) - -install:: export diff --git a/pr/src/md/Makefile.in b/pr/src/md/Makefile.in index 5e78b60b..f9157722 100644 --- a/pr/src/md/Makefile.in +++ b/pr/src/md/Makefile.in @@ -26,30 +26,7 @@ include $(MOD_DEPTH)/config/autoconf.mk include $(topsrcdir)/config/config.mk -ifdef USE_AUTOCONF DIRS = $(PR_MD_ARCH_DIR) -else -ifeq ($(OS_ARCH),WINNT) - ifeq ($(OS_TARGET),OS2) - DIRS = os2 - else - DIRS = windows - endif -else - ifeq ($(OS_ARCH),BeOS) - DIRS = beos - else - DIRS = unix - endif -endif - -# Disable optimization of the nspr on SunOS4.1.3 -ifeq ($(OS_ARCH),SunOS) -ifeq ($(OS_RELEASE),4.1.3_U1) -OPTIMIZER = -endif -endif -endif # USE_AUTOCONF CSRCS = \ prosdep.c \ @@ -57,7 +34,7 @@ CSRCS = \ TARGETS = $(OBJS) -INCLUDES = -I$(DIST)/include -I$(topsrcdir)/pr/include +INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include DEFINES += -D_NSPR_BUILD_ @@ -65,4 +42,3 @@ include $(topsrcdir)/config/rules.mk export:: $(TARGETS) -install:: export diff --git a/pr/src/md/beos/.cvsignore b/pr/src/md/beos/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/pr/src/md/beos/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/pr/src/md/beos/Makefile b/pr/src/md/beos/Makefile deleted file mode 100644 index ce21aece..00000000 --- a/pr/src/md/beos/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# -# The contents of this file are subject to the Mozilla Public License -# Version 1.1 (the "MPL"); you may not use this file except in -# compliance with the MPL. You may obtain a copy of the MPL at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the MPL is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the MPL -# for the specific language governing rights and limitations under the -# MPL. -# - -MOD_DEPTH = ../../../.. - -include $(MOD_DEPTH)/config/config.mk - -include bsrcs.mk -CSRCS += $(MDCSRCS) - -TARGETS = $(OBJS) - -INCLUDES = -I$(DIST)/include -I$(MOD_DEPTH)/pr/include -I$(MOD_DEPTH)/pr/include/private - -DEFINES += -D_NSPR_BUILD_ - -include $(MOD_DEPTH)/config/rules.mk - -export:: $(TARGETS) - -install:: export diff --git a/pr/src/md/beos/Makefile.in b/pr/src/md/beos/Makefile.in index 9e407a95..024bde8b 100644 --- a/pr/src/md/beos/Makefile.in +++ b/pr/src/md/beos/Makefile.in @@ -24,7 +24,7 @@ CSRCS += $(MDCSRCS) TARGETS = $(OBJS) -INCLUDES = -I$(DIST)/include -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private +INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private DEFINES += -D_NSPR_BUILD_ @@ -32,4 +32,3 @@ include $(topsrcdir)/config/rules.mk export:: $(TARGETS) -install:: export 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..910803c6 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 // 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 { @@ -45,11 +51,10 @@ static struct { void * cookie; } dnsContext; -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 +64,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,26 +98,20 @@ 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); + dnsContext.serviceRef = NULL; dnsContext.lock = PR_NewLock(); PR_ASSERT(dnsContext.lock != NULL); dnsContext.thread = _PR_MD_CURRENT_THREAD(); dnsContext.cookie = NULL; - gOTInitialized = PR_FALSE; - /* XXX Does not handle absence of open tpt and tcp yet! */ } @@ -124,36 +119,65 @@ static void _MD_FinishInitNetAccess() { OSStatus errOT; + if (dnsContext.serviceRef) + return; + dnsContext.serviceRef = OT_OPEN_INTERNET_SERVICES(kDefaultInternetServicesPath, NULL, &errOT); - if (errOT != kOTNoError) return; /* no network -- oh well */ + if (errOT != kOTNoError) { + dnsContext.serviceRef = NULL; + return; /* no network -- oh well */ + } + 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 */ errOT = OTSetAsynchronous(dnsContext.serviceRef); PR_ASSERT(errOT == kOTNoError); - - gOTInitialized = PR_TRUE; } -pascal void DNSNotifierRoutine(void * contextPtr, OTEventCode code, OTResult result, void * cookie) +static pascal void DNSNotifierRoutine(void * contextPtr, OTEventCode otEvent, OTResult result, void * cookie) { #pragma unused(contextPtr) _PRCPU * cpu = _PR_MD_CURRENT_CPU(); - - if (code == T_DNRSTRINGTOADDRCOMPLETE) { + OSStatus errOT; + dnsContext.thread->md.osErrCode = result; dnsContext.cookie = cookie; - if (_PR_MD_GET_INTSOFF()) { - cpu->u.missed[cpu->where] |= _PR_MISSED_IO; - dnsContext.thread->md.missedIONotify = PR_TRUE; - return; - } - DoneWaitingOnThisThread(dnsContext.thread); + + switch (otEvent) { + case T_DNRSTRINGTOADDRCOMPLETE: + if (_PR_MD_GET_INTSOFF()) { + cpu->u.missed[cpu->where] |= _PR_MISSED_IO; + dnsContext.thread->md.missedIONotify = PR_TRUE; + return; + } + DoneWaitingOnThisThread(dnsContext.thread); + break; + + case kOTProviderWillClose: + errOT = OTSetSynchronous(dnsContext.serviceRef); + // fall through to kOTProviderIsClosed case + + case kOTProviderIsClosed: + errOT = OTCloseProvider((ProviderRef)dnsContext.serviceRef); + dnsContext.serviceRef = nil; + + if (_PR_MD_GET_INTSOFF()) { + cpu->u.missed[cpu->where] |= _PR_MISSED_IO; + dnsContext.thread->md.missedIONotify = PR_TRUE; + return; + } + DoneWaitingOnThisThread(dnsContext.thread); + break; + + default: // or else we don't handle the event + PR_ASSERT(otEvent==NULL); + } // or else we don't handle the event } @@ -262,12 +286,13 @@ 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); EndpointRef endpoint = (EndpointRef)secret->md.osfd; PRThread * thread = NULL; + PRThread * pollThread = md->poll.thread; OSStatus err; OTResult resultOT; TDiscon discon; @@ -301,7 +326,6 @@ pascal void NotifierRoutine(void * contextPtr, OTEventCode code, OTResult resul thread = secret->md.write.thread; secret->md.write.thread = NULL; secret->md.write.cookie = cookie; - secret->md.connectionOpen = PR_TRUE; break; case T_DATA: // Standard data is available @@ -323,7 +347,6 @@ pascal void NotifierRoutine(void * contextPtr, OTEventCode code, OTResult resul err = OTRcvDisconnect(endpoint, &discon); PR_ASSERT(err == kOTNoError); secret->md.exceptReady = PR_TRUE; - secret->md.connectionOpen = PR_FALSE; // wake up waiting threads, if any result = -3199 - discon.reason; // obtain the negative error code @@ -356,7 +379,7 @@ pascal void NotifierRoutine(void * contextPtr, OTEventCode code, OTResult resul PR_ASSERT(err == kOTNoError); secret->md.readReady = PR_TRUE; // mark readable (to emulate bsd sockets) // remember connection is closed, so we can return 0 on read or receive - secret->md.connectionOpen = PR_FALSE; + secret->md.orderlyDisconnect = PR_TRUE; thread = secret->md.read.thread; secret->md.read.thread = NULL; @@ -430,7 +453,11 @@ pascal void NotifierRoutine(void * contextPtr, OTEventCode code, OTResult resul return; } - WakeUpNotifiedThread(thread, result); + if (pollThread) + WakeUpNotifiedThread(pollThread, kOTNoError); + + if (thread && (thread != pollThread)) + WakeUpNotifiedThread(thread, result); } @@ -473,7 +500,6 @@ PRInt32 _MD_socket(int domain, int type, int protocol) OSStatus err; EndpointRef endpoint; - if (!gOTInitialized) _MD_FinishInitNetAccess(); // We only deal with internet domain @@ -1037,7 +1063,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 +1220,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 +1376,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 +1388,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 +1456,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 ); @@ -1442,9 +1468,6 @@ static PRInt32 SendReceiveStream(PRFileDesc *fd, void *buf, PRInt32 amount, return result; } else { switch (result) { - case kOTOutStateErr: // it has been closed - return 0; - case kOTLookErr: PR_ASSERT(!"call to OTLook() required after all."); break; @@ -1464,6 +1487,9 @@ static PRInt32 SendReceiveStream(PRFileDesc *fd, void *buf, PRInt32 amount, goto ErrorExit; break; + case kOTOutStateErr: // if provider already closed, fall through to handle error + if (fd->secret->md.orderlyDisconnect) + return 0; default: err = result; goto ErrorExit; @@ -1471,9 +1497,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; } @@ -1633,8 +1663,13 @@ PRInt32 _MD_writev(PRFileDesc *fd, const struct PRIOVec *iov, PRInt32 iov_size, static PRBool GetState(PRFileDesc *fd, PRBool *readReady, PRBool *writeReady, PRBool *exceptReady) { OTResult resultOT; - - *readReady = fd->secret->md.readReady; + // hack to emulate BSD sockets; say that a socket that has disconnected + // is still readable. + size_t availableData = 1; + if (!fd->secret->md.orderlyDisconnect) + OTCountDataBytes((EndpointRef)fd->secret->md.osfd, &availableData); + + *readReady = fd->secret->md.readReady && (availableData > 0); *exceptReady = fd->secret->md.exceptReady; resultOT = OTGetEndpointState((EndpointRef)fd->secret->md.osfd); @@ -1650,22 +1685,13 @@ static PRBool GetState(PRFileDesc *fd, PRBool *readReady, PRBool *writeReady, PR return *readReady || *writeReady || *exceptReady; } - -PRInt32 _MD_poll(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout) +// check to see if any of the poll descriptors have data available +// for reading or writing. +static PRInt32 CheckPollDescs(PRPollDesc *pds, PRIntn npds) { PRInt32 ready = 0; PRPollDesc *pd, *epd; - PRIntervalTime sleepTime, timein; - sleepTime = PR_MillisecondsToInterval(5UL); - if (PR_INTERVAL_NO_TIMEOUT != timeout) - { - if (sleepTime > timeout) sleepTime = timeout; - timein = PR_IntervalNow(); - } - - do - { for (pd = pds, epd = pd + npds; pd < epd; pd++) { PRInt16 in_flags_read = 0, in_flags_write = 0; @@ -1697,8 +1723,9 @@ PRInt32 _MD_poll(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout) pd->out_flags = 0; /* pre-condition */ bottomFD = PR_GetIdentitiesLayer(pd->fd, PR_NSPR_IO_LAYER); PR_ASSERT(NULL != bottomFD); - if ((NULL != bottomFD) && (_PR_FILEDESC_OPEN == bottomFD->secret->state)) - { + + if (bottomFD && (_PR_FILEDESC_OPEN == bottomFD->secret->state)) + { if (GetState(bottomFD, &readReady, &writeReady, &exceptReady)) { if (readReady) @@ -1722,7 +1749,7 @@ PRInt32 _MD_poll(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout) if (0 != pd->out_flags) ready++; } } - else + else /* bad state */ { ready += 1; /* this will cause an abrupt return */ pd->out_flags = PR_POLL_NVAL; /* bogii */ @@ -1730,14 +1757,69 @@ PRInt32 _MD_poll(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout) } } - if (ready > 0) return ready; + return ready; +} + +// set or clear md.poll.thread on the poll descriptors +static void SetDescPollThread(PRPollDesc *pds, PRIntn npds, PRThread* thread) +{ + PRInt32 ready = 0; + PRPollDesc *pd, *epd; + + for (pd = pds, epd = pd + npds; pd < epd; pd++) + { + if (pd->fd) + { + PRFileDesc *bottomFD = PR_GetIdentitiesLayer(pd->fd, PR_NSPR_IO_LAYER); + PR_ASSERT(NULL != bottomFD); + if (bottomFD && (_PR_FILEDESC_OPEN == bottomFD->secret->state)) + { + bottomFD->secret->md.poll.thread = thread; + } + } + } +} + +PRInt32 _MD_poll(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout) +{ + PRThread *thread = _PR_MD_CURRENT_THREAD(); + intn is; + PRInt32 ready; + OSErr result; + + if (timeout == PR_INTERVAL_NO_WAIT) { + return CheckPollDescs(pds, npds); + } + + _PR_INTSOFF(is); + PR_Lock(thread->md.asyncIOLock); - (void) PR_Sleep(sleepTime); + // ensure that we don't miss the firing of the notifier while checking socket status + // need to set up the thread + PrepareForAsyncCompletion(thread, 0); - } while ((timeout == PR_INTERVAL_NO_TIMEOUT) || - (((PRIntervalTime)(PR_IntervalNow() - timein)) < timeout)); + SetDescPollThread(pds, npds, thread); + ready = CheckPollDescs(pds, npds); - return 0; /* timed out */ + PR_Unlock(thread->md.asyncIOLock); + _PR_FAST_INTSON(is); + + if (ready == 0) { + WaitOnThisThread(thread, timeout); + result = thread->md.osErrCode; + if (result != noErr && result != kETIMEDOUTErr) { + PR_ASSERT(0); /* debug: catch unexpected errors */ + ready = -1; + } else { + ready = CheckPollDescs(pds, npds); + } + } else { + thread->io_pending = PR_FALSE; + } + + SetDescPollThread(pds, npds, NULL); + + return ready; } @@ -1752,7 +1834,7 @@ void _MD_initfiledesc(PRFileDesc *fd) PR_ASSERT(fd->secret->md.miscLock == NULL); fd->secret->md.miscLock = PR_NewLock(); PR_ASSERT(fd->secret->md.miscLock != NULL); - fd->secret->md.connectionOpen = PR_FALSE; // starts out closed + fd->secret->md.orderlyDisconnect = PR_FALSE; fd->secret->md.readReady = PR_FALSE; // let's not presume we have data ready to read fd->secret->md.writeReady = PR_TRUE; // let's presume we can write unless we hear otherwise fd->secret->md.exceptReady = PR_FALSE; @@ -1789,7 +1871,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 @@ -1862,11 +1944,11 @@ PR_IMPLEMENT(unsigned long) inet_addr(const char *cp) OSStatus err; InetHost host; - if (!gOTInitialized) _MD_FinishInitNetAccess(); err = OTInetStringToHost((char*) cp, &host); - PR_ASSERT(err == kOTNoError); + if (err != kOTNoError) + return -1; return host; } @@ -1884,7 +1966,6 @@ PR_IMPLEMENT(struct hostent *) gethostbyname(const char * name) PRUint32 index; PRThread *me = _PR_MD_CURRENT_THREAD(); - if (!gOTInitialized) _MD_FinishInitNetAccess(); me->io_pending = PR_TRUE; @@ -1925,7 +2006,6 @@ PR_IMPLEMENT(struct hostent *) gethostbyaddr(const void *addr, int addrlen, int PR_ASSERT(type == AF_INET); PR_ASSERT(addrlen == sizeof(struct in_addr)); - if (!gOTInitialized) _MD_FinishInitNetAccess(); OTInetHostToString((InetHost)addr, sHostInfo.name); @@ -1936,7 +2016,6 @@ PR_IMPLEMENT(struct hostent *) gethostbyaddr(const void *addr, int addrlen, int PR_IMPLEMENT(char *) inet_ntoa(struct in_addr addr) { - if (!gOTInitialized) _MD_FinishInitNetAccess(); OTInetHostToString((InetHost)addr.s_addr, sHostInfo.name); @@ -1950,7 +2029,6 @@ PRStatus _MD_gethostname(char *name, int namelen) OSStatus err; InetInterfaceInfo info; - if (!gOTInitialized) _MD_FinishInitNetAccess(); /* diff --git a/pr/src/md/mac/macthr.c b/pr/src/md/mac/macthr.c index 53d61206..59b67a67 100644 --- a/pr/src/md/mac/macthr.c +++ b/pr/src/md/mac/macthr.c @@ -275,6 +275,8 @@ void WaitOnThisThread(PRThread *thread, PRIntervalTime timeout) thread->md.osErrCode = kETIMEDOUTErr; PR_SetError(PR_IO_TIMEOUT_ERROR, kETIMEDOUTErr); } + + thread->io_pending = PR_FALSE; PR_Unlock(thread->md.asyncIOLock); _PR_FAST_INTSON(is); } 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/.cvsignore b/pr/src/md/os2/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/pr/src/md/os2/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/pr/src/md/os2/Makefile b/pr/src/md/os2/Makefile deleted file mode 100644 index 03e4c863..00000000 --- a/pr/src/md/os2/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -#! gmake - -MOD_DEPTH = ../../../.. - -include $(MOD_DEPTH)/config/config.mk - -ifeq ($(OS_TARGET), OS2) -CSRCS = \ - os2misc.c \ - os2sem.c \ - os2inrval.c \ - os2gc.c \ - os2thred.c \ - os2io.c \ - os2cv.c \ - os2sock.c \ - os2_errors.c \ - os2poll.c \ - os2rng.c \ - $(NULL) -endif - -TARGETS = $(OBJS) - -INCLUDES = -I$(DIST)/include -I$(MOD_DEPTH)/pr/include -I$(MOD_DEPTH)/pr/include/private - -DEFINES += -D_NSPR_BUILD_ - -include $(MOD_DEPTH)/config/rules.mk - -export:: $(TARGETS) - -install:: export - - - diff --git a/pr/src/md/os2/Makefile.in b/pr/src/md/os2/Makefile.in index 72414033..08f866d7 100644 --- a/pr/src/md/os2/Makefile.in +++ b/pr/src/md/os2/Makefile.in @@ -38,12 +38,13 @@ CSRCS = \ os2sock.c \ os2_errors.c \ os2poll.c \ + os2rng.c \ $(NULL) endif TARGETS = $(OBJS) -INCLUDES = -I$(DIST)/include -I$(MOD_DEPTH)/pr/include -I$(MOD_DEPTH)/pr/include/private +INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private DEFINES += -D_NSPR_BUILD_ @@ -51,7 +52,6 @@ include $(topsrcdir)/config/rules.mk export:: $(TARGETS) -install:: export diff --git a/pr/src/md/os2/objs.mk b/pr/src/md/os2/objs.mk new file mode 100644 index 00000000..82693637 --- /dev/null +++ b/pr/src/md/os2/objs.mk @@ -0,0 +1,37 @@ +# +# 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) 1998 Netscape Communications Corporation. All Rights +# Reserved. +# + +# This makefile appends to the variable OBJS the platform-dependent +# object modules that will be part of the nspr20 library. + +CSRCS = \ + os2io.c \ + os2sock.c \ + os2thred.c \ + os2cv.c \ + os2gc.c \ + os2misc.c \ + os2inrval.c \ + os2sem.c \ + os2_errors.c \ + os2poll.c \ + os2rng.c \ + $(NULL) + +OBJS += $(addprefix md/os2/$(OBJDIR)/,$(CSRCS:.c=.$(OBJ_SUFFIX))) \ + $(addprefix md/os2/$(OBJDIR)/,$(ASFILES:.s=.$(OBJ_SUFFIX))) + diff --git a/pr/src/md/os2/os2cv.c b/pr/src/md/os2/os2cv.c index 1205f3af..f91ae80d 100644 --- a/pr/src/md/os2/os2cv.c +++ b/pr/src/md/os2/os2cv.c @@ -219,7 +219,7 @@ static void md_PostNotifyToCvar(_MDCVar *cvar, _MDLock *lock, * 0 when it succeeds. * */ -PR_IMPLEMENT(PRInt32) +PRInt32 _PR_MD_NEW_CV(_MDCVar *cv) { cv->magic = _MD_MAGIC_CV; @@ -230,7 +230,7 @@ _PR_MD_NEW_CV(_MDCVar *cv) return 0; } -PR_IMPLEMENT(void) _PR_MD_FREE_CV(_MDCVar *cv) +void _PR_MD_FREE_CV(_MDCVar *cv) { cv->magic = (PRUint32)-1; return; @@ -239,7 +239,7 @@ PR_IMPLEMENT(void) _PR_MD_FREE_CV(_MDCVar *cv) /* * _PR_MD_WAIT_CV() -- Wait on condition variable */ -PR_IMPLEMENT(void) +void _PR_MD_WAIT_CV(_MDCVar *cv, _MDLock *lock, PRIntervalTime timeout ) { PRThread *thred = _PR_MD_CURRENT_THREAD(); @@ -306,21 +306,21 @@ _PR_MD_WAIT_CV(_MDCVar *cv, _MDLock *lock, PRIntervalTime timeout ) return; } /* --- end _PR_MD_WAIT_CV() --- */ -PR_IMPLEMENT(void) +void _PR_MD_NOTIFY_CV(_MDCVar *cv, _MDLock *lock) { md_PostNotifyToCvar(cv, lock, PR_FALSE); return; } -PR_IMPLEMENT(void) +void _PR_MD_NOTIFYALL_CV(_MDCVar *cv, _MDLock *lock) { md_PostNotifyToCvar(cv, lock, PR_TRUE); return; } -PR_IMPLEMENT(void) +void _PR_MD_UNLOCK(_MDLock *lock) { if (0 != lock->notified.length) { diff --git a/pr/src/md/os2/os2inrval.c b/pr/src/md/os2/os2inrval.c index ecba3068..ea2dd38a 100644 --- a/pr/src/md/os2/os2inrval.c +++ b/pr/src/md/os2/os2inrval.c @@ -29,7 +29,7 @@ PRInt32 _os2_highMask = 0; -PR_IMPLEMENT(void) +void _PR_MD_INTERVAL_INIT() { if (DosTmrQueryFreq(&_os2_ticksPerSec) == NO_ERROR) @@ -46,7 +46,7 @@ _PR_MD_INTERVAL_INIT() PR_ASSERT(_os2_ticksPerSec > PR_INTERVAL_MIN && _os2_ticksPerSec < PR_INTERVAL_MAX); } -PR_IMPLEMENT(PRIntervalTime) +PRIntervalTime _PR_MD_GET_INTERVAL() { QWORD count; @@ -69,7 +69,7 @@ _PR_MD_GET_INTERVAL() } } -PR_IMPLEMENT(PRIntervalTime) +PRIntervalTime _PR_MD_INTERVAL_PER_SEC() { if(_os2_ticksPerSec != -1) 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/os2/os2misc.c b/pr/src/md/os2/os2misc.c index 27277e68..28c9a641 100644 --- a/pr/src/md/os2/os2misc.c +++ b/pr/src/md/os2/os2misc.c @@ -473,7 +473,7 @@ PRStatus _MD_OS2GetHostName(char *name, PRUint32 namelen) return PR_FAILURE; } -PR_IMPLEMENT(void) +void _PR_MD_WAKEUP_CPUS( void ) { return; diff --git a/pr/src/md/os2/os2poll.c b/pr/src/md/os2/os2poll.c index 47b1791e..99740c66 100644 --- a/pr/src/md/os2/os2poll.c +++ b/pr/src/md/os2/os2poll.c @@ -61,6 +61,9 @@ PRInt32 _PR_MD_PR_POLL( return 0; } + remaining = timeout; + start = PR_IntervalNow(); + FD_ZERO(&rd); FD_ZERO(&wt); FD_ZERO(&ex); @@ -161,9 +164,6 @@ PRInt32 _PR_MD_PR_POLL( if (0 != ready) return ready; /* no need to block */ - remaining = timeout; - start = PR_IntervalNow(); - retry: if (timeout != PR_INTERVAL_NO_TIMEOUT) { @@ -260,3 +260,151 @@ retry: return ready; } +#ifdef XP_OS2_EMX +HMTX thread_select_mutex = 0; /* because EMX's select is not thread safe - duh! */ + +typedef struct _thread_select_st { + int nfds; + int isrdfds; + struct _fd_set *readfds; + int iswrfds; + struct _fd_set *writefds; + int isexfds; + struct _fd_set *exceptfds; + int istimeout; + struct timeval timeout; + volatile HEV event; + int result; + int select_errno; + volatile int done; +} *pthread_select_t; + +void _thread_select(void * arg) +{ + pthread_select_t self = arg; + int result, chkstdin; + struct _fd_set readfds; + struct _fd_set writefds; + struct _fd_set exceptfds; + HEV event = self->event; + + chkstdin = (self->isrdfds && FD_ISSET(0,self->readfds))?1:0; + + do { + struct timeval timeout = {0L,0L}; + + + if (self->isrdfds) readfds = *self->readfds; + if (self->iswrfds) writefds = *self->writefds; + if (self->isexfds) exceptfds = *self->exceptfds; + + if (chkstdin) FD_CLR(0,&readfds); + + if (!thread_select_mutex) + DosCreateMutexSem(NULL,&thread_select_mutex,0,1); + else + DosRequestMutexSem(thread_select_mutex,SEM_INDEFINITE_WAIT); + result = select( + self->nfds, + self->isrdfds?&readfds:NULL, + self->iswrfds?&writefds:NULL, + self->isexfds?&exceptfds:NULL, + &timeout); + DosReleaseMutexSem(thread_select_mutex); + + if (chkstdin) { + int charcount = 0, res; + res = ioctl(0,FIONREAD,&charcount); + if (res==0 && charcount>0) FD_SET(0,&readfds); + } + + if (result>0) { + self->done++; + if (self->isrdfds) *self->readfds = readfds; + if (self->iswrfds) *self->writefds = writefds; + if (self->isexfds) *self->exceptfds = exceptfds; + } else + if (result) self->done++; + else DosSleep(1); + + } while (self->event!=0 && self->done==0); + + if (self->event) { + self->select_errno = (result < 0)?errno:0; + self->result = result; + self->done = 3; + DosPostEventSem(event); + } else { + self->done = 3; + free(self); + } + +} + +PRInt32 +_MD_SELECT(int nfds, fd_set *readfds, fd_set *writefds, + fd_set *exceptfds, struct timeval *timeout) +{ + pthread_select_t sel; + HEV ev = 0; + HTIMER timer = 0; + int result = 0; + APIRET rc; + unsigned long msecs = SEM_INDEFINITE_WAIT; + + if (timeout) { + if (timeout->tv_sec != 0 || timeout->tv_usec != 0) + msecs = (timeout->tv_sec * 1000L) + (timeout->tv_usec / 1000L); + else + msecs = SEM_IMMEDIATE_RETURN; + }; + + if (!(sel = (pthread_select_t) malloc(sizeof(struct _thread_select_st)))) { + result = -1; + errno = ENOMEM; + } else { + sel->nfds = nfds; + sel->isrdfds = readfds?1:0; + if (sel->isrdfds) sel->readfds = readfds; + sel->iswrfds = writefds?1:0; + if (sel->iswrfds) sel->writefds = writefds; + sel->isexfds = exceptfds?1:0; + if (sel->isexfds) sel->exceptfds = exceptfds; + sel->istimeout = timeout?1:0; + if (sel->istimeout) sel->timeout = *timeout; + + rc = DosCreateEventSem(NULL,&ev,0,FALSE); + + sel->event = ev; + if (msecs == SEM_IMMEDIATE_RETURN) + sel->done = 1; + else + sel->done = 0; + + if (_beginthread(_thread_select,NULL,65536,(void *)sel) == -1) { + result = -1; sel->event = 0; + DosCloseEventSem(ev); + } else { + rc = DosWaitEventSem(ev,msecs); + if ((!sel->done) && (msecs != SEM_IMMEDIATE_RETURN)) { /* Interrupted by other thread or timeout */ + sel->event = 0; + result = 0; + errno = ETIMEDOUT; + + } else { + while (sel->done && sel->done != 3) { + DosSleep(1); + } + sel->event = 0; + result = sel->result; + if (sel->select_errno) errno = sel->select_errno; + free(sel); + } + rc = DosCloseEventSem(ev); + } + } + + return (result); +} + +#endif diff --git a/pr/src/md/os2/os2sem.c b/pr/src/md/os2/os2sem.c index 86a41f58..57131beb 100644 --- a/pr/src/md/os2/os2sem.c +++ b/pr/src/md/os2/os2sem.c @@ -24,7 +24,7 @@ #include "primpl.h" -PR_IMPLEMENT(void) +void _PR_MD_NEW_SEM(_MDSemaphore *md, PRUintn value) { int rv; @@ -36,7 +36,7 @@ _PR_MD_NEW_SEM(_MDSemaphore *md, PRUintn value) PR_ASSERT(rv == NO_ERROR); } -PR_IMPLEMENT(void) +void _PR_MD_DESTROY_SEM(_MDSemaphore *md) { int rv; @@ -45,7 +45,7 @@ _PR_MD_DESTROY_SEM(_MDSemaphore *md) } -PR_IMPLEMENT(PRStatus) +PRStatus _PR_MD_TIMED_WAIT_SEM(_MDSemaphore *md, PRIntervalTime ticks) { int rv; @@ -57,13 +57,13 @@ _PR_MD_TIMED_WAIT_SEM(_MDSemaphore *md, PRIntervalTime ticks) return PR_FAILURE; } -PR_IMPLEMENT(PRStatus) +PRStatus _PR_MD_WAIT_SEM(_MDSemaphore *md) { return _PR_MD_TIMED_WAIT_SEM(md, PR_INTERVAL_NO_TIMEOUT); } -PR_IMPLEMENT(void) +void _PR_MD_POST_SEM(_MDSemaphore *md) { int rv; diff --git a/pr/src/md/os2/os2sock.c b/pr/src/md/os2/os2sock.c index 34f5ff43..d8e78a0e 100644 --- a/pr/src/md/os2/os2sock.c +++ b/pr/src/md/os2/os2sock.c @@ -55,7 +55,7 @@ _PR_MD_SOCKET(int af, int type, int flags) { int rv = sock_errno(); soclose(sock); - _PR_MD_MAP_SOCKET_ERROR(rv); + _PR_MD_MAP_SOCKET_ERROR(rv); return (PRInt32) -1; } @@ -82,8 +82,8 @@ _MD_CloseSocket(PRInt32 osfd) PRInt32 rv = -1; rv = soclose((int) osfd ); - if (rv < 0) - _PR_MD_MAP_SOCKET_ERROR(sock_errno()); + if (rv < 0) + _PR_MD_MAP_SOCKET_ERROR(sock_errno()); return rv; } @@ -94,7 +94,7 @@ _MD_SocketAvailable(PRFileDesc *fd) PRInt32 result; if (ioctl(fd->secret->md.osfd, FIONREAD, (char *) &result, sizeof(result)) < 0) { - PR_SetError(PR_BAD_DESCRIPTOR_ERROR, sock_errno()); + PR_SetError(PR_BAD_DESCRIPTOR_ERROR, sock_errno()); return -1; } return result; @@ -124,18 +124,18 @@ _MD_Accept(PRFileDesc *fd, PRNetAddr *raddr, PRUint32 *rlen, && (!fd->secret->nonblocking)) { #ifdef BSD_SELECT - if ((rv = select(osfd + 1, &rd, NULL, NULL,NULL)) == -1) { + if ((rv = _MD_SELECT(osfd + 1, &rd, NULL, NULL,NULL)) == -1) { #else - if ((rv = select(socks, 1, 0, 0, -1)) == -1) { + if ((rv = _MD_SELECT(socks, 1, 0, 0, -1)) == -1) { #endif - _PR_MD_MAP_SELECT_ERROR(sock_errno()); + _PR_MD_MAP_SELECT_ERROR(sock_errno()); break; - } + } } else { - _PR_MD_MAP_ACCEPT_ERROR(err); + _PR_MD_MAP_ACCEPT_ERROR(err); break; - } + } } return(rv); } @@ -146,14 +146,14 @@ _MD_Accept(PRFileDesc *fd, PRNetAddr *raddr, PRUint32 *rlen, if (((err = sock_errno()) == EWOULDBLOCK) && (!fd->secret->nonblocking)) { - PR_SetError(PR_IO_TIMEOUT_ERROR, 0); + PR_SetError(PR_IO_TIMEOUT_ERROR, 0); } else { _PR_MD_MAP_ACCEPT_ERROR(err); } } - return(rv); + return(rv); } else { @@ -165,26 +165,25 @@ retry: { #ifdef BSD_SELECT tv.tv_sec = PR_IntervalToSeconds(timeout); - tv.tv_usec = PR_IntervalToMicroseconds( - timeout - PR_SecondsToInterval(tv.tv_sec)); + tv.tv_usec = PR_IntervalToMicroseconds(timeout - PR_SecondsToInterval(tv.tv_sec)); tvp = &tv; - rv = select(osfd + 1, &rd, NULL, NULL, tvp); + rv = _MD_SELECT(osfd + 1, &rd, NULL, NULL, tvp); #else long lTimeout = PR_IntervalToMilliseconds(timeout); - rv = select(socks, 1, 0, 0, lTimeout); + rv = _MD_SELECT(socks, 1, 0, 0, lTimeout); #endif if (rv > 0) { goto retry; } else if (rv == 0) { - PR_SetError(PR_IO_TIMEOUT_ERROR, 0); + PR_SetError(PR_IO_TIMEOUT_ERROR, 0); rv = -1; } else { - _PR_MD_MAP_SELECT_ERROR(sock_errno()); + _PR_MD_MAP_SELECT_ERROR(sock_errno()); } } else { - _PR_MD_MAP_ACCEPT_ERROR(err); + _PR_MD_MAP_ACCEPT_ERROR(err); } } } @@ -201,7 +200,11 @@ _PR_MD_CONNECT(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen, PRInt32 rv; int err, len; #ifdef BSD_SELECT +#ifdef XP_OS2//_VACPP + fd_set wd; +#else fd_set wd, ex; +#endif #vacpp struct timeval tv, *tvp; #else int socks[1]; @@ -219,17 +222,20 @@ _PR_MD_CONNECT(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen, else { tv.tv_sec = PR_IntervalToSeconds(timeout); - tv.tv_usec = PR_IntervalToMicroseconds( - timeout - PR_SecondsToInterval(tv.tv_sec)); + tv.tv_usec = PR_IntervalToMicroseconds(timeout - PR_SecondsToInterval(tv.tv_sec)); tvp = &tv; } FD_ZERO(&wd); FD_SET(osfd, &wd); +#ifdef XP_OS2//_VACPP + rv = _MD_SELECT(osfd + 1, NULL, &wd, NULL, tvp); +#else FD_ZERO(&ex); FD_SET(osfd, &ex); - rv = select(osfd + 1, NULL, &wd, &ex, tvp); -#else + rv = _MD_SELECT(osfd + 1, NULL, &wd, &ex, tvp); +#endif #vacpp +#else #!bsd_select if (timeout == PR_INTERVAL_NO_TIMEOUT) lTimeout = -1; else @@ -238,11 +244,38 @@ _PR_MD_CONNECT(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen, } socks[0] = osfd; - rv = select(socks, 0, 1, 1, lTimeout); +#ifdef XP_OS2//_VACPP + rv = _MD_SELECT(socks, 0, 1, 0, lTimeout); +#else + rv = _MD_SELECT(socks, 0, 1, 1, lTimeout); +#endif #vacpp #endif if (rv > 0) { #ifdef BSD_SELECT +#ifdef XP_OS2//_VACPP + if (FD_ISSET(osfd, &wd)) + { + //DosSleep(0); + len = sizeof(err); + if (getsockopt(osfd, SOL_SOCKET, SO_ERROR, + (char *) &err, &len) < 0) + { + _PR_MD_MAP_GETSOCKOPT_ERROR(sock_errno()); + return -1; + } + + if (err != 0) + { + _PR_MD_MAP_CONNECT_ERROR(err); + return -1; + } + else + return 0; /* it's connected */ + } + else + return -1; +#else if (FD_ISSET(osfd, &ex)) { DosSleep(0); @@ -264,24 +297,37 @@ _PR_MD_CONNECT(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen, /* it's connected */ return 0; } -#else - if (getsockopt(osfd, SOL_SOCKET, SO_ERROR, - (char *) &err, &len) < 0) - { - _PR_MD_MAP_GETSOCKOPT_ERROR(sock_errno()); - return -1; - } - else - return 0; /* It's connected ! */ +#endif #vacpp +#else #!bsd_select + if (socks[0] == osfd) + { + len = sizeof(err); + if (getsockopt(osfd, SOL_SOCKET, SO_ERROR, + (char *) &err, &len) < 0) + { + _PR_MD_MAP_GETSOCKOPT_ERROR(sock_errno()); + return -1; + } + + if (err != 0) + { + _PR_MD_MAP_CONNECT_ERROR(err); + return -1; + } + else + return 0; /* it's connected */ + } + else + return -1; #endif - } + } else if (rv == 0) { - PR_SetError(PR_IO_TIMEOUT_ERROR, 0); + PR_SetError(PR_IO_TIMEOUT_ERROR, 0); return(-1); } else if (rv < 0) { - _PR_MD_MAP_SELECT_ERROR(sock_errno()); + _PR_MD_MAP_SELECT_ERROR(sock_errno()); return(-1); } } @@ -340,7 +386,7 @@ _PR_MD_RECV(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, timeout - PR_SecondsToInterval(tv.tv_sec)); tvp = &tv; } - if ((rv = select(osfd + 1, &rd, NULL, NULL, tvp)) == -1) + if ((rv = _MD_SELECT(osfd + 1, &rd, NULL, NULL, tvp)) == -1) #else socks[0] = osfd; if (timeout == PR_INTERVAL_NO_TIMEOUT) @@ -351,22 +397,22 @@ _PR_MD_RECV(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, { lTimeout = PR_IntervalToMilliseconds(timeout); } - if ((rv = select(socks, 1, 0, 0, lTimeout)) == -1) + if ((rv = _MD_SELECT(socks, 1, 0, 0, lTimeout)) == -1) #endif { - _PR_MD_MAP_SELECT_ERROR(sock_errno()); + _PR_MD_MAP_SELECT_ERROR(sock_errno()); return -1; } else if (rv == 0) { - PR_SetError(PR_IO_TIMEOUT_ERROR, 0); + PR_SetError(PR_IO_TIMEOUT_ERROR, 0); rv = -1; break; } } else { - _PR_MD_MAP_RECV_ERROR(err); + _PR_MD_MAP_RECV_ERROR(err); break; } } /* end while() */ @@ -409,7 +455,7 @@ _PR_MD_SEND(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, } FD_ZERO(&wd); FD_SET(osfd, &wd); - if ((rv = select( osfd + 1, NULL, &wd, NULL,tvp)) == -1) { + if ((rv = _MD_SELECT( osfd + 1, NULL, &wd, NULL,tvp)) == -1) { #else if ( timeout == PR_INTERVAL_NO_TIMEOUT ) { @@ -420,21 +466,21 @@ _PR_MD_SEND(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, lTimeout = PR_IntervalToMilliseconds(timeout); } socks[0] = osfd; - if ((rv = select( socks, 0, 1, 0, lTimeout)) == -1) { + if ((rv = _MD_SELECT( socks, 0, 1, 0, lTimeout)) == -1) { #endif - _PR_MD_MAP_SELECT_ERROR(sock_errno()); + _PR_MD_MAP_SELECT_ERROR(sock_errno()); break; - } + } if (rv == 0) { - PR_SetError(PR_IO_TIMEOUT_ERROR, 0); - return -1; + PR_SetError(PR_IO_TIMEOUT_ERROR, 0); + return -1; } } else { - _PR_MD_MAP_SEND_ERROR(err); + _PR_MD_MAP_SEND_ERROR(err); return -1; - } + } } bytesSent += rv; if (fd->secret->nonblocking) @@ -457,7 +503,7 @@ _PR_MD_SEND(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, } FD_ZERO(&wd); FD_SET(osfd, &wd); - if ((rv = select(osfd + 1, NULL, &wd, NULL,tvp)) == -1) { + if ((rv = _MD_SELECT(osfd + 1, NULL, &wd, NULL,tvp)) == -1) { #else if ( timeout == PR_INTERVAL_NO_TIMEOUT ) { @@ -468,15 +514,15 @@ _PR_MD_SEND(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, lTimeout = PR_IntervalToMilliseconds(timeout); } socks[0] = osfd; - if ((rv = select(socks, 0, 1, 0,lTimeout)) == -1) { + if ((rv = _MD_SELECT(socks, 0, 1, 0,lTimeout)) == -1) { #endif - _PR_MD_MAP_SELECT_ERROR(sock_errno()); + _PR_MD_MAP_SELECT_ERROR(sock_errno()); break; - } + } if (rv == 0) { - PR_SetError(PR_IO_TIMEOUT_ERROR, 0); - return -1; + PR_SetError(PR_IO_TIMEOUT_ERROR, 0); + return -1; } } } @@ -520,7 +566,7 @@ _PR_MD_SENDTO(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, } FD_ZERO(&wd); FD_SET(osfd, &wd); - if ((rv = select(osfd + 1, NULL, &wd, NULL, tvp)) == -1) { + if ((rv = _MD_SELECT(osfd + 1, NULL, &wd, NULL, tvp)) == -1) { #else if ( timeout == PR_INTERVAL_NO_TIMEOUT ) { @@ -531,21 +577,21 @@ _PR_MD_SENDTO(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, lTimeout = PR_IntervalToMilliseconds(timeout); } socks[0] = osfd; - if ((rv = select(socks, 0, 1, 0, lTimeout)) == -1) { + if ((rv = _MD_SELECT(socks, 0, 1, 0, lTimeout)) == -1) { #endif - _PR_MD_MAP_SELECT_ERROR(sock_errno()); + _PR_MD_MAP_SELECT_ERROR(sock_errno()); break; - } + } if (rv == 0) { - PR_SetError(PR_IO_TIMEOUT_ERROR, 0); - return -1; + PR_SetError(PR_IO_TIMEOUT_ERROR, 0); + return -1; } } else { - _PR_MD_MAP_SENDTO_ERROR(err); + _PR_MD_MAP_SENDTO_ERROR(err); return -1; - } + } } bytesSent += rv; if (fd->secret->nonblocking) @@ -568,7 +614,7 @@ _PR_MD_SENDTO(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, } FD_ZERO(&wd); FD_SET(osfd, &wd); - if ((rv = select( osfd + 1, NULL, &wd, NULL, tvp)) == -1) { + if ((rv = _MD_SELECT( osfd + 1, NULL, &wd, NULL, tvp)) == -1) { #else if ( timeout == PR_INTERVAL_NO_TIMEOUT ) { @@ -579,15 +625,15 @@ _PR_MD_SENDTO(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, lTimeout = PR_IntervalToMilliseconds(timeout); } socks[0] = osfd; - if ((rv = select( socks, 0, 1, 0, lTimeout)) == -1) { + if ((rv = _MD_SELECT( socks, 0, 1, 0, lTimeout)) == -1) { #endif - _PR_MD_MAP_SELECT_ERROR(sock_errno()); + _PR_MD_MAP_SELECT_ERROR(sock_errno()); break; - } + } if (rv == 0) { - PR_SetError(PR_IO_TIMEOUT_ERROR, 0); - return -1; + PR_SetError(PR_IO_TIMEOUT_ERROR, 0); + return -1; } } } @@ -616,20 +662,20 @@ _PR_MD_RECVFROM(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, && (!fd->secret->nonblocking)) { #ifdef BSD_SELECT - if (timeout == PR_INTERVAL_NO_TIMEOUT) - { - tvp = NULL; - } - else - { - tv.tv_sec = PR_IntervalToSeconds(timeout); - tv.tv_usec = PR_IntervalToMicroseconds( - timeout - PR_SecondsToInterval(tv.tv_sec)); - tvp = &tv; - } - FD_ZERO(&rd); - FD_SET(osfd, &rd); - if ((rv = select(osfd + 1, &rd, NULL, NULL, tvp)) == -1) + if (timeout == PR_INTERVAL_NO_TIMEOUT) + { + tvp = NULL; + } + else + { + tv.tv_sec = PR_IntervalToSeconds(timeout); + tv.tv_usec = PR_IntervalToMicroseconds( + timeout - PR_SecondsToInterval(tv.tv_sec)); + tvp = &tv; + } + FD_ZERO(&rd); + FD_SET(osfd, &rd); + if ((rv = _MD_SELECT(osfd + 1, &rd, NULL, NULL, tvp)) == -1) #else if (timeout == PR_INTERVAL_NO_TIMEOUT) { @@ -640,14 +686,14 @@ _PR_MD_RECVFROM(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, lTimeout = PR_IntervalToMilliseconds(timeout); } socks[0] = osfd; - if ((rv = select(socks, 1, 0, 0, lTimeout)) == -1) + if ((rv = _MD_SELECT(socks, 1, 0, 0, lTimeout)) == -1) #endif { - _PR_MD_MAP_SELECT_ERROR(sock_errno()); + _PR_MD_MAP_SELECT_ERROR(sock_errno()); return -1; } else if (rv == 0) { - PR_SetError(PR_IO_TIMEOUT_ERROR, 0); + PR_SetError(PR_IO_TIMEOUT_ERROR, 0); rv = -1; break; } @@ -657,7 +703,7 @@ _PR_MD_RECVFROM(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, } else { - _PR_MD_MAP_RECVFROM_ERROR(err); + _PR_MD_MAP_RECVFROM_ERROR(err); break; } } @@ -702,12 +748,12 @@ _PR_MD_WRITEV(PRFileDesc *fd, const PRIOVec *iov, PRInt32 iov_size, PRIntervalTi PRInt32 _PR_MD_SHUTDOWN(PRFileDesc *fd, PRIntn how) { -PRInt32 rv; + PRInt32 rv; rv = shutdown(fd->secret->md.osfd, how); - if (rv < 0) - _PR_MD_MAP_SHUTDOWN_ERROR(sock_errno()); - return rv; + if (rv < 0) + _PR_MD_MAP_SHUTDOWN_ERROR(sock_errno()); + return rv; } PRStatus @@ -717,11 +763,11 @@ _PR_MD_GETSOCKNAME(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *len) rv = getsockname((int)fd->secret->md.osfd, (struct sockaddr *)addr, (int *) len); if (rv==0) - return PR_SUCCESS; - else { - _PR_MD_MAP_GETSOCKNAME_ERROR(sock_errno()); - return PR_FAILURE; - } + return PR_SUCCESS; + else { + _PR_MD_MAP_GETSOCKNAME_ERROR(sock_errno()); + return PR_FAILURE; + } } PRStatus @@ -731,11 +777,11 @@ _PR_MD_GETPEERNAME(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *len) rv = getpeername((int)fd->secret->md.osfd, (struct sockaddr *)addr, (int *) len); if (rv==0) - return PR_SUCCESS; - else { - _PR_MD_MAP_GETPEERNAME_ERROR(sock_errno()); - return PR_FAILURE; - } + return PR_SUCCESS; + else { + _PR_MD_MAP_GETPEERNAME_ERROR(sock_errno()); + return PR_FAILURE; + } } PRStatus @@ -745,11 +791,11 @@ _PR_MD_GETSOCKOPT(PRFileDesc *fd, PRInt32 level, PRInt32 optname, char* optval, rv = getsockopt((int)fd->secret->md.osfd, level, optname, optval, optlen); if (rv==0) - return PR_SUCCESS; - else { - _PR_MD_MAP_GETSOCKOPT_ERROR(sock_errno()); - return PR_FAILURE; - } + return PR_SUCCESS; + else { + _PR_MD_MAP_GETSOCKOPT_ERROR(sock_errno()); + return PR_FAILURE; + } } PRStatus @@ -759,11 +805,11 @@ _PR_MD_SETSOCKOPT(PRFileDesc *fd, PRInt32 level, PRInt32 optname, const char* op rv = setsockopt((int)fd->secret->md.osfd, level, optname, (char *) optval, optlen); if (rv==0) - return PR_SUCCESS; - else { - _PR_MD_MAP_SETSOCKOPT_ERROR(sock_errno()); - return PR_FAILURE; - } + return PR_SUCCESS; + else { + _PR_MD_MAP_SETSOCKOPT_ERROR(sock_errno()); + return PR_FAILURE; + } } void diff --git a/pr/src/md/os2/os2thred.c b/pr/src/md/os2/os2thred.c index b6c1615b..cbb8603c 100644 --- a/pr/src/md/os2/os2thred.c +++ b/pr/src/md/os2/os2thred.c @@ -36,7 +36,7 @@ _NSPR_TLS* pThreadLocalStorage = 0; _PRInterruptTable _pr_interruptTable[] = { { 0 } }; APIRET (* APIENTRY QueryThreadContext)(TID, ULONG, PCONTEXTRECORD); -PR_IMPLEMENT(void) +void _PR_MD_ENSURE_TLS(void) { if(!pThreadLocalStorage) @@ -50,7 +50,7 @@ _PR_MD_ENSURE_TLS(void) } } -PR_IMPLEMENT(void) +void _PR_MD_EARLY_INIT() { HMODULE hmod; @@ -77,7 +77,7 @@ _pr_SetThreadMDHandle(PRThread *thread) } -PR_IMPLEMENT(PRStatus) +PRStatus _PR_MD_INIT_THREAD(PRThread *thread) { #ifdef XP_OS2_EMX @@ -98,7 +98,7 @@ _PR_MD_INIT_THREAD(PRThread *thread) return (thread->md.blocked_sema.sem != 0) ? PR_SUCCESS : PR_FAILURE; } -PR_IMPLEMENT(PRStatus) +PRStatus _PR_MD_CREATE_THREAD(PRThread *thread, void (*start)(void *), PRThreadPriority priority, @@ -119,14 +119,14 @@ _PR_MD_CREATE_THREAD(PRThread *thread, return PR_SUCCESS; } -PR_IMPLEMENT(void) +void _PR_MD_YIELD(void) { /* Isn't there some problem with DosSleep(0) on OS/2? */ DosSleep(0); } -PR_IMPLEMENT(void) +void _PR_MD_SET_PRIORITY(_MDThread *thread, PRThreadPriority newPri) { int nativePri; @@ -159,7 +159,7 @@ _PR_MD_SET_PRIORITY(_MDThread *thread, PRThreadPriority newPri) return; } -PR_IMPLEMENT(void) +void _PR_MD_CLEAN_THREAD(PRThread *thread) { if (&thread->md.blocked_sema) { @@ -172,7 +172,7 @@ _PR_MD_CLEAN_THREAD(PRThread *thread) } } -PR_IMPLEMENT(void) +void _PR_MD_EXIT_THREAD(PRThread *thread) { _PR_MD_DESTROY_SEM(&thread->md.blocked_sema); @@ -200,7 +200,7 @@ _PR_MD_EXIT_THREAD(PRThread *thread) } -PR_IMPLEMENT(void) +void _PR_MD_EXIT(PRIntn status) { _exit(status); @@ -240,19 +240,19 @@ _PR_MD_GETTHREADAFFINITYMASK(PRThread *thread, PRUint32 *mask) } #endif /* HAVE_THREAD_AFFINITY */ -PR_IMPLEMENT(void) +void _PR_MD_SUSPEND_CPU(_PRCPU *cpu) { _PR_MD_SUSPEND_THREAD(cpu->thread); } -PR_IMPLEMENT(void) +void _PR_MD_RESUME_CPU(_PRCPU *cpu) { _PR_MD_RESUME_THREAD(cpu->thread); } -PR_IMPLEMENT(void) +void _PR_MD_SUSPEND_THREAD(PRThread *thread) { if (_PR_IS_NATIVE_THREAD(thread)) { @@ -266,7 +266,7 @@ _PR_MD_SUSPEND_THREAD(PRThread *thread) } } -PR_IMPLEMENT(void) +void _PR_MD_RESUME_THREAD(PRThread *thread) { if (_PR_IS_NATIVE_THREAD(thread)) { diff --git a/pr/src/md/unix/.cvsignore b/pr/src/md/unix/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/pr/src/md/unix/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/pr/src/md/unix/Makefile b/pr/src/md/unix/Makefile deleted file mode 100644 index de8baadd..00000000 --- a/pr/src/md/unix/Makefile +++ /dev/null @@ -1,316 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -MOD_DEPTH = ../../../.. - -include $(MOD_DEPTH)/config/config.mk - -# Disable optimization of the nspr on SunOS4.1.3 -ifeq ($(OS_ARCH),SunOS) -ifeq ($(OS_RELEASE),4.1.3_U1) -OPTIMIZER = -endif -endif - -CSRCS = \ - unix.c \ - unix_errors.c \ - uxproces.c \ - uxrng.c \ - uxshm.c \ - uxwrap.c \ - $(NULL) - -ifneq ($(USE_PTHREADS),1) -CSRCS += uxpoll.c -endif - -ifeq ($(PTHREADS_USER),1) -CSRCS += pthreads_user.c -endif - -IRIX_CSRCS = \ - irix.c \ - $(NULL) - -SUNOS4_CSRCS = \ - sunos4.c \ - $(NULL) - -SOLARIS_CSRCS = \ - solaris.c \ - $(NULL) - -AIX_CSRCS = \ - aix.c \ - $(NULL) - -FREEBSD_CSRCS = \ - freebsd.c \ - $(NULL) - -NETBSD_CSRCS = \ - netbsd.c \ - $(NULL) - -OPENBSD_CSRCS = \ - openbsd.c \ - $(NULL) - -BSDI_CSRCS = \ - bsdi.c \ - $(NULL) - -HPUX_CSRCS = \ - hpux.c \ - $(NULL) - -OPENVMS_CSRCS = \ - openvms.c \ - $(NULL) - -OSF1_CSRCS = \ - osf1.c \ - $(NULL) - -LINUX_CSRCS = \ - linux.c \ - $(NULL) - -UNIXWARE_CSRCS = \ - unixware.c \ - $(NULL) - -RELIANTUNIX_CSRCS = \ - reliantunix.c \ - $(NULL) - -RHAPSODY_CSRCS = \ - rhapsody.c \ - $(NULL) - -NEXTSTEP_CSRCS = \ - nextstep.c \ - $(NULL) - -NEC_CSRCS = \ - nec.c \ - $(NULL) - -SONY_CSRCS = \ - sony.c \ - $(NULL) - -NCR_CSRCS = \ - ncr.c \ - $(NULL) - -SCOOS_CSRCS = \ - scoos.c \ - $(NULL) - -DGUX_CSRCS = \ - dgux.c \ - $(NULL) - -QNX_CSRCS = \ - qnx.c \ - $(NULL) - -NTO_CSRCS = \ - nto.c \ - $(NULL) - -ifeq ($(OS_ARCH),IRIX) -CSRCS += $(IRIX_CSRCS) -endif - -ifeq ($(OS_ARCH),SunOS) -ifeq ($(OS_RELEASE),4.1.3_U1) -CSRCS += $(SUNOS4_CSRCS) -else -CSRCS += $(SOLARIS_CSRCS) -endif -endif - -ifeq ($(OS_ARCH),AIX) -CSRCS += $(AIX_CSRCS) -endif -ifeq ($(OS_ARCH),FreeBSD) -CSRCS += $(FREEBSD_CSRCS) -endif -ifeq ($(OS_ARCH),NetBSD) -CSRCS += $(NETBSD_CSRCS) -endif -ifeq ($(OS_ARCH),OpenBSD) -CSRCS += $(OPENBSD_CSRCS) -endif -ifeq ($(OS_ARCH),BSD_OS) -CSRCS += $(BSDI_CSRCS) -endif -ifeq ($(OS_ARCH),HP-UX) -CSRCS += $(HPUX_CSRCS) -endif -ifeq ($(OS_ARCH),OpenVMS) -CSRCS += $(OPENVMS_CSRCS) -endif -ifeq ($(OS_ARCH),OSF1) -CSRCS += $(OSF1_CSRCS) -endif -ifeq ($(OS_ARCH),Linux) -CSRCS += $(LINUX_CSRCS) -endif -ifeq ($(OS_ARCH),UNIXWARE) -CSRCS += $(UNIXWARE_CSRCS) -endif -ifeq ($(OS_ARCH),SINIX) -CSRCS += $(RELIANTUNIX_CSRCS) -endif -ifeq ($(OS_ARCH),Rhapsody) -CSRCS += $(RHAPSODY_CSRCS) -endif -ifeq ($(OS_ARCH),NEXTSTEP) -CSRCS += $(NEXTSTEP_CSRCS) -endif -ifeq ($(OS_ARCH),NEC) -CSRCS += $(NEC_CSRCS) -endif -ifeq ($(OS_ARCH),NEWS-OS) -CSRCS += $(SONY_CSRCS) -endif -ifeq ($(OS_ARCH),NCR) -CSRCS += $(NCR_CSRCS) -endif -ifeq ($(OS_ARCH),SCOOS) -CSRCS += $(SCOOS_CSRCS) -endif -ifeq ($(OS_ARCH),DGUX) -CSRCS += $(DGUX_CSRCS) -endif -ifeq ($(OS_ARCH),NTO) -CSRCS += $(NTO_CSRCS) -endif -ifeq ($(OS_ARCH),QNX) -ifeq ($(OS_TARGET),NTO) -CSRCS += $(NTO_CSRCS) -else -CSRCS += $(QNX_CSRCS) -endif -endif - -# -# Some Unix platforms have an assembly language file. -# E.g., AIX 3.2, Solaris (both sparc and x86). -# -ifeq ($(OS_ARCH), AIX) - ifeq ($(OS_RELEASE), 3.2) - ASFILES = os_$(OS_ARCH).s - endif -endif - -ifeq ($(OS_ARCH),SunOS) - ifneq ($(OS_RELEASE),4.1.3_U1) - ifneq ($(LOCAL_THREADS_ONLY),1) - ifeq ($(CPU_ARCH),x86) - ASFILES = os_$(OS_ARCH)_x86.s - else - ASFILES = os_$(OS_ARCH).s - ifneq ($(USE_64),1) - ASFILES += os_$(OS_ARCH)_32.s - endif - endif - endif - endif -endif - -ifeq ($(OS_ARCH), SINIX) - ifeq ($(CPU_ARCH),mips) - ASFILES = os_ReliantUNIX.s - endif -endif - -ifeq ($(OS_ARCH)$(OS_RELEASE),BSD_OS2.1) - ASFILES = os_BSD_386_2.s -endif - -ifeq ($(OS_ARCH), IRIX) - ASFILES = os_Irix.s -endif - -ifeq ($(OS_ARCH), HP-UX) - ASFILES = os_HPUX.s -endif - -TARGETS = $(OBJS) - -ifeq ($(OS_ARCH),AIX) -ifeq (,$(filter-out 3.2 4.1,$(OS_RELEASE))) -ifneq ($(USE_PTHREADS), 1) -#TARGETS += $(OBJDIR)/aixwrap.$(OBJ_SUFFIX) -endif -endif -endif - -ifeq ($(OS_ARCH),SunOS) - ifneq ($(OS_RELEASE),4.1.3_U1) - ifeq ($(OS_TEST),sun4u) - LIBRARY_NAME = $(ULTRASPARC_LIBRARY) - LIBRARY_VERSION = $(MOD_VERSION) - ULTRASPARC_ASFILES = os_$(OS_ARCH)_ultrasparc.s - ULTRASPARC_ASOBJS = $(addprefix $(OBJDIR)/,$(ULTRASPARC_ASFILES:.s=.$(OBJ_SUFFIX))) - TARGETS += $(ULTRASPARC_ASOBJS) $(SHARED_LIBRARY) - RELEASE_LIBS = $(SHARED_LIBRARY) - endif - endif -endif - -INCLUDES = -I$(DIST)/include -I$(MOD_DEPTH)/pr/include -I$(MOD_DEPTH)/pr/include/private - -DEFINES += -D_NSPR_BUILD_ - -include $(MOD_DEPTH)/config/rules.mk - -export:: $(TARGETS) -#ifeq ($(OS_ARCH),AIX) -#ifeq (,$(filter-out 3.2 4.1,$(OS_RELEASE))) -#ifneq ($(USE_PTHREADS), 1) -# $(INSTALL) -m 444 $(OBJDIR)/aixwrap.$(OBJ_SUFFIX) $(DIST)/lib -#endif -#endif -#endif - -ifeq ($(OS_ARCH),SunOS) -ifneq ($(OS_RELEASE),4.1.3_U1) -ifeq ($(OS_TEST),sun4u) -$(SHARED_LIBRARY): $(ULTRASPARC_ASOBJS) - $(LD) -G -z text -o $@ $(ULTRASPARC_ASOBJS) - $(INSTALL) -m 444 $(SHARED_LIBRARY) $(DIST)/lib - -$(ULTRASPARC_ASOBJS): $(ULTRASPARC_ASFILES) -ifeq ($(USE_64),1) - /usr/ccs/bin/as -o $@ -K PIC -P -D_ASM -D__STDC__=0 -xarch=v9 $< -else - /usr/ccs/bin/as -o $@ -K PIC -P -D_ASM -D__STDC__=0 -xarch=v8plus $< -endif - -clean:: - rm -rf $(ULTRASPARC_ASOBJS) -endif -endif -endif - -install:: export diff --git a/pr/src/md/unix/Makefile.in b/pr/src/md/unix/Makefile.in index 9fb73bf8..9db24b49 100644 --- a/pr/src/md/unix/Makefile.in +++ b/pr/src/md/unix/Makefile.in @@ -24,17 +24,6 @@ include $(MOD_DEPTH)/config/autoconf.mk include $(topsrcdir)/config/config.mk -ifndef USE_AUTOCONF - -# Disable optimization of the nspr on SunOS4.1.3 -ifeq ($(OS_ARCH),SunOS) -ifeq ($(OS_RELEASE),4.1.3_U1) -OPTIMIZER = -endif -endif - -endif # ! USE_AUTOCONF - CSRCS = \ unix.c \ unix_errors.c \ @@ -52,235 +41,16 @@ ifeq ($(PTHREADS_USER),1) CSRCS += pthreads_user.c endif -ifndef USE_AUTOCONF - -IRIX_CSRCS = \ - irix.c \ - $(NULL) - -SUNOS4_CSRCS = \ - sunos4.c \ - $(NULL) - -SOLARIS_CSRCS = \ - solaris.c \ - $(NULL) - -AIX_CSRCS = \ - aix.c \ - $(NULL) - -FREEBSD_CSRCS = \ - freebsd.c \ - $(NULL) - -NETBSD_CSRCS = \ - netbsd.c \ - $(NULL) - -OPENBSD_CSRCS = \ - openbsd.c \ - $(NULL) - -BSDI_CSRCS = \ - bsdi.c \ - $(NULL) - -HPUX_CSRCS = \ - hpux.c \ - $(NULL) - -OPENVMS_CSRCS = \ - openvms.c \ - $(NULL) - -OSF1_CSRCS = \ - osf1.c \ - $(NULL) - -LINUX_CSRCS = \ - linux.c \ - $(NULL) - -UNIXWARE_CSRCS = \ - unixware.c \ - $(NULL) - -RELIANTUNIX_CSRCS = \ - reliantunix.c \ - $(NULL) - -RHAPSODY_CSRCS = \ - rhapsody.c \ - $(NULL) - -NEXTSTEP_CSRCS = \ - nextstep.c \ - $(NULL) - -NEC_CSRCS = \ - nec.c \ - $(NULL) - -SONY_CSRCS = \ - sony.c \ - $(NULL) - -NCR_CSRCS = \ - ncr.c \ - $(NULL) - -SCOOS_CSRCS = \ - scoos.c \ - $(NULL) - -DGUX_CSRCS = \ - dgux.c \ - $(NULL) - -QNX_CSRCS = \ - qnx.c \ - $(NULL) - -NTO_CSRCS = \ - nto.c \ - $(NULL) - -ifeq ($(OS_ARCH),IRIX) -CSRCS += $(IRIX_CSRCS) -endif - -ifeq ($(OS_ARCH),SunOS) -ifeq ($(OS_RELEASE),4.1.3_U1) -CSRCS += $(SUNOS4_CSRCS) -else -CSRCS += $(SOLARIS_CSRCS) -endif -endif - -ifeq ($(OS_ARCH),AIX) -CSRCS += $(AIX_CSRCS) -endif -ifeq ($(OS_ARCH),FreeBSD) -CSRCS += $(FREEBSD_CSRCS) -endif -ifeq ($(OS_ARCH),NetBSD) -CSRCS += $(NETBSD_CSRCS) -endif -ifeq ($(OS_ARCH),OpenBSD) -CSRCS += $(OPENBSD_CSRCS) -endif -ifeq ($(OS_ARCH),BSD_OS) -CSRCS += $(BSDI_CSRCS) -endif -ifeq ($(OS_ARCH),HP-UX) -CSRCS += $(HPUX_CSRCS) -endif -ifeq ($(OS_ARCH),OpenVMS) -CSRCS += $(OPENVMS_CSRCS) -endif -ifeq ($(OS_ARCH),OSF1) -CSRCS += $(OSF1_CSRCS) -endif -ifeq ($(OS_ARCH),Linux) -CSRCS += $(LINUX_CSRCS) -endif -ifeq ($(OS_ARCH),UNIXWARE) -CSRCS += $(UNIXWARE_CSRCS) -endif -ifeq ($(OS_ARCH),SINIX) -CSRCS += $(RELIANTUNIX_CSRCS) -endif -ifeq ($(OS_ARCH),Rhapsody) -CSRCS += $(RHAPSODY_CSRCS) -endif -ifeq ($(OS_ARCH),NEXTSTEP) -CSRCS += $(NEXTSTEP_CSRCS) -endif -ifeq ($(OS_ARCH),NEC) -CSRCS += $(NEC_CSRCS) -endif -ifeq ($(OS_ARCH),NEWS-OS) -CSRCS += $(SONY_CSRCS) -endif -ifeq ($(OS_ARCH),NCR) -CSRCS += $(NCR_CSRCS) -endif -ifeq ($(OS_ARCH),SCOOS) -CSRCS += $(SCOOS_CSRCS) -endif -ifeq ($(OS_ARCH),DGUX) -CSRCS += $(DGUX_CSRCS) -endif -ifeq ($(OS_ARCH),NTO) -CSRCS += $(NTO_CSRCS) -endif -ifeq ($(OS_ARCH),QNX) -ifeq ($(OS_TARGET),NTO) -CSRCS += $(NTO_CSRCS) -else -CSRCS += $(QNX_CSRCS) -endif -endif - -# -# Some Unix platforms have an assembly language file. -# E.g., AIX 3.2, Solaris (both sparc and x86). -# -ifeq ($(OS_ARCH), AIX) - ifeq ($(OS_RELEASE), 3.2) - ASFILES = os_$(OS_ARCH).s - endif -endif - -ifeq ($(OS_ARCH),SunOS) - ifneq ($(OS_RELEASE),4.1.3_U1) - ifneq ($(LOCAL_THREADS_ONLY),1) - ifeq ($(CPU_ARCH),x86) - ASFILES = os_$(OS_ARCH)_x86.s - else - ASFILES = os_$(OS_ARCH).s - ifneq ($(USE_64),1) - ASFILES += os_$(OS_ARCH)_32.s - endif - endif - endif - endif -endif - -ifeq ($(OS_ARCH), SINIX) - ifeq ($(CPU_ARCH),mips) - ASFILES = os_ReliantUNIX.s - endif -endif - -ifeq ($(OS_ARCH)$(OS_RELEASE),BSD_OS2.1) - ASFILES = os_BSD_386_2.s -endif - -ifeq ($(OS_ARCH), IRIX) - ASFILES = os_Irix.s -endif - -ifeq ($(OS_ARCH), HP-UX) - ASFILES = os_HPUX.s -endif - -TARGETS = $(OBJS) +CSRCS += $(PR_MD_CSRCS) +ASFILES += $(PR_MD_ASFILES) -ifeq ($(OS_ARCH),AIX) -ifeq (,$(filter-out 3.2 4.1,$(OS_RELEASE))) -ifneq ($(USE_PTHREADS), 1) -#TARGETS += $(OBJDIR)/aixwrap.$(OBJ_SUFFIX) -endif -endif -endif +TARGETS = $(OBJS) ifeq ($(OS_ARCH),SunOS) ifneq ($(OS_RELEASE),4.1.3_U1) ifeq ($(OS_TEST),sun4u) LIBRARY_NAME = $(ULTRASPARC_LIBRARY) - LIBRARY_VERSION = $(MOD_VERSION) + LIBRARY_VERSION = $(MOD_MAJOR_VERSION) ULTRASPARC_ASFILES = os_$(OS_ARCH)_ultrasparc.s ULTRASPARC_ASOBJS = $(addprefix $(OBJDIR)/,$(ULTRASPARC_ASFILES:.s=.$(OBJ_SUFFIX))) TARGETS += $(ULTRASPARC_ASOBJS) $(SHARED_LIBRARY) @@ -289,37 +59,20 @@ ifeq ($(OS_ARCH),SunOS) endif endif -else # USE_AUTOCONF - -CSRCS += $(PR_MD_CSRCS) -ASFILES += $(PR_MD_ASFILES) - -TARGETS = $(OBJS) - -endif # ! USE_AUTOCONF - -INCLUDES = -I$(DIST)/include -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private +INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private DEFINES += -D_NSPR_BUILD_ include $(topsrcdir)/config/rules.mk export:: $(TARGETS) -#ifeq ($(OS_ARCH),AIX) -#ifeq (,$(filter-out 3.2 4.1,$(OS_RELEASE))) -#ifneq ($(USE_PTHREADS), 1) -# $(INSTALL) -m 444 $(OBJDIR)/aixwrap.$(OBJ_SUFFIX) $(DIST)/lib -#endif -#endif -#endif -ifndef USE_AUTOCONF ifeq ($(OS_ARCH),SunOS) ifneq ($(OS_RELEASE),4.1.3_U1) ifeq ($(OS_TEST),sun4u) $(SHARED_LIBRARY): $(ULTRASPARC_ASOBJS) $(LD) -G -z text -o $@ $(ULTRASPARC_ASOBJS) - $(INSTALL) -m 444 $(SHARED_LIBRARY) $(DIST)/lib + $(INSTALL) -m 444 $(SHARED_LIBRARY) $(dist_libdir) $(ULTRASPARC_ASOBJS): $(ULTRASPARC_ASFILES) ifeq ($(USE_64),1) @@ -333,5 +86,3 @@ clean:: endif endif endif -endif #!USE_AUTOCONF -install:: export 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..575584b6 100644 --- a/pr/src/md/unix/objs.mk +++ b/pr/src/md/unix/objs.mk @@ -35,226 +35,9 @@ ifeq ($(PTHREADS_USER),1) CSRCS += pthreads_user.c endif -ifdef USE_AUTOCONF - CSRCS += $(PR_MD_CSRCS) ASFILES += $(PR_MD_ASFILES) -else # ! USE_AUTOCONF -IRIX_CSRCS = \ - irix.c \ - $(NULL) - -SUNOS4_CSRCS = \ - sunos4.c \ - $(NULL) - -SOLARIS_CSRCS = \ - solaris.c \ - $(NULL) - -AIX_CSRCS = \ - aix.c \ - $(NULL) - -FREEBSD_CSRCS = \ - freebsd.c \ - $(NULL) - -NETBSD_CSRCS = \ - netbsd.c \ - $(NULL) - -OPENBSD_CSRCS = \ - openbsd.c \ - $(NULL) - -BSDI_CSRCS = \ - bsdi.c \ - $(NULL) - -HPUX_CSRCS = \ - hpux.c \ - $(NULL) - -OSF1_CSRCS = \ - osf1.c \ - $(NULL) - -OPENVMS_CSRCS = \ - openvms.c \ - $(NULL) - -LINUX_CSRCS = \ - linux.c \ - $(NULL) - -UNIXWARE_CSRCS = \ - unixware.c \ - $(NULL) - -RELIANTUNIX_CSRCS = \ - reliantunix.c \ - $(NULL) - -RHAPSODY_CSRCS = \ - rhapsody.c \ - $(NULL) - -NEXTSTEP_CSRCS = \ - nextstep.c \ - $(NULL) - -NEC_CSRCS = \ - nec.c \ - $(NULL) - -SONY_CSRCS = \ - sony.c \ - $(NULL) - -NCR_CSRCS = \ - ncr.c \ - $(NULL) - -SCOOS_CSRCS = \ - scoos.c \ - $(NULL) - -DGUX_CSRCS = \ - dgux.c \ - $(NULL) - -QNX_CSRCS = \ - qnx.c \ - $(NULL) - -NTO_CSRCS = \ - nto.c \ - $(NULL) - -ifeq ($(OS_ARCH),IRIX) -CSRCS += $(IRIX_CSRCS) -endif - -ifeq ($(OS_ARCH),SunOS) -ifeq ($(OS_RELEASE),4.1.3_U1) -CSRCS += $(SUNOS4_CSRCS) -else -CSRCS += $(SOLARIS_CSRCS) -endif -endif - -ifeq ($(OS_ARCH),AIX) -CSRCS += $(AIX_CSRCS) -endif -ifeq ($(OS_ARCH),FreeBSD) -CSRCS += $(FREEBSD_CSRCS) -endif -ifeq ($(OS_ARCH),NetBSD) -CSRCS += $(NETBSD_CSRCS) -endif -ifeq ($(OS_ARCH),OpenBSD) -CSRCS += $(OPENBSD_CSRCS) -endif -ifeq ($(OS_ARCH),BSD_OS) -CSRCS += $(BSDI_CSRCS) -endif -ifeq ($(OS_ARCH),HP-UX) -CSRCS += $(HPUX_CSRCS) -endif -ifeq ($(OS_ARCH),OSF1) -CSRCS += $(OSF1_CSRCS) -endif -ifeq ($(OS_ARCH),OpenVMS) -CSRCS += $(OPENVMS_CSRCS) -endif -ifeq ($(OS_ARCH),Linux) -CSRCS += $(LINUX_CSRCS) -endif -ifeq ($(OS_ARCH),UNIXWARE) -CSRCS += $(UNIXWARE_CSRCS) -endif -ifeq ($(OS_ARCH),SINIX) -CSRCS += $(RELIANTUNIX_CSRCS) -endif -ifeq ($(OS_ARCH),Rhapsody) -CSRCS += $(RHAPSODY_CSRCS) -endif -ifeq ($(OS_ARCH),NEXTSTEP) -CSRCS += $(NEXTSTEP_CSRCS) -endif -ifeq ($(OS_ARCH),NEC) -CSRCS += $(NEC_CSRCS) -endif -ifeq ($(OS_ARCH),NEWS-OS) -CSRCS += $(SONY_CSRCS) -endif -ifeq ($(OS_ARCH),NCR) -CSRCS += $(NCR_CSRCS) -endif -ifeq ($(OS_ARCH),SCOOS) -CSRCS += $(SCOOS_CSRCS) -endif -ifeq ($(OS_ARCH),DGUX) -CSRCS += $(DGUX_CSRCS) -endif -ifeq ($(OS_ARCH),NTO) -CSRCS += $(NTO_CSRCS) -endif -ifeq ($(OS_ARCH),QNX) -ifeq ($(OS_TARGET),NTO) -CSRCS += $(NTO_CSRCS) -else -CSRCS += $(QNX_CSRCS) -endif -endif - -# -# Some Unix platforms have an assembly language file. -# E.g., AIX 3.2, Solaris (both sparc and x86). -# -ifeq ($(OS_ARCH), AIX) - ifeq ($(OS_RELEASE), 3.2) - ASFILES = os_$(OS_ARCH).s - endif -endif - -ifeq ($(OS_ARCH),SunOS) - ifneq ($(OS_RELEASE),4.1.3_U1) - ifneq ($(LOCAL_THREADS_ONLY),1) - ifeq ($(CPU_ARCH),x86) - ASFILES = os_$(OS_ARCH)_x86.s - else - ASFILES = os_$(OS_ARCH).s - ifneq ($(USE_64),1) - ASFILES += os_$(OS_ARCH)_32.s - endif - endif - endif - endif -endif - -ifeq ($(OS_ARCH), SINIX) - ifeq ($(CPU_ARCH),mips) - ASFILES = os_ReliantUNIX.s - endif -endif - -ifeq ($(OS_ARCH), HP-UX) - ASFILES = os_HPUX.s -endif - -ifeq ($(OS_ARCH), IRIX) - ASFILES = os_Irix.s -endif - -ifeq ($(OS_ARCH)$(OS_RELEASE),BSD_OS2.1) - ASFILES = os_BSD_386_2.s -endif - -endif # !USE_AUTOCONF - OBJS += $(addprefix md/unix/$(OBJDIR)/,$(CSRCS:.c=.$(OBJ_SUFFIX))) \ $(addprefix md/unix/$(OBJDIR)/,$(ASFILES:.s=.$(OBJ_SUFFIX))) 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..d6cacf6d 100644 --- a/pr/src/md/unix/uxproces.c +++ b/pr/src/md/unix/uxproces.c @@ -27,7 +27,11 @@ #include /* For dlopen, dlsym, dlclose */ #endif +#if defined(RHAPSODY) +#include +#else extern char **environ; +#endif /* * HP-UX 9 doesn't have the SA_RESTART flag. @@ -36,6 +40,10 @@ extern char **environ; #define SA_RESTART 0 #endif +#if defined(VMS) +static PRLock *_pr_vms_fork_lock = NULL; +#endif + /* ********************************************************************** * @@ -146,7 +154,10 @@ ForkAndExec( char *const *childEnvp; char **newEnvp = NULL; int flags; - +#ifdef VMS + char VMScurdir[FILENAME_MAX+1] = { '\0' } ; +#endif + process = PR_NEW(PRProcess); if (!process) { PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0); @@ -156,7 +167,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++) { } @@ -173,6 +188,65 @@ ForkAndExec( newEnvp[idx] = NULL; childEnvp = newEnvp; } +#ifdef VMS +/* +** Since vfork/exec is implemented VERY differently on OpenVMS, we have to +** handle the setting up of the standard streams very differently. And since +** none of this code can ever execute in the context of the child, we have +** to perform the chdir in the parent so the child is born into the correct +** directory (and then switch the parent back again). +*/ +{ + int decc$set_child_standard_streams(int,int,int); + int n, fd_stdin=0, fd_stdout=1, fd_stderr=2; + + /* Set up any standard streams we are given, assuming defaults */ + if (attr) { + if (attr->stdinFd) + fd_stdin = attr->stdinFd->secret->md.osfd; + if (attr->stdoutFd) + fd_stdout = attr->stdoutFd->secret->md.osfd; + if (attr->stderrFd) + fd_stderr = attr->stderrFd->secret->md.osfd; + } + + /* + ** Put a lock around anything that isn't going to be thread-safe. + */ + PR_Lock(_pr_vms_fork_lock); + + /* + ** Prepare the child's streams. We always do this in case a previous fork + ** has left the stream assignments in some non-standard way. + */ + n = decc$set_child_standard_streams(fd_stdin,fd_stdout,fd_stderr); + if (n == -1) { + PR_SetError(PR_BAD_DESCRIPTOR_ERROR, errno); + PR_DELETE(process); + if (newEnvp) { + PR_DELETE(newEnvp); + } + PR_Unlock(_pr_vms_fork_lock); + return NULL; + } + + /* Switch directory if we have to */ + if (attr) { + if (attr->currentDirectory) { + if ( (getcwd(VMScurdir,sizeof(VMScurdir)) == NULL) || + (chdir(attr->currentDirectory) < 0) ) { + PR_SetError(PR_DIRECTORY_OPEN_ERROR, errno); + PR_DELETE(process); + if (newEnvp) { + PR_DELETE(newEnvp); + } + PR_Unlock(_pr_vms_fork_lock); + return NULL; + } + } + } +} +#endif /* VMS */ #ifdef AIX process->md.pid = (*pr_wp.forkptr)(); @@ -193,7 +267,9 @@ ForkAndExec( * the standard I/O file descriptors, and hence corrupt * the parent process's standard I/O data structures. */ - +#ifdef VMS + /* OpenVMS has already handled all this above */ +#else if (attr) { if (attr->stdinFd && attr->stdinFd->secret->md.osfd != 0) { @@ -234,6 +310,7 @@ ForkAndExec( } } } +#endif /* !VMS */ if (childEnvp) { (void)execve(path, argv, childEnvp); @@ -242,12 +319,35 @@ ForkAndExec( (void)execv(path, argv); } /* Whoops! It returned. That's a bad sign. */ +#ifdef VMS + /* + ** On OpenVMS we are still in the context of the parent, and so we + ** can (and should!) perform normal error handling. + */ + PR_SetError(PR_UNKNOWN_ERROR, errno); + PR_DELETE(process); + if (newEnvp) { + PR_DELETE(newEnvp); + } + if (VMScurdir[0] != '\0') + chdir(VMScurdir); + PR_Unlock(_pr_vms_fork_lock); + return NULL; +#else _exit(1); +#endif /* VMS */ } if (newEnvp) { PR_DELETE(newEnvp); } +#ifdef VMS + /* If we switched directories, then remember to switch back */ + if (VMScurdir[0] != '\0') { + chdir(VMScurdir); /* can't do much if it fails */ + } + PR_Unlock(_pr_vms_fork_lock); +#endif /* VMS */ #if defined(_PR_NATIVE_THREADS) PR_Lock(pr_wp.ml); @@ -655,6 +755,10 @@ static PRStatus _MD_InitProcesses() pr_wp.ml = PR_NewLock(); PR_ASSERT(NULL != pr_wp.ml); +#if defined(VMS) + _pr_vms_fork_lock = PR_NewLock(); + PR_ASSERT(NULL != _pr_vms_fork_lock); +#endif #if defined(_PR_NATIVE_THREADS) pr_wp.numProcs = 0; pr_wp.cv = PR_NewCondVar(pr_wp.ml); 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 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/.cvsignore b/pr/src/md/windows/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/pr/src/md/windows/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/pr/src/md/windows/Makefile b/pr/src/md/windows/Makefile deleted file mode 100644 index 0655ba19..00000000 --- a/pr/src/md/windows/Makefile +++ /dev/null @@ -1,87 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -#! gmake - -MOD_DEPTH = ../../../.. - -include $(MOD_DEPTH)/config/config.mk - -ifeq ($(OS_TARGET), WIN16) -CSRCS = \ - w16null.c \ - w16thred.c \ - w16proc.c \ - w16fmem.c \ - w16sock.c \ - w16mem.c \ - w16io.c \ - w16gc.c \ - w16error.c \ - w16stdio.c \ - w16callb.c \ - ntinrval.c \ - $(NULL) -else -ifeq ($(OS_TARGET), WIN95) -CSRCS = \ - ntmisc.c \ - ntsec.c \ - ntsem.c \ - ntinrval.c \ - ntgc.c \ - w95thred.c \ - w95io.c \ - w95cv.c \ - w32rng.c \ - w95sock.c \ - win32_errors.c \ - w32ipcsem.c \ - w32poll.c \ - w32shm.c \ - w95dllmain.c \ - $(NULL) -else -CSRCS = \ - ntdllmn.c \ - ntmisc.c \ - ntsec.c \ - ntsem.c \ - ntinrval.c \ - ntgc.c \ - ntthread.c \ - ntio.c \ - win32_errors.c \ - w32ipcsem.c \ - w32poll.c \ - w32rng.c \ - w32shm.c \ - $(NULL) -endif -endif - -TARGETS = $(OBJS) - -INCLUDES = -I$(DIST)/include -I$(MOD_DEPTH)/pr/include -I$(MOD_DEPTH)/pr/include/private - -DEFINES += -D_NSPR_BUILD_ - -include $(MOD_DEPTH)/config/rules.mk - -export:: $(TARGETS) - -install:: export diff --git a/pr/src/md/windows/Makefile.in b/pr/src/md/windows/Makefile.in index 89100b06..cf5eeac9 100644 --- a/pr/src/md/windows/Makefile.in +++ b/pr/src/md/windows/Makefile.in @@ -27,7 +27,7 @@ include $(MOD_DEPTH)/config/autoconf.mk include $(topsrcdir)/config/config.mk ifdef USE_AUTOCONF -OS_TARGET=$(MOZ_TARGET) +OS_TARGET=$(MOZ_WIN32_TARGET) endif ifeq ($(OS_TARGET), WIN16) @@ -49,17 +49,18 @@ else ifeq ($(OS_TARGET), WIN95) CSRCS = \ ntmisc.c \ + ntsec.c \ ntsem.c \ ntinrval.c \ ntgc.c \ w95thred.c \ w95io.c \ w95cv.c \ + w32rng.c \ w95sock.c \ win32_errors.c \ w32ipcsem.c \ w32poll.c \ - w32rng.c \ w32shm.c \ w95dllmain.c \ $(NULL) @@ -67,6 +68,7 @@ else CSRCS = \ ntdllmn.c \ ntmisc.c \ + ntsec.c \ ntsem.c \ ntinrval.c \ ntgc.c \ @@ -83,7 +85,7 @@ endif TARGETS = $(OBJS) -INCLUDES = -I$(DIST)/include -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private +INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private DEFINES += -D_NSPR_BUILD_ @@ -91,4 +93,3 @@ include $(topsrcdir)/config/rules.mk export:: $(TARGETS) -install:: export 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/objs.mk b/pr/src/md/windows/objs.mk index eff0e2b1..3820da67 100644 --- a/pr/src/md/windows/objs.mk +++ b/pr/src/md/windows/objs.mk @@ -14,8 +14,9 @@ # Copyright (C) 1999 Christopher Seawood. All Rights Reserved. # -ifeq (WINNT,$(MOZ_TARGET)) +ifeq (WINNT,$(MOZ_WIN32_TARGET)) CSRCS = ntmisc.c \ + ntsec.c \ ntsem.c \ ntinrval.c \ ntgc.c \ @@ -23,10 +24,14 @@ CSRCS = ntmisc.c \ ntthread.c \ ntdllmn.c \ win32_errors.c \ - w32poll.c + w32ipcsem.c \ + w32poll.c \ + w32rng.c \ + w32shm.c else -ifeq (WIN95,$(MOZ_TARGET)) +ifeq (WIN95,$(MOZ_WIN32_TARGET)) CSRCS = ntmisc.c \ + ntsec.c \ ntsem.c \ ntinrval.c \ ntgc.c \ @@ -35,10 +40,13 @@ CSRCS = ntmisc.c \ w95cv.c \ w95sock.c \ win32_errors.c \ + w32ipcsem.c \ w32poll.c \ + w32rng.c \ + w32shm.c \ w95dllmain.c else -ifeq (WIN16,$(MOZ_TARGET)) +ifeq (WIN16,$(MOZ_WIN32_TARGET)) CSRCS = w16null.c \ w16thred.c \ w16proc.c \ 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/.cvsignore b/pr/src/memory/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/pr/src/memory/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/pr/src/memory/Makefile b/pr/src/memory/Makefile deleted file mode 100644 index 25762308..00000000 --- a/pr/src/memory/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -#! gmake - -MOD_DEPTH = ../../.. - -include $(MOD_DEPTH)/config/config.mk - -# Disable optimization of the nspr on SunOS4.1.3 -ifeq ($(OS_ARCH),SunOS) -ifeq ($(OS_RELEASE),4.1.3_U1) -OPTIMIZER = -endif -endif - -CSRCS = prseg.c prshm.c prshma.c - -TARGETS = $(OBJS) - -INCLUDES = -I$(DIST)/include -I$(MOD_DEPTH)/pr/include -I$(MOD_DEPTH)/pr/include/private - -DEFINES += -D_NSPR_BUILD_ - -include $(MOD_DEPTH)/config/rules.mk - -export:: $(TARGETS) - -install:: export - diff --git a/pr/src/memory/Makefile.in b/pr/src/memory/Makefile.in index 7fa317e3..8ccd22e3 100644 --- a/pr/src/memory/Makefile.in +++ b/pr/src/memory/Makefile.in @@ -26,20 +26,15 @@ include $(MOD_DEPTH)/config/autoconf.mk include $(topsrcdir)/config/config.mk -ifndef USE_AUTOCONF -# Disable optimization of the nspr on SunOS4.1.3 -ifeq ($(OS_ARCH),SunOS) -ifeq ($(OS_RELEASE),4.1.3_U1) -OPTIMIZER = -endif -endif -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 +INCLUDES = -I$(dist_includedir) -I$(dist_includedir)/.. -I$(dist_includedir)/../boehm -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private DEFINES += -D_NSPR_BUILD_ @@ -47,5 +42,4 @@ include $(topsrcdir)/config/rules.mk export:: $(TARGETS) -install:: export 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 + */ + +/* + * prgcleak.c + */ + +#ifdef GC_LEAK_DETECTOR + +/* for FILE */ +#include + +/* 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/.cvsignore b/pr/src/misc/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/pr/src/misc/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/pr/src/misc/Makefile b/pr/src/misc/Makefile deleted file mode 100644 index 842226dd..00000000 --- a/pr/src/misc/Makefile +++ /dev/null @@ -1,88 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -#! gmake - -MOD_DEPTH = ../../.. - -include $(MOD_DEPTH)/config/config.mk - -# Disable optimization of the nspr on SunOS4.1.3 -ifeq ($(OS_ARCH),SunOS) -ifeq ($(OS_RELEASE),4.1.3_U1) -OPTIMIZER = -endif -endif - -CSRCS = \ - pralarm.c \ - pratom.c \ - prcountr.c \ - prdtoa.c \ - prenv.c \ - prerr.c \ - prerror.c \ - prerrortable.c \ - prinit.c \ - prinrval.c \ - pripc.c \ - prlog2.c \ - prlong.c \ - prnetdb.c \ - prolock.c \ - prrng.c \ - prsystem.c \ - prtime.c \ - prthinfo.c \ - prtpool.c \ - prtrace.c \ - $(NULL) - -ifndef USE_PTHREADS -CSRCS += \ - pripcsem.c \ - $(NULL) -endif - -TARGETS = $(OBJS) - -INCLUDES = -I$(DIST)/include -I$(MOD_DEPTH)/pr/include -I$(MOD_DEPTH)/pr/include/private - -DEFINES += -D_NSPR_BUILD_ - -RELEASE_BINS = compile-et.pl prerr.properties - -include $(MOD_DEPTH)/config/rules.mk - -# An AIX Optimization bug causes PR_dtoa() to produce wrong result. -# This suppresses optimization for this single compilation unit. -ifeq ($(OS_ARCH), AIX) -$(OBJDIR)/prdtoa.o: - @$(MAKE_OBJDIR) - $(CC) -o $@ -c $(filter-out -O, $(CFLAGS)) prdtoa.c -endif - -# -# Generate prerr.h, prerr.c, and prerr.properties from prerr.et. -# -build_prerr: - perl compile-et.pl prerr.et - -export:: $(TARGETS) - -install:: export - diff --git a/pr/src/misc/Makefile.in b/pr/src/misc/Makefile.in index 5c0bf1a0..6ad93101 100644 --- a/pr/src/misc/Makefile.in +++ b/pr/src/misc/Makefile.in @@ -26,15 +26,6 @@ include $(MOD_DEPTH)/config/autoconf.mk include $(topsrcdir)/config/config.mk -ifndef USE_AUTOCONF -# Disable optimization of the nspr on SunOS4.1.3 -ifeq ($(OS_ARCH),SunOS) -ifeq ($(OS_RELEASE),4.1.3_U1) -OPTIMIZER = -endif -endif -endif #!USE_AUTOCONF - CSRCS = \ pralarm.c \ pratom.c \ @@ -50,11 +41,12 @@ CSRCS = \ prlog2.c \ prlong.c \ prnetdb.c \ - prrng.c \ prolock.c \ + prrng.c \ prsystem.c \ prtime.c \ prthinfo.c \ + prtpool.c \ prtrace.c \ $(NULL) @@ -66,23 +58,21 @@ endif TARGETS = $(OBJS) -INCLUDES = -I$(DIST)/include -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private +INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private DEFINES += -D_NSPR_BUILD_ -RELEASE_BINS = compile-et.pl prerr.properties +#RELEASE_BINS = compile-et.pl prerr.properties include $(topsrcdir)/config/rules.mk -ifndef USE_AUTOCONF # An AIX Optimization bug causes PR_dtoa() to produce wrong result. # This suppresses optimization for this single compilation unit. ifeq ($(OS_ARCH), AIX) -$(OBJDIR)/prdtoa.o: +$(OBJDIR)/prdtoa.o: prdtoa.c @$(MAKE_OBJDIR) - $(CC) -o $@ -c $(filter-out -O, $(CFLAGS)) prdtoa.c + $(CC) -o $@ -c $(filter-out -O, $(CFLAGS)) $< endif -endif #!USE_AUTOCONF # # Generate prerr.h, prerr.c, and prerr.properties from prerr.et. @@ -92,5 +82,4 @@ build_prerr: export:: $(TARGETS) -install:: export diff --git a/pr/src/misc/prnetdb.c b/pr/src/misc/prnetdb.c index f31374b3..6c538582 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) @@ -924,6 +924,7 @@ PR_IMPLEMENT(PRStatus) PR_InitializeNetAddr( PRStatus rv = PR_SUCCESS; if (!_pr_initialized) _PR_ImplicitInitialization(); + if (val != PR_IpAddrNull) memset(addr, 0, sizeof(addr->inet)); addr->inet.family = AF_INET; addr->inet.port = htons(port); switch (val) @@ -949,9 +950,10 @@ PR_IMPLEMENT(PRStatus) PR_SetNetAddr( PRStatus rv = PR_SUCCESS; if (!_pr_initialized) _PR_ImplicitInitialization(); - addr->raw.family = af; if (af == PR_AF_INET6) { + if (val != PR_IpAddrNull) memset(addr, 0, sizeof(addr->ipv6)); + addr->ipv6.family = af; addr->ipv6.port = htons(port); addr->ipv6.flowinfo = 0; addr->ipv6.scope_id = 0; @@ -972,6 +974,8 @@ PR_IMPLEMENT(PRStatus) PR_SetNetAddr( } else { + if (val != PR_IpAddrNull) memset(addr, 0, sizeof(addr->inet)); + addr->inet.family = af; addr->inet.port = htons(port); switch (val) { 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/misc/prtime.c b/pr/src/misc/prtime.c index b5cbb6cf..9c4a5944 100644 --- a/pr/src/misc/prtime.c +++ b/pr/src/misc/prtime.c @@ -1649,7 +1649,7 @@ PR_FormatTime(char *buf, int buflen, const char *fmt, const PRExplodedTime *tm) * values for these two fields. */ -#if defined(SUNOS4) || (__GLIBC__ >= 2) +#if defined(SUNOS4) || (__GLIBC__ >= 2) || defined(XP_BEOS) if (mktime(&a) == -1) { PR_snprintf(buf, buflen, "can't get timezone"); return 0; diff --git a/pr/src/prvrsion.c b/pr/src/prvrsion.c index c694a34e..f029398b 100644 --- a/pr/src/prvrsion.c +++ b/pr/src/prvrsion.c @@ -22,7 +22,9 @@ /************************************************************************/ /**************************IDENTITY AND VERSIONING***********************/ /************************************************************************/ +#ifndef XP_MAC #include "_pr_bld.h" +#endif #if !defined(_BUILD_TIME) #ifdef HAVE_LONG_LONG #define _BUILD_TIME 0 diff --git a/pr/src/pthreads/.cvsignore b/pr/src/pthreads/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/pr/src/pthreads/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/pr/src/pthreads/Makefile b/pr/src/pthreads/Makefile deleted file mode 100644 index d2700995..00000000 --- a/pr/src/pthreads/Makefile +++ /dev/null @@ -1,49 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -#! gmake - -MOD_DEPTH = ../../.. - -include $(MOD_DEPTH)/config/config.mk - -# Disable optimization of the nspr on SunOS4.1.3 -ifeq ($(OS_ARCH),SunOS) -ifeq ($(OS_RELEASE),4.1.3_U1) -OPTIMIZER = -endif -endif - -CSRCS = \ - ptio.c \ - ptsynch.c \ - ptthread.c \ - ptmisc.c \ - $(NULL) - -TARGETS = $(OBJS) - -INCLUDES = -I$(DIST)/include -I$(MOD_DEPTH)/pr/include -I$(MOD_DEPTH)/pr/include/private - -DEFINES += -D_NSPR_BUILD_ - -include $(MOD_DEPTH)/config/rules.mk - -export:: $(TARGETS) - -install:: export - diff --git a/pr/src/pthreads/Makefile.in b/pr/src/pthreads/Makefile.in index f8328e90..4201bad9 100644 --- a/pr/src/pthreads/Makefile.in +++ b/pr/src/pthreads/Makefile.in @@ -42,7 +42,7 @@ CSRCS = \ TARGETS = $(OBJS) -INCLUDES = -I$(DIST)/include -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private +INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private DEFINES += -D_NSPR_BUILD_ @@ -50,5 +50,4 @@ include $(topsrcdir)/config/rules.mk export:: $(TARGETS) -install:: export 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 @@ -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 #include @@ -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..68c959b9 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 + +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 */ @@ -90,9 +126,14 @@ static void _PR_InitializeStack(PRThreadStack *ts) #ifdef HAVE_STACK_GROWING_UP 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 } } @@ -297,6 +338,9 @@ static PRThread* _PR_CreateThread( #endif /* !defined(_PR_DCETHREADS) */ if (0 == stackSize) stackSize = (64 * 1024); /* default == 64K */ +#ifdef _MD_MINIMUM_STACK_SIZE + if (stackSize < _MD_MINIMUM_STACK_SIZE) stackSize = _MD_MINIMUM_STACK_SIZE; +#endif /* * Linux doesn't have pthread_attr_setstacksize. */ @@ -762,11 +806,27 @@ void _PR_InitThreads( #endif #if defined(_PR_DCETHREADS) || defined(_POSIX_THREAD_PRIORITY_SCHEDULING) +#if defined(FREEBSD) + { + pthread_attr_t attr; + int policy; + /* get the min and max priorities of the default policy */ + pthread_attr_init(&attr); + pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + pthread_attr_getschedpolicy(&attr, &policy); + pt_book.minPrio = sched_get_priority_min(policy); + PR_ASSERT(-1 != pt_book.minPrio); + pt_book.maxPrio = sched_get_priority_max(policy); + PR_ASSERT(-1 != pt_book.maxPrio); + pthread_attr_destroy(&attr); + } +#else /* ** These might be function evaluations */ pt_book.minPrio = PT_PRIO_MIN; pt_book.maxPrio = PT_PRIO_MAX; +#endif #endif PR_ASSERT(NULL == pt_book.ml); @@ -1031,7 +1091,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 +1155,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 +1346,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 +1355,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 +1388,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 +1396,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/.cvsignore b/pr/src/threads/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/pr/src/threads/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/pr/src/threads/Makefile b/pr/src/threads/Makefile deleted file mode 100644 index 0294ca57..00000000 --- a/pr/src/threads/Makefile +++ /dev/null @@ -1,77 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -#! gmake - -MOD_DEPTH = ../../.. - -include $(MOD_DEPTH)/config/config.mk - -ifdef USE_PTHREADS - DIRS = -else -ifdef USE_BTHREADS - DIRS = -else - DIRS = combined -endif -endif - -# Disable optimization of the nspr on SunOS4.1.3 -ifeq ($(OS_ARCH),SunOS) -ifeq ($(OS_RELEASE),4.1.3_U1) -OPTIMIZER = -endif -endif - -ifdef USE_PTHREADS -CSRCS = \ - prcmon.c \ - prrwlock.c \ - prtpd.c \ - $(NULL) -else -ifdef USE_BTHREADS -CSRCS = \ - prcmon.c \ - prrwlock.c \ - prtpd.c \ - $(NULL) -else -CSRCS = \ - prcmon.c \ - prdump.c \ - prmon.c \ - prsem.c \ - prrwlock.c \ - prcthr.c \ - prtpd.c \ - $(NULL) -endif -endif - -TARGETS = $(OBJS) - -INCLUDES = -I$(DIST)/include -I$(MOD_DEPTH)/pr/include -I$(MOD_DEPTH)/pr/include/private - -DEFINES += -D_NSPR_BUILD_ - -include $(MOD_DEPTH)/config/rules.mk - -export:: $(TARGETS) - -install:: export diff --git a/pr/src/threads/Makefile.in b/pr/src/threads/Makefile.in index 8e091510..47778a88 100644 --- a/pr/src/threads/Makefile.in +++ b/pr/src/threads/Makefile.in @@ -36,15 +36,6 @@ else endif endif -ifndef USE_AUTOCONF -# Disable optimization of the nspr on SunOS4.1.3 -ifeq ($(OS_ARCH),SunOS) -ifeq ($(OS_RELEASE),4.1.3_U1) -OPTIMIZER = -endif -endif -endif - ifdef USE_PTHREADS CSRCS = \ prcmon.c \ @@ -73,7 +64,7 @@ endif TARGETS = $(OBJS) -INCLUDES = -I$(DIST)/include -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private +INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private DEFINES += -D_NSPR_BUILD_ @@ -81,4 +72,3 @@ include $(topsrcdir)/config/rules.mk export:: $(TARGETS) -install:: export diff --git a/pr/src/threads/combined/.cvsignore b/pr/src/threads/combined/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/pr/src/threads/combined/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/pr/src/threads/combined/Makefile b/pr/src/threads/combined/Makefile deleted file mode 100644 index f45fdecb..00000000 --- a/pr/src/threads/combined/Makefile +++ /dev/null @@ -1,54 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -#! gmake - -MOD_DEPTH = ../../../.. - -include $(MOD_DEPTH)/config/config.mk - -# Disable optimization of the nspr on SunOS4.1.3 -ifeq ($(OS_ARCH),SunOS) -ifeq ($(OS_RELEASE),4.1.3_U1) -OPTIMIZER = -endif -endif - -ifdef USE_PTHREADS -CSRCS = \ - $(NULL) -else -CSRCS = \ - prucpu.c \ - prucv.c \ - prulock.c \ - pruthr.c \ - prustack.c \ - $(NULL) -endif - -TARGETS = $(OBJS) - -INCLUDES = -I$(DIST)/include -I$(MOD_DEPTH)/pr/include -I$(MOD_DEPTH)/pr/include/private - -DEFINES += -D_NSPR_BUILD_ - -include $(MOD_DEPTH)/config/rules.mk - -export:: $(TARGETS) - -install:: export diff --git a/pr/src/threads/combined/Makefile.in b/pr/src/threads/combined/Makefile.in index ecaca4bf..9b455443 100644 --- a/pr/src/threads/combined/Makefile.in +++ b/pr/src/threads/combined/Makefile.in @@ -50,7 +50,7 @@ endif TARGETS = $(OBJS) -INCLUDES = -I$(DIST)/include -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private +INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private DEFINES += -D_NSPR_BUILD_ @@ -58,4 +58,3 @@ include $(topsrcdir)/config/rules.mk export:: $(TARGETS) -install:: export 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 @@ -1247,6 +1247,14 @@ PR_IMPLEMENT(PRThread*) _PR_CreateThread(PRThreadType type, if ((PRUptrdiff)top & 0x3f) { 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)); diff --git a/pr/tests/.cvsignore b/pr/tests/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/pr/tests/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/pr/tests/Makefile b/pr/tests/Makefile deleted file mode 100644 index d1851723..00000000 --- a/pr/tests/Makefile +++ /dev/null @@ -1,571 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -#! gmake - -MOD_DEPTH = ../.. - -include $(MOD_DEPTH)/config/config.mk - -ifeq ($(OS_TARGET), WIN16) -OS_CFLAGS = $(OS_EXE_CFLAGS) -W16STDIO = $(MOD_DEPTH)/pr/src/md/windows/$(OBJDIR)/w16stdio.$(OBJ_SUFFIX) -endif - -ifeq ($(OS_TARGET),WIN16) -DIRS = dll w16gui -else -DIRS = dll -endif - -ifeq ($(OS_TARGET),OS2) -OS_CFLAGS = $(OS_EXE_CFLAGS) -endif - -CSRCS = \ - accept.c \ - acceptread.c \ - addrstr.c \ - affinity.c \ - alarm.c \ - anonfm.c \ - atomic.c \ - attach.c \ - bigfile.c \ - bigfile2.c \ - bigfile3.c \ - cleanup.c \ - cltsrv.c \ - concur.c \ - cvar.c \ - cvar2.c \ - dceemu.c \ - dlltest.c \ - dtoa.c \ - errcodes.c \ - exit.c \ - fdcach.c \ - fileio.c \ - foreign.c \ - forktest.c \ - fsync.c \ - gethost.c \ - getproto.c \ - i2l.c \ - initclk.c \ - inrval.c \ - instrumt.c \ - intrupt.c \ - io_timeout.c \ - ioconthr.c \ - ipv6.c \ - join.c \ - joinkk.c \ - joinku.c \ - joinuk.c \ - joinuu.c \ - layer.c \ - lazyinit.c \ - lltest.c \ - lock.c \ - lockfile.c \ - logger.c \ - makedir.c \ - mbcs.c \ - multiacc.c \ - multiwait.c \ - many_cv.c \ - nameshm1.c \ - nbconn.c \ - nblayer.c \ - nonblock.c \ - ntioto.c \ - ntoh.c \ - op_2long.c \ - op_excl.c \ - op_filnf.c \ - op_filok.c \ - op_noacc.c \ - op_nofil.c \ - openfile.c \ - parent.c \ - perf.c \ - pipeping.c \ - pipepong.c \ - pipeself.c \ - poll_er.c \ - poll_nm.c \ - poll_to.c \ - pollable.c \ - prftest.c \ - prftest1.c \ - prftest2.c \ - priotest.c \ - provider.c \ - prpoll.c \ - ranfile.c \ - randseed.c \ - rwlocktest.c \ - sel_spd.c \ - selct_er.c \ - selct_nm.c \ - selct_to.c \ - select2.c \ - sem.c \ - sema.c \ - semaerr.c \ - semaerr1.c \ - semaping.c \ - semapong.c \ - sendzlf.c \ - server_test.c \ - servr_kk.c \ - servr_ku.c \ - servr_uk.c \ - servr_uu.c \ - short_thread.c \ - sigpipe.c \ - socket.c \ - sockopt.c \ - sockping.c \ - sockpong.c \ - sprintf.c \ - sproc_ch.c \ - sproc_p.c \ - stack.c \ - stdio.c \ - str2addr.c \ - strod.c \ - suspend.c \ - switch.c \ - system.c \ - testbit.c \ - testfile.c \ - thrpool_server.c \ - thrpool_client.c \ - threads.c \ - thruput.c \ - timemac.c \ - timetest.c \ - tmoacc.c \ - tmocon.c \ - tpd.c \ - vercheck.c \ - version.c \ - udpsrv.c \ - writev.c \ - xnotify.c \ - y2k.c \ - y2ktmo.c \ - zerolen.c \ - $(NULL) - -ifeq ($(OS_TARGET),OS2) -CSRCS += \ - sleep.c \ - stat.c \ - yield.c \ - $(NULL) -endif - -ifeq (,$(filter-out WINNT OS2,$(OS_ARCH))) -PROG_SUFFIX = .exe -else -PROG_SUFFIX = -endif - -PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(PROG_SUFFIX))) - -TARGETS = $(PROGS) - -INCLUDES = -I$(DIST)/include -I$(MOD_DEPTH)/pr/include -I$(MOD_DEPTH)/pr/include/private - -# Setting the variables LDOPTS and LIBPR. We first initialize -# them to the default values, then adjust them for some platforms. -LDOPTS = -L$(DIST)/lib -LIBPR = -lnspr$(MOD_VERSION) -LIBPLC = -lplc$(MOD_VERSION) - -ifeq ($(OS_ARCH), WINNT) -ifeq ($(OS_TARGET), WIN16) - LIBPR = $(DIST)/lib/nspr$(MOD_VERSION).lib - LIBPLC= $(DIST)/lib/plc$(MOD_VERSION).lib -else - LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO - ifeq ($(OS_TARGET), WIN95) - LIBPR = $(DIST)/lib/nspr$(MOD_VERSION).$(LIB_SUFFIX) - LIBPLC= $(DIST)/lib/plc$(MOD_VERSION).$(LIB_SUFFIX) - else - LIBPR = $(DIST)/lib/libnspr$(MOD_VERSION).$(LIB_SUFFIX) - LIBPLC= $(DIST)/lib/libplc$(MOD_VERSION).$(LIB_SUFFIX) - endif - ifdef PROFILE - LDOPTS += -PROFILE -MAP - endif # profile -endif -endif - -ifeq ($(OS_ARCH),OS2) -ifeq ($(MOZ_OS2_TOOLS),VACPP) - LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO - LIBPR = $(DIST)/lib/nspr$(MOD_VERSION).lib - LIBPLC = $(DIST)/lib/plc$(MOD_VERSION).lib -else -ifeq ($(MOZ_OS2_EMX_OBJECTFORMAT),OMF) - LDOPTS = -Zlinker /PM:VIO -endif -endif -endif - -ifneq ($(OS_ARCH), WINNT) -# Use an absolute pathname as the runtime library path (for the -R -# or -rpath linker option or the LD_RUN_PATH environment variable). -ifeq (,$(patsubst /%,,$(DIST))) -# $(DIST) is already an absolute pathname. -ABSOLUTE_LIB_DIR = $(DIST)/lib -else -# $(DIST) is a relative pathname: prepend the current directory. -PWD = $(shell pwd) -ABSOLUTE_LIB_DIR = $(PWD)/$(DIST)/lib -endif -endif - -ifeq ($(OS_ARCH), IRIX) - ifeq ($(USE_CPLUS), 1) - CC = CC - endif - LDOPTS += -rpath $(ABSOLUTE_LIB_DIR) -rdata_shared -# For 6.x machines, include this flag - ifeq ($(basename $(OS_RELEASE)),6) - ifeq ($(USE_N32),1) - LDOPTS += -n32 - else - LDOPTS += -32 - endif - - ifeq ($(USE_PTHREADS), 1) - ifeq ($(OS_RELEASE), 6.2) - LDOPTS += -Wl,-woff,85 - endif - endif - endif -endif - -ifeq ($(OS_ARCH), OSF1) - ifeq ($(USE_CPLUS), 1) - CC = cxx - endif -# I haven't figured out how to pass -rpath to cc on OSF1 V3.2, so -# we do static linking. - ifeq (,$(filter-out V2.0 V3.2,$(OS_RELEASE))) - LIBPR = $(DIST)/lib/libnspr$(MOD_VERSION).a - LIBPLC = $(DIST)/lib/libplc$(MOD_VERSION).a - EXTRA_LIBS = -lc_r - else - LDOPTS += -rpath $(ABSOLUTE_LIB_DIR) - endif -endif - -ifeq ($(OS_ARCH), HP-UX) - LDOPTS += -z -Wl,+s,+b,$(ABSOLUTE_LIB_DIR) - ifeq ($(USE_64),1) - LDOPTS += +DA2.0W - EXTRA_LIBS = -lpthread - endif -endif - -# AIX -ifeq ($(OS_ARCH),AIX) - LDOPTS += -blibpath:$(ABSOLUTE_LIB_DIR):/usr/lib:/lib - ifeq ($(OS_ARCH)$(OS_RELEASE),AIX4.1) - LIBPR = -lnspr$(MOD_VERSION)_shr - LIBPLC = -lplc$(MOD_VERSION)_shr - else - LDOPTS += -brtl - EXTRA_LIBS = -ldl - endif -endif - -# Solaris -ifeq ($(OS_ARCH), SunOS) - ifneq ($(OS_RELEASE), 4.1.3_U1) - ifdef NS_USE_GCC - LDOPTS += -Xlinker -R -Xlinker $(ABSOLUTE_LIB_DIR) - else - ifeq ($(USE_CPLUS), 1) - CC = CC - endif - LDOPTS += -R $(ABSOLUTE_LIB_DIR) - endif - endif - - ifneq ($(LOCAL_THREADS_ONLY),1) -# SunOS 5.4 and 5.5 need to link with -lthread or -lpthread, -# even though we already linked with these system libraries -# when we built libnspr.so. - ifeq ($(OS_RELEASE), 5.4) - EXTRA_LIBS = -lthread - endif - - ifeq ($(OS_RELEASE), 5.5) - ifdef USE_PTHREADS - EXTRA_LIBS = -lpthread - else - EXTRA_LIBS = -lthread - endif - endif - endif # LOCAL_THREADS_ONLY -endif # SunOS - -ifeq ($(OS_ARCH), NEC) - EXTRA_LIBS = $(OS_LIBS) -# This hardcodes in the executable programs the directory to find -# libnspr.so etc. at program startup. Equivalent to the -R or -rpath -# option for ld on other platforms. - export LD_RUN_PATH = $(ABSOLUTE_LIB_DIR) -endif - -ifeq ($(OS_ARCH), NCR) -# NCR needs to link against -lsocket -lnsl -ldl (and -lc, which is -# linked implicitly by $(CC)). Note that we did not link with these -# system libraries when we built libnspr.so. - EXTRA_LIBS = -lsocket -lnsl -ldl -# This hardcodes in the executable programs the directory to find -# libnspr.so etc. at program startup. Equivalent to the -R or -rpath -# option for ld on other platforms. - export LD_RUN_PATH = $(ABSOLUTE_LIB_DIR) -endif - -ifeq ($(OS_ARCH), NEXTSTEP) -# balazs.pataki@sztaki.hu: linkage is done in a different pass in the `tests' -# modeul, so we have to pass the `-posix' flag by "hand" to `ld' -LDOPTS += -posix -endif - -ifeq ($(OS_ARCH), NEWS-OS) -# This hardcodes in the executable programs the directory to find -# libnspr.so etc. at program startup. Equivalent to the -R or -rpath -# option for ld on other platforms. -#export LD_RUN_PATH = $(ABSOLUTE_LIB_DIR) - LIBPR = $(DIST)/lib/libnspr$(MOD_VERSION).a - LIBPLC = $(DIST)/lib/libplc$(MOD_VERSION).a - EXTRA_LIBS = -lsocket -lnsl -lgen -lresolv -endif - -ifeq ($(OS_ARCH), Linux) - ifeq ($(OS_RELEASE), 1.2) - EXTRA_LIBS = -ldl - else - LDOPTS += -Xlinker -rpath $(ABSOLUTE_LIB_DIR) - ifeq ($(USE_PTHREADS),1) - EXTRA_LIBS = -lpthread - endif - endif -endif - -ifeq ($(OS_ARCH), SCOOS) -# SCO Unix needs to link against -lsocket again even though we -# already linked with these system libraries when we built libnspr.so. -EXTRA_LIBS = -lsocket -# This hardcodes in the executable programs the directory to find -# libnspr.so etc. at program startup. Equivalent to the -R or -rpath -# option for ld on other platforms. -export LD_RUN_PATH = $(ABSOLUTE_LIB_DIR) -endif - -ifeq ($(OS_ARCH),SINIX) -EXTRA_LIBS = -lsocket -lnsl -lresolv -ldl -# This hardcodes in the executable programs the directory to find -# libnspr.so etc. at program startup. Equivalent to the -R or -rpath -# option for ld on other platforms. -export LD_RUN_PATH = $(ABSOLUTE_LIB_DIR) -endif - -ifeq ($(OS_ARCH), UNIXWARE) -export LD_RUN_PATH = $(ABSOLUTE_LIB_DIR) -endif - -ifeq ($(OS_ARCH),FreeBSD) -ifeq ($(USE_PTHREADS),1) -LDOPTS += -pthread -endif -LDOPTS += -Xlinker -R $(ABSOLUTE_LIB_DIR) -endif - -ifeq ($(OS_ARCH),OpenBSD) -ifeq ($(USE_PTHREADS),1) -LDOPTS += -pthread -endif -endif - -ifeq ($(OS_ARCH),BSD_OS) -ifneq ($(OS_RELEASE),1.1) -EXTRA_LIBS = -ldl -endif -endif - -ifeq ($(USE_PTHREADS),1) -LIBPTHREAD = -lpthread -ifeq ($(OS_ARCH),AIX) -LIBPTHREAD = -lpthreads -endif -ifeq (,$(filter-out FreeBSD OpenBSD BSD_OS NTO,$(OS_ARCH))) -LIBPTHREAD = -endif -ifeq ($(OS_ARCH)$(basename $(OS_RELEASE)),HP-UXB.10) -LIBPTHREAD = -ldce -endif -endif - -##################################################### -# -# The rules -# -##################################################### - -include $(MOD_DEPTH)/config/rules.mk - -AIX_PRE_4_2 = 0 -ifeq ($(OS_ARCH),AIX) -ifeq ($(OS_RELEASE),4.1) -ifneq ($(USE_PTHREADS), 1) -#AIX_PRE_4_2 = 1 -endif -endif -endif - -ifeq ($(AIX_PRE_4_2),1) - -# AIX releases prior to 4.2 need a special two-step linking hack -# in order to both override the system select() and be able to -# get at the original system select(). -# -# We use a pattern rule in ns/nspr20/config/rules.mk to generate -# the .$(OBJ_SUFFIX) file from the .c source file, then do the -# two-step linking hack below. - -$(OBJDIR)/%: $(OBJDIR)/%.$(OBJ_SUFFIX) - @$(MAKE_OBJDIR) - rm -f $@ $(AIX_TMP) - $(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(DIST)/lib/libnspr$(MOD_VERSION).a - $(CC) -o $@ $(AIX_TMP) $(AIX_WRAP) - rm -f $(AIX_TMP) - -else - -# All platforms that are not AIX pre-4.2. - -$(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX) - @$(MAKE_OBJDIR) -ifeq ($(OS_ARCH), WINNT) -ifeq ($(OS_TARGET),WIN16) - echo system windows >w16link - echo name $@ >>w16link - echo option map >>w16link -# echo option CASEEXACT >>w16link - echo option stack=16K >>w16link - echo debug $(DEBUGTYPE) all >>w16link - echo file >>w16link - echo $< , >>w16link - echo $(W16STDIO) >>w16link - echo library >>w16link - echo $(LIBPR), >>w16link - echo $(LIBPLC), >>w16link - echo winsock.lib >>w16link - wlink @w16link. -else - link $(LDOPTS) $(EXTRA_LDOPTS) $< $(LIBPLC) $(LIBPR) $(EXTRA_LIBS) wsock32.lib -out:$@ -endif -else -ifeq ($(OS_ARCH),OS2) - $(LINK) $(EXEFLAGS) $(LDOPTS) $< $(LIBPLC) $(LIBPR) $(OS_LIBS) $(EXTRA_LIBS) -else - $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPR) $(EXTRA_LIBS) -o $@ -endif -endif -endif - -export:: $(TARGETS) -install:: export -clean:: - rm -f $(TARGETS) - -# The following tests call BSD socket functions, so they need to link -# with -lsocket on some platforms. -ifeq ($(OS_ARCH),SunOS) -ifneq ($(OS_RELEASE),4.1.3_U1) -ifeq ($(USE_IPV6),1) -$(OBJDIR)/gethost: $(OBJDIR)/gethost.o - $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPR) -lsocket $(EXTRA_LIBS) -o $@ -endif -$(OBJDIR)/prpoll: $(OBJDIR)/prpoll.o - $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPR) -lsocket $(EXTRA_LIBS) -o $@ -endif -endif - -ifeq ($(USE_PTHREADS), 1) -$(OBJDIR)/attach: $(OBJDIR)/attach.o - $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@ -$(OBJDIR)/foreign: $(OBJDIR)/foreign.o - $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@ -$(OBJDIR)/provider: $(OBJDIR)/provider.o - $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@ -$(OBJDIR)/socket: $(OBJDIR)/socket.o - $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@ -$(OBJDIR)/testfile: $(OBJDIR)/testfile.o - $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@ -endif - -# -# Run the test programs with no arguments -# -# Test output goes to the file pointed to by the environment variable -# NSPR_TEST_LOGFILE, if set, else to /dev/null -# -ECHO = echo -PROGRAMS = $(notdir $(PROGS)) -ifdef NSPR_TEST_LOGFILE -LOGFILE = $(NSPR_TEST_LOGFILE) -else -ifeq (,$(filter-out WINNT OS2,$(OS_ARCH))) -LOGFILE = nul -else -LOGFILE = /dev/null -endif -endif - -ifeq ($(OS_TARGET),Linux) -ECHO = /bin/echo -endif - -ALWAYS: - -runtests:: $(PROGS) ALWAYS - @$(ECHO) "\nNSPR Test Results - $(OBJDIR)\n" - @$(ECHO) "BEGIN\t\t\t`date`" - @$(ECHO) "NSPR_TEST_LOGFILE\t$(LOGFILE)\n" - @$(ECHO) "Test\t\t\tResult\n" - @cd $(OBJDIR); for i in $(PROGRAMS); do \ - $(ECHO) "$$i\c"; \ - ./$$i >> $(LOGFILE) 2>&1 ; \ - if [ 0 = $$? ] ; then \ - $(ECHO) "\t\t\tPassed"; \ - else \ - $(ECHO) "\t\t\tFAILED"; \ - fi; \ - done - @$(ECHO) "\nEND\t\t`date`\n" diff --git a/pr/tests/Makefile.in b/pr/tests/Makefile.in index 30dad6d7..80e3738a 100644 --- a/pr/tests/Makefile.in +++ b/pr/tests/Makefile.in @@ -26,16 +26,7 @@ include $(MOD_DEPTH)/config/autoconf.mk include $(topsrcdir)/config/config.mk -ifeq ($(OS_TARGET), WIN16) -OS_CFLAGS = $(OS_EXE_CFLAGS) -W16STDIO = $(MOD_DEPTH)/pr/src/md/windows/$(OBJDIR)/w16stdio.$(OBJ_SUFFIX) -endif - -ifeq ($(OS_TARGET),WIN16) -DIRS = dll w16gui -else DIRS = dll -endif ifeq ($(OS_TARGET),OS2) OS_CFLAGS = $(OS_EXE_CFLAGS) @@ -93,11 +84,11 @@ CSRCS = \ multiacc.c \ multiwait.c \ many_cv.c \ - nameshm1.c \ + nameshm1.c \ nbconn.c \ nblayer.c \ nonblock.c \ - ntioto.c \ + ntioto.c \ ntoh.c \ op_2long.c \ op_excl.c \ @@ -122,7 +113,7 @@ CSRCS = \ provider.c \ prpoll.c \ ranfile.c \ - randseed.c \ + randseed.c \ rwlocktest.c \ sel_spd.c \ selct_er.c \ @@ -130,12 +121,12 @@ CSRCS = \ selct_to.c \ select2.c \ sem.c \ - sema.c \ - semaerr.c \ - semaerr1.c \ - semaping.c \ - semapong.c \ - sendzlf.c \ + sema.c \ + semaerr.c \ + semaerr1.c \ + semaping.c \ + semapong.c \ + sendzlf.c \ server_test.c \ servr_kk.c \ servr_ku.c \ @@ -159,6 +150,8 @@ CSRCS = \ system.c \ testbit.c \ testfile.c \ + thrpool_server.c \ + thrpool_client.c \ threads.c \ thruput.c \ timemac.c \ @@ -172,7 +165,7 @@ CSRCS = \ writev.c \ xnotify.c \ y2k.c \ - y2ktmo.c \ + y2ktmo.c \ zerolen.c \ $(NULL) @@ -184,7 +177,7 @@ CSRCS += \ $(NULL) endif -ifeq ($(OS_ARCH), WINNT) +ifeq (,$(filter-out WINNT OS2,$(OS_ARCH))) PROG_SUFFIX = .exe else PROG_SUFFIX = @@ -194,42 +187,22 @@ PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(PROG_SUFFIX))) TARGETS = $(PROGS) -INCLUDES = -I$(DIST)/include -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private - -# Setting the variables LDOPTS and LIBPR. We first initialize -# them to the default values, then adjust them for some platforms. -LDOPTS = -L$(DIST)/lib -LIBPR = -lnspr$(MOD_VERSION) -LIBPLC = -lplc$(MOD_VERSION) - -ifndef USE_AUTOCONF +INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private ifeq ($(OS_ARCH), WINNT) -ifeq ($(OS_TARGET), WIN16) - LIBPR = $(DIST)/lib/nspr$(MOD_VERSION).lib - LIBPLC= $(DIST)/lib/plc$(MOD_VERSION).lib -else -ifeq ($(OS_TARGET), OS2) -ifdef XP_OS2_VACPP - LDOPTS = - LIBPR = $(DIST)/lib/nspr$(MOD_VERSION).lib - LIBPLC= $(DIST)/lib/plc$(MOD_VERSION).lib -else - LDOPTS = -Zlinker /PM:VIO -endif -else LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO - ifeq ($(OS_TARGET), WIN95) - LIBPR = $(DIST)/lib/nspr$(MOD_VERSION).$(LIB_SUFFIX) - LIBPLC= $(DIST)/lib/plc$(MOD_VERSION).$(LIB_SUFFIX) - else - LIBPR = $(DIST)/lib/libnspr$(MOD_VERSION).$(LIB_SUFFIX) - LIBPLC= $(DIST)/lib/libplc$(MOD_VERSION).$(LIB_SUFFIX) - endif ifdef PROFILE LDOPTS += -PROFILE -MAP endif # profile endif + +ifeq ($(OS_ARCH),OS2) +ifeq ($(MOZ_OS2_TOOLS),VACPP) + LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO +else +ifeq ($(MOZ_OS2_EMX_OBJECTFORMAT),OMF) + LDOPTS = -Zlinker /PM:VIO +endif endif endif @@ -238,11 +211,11 @@ ifneq ($(OS_ARCH), WINNT) # or -rpath linker option or the LD_RUN_PATH environment variable). ifeq (,$(patsubst /%,,$(DIST))) # $(DIST) is already an absolute pathname. -ABSOLUTE_LIB_DIR = $(DIST)/lib +ABSOLUTE_LIB_DIR = $(dist_libdir) else # $(DIST) is a relative pathname: prepend the current directory. PWD = $(shell pwd) -ABSOLUTE_LIB_DIR = $(PWD)/$(DIST)/lib +ABSOLUTE_LIB_DIR = $(PWD)/$(dist_libdir) endif endif @@ -274,8 +247,8 @@ ifeq ($(OS_ARCH), OSF1) # I haven't figured out how to pass -rpath to cc on OSF1 V3.2, so # we do static linking. ifeq (,$(filter-out V2.0 V3.2,$(OS_RELEASE))) - LIBPR = $(DIST)/lib/libnspr$(MOD_VERSION).a - LIBPLC = $(DIST)/lib/libplc$(MOD_VERSION).a + LIBNSPR = $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).a + LIBPLC = $(dist_libdir)/libplc$(MOD_MAJOR_VERSION).a EXTRA_LIBS = -lc_r else LDOPTS += -rpath $(ABSOLUTE_LIB_DIR) @@ -285,8 +258,8 @@ endif ifeq ($(OS_ARCH), HP-UX) LDOPTS += -z -Wl,+s,+b,$(ABSOLUTE_LIB_DIR) ifeq ($(USE_64),1) - LDOPTS += +DA2.0W - EXTRA_LIBS = -lpthread + LDOPTS += +DA2.0W + EXTRA_LIBS = -lpthread endif endif @@ -294,8 +267,8 @@ endif ifeq ($(OS_ARCH),AIX) LDOPTS += -blibpath:$(ABSOLUTE_LIB_DIR):/usr/lib:/lib ifeq ($(OS_ARCH)$(OS_RELEASE),AIX4.1) - LIBPR = -lnspr$(MOD_VERSION)_shr - LIBPLC = -lplc$(MOD_VERSION)_shr + LIBNSPR = -lnspr$(MOD_MAJOR_VERSION)_shr + LIBPLC = -lplc$(MOD_MAJOR_VERSION)_shr else LDOPTS += -brtl EXTRA_LIBS = -ldl @@ -363,8 +336,8 @@ ifeq ($(OS_ARCH), NEWS-OS) # libnspr.so etc. at program startup. Equivalent to the -R or -rpath # option for ld on other platforms. #export LD_RUN_PATH = $(ABSOLUTE_LIB_DIR) - LIBPR = $(DIST)/lib/libnspr$(MOD_VERSION).a - LIBPLC = $(DIST)/lib/libplc$(MOD_VERSION).a + LIBNSPR = $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).a + LIBPLC = $(dist_libdir)/libplc$(MOD_MAJOR_VERSION).a EXTRA_LIBS = -lsocket -lnsl -lgen -lresolv endif @@ -401,6 +374,13 @@ ifeq ($(OS_ARCH), UNIXWARE) export LD_RUN_PATH = $(ABSOLUTE_LIB_DIR) endif +ifeq ($(OS_ARCH),FreeBSD) +ifeq ($(USE_PTHREADS),1) +LDOPTS += -pthread +endif +LDOPTS += -Xlinker -R $(ABSOLUTE_LIB_DIR) +endif + ifeq ($(OS_ARCH),OpenBSD) ifeq ($(USE_PTHREADS),1) LDOPTS += -pthread @@ -414,6 +394,12 @@ endif LDOPTS += -Xlinker -R $(ABSOLUTE_LIB_DIR) endif +ifeq ($(OS_ARCH),OpenBSD) +ifeq ($(USE_PTHREADS),1) +LDOPTS += -pthread +endif +endif + ifeq ($(OS_ARCH),BSD_OS) ifneq ($(OS_RELEASE),1.1) EXTRA_LIBS = -ldl @@ -425,7 +411,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) @@ -433,7 +419,6 @@ LIBPTHREAD = -ldce endif endif -endif # !USE_AUTOCONF ##################################################### # @@ -443,11 +428,6 @@ endif # !USE_AUTOCONF include $(topsrcdir)/config/rules.mk -ifdef USE_AUTOCONF -$(OBJDIR)/%$(PROG_SUFFIX): %.c - $(CC) $< -o $@ $(CFLAGS) $(LDOPTS) $(LIBPLC) $(LIBPR) $(OS_LIBS) - -else AIX_PRE_4_2 = 0 ifeq ($(OS_ARCH),AIX) ifeq ($(OS_RELEASE),4.1) @@ -470,7 +450,7 @@ ifeq ($(AIX_PRE_4_2),1) $(OBJDIR)/%: $(OBJDIR)/%.$(OBJ_SUFFIX) @$(MAKE_OBJDIR) rm -f $@ $(AIX_TMP) - $(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(DIST)/lib/libnspr$(MOD_VERSION).a + $(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).a $(CC) -o $@ $(AIX_TMP) $(AIX_WRAP) rm -f $(AIX_TMP) @@ -481,66 +461,46 @@ else $(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX) @$(MAKE_OBJDIR) ifeq ($(OS_ARCH), WINNT) -ifeq ($(OS_TARGET),WIN16) - echo system windows >w16link - echo name $@ >>w16link - echo option map >>w16link -# echo option CASEEXACT >>w16link - echo option stack=16K >>w16link - echo debug $(DEBUGTYPE) all >>w16link - echo file >>w16link - echo $< , >>w16link - echo $(W16STDIO) >>w16link - echo library >>w16link - echo $(LIBPR), >>w16link - echo $(LIBPLC), >>w16link - echo winsock.lib >>w16link - wlink @w16link. + link $(LDOPTS) $(EXTRA_LDOPTS) $< $(LIBPLC) $(LIBNSPR) $(EXTRA_LIBS) wsock32.lib -out:$@ else -ifeq ($(OS_TARGET),OS2) - $(LINK) $(EXEFLAGS) $(LDOPTS) $< $(LIBPLC) $(LIBPR) $(OS_LIBS) $(EXTRA_LIBS) +ifeq ($(OS_ARCH),OS2) + $(LINK) $(EXEFLAGS) $(LDOPTS) $< $(LIBPLC) $(LIBNSPR) $(OS_LIBS) $(EXTRA_LIBS) else - link $(LDOPTS) $(EXTRA_LDOPTS) $< $(LIBPLC) $(LIBPR) $(EXTRA_LIBS) wsock32.lib -out:$@ -endif -endif -else - $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPR) $(EXTRA_LIBS) -o $@ -endif - -endif - -endif # !USE_AUTOCONF + $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) $(EXTRA_LIBS) -o $@ +endif # OS/2 +endif # WINNT +endif # AIX_PRE_4_2 export:: $(TARGETS) -install:: export clean:: rm -f $(TARGETS) -ifndef USE_AUTOCONF -# The prpoll test calls BSD socket functions, so it needs to link +# The following tests call BSD socket functions, so they need to link # with -lsocket on some platforms. ifeq ($(OS_ARCH),SunOS) ifneq ($(OS_RELEASE),4.1.3_U1) +ifeq ($(USE_IPV6),1) +$(OBJDIR)/gethost: $(OBJDIR)/gethost.o + $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) -lsocket $(EXTRA_LIBS) -o $@ +endif $(OBJDIR)/prpoll: $(OBJDIR)/prpoll.o - $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPR) -lsocket $(EXTRA_LIBS) -o $@ + $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) -lsocket $(EXTRA_LIBS) -o $@ endif endif ifeq ($(USE_PTHREADS), 1) $(OBJDIR)/attach: $(OBJDIR)/attach.o - $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@ + $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@ $(OBJDIR)/foreign: $(OBJDIR)/foreign.o - $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@ + $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@ $(OBJDIR)/provider: $(OBJDIR)/provider.o - $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@ + $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@ $(OBJDIR)/socket: $(OBJDIR)/socket.o - $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@ + $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@ $(OBJDIR)/testfile: $(OBJDIR)/testfile.o - $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@ + $(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) $(LIBPTHREAD) $(EXTRA_LIBS) -o $@ endif -endif # !USE_AUTOCONF - # # Run the test programs with no arguments # @@ -552,7 +512,7 @@ PROGRAMS = $(notdir $(PROGS)) ifdef NSPR_TEST_LOGFILE LOGFILE = $(NSPR_TEST_LOGFILE) else -ifeq ($(OS_ARCH), WINNT) +ifeq (,$(filter-out WINNT OS2,$(OS_ARCH))) LOGFILE = nul else LOGFILE = /dev/null diff --git a/pr/tests/attach.c b/pr/tests/attach.c index 4b890063..980fd6d4 100644 --- a/pr/tests/attach.c +++ b/pr/tests/attach.c @@ -36,15 +36,6 @@ ** 12-June-97 Revert to return code 0 and 1. ***********************************************************************/ -#ifdef XP_BEOS -#include -int main() -{ - printf( "This test currently does not run on BeOS\n" ); - return 0; -} -#else - /*********************************************************************** ** Includes ***********************************************************************/ @@ -74,6 +65,8 @@ int main() #define INCL_ERRORS #include #include +#elif defined(XP_BEOS) +#include #endif #define DEFAULT_COUNT 1000 @@ -125,6 +118,8 @@ static void Measure(void (*func)(void), const char *msg) static unsigned __stdcall threadStartFunc(void *arg) #elif defined(IRIX) && !defined(_PR_PTHREADS) static void threadStartFunc(void *arg) +#elif defined(XP_BEOS) +static int32 threadStartFunc(void *arg) #else static void * threadStartFunc(void *arg) #endif @@ -165,6 +160,10 @@ int main(int argc, char **argv) #elif defined(OS2) int rv; TID threadID; +#elif defined(XP_BEOS) + thread_id threadID; + int32 threadRV; + status_t waitRV; #endif /* The command line argument: -d is used to determine if the test is being run @@ -328,6 +327,28 @@ int main(int argc, char **argv) goto exit_now; } +#elif defined(XP_BEOS) + + threadID = spawn_thread(threadStartFunc, NULL, B_NORMAL_PRIORITY, NULL); + if (threadID <= B_ERROR) { + fprintf(stderr, "thread creation failed: error code %08lx\n", threadID); + failed_already = 1; + goto exit_now; + } + if (resume_thread(threadID) != B_OK) { + fprintf(stderr, "failed starting thread: error code %08lx\n", threadID); + failed_already = 1; + goto exit_now; + } + + waitRV = wait_for_thread(threadID, &threadRV); + if (debug_mode) + PR_ASSERT(waitRV == B_OK); + else if (waitRV != B_OK) { + failed_already = 1; + goto exit_now; + } + #else if (!debug_mode) failed_already=1; @@ -344,5 +365,3 @@ exit_now: else return 0; } - -#endif /* XP_BEOS */ diff --git a/pr/tests/dll/.cvsignore b/pr/tests/dll/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/pr/tests/dll/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/pr/tests/dll/Makefile b/pr/tests/dll/Makefile deleted file mode 100644 index 66acab4a..00000000 --- a/pr/tests/dll/Makefile +++ /dev/null @@ -1,96 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -#! gmake - -MOD_DEPTH = ../../.. - -include $(MOD_DEPTH)/config/config.mk - -# Disable optimization of the nspr on SunOS4.1.3 -ifeq ($(OS_ARCH),SunOS) -ifeq ($(OS_RELEASE),4.1.3_U1) -OPTIMIZER = -endif -endif - -CSRCS = mygetval.c mysetval.c - -INCLUDES = -I$(DIST)/include - -OBJS = $(OBJDIR)/mygetval.$(OBJ_SUFFIX) \ - $(OBJDIR)/mysetval.$(OBJ_SUFFIX) - -ifeq ($(OS_TARGET), WIN16) -W16OBJS = $(subst $(space),$(comma)$(space),$(OBJS)) -endif - -ifeq ($(OS_ARCH), WINNT) -ifeq ($(OS_TARGET), WIN16) -# do nothing -else -DLLBASE=/BASE:0x30000000 -RES=$(OBJDIR)/my.res -RESNAME=../../../pr/src/nspr.rc -endif -endif - -ifeq (,$(filter-out WINNT OS2,$(OS_ARCH))) -IMPORT_LIBRARY = $(OBJDIR)/my.$(LIB_SUFFIX) -SHARED_LIBRARY = $(OBJDIR)/my.dll -ifeq ($(OS_ARCH), OS2) -LIBRARY = $(OBJDIR)/my_s.lib -# XXX $(LIBRARY) probably doesn't need to be added to TARGETS. -TARGETS = $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) -else -TARGETS = $(SHARED_LIBRARY) $(IMPORT_LIBRARY) -endif -else -ifdef MKSHLIB -SHARED_LIBRARY = $(OBJDIR)/libmy.$(DLL_SUFFIX) -endif -TARGETS = $(SHARED_LIBRARY) -endif - -# -# To create a loadable module on Rhapsody, we must override -# -dynamiclib with -bundle. -# -ifeq ($(OS_ARCH),Rhapsody) -DSO_LDOPTS = -bundle -endif - -include $(MOD_DEPTH)/config/rules.mk - -ifeq ($(OS_TARGET), WIN16) -# Note: The Win16 target: my.dll requires these macros -# to be overridden to build the test .dll -# default values in win16...mk are for release targets. -# -OS_DLL_OPTION = NOCASEEXACT -OS_LIB_FLAGS = -irn -endif - -ifdef SHARED_LIBRARY -export:: $(TARGETS) - $(NSINSTALL) $(TARGETS) ../$(OBJDIR)/dll - -install:: export - -clean:: - rm -rf $(TARGETS) -endif diff --git a/pr/tests/dll/Makefile.in b/pr/tests/dll/Makefile.in index 3165224f..d90c411c 100644 --- a/pr/tests/dll/Makefile.in +++ b/pr/tests/dll/Makefile.in @@ -33,7 +33,9 @@ OPTIMIZER = endif endif -INCLUDES = -I$(DIST)/include +CSRCS = mygetval.c mysetval.c + +INCLUDES = -I$(dist_includedir) OBJS = $(OBJDIR)/mygetval.$(OBJ_SUFFIX) \ $(OBJDIR)/mysetval.$(OBJ_SUFFIX) @@ -43,7 +45,7 @@ W16OBJS = $(subst $(space),$(comma)$(space),$(OBJS)) endif ifeq ($(OS_ARCH), WINNT) -ifeq (,$(filter-out WIN16 OS2,$(OS_TARGET))) +ifeq ($(OS_TARGET), WIN16) # do nothing else DLLBASE=/BASE:0x30000000 @@ -52,10 +54,10 @@ RESNAME=../../../pr/src/nspr.rc endif endif -ifeq ($(OS_ARCH), WINNT) -IMPORT_LIBRARY = $(OBJDIR)/my.lib +ifeq (,$(filter-out WINNT OS2,$(OS_ARCH))) +IMPORT_LIBRARY = $(OBJDIR)/my.$(LIB_SUFFIX) SHARED_LIBRARY = $(OBJDIR)/my.dll -ifeq ($(OS_TARGET), OS2) +ifeq ($(OS_ARCH), OS2) LIBRARY = $(OBJDIR)/my_s.lib # XXX $(LIBRARY) probably doesn't need to be added to TARGETS. TARGETS = $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) @@ -92,7 +94,6 @@ ifdef SHARED_LIBRARY export:: $(TARGETS) $(NSINSTALL) $(TARGETS) ../$(OBJDIR)/dll -install:: export clean:: rm -rf $(TARGETS) 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 -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) diff --git a/pr/tests/w16gui/.cvsignore b/pr/tests/w16gui/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/pr/tests/w16gui/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/pr/tests/w16gui/Makefile b/pr/tests/w16gui/Makefile deleted file mode 100644 index 97b38223..00000000 --- a/pr/tests/w16gui/Makefile +++ /dev/null @@ -1,75 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -#! gmake - - - -MOD_DEPTH = ../../.. - -include $(MOD_DEPTH)/config/config.mk - -W16STDIO = $(MOD_DEPTH)/pr/src/md/windows/$(OBJDIR)/w16stdio.$(OBJ_SUFFIX) - -CSRCS = poppad.c \ - popfile.c \ - popfont.c \ - popfind.c \ - popprnt0.c - - -INCLUDES = -I$(DIST)/include -LIBPR = $(DIST)/lib/nspr$(MOD_VERSION).lib -LIBPLDS = $(DIST)/lib/plds$(MOD_VERSION).lib -TARGETS = $(OBJDIR)/poppad.exe -OS_CFLAGS = $(OS_EXE_CFLAGS) - -include $(MOD_DEPTH)/config/rules.mk - - -ifeq ($(OS_TARGET),WIN16) -$(OBJDIR)/poppad.exe: $(OBJS) - @$(MAKE_OBJDIR) - echo system windows >w16link - echo name $@ >>w16link - echo option map >>w16link - echo option stack=16K >>w16link - echo debug $(DEBUGTYPE) all >>w16link - echo file >>w16link - echo $(OBJDIR)\\poppad.$(OBJ_SUFFIX), >>w16link - echo $(OBJDIR)\\popfile.$(OBJ_SUFFIX), >>w16link - echo $(OBJDIR)\\popfont.$(OBJ_SUFFIX), >>w16link - echo $(OBJDIR)\\popfind.$(OBJ_SUFFIX), >>w16link - echo $(OBJDIR)\\popprnt0.$(OBJ_SUFFIX), >>w16link - echo $(W16STDIO) >>w16link - echo library $(LIBPR) >>w16link - echo library $(LIBPLDS) >>w16link - echo library clibl, commdlg >>w16link - echo library winsock.lib >>w16link - wlink @w16link. - wrc -bt=windows poppad.rc $(OBJDIR)\\poppad.exe -else -$(OBJDIR)/poppad.exe: $(OBJS) - link $(LDOPTS) $< $(LIBPLC) $(LIBPR) wsock32.lib -out:$@ -endif - -export:: $(TARGETS) - -install:: export - -clean:: - rm -rf $(TARGETS) diff --git a/pr/tests/w16gui/Makefile.in b/pr/tests/w16gui/Makefile.in index babc0fb1..05c2e57b 100644 --- a/pr/tests/w16gui/Makefile.in +++ b/pr/tests/w16gui/Makefile.in @@ -37,9 +37,9 @@ CSRCS = poppad.c \ popprnt0.c -INCLUDES = -I$(DIST)/include -LIBPR = $(DIST)/lib/nspr$(MOD_VERSION).lib -LIBPLDS = $(DIST)/lib/plds$(MOD_VERSION).lib +INCLUDES = -I$(dist_includedir) +LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).lib +LIBPLDS = $(dist_libdir)/plds$(MOD_MAJOR_VERSION).lib TARGETS = $(OBJDIR)/poppad.exe OS_CFLAGS = $(OS_EXE_CFLAGS) @@ -74,7 +74,6 @@ endif export:: $(TARGETS) -install:: export clean:: rm -rf $(TARGETS) diff --git a/tools/.cvsignore b/tools/.cvsignore new file mode 100644 index 00000000..f3c7a7c5 --- /dev/null +++ b/tools/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/tools/Makefile b/tools/Makefile deleted file mode 100644 index 6effac67..00000000 --- a/tools/Makefile +++ /dev/null @@ -1,225 +0,0 @@ -# -# 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) 1998 Netscape Communications Corporation. All Rights -# Reserved. -# - -#! gmake - -MOD_DEPTH = .. - -include $(MOD_DEPTH)/config/config.mk - -ifeq ($(OS_TARGET), WIN16) -OS_CFLAGS = $(OS_EXE_CFLAGS) -endif - - -DIRS = - -CSRCS = \ - httpget.c \ - tail.c \ - $(NULL) - -ifeq (,$(filter-out WINNT OS2,$(OS_ARCH))) -PROG_SUFFIX = .exe -else -PROG_SUFFIX = -endif - -PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(PROG_SUFFIX))) - -TARGETS = $(PROGS) - -INCLUDES = -I$(DIST)/include - -NSPR_VERSION = 3 - -# Setting the variables LDOPTS and LIBPR. We first initialize -# them to the default values, then adjust them for some platforms. -LDOPTS = -L$(DIST)/lib -LIBPR = -lnspr$(NSPR_VERSION) -LIBPLC = -lplc$(NSPR_VERSION) - -ifeq ($(OS_ARCH), WINNT) -ifeq ($(OS_TARGET), WIN16) - LIBPR = $(DIST)/lib/nspr$(NSPR_VERSION).lib - LIBPLC= $(DIST)/lib/plc$(NSPR_VERSION).lib -else -LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO -LIBPR = $(DIST)/lib/libnspr$(NSPR_VERSION).$(LIB_SUFFIX) -LIBPLC= $(DIST)/lib/libplc$(NSPR_VERSION).$(LIB_SUFFIX) -endif -endif - -ifeq ($(OS_ARCH),OS2) - ifeq ($(MOZ_OS2_TOOLS),VACPP) - LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO - LIBPR = $(DIST)/lib/nspr$(NSPR_VERSION).lib - LIBPLC= $(DIST)/lib/plc$(NSPR_VERSION).lib - else - LDOPTS += -Zomf -Zlinker /PM:VIO - endif -endif - -ifneq ($(OS_ARCH), WINNT) -PWD = $(shell pwd) -endif - -ifeq ($(OS_ARCH), IRIX) -LDOPTS += -rpath $(PWD)/$(DIST)/lib -endif - -ifeq ($(OS_ARCH), OSF1) -LDOPTS += -rpath $(PWD)/$(DIST)/lib -lpthread -endif - -ifeq ($(OS_ARCH), HP-UX) -LDOPTS += -Wl,+s,+b,$(PWD)/$(DIST)/lib -endif - -# AIX -ifeq ($(OS_ARCH),AIX) -LDOPTS += -blibpath:$(PWD)/$(DIST)/lib:/usr/lib:/lib -LIBPR = -lnspr$(NSPR_VERSION)_shr -LIBPLC = -lplc$(NSPR_VERSION)_shr -endif - -# Solaris -ifeq ($(OS_ARCH), SunOS) -ifneq ($(OS_RELEASE), 4.1.3_U1) -ifdef NS_USE_GCC -LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(DIST)/lib -else -LDOPTS += -R $(PWD)/$(DIST)/lib -endif -endif - -# SunOS 5.4 and 5.5 need to link with -lthread or -lpthread, -# even though we already linked with these system libraries -# when we built libnspr.so. -ifeq ($(OS_RELEASE), 5.4) -EXTRA_LIBS = -lthread -endif - -ifeq ($(OS_RELEASE), 5.5) -ifdef USE_PTHREADS -EXTRA_LIBS = -lpthread -else -EXTRA_LIBS = -lthread -endif -endif -endif # SunOS - -ifeq ($(OS_ARCH), NCR) -# XXX: We see some strange problems when we link with libnspr.so. -# So for now we use static libraries on NCR. The shared library -# stuff below is commented out. -LIBPR = $(DIST)/lib/libnspr$(NSPR_VERSION).a -LIBPLC = $(DIST)/lib/libplc$(NSPR_VERSION).a -EXTRA_LIBS = -lsocket -lnsl -ldl - -# NCR needs to link against -lsocket -lnsl (and -lc, which is linked -# implicitly by $(CC)) again even though we already linked with these -# system libraries when we built libnspr.so. -#EXTRA_LIBS = -lsocket -lnsl -# This hardcodes in the executable programs the directory to find -# libnspr.so etc. at program startup. Equivalent to the -R or -rpath -# option for ld on other platforms. -#export LD_RUN_PATH = $(PWD)/$(DIST)/lib -endif - -ifeq ($(OS_ARCH), SCOOS) -# SCO Unix needs to link against -lsocket again even though we -# already linked with these system libraries when we built libnspr.so. -EXTRA_LIBS = -lsocket -# This hardcodes in the executable programs the directory to find -# libnspr.so etc. at program startup. Equivalent to the -R or -rpath -# option for ld on other platforms. -export LD_RUN_PATH = $(PWD)/$(DIST)/lib -endif - -##################################################### -# -# The rules -# -##################################################### - -include $(MOD_DEPTH)/config/rules.mk - -AIX_PRE_4_2 = 0 -ifeq ($(OS_ARCH),AIX) -ifneq ($(OS_RELEASE),4.2) -ifneq ($(USE_PTHREADS), 1) -#AIX_PRE_4_2 = 1 -endif -endif -endif - -ifeq ($(AIX_PRE_4_2),1) - -# AIX releases prior to 4.2 need a special two-step linking hack -# in order to both override the system select() and be able to -# get at the original system select(). -# -# We use a pattern rule in ns/nspr20/config/rules.mk to generate -# the .$(OBJ_SUFFIX) file from the .c source file, then do the -# two-step linking hack below. - -$(OBJDIR)/%: $(OBJDIR)/%.$(OBJ_SUFFIX) - @$(MAKE_OBJDIR) - rm -f $@ $(AIX_TMP) - $(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(DIST)/lib/libnspr$(NSPR_VERSION).a - $(CC) -o $@ $(AIX_TMP) $(AIX_WRAP) - rm -f $(AIX_TMP) - -else - -# All platforms that are not AIX pre-4.2. - -$(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX) - @$(MAKE_OBJDIR) -ifeq ($(OS_ARCH), WINNT) -ifeq ($(OS_TARGET),WIN16) - echo system windows >w16link - echo option map >>w16link - echo option stack=10K >>w16link - echo option heapsize=32K >>w16link - echo debug $(DEBUGTYPE) all >>w16link - echo name $@ >>w16link - echo file >>w16link - echo $< >>w16link - echo library >>w16link - echo $(LIBPR), >>w16link - echo $(LIBPLC), >>w16link - echo winsock.lib >>w16link - wlink @w16link. -else - link $(LDOPTS) $< $(LIBPR) $(LIBPLC) wsock32.lib -out:$@ -endif -else -ifeq ($(OS_ARCH),OS2) - $(LINK) $(LDOPTS) $< $(LIBPR) $(LIBPLC) $(OS_LIBS) $(EXTRA_LIBS) -o $@ -else - $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPR) $(LIBPLC) $(EXTRA_LIBS) -o $@ -endif -endif -endif - -export:: $(TARGETS) -install:: export -clean:: - rm -f $(TARGETS) - diff --git a/tools/Makefile.in b/tools/Makefile.in index bff44750..0b872d7a 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -38,7 +38,7 @@ CSRCS = \ tail.c \ $(NULL) -ifeq ($(OS_ARCH), WINNT) +ifeq (,$(filter-out WINNT OS2,$(OS_ARCH))) PROG_SUFFIX = .exe else PROG_SUFFIX = @@ -48,25 +48,35 @@ PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(PROG_SUFFIX))) TARGETS = $(PROGS) -INCLUDES = -I$(DIST)/include +INCLUDES = -I$(dist_includedir) NSPR_VERSION = 3 # Setting the variables LDOPTS and LIBPR. We first initialize # them to the default values, then adjust them for some platforms. -LDOPTS = -L$(DIST)/lib +LDOPTS = -L$(dist_libdir) LIBPR = -lnspr$(NSPR_VERSION) LIBPLC = -lplc$(NSPR_VERSION) ifeq ($(OS_ARCH), WINNT) ifeq ($(OS_TARGET), WIN16) - LIBPR = $(DIST)/lib/nspr$(NSPR_VERSION).lib - LIBPLC= $(DIST)/lib/plc$(NSPR_VERSION).lib + LIBPR = $(dist_libdir)/nspr$(NSPR_VERSION).lib + LIBPLC= $(dist_libdir)/plc$(NSPR_VERSION).lib else LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO -LIBPR = $(DIST)/lib/libnspr$(NSPR_VERSION).$(LIB_SUFFIX) -LIBPLC= $(DIST)/lib/libplc$(NSPR_VERSION).$(LIB_SUFFIX) +LIBPR = $(dist_libdir)/libnspr$(NSPR_VERSION).$(LIB_SUFFIX) +LIBPLC= $(dist_libdir)/libplc$(NSPR_VERSION).$(LIB_SUFFIX) +endif endif + +ifeq ($(OS_ARCH),OS2) + ifeq ($(MOZ_OS2_TOOLS),VACPP) + LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO + LIBPR = $(dist_libdir)/nspr$(NSPR_VERSION).lib + LIBPLC= $(dist_libdir)/plc$(NSPR_VERSION).lib + else + LDOPTS += -Zomf -Zlinker /PM:VIO + endif endif ifneq ($(OS_ARCH), WINNT) @@ -74,20 +84,20 @@ PWD = $(shell pwd) endif ifeq ($(OS_ARCH), IRIX) -LDOPTS += -rpath $(PWD)/$(DIST)/lib +LDOPTS += -rpath $(PWD)/$(dist_libdir) endif ifeq ($(OS_ARCH), OSF1) -LDOPTS += -rpath $(PWD)/$(DIST)/lib -lpthread +LDOPTS += -rpath $(PWD)/$(dist_libdir) -lpthread endif ifeq ($(OS_ARCH), HP-UX) -LDOPTS += -Wl,+s,+b,$(PWD)/$(DIST)/lib +LDOPTS += -Wl,+s,+b,$(PWD)/$(dist_libdir) endif # AIX ifeq ($(OS_ARCH),AIX) -LDOPTS += -blibpath:$(PWD)/$(DIST)/lib:/usr/lib:/lib +LDOPTS += -blibpath:$(PWD)/$(dist_libdir):/usr/lib:/lib LIBPR = -lnspr$(NSPR_VERSION)_shr LIBPLC = -lplc$(NSPR_VERSION)_shr endif @@ -96,9 +106,9 @@ endif ifeq ($(OS_ARCH), SunOS) ifneq ($(OS_RELEASE), 4.1.3_U1) ifdef NS_USE_GCC -LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(DIST)/lib +LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(dist_libdir) else -LDOPTS += -R $(PWD)/$(DIST)/lib +LDOPTS += -R $(PWD)/$(dist_libdir) endif endif @@ -122,8 +132,8 @@ ifeq ($(OS_ARCH), NCR) # XXX: We see some strange problems when we link with libnspr.so. # So for now we use static libraries on NCR. The shared library # stuff below is commented out. -LIBPR = $(DIST)/lib/libnspr$(NSPR_VERSION).a -LIBPLC = $(DIST)/lib/libplc$(NSPR_VERSION).a +LIBPR = $(dist_libdir)/libnspr$(NSPR_VERSION).a +LIBPLC = $(dist_libdir)/libplc$(NSPR_VERSION).a EXTRA_LIBS = -lsocket -lnsl -ldl # NCR needs to link against -lsocket -lnsl (and -lc, which is linked @@ -133,7 +143,7 @@ EXTRA_LIBS = -lsocket -lnsl -ldl # This hardcodes in the executable programs the directory to find # libnspr.so etc. at program startup. Equivalent to the -R or -rpath # option for ld on other platforms. -#export LD_RUN_PATH = $(PWD)/$(DIST)/lib +#export LD_RUN_PATH = $(PWD)/$(dist_libdir) endif ifeq ($(OS_ARCH), SCOOS) @@ -143,7 +153,7 @@ EXTRA_LIBS = -lsocket # This hardcodes in the executable programs the directory to find # libnspr.so etc. at program startup. Equivalent to the -R or -rpath # option for ld on other platforms. -export LD_RUN_PATH = $(PWD)/$(DIST)/lib +export LD_RUN_PATH = $(PWD)/$(dist_libdir) endif ##################################################### @@ -176,7 +186,7 @@ ifeq ($(AIX_PRE_4_2),1) $(OBJDIR)/%: $(OBJDIR)/%.$(OBJ_SUFFIX) @$(MAKE_OBJDIR) rm -f $@ $(AIX_TMP) - $(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(DIST)/lib/libnspr$(NSPR_VERSION).a + $(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(dist_libdir)/libnspr$(NSPR_VERSION).a $(CC) -o $@ $(AIX_TMP) $(AIX_WRAP) rm -f $(AIX_TMP) @@ -204,14 +214,16 @@ ifeq ($(OS_TARGET),WIN16) else link $(LDOPTS) $< $(LIBPR) $(LIBPLC) wsock32.lib -out:$@ endif +else +ifeq ($(OS_ARCH),OS2) + $(LINK) $(LDOPTS) $< $(LIBPR) $(LIBPLC) $(OS_LIBS) $(EXTRA_LIBS) -o $@ else $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPR) $(LIBPLC) $(EXTRA_LIBS) -o $@ endif - +endif endif export:: $(TARGETS) -install:: export clean:: rm -f $(TARGETS) -- cgit v1.2.1