diff --git a/www-client/mozilla-firefox/patches/2009-09-27/bezilla.step-by-step.txt b/www-client/mozilla-firefox/patches/2009-09-27/bezilla.step-by-step.txt
new file mode 100644
index 000000000..329eb07b1
--- /dev/null
+++ b/www-client/mozilla-firefox/patches/2009-09-27/bezilla.step-by-step.txt
@@ -0,0 +1,18 @@
+Note: use --dry-run, as some patches may need -p1 and others may not apply cleanly.
+
+r01-config-star.patch # patches config.guess, config.sub
+r02-configure-in-withGCC4andCrossCompile.patch # same as above, plus additions from `svn diff -r 7:8`
+r03a-makefile-in.patch # Adds "Haiku" to the OS_ARCH tests.
+r03b-starmk.patch # More adding "Haiku" to the OS_ARCH tests.
+r04a-rdef-support-in-Makefile.patch # Adds rdef support to Makefiles.
+r04b-just-rdefs-no-Makefile.patch # various *.rdef
+r05-fix-shlibsign.README # Discussion that led to the patch.
+r05-fix-shlibsign.patch # hack/fix for someone defines true/false to 1/0
+r06-nss-gcc4.patch # possible gcc4 and header fixes for nss/
+r07-working-nspr-from-haikuports.patch # applying this instead of 89-unmodified.patch will allow proper compilation, at the cost of losing your newest nspr work.
+r08-misc.patch # numerous patches. not sure which patches are dependant on each other.
+ # Fonts, AppRunner, AppShell, DragService, nsToolKit, plevent, maybe more.
+r09-sunbird-options-fix.patch # small fix for Sunbird's option window
+r11-bookmarks-v2.patch # changes the default startup page, bookmarks, allows UserGuide and Welcome to be fetched locally or from svn
+r10-grey-menu-color.patch # switches the blue menu highlight selection color for grey.
+r12-releasenotes.patch # removes the 2nd first-run tab, changes release notes to about:buildconfig
diff --git a/www-client/mozilla-firefox/patches/2009-09-27/r01-config-star.patch b/www-client/mozilla-firefox/patches/2009-09-27/r01-config-star.patch
new file mode 100644
index 000000000..4a08a242c
--- /dev/null
+++ b/www-client/mozilla-firefox/patches/2009-09-27/r01-config-star.patch
@@ -0,0 +1,5296 @@
+Index: build/autoconf/config.guess
+===================================================================
+--- build/autoconf/config.guess (revision 15)
++++ build/autoconf/config.guess (working copy)
+@@ -1,9 +1,10 @@
+ #! /bin/sh
+ # Attempt to guess a canonical system name.
+ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+-# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
++# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
++# Free Software Foundation, Inc.
+
+-timestamp='2003-02-22'
++timestamp='2009-04-27'
+
+ # 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
+@@ -17,13 +18,15 @@
+ #
+ # You should have received a copy of the GNU General Public License
+ # along with this program; if not, write to the Free Software
+-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
++# 02110-1301, USA.
+ #
+ # As a special exception to the GNU General Public License, if you
+ # distribute this file as part of a program that contains a
+ # configuration script generated by Autoconf, you may include it under
+ # the same distribution terms that you use for the rest of that program.
+
++
+ # Originally written by Per Bothner .
+ # Please send patches to . Submit a context
+ # diff and a properly formatted ChangeLog entry.
+@@ -53,8 +56,8 @@
+ GNU config.guess ($timestamp)
+
+ Originally written by Per Bothner.
+-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+-Free Software Foundation, Inc.
++Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
++2002, 2003, 2004, 2005, 2006, 2007, 2008 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."
+@@ -66,11 +69,11 @@
+ while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+- echo "$timestamp" ; exit 0 ;;
++ echo "$timestamp" ; exit ;;
+ --version | -v )
+- echo "$version" ; exit 0 ;;
++ echo "$version" ; exit ;;
+ --help | --h* | -h )
+- echo "$usage"; exit 0 ;;
++ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+@@ -104,8 +107,9 @@
+ trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+ trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+ : ${TMPDIR=/tmp} ;
+- { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
++ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
++ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+ dummy=$tmp/dummy ;
+ tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+@@ -122,7 +126,7 @@
+ ;;
+ ,,*) CC_FOR_BUILD=$CC ;;
+ ,*,*) CC_FOR_BUILD=$HOST_CC ;;
+-esac ;'
++esac ; set_cc_for_build= ;'
+
+ # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+ # (ghazi@noc.rutgers.edu 1994-08-24)
+@@ -157,6 +161,7 @@
+ arm*) machine=arm-unknown ;;
+ sh3el) machine=shl-unknown ;;
+ sh3eb) machine=sh-unknown ;;
++ sh5el) machine=sh5le-unknown ;;
+ *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+ esac
+ # The Operating System including object format, if it has switched
+@@ -195,50 +200,32 @@
+ # contains redundant information, the shorter form:
+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ echo "${machine}-${os}${release}"
+- exit 0 ;;
+- amiga:OpenBSD:*:*)
+- echo m68k-unknown-openbsd${UNAME_RELEASE}
+- exit 0 ;;
+- arc:OpenBSD:*:*)
+- echo mipsel-unknown-openbsd${UNAME_RELEASE}
+- exit 0 ;;
+- hp300:OpenBSD:*:*)
+- echo m68k-unknown-openbsd${UNAME_RELEASE}
+- exit 0 ;;
+- mac68k:OpenBSD:*:*)
+- echo m68k-unknown-openbsd${UNAME_RELEASE}
+- exit 0 ;;
+- macppc:OpenBSD:*:*)
+- echo powerpc-unknown-openbsd${UNAME_RELEASE}
+- exit 0 ;;
+- mvme68k:OpenBSD:*:*)
+- echo m68k-unknown-openbsd${UNAME_RELEASE}
+- exit 0 ;;
+- mvme88k:OpenBSD:*:*)
+- echo m88k-unknown-openbsd${UNAME_RELEASE}
+- exit 0 ;;
+- mvmeppc:OpenBSD:*:*)
+- echo powerpc-unknown-openbsd${UNAME_RELEASE}
+- exit 0 ;;
+- pmax:OpenBSD:*:*)
+- echo mipsel-unknown-openbsd${UNAME_RELEASE}
+- exit 0 ;;
+- sgi:OpenBSD:*:*)
+- echo mipseb-unknown-openbsd${UNAME_RELEASE}
+- exit 0 ;;
+- sun3:OpenBSD:*:*)
+- echo m68k-unknown-openbsd${UNAME_RELEASE}
+- exit 0 ;;
+- wgrisc:OpenBSD:*:*)
+- echo mipsel-unknown-openbsd${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ *:OpenBSD:*:*)
+- echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
+- exit 0 ;;
++ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
++ echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
++ exit ;;
++ *:ekkoBSD:*:*)
++ echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
++ exit ;;
++ *:SolidBSD:*:*)
++ echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
++ exit ;;
++ macppc:MirBSD:*:*)
++ echo powerpc-unknown-mirbsd${UNAME_RELEASE}
++ exit ;;
++ *:MirBSD:*:*)
++ echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
++ exit ;;
+ alpha:OSF1:*:*)
+- if test $UNAME_RELEASE = "V4.0"; then
++ case $UNAME_RELEASE in
++ *4.0)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+- fi
++ ;;
++ *5.*)
++ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
++ ;;
++ esac
+ # According to Compaq, /usr/sbin/psrinfo has been available on
+ # OSF/1 and Tru64 systems produced since 1995. I hope that
+ # covers most systems running today. This code pipes the CPU
+@@ -276,39 +263,49 @@
+ "EV7.9 (21364A)")
+ UNAME_MACHINE="alphaev79" ;;
+ esac
++ # A Pn.n version is a patched version.
+ # A Vn.n version is a released version.
+ # 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.
+- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+- exit 0 ;;
++ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
++ exit ;;
+ 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 ;;
++ exit ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+- exit 0 ;;
++ exit ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-unknown-sysv4
+- exit 0;;
++ exit ;;
+ *:[Aa]miga[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-amigaos
+- exit 0 ;;
++ exit ;;
+ *:[Mm]orph[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-morphos
+- exit 0 ;;
++ exit ;;
+ *:OS/390:*:*)
+ echo i370-ibm-openedition
+- exit 0 ;;
++ exit ;;
++ *:z/VM:*:*)
++ echo s390-ibm-zvmoe
++ exit ;;
++ *:OS400:*:*)
++ echo powerpc-ibm-os400
++ exit ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+- exit 0;;
++ exit ;;
++ arm:riscos:*:*|arm:RISCOS:*:*)
++ echo arm-unknown-riscos
++ exit ;;
+ SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+ echo hppa1.1-hitachi-hiuxmpp
+- exit 0;;
++ exit ;;
+ 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
+@@ -316,29 +313,48 @@
+ else
+ echo pyramid-pyramid-bsd
+ fi
+- exit 0 ;;
++ exit ;;
+ NILE*:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+- exit 0 ;;
+- DRS?6000:UNIX_SV:4.2*:7*)
++ exit ;;
++ DRS?6000:unix:4.0:6*)
++ echo sparc-icl-nx6
++ exit ;;
++ DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+ case `/usr/bin/uname -p` in
+- sparc) echo sparc-icl-nx7 && exit 0 ;;
++ sparc) echo sparc-icl-nx7; exit ;;
+ esac ;;
++ s390x:SunOS:*:*)
++ echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
++ exit ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+- exit 0 ;;
++ exit ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+- exit 0 ;;
+- i86pc:SunOS:5.*:*)
+- echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+- exit 0 ;;
++ exit ;;
++ i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
++ eval $set_cc_for_build
++ SUN_ARCH="i386"
++ # If there is a compiler, see if it is configured for 64-bit objects.
++ # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
++ # This test works for both compilers.
++ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
++ if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
++ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
++ grep IS_64BIT_ARCH >/dev/null
++ then
++ SUN_ARCH="x86_64"
++ fi
++ fi
++ echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
++ exit ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+- exit 0 ;;
++ exit ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+@@ -347,10 +363,10 @@
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+- exit 0 ;;
++ exit ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+@@ -362,10 +378,10 @@
+ echo sparc-sun-sunos${UNAME_RELEASE}
+ ;;
+ esac
+- exit 0 ;;
++ exit ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ # 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
+@@ -376,37 +392,40 @@
+ # be no problem.
+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+ echo m68k-milan-mint${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+ echo m68k-hades-mint${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+ echo m68k-unknown-mint${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
++ m68k:machten:*:*)
++ echo m68k-apple-machten${UNAME_RELEASE}
++ exit ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+- exit 0 ;;
++ exit ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ 2020:CLIX:*:* | 2430:CLIX:*:*)
+ echo clipper-intergraph-clix${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+@@ -430,32 +449,33 @@
+ exit (-1);
+ }
+ EOF
+- $CC_FOR_BUILD -o $dummy $dummy.c \
+- && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+- && exit 0
++ $CC_FOR_BUILD -o $dummy $dummy.c &&
++ dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
++ SYSTEM_NAME=`$dummy $dummyarg` &&
++ { echo "$SYSTEM_NAME"; exit; }
+ echo mips-mips-riscos${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ Motorola:PowerMAX_OS:*:*)
+ echo powerpc-motorola-powermax
+- exit 0 ;;
++ exit ;;
+ Motorola:*:4.3:PL8-*)
+ echo powerpc-harris-powermax
+- exit 0 ;;
++ exit ;;
+ Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+ echo powerpc-harris-powermax
+- exit 0 ;;
++ exit ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+- exit 0 ;;
++ exit ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+- exit 0 ;;
++ exit ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+- exit 0 ;;
++ exit ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+- exit 0 ;;
++ exit ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+@@ -471,29 +491,29 @@
+ else
+ echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+- exit 0 ;;
++ exit ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+- exit 0 ;;
++ exit ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+- exit 0 ;;
++ exit ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+- exit 0 ;;
++ exit ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+- exit 0 ;;
++ exit ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+- exit 0 ;;
++ exit ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+- echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+- exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
++ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
++ exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i*86:AIX:*:*)
+ echo i386-ibm-aix
+- exit 0 ;;
++ exit ;;
+ ia64:AIX:*:*)
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+@@ -501,7 +521,7 @@
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+- exit 0 ;;
++ exit ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ eval $set_cc_for_build
+@@ -516,15 +536,19 @@
+ exit(0);
+ }
+ EOF
+- $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
+- echo rs6000-ibm-aix3.2.5
++ if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
++ then
++ echo "$SYSTEM_NAME"
++ else
++ echo rs6000-ibm-aix3.2.5
++ fi
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+- exit 0 ;;
+- *:AIX:*:[45])
++ exit ;;
++ *:AIX:*:[456])
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+@@ -537,28 +561,28 @@
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+- exit 0 ;;
++ exit ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+- exit 0 ;;
++ exit ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+- exit 0 ;;
++ exit ;;
+ 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
++ exit ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+- exit 0 ;;
++ exit ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+- exit 0 ;;
++ exit ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+- exit 0 ;;
++ exit ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+- exit 0 ;;
++ exit ;;
+ 9000/[34678]??:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ case "${UNAME_MACHINE}" in
+@@ -620,9 +644,19 @@
+ esac
+ if [ ${HP_ARCH} = "hppa2.0w" ]
+ then
+- # avoid double evaluation of $set_cc_for_build
+- test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
+- if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
++ eval $set_cc_for_build
++
++ # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
++ # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
++ # generating 64-bit code. GNU and HP use different nomenclature:
++ #
++ # $ CC_FOR_BUILD=cc ./config.guess
++ # => hppa2.0w-hp-hpux11.23
++ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
++ # => hppa64-hp-hpux11.23
++
++ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
++ grep __LP64__ >/dev/null
+ then
+ HP_ARCH="hppa2.0w"
+ else
+@@ -630,11 +664,11 @@
+ fi
+ fi
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+- exit 0 ;;
++ exit ;;
+ ia64:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ia64-hp-hpux${HPUX_REV}
+- exit 0 ;;
++ exit ;;
+ 3050*:HI-UX:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+@@ -662,153 +696,192 @@
+ exit (0);
+ }
+ EOF
+- $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
++ $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
++ { echo "$SYSTEM_NAME"; exit; }
+ echo unknown-hitachi-hiuxwe2
+- exit 0 ;;
++ exit ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ echo hppa1.1-hp-bsd
+- exit 0 ;;
++ exit ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+- exit 0 ;;
++ exit ;;
+ *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+ echo hppa1.0-hp-mpeix
+- exit 0 ;;
++ exit ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+- exit 0 ;;
++ exit ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+- exit 0 ;;
++ exit ;;
+ i*86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-unknown-osf1mk
+ else
+ echo ${UNAME_MACHINE}-unknown-osf1
+ fi
+- exit 0 ;;
++ exit ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+- exit 0 ;;
++ exit ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+- exit 0 ;;
++ exit ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+- exit 0 ;;
++ exit ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+- exit 0 ;;
++ exit ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+- exit 0 ;;
++ exit ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+- exit 0 ;;
++ exit ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+- exit 0 ;;
++ exit ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+ -e 's/\.[^.]*$/.X/'
+- exit 0 ;;
++ exit ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+- exit 0 ;;
++ exit ;;
+ CRAY*T3E:*:*:*)
+ echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+- exit 0 ;;
++ exit ;;
+ CRAY*SV1:*:*:*)
+ echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+- exit 0 ;;
++ exit ;;
+ *:UNICOS/mp:*:*)
+- echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+- exit 0 ;;
++ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
++ exit ;;
+ 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 "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+- exit 0 ;;
++ exit ;;
++ 5000:UNIX_System_V:4.*:*)
++ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
++ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
++ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
++ exit ;;
+ i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ sparc*:BSD/OS:*:*)
+ echo sparc-unknown-bsdi${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ *:FreeBSD:*:*)
+- # Determine whether the default compiler uses glibc.
+- eval $set_cc_for_build
+- sed 's/^ //' << EOF >$dummy.c
+- #include
+- #if __GLIBC__ >= 2
+- LIBC=gnu
+- #else
+- LIBC=
+- #endif
+-EOF
+- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
+- exit 0 ;;
++ case ${UNAME_MACHINE} in
++ pc98)
++ echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
++ amd64)
++ echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
++ *)
++ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
++ esac
++ exit ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin
+- exit 0 ;;
+- i*:MINGW*:*)
++ exit ;;
++ *: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
++ exit ;;
++ i*:windows32*:*)
++ # uname -m includes "-pc" on this system.
++ echo ${UNAME_MACHINE}-mingw32
++ exit ;;
+ i*:PW*:*)
+ echo ${UNAME_MACHINE}-pc-pw32
+- exit 0 ;;
+- x86:Interix*:3*)
+- echo i586-pc-interix3
+- exit 0 ;;
++ exit ;;
++ *:Interix*:[3456]*)
++ case ${UNAME_MACHINE} in
++ x86)
++ echo i586-pc-interix${UNAME_RELEASE}
++ exit ;;
++ EM64T | authenticamd | genuineintel)
++ echo x86_64-unknown-interix${UNAME_RELEASE}
++ exit ;;
++ IA64)
++ echo ia64-unknown-interix${UNAME_RELEASE}
++ exit ;;
++ esac ;;
+ [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+ echo i${UNAME_MACHINE}-pc-mks
+- exit 0 ;;
++ exit ;;
+ 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 i586-pc-interix
+- exit 0 ;;
++ exit ;;
+ i*:UWIN*:*)
+ echo ${UNAME_MACHINE}-pc-uwin
+- exit 0 ;;
++ exit ;;
++ amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
++ echo x86_64-unknown-cygwin
++ exit ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin
+- exit 0 ;;
++ exit ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+- exit 0 ;;
++ exit ;;
+ *:GNU:*:*)
++ # the GNU system
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+- exit 0 ;;
++ exit ;;
++ *:GNU/*:*:*)
++ # other systems with GNU libc and userland
++ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
++ exit ;;
+ i*86:Minix:*:*)
+ echo ${UNAME_MACHINE}-pc-minix
+- exit 0 ;;
++ exit ;;
+ arm*:Linux:*:*)
++ eval $set_cc_for_build
++ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
++ | grep -q __ARM_EABI__
++ then
++ echo ${UNAME_MACHINE}-unknown-linux-gnu
++ else
++ echo ${UNAME_MACHINE}-unknown-linux-gnueabi
++ fi
++ exit ;;
++ avr32*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+- exit 0 ;;
++ exit ;;
++ cris:Linux:*:*)
++ echo cris-axis-linux-gnu
++ exit ;;
++ crisv32:Linux:*:*)
++ echo crisv32-axis-linux-gnu
++ exit ;;
++ frv:Linux:*:*)
++ echo frv-unknown-linux-gnu
++ exit ;;
+ ia64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+- exit 0 ;;
++ exit ;;
++ m32r*:Linux:*:*)
++ echo ${UNAME_MACHINE}-unknown-linux-gnu
++ exit ;;
+ m68*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+- exit 0 ;;
++ exit ;;
+ mips:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+@@ -825,8 +898,12 @@
+ #endif
+ #endif
+ EOF
+- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+- test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
++ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
++ /^CPU/{
++ s: ::g
++ p
++ }'`"
++ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ ;;
+ mips64:Linux:*:*)
+ eval $set_cc_for_build
+@@ -844,15 +921,22 @@
+ #endif
+ #endif
+ EOF
+- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+- test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
++ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
++ /^CPU/{
++ s: ::g
++ p
++ }'`"
++ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ ;;
++ or32:Linux:*:*)
++ echo or32-unknown-linux-gnu
++ exit ;;
+ ppc:Linux:*:*)
+ echo powerpc-unknown-linux-gnu
+- exit 0 ;;
++ exit ;;
+ ppc64:Linux:*:*)
+ echo powerpc64-unknown-linux-gnu
+- exit 0 ;;
++ exit ;;
+ alpha:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+@@ -866,7 +950,10 @@
+ objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+- exit 0 ;;
++ exit ;;
++ padre:Linux:*:*)
++ echo sparc-unknown-linux-gnu
++ exit ;;
+ parisc:Linux:*:* | hppa:Linux:*:*)
+ # Look for CPU level
+ case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+@@ -874,22 +961,31 @@
+ PA8*) echo hppa2.0-unknown-linux-gnu ;;
+ *) echo hppa-unknown-linux-gnu ;;
+ esac
+- exit 0 ;;
++ exit ;;
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ echo hppa64-unknown-linux-gnu
+- exit 0 ;;
++ exit ;;
+ s390:Linux:*:* | s390x:Linux:*:*)
+ echo ${UNAME_MACHINE}-ibm-linux
+- exit 0 ;;
++ exit ;;
++ sh64*:Linux:*:*)
++ echo ${UNAME_MACHINE}-unknown-linux-gnu
++ exit ;;
+ sh*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+- exit 0 ;;
++ exit ;;
+ sparc:Linux:*:* | sparc64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+- exit 0 ;;
++ exit ;;
++ vax:Linux:*:*)
++ echo ${UNAME_MACHINE}-dec-linux-gnu
++ exit ;;
+ x86_64:Linux:*:*)
+ echo x86_64-unknown-linux-gnu
+- exit 0 ;;
++ exit ;;
++ xtensa*:Linux:*:*)
++ echo ${UNAME_MACHINE}-unknown-linux-gnu
++ exit ;;
+ 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
+@@ -907,15 +1003,12 @@
+ ;;
+ a.out-i386-linux)
+ echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+- exit 0 ;;
+- coff-i386)
+- echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+- exit 0 ;;
++ exit ;;
+ "")
+ # Either a pre-BFD a.out linker (linux-gnuoldld) or
+ # one that does not give us useful --help.
+ echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+- exit 0 ;;
++ exit ;;
+ esac
+ # Determine whether the default compiler is a.out or elf
+ eval $set_cc_for_build
+@@ -932,23 +1025,33 @@
+ LIBC=gnulibc1
+ # endif
+ #else
+- #ifdef __INTEL_COMPILER
++ #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+ LIBC=gnu
+ #else
+ LIBC=gnuaout
+ #endif
+ #endif
++ #ifdef __dietlibc__
++ LIBC=dietlibc
++ #endif
+ EOF
+- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+- test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
+- test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
++ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
++ /^LIBC/{
++ s: ::g
++ p
++ }'`"
++ test x"${LIBC}" != x && {
++ echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
++ exit
++ }
++ test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
+ ;;
+ i*86:DYNIX/ptx:4*:*)
+ # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+ # earlier versions are messed up and put the nodename in both
+ # sysname and nodename.
+ echo i386-sequent-sysv4
+- exit 0 ;;
++ exit ;;
+ i*86:UNIX_SV:4.2MP:2.*)
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+@@ -956,24 +1059,27 @@
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+- exit 0 ;;
++ exit ;;
+ i*86:OS/2:*:*)
+ # If we were able to find `uname', then EMX Unix compatibility
+ # is probably installed.
+ echo ${UNAME_MACHINE}-pc-os2-emx
+- exit 0 ;;
++ exit ;;
+ i*86:XTS-300:*:STOP)
+ echo ${UNAME_MACHINE}-unknown-stop
+- exit 0 ;;
++ exit ;;
+ i*86:atheos:*:*)
+ echo ${UNAME_MACHINE}-unknown-atheos
+- exit 0 ;;
++ exit ;;
++ i*86:syllable:*:*)
++ echo ${UNAME_MACHINE}-pc-syllable
++ exit ;;
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ i*86:*DOS:*:*)
+ echo ${UNAME_MACHINE}-pc-msdosdjgpp
+- exit 0 ;;
++ exit ;;
+ 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
+@@ -981,15 +1087,16 @@
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+ fi
+- exit 0 ;;
+- i*86:*:5:[78]*)
++ exit ;;
++ i*86:*:5:[678]*)
++ # UnixWare 7.x, OpenUNIX and OpenServer 6.
+ case `/bin/uname -X | grep "^Machine"` in
+ *486*) UNAME_MACHINE=i486 ;;
+ *Pentium) UNAME_MACHINE=i586 ;;
+ *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+ esac
+ echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+- exit 0 ;;
++ exit ;;
+ i*86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' /dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+- exit 0 ;;
++ exit ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+- exit 0 ;;
++ exit ;;
+ mc68k:UNIX:SYSTEM5:3.51m)
+ echo m68k-convergent-sysv
+- exit 0 ;;
++ exit ;;
+ M680?0:D-NIX:5.3:*)
+ echo m68k-diab-dnix
+- exit 0 ;;
+- M68*:*:R3V[567]*:*)
+- test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+- 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0)
++ exit ;;
++ M68*:*:R3V[5678]*:*)
++ test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
++ 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+- && echo i486-ncr-sysv4.3${OS_REL} && exit 0
++ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+- && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
++ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+- && echo i486-ncr-sysv4 && exit 0 ;;
++ && { echo i486-ncr-sysv4; exit; } ;;
++ NCR*:*:4.2:* | MPRAS*:*:4.2:*)
++ OS_REL='.3'
++ test -r /etc/.relid \
++ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
++ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
++ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
++ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
++ && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
++ /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
++ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+- exit 0 ;;
++ exit ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ rs6000:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+ echo powerpc-unknown-lynxos${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ RM*:ReliantUNIX-*:*:*)
+ echo mips-sni-sysv4
+- exit 0 ;;
++ exit ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+- exit 0 ;;
++ exit ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+@@ -1081,78 +1201,84 @@
+ else
+ echo ns32k-sni-sysv
+ fi
+- exit 0 ;;
++ exit ;;
+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # 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
++ exit ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes .
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+- exit 0 ;;
++ exit ;;
+ *:*:*:FTX*)
+ # From seanf@swdc.stratus.com.
+ echo i860-stratus-sysv4
+- exit 0 ;;
++ exit ;;
++ i*86:VOS:*:*)
++ # From Paul.Green@stratus.com.
++ echo ${UNAME_MACHINE}-stratus-vos
++ exit ;;
+ *:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo hppa1.1-stratus-vos
+- exit 0 ;;
++ exit ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ news*:NEWS-OS:6*:*)
+ echo mips-sony-newsos6
+- exit 0 ;;
++ exit ;;
+ 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 ;;
++ exit ;;
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-be-beos
+- exit 0 ;;
++ exit ;;
+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
+ echo powerpc-apple-beos
+- exit 0 ;;
++ exit ;;
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ echo i586-pc-beos
+- exit 0 ;;
++ exit ;;
++ BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
++ echo i586-pc-haiku
++ exit ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ SX-5:SUPER-UX:*:*)
+ echo sx5-nec-superux${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ SX-6:SUPER-UX:*:*)
+ echo sx6-nec-superux${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
++ SX-7:SUPER-UX:*:*)
++ echo sx7-nec-superux${UNAME_RELEASE}
++ exit ;;
++ SX-8:SUPER-UX:*:*)
++ echo sx8-nec-superux${UNAME_RELEASE}
++ exit ;;
++ SX-8R:SUPER-UX:*:*)
++ echo sx8r-nec-superux${UNAME_RELEASE}
++ exit ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ *:Rhapsody:*:*)
+ echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ *:Darwin:*:*)
+- case `uname -p` in
+- *86) UNAME_PROCESSOR=i686 ;;
+- powerpc) UNAME_PROCESSOR=powerpc ;;
++ UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
++ case $UNAME_PROCESSOR in
++ unknown) UNAME_PROCESSOR=powerpc ;;
+ esac
+ echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ *:procnto*:*:* | *:QNX:[0123456789]*:*)
+ UNAME_PROCESSOR=`uname -p`
+ if test "$UNAME_PROCESSOR" = "x86"; then
+@@ -1160,22 +1286,25 @@
+ UNAME_MACHINE=pc
+ fi
+ echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ *:QNX:*:4*)
+ echo i386-pc-qnx
+- exit 0 ;;
+- NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*)
++ exit ;;
++ NSE-?:NONSTOP_KERNEL:*:*)
++ echo nse-tandem-nsk${UNAME_RELEASE}
++ exit ;;
++ NSR-?:NONSTOP_KERNEL:*:*)
+ echo nsr-tandem-nsk${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ *:NonStop-UX:*:*)
+ echo mips-compaq-nonstopux
+- exit 0 ;;
++ exit ;;
+ BS2000:POSIX*:*:*)
+ echo bs2000-siemens-sysv
+- exit 0 ;;
++ exit ;;
+ DS/*:UNIX_System_V:*:*)
+ echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ *:Plan9:*:*)
+ # "uname -m" is not consistent, so use $cputype instead. 386
+ # is converted to i386 for consistency with other x86
+@@ -1186,25 +1315,50 @@
+ UNAME_MACHINE="$cputype"
+ fi
+ echo ${UNAME_MACHINE}-unknown-plan9
+- exit 0 ;;
++ exit ;;
+ *:TOPS-10:*:*)
+ echo pdp10-unknown-tops10
+- exit 0 ;;
++ exit ;;
+ *:TENEX:*:*)
+ echo pdp10-unknown-tenex
+- exit 0 ;;
++ exit ;;
+ KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+ echo pdp10-dec-tops20
+- exit 0 ;;
++ exit ;;
+ XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+ echo pdp10-xkl-tops20
+- exit 0 ;;
++ exit ;;
+ *:TOPS-20:*:*)
+ echo pdp10-unknown-tops20
+- exit 0 ;;
++ exit ;;
+ *:ITS:*:*)
+ echo pdp10-unknown-its
+- exit 0 ;;
++ exit ;;
++ SEI:*:*:SEIUX)
++ echo mips-sei-seiux${UNAME_RELEASE}
++ exit ;;
++ *:DragonFly:*:*)
++ echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
++ exit ;;
++ *:*VMS:*:*)
++ UNAME_MACHINE=`(uname -p) 2>/dev/null`
++ case "${UNAME_MACHINE}" in
++ A*) echo alpha-dec-vms ; exit ;;
++ I*) echo ia64-dec-vms ; exit ;;
++ V*) echo vax-dec-vms ; exit ;;
++ esac ;;
++ *:XENIX:*:SysV)
++ echo i386-pc-xenix
++ exit ;;
++ i*86:skyos:*:*)
++ echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
++ exit ;;
++ i*86:rdos:*:*)
++ echo ${UNAME_MACHINE}-pc-rdos
++ exit ;;
++ i*86:AROS:*:*)
++ echo ${UNAME_MACHINE}-pc-aros
++ exit ;;
+ esac
+
+ #echo '(No uname command or uname output not recognized.)' 1>&2
+@@ -1236,7 +1390,7 @@
+ #endif
+
+ #if defined (__arm) && defined (__acorn) && defined (__unix)
+- printf ("arm-acorn-riscix"); exit (0);
++ printf ("arm-acorn-riscix\n"); exit (0);
+ #endif
+
+ #if defined (hp300) && !defined (hpux)
+@@ -1325,11 +1479,12 @@
+ }
+ EOF
+
+-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
++$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
++ { echo "$SYSTEM_NAME"; exit; }
+
+ # Apollos put the system type in the environment.
+
+-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
++test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+ # Convex versions that predate uname can use getsysinfo(1)
+
+@@ -1338,22 +1493,22 @@
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
+- exit 0 ;;
++ exit ;;
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+- exit 0 ;;
++ exit ;;
+ c34*)
+ echo c34-convex-bsd
+- exit 0 ;;
++ exit ;;
+ c38*)
+ echo c38-convex-bsd
+- exit 0 ;;
++ exit ;;
+ c4*)
+ echo c4-convex-bsd
+- exit 0 ;;
++ exit ;;
+ esac
+ fi
+
+@@ -1364,7 +1519,9 @@
+ the operating system you are using. It is advised that you
+ download the most up to date version of the config scripts from
+
+- ftp://ftp.gnu.org/pub/gnu/config/
++ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
++and
++ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+ If the version you run ($0) is already up to date, please
+ send the following data and any information you think might be
+Index: build/autoconf/config.sub
+===================================================================
+--- build/autoconf/config.sub (revision 15)
++++ build/autoconf/config.sub (working copy)
+@@ -1,9 +1,10 @@
+ #! /bin/sh
+ # Configuration validation subroutine script.
+ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+-# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
++# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
++# Free Software Foundation, Inc.
+
+-timestamp='2003-02-22'
++timestamp='2009-04-17'
+
+ # This file is (in principle) common to ALL GNU software.
+ # The presence of a machine in this file suggests that SOME GNU software
+@@ -21,14 +22,15 @@
+ #
+ # You should have received a copy of the GNU General Public License
+ # along with this program; if not, write to the Free Software
+-# Foundation, Inc., 59 Temple Place - Suite 330,
+-# Boston, MA 02111-1307, USA.
+-
++# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
++# 02110-1301, USA.
++#
+ # As a special exception to the GNU General Public License, if you
+ # distribute this file as part of a program that contains a
+ # 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 . Submit a context
+ # diff and a properly formatted ChangeLog entry.
+ #
+@@ -70,8 +72,8 @@
+ version="\
+ GNU config.sub ($timestamp)
+
+-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+-Free Software Foundation, Inc.
++Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
++2002, 2003, 2004, 2005, 2006, 2007, 2008 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."
+@@ -83,11 +85,11 @@
+ while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+- echo "$timestamp" ; exit 0 ;;
++ echo "$timestamp" ; exit ;;
+ --version | -v )
+- echo "$version" ; exit 0 ;;
++ echo "$version" ; exit ;;
+ --help | --h* | -h )
+- echo "$usage"; exit 0 ;;
++ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+@@ -99,7 +101,7 @@
+ *local*)
+ # First pass through any local machine types.
+ echo $1
+- exit 0;;
++ exit ;;
+
+ * )
+ break ;;
+@@ -118,7 +120,10 @@
+ # Here we must recognize all the valid KERNEL-OS combinations.
+ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+ case $maybe_os in
+- nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
++ nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
++ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
++ kopensolaris*-gnu* | \
++ storm-chaos* | os2-emx* | rtmk-nova*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+@@ -144,7 +149,7 @@
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+- -apple | -axis)
++ -apple | -axis | -knuth | -cray)
+ os=
+ basic_machine=$1
+ ;;
+@@ -169,6 +174,10 @@
+ -hiux*)
+ os=-hiuxwe2
+ ;;
++ -sco6)
++ os=-sco5v6
++ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
++ ;;
+ -sco5)
+ os=-sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+@@ -185,6 +194,10 @@
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
++ -sco5v6*)
++ # Don't forget version if it is 3.2v4 or newer.
++ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
++ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+@@ -224,51 +237,61 @@
+ case $basic_machine in
+ # Recognize the basic CPU types without company name.
+ # Some are omitted here because they have special meanings below.
+-#### MozillaHack
+-# mips*el
+-#### End MozillaHack
+ 1750a | 580 \
+ | a29k \
+ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+- | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+- | clipper \
++ | am33_2.0 \
++ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
++ | bfin \
++ | c4x | clipper \
+ | d10v | d30v | dlx | dsp16xx \
+- | fr30 | frv \
++ | fido | fr30 | frv \
+ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | i370 | i860 | i960 | ia64 \
+- | ip2k \
+- | m32r | m68000 | m68k | m88k | mcore \
+- | mips | mipsbe | mipseb | mips*el | mipsle \
++ | ip2k | iq2000 \
++ | lm32 \
++ | m32c | m32r | m32rle | m68000 | m68k | m88k \
++ | maxq | mb | microblaze | mcore | mep | metag \
++ | mips | mipsbe | mipseb | mipsel | mipsle \
+ | mips16 \
+ | mips64 | mips64el \
++ | mips64octeon | mips64octeonel \
++ | mips64orion | mips64orionel \
++ | mips64r5900 | mips64r5900el \
+ | mips64vr | mips64vrel \
+- | mips64orion | mips64orionel \
+ | mips64vr4100 | mips64vr4100el \
+ | mips64vr4300 | mips64vr4300el \
+ | mips64vr5000 | mips64vr5000el \
++ | mips64vr5900 | mips64vr5900el \
+ | mipsisa32 | mipsisa32el \
+ | mipsisa32r2 | mipsisa32r2el \
+ | mipsisa64 | mipsisa64el \
++ | mipsisa64r2 | mipsisa64r2el \
+ | mipsisa64sb1 | mipsisa64sb1el \
+ | mipsisa64sr71k | mipsisa64sr71kel \
+ | mipstx39 | mipstx39el \
+ | mn10200 | mn10300 \
++ | moxie \
++ | mt \
+ | msp430 \
++ | nios | nios2 \
+ | ns16k | ns32k \
+- | openrisc | or32 \
++ | or32 \
+ | pdp10 | pdp11 | pj | pjl \
+ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+ | pyramid \
+- | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
++ | score \
++ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+ | sh64 | sh64le \
+- | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
+- | strongarm \
+- | tahoe | thumb | tic80 | tron \
++ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
++ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
++ | spu | strongarm \
++ | tahoe | thumb | tic4x | tic80 | tron \
+ | v850 | v850e \
+ | we32k \
+- | x86 | xscale | xstormy16 | xtensa \
+- | z8k)
++ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
++ | z8k | z80)
+ basic_machine=$basic_machine-unknown
+ ;;
+ m6811 | m68hc11 | m6812 | m68hc12)
+@@ -278,6 +301,9 @@
+ ;;
+ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+ ;;
++ ms1)
++ basic_machine=mt-unknown
++ ;;
+
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+@@ -291,64 +317,74 @@
+ exit 1
+ ;;
+ # Recognize the basic CPU types with company name.
+-#### MozillaHack
+-# mips*el
+-#### End MozillaHack
+ 580-* \
+ | a29k-* \
+ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
+- | avr-* \
+- | bs2000-* \
++ | avr-* | avr32-* \
++ | bfin-* | bs2000-* \
+ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+- | clipper-* | cydra-* \
++ | clipper-* | craynv-* | cydra-* \
+ | d10v-* | d30v-* | dlx-* \
+ | elxsi-* \
+- | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
++ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+ | h8300-* | h8500-* \
+ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+ | i*86-* | i860-* | i960-* | ia64-* \
+- | ip2k-* \
+- | m32r-* \
++ | ip2k-* | iq2000-* \
++ | lm32-* \
++ | m32c-* | m32r-* | m32rle-* \
+ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+- | m88110-* | m88k-* | mcore-* \
+- | mips-* | mipsbe-* | mipseb-* | mips*el-* | mipsle-* \
++ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
++ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+ | mips16-* \
+ | mips64-* | mips64el-* \
++ | mips64octeon-* | mips64octeonel-* \
++ | mips64orion-* | mips64orionel-* \
++ | mips64r5900-* | mips64r5900el-* \
+ | mips64vr-* | mips64vrel-* \
+- | mips64orion-* | mips64orionel-* \
+ | mips64vr4100-* | mips64vr4100el-* \
+ | mips64vr4300-* | mips64vr4300el-* \
+ | mips64vr5000-* | mips64vr5000el-* \
++ | mips64vr5900-* | mips64vr5900el-* \
+ | mipsisa32-* | mipsisa32el-* \
+ | mipsisa32r2-* | mipsisa32r2el-* \
+ | mipsisa64-* | mipsisa64el-* \
++ | mipsisa64r2-* | mipsisa64r2el-* \
+ | mipsisa64sb1-* | mipsisa64sb1el-* \
+ | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipstx39-* | mipstx39el-* \
++ | mmix-* \
++ | mt-* \
+ | msp430-* \
+- | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \
++ | nios-* | nios2-* \
++ | none-* | np1-* | ns16k-* | ns32k-* \
+ | orion-* \
+ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+ | pyramid-* \
+ | romp-* | rs6000-* \
+- | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
++ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+- | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
+- | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
++ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
++ | sparclite-* \
++ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
+ | tahoe-* | thumb-* \
+- | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
++ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
+ | tron-* \
+ | v850-* | v850e-* | vax-* \
+ | we32k-* \
+- | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
+- | xtensa-* \
++ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
++ | xstormy16-* | xtensa*-* \
+ | ymp-* \
+- | z8k-*)
++ | z8k-* | z80-*)
+ ;;
++ # Recognize the basic CPU types without company name, with glob match.
++ xtensa*)
++ basic_machine=$basic_machine-unknown
++ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 386bsd)
+@@ -365,6 +401,9 @@
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
++ abacus)
++ basic_machine=abacus-unknown
++ ;;
+ adobe68k)
+ basic_machine=m68010-adobe
+ os=-scout
+@@ -379,6 +418,12 @@
+ basic_machine=a29k-none
+ os=-bsd
+ ;;
++ amd64)
++ basic_machine=x86_64-pc
++ ;;
++ amd64-*)
++ basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
++ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ os=-sysv
+@@ -402,6 +447,10 @@
+ basic_machine=m68k-apollo
+ os=-bsd
+ ;;
++ aros)
++ basic_machine=i386-pc
++ os=-aros
++ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+@@ -410,10 +459,22 @@
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
++ blackfin)
++ basic_machine=bfin-unknown
++ os=-linux
++ ;;
++ blackfin-*)
++ basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
++ os=-linux
++ ;;
+ c90)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
++ cegcc)
++ basic_machine=arm-unknown
++ os=-cegcc
++ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+@@ -438,12 +499,27 @@
+ basic_machine=j90-cray
+ os=-unicos
+ ;;
++ craynv)
++ basic_machine=craynv-cray
++ os=-unicosmp
++ ;;
++ cr16)
++ basic_machine=cr16-unknown
++ os=-elf
++ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
++ crisv32 | crisv32-* | etraxfs*)
++ basic_machine=crisv32-axis
++ ;;
+ cris | cris-* | etrax*)
+ basic_machine=cris-axis
+ ;;
++ crx)
++ basic_machine=crx-unknown
++ os=-elf
++ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+@@ -466,6 +542,14 @@
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
++ dicos)
++ basic_machine=i686-pc
++ os=-dicos
++ ;;
++ djgpp)
++ basic_machine=i586-pc
++ os=-msdosdjgpp
++ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+@@ -616,6 +700,14 @@
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
++ m68knommu)
++ basic_machine=m68k-unknown
++ os=-linux
++ ;;
++ m68knommu-*)
++ basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
++ os=-linux
++ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+@@ -631,12 +723,10 @@
+ basic_machine=i386-pc
+ os=-mingw32
+ ;;
+-#### MozillaHack
+- i386-msvc | msvc)
+- basic_machine=i386-pc
+- os=-msvc
++ mingw32ce)
++ basic_machine=arm-unknown
++ os=-mingw32ce
+ ;;
+-#### End MozillaHack
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+@@ -650,10 +740,6 @@
+ 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
+@@ -666,6 +752,9 @@
+ basic_machine=i386-pc
+ os=-msdos
+ ;;
++ ms1-*)
++ basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
++ ;;
+ mvs)
+ basic_machine=i370-ibm
+ os=-mvs
+@@ -734,10 +823,6 @@
+ np1)
+ basic_machine=np1-gould
+ ;;
+- nv1)
+- basic_machine=nv1-cray
+- os=-unicosmp
+- ;;
+ nsr-tandem)
+ basic_machine=nsr-tandem
+ ;;
+@@ -745,10 +830,13 @@
+ basic_machine=hppa1.1-oki
+ os=-proelf
+ ;;
+- or32 | or32-*)
++ openrisc | openrisc-*)
+ basic_machine=or32-unknown
+- os=-coff
+ ;;
++ os400)
++ basic_machine=powerpc-ibm
++ os=-os400
++ ;;
+ OSE68000 | ose68000)
+ basic_machine=m68000-ericsson
+ os=-ose
+@@ -765,6 +853,14 @@
+ basic_machine=i860-intel
+ os=-osf
+ ;;
++ parisc)
++ basic_machine=hppa-unknown
++ os=-linux
++ ;;
++ parisc-*)
++ basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
++ os=-linux
++ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+@@ -774,24 +870,36 @@
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
++ pc98)
++ basic_machine=i386-pc
++ ;;
++ pc98-*)
++ basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
++ ;;
+ pentium | p5 | k5 | k6 | nexgen | viac3)
+ basic_machine=i586-pc
+ ;;
+ pentiumpro | p6 | 6x86 | athlon | athlon_*)
+ basic_machine=i686-pc
+ ;;
+- pentiumii | pentium2)
++ pentiumii | pentium2 | pentiumiii | pentium3)
+ basic_machine=i686-pc
+ ;;
++ pentium4)
++ basic_machine=i786-pc
++ ;;
+ pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumpro-* | p6-* | 6x86-* | athlon-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+- pentiumii-* | pentium2-*)
++ pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
++ pentium4-*)
++ basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
++ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+@@ -824,6 +932,10 @@
+ basic_machine=i586-unknown
+ os=-pw32
+ ;;
++ rdos)
++ basic_machine=i386-pc
++ os=-rdos
++ ;;
+ rom68k)
+ basic_machine=m68k-rom68k
+ os=-coff
+@@ -850,6 +962,14 @@
+ sb1el)
+ basic_machine=mipsisa64sb1el-unknown
+ ;;
++ sde)
++ basic_machine=mipsisa32-sde
++ os=-elf
++ ;;
++ sei)
++ basic_machine=mips-sei
++ os=-seiux
++ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+@@ -857,6 +977,12 @@
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
++ sh5el)
++ basic_machine=sh5le-unknown
++ ;;
++ sh64)
++ basic_machine=sh64-unknown
++ ;;
+ sparclite-wrs | simso-wrs)
+ basic_machine=sparclite-wrs
+ os=-vxworks
+@@ -931,10 +1057,6 @@
+ basic_machine=t90-cray
+ os=-unicos
+ ;;
+- tic4x | c4x*)
+- basic_machine=tic4x-unknown
+- os=-coff
+- ;;
+ tic54x | c54x*)
+ basic_machine=tic54x-unknown
+ os=-coff
+@@ -947,6 +1069,10 @@
+ basic_machine=tic6x-unknown
+ os=-coff
+ ;;
++ tile*)
++ basic_machine=tile-unknown
++ os=-linux-gnu
++ ;;
+ tx39)
+ basic_machine=mipstx39-unknown
+ ;;
+@@ -960,6 +1086,10 @@
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
++ tpf)
++ basic_machine=s390x-ibm
++ os=-tpf
++ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+@@ -1003,6 +1133,10 @@
+ basic_machine=hppa1.1-winbond
+ os=-proelf
+ ;;
++ xbox)
++ basic_machine=i686-pc
++ os=-mingw32
++ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+@@ -1014,6 +1148,10 @@
+ basic_machine=z8k-unknown
+ os=-sim
+ ;;
++ z80-*-coff)
++ basic_machine=z80-unknown
++ os=-sim
++ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+@@ -1033,6 +1171,9 @@
+ romp)
+ basic_machine=romp-ibm
+ ;;
++ mmix)
++ basic_machine=mmix-knuth
++ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+@@ -1049,13 +1190,10 @@
+ we32k)
+ basic_machine=we32k-att
+ ;;
+- sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
++ sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
+ basic_machine=sh-unknown
+ ;;
+- sh64)
+- basic_machine=sh64-unknown
+- ;;
+- sparc | sparcv9 | sparcv9b)
++ sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+@@ -1121,30 +1259,31 @@
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+-#### MozillaHack
+-# msvc
+-#### End MozillaHack
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
++ | -kopensolaris* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+- | -aos* \
++ | -aos* | -aros* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+- | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
+- | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
++ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
++ | -openbsd* | -solidbsd* \
++ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
++ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+- | -chorusos* | -chorusrdb* \
++ | -chorusos* | -chorusrdb* | -cegcc* \
+ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+- | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
++ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
++ | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+- | -msvc* \
+ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+- | -powermax* | -dnix*)
++ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
++ | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -qnx*)
+@@ -1162,12 +1301,15 @@
+ os=`echo $os | sed -e 's|nto|nto-qnx|'`
+ ;;
+ -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+- | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
++ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+ ;;
+ -mac*)
+ os=`echo $os | sed -e 's|mac|macos|'`
+ ;;
++ -linux-dietlibc)
++ os=-linux-dietlibc
++ ;;
+ -linux*)
+ os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ ;;
+@@ -1180,6 +1322,9 @@
+ -opened*)
+ os=-openedition
+ ;;
++ -os400*)
++ os=-os400
++ ;;
+ -wince*)
+ os=-wince
+ ;;
+@@ -1201,6 +1346,9 @@
+ -atheos*)
+ os=-atheos
+ ;;
++ -syllable*)
++ os=-syllable
++ ;;
+ -386bsd)
+ os=-bsd
+ ;;
+@@ -1223,6 +1371,9 @@
+ -sinix*)
+ os=-sysv4
+ ;;
++ -tpf*)
++ os=-tpf
++ ;;
+ -triton*)
+ os=-sysv3
+ ;;
+@@ -1259,6 +1410,12 @@
+ -kaos*)
+ os=-kaos
+ ;;
++ -zvmoe)
++ os=-zvmoe
++ ;;
++ -dicos*)
++ os=-dicos
++ ;;
+ -none)
+ ;;
+ *)
+@@ -1281,6 +1438,12 @@
+ # system, and we'll never get to this point.
+
+ case $basic_machine in
++ score-*)
++ os=-elf
++ ;;
++ spu-*)
++ os=-elf
++ ;;
+ *-acorn)
+ os=-riscix1.2
+ ;;
+@@ -1290,6 +1453,9 @@
+ arm*-semi)
+ os=-aout
+ ;;
++ c4x-* | tic4x-*)
++ os=-coff
++ ;;
+ # This must come before the *-dec entry.
+ pdp10-*)
+ os=-tops20
+@@ -1315,6 +1481,9 @@
+ m68*-cisco)
+ os=-aout
+ ;;
++ mep-*)
++ os=-elf
++ ;;
+ mips*-cisco)
+ os=-elf
+ ;;
+@@ -1333,9 +1502,15 @@
+ *-be)
+ os=-beos
+ ;;
++ *-haiku)
++ os=-haiku
++ ;;
+ *-ibm)
+ os=-aix
+ ;;
++ *-knuth)
++ os=-mmixware
++ ;;
+ *-wec)
+ os=-proelf
+ ;;
+@@ -1468,9 +1643,15 @@
+ -mvs* | -opened*)
+ vendor=ibm
+ ;;
++ -os400*)
++ vendor=ibm
++ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
++ -tpf*)
++ vendor=ibm
++ ;;
+ -vxsim* | -vxworks* | -windiss*)
+ vendor=wrs
+ ;;
+@@ -1495,7 +1676,7 @@
+ esac
+
+ echo $basic_machine$os
+-exit 0
++exit
+
+ # Local variables:
+ # eval: (add-hook 'write-file-hooks 'time-stamp)
+Index: directory/c-sdk/config/autoconf/config.guess
+===================================================================
+--- directory/c-sdk/config/autoconf/config.guess (revision 15)
++++ directory/c-sdk/config/autoconf/config.guess (working copy)
+@@ -1,9 +1,10 @@
+ #! /bin/sh
+ # Attempt to guess a canonical system name.
+ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+-# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
++# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
++# Free Software Foundation, Inc.
+
+-timestamp='2003-02-22'
++timestamp='2009-04-27'
+
+ # 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
+@@ -17,13 +18,15 @@
+ #
+ # You should have received a copy of the GNU General Public License
+ # along with this program; if not, write to the Free Software
+-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
++# 02110-1301, USA.
+ #
+ # As a special exception to the GNU General Public License, if you
+ # distribute this file as part of a program that contains a
+ # configuration script generated by Autoconf, you may include it under
+ # the same distribution terms that you use for the rest of that program.
+
++
+ # Originally written by Per Bothner .
+ # Please send patches to . Submit a context
+ # diff and a properly formatted ChangeLog entry.
+@@ -53,8 +56,8 @@
+ GNU config.guess ($timestamp)
+
+ Originally written by Per Bothner.
+-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+-Free Software Foundation, Inc.
++Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
++2002, 2003, 2004, 2005, 2006, 2007, 2008 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."
+@@ -66,11 +69,11 @@
+ while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+- echo "$timestamp" ; exit 0 ;;
++ echo "$timestamp" ; exit ;;
+ --version | -v )
+- echo "$version" ; exit 0 ;;
++ echo "$version" ; exit ;;
+ --help | --h* | -h )
+- echo "$usage"; exit 0 ;;
++ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+@@ -104,8 +107,9 @@
+ trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+ trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+ : ${TMPDIR=/tmp} ;
+- { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
++ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
++ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+ dummy=$tmp/dummy ;
+ tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+@@ -122,7 +126,7 @@
+ ;;
+ ,,*) CC_FOR_BUILD=$CC ;;
+ ,*,*) CC_FOR_BUILD=$HOST_CC ;;
+-esac ;'
++esac ; set_cc_for_build= ;'
+
+ # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+ # (ghazi@noc.rutgers.edu 1994-08-24)
+@@ -157,6 +161,7 @@
+ arm*) machine=arm-unknown ;;
+ sh3el) machine=shl-unknown ;;
+ sh3eb) machine=sh-unknown ;;
++ sh5el) machine=sh5le-unknown ;;
+ *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+ esac
+ # The Operating System including object format, if it has switched
+@@ -195,50 +200,32 @@
+ # contains redundant information, the shorter form:
+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ echo "${machine}-${os}${release}"
+- exit 0 ;;
+- amiga:OpenBSD:*:*)
+- echo m68k-unknown-openbsd${UNAME_RELEASE}
+- exit 0 ;;
+- arc:OpenBSD:*:*)
+- echo mipsel-unknown-openbsd${UNAME_RELEASE}
+- exit 0 ;;
+- hp300:OpenBSD:*:*)
+- echo m68k-unknown-openbsd${UNAME_RELEASE}
+- exit 0 ;;
+- mac68k:OpenBSD:*:*)
+- echo m68k-unknown-openbsd${UNAME_RELEASE}
+- exit 0 ;;
+- macppc:OpenBSD:*:*)
+- echo powerpc-unknown-openbsd${UNAME_RELEASE}
+- exit 0 ;;
+- mvme68k:OpenBSD:*:*)
+- echo m68k-unknown-openbsd${UNAME_RELEASE}
+- exit 0 ;;
+- mvme88k:OpenBSD:*:*)
+- echo m88k-unknown-openbsd${UNAME_RELEASE}
+- exit 0 ;;
+- mvmeppc:OpenBSD:*:*)
+- echo powerpc-unknown-openbsd${UNAME_RELEASE}
+- exit 0 ;;
+- pmax:OpenBSD:*:*)
+- echo mipsel-unknown-openbsd${UNAME_RELEASE}
+- exit 0 ;;
+- sgi:OpenBSD:*:*)
+- echo mipseb-unknown-openbsd${UNAME_RELEASE}
+- exit 0 ;;
+- sun3:OpenBSD:*:*)
+- echo m68k-unknown-openbsd${UNAME_RELEASE}
+- exit 0 ;;
+- wgrisc:OpenBSD:*:*)
+- echo mipsel-unknown-openbsd${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ *:OpenBSD:*:*)
+- echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
+- exit 0 ;;
++ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
++ echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
++ exit ;;
++ *:ekkoBSD:*:*)
++ echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
++ exit ;;
++ *:SolidBSD:*:*)
++ echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
++ exit ;;
++ macppc:MirBSD:*:*)
++ echo powerpc-unknown-mirbsd${UNAME_RELEASE}
++ exit ;;
++ *:MirBSD:*:*)
++ echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
++ exit ;;
+ alpha:OSF1:*:*)
+- if test $UNAME_RELEASE = "V4.0"; then
++ case $UNAME_RELEASE in
++ *4.0)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+- fi
++ ;;
++ *5.*)
++ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
++ ;;
++ esac
+ # According to Compaq, /usr/sbin/psrinfo has been available on
+ # OSF/1 and Tru64 systems produced since 1995. I hope that
+ # covers most systems running today. This code pipes the CPU
+@@ -276,39 +263,49 @@
+ "EV7.9 (21364A)")
+ UNAME_MACHINE="alphaev79" ;;
+ esac
++ # A Pn.n version is a patched version.
+ # A Vn.n version is a released version.
+ # 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.
+- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+- exit 0 ;;
++ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
++ exit ;;
+ 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 ;;
++ exit ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+- exit 0 ;;
++ exit ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-unknown-sysv4
+- exit 0;;
++ exit ;;
+ *:[Aa]miga[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-amigaos
+- exit 0 ;;
++ exit ;;
+ *:[Mm]orph[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-morphos
+- exit 0 ;;
++ exit ;;
+ *:OS/390:*:*)
+ echo i370-ibm-openedition
+- exit 0 ;;
++ exit ;;
++ *:z/VM:*:*)
++ echo s390-ibm-zvmoe
++ exit ;;
++ *:OS400:*:*)
++ echo powerpc-ibm-os400
++ exit ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+- exit 0;;
++ exit ;;
++ arm:riscos:*:*|arm:RISCOS:*:*)
++ echo arm-unknown-riscos
++ exit ;;
+ SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+ echo hppa1.1-hitachi-hiuxmpp
+- exit 0;;
++ exit ;;
+ 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
+@@ -316,29 +313,48 @@
+ else
+ echo pyramid-pyramid-bsd
+ fi
+- exit 0 ;;
++ exit ;;
+ NILE*:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+- exit 0 ;;
+- DRS?6000:UNIX_SV:4.2*:7*)
++ exit ;;
++ DRS?6000:unix:4.0:6*)
++ echo sparc-icl-nx6
++ exit ;;
++ DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+ case `/usr/bin/uname -p` in
+- sparc) echo sparc-icl-nx7 && exit 0 ;;
++ sparc) echo sparc-icl-nx7; exit ;;
+ esac ;;
++ s390x:SunOS:*:*)
++ echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
++ exit ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+- exit 0 ;;
++ exit ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+- exit 0 ;;
+- i86pc:SunOS:5.*:*)
+- echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+- exit 0 ;;
++ exit ;;
++ i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
++ eval $set_cc_for_build
++ SUN_ARCH="i386"
++ # If there is a compiler, see if it is configured for 64-bit objects.
++ # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
++ # This test works for both compilers.
++ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
++ if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
++ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
++ grep IS_64BIT_ARCH >/dev/null
++ then
++ SUN_ARCH="x86_64"
++ fi
++ fi
++ echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
++ exit ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+- exit 0 ;;
++ exit ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+@@ -347,10 +363,10 @@
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+- exit 0 ;;
++ exit ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+@@ -362,10 +378,10 @@
+ echo sparc-sun-sunos${UNAME_RELEASE}
+ ;;
+ esac
+- exit 0 ;;
++ exit ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ # 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
+@@ -376,37 +392,40 @@
+ # be no problem.
+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+ echo m68k-milan-mint${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+ echo m68k-hades-mint${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+ echo m68k-unknown-mint${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
++ m68k:machten:*:*)
++ echo m68k-apple-machten${UNAME_RELEASE}
++ exit ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+- exit 0 ;;
++ exit ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ 2020:CLIX:*:* | 2430:CLIX:*:*)
+ echo clipper-intergraph-clix${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+@@ -430,32 +449,33 @@
+ exit (-1);
+ }
+ EOF
+- $CC_FOR_BUILD -o $dummy $dummy.c \
+- && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+- && exit 0
++ $CC_FOR_BUILD -o $dummy $dummy.c &&
++ dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
++ SYSTEM_NAME=`$dummy $dummyarg` &&
++ { echo "$SYSTEM_NAME"; exit; }
+ echo mips-mips-riscos${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ Motorola:PowerMAX_OS:*:*)
+ echo powerpc-motorola-powermax
+- exit 0 ;;
++ exit ;;
+ Motorola:*:4.3:PL8-*)
+ echo powerpc-harris-powermax
+- exit 0 ;;
++ exit ;;
+ Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+ echo powerpc-harris-powermax
+- exit 0 ;;
++ exit ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+- exit 0 ;;
++ exit ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+- exit 0 ;;
++ exit ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+- exit 0 ;;
++ exit ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+- exit 0 ;;
++ exit ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+@@ -471,29 +491,29 @@
+ else
+ echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+- exit 0 ;;
++ exit ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+- exit 0 ;;
++ exit ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+- exit 0 ;;
++ exit ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+- exit 0 ;;
++ exit ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+- exit 0 ;;
++ exit ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+- exit 0 ;;
++ exit ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+- echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+- exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
++ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
++ exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i*86:AIX:*:*)
+ echo i386-ibm-aix
+- exit 0 ;;
++ exit ;;
+ ia64:AIX:*:*)
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+@@ -501,7 +521,7 @@
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+- exit 0 ;;
++ exit ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ eval $set_cc_for_build
+@@ -516,15 +536,19 @@
+ exit(0);
+ }
+ EOF
+- $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
+- echo rs6000-ibm-aix3.2.5
++ if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
++ then
++ echo "$SYSTEM_NAME"
++ else
++ echo rs6000-ibm-aix3.2.5
++ fi
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+- exit 0 ;;
+- *:AIX:*:[45])
++ exit ;;
++ *:AIX:*:[456])
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+@@ -537,28 +561,28 @@
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+- exit 0 ;;
++ exit ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+- exit 0 ;;
++ exit ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+- exit 0 ;;
++ exit ;;
+ 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
++ exit ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+- exit 0 ;;
++ exit ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+- exit 0 ;;
++ exit ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+- exit 0 ;;
++ exit ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+- exit 0 ;;
++ exit ;;
+ 9000/[34678]??:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ case "${UNAME_MACHINE}" in
+@@ -620,9 +644,19 @@
+ esac
+ if [ ${HP_ARCH} = "hppa2.0w" ]
+ then
+- # avoid double evaluation of $set_cc_for_build
+- test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
+- if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
++ eval $set_cc_for_build
++
++ # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
++ # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
++ # generating 64-bit code. GNU and HP use different nomenclature:
++ #
++ # $ CC_FOR_BUILD=cc ./config.guess
++ # => hppa2.0w-hp-hpux11.23
++ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
++ # => hppa64-hp-hpux11.23
++
++ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
++ grep __LP64__ >/dev/null
+ then
+ HP_ARCH="hppa2.0w"
+ else
+@@ -630,11 +664,11 @@
+ fi
+ fi
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+- exit 0 ;;
++ exit ;;
+ ia64:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ia64-hp-hpux${HPUX_REV}
+- exit 0 ;;
++ exit ;;
+ 3050*:HI-UX:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+@@ -662,153 +696,192 @@
+ exit (0);
+ }
+ EOF
+- $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
++ $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
++ { echo "$SYSTEM_NAME"; exit; }
+ echo unknown-hitachi-hiuxwe2
+- exit 0 ;;
++ exit ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ echo hppa1.1-hp-bsd
+- exit 0 ;;
++ exit ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+- exit 0 ;;
++ exit ;;
+ *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+ echo hppa1.0-hp-mpeix
+- exit 0 ;;
++ exit ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+- exit 0 ;;
++ exit ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+- exit 0 ;;
++ exit ;;
+ i*86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-unknown-osf1mk
+ else
+ echo ${UNAME_MACHINE}-unknown-osf1
+ fi
+- exit 0 ;;
++ exit ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+- exit 0 ;;
++ exit ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+- exit 0 ;;
++ exit ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+- exit 0 ;;
++ exit ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+- exit 0 ;;
++ exit ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+- exit 0 ;;
++ exit ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+- exit 0 ;;
++ exit ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+- exit 0 ;;
++ exit ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+ -e 's/\.[^.]*$/.X/'
+- exit 0 ;;
++ exit ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+- exit 0 ;;
++ exit ;;
+ CRAY*T3E:*:*:*)
+ echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+- exit 0 ;;
++ exit ;;
+ CRAY*SV1:*:*:*)
+ echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+- exit 0 ;;
++ exit ;;
+ *:UNICOS/mp:*:*)
+- echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+- exit 0 ;;
++ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
++ exit ;;
+ 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 "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+- exit 0 ;;
++ exit ;;
++ 5000:UNIX_System_V:4.*:*)
++ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
++ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
++ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
++ exit ;;
+ i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ sparc*:BSD/OS:*:*)
+ echo sparc-unknown-bsdi${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ *:FreeBSD:*:*)
+- # Determine whether the default compiler uses glibc.
+- eval $set_cc_for_build
+- sed 's/^ //' << EOF >$dummy.c
+- #include
+- #if __GLIBC__ >= 2
+- LIBC=gnu
+- #else
+- LIBC=
+- #endif
+-EOF
+- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
+- exit 0 ;;
++ case ${UNAME_MACHINE} in
++ pc98)
++ echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
++ amd64)
++ echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
++ *)
++ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
++ esac
++ exit ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin
+- exit 0 ;;
+- i*:MINGW*:*)
++ exit ;;
++ *: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
++ exit ;;
++ i*:windows32*:*)
++ # uname -m includes "-pc" on this system.
++ echo ${UNAME_MACHINE}-mingw32
++ exit ;;
+ i*:PW*:*)
+ echo ${UNAME_MACHINE}-pc-pw32
+- exit 0 ;;
+- x86:Interix*:3*)
+- echo i586-pc-interix3
+- exit 0 ;;
++ exit ;;
++ *:Interix*:[3456]*)
++ case ${UNAME_MACHINE} in
++ x86)
++ echo i586-pc-interix${UNAME_RELEASE}
++ exit ;;
++ EM64T | authenticamd | genuineintel)
++ echo x86_64-unknown-interix${UNAME_RELEASE}
++ exit ;;
++ IA64)
++ echo ia64-unknown-interix${UNAME_RELEASE}
++ exit ;;
++ esac ;;
+ [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+ echo i${UNAME_MACHINE}-pc-mks
+- exit 0 ;;
++ exit ;;
+ 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 i586-pc-interix
+- exit 0 ;;
++ exit ;;
+ i*:UWIN*:*)
+ echo ${UNAME_MACHINE}-pc-uwin
+- exit 0 ;;
++ exit ;;
++ amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
++ echo x86_64-unknown-cygwin
++ exit ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin
+- exit 0 ;;
++ exit ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+- exit 0 ;;
++ exit ;;
+ *:GNU:*:*)
++ # the GNU system
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+- exit 0 ;;
++ exit ;;
++ *:GNU/*:*:*)
++ # other systems with GNU libc and userland
++ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
++ exit ;;
+ i*86:Minix:*:*)
+ echo ${UNAME_MACHINE}-pc-minix
+- exit 0 ;;
++ exit ;;
+ arm*:Linux:*:*)
++ eval $set_cc_for_build
++ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
++ | grep -q __ARM_EABI__
++ then
++ echo ${UNAME_MACHINE}-unknown-linux-gnu
++ else
++ echo ${UNAME_MACHINE}-unknown-linux-gnueabi
++ fi
++ exit ;;
++ avr32*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+- exit 0 ;;
++ exit ;;
++ cris:Linux:*:*)
++ echo cris-axis-linux-gnu
++ exit ;;
++ crisv32:Linux:*:*)
++ echo crisv32-axis-linux-gnu
++ exit ;;
++ frv:Linux:*:*)
++ echo frv-unknown-linux-gnu
++ exit ;;
+ ia64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+- exit 0 ;;
++ exit ;;
++ m32r*:Linux:*:*)
++ echo ${UNAME_MACHINE}-unknown-linux-gnu
++ exit ;;
+ m68*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+- exit 0 ;;
++ exit ;;
+ mips:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+@@ -825,8 +898,12 @@
+ #endif
+ #endif
+ EOF
+- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+- test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
++ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
++ /^CPU/{
++ s: ::g
++ p
++ }'`"
++ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ ;;
+ mips64:Linux:*:*)
+ eval $set_cc_for_build
+@@ -844,15 +921,22 @@
+ #endif
+ #endif
+ EOF
+- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+- test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
++ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
++ /^CPU/{
++ s: ::g
++ p
++ }'`"
++ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ ;;
++ or32:Linux:*:*)
++ echo or32-unknown-linux-gnu
++ exit ;;
+ ppc:Linux:*:*)
+ echo powerpc-unknown-linux-gnu
+- exit 0 ;;
++ exit ;;
+ ppc64:Linux:*:*)
+ echo powerpc64-unknown-linux-gnu
+- exit 0 ;;
++ exit ;;
+ alpha:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+@@ -866,7 +950,10 @@
+ objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+- exit 0 ;;
++ exit ;;
++ padre:Linux:*:*)
++ echo sparc-unknown-linux-gnu
++ exit ;;
+ parisc:Linux:*:* | hppa:Linux:*:*)
+ # Look for CPU level
+ case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+@@ -874,22 +961,31 @@
+ PA8*) echo hppa2.0-unknown-linux-gnu ;;
+ *) echo hppa-unknown-linux-gnu ;;
+ esac
+- exit 0 ;;
++ exit ;;
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ echo hppa64-unknown-linux-gnu
+- exit 0 ;;
++ exit ;;
+ s390:Linux:*:* | s390x:Linux:*:*)
+ echo ${UNAME_MACHINE}-ibm-linux
+- exit 0 ;;
++ exit ;;
++ sh64*:Linux:*:*)
++ echo ${UNAME_MACHINE}-unknown-linux-gnu
++ exit ;;
+ sh*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+- exit 0 ;;
++ exit ;;
+ sparc:Linux:*:* | sparc64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+- exit 0 ;;
++ exit ;;
++ vax:Linux:*:*)
++ echo ${UNAME_MACHINE}-dec-linux-gnu
++ exit ;;
+ x86_64:Linux:*:*)
+ echo x86_64-unknown-linux-gnu
+- exit 0 ;;
++ exit ;;
++ xtensa*:Linux:*:*)
++ echo ${UNAME_MACHINE}-unknown-linux-gnu
++ exit ;;
+ 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
+@@ -907,15 +1003,12 @@
+ ;;
+ a.out-i386-linux)
+ echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+- exit 0 ;;
+- coff-i386)
+- echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+- exit 0 ;;
++ exit ;;
+ "")
+ # Either a pre-BFD a.out linker (linux-gnuoldld) or
+ # one that does not give us useful --help.
+ echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+- exit 0 ;;
++ exit ;;
+ esac
+ # Determine whether the default compiler is a.out or elf
+ eval $set_cc_for_build
+@@ -932,23 +1025,33 @@
+ LIBC=gnulibc1
+ # endif
+ #else
+- #ifdef __INTEL_COMPILER
++ #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+ LIBC=gnu
+ #else
+ LIBC=gnuaout
+ #endif
+ #endif
++ #ifdef __dietlibc__
++ LIBC=dietlibc
++ #endif
+ EOF
+- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+- test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
+- test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
++ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
++ /^LIBC/{
++ s: ::g
++ p
++ }'`"
++ test x"${LIBC}" != x && {
++ echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
++ exit
++ }
++ test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
+ ;;
+ i*86:DYNIX/ptx:4*:*)
+ # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+ # earlier versions are messed up and put the nodename in both
+ # sysname and nodename.
+ echo i386-sequent-sysv4
+- exit 0 ;;
++ exit ;;
+ i*86:UNIX_SV:4.2MP:2.*)
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+@@ -956,24 +1059,27 @@
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+- exit 0 ;;
++ exit ;;
+ i*86:OS/2:*:*)
+ # If we were able to find `uname', then EMX Unix compatibility
+ # is probably installed.
+ echo ${UNAME_MACHINE}-pc-os2-emx
+- exit 0 ;;
++ exit ;;
+ i*86:XTS-300:*:STOP)
+ echo ${UNAME_MACHINE}-unknown-stop
+- exit 0 ;;
++ exit ;;
+ i*86:atheos:*:*)
+ echo ${UNAME_MACHINE}-unknown-atheos
+- exit 0 ;;
++ exit ;;
++ i*86:syllable:*:*)
++ echo ${UNAME_MACHINE}-pc-syllable
++ exit ;;
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ i*86:*DOS:*:*)
+ echo ${UNAME_MACHINE}-pc-msdosdjgpp
+- exit 0 ;;
++ exit ;;
+ 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
+@@ -981,15 +1087,16 @@
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+ fi
+- exit 0 ;;
+- i*86:*:5:[78]*)
++ exit ;;
++ i*86:*:5:[678]*)
++ # UnixWare 7.x, OpenUNIX and OpenServer 6.
+ case `/bin/uname -X | grep "^Machine"` in
+ *486*) UNAME_MACHINE=i486 ;;
+ *Pentium) UNAME_MACHINE=i586 ;;
+ *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+ esac
+ echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+- exit 0 ;;
++ exit ;;
+ i*86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' /dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+- exit 0 ;;
++ exit ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+- exit 0 ;;
++ exit ;;
+ mc68k:UNIX:SYSTEM5:3.51m)
+ echo m68k-convergent-sysv
+- exit 0 ;;
++ exit ;;
+ M680?0:D-NIX:5.3:*)
+ echo m68k-diab-dnix
+- exit 0 ;;
+- M68*:*:R3V[567]*:*)
+- test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+- 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0)
++ exit ;;
++ M68*:*:R3V[5678]*:*)
++ test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
++ 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+- && echo i486-ncr-sysv4.3${OS_REL} && exit 0
++ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+- && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
++ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+- && echo i486-ncr-sysv4 && exit 0 ;;
++ && { echo i486-ncr-sysv4; exit; } ;;
++ NCR*:*:4.2:* | MPRAS*:*:4.2:*)
++ OS_REL='.3'
++ test -r /etc/.relid \
++ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
++ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
++ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
++ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
++ && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
++ /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
++ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+- exit 0 ;;
++ exit ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ rs6000:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+ echo powerpc-unknown-lynxos${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ RM*:ReliantUNIX-*:*:*)
+ echo mips-sni-sysv4
+- exit 0 ;;
++ exit ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+- exit 0 ;;
++ exit ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+@@ -1081,78 +1201,84 @@
+ else
+ echo ns32k-sni-sysv
+ fi
+- exit 0 ;;
++ exit ;;
+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # 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
++ exit ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes .
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+- exit 0 ;;
++ exit ;;
+ *:*:*:FTX*)
+ # From seanf@swdc.stratus.com.
+ echo i860-stratus-sysv4
+- exit 0 ;;
++ exit ;;
++ i*86:VOS:*:*)
++ # From Paul.Green@stratus.com.
++ echo ${UNAME_MACHINE}-stratus-vos
++ exit ;;
+ *:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo hppa1.1-stratus-vos
+- exit 0 ;;
++ exit ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ news*:NEWS-OS:6*:*)
+ echo mips-sony-newsos6
+- exit 0 ;;
++ exit ;;
+ 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 ;;
++ exit ;;
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-be-beos
+- exit 0 ;;
++ exit ;;
+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
+ echo powerpc-apple-beos
+- exit 0 ;;
++ exit ;;
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ echo i586-pc-beos
+- exit 0 ;;
++ exit ;;
++ BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
++ echo i586-pc-haiku
++ exit ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ SX-5:SUPER-UX:*:*)
+ echo sx5-nec-superux${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ SX-6:SUPER-UX:*:*)
+ echo sx6-nec-superux${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
++ SX-7:SUPER-UX:*:*)
++ echo sx7-nec-superux${UNAME_RELEASE}
++ exit ;;
++ SX-8:SUPER-UX:*:*)
++ echo sx8-nec-superux${UNAME_RELEASE}
++ exit ;;
++ SX-8R:SUPER-UX:*:*)
++ echo sx8r-nec-superux${UNAME_RELEASE}
++ exit ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ *:Rhapsody:*:*)
+ echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ *:Darwin:*:*)
+- case `uname -p` in
+- *86) UNAME_PROCESSOR=i686 ;;
+- powerpc) UNAME_PROCESSOR=powerpc ;;
++ UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
++ case $UNAME_PROCESSOR in
++ unknown) UNAME_PROCESSOR=powerpc ;;
+ esac
+ echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ *:procnto*:*:* | *:QNX:[0123456789]*:*)
+ UNAME_PROCESSOR=`uname -p`
+ if test "$UNAME_PROCESSOR" = "x86"; then
+@@ -1160,22 +1286,25 @@
+ UNAME_MACHINE=pc
+ fi
+ echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ *:QNX:*:4*)
+ echo i386-pc-qnx
+- exit 0 ;;
+- NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*)
++ exit ;;
++ NSE-?:NONSTOP_KERNEL:*:*)
++ echo nse-tandem-nsk${UNAME_RELEASE}
++ exit ;;
++ NSR-?:NONSTOP_KERNEL:*:*)
+ echo nsr-tandem-nsk${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ *:NonStop-UX:*:*)
+ echo mips-compaq-nonstopux
+- exit 0 ;;
++ exit ;;
+ BS2000:POSIX*:*:*)
+ echo bs2000-siemens-sysv
+- exit 0 ;;
++ exit ;;
+ DS/*:UNIX_System_V:*:*)
+ echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+- exit 0 ;;
++ exit ;;
+ *:Plan9:*:*)
+ # "uname -m" is not consistent, so use $cputype instead. 386
+ # is converted to i386 for consistency with other x86
+@@ -1186,25 +1315,50 @@
+ UNAME_MACHINE="$cputype"
+ fi
+ echo ${UNAME_MACHINE}-unknown-plan9
+- exit 0 ;;
++ exit ;;
+ *:TOPS-10:*:*)
+ echo pdp10-unknown-tops10
+- exit 0 ;;
++ exit ;;
+ *:TENEX:*:*)
+ echo pdp10-unknown-tenex
+- exit 0 ;;
++ exit ;;
+ KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+ echo pdp10-dec-tops20
+- exit 0 ;;
++ exit ;;
+ XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+ echo pdp10-xkl-tops20
+- exit 0 ;;
++ exit ;;
+ *:TOPS-20:*:*)
+ echo pdp10-unknown-tops20
+- exit 0 ;;
++ exit ;;
+ *:ITS:*:*)
+ echo pdp10-unknown-its
+- exit 0 ;;
++ exit ;;
++ SEI:*:*:SEIUX)
++ echo mips-sei-seiux${UNAME_RELEASE}
++ exit ;;
++ *:DragonFly:*:*)
++ echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
++ exit ;;
++ *:*VMS:*:*)
++ UNAME_MACHINE=`(uname -p) 2>/dev/null`
++ case "${UNAME_MACHINE}" in
++ A*) echo alpha-dec-vms ; exit ;;
++ I*) echo ia64-dec-vms ; exit ;;
++ V*) echo vax-dec-vms ; exit ;;
++ esac ;;
++ *:XENIX:*:SysV)
++ echo i386-pc-xenix
++ exit ;;
++ i*86:skyos:*:*)
++ echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
++ exit ;;
++ i*86:rdos:*:*)
++ echo ${UNAME_MACHINE}-pc-rdos
++ exit ;;
++ i*86:AROS:*:*)
++ echo ${UNAME_MACHINE}-pc-aros
++ exit ;;
+ esac
+
+ #echo '(No uname command or uname output not recognized.)' 1>&2
+@@ -1236,7 +1390,7 @@
+ #endif
+
+ #if defined (__arm) && defined (__acorn) && defined (__unix)
+- printf ("arm-acorn-riscix"); exit (0);
++ printf ("arm-acorn-riscix\n"); exit (0);
+ #endif
+
+ #if defined (hp300) && !defined (hpux)
+@@ -1325,11 +1479,12 @@
+ }
+ EOF
+
+-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
++$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
++ { echo "$SYSTEM_NAME"; exit; }
+
+ # Apollos put the system type in the environment.
+
+-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
++test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+ # Convex versions that predate uname can use getsysinfo(1)
+
+@@ -1338,22 +1493,22 @@
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
+- exit 0 ;;
++ exit ;;
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+- exit 0 ;;
++ exit ;;
+ c34*)
+ echo c34-convex-bsd
+- exit 0 ;;
++ exit ;;
+ c38*)
+ echo c38-convex-bsd
+- exit 0 ;;
++ exit ;;
+ c4*)
+ echo c4-convex-bsd
+- exit 0 ;;
++ exit ;;
+ esac
+ fi
+
+@@ -1364,7 +1519,9 @@
+ the operating system you are using. It is advised that you
+ download the most up to date version of the config scripts from
+
+- ftp://ftp.gnu.org/pub/gnu/config/
++ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
++and
++ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+ If the version you run ($0) is already up to date, please
+ send the following data and any information you think might be
+Index: directory/c-sdk/config/autoconf/config.sub
+===================================================================
+--- directory/c-sdk/config/autoconf/config.sub (revision 15)
++++ directory/c-sdk/config/autoconf/config.sub (working copy)
+@@ -1,9 +1,10 @@
+ #! /bin/sh
+ # Configuration validation subroutine script.
+ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+-# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
++# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
++# Free Software Foundation, Inc.
+
+-timestamp='2003-02-22'
++timestamp='2009-04-17'
+
+ # This file is (in principle) common to ALL GNU software.
+ # The presence of a machine in this file suggests that SOME GNU software
+@@ -21,14 +22,15 @@
+ #
+ # You should have received a copy of the GNU General Public License
+ # along with this program; if not, write to the Free Software
+-# Foundation, Inc., 59 Temple Place - Suite 330,
+-# Boston, MA 02111-1307, USA.
+-
++# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
++# 02110-1301, USA.
++#
+ # As a special exception to the GNU General Public License, if you
+ # distribute this file as part of a program that contains a
+ # 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 . Submit a context
+ # diff and a properly formatted ChangeLog entry.
+ #
+@@ -70,8 +72,8 @@
+ version="\
+ GNU config.sub ($timestamp)
+
+-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+-Free Software Foundation, Inc.
++Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
++2002, 2003, 2004, 2005, 2006, 2007, 2008 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."
+@@ -83,11 +85,11 @@
+ while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+- echo "$timestamp" ; exit 0 ;;
++ echo "$timestamp" ; exit ;;
+ --version | -v )
+- echo "$version" ; exit 0 ;;
++ echo "$version" ; exit ;;
+ --help | --h* | -h )
+- echo "$usage"; exit 0 ;;
++ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+@@ -99,7 +101,7 @@
+ *local*)
+ # First pass through any local machine types.
+ echo $1
+- exit 0;;
++ exit ;;
+
+ * )
+ break ;;
+@@ -118,7 +120,10 @@
+ # Here we must recognize all the valid KERNEL-OS combinations.
+ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+ case $maybe_os in
+- nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
++ nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
++ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
++ kopensolaris*-gnu* | \
++ storm-chaos* | os2-emx* | rtmk-nova*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+@@ -144,7 +149,7 @@
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+- -apple | -axis)
++ -apple | -axis | -knuth | -cray)
+ os=
+ basic_machine=$1
+ ;;
+@@ -169,6 +174,10 @@
+ -hiux*)
+ os=-hiuxwe2
+ ;;
++ -sco6)
++ os=-sco5v6
++ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
++ ;;
+ -sco5)
+ os=-sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+@@ -185,6 +194,10 @@
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
++ -sco5v6*)
++ # Don't forget version if it is 3.2v4 or newer.
++ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
++ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+@@ -224,51 +237,61 @@
+ case $basic_machine in
+ # Recognize the basic CPU types without company name.
+ # Some are omitted here because they have special meanings below.
+-#### MozillaHack
+-# mips*el
+-#### End MozillaHack
+ 1750a | 580 \
+ | a29k \
+ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+- | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+- | clipper \
++ | am33_2.0 \
++ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
++ | bfin \
++ | c4x | clipper \
+ | d10v | d30v | dlx | dsp16xx \
+- | fr30 | frv \
++ | fido | fr30 | frv \
+ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | i370 | i860 | i960 | ia64 \
+- | ip2k \
+- | m32r | m68000 | m68k | m88k | mcore \
+- | mips | mipsbe | mipseb | mips*el | mipsle \
++ | ip2k | iq2000 \
++ | lm32 \
++ | m32c | m32r | m32rle | m68000 | m68k | m88k \
++ | maxq | mb | microblaze | mcore | mep | metag \
++ | mips | mipsbe | mipseb | mipsel | mipsle \
+ | mips16 \
+ | mips64 | mips64el \
++ | mips64octeon | mips64octeonel \
++ | mips64orion | mips64orionel \
++ | mips64r5900 | mips64r5900el \
+ | mips64vr | mips64vrel \
+- | mips64orion | mips64orionel \
+ | mips64vr4100 | mips64vr4100el \
+ | mips64vr4300 | mips64vr4300el \
+ | mips64vr5000 | mips64vr5000el \
++ | mips64vr5900 | mips64vr5900el \
+ | mipsisa32 | mipsisa32el \
+ | mipsisa32r2 | mipsisa32r2el \
+ | mipsisa64 | mipsisa64el \
++ | mipsisa64r2 | mipsisa64r2el \
+ | mipsisa64sb1 | mipsisa64sb1el \
+ | mipsisa64sr71k | mipsisa64sr71kel \
+ | mipstx39 | mipstx39el \
+ | mn10200 | mn10300 \
++ | moxie \
++ | mt \
+ | msp430 \
++ | nios | nios2 \
+ | ns16k | ns32k \
+- | openrisc | or32 \
++ | or32 \
+ | pdp10 | pdp11 | pj | pjl \
+ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+ | pyramid \
+- | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
++ | score \
++ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+ | sh64 | sh64le \
+- | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
+- | strongarm \
+- | tahoe | thumb | tic80 | tron \
++ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
++ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
++ | spu | strongarm \
++ | tahoe | thumb | tic4x | tic80 | tron \
+ | v850 | v850e \
+ | we32k \
+- | x86 | xscale | xstormy16 | xtensa \
+- | z8k)
++ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
++ | z8k | z80)
+ basic_machine=$basic_machine-unknown
+ ;;
+ m6811 | m68hc11 | m6812 | m68hc12)
+@@ -278,6 +301,9 @@
+ ;;
+ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+ ;;
++ ms1)
++ basic_machine=mt-unknown
++ ;;
+
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+@@ -291,64 +317,74 @@
+ exit 1
+ ;;
+ # Recognize the basic CPU types with company name.
+-#### MozillaHack
+-# mips*el
+-#### End MozillaHack
+ 580-* \
+ | a29k-* \
+ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
+- | avr-* \
+- | bs2000-* \
++ | avr-* | avr32-* \
++ | bfin-* | bs2000-* \
+ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+- | clipper-* | cydra-* \
++ | clipper-* | craynv-* | cydra-* \
+ | d10v-* | d30v-* | dlx-* \
+ | elxsi-* \
+- | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
++ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+ | h8300-* | h8500-* \
+ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+ | i*86-* | i860-* | i960-* | ia64-* \
+- | ip2k-* \
+- | m32r-* \
++ | ip2k-* | iq2000-* \
++ | lm32-* \
++ | m32c-* | m32r-* | m32rle-* \
+ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+- | m88110-* | m88k-* | mcore-* \
+- | mips-* | mipsbe-* | mipseb-* | mips*el-* | mipsle-* \
++ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
++ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+ | mips16-* \
+ | mips64-* | mips64el-* \
++ | mips64octeon-* | mips64octeonel-* \
++ | mips64orion-* | mips64orionel-* \
++ | mips64r5900-* | mips64r5900el-* \
+ | mips64vr-* | mips64vrel-* \
+- | mips64orion-* | mips64orionel-* \
+ | mips64vr4100-* | mips64vr4100el-* \
+ | mips64vr4300-* | mips64vr4300el-* \
+ | mips64vr5000-* | mips64vr5000el-* \
++ | mips64vr5900-* | mips64vr5900el-* \
+ | mipsisa32-* | mipsisa32el-* \
+ | mipsisa32r2-* | mipsisa32r2el-* \
+ | mipsisa64-* | mipsisa64el-* \
++ | mipsisa64r2-* | mipsisa64r2el-* \
+ | mipsisa64sb1-* | mipsisa64sb1el-* \
+ | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipstx39-* | mipstx39el-* \
++ | mmix-* \
++ | mt-* \
+ | msp430-* \
+- | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \
++ | nios-* | nios2-* \
++ | none-* | np1-* | ns16k-* | ns32k-* \
+ | orion-* \
+ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+ | pyramid-* \
+ | romp-* | rs6000-* \
+- | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
++ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+- | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
+- | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
++ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
++ | sparclite-* \
++ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
+ | tahoe-* | thumb-* \
+- | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
++ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
+ | tron-* \
+ | v850-* | v850e-* | vax-* \
+ | we32k-* \
+- | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
+- | xtensa-* \
++ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
++ | xstormy16-* | xtensa*-* \
+ | ymp-* \
+- | z8k-*)
++ | z8k-* | z80-*)
+ ;;
++ # Recognize the basic CPU types without company name, with glob match.
++ xtensa*)
++ basic_machine=$basic_machine-unknown
++ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 386bsd)
+@@ -365,6 +401,9 @@
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
++ abacus)
++ basic_machine=abacus-unknown
++ ;;
+ adobe68k)
+ basic_machine=m68010-adobe
+ os=-scout
+@@ -379,6 +418,12 @@
+ basic_machine=a29k-none
+ os=-bsd
+ ;;
++ amd64)
++ basic_machine=x86_64-pc
++ ;;
++ amd64-*)
++ basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
++ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ os=-sysv
+@@ -402,6 +447,10 @@
+ basic_machine=m68k-apollo
+ os=-bsd
+ ;;
++ aros)
++ basic_machine=i386-pc
++ os=-aros
++ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+@@ -410,10 +459,22 @@
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
++ blackfin)
++ basic_machine=bfin-unknown
++ os=-linux
++ ;;
++ blackfin-*)
++ basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
++ os=-linux
++ ;;
+ c90)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
++ cegcc)
++ basic_machine=arm-unknown
++ os=-cegcc
++ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+@@ -438,12 +499,27 @@
+ basic_machine=j90-cray
+ os=-unicos
+ ;;
++ craynv)
++ basic_machine=craynv-cray
++ os=-unicosmp
++ ;;
++ cr16)
++ basic_machine=cr16-unknown
++ os=-elf
++ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
++ crisv32 | crisv32-* | etraxfs*)
++ basic_machine=crisv32-axis
++ ;;
+ cris | cris-* | etrax*)
+ basic_machine=cris-axis
+ ;;
++ crx)
++ basic_machine=crx-unknown
++ os=-elf
++ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+@@ -466,6 +542,14 @@
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
++ dicos)
++ basic_machine=i686-pc
++ os=-dicos
++ ;;
++ djgpp)
++ basic_machine=i586-pc
++ os=-msdosdjgpp
++ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+@@ -616,6 +700,14 @@
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
++ m68knommu)
++ basic_machine=m68k-unknown
++ os=-linux
++ ;;
++ m68knommu-*)
++ basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
++ os=-linux
++ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+@@ -631,12 +723,10 @@
+ basic_machine=i386-pc
+ os=-mingw32
+ ;;
+-#### MozillaHack
+- i386-msvc | msvc)
+- basic_machine=i386-pc
+- os=-msvc
++ mingw32ce)
++ basic_machine=arm-unknown
++ os=-mingw32ce
+ ;;
+-#### End MozillaHack
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+@@ -650,10 +740,6 @@
+ 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
+@@ -666,6 +752,9 @@
+ basic_machine=i386-pc
+ os=-msdos
+ ;;
++ ms1-*)
++ basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
++ ;;
+ mvs)
+ basic_machine=i370-ibm
+ os=-mvs
+@@ -734,10 +823,6 @@
+ np1)
+ basic_machine=np1-gould
+ ;;
+- nv1)
+- basic_machine=nv1-cray
+- os=-unicosmp
+- ;;
+ nsr-tandem)
+ basic_machine=nsr-tandem
+ ;;
+@@ -745,10 +830,13 @@
+ basic_machine=hppa1.1-oki
+ os=-proelf
+ ;;
+- or32 | or32-*)
++ openrisc | openrisc-*)
+ basic_machine=or32-unknown
+- os=-coff
+ ;;
++ os400)
++ basic_machine=powerpc-ibm
++ os=-os400
++ ;;
+ OSE68000 | ose68000)
+ basic_machine=m68000-ericsson
+ os=-ose
+@@ -765,6 +853,14 @@
+ basic_machine=i860-intel
+ os=-osf
+ ;;
++ parisc)
++ basic_machine=hppa-unknown
++ os=-linux
++ ;;
++ parisc-*)
++ basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
++ os=-linux
++ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+@@ -774,24 +870,36 @@
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
++ pc98)
++ basic_machine=i386-pc
++ ;;
++ pc98-*)
++ basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
++ ;;
+ pentium | p5 | k5 | k6 | nexgen | viac3)
+ basic_machine=i586-pc
+ ;;
+ pentiumpro | p6 | 6x86 | athlon | athlon_*)
+ basic_machine=i686-pc
+ ;;
+- pentiumii | pentium2)
++ pentiumii | pentium2 | pentiumiii | pentium3)
+ basic_machine=i686-pc
+ ;;
++ pentium4)
++ basic_machine=i786-pc
++ ;;
+ pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumpro-* | p6-* | 6x86-* | athlon-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+- pentiumii-* | pentium2-*)
++ pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
++ pentium4-*)
++ basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
++ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+@@ -824,6 +932,10 @@
+ basic_machine=i586-unknown
+ os=-pw32
+ ;;
++ rdos)
++ basic_machine=i386-pc
++ os=-rdos
++ ;;
+ rom68k)
+ basic_machine=m68k-rom68k
+ os=-coff
+@@ -850,6 +962,14 @@
+ sb1el)
+ basic_machine=mipsisa64sb1el-unknown
+ ;;
++ sde)
++ basic_machine=mipsisa32-sde
++ os=-elf
++ ;;
++ sei)
++ basic_machine=mips-sei
++ os=-seiux
++ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+@@ -857,6 +977,12 @@
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
++ sh5el)
++ basic_machine=sh5le-unknown
++ ;;
++ sh64)
++ basic_machine=sh64-unknown
++ ;;
+ sparclite-wrs | simso-wrs)
+ basic_machine=sparclite-wrs
+ os=-vxworks
+@@ -931,10 +1057,6 @@
+ basic_machine=t90-cray
+ os=-unicos
+ ;;
+- tic4x | c4x*)
+- basic_machine=tic4x-unknown
+- os=-coff
+- ;;
+ tic54x | c54x*)
+ basic_machine=tic54x-unknown
+ os=-coff
+@@ -947,6 +1069,10 @@
+ basic_machine=tic6x-unknown
+ os=-coff
+ ;;
++ tile*)
++ basic_machine=tile-unknown
++ os=-linux-gnu
++ ;;
+ tx39)
+ basic_machine=mipstx39-unknown
+ ;;
+@@ -960,6 +1086,10 @@
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
++ tpf)
++ basic_machine=s390x-ibm
++ os=-tpf
++ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+@@ -1003,6 +1133,10 @@
+ basic_machine=hppa1.1-winbond
+ os=-proelf
+ ;;
++ xbox)
++ basic_machine=i686-pc
++ os=-mingw32
++ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+@@ -1014,6 +1148,10 @@
+ basic_machine=z8k-unknown
+ os=-sim
+ ;;
++ z80-*-coff)
++ basic_machine=z80-unknown
++ os=-sim
++ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+@@ -1033,6 +1171,9 @@
+ romp)
+ basic_machine=romp-ibm
+ ;;
++ mmix)
++ basic_machine=mmix-knuth
++ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+@@ -1049,13 +1190,10 @@
+ we32k)
+ basic_machine=we32k-att
+ ;;
+- sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
++ sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
+ basic_machine=sh-unknown
+ ;;
+- sh64)
+- basic_machine=sh64-unknown
+- ;;
+- sparc | sparcv9 | sparcv9b)
++ sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+@@ -1121,30 +1259,31 @@
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+-#### MozillaHack
+-# msvc
+-#### End MozillaHack
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
++ | -kopensolaris* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+- | -aos* \
++ | -aos* | -aros* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+- | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
+- | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
++ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
++ | -openbsd* | -solidbsd* \
++ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
++ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+- | -chorusos* | -chorusrdb* \
++ | -chorusos* | -chorusrdb* | -cegcc* \
+ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+- | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
++ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
++ | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+- | -msvc* \
+ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+- | -powermax* | -dnix*)
++ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
++ | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -qnx*)
+@@ -1162,12 +1301,15 @@
+ os=`echo $os | sed -e 's|nto|nto-qnx|'`
+ ;;
+ -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+- | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
++ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+ ;;
+ -mac*)
+ os=`echo $os | sed -e 's|mac|macos|'`
+ ;;
++ -linux-dietlibc)
++ os=-linux-dietlibc
++ ;;
+ -linux*)
+ os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ ;;
+@@ -1180,6 +1322,9 @@
+ -opened*)
+ os=-openedition
+ ;;
++ -os400*)
++ os=-os400
++ ;;
+ -wince*)
+ os=-wince
+ ;;
+@@ -1201,6 +1346,9 @@
+ -atheos*)
+ os=-atheos
+ ;;
++ -syllable*)
++ os=-syllable
++ ;;
+ -386bsd)
+ os=-bsd
+ ;;
+@@ -1223,6 +1371,9 @@
+ -sinix*)
+ os=-sysv4
+ ;;
++ -tpf*)
++ os=-tpf
++ ;;
+ -triton*)
+ os=-sysv3
+ ;;
+@@ -1259,6 +1410,12 @@
+ -kaos*)
+ os=-kaos
+ ;;
++ -zvmoe)
++ os=-zvmoe
++ ;;
++ -dicos*)
++ os=-dicos
++ ;;
+ -none)
+ ;;
+ *)
+@@ -1281,6 +1438,12 @@
+ # system, and we'll never get to this point.
+
+ case $basic_machine in
++ score-*)
++ os=-elf
++ ;;
++ spu-*)
++ os=-elf
++ ;;
+ *-acorn)
+ os=-riscix1.2
+ ;;
+@@ -1290,6 +1453,9 @@
+ arm*-semi)
+ os=-aout
+ ;;
++ c4x-* | tic4x-*)
++ os=-coff
++ ;;
+ # This must come before the *-dec entry.
+ pdp10-*)
+ os=-tops20
+@@ -1315,6 +1481,9 @@
+ m68*-cisco)
+ os=-aout
+ ;;
++ mep-*)
++ os=-elf
++ ;;
+ mips*-cisco)
+ os=-elf
+ ;;
+@@ -1333,9 +1502,15 @@
+ *-be)
+ os=-beos
+ ;;
++ *-haiku)
++ os=-haiku
++ ;;
+ *-ibm)
+ os=-aix
+ ;;
++ *-knuth)
++ os=-mmixware
++ ;;
+ *-wec)
+ os=-proelf
+ ;;
+@@ -1468,9 +1643,15 @@
+ -mvs* | -opened*)
+ vendor=ibm
+ ;;
++ -os400*)
++ vendor=ibm
++ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
++ -tpf*)
++ vendor=ibm
++ ;;
+ -vxsim* | -vxworks* | -windiss*)
+ vendor=wrs
+ ;;
+@@ -1495,7 +1676,7 @@
+ esac
+
+ echo $basic_machine$os
+-exit 0
++exit
+
+ # Local variables:
+ # eval: (add-hook 'write-file-hooks 'time-stamp)
+Index: nsprpub/build/autoconf/config.guess
+===================================================================
+--- nsprpub/build/autoconf/config.guess (revision 15)
++++ nsprpub/build/autoconf/config.guess (working copy)
+@@ -1,9 +1,10 @@
+ #! /bin/sh
+ # Attempt to guess a canonical system name.
+ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+-# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
++# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
++# Free Software Foundation, Inc.
+
+-timestamp='2005-10-13'
++timestamp='2009-04-27'
+
+ # 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
+@@ -55,8 +56,8 @@
+ GNU config.guess ($timestamp)
+
+ Originally written by Per Bothner.
+-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+-Free Software Foundation, Inc.
++Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
++2002, 2003, 2004, 2005, 2006, 2007, 2008 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."
+@@ -106,7 +107,7 @@
+ trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+ trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+ : ${TMPDIR=/tmp} ;
+- { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
++ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+@@ -160,6 +161,7 @@
+ arm*) machine=arm-unknown ;;
+ sh3el) machine=shl-unknown ;;
+ sh3eb) machine=sh-unknown ;;
++ sh5el) machine=sh5le-unknown ;;
+ *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+ esac
+ # The Operating System including object format, if it has switched
+@@ -206,8 +208,11 @@
+ *:ekkoBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+ exit ;;
++ *:SolidBSD:*:*)
++ echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
++ exit ;;
+ macppc:MirBSD:*:*)
+- echo powerppc-unknown-mirbsd${UNAME_RELEASE}
++ echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
+ *:MirBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+@@ -319,14 +324,30 @@
+ case `/usr/bin/uname -p` in
+ sparc) echo sparc-icl-nx7; exit ;;
+ esac ;;
++ s390x:SunOS:*:*)
++ echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
++ exit ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+- i86pc:SunOS:5.*:*)
+- echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
++ i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
++ eval $set_cc_for_build
++ SUN_ARCH="i386"
++ # If there is a compiler, see if it is configured for 64-bit objects.
++ # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
++ # This test works for both compilers.
++ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
++ if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
++ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
++ grep IS_64BIT_ARCH >/dev/null
++ then
++ SUN_ARCH="x86_64"
++ fi
++ fi
++ echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+@@ -527,7 +548,7 @@
+ echo rs6000-ibm-aix3.2
+ fi
+ exit ;;
+- *:AIX:*:[45])
++ *:AIX:*:[456])
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+@@ -764,20 +785,21 @@
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ exit ;;
+ *:FreeBSD:*:*)
+- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
++ case ${UNAME_MACHINE} in
++ pc98)
++ echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
++ amd64)
++ echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
++ *)
++ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
++ esac
+ exit ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin
+ exit ;;
+- i*:MINGW*:*)
++ *:MINGW*:*)
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit ;;
+-#### MozillaHack
+-# Netscape's hacked uname
+- xx:WINNT:* | xx:WIN95:*)
+- echo i586-pc-msvc
+- exit ;;
+-### End MozillaHack
+ i*:windows32*:*)
+ # uname -m includes "-pc" on this system.
+ echo ${UNAME_MACHINE}-mingw32
+@@ -785,9 +807,18 @@
+ i*:PW*:*)
+ echo ${UNAME_MACHINE}-pc-pw32
+ exit ;;
+- x86:Interix*:[34]*)
+- echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
+- exit ;;
++ *:Interix*:[3456]*)
++ case ${UNAME_MACHINE} in
++ x86)
++ echo i586-pc-interix${UNAME_RELEASE}
++ exit ;;
++ EM64T | authenticamd | genuineintel)
++ echo x86_64-unknown-interix${UNAME_RELEASE}
++ exit ;;
++ IA64)
++ echo ia64-unknown-interix${UNAME_RELEASE}
++ exit ;;
++ esac ;;
+ [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+ echo i${UNAME_MACHINE}-pc-mks
+ exit ;;
+@@ -821,6 +852,16 @@
+ echo ${UNAME_MACHINE}-pc-minix
+ exit ;;
+ arm*:Linux:*:*)
++ eval $set_cc_for_build
++ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
++ | grep -q __ARM_EABI__
++ then
++ echo ${UNAME_MACHINE}-unknown-linux-gnu
++ else
++ echo ${UNAME_MACHINE}-unknown-linux-gnueabi
++ fi
++ exit ;;
++ avr32*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ cris:Linux:*:*)
+@@ -857,7 +898,11 @@
+ #endif
+ #endif
+ EOF
+- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
++ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
++ /^CPU/{
++ s: ::g
++ p
++ }'`"
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ ;;
+ mips64:Linux:*:*)
+@@ -876,7 +921,11 @@
+ #endif
+ #endif
+ EOF
+- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
++ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
++ /^CPU/{
++ s: ::g
++ p
++ }'`"
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ ;;
+ or32:Linux:*:*)
+@@ -902,6 +951,9 @@
+ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+ exit ;;
++ padre:Linux:*:*)
++ echo sparc-unknown-linux-gnu
++ exit ;;
+ parisc:Linux:*:* | hppa:Linux:*:*)
+ # Look for CPU level
+ case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+@@ -925,9 +977,15 @@
+ sparc:Linux:*:* | sparc64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
++ vax:Linux:*:*)
++ echo ${UNAME_MACHINE}-dec-linux-gnu
++ exit ;;
+ x86_64:Linux:*:*)
+ echo x86_64-unknown-linux-gnu
+ exit ;;
++ xtensa*:Linux:*:*)
++ echo ${UNAME_MACHINE}-unknown-linux-gnu
++ exit ;;
+ 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
+@@ -946,9 +1004,6 @@
+ a.out-i386-linux)
+ echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+ exit ;;
+- coff-i386)
+- echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+- exit ;;
+ "")
+ # Either a pre-BFD a.out linker (linux-gnuoldld) or
+ # one that does not give us useful --help.
+@@ -970,7 +1025,7 @@
+ LIBC=gnulibc1
+ # endif
+ #else
+- #ifdef __INTEL_COMPILER
++ #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+ LIBC=gnu
+ #else
+ LIBC=gnuaout
+@@ -980,7 +1035,11 @@
+ LIBC=dietlibc
+ #endif
+ EOF
+- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
++ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
++ /^LIBC/{
++ s: ::g
++ p
++ }'`"
+ test x"${LIBC}" != x && {
+ echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+ exit
+@@ -1059,8 +1118,11 @@
+ 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
++ # the processor, so we play safe by assuming i586.
++ # Note: whatever this is, it MUST be the same as what config.sub
++ # prints for the "djgpp" host, or else GDB configury will decide that
++ # this is a cross-build.
++ echo i586-pc-msdosdjgpp
+ exit ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+@@ -1098,6 +1160,16 @@
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4; exit; } ;;
++ NCR*:*:4.2:* | MPRAS*:*:4.2:*)
++ OS_REL='.3'
++ test -r /etc/.relid \
++ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
++ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
++ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
++ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
++ && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
++ /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
++ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+@@ -1134,16 +1206,6 @@
+ # says
+ echo i586-unisys-sysv4
+ exit ;;
+-#### 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 ;;
+-#### End MozillaHack
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes .
+ # How about differentiating between stratus architectures? -djm
+@@ -1183,6 +1245,9 @@
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ echo i586-pc-beos
+ exit ;;
++ BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
++ echo i586-pc-haiku
++ exit ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux${UNAME_RELEASE}
+ exit ;;
+@@ -1192,6 +1257,15 @@
+ SX-6:SUPER-UX:*:*)
+ echo sx6-nec-superux${UNAME_RELEASE}
+ exit ;;
++ SX-7:SUPER-UX:*:*)
++ echo sx7-nec-superux${UNAME_RELEASE}
++ exit ;;
++ SX-8:SUPER-UX:*:*)
++ echo sx8-nec-superux${UNAME_RELEASE}
++ exit ;;
++ SX-8R:SUPER-UX:*:*)
++ echo sx8r-nec-superux${UNAME_RELEASE}
++ exit ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ exit ;;
+@@ -1279,6 +1353,12 @@
+ i*86:skyos:*:*)
+ echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+ exit ;;
++ i*86:rdos:*:*)
++ echo ${UNAME_MACHINE}-pc-rdos
++ exit ;;
++ i*86:AROS:*:*)
++ echo ${UNAME_MACHINE}-pc-aros
++ exit ;;
+ esac
+
+ #echo '(No uname command or uname output not recognized.)' 1>&2
+@@ -1439,9 +1519,9 @@
+ the operating system you are using. It is advised that you
+ download the most up to date version of the config scripts from
+
+- http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
++ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+ and
+- http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
++ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+ If the version you run ($0) is already up to date, please
+ send the following data and any information you think might be
+Index: nsprpub/build/autoconf/config.sub
+===================================================================
+--- nsprpub/build/autoconf/config.sub (revision 15)
++++ nsprpub/build/autoconf/config.sub (working copy)
+@@ -1,9 +1,10 @@
+ #! /bin/sh
+ # Configuration validation subroutine script.
+ # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+-# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
++# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
++# Free Software Foundation, Inc.
+
+-timestamp='2005-10-13'
++timestamp='2009-04-17'
+
+ # This file is (in principle) common to ALL GNU software.
+ # The presence of a machine in this file suggests that SOME GNU software
+@@ -71,8 +72,8 @@
+ version="\
+ GNU config.sub ($timestamp)
+
+-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+-Free Software Foundation, Inc.
++Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
++2002, 2003, 2004, 2005, 2006, 2007, 2008 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."
+@@ -119,8 +120,10 @@
+ # Here we must recognize all the valid KERNEL-OS combinations.
+ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+ case $maybe_os in
+- nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
+- kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
++ nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
++ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
++ kopensolaris*-gnu* | \
++ storm-chaos* | os2-emx* | rtmk-nova*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+@@ -171,6 +174,10 @@
+ -hiux*)
+ os=-hiuxwe2
+ ;;
++ -sco6)
++ os=-sco5v6
++ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
++ ;;
+ -sco5)
+ os=-sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+@@ -187,6 +194,10 @@
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
++ -sco5v6*)
++ # Don't forget version if it is 3.2v4 or newer.
++ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
++ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+@@ -226,28 +237,29 @@
+ case $basic_machine in
+ # Recognize the basic CPU types without company name.
+ # Some are omitted here because they have special meanings below.
+-#### MozillaHack
+-# mips*el
+-#### End MozillaHack
+ 1750a | 580 \
+ | a29k \
+ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+ | am33_2.0 \
+- | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
++ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+ | bfin \
+ | c4x | clipper \
+ | d10v | d30v | dlx | dsp16xx \
+- | fr30 | frv \
++ | fido | fr30 | frv \
+ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | i370 | i860 | i960 | ia64 \
+ | ip2k | iq2000 \
+- | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
+- | mips | mipsbe | mipseb | mips*el | mipsle \
++ | lm32 \
++ | m32c | m32r | m32rle | m68000 | m68k | m88k \
++ | maxq | mb | microblaze | mcore | mep | metag \
++ | mips | mipsbe | mipseb | mipsel | mipsle \
+ | mips16 \
+ | mips64 | mips64el \
++ | mips64octeon | mips64octeonel \
++ | mips64orion | mips64orionel \
++ | mips64r5900 | mips64r5900el \
+ | mips64vr | mips64vrel \
+- | mips64orion | mips64orionel \
+ | mips64vr4100 | mips64vr4100el \
+ | mips64vr4300 | mips64vr4300el \
+ | mips64vr5000 | mips64vr5000el \
+@@ -260,28 +272,28 @@
+ | mipsisa64sr71k | mipsisa64sr71kel \
+ | mipstx39 | mipstx39el \
+ | mn10200 | mn10300 \
+- | ms1 \
++ | moxie \
++ | mt \
+ | msp430 \
++ | nios | nios2 \
+ | ns16k | ns32k \
+ | or32 \
+ | pdp10 | pdp11 | pj | pjl \
+ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+ | pyramid \
+- | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
++ | score \
++ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+ | sh64 | sh64le \
+- | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
+- | sparcv8 | sparcv9 | sparcv9b \
+- | strongarm \
++ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
++ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
++ | spu | strongarm \
+ | tahoe | thumb | tic4x | tic80 | tron \
+ | v850 | v850e \
+ | we32k \
+- | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
+- | z8k)
++ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
++ | z8k | z80)
+ basic_machine=$basic_machine-unknown
+ ;;
+- m32c)
+- basic_machine=$basic_machine-unknown
+- ;;
+ m6811 | m68hc11 | m6812 | m68hc12)
+ # Motorola 68HC11/12.
+ basic_machine=$basic_machine-unknown
+@@ -289,6 +301,9 @@
+ ;;
+ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+ ;;
++ ms1)
++ basic_machine=mt-unknown
++ ;;
+
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+@@ -302,34 +317,34 @@
+ exit 1
+ ;;
+ # Recognize the basic CPU types with company name.
+-#### MozillaHack
+-# mips*el
+-#### End MozillaHack
+ 580-* \
+ | a29k-* \
+ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
+- | avr-* \
++ | avr-* | avr32-* \
+ | bfin-* | bs2000-* \
+ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+ | clipper-* | craynv-* | cydra-* \
+ | d10v-* | d30v-* | dlx-* \
+ | elxsi-* \
+- | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
++ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+ | h8300-* | h8500-* \
+ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+ | i*86-* | i860-* | i960-* | ia64-* \
+ | ip2k-* | iq2000-* \
+- | m32r-* | m32rle-* \
++ | lm32-* \
++ | m32c-* | m32r-* | m32rle-* \
+ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+- | m88110-* | m88k-* | maxq-* | mcore-* \
+- | mips-* | mipsbe-* | mipseb-* | mips*el-* | mipsle-* \
++ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
++ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+ | mips16-* \
+ | mips64-* | mips64el-* \
++ | mips64octeon-* | mips64octeonel-* \
++ | mips64orion-* | mips64orionel-* \
++ | mips64r5900-* | mips64r5900el-* \
+ | mips64vr-* | mips64vrel-* \
+- | mips64orion-* | mips64orionel-* \
+ | mips64vr4100-* | mips64vr4100el-* \
+ | mips64vr4300-* | mips64vr4300el-* \
+ | mips64vr5000-* | mips64vr5000el-* \
+@@ -342,30 +357,33 @@
+ | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipstx39-* | mipstx39el-* \
+ | mmix-* \
+- | ms1-* \
++ | mt-* \
+ | msp430-* \
++ | nios-* | nios2-* \
+ | none-* | np1-* | ns16k-* | ns32k-* \
+ | orion-* \
+ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+ | pyramid-* \
+ | romp-* | rs6000-* \
+- | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
++ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+- | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
++ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+ | sparclite-* \
+- | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
++ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
+ | tahoe-* | thumb-* \
+- | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
++ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
+ | tron-* \
+ | v850-* | v850e-* | vax-* \
+ | we32k-* \
+- | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
+- | xstormy16-* | xtensa-* \
++ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
++ | xstormy16-* | xtensa*-* \
+ | ymp-* \
+- | z8k-*)
++ | z8k-* | z80-*)
+ ;;
+- m32c-*)
++ # Recognize the basic CPU types without company name, with glob match.
++ xtensa*)
++ basic_machine=$basic_machine-unknown
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+@@ -429,6 +447,10 @@
+ basic_machine=m68k-apollo
+ os=-bsd
+ ;;
++ aros)
++ basic_machine=i386-pc
++ os=-aros
++ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+@@ -437,10 +459,22 @@
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
++ blackfin)
++ basic_machine=bfin-unknown
++ os=-linux
++ ;;
++ blackfin-*)
++ basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
++ os=-linux
++ ;;
+ c90)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
++ cegcc)
++ basic_machine=arm-unknown
++ os=-cegcc
++ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+@@ -469,8 +503,8 @@
+ basic_machine=craynv-cray
+ os=-unicosmp
+ ;;
+- cr16c)
+- basic_machine=cr16c-unknown
++ cr16)
++ basic_machine=cr16-unknown
+ os=-elf
+ ;;
+ crds | unos)
+@@ -508,6 +542,10 @@
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
++ dicos)
++ basic_machine=i686-pc
++ os=-dicos
++ ;;
+ djgpp)
+ basic_machine=i586-pc
+ os=-msdosdjgpp
+@@ -662,6 +700,14 @@
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
++ m68knommu)
++ basic_machine=m68k-unknown
++ os=-linux
++ ;;
++ m68knommu-*)
++ basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
++ os=-linux
++ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+@@ -677,12 +723,10 @@
+ basic_machine=i386-pc
+ os=-mingw32
+ ;;
+-#### MozillaHack
+- i386-msvc | msvc)
+- basic_machine=i386-pc
+- os=-msvc
++ mingw32ce)
++ basic_machine=arm-unknown
++ os=-mingw32ce
+ ;;
+-#### End MozillaHack
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+@@ -708,6 +752,9 @@
+ basic_machine=i386-pc
+ os=-msdos
+ ;;
++ ms1-*)
++ basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
++ ;;
+ mvs)
+ basic_machine=i370-ibm
+ os=-mvs
+@@ -806,6 +853,14 @@
+ basic_machine=i860-intel
+ os=-osf
+ ;;
++ parisc)
++ basic_machine=hppa-unknown
++ os=-linux
++ ;;
++ parisc-*)
++ basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
++ os=-linux
++ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+@@ -815,6 +870,12 @@
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
++ pc98)
++ basic_machine=i386-pc
++ ;;
++ pc98-*)
++ basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
++ ;;
+ pentium | p5 | k5 | k6 | nexgen | viac3)
+ basic_machine=i586-pc
+ ;;
+@@ -871,6 +932,10 @@
+ basic_machine=i586-unknown
+ os=-pw32
+ ;;
++ rdos)
++ basic_machine=i386-pc
++ os=-rdos
++ ;;
+ rom68k)
+ basic_machine=m68k-rom68k
+ os=-coff
+@@ -897,6 +962,10 @@
+ sb1el)
+ basic_machine=mipsisa64sb1el-unknown
+ ;;
++ sde)
++ basic_machine=mipsisa32-sde
++ os=-elf
++ ;;
+ sei)
+ basic_machine=mips-sei
+ os=-seiux
+@@ -908,6 +977,9 @@
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
++ sh5el)
++ basic_machine=sh5le-unknown
++ ;;
+ sh64)
+ basic_machine=sh64-unknown
+ ;;
+@@ -997,6 +1069,10 @@
+ basic_machine=tic6x-unknown
+ os=-coff
+ ;;
++ tile*)
++ basic_machine=tile-unknown
++ os=-linux-gnu
++ ;;
+ tx39)
+ basic_machine=mipstx39-unknown
+ ;;
+@@ -1072,6 +1148,10 @@
+ basic_machine=z8k-unknown
+ os=-sim
+ ;;
++ z80-*-coff)
++ basic_machine=z80-unknown
++ os=-sim
++ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+@@ -1110,10 +1190,10 @@
+ we32k)
+ basic_machine=we32k-att
+ ;;
+- sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
++ sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
+ basic_machine=sh-unknown
+ ;;
+- sparc | sparcv8 | sparcv9 | sparcv9b)
++ sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+@@ -1179,32 +1259,31 @@
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+-#### MozillaHack
+-# msvc
+-#### End MozillaHack
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
++ | -kopensolaris* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+- | -aos* \
++ | -aos* | -aros* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+- | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
++ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
++ | -openbsd* | -solidbsd* \
+ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+- | -chorusos* | -chorusrdb* \
++ | -chorusos* | -chorusrdb* | -cegcc* \
+ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+- | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
++ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
++ | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+- | -msvc* \
+ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+- | -skyos* | -haiku*)
++ | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -qnx*)
+@@ -1334,6 +1413,9 @@
+ -zvmoe)
+ os=-zvmoe
+ ;;
++ -dicos*)
++ os=-dicos
++ ;;
+ -none)
+ ;;
+ *)
+@@ -1356,6 +1438,12 @@
+ # system, and we'll never get to this point.
+
+ case $basic_machine in
++ score-*)
++ os=-elf
++ ;;
++ spu-*)
++ os=-elf
++ ;;
+ *-acorn)
+ os=-riscix1.2
+ ;;
+@@ -1365,9 +1453,9 @@
+ arm*-semi)
+ os=-aout
+ ;;
+- c4x-* | tic4x-*)
+- os=-coff
+- ;;
++ c4x-* | tic4x-*)
++ os=-coff
++ ;;
+ # This must come before the *-dec entry.
+ pdp10-*)
+ os=-tops20
+@@ -1393,6 +1481,9 @@
+ m68*-cisco)
+ os=-aout
+ ;;
++ mep-*)
++ os=-elf
++ ;;
+ mips*-cisco)
+ os=-elf
+ ;;
diff --git a/www-client/mozilla-firefox/patches/2009-09-27/r02-configure-in-withGCC4andCrossCompile.patch b/www-client/mozilla-firefox/patches/2009-09-27/r02-configure-in-withGCC4andCrossCompile.patch
new file mode 100644
index 000000000..9830771ab
--- /dev/null
+++ b/www-client/mozilla-firefox/patches/2009-09-27/r02-configure-in-withGCC4andCrossCompile.patch
@@ -0,0 +1,362 @@
+Index: configure.in
+===================================================================
+--- configure.in (revision 7)
++++ configure.in (working copy)
+@@ -880,11 +880,17 @@
+ OS_RELEASE=
+ OS_TEST="${target_cpu}"
+ case "${target_os}" in
+- linux*) OS_ARCH=Linux ;;
+- solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
+- mingw*) OS_ARCH=WINNT ;;
+- wince*) OS_ARCH=WINCE ;;
+- darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
++ linux*) OS_ARCH=Linux ;;
++ solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
++ mingw*) OS_ARCH=WINNT ;;
++ wince*) OS_ARCH=WINCE ;;
++ darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
++ beos* | haiku*) OS_ARCH=BeOS OS_TARGET=BeOS ;;
++dnl -------------------------------------------------------
++dnl Cross-compiling-haiku - This should probably be
++dnl beos*) OS_ARCH=BeOS OS_TARGET=BeOS ;;
++dnl haiku*) OS_ARCH=Haiku OS_TARGET=Haiku ;;
++dnl -------------------------------------------------------
+ esac
+ else
+ OS_TARGET=`uname -s`
+@@ -1002,6 +1008,14 @@
+ UnixWare)
+ HOST_OS_ARCH=UNIXWARE
+ ;;
++beos* | haiku*)
++ HOST_OS_ARCH=BeOS
++ ;;
++dnl -------------------------------------------------------
++dnl This should probably be
++dnl beos*) HOST_OS_ARCH=BeOS ;;
++dnl haiku*) HOST_OS_ARCH=Haiku ;;
++dnl -------------------------------------------------------
+ esac
+
+ case "$OS_ARCH" in
+@@ -1338,7 +1352,7 @@
+ dnl System overrides of the defaults for host
+ dnl ========================================================
+ case "$host" in
+-*-beos*)
++*-beos*|*-haiku*)
+ HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
+ HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
+ HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
+@@ -1482,17 +1496,35 @@
+ AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
+ ;;
+
+-*-beos*)
++*-beos*|*-haiku*)
+ no_x=yes
+- MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
+ _PLATFORM_DEFAULT_TOOLKIT="beos"
++ TARGET_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
++ TARGET_MD_ARCH=beos
++
++ DSO_PIC_CFLAGS=-fPIC
+ DSO_LDOPTS='-nostart'
++ MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
++ MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
+ TK_LIBS='-lbe -lroot'
+ LIBS="$LIBS -lbe"
++
++ _HAIKU_BUILD=0
++
+ if test "$COMPILE_ENVIRONMENT"; then
++ AC_CHECK_LIB(network,main,_HAIKU_BUILD=1)
++ fi
++ if test "$_HAIKU_BUILD" = 1; then
++ LIBS="$LIBS -lnetwork"
++ AC_DEFINE(XP_HAIKU)
++ AC_DEFINE(__BEOS__)
++ AC_DEFINE(BONE_VERSION)
++ else
+ AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
+ AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
++ AC_DEFINE(BEOS_ADDON_WORKAROUND)
+ fi
++
+ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
+ _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
+ _MOZ_USE_RTTI=1
+@@ -2692,8 +2724,10 @@
+ ])
+ if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
+ "$ac_cv_have_visibility_class_bug" = "no"; then
+- VISIBILITY_FLAGS='-I$(DIST)/include/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
+- WRAP_SYSTEM_INCLUDES=1
++ # HACK for Haiku GCC4 -- enforce '-fvisibility=hidden'
++ #VISIBILITY_FLAGS='-I$(DIST)/include/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
++ #WRAP_SYSTEM_INCLUDES=1
++ VISIBILITY_FLAGS='-fvisibility=hidden'
+ else
+ VISIBILITY_FLAGS='-fvisibility=hidden'
+ fi # have visibility pragma bug
+@@ -2761,6 +2795,8 @@
+ case $target in
+ *-darwin*)
+ ;;
++*-beos*|*-haiku*)
++ ;;
+ *)
+ AC_CHECK_LIB(dl, dlopen,
+ AC_CHECK_HEADER(dlfcn.h,
+@@ -3125,7 +3161,7 @@
+ fi
+
+ case $target_os in
+- os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*)
++ os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|beos*|haiku*)
+ ;;
+ *)
+
+@@ -5242,7 +5278,7 @@
+ dnl Image decoders
+ dnl ========================================================
+ case "$target_os" in
+-cygwin*|mingw*|msvc*|mks*|os2*|wince*|beos*)
++cygwin*|mingw*|msvc*|mks*|os2*|wince*|beos*|haiku*)
+ MOZ_IMG_DECODERS_DEFAULT="$MOZ_IMG_DECODERS_DEFAULT icon"
+ ;;
+ darwin*)
+@@ -5689,7 +5725,7 @@
+
+ MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG"
+ case "${target_os}" in
+- beos*)
++ beos*|haiku*)
+ MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
+ ;;
+ msvc*|mks*|cygwin*|mingw*|os2*|wince*)
+@@ -6725,7 +6761,7 @@
+ os2*)
+ MOZ_LIBART_LIBS='-lmoz_art -lm'
+ ;;
+- beos*)
++ beos*|haiku*)
+ MOZ_LIBART_LIBS='-lmoz_art_lgpl -lroot -lbe'
+ ;;
+ *)
+@@ -7377,6 +7413,9 @@
+ elif test "$OS_ARCH" = "BeOS"; then
+ AC_DEFINE(XP_BEOS)
+ MOZ_MOVEMAIL=1
++elif test "$OS_ARCH" = "Haiku"; then
++ AC_DEFINE(XP_BEOS)
++ MOZ_MOVEMAIL=1
+ elif test "$OS_ARCH" = "Darwin"; then
+ AC_DEFINE(XP_UNIX)
+ AC_DEFINE(UNIX_ASYNC_DNS)
+Index: directory/c-sdk/configure.in
+===================================================================
+--- directory/c-sdk/configure.in (revision 7)
++++ directory/c-sdk/configure.in (working copy)
+@@ -360,7 +360,7 @@
+ AC_DEFINE(DEBUG)
+ DEFINES="$DEFINES -UNDEBUG"
+ case "${target_os}" in
+- beos*)
++ beos*|haiku*)
+ DEFINES="$DEFINES -DDEBUG_${USER}"
+ ;;
+ msvc*|mks*|cygwin*|mingw*|os2*)
+@@ -563,10 +563,16 @@
+ OS_RELEASE=
+ OS_TEST="${target_cpu}"
+ case "${target_os}" in
+- linux*) OS_ARCH=Linux ;;
+- solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
+- mingw*) OS_ARCH=WINNT ;;
+- darwin*) OS_ARCH=Darwin ;;
++ linux*) OS_ARCH=Linux ;;
++ solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
++ mingw*) OS_ARCH=WINNT ;;
++ darwin*) OS_ARCH=Darwin ;;
++ beos* | haiku*) OS_ARCH=BeOS OS_TARGET=BeOS ;;
++dnl -------------------------------------------------------
++dnl Cross-compiling-haiku - This should probably be
++dnl beos*) OS_ARCH=BeOS OS_TARGET=BeOS ;;
++dnl haiku*) OS_ARCH=Haiku OS_TARGET=Haiku ;;
++dnl -------------------------------------------------------
+ esac
+ else
+ OS_ARCH=`uname -s | sed -e 's|/|_|g'`
+@@ -733,7 +739,7 @@
+ fi
+ WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
+ ;;
+-*-beos*)
++*-beos*|*-haiku*)
+ HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE"
+ ;;
+ *os2*)
+@@ -812,24 +818,40 @@
+ RESOLVE_LINK_SYMBOLS=1
+ ;;
+
+-*-beos*)
++*-beos*|*-haiku*)
+ AC_DEFINE(XP_BEOS)
+ AC_DEFINE(BeOS)
+ AC_DEFINE(BEOS)
+ AC_DEFINE(_POSIX_SOURCE)
++ DSO_CFLAGS=-fPIC
+ DSO_LDOPTS=-nostart
++
+ MDCPUCFG_H=_beos.cfg
+ USE_BTHREADS=1
+ PR_MD_ARCH_DIR=beos
+ RESOLVE_LINK_SYMBOLS=1
++
++ _HAIKU_BUILD=0
++ AC_CHECK_LIB(network,main,_HAIKU_BUILD=1)
++ if test "$_HAIKU_BUILD" = 1; then
++ OS_LIBS="$OS_LIBS -lnetwork"
++ AC_DEFINE(XP_HAIKU)
++ AC_DEFINE(BONE_VERSION)
++ else
++ AC_CHECK_LIB(bind, gethostbyaddr, [OS_LIBS="$OS_LIBS -lbind -lsocket"])
++ fi
++
+ case "${target_cpu}" in
+ i*86)
+- _OPTIMIZE_FLAGS=-O2
+- _DEBUG_FLAGS='-gdwarf-2 -O0'
+- MKSHLIB='$(CCC) $(DSO_LDOPTS) -o $@'
+- AC_CHECK_LIB(bind, gethostbyaddr, [OS_LIBS="$OS_LIBS -lbind -lsocket"])
++ AC_DEFINE(i586)
++ CPU_ARCH=i586
++ _OPTIMIZE_FLAGS=-O3
++ _DEBUG_FLAGS='-gdwarf-2 -O0 -fno-inline'
++ MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
+ ;;
+ powerpc)
++ AC_DEFINE(ppc)
++ CPU_ARCH=ppc
+ CC=mwcc
+ CCC=mwcc
+ LD=mwld
+@@ -2095,7 +2117,7 @@
+ fi])
+
+ case "$target" in
+-*-beos*)
++*-beos*|*-haiku*)
+ AC_ARG_WITH(bthreads,
+ [ --with-bthreads Use system bthreads library as thread subsystem (BeOS only)],
+ [ if test "$withval" = "yes"; then
+Index: nsprpub/configure.in
+===================================================================
+--- nsprpub/configure.in (revision 7)
++++ nsprpub/configure.in (working copy)
+@@ -381,7 +381,7 @@
+ DEFINES="$DEFINES -UNDEBUG"
+
+ case "${target_os}" in
+- beos*)
++ beos*|haiku*)
+ DEFINES="$DEFINES -DDEBUG_${USER}"
+ ;;
+ msvc*|mks*|cygwin*|mingw*|os2*)
+@@ -652,6 +652,12 @@
+ solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
+ mingw*) OS_ARCH=WINNT ;;
+ darwin*) OS_ARCH=Darwin ;;
++ beos*|haiku*) OS_ARCH=BeOS OS_TARGET=BeOS OS_RELEASE=R5 ;;
++dnl -------------------------------------------------------
++dnl Cross-compiling-haiku - This should probably be
++dnl beos*) OS_ARCH=BeOS OS_TARGET=BeOS OS_RELEASE=R5 ;;
++dnl haiku*) OS_ARCH=Haiku OS_TARGET=Haiku OS_RELEASE=R1 ;;
++dnl -------------------------------------------------------
+ esac
+ else
+ OS_ARCH=`uname -s | sed -e 's|/|_|g'`
+@@ -823,7 +829,7 @@
+ CYGWIN_WRAPPER='sh $(topsrcdir)/build/cygwin-wrapper'
+ fi
+ ;;
+-*-beos*)
++*-beos*|*-haiku*)
+ HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE"
+ ;;
+ *os2*)
+@@ -898,24 +904,40 @@
+ RESOLVE_LINK_SYMBOLS=1
+ ;;
+
+-*-beos*)
++*-beos*|*-haiku*)
+ AC_DEFINE(XP_BEOS)
+ AC_DEFINE(BeOS)
+ AC_DEFINE(BEOS)
+ AC_DEFINE(_POSIX_SOURCE)
+- DSO_LDOPTS=-nostart
++ DSO_CFLAGS=-fPIC
++ DSO_LDOPTS='-nostart'
++
+ MDCPUCFG_H=_beos.cfg
+ USE_BTHREADS=1
+ PR_MD_ARCH_DIR=beos
+ RESOLVE_LINK_SYMBOLS=1
++
++ _HAIKU_BUILD=0
++ AC_CHECK_LIB(network,main,_HAIKU_BUILD=1)
++ if test "$_HAIKU_BUILD" = 1; then
++ OS_LIBS="$OS_LIBS -lnetwork"
++ AC_DEFINE(XP_HAIKU)
++ AC_DEFINE(BONE_VERSION)
++ else
++ AC_CHECK_LIB(bind, gethostbyaddr, [OS_LIBS="$OS_LIBS -lbind -lsocket"])
++ fi
++
+ case "${target_cpu}" in
+ i*86)
+- _OPTIMIZE_FLAGS=-O2
+- _DEBUG_FLAGS='-gdwarf-2 -O0'
+- MKSHLIB='$(CCC) $(DSO_LDOPTS) -o $@'
+- AC_CHECK_LIB(bind, gethostbyaddr, [OS_LIBS="$OS_LIBS -lbind -lsocket"])
++ AC_DEFINE(i586)
++ CPU_ARCH=i586
++ _OPTIMIZE_FLAGS=-O3
++ _DEBUG_FLAGS='-gdwarf-2 -O0 -fno-inline'
++ MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
+ ;;
+ powerpc)
++ AC_DEFINE(ppc)
++ CPU_ARCH=ppc
+ CC=mwcc
+ CCC=mwcc
+ LD=mwld
+@@ -2245,11 +2267,13 @@
+
+ dnl We don't want anything to link with libdl even if it's present on OS X,
+ dnl since it's not used and not part of the default installation.
+-dnl The same goes for BeOS.
++dnl The same goes for BeOS and Haiku.
+
+ case $target in
+-*-darwin*|*-beos*)
++*-darwin*)
+ ;;
++*-beos*|*-haiku*)
++ ;;
+ *)
+ AC_CHECK_LIB(dl, dlopen,
+ AC_CHECK_HEADER(dlfcn.h,
+@@ -2438,7 +2462,7 @@
+ fi])
+
+ case "$target" in
+-*-beos*)
++*-beos*|*-haiku*)
+ AC_ARG_WITH(bthreads,
+ [ --with-bthreads Use system bthreads library as thread subsystem
+ (BeOS only)],
diff --git a/www-client/mozilla-firefox/patches/2009-09-27/r03a-makefile-in.patch b/www-client/mozilla-firefox/patches/2009-09-27/r03a-makefile-in.patch
new file mode 100644
index 000000000..4c7d35333
--- /dev/null
+++ b/www-client/mozilla-firefox/patches/2009-09-27/r03a-makefile-in.patch
@@ -0,0 +1,375 @@
+Index: browser/app/Makefile.in
+===================================================================
+--- browser/app/Makefile.in (revision 7)
++++ browser/app/Makefile.in (working copy)
+@@ -151,7 +151,7 @@
+ endif
+ endif
+
+-ifeq ($(OS_ARCH),BeOS)
++ifeq (,$(filter-out BeOS Haiku, $(OS_ARCH)))
+ BEOS_PROGRAM_RESOURCE = $(srcdir)/apprunner-beos.rsrc
+ ifdef BUILD_STATIC_LIBS
+ OS_LIBS += -ltracker -lgame
+Index: browser/components/migration/src/Makefile.in
+===================================================================
+--- browser/components/migration/src/Makefile.in (revision 7)
++++ browser/components/migration/src/Makefile.in (working copy)
+@@ -78,7 +78,7 @@
+ nsPhoenixProfileMigrator.cpp \
+ $(NULL)
+
+-ifneq ($(OS_ARCH),BeOS)
++ifneq (,$(filter-out BeOS Haiku, $(OS_ARCH)))
+ CPPSRCS += nsDogbertProfileMigrator.cpp
+ endif
+
+Index: calendar/libical/src/libical/Makefile.in
+===================================================================
+--- calendar/libical/src/libical/Makefile.in (revision 7)
++++ calendar/libical/src/libical/Makefile.in (working copy)
+@@ -89,7 +89,7 @@
+
+ DEFINES += -DHAVE_CONFIG_H
+
+-ifneq (,$(filter BeOS Darwin OpenVMS NetBSD FreeBSD,$(OS_ARCH)))
++ifneq (,$(filter BeOS Haiku Darwin OpenVMS NetBSD FreeBSD,$(OS_ARCH)))
+ DEFINES += -D__USE_BSD=1
+ endif
+
+Index: calendar/sunbird/app/Makefile.in
+===================================================================
+--- calendar/sunbird/app/Makefile.in (revision 7)
++++ calendar/sunbird/app/Makefile.in (working copy)
+@@ -194,7 +194,8 @@
+ endif
+ endif
+
+-ifeq ($(OS_ARCH),BeOS)
++ifeq (,$(filter-out BeOS Haiku, $(OS_ARCH)))
++BEOS_PROGRAM_RESOURCE = $(srcdir)/apprunner-beos.rsrc
+ ifdef BUILD_STATIC_LIBS
+ OS_LIBS += -ltracker -lgame
+ endif
+Index: directory/c-sdk/ldap/libraries/libldap/Makefile.in
+===================================================================
+--- directory/c-sdk/ldap/libraries/libldap/Makefile.in (revision 7)
++++ directory/c-sdk/ldap/libraries/libldap/Makefile.in (working copy)
+@@ -237,7 +237,7 @@
+ SHARED_LIBRARY_LIBS = $(dist_libdir)/lib$(LBER_LIBNAME).a
+ endif
+
+-ifeq ($(OS_ARCH), BeOS)
++ifeq (,$(filter-out BeOS Haiku, $(OS_ARCH)))
+ EXTRA_LIBS = -L$(dist_libdir) -l$(LBER_LIBNAME) -lbe
+ endif
+
+@@ -302,7 +302,7 @@
+ ifdef SO_FILES_TO_REMOVE
+ -$(RM) $(SO_FILES_TO_REMOVE)
+ endif
+-ifneq (,$(filter AIX Linux HP-UX Darwin BeOS QNX NetBSD OSF1 OpenBSD, $(OS_ARCH)))
++ifneq (,$(filter AIX Linux HP-UX Darwin BeOS Haiku QNX NetBSD OSF1 OpenBSD, $(OS_ARCH)))
+ $(LINK_LIB) ../liblber/$(OBJDIR_NAME)/*.a
+ else
+ ifeq ($(OS_ARCH),OS2)
+Index: directory/c-sdk/ldap/libraries/libprldap/Makefile.in
+===================================================================
+--- directory/c-sdk/ldap/libraries/libprldap/Makefile.in (revision 7)
++++ directory/c-sdk/ldap/libraries/libprldap/Makefile.in (working copy)
+@@ -165,7 +165,7 @@
+ EXTRA_LIBS += -L$(dist_libdir) $(DYNAMICNSPR)
+ endif
+
+-ifeq ($(OS_ARCH), BeOS)
++ifeq (,$(filter-out BeOS Haiku, $(OS_ARCH)))
+ EXTRA_LIBS = -L$(dist_libdir) -l$(LDAP_LIBNAME)
+ EXTRA_LIBS += -L$(dist_libdir) $(DYNAMICNSPR)
+ endif
+Index: directory/c-sdk/ldap/libraries/libssldap/Makefile
+===================================================================
+--- directory/c-sdk/ldap/libraries/libssldap/Makefile (revision 7)
++++ directory/c-sdk/ldap/libraries/libssldap/Makefile (working copy)
+@@ -167,7 +167,7 @@
+ EXTRA_LIBS += $(OS_LIBS)
+ endif
+
+-ifeq ($(OS_ARCH), BeOS)
++ifeq (,$(filter-out BeOS Haiku, $(OS_ARCH)))
+ EXTRA_LIBS = -L$(dist_libdir) -l$(LDAP_LIBNAME) -l$(PRLDAP_LIBNAME)
+ ifeq ($(NSS_DYNAMIC_SOFTOKN),1)
+ EXTRA_LIBS += -l$(SOFTOKN_LIBNAME)
+Index: directory/c-sdk/ldap/libraries/libssldap/Makefile.in
+===================================================================
+--- directory/c-sdk/ldap/libraries/libssldap/Makefile.in (revision 7)
++++ directory/c-sdk/ldap/libraries/libssldap/Makefile.in (working copy)
+@@ -182,7 +182,7 @@
+ EXTRA_LIBS += $(OS_LIBS)
+ endif
+
+-ifeq ($(OS_ARCH), BeOS)
++ifeq (,$(filter-out BeOS Haiku, $(OS_ARCH)))
+ EXTRA_LIBS = -L$(dist_libdir) -l$(LDAP_LIBNAME) -l$(PRLDAP_LIBNAME)
+ ifeq ($(NSS_DYNAMIC_SOFTOKN),1)
+ EXTRA_LIBS += -l$(SOFTOKN_LIBNAME)
+Index: embedding/componentlib/Makefile.in
+===================================================================
+--- embedding/componentlib/Makefile.in (revision 7)
++++ embedding/componentlib/Makefile.in (working copy)
+@@ -152,7 +152,7 @@
+ OS_LIBS += ole32.lib shell32.lib
+ endif
+
+-ifeq ($(OS_ARCH),BeOS)
++ifeq (,$(filter-out BeOS Haiku, $(OS_ARCH)))
+ OS_LIBS += -ltracker
+ endif
+
+Index: intl/uconv/src/Makefile.in
+===================================================================
+--- intl/uconv/src/Makefile.in (revision 7)
++++ intl/uconv/src/Makefile.in (working copy)
+@@ -119,7 +119,7 @@
+ CPPSRCS += nsMacCharset.cpp
+ EXPORT_RESOURCE += maccharset.properties
+ else
+-ifeq ($(OS_ARCH),BeOS)
++ifeq (,$(filter-out BeOS Haiku, $(OS_ARCH)))
+ CPPSRCS += nsBeOSCharset.cpp
+ else
+ CPPSRCS += nsUNIXCharset.cpp
+Index: ipc/ipcd/client/src/Makefile.in
+===================================================================
+--- ipc/ipcd/client/src/Makefile.in (revision 7)
++++ ipc/ipcd/client/src/Makefile.in (working copy)
+@@ -64,7 +64,7 @@
+ ifeq ($(OS_ARCH),WINNT)
+ CPPSRCS += ipcConnectionWin.cpp
+ else
+-ifeq ($(OS_ARCH),BeOS)
++ifeq (,$(filter-out BeOS Haiku, $(OS_ARCH)))
+ CPPSRCS += ipcConnectionStub.cpp
+ else
+ CPPSRCS += ipcConnectionUnix.cpp
+Index: ipc/ipcd/daemon/src/Makefile.in
+===================================================================
+--- ipc/ipcd/daemon/src/Makefile.in (revision 7)
++++ ipc/ipcd/daemon/src/Makefile.in (working copy)
+@@ -59,7 +59,7 @@
+ ifeq ($(OS_ARCH),WINNT)
+ CPPSRCS += ipcdWin.cpp
+ else
+-ifeq ($(OS_ARCH),BeOS)
++ifeq (,$(filter-out BeOS Haiku, $(OS_ARCH)))
+ CPPSRCS += ipcdStub.cpp
+ else
+ CPPSRCS += ipcdUnix.cpp
+Index: js/src/Makefile.in
+===================================================================
+--- js/src/Makefile.in (revision 7)
++++ js/src/Makefile.in (working copy)
+@@ -246,7 +246,7 @@
+ LDFLAGS += $(pathsubst -l%,$(NSPR_STATIC_PATH)/%.a,$(NSPR_LIBS))
+
+ # BeOS and HP-UX do not require the extra linking of "-lm"
+-ifeq (,$(filter BeOS HP-UX WINNT WINCE OpenVMS,$(OS_ARCH)))
++ifeq (,$(filter BeOS Haiku HP-UX WINNT WINCE OpenVMS,$(OS_ARCH)))
+ LDFLAGS += -lm
+ endif
+
+Index: mail/app/Makefile.in
+===================================================================
+--- mail/app/Makefile.in (revision 7)
++++ mail/app/Makefile.in (working copy)
+@@ -149,7 +149,7 @@
+ endif
+ endif
+
+-ifeq ($(OS_ARCH),BeOS)
++ifeq (,$(filter-out BeOS Haiku, $(OS_ARCH)))
+ BEOS_PROGRAM_RESOURCE = $(srcdir)/apprunner-beos.rsrc
+ ifdef BUILD_STATIC_LIBS
+ OS_LIBS += -ltracker -lgame
+Index: modules/libpr0n/decoders/Makefile.in
+===================================================================
+--- modules/libpr0n/decoders/Makefile.in (revision 7)
++++ modules/libpr0n/decoders/Makefile.in (working copy)
+@@ -52,7 +52,7 @@
+ ifeq ($(OS_ARCH),OS2)
+ DIRS = icon/os2 icon
+ endif
+-ifeq ($(OS_ARCH),BeOS)
++ifeq (,$(filter-out BeOS Haiku, $(OS_ARCH)))
+ DIRS = icon/beos icon
+ endif
+ ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
+Index: modules/libpr0n/decoders/icon/Makefile.in
+===================================================================
+--- modules/libpr0n/decoders/icon/Makefile.in (revision 7)
++++ modules/libpr0n/decoders/icon/Makefile.in (working copy)
+@@ -82,7 +82,7 @@
+ PLATFORM = mac
+ endif
+
+-ifeq ($(OS_ARCH),BeOS)
++ifeq (,$(filter-out BeOS Haiku, $(OS_ARCH)))
+ PLATFORM = beos
+ endif
+
+@@ -102,7 +102,7 @@
+ ifdef MOZ_ENABLE_GNOMEUI
+ USE_ICON_DECODER = 1
+ endif
+-ifeq (,$(filter-out Darwin OS2 BeOS,$(OS_ARCH)))
++ifeq (,$(filter-out Darwin OS2 BeOS Haiku,$(OS_ARCH)))
+ USE_ICON_DECODER = 1
+ endif
+
+Index: modules/plugin/base/src/Makefile.in
+===================================================================
+--- modules/plugin/base/src/Makefile.in (revision 7)
++++ modules/plugin/base/src/Makefile.in (working copy)
+@@ -96,7 +96,7 @@
+ nsJSNPRuntime.cpp \
+ $(NULL)
+
+-ifeq ($(OS_ARCH), BeOS)
++ifeq (,$(filter-out BeOS Haiku, $(OS_ARCH)))
+ CPPSRCS += nsPluginsDirBeOS.cpp
+ CPPSRCS += nsPluginNativeWindow.cpp
+ else
+Index: modules/libreg/src/Makefile.in
+===================================================================
+--- modules/libreg/src/Makefile.in (revision 7)
++++ modules/libreg/src/Makefile.in (working copy)
+@@ -66,7 +66,7 @@
+
+ DEFINES += -DUSE_BUFFERED_REGISTRY_IO
+ # Memory mapped files are not supported under QNX, Neutrino, HP-UX and BeOS
+-#ifeq (,$(filter BeOS HP-UX QNX,$(OS_ARCH)))
++#ifeq (,$(filter BeOS Haiku HP-UX QNX,$(OS_ARCH)))
+ #CSRCS += mmapio.c
+ #DEFINES += -DUSE_MMAP_REGISTRY_IO
+ #endif
+Index: nsprpub/lib/prstreams/Makefile.in
+===================================================================
+--- nsprpub/lib/prstreams/Makefile.in (revision 7)
++++ nsprpub/lib/prstreams/Makefile.in (working copy)
+@@ -69,7 +69,7 @@
+ endif
+ endif
+
+-ifeq ($(OS_ARCH), BeOS)
++ifeq (,$(filter-out BeOS Haiku, $(OS_ARCH)))
+ CFLAGS += -frtti -fexceptions
+ endif
+
+@@ -118,7 +118,7 @@
+ endif
+ endif
+
+-ifeq ($(OS_ARCH),BeOS)
++ifeq (,$(filter-out BeOS Haiku, $(OS_ARCH)))
+ OS_LIBS = -lstdc++.r4
+ endif
+
+Index: toolkit/library/Makefile.in
+===================================================================
+--- toolkit/library/Makefile.in (revision 7)
++++ toolkit/library/Makefile.in (working copy)
+@@ -364,7 +364,7 @@
+ EXTRA_DSO_LDOPTS += $(MOZ_PANGO_LIBS)
+ endif
+
+-ifeq ($(OS_ARCH),BeOS)
++ifeq (,$(filter-out BeOS Haiku, $(OS_ARCH)))
+ EXTRA_DSO_LDOPTS += -lbe
+ endif
+
+Index: xpcom/build/Makefile.in
+===================================================================
+--- xpcom/build/Makefile.in (revision 7)
++++ xpcom/build/Makefile.in (working copy)
+@@ -173,7 +173,7 @@
+ EXTRA_DSO_LDOPTS += $(TK_LIBS)
+ endif
+
+-ifeq ($(OS_ARCH),BeOS)
++ifeq (,$(filter-out BeOS Haiku, $(OS_ARCH)))
+ EXTRA_DSO_LDOPTS += -lbe
+ endif
+
+Index: xpcom/obsolete/Makefile.in
+===================================================================
+--- xpcom/obsolete/Makefile.in (revision 7)
++++ xpcom/obsolete/Makefile.in (working copy)
+@@ -120,7 +120,7 @@
+ EXTRA_DSO_LDOPTS += $(TK_LIBS)
+ endif
+
+-ifeq ($(OS_ARCH),BeOS)
++ifeq (,$(filter-out BeOS Haiku, $(OS_ARCH)))
+ EXTRA_DSO_LDOPTS += -lbe
+ endif
+
+Index: xpcom/reflect/xptcall/src/md/unix/Makefile.in
+===================================================================
+--- xpcom/reflect/xptcall/src/md/unix/Makefile.in (revision 7)
++++ xpcom/reflect/xptcall/src/md/unix/Makefile.in (working copy)
+@@ -95,9 +95,10 @@
+ endif
+ endif
+ #
+-# BeOS/Intel (uses the same unixish_x86 code)
++# BeOS/Intel (uses the same as Linux, works well. Migrate others!)
+ #
+-ifeq ($(OS_ARCH)$(OS_TEST),BeOSBePC)
++#ifeq ($(OS_ARCH)$(OS_TEST),BeOSBePC)
++ifeq (,$(filter-out BeOSBePC HaikuBePC, $(OS_ARCH)$(OS_TEST)))
+ CPPSRCS := xptcinvoke_gcc_x86_unix.cpp xptcstubs_gcc_x86_unix.cpp
+ endif
+ #
+Index: xpinstall/packager/Makefile.in
+===================================================================
+--- xpinstall/packager/Makefile.in (revision 7)
++++ xpinstall/packager/Makefile.in (working copy)
+@@ -48,7 +48,7 @@
+ ifeq ($(OS_ARCH),IRIX)
+ STRIP_FLAGS = -f
+ endif
+-ifeq ($(OS_ARCH),BeOS)
++ifeq (,$(filter-out BeOS Haiku, $(OS_ARCH)))
+ STRIP_FLAGS = -g
+ PLATFORM_EXCLUDE_LIST = ! -name "*.stub" ! -name "$(MOZ_PKG_APPNAME)-bin"
+ endif
+Index: xulrunner/app/Makefile.in
+===================================================================
+--- xulrunner/app/Makefile.in (revision 7)
++++ xulrunner/app/Makefile.in (working copy)
+@@ -59,7 +59,7 @@
+ ifeq ($(USE_SHORT_LIBNAME), 1)
+ PROGRAM = xulrunner$(BIN_SUFFIX)
+ else
+-ifeq ($(OS_ARCH), BeOS)
++ifeq (,$(filter-out BeOS Haiku, $(OS_ARCH)))
+ PROGRAM = xulrunner$(BIN_SUFFIX)
+ else
+ PROGRAM = xulrunner-bin$(BIN_SUFFIX)
+@@ -85,7 +85,7 @@
+ ifeq ($(OS_ARCH),WINNT)
+ CPPSRCS += nsRegisterGREWin.cpp
+ else
+-ifneq (,$(filter OS2 Darwin,$(OS_ARCH)))
++ifneq (,$(filter OS2 Darwin BeOS Haiku,$(OS_ARCH)))
+ CPPSRCS += nsRegisterGREVoid.cpp
+ else
+ CPPSRCS += nsRegisterGREUnix.cpp
+@@ -174,7 +174,7 @@
+ endif
+ endif
+
+-ifeq ($(OS_ARCH),BeOS)
++ifeq (,$(filter-out BeOS Haiku, $(OS_ARCH)))
+ OS_LIBS += -ltracker
+ endif
+
diff --git a/www-client/mozilla-firefox/patches/2009-09-27/r03b-starmk.patch b/www-client/mozilla-firefox/patches/2009-09-27/r03b-starmk.patch
new file mode 100644
index 000000000..93a823127
--- /dev/null
+++ b/www-client/mozilla-firefox/patches/2009-09-27/r03b-starmk.patch
@@ -0,0 +1,115 @@
+Index: config/config.mk
+===================================================================
+--- config/config.mk (revision 7)
++++ config/config.mk (working copy)
+@@ -110,9 +110,6 @@
+ LD := $(CC)
+ endif
+ endif
+-ifeq ($(OS_ARCH),BeOS)
+-BEOS_ADDON_WORKAROUND = 1
+-endif
+
+ #
+ # Strip off the excessively long version numbers on these platforms,
+Index: config/rules.mk
+===================================================================
+--- config/rules.mk (revision 7)
++++ config/rules.mk (working copy)
+@@ -517,7 +517,7 @@
+ #
+ # BeOS: add -Bsymbolic flag for components
+ #
+-ifeq ($(OS_ARCH),BeOS)
++ifeq (,$(filter BeOS Haiku,$(OS_ARCH)))
+ ifdef IS_COMPONENT
+ EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic
+ endif
+@@ -827,7 +827,7 @@
+ ifdef MOZ_POST_PROGRAM_COMMAND
+ $(MOZ_POST_PROGRAM_COMMAND) $@
+ endif
+-ifeq ($(OS_ARCH),BeOS)
++ifeq (,$(filter-out BeOS Haiku, $(OS_ARCH)))
+ ifdef BEOS_PROGRAM_RESOURCE
+ xres -o $@ $(BEOS_PROGRAM_RESOURCE)
+ mimeset $@
+Index: directory/c-sdk/build.mk
+===================================================================
+--- directory/c-sdk/build.mk (revision 7)
++++ directory/c-sdk/build.mk (working copy)
+@@ -442,7 +442,7 @@
+ SO_FILES_TO_REMOVE=so_locations
+ endif
+
+-ifneq (,$(filter BeOS Darwin NetBSD,$(OS_ARCH)))
++ifneq (,$(filter BeOS Haiku Darwin NetBSD,$(OS_ARCH)))
+ LINK_DLL = $(MKSHLIB) $(OBJS)
+ endif
+
+Index: security/coreconf/config.mk
+===================================================================
+--- security/coreconf/config.mk (revision 7)
++++ security/coreconf/config.mk (working copy)
+@@ -68,8 +68,12 @@
+ ifeq (,$(filter-out $(TARGET_OSES),$(OS_TARGET)))
+ include $(CORE_DEPTH)/coreconf/$(OS_TARGET).mk
+ else
++ifeq ($(OS_ARCH), Haiku)
++include $(CORE_DEPTH)/coreconf/BeOS.mk
++else
+ include $(CORE_DEPTH)/coreconf/$(OS_TARGET)$(OS_RELEASE).mk
+ endif
++endif
+
+ #######################################################################
+ # [4.0] Master "Core Components" source and release tags #
+Index: security/nss/lib/ssl/config.mk
+===================================================================
+--- security/nss/lib/ssl/config.mk (revision 7)
++++ security/nss/lib/ssl/config.mk (working copy)
+@@ -111,7 +111,7 @@
+ -lnspr4 \
+ $(NULL)
+
+-ifeq ($(OS_ARCH), BeOS)
++ifeq (,$(filter-out BeOS Haiku, $(OS_ARCH)))
+ EXTRA_SHARED_LIBS += -lbe
+ endif
+
+Index: toolkit/mozapps/installer/package-name.mk
+===================================================================
+--- toolkit/mozapps/installer/package-name.mk (revision 7)
++++ toolkit/mozapps/installer/package-name.mk (working copy)
+@@ -59,6 +59,9 @@
+ ifeq ($(OS_ARCH),OS2)
+ MOZ_PKG_PLATFORM := os2
+ endif
++ifeq ($(OS_ARCH), Haiku)
++MOZ_PKG_PLATFORM := Haiku
++endif
+ ifeq ($(OS_ARCH), BeOS)
+ ifeq (,$(filter-out 6.%, $(OS_RELEASE)))
+ MOZ_PKG_PLATFORM := Zeta
+Index: toolkit/mozapps/installer/packager.mk
+===================================================================
+--- toolkit/mozapps/installer/packager.mk (revision 7)
++++ toolkit/mozapps/installer/packager.mk (working copy)
+@@ -48,7 +48,7 @@
+ ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
+ MOZ_PKG_FORMAT = DMG
+ else
+-ifeq (,$(filter-out OS2 WINNT BeOS, $(OS_ARCH)))
++ifeq (,$(filter-out OS2 WINNT BeOS Haiku, $(OS_ARCH)))
+ MOZ_PKG_FORMAT = ZIP
+ ifeq ($(OS_ARCH),OS2)
+ INSTALLER_DIR = os2
+@@ -251,7 +251,7 @@
+ ifeq ($(OS_ARCH),IRIX)
+ STRIP_FLAGS = -f
+ endif
+-ifeq ($(OS_ARCH),BeOS)
++ifeq (,$(filter-out BeOS Haiku, $(OS_ARCH)))
+ STRIP_FLAGS = -g
+ PLATFORM_EXCLUDE_LIST = ! -name "*.stub" ! -name "$(MOZ_PKG_APPNAME)-bin"
+ endif
diff --git a/www-client/mozilla-firefox/patches/2009-09-27/r04a-rdef-support-in-Makefile.patch b/www-client/mozilla-firefox/patches/2009-09-27/r04a-rdef-support-in-Makefile.patch
new file mode 100644
index 000000000..a751978a0
--- /dev/null
+++ b/www-client/mozilla-firefox/patches/2009-09-27/r04a-rdef-support-in-Makefile.patch
@@ -0,0 +1,140 @@
+Index: mozilla/browser/app/Makefile.in
+===================================================================
+RCS file: /cvsroot/mozilla/browser/app/Makefile.in,v
+retrieving revision 1.85.2.12
+diff -u -8 -p -w -r1.85.2.12 Makefile.in
+--- mozilla/browser/app/Makefile.in 12 May 2008 18:25:50 -0000 1.85.2.12
++++ mozilla/browser/app/Makefile.in 8 Jul 2009 21:49:35 -0000
+@@ -146,17 +150,20 @@ endif
+ ifdef BUILD_STATIC_LIBS
+ RCFLAGS += -DMOZ_STATIC_BUILD
+ endif
+ ifdef DEBUG
+ RCFLAGS += -DDEBUG
+ endif
+ endif
+
+ ifeq (,$(filter-out BeOS Haiku, $(OS_ARCH)))
++ifeq ($(OS_ARCH),Haiku)
++BEOS_PROGRAM_RDEF = $(srcdir)/apprunner-beos.rdef
++endif
+ BEOS_PROGRAM_RESOURCE = $(srcdir)/apprunner-beos.rsrc
+ ifdef BUILD_STATIC_LIBS
+ OS_LIBS += -ltracker -lgame
+ endif
+ endif
+
+ ifeq ($(OS_ARCH),OS2)
+ RESFILE=splashos2.res
+Index: mozilla/calendar/sunbird/app/Makefile.in
+===================================================================
+RCS file: /cvsroot/mozilla/calendar/sunbird/app/Makefile.in,v
+retrieving revision 1.21.2.23
+diff -u -8 -p -w -r1.21.2.23 Makefile.in
+--- mozilla/calendar/sunbird/app/Makefile.in 4 May 2008 01:32:07 -0000 1.21.2.23
++++ mozilla/calendar/sunbird/app/Makefile.in 8 Jul 2009 21:50:01 -0000
+@@ -189,18 +193,21 @@ endif
+ ifdef BUILD_STATIC_LIBS
+ RCFLAGS += -DMOZ_STATIC_BUILD
+ endif
+ ifdef DEBUG
+ RCFLAGS += -DDEBUG
+ endif
+ endif
+
+ ifeq (,$(filter-out BeOS Haiku, $(OS_ARCH)))
++ifeq ($(OS_ARCH),Haiku)
++BEOS_PROGRAM_RDEF = $(srcdir)/apprunner-beos.rdef
++endif
+ BEOS_PROGRAM_RESOURCE = $(srcdir)/apprunner-beos.rsrc
+ ifdef BUILD_STATIC_LIBS
+ OS_LIBS += -ltracker -lgame
+ endif
+ endif
+
+ ifeq ($(OS_ARCH),OS2)
+ RESFILE=splashos2.res
+ RCFLAGS += -DMOZ_SUNBIRD
+Index: mozilla/config/rules.mk
+===================================================================
+RCS file: /cvsroot/mozilla/config/rules.mk,v
+retrieving revision 3.487.2.9
+diff -u -8 -p -w -r3.487.2.9 rules.mk
+--- mozilla/config/rules.mk 18 Dec 2007 21:33:08 -0000 3.487.2.9
++++ mozilla/config/rules.mk 8 Jul 2009 21:50:19 -0000
+@@ -822,17 +826,20 @@ endif # OS2
+ endif # WINCE
+
+ ifdef ENABLE_STRIP
+ $(STRIP) $@
+ endif
+ ifdef MOZ_POST_PROGRAM_COMMAND
+ $(MOZ_POST_PROGRAM_COMMAND) $@
+ endif
+ ifneq (,$(filter BeOS Haiku,$(OS_ARCH)))
++ifdef BEOS_PROGRAM_RDEF
++ rc -o $(BEOS_PROGRAM_RESOURCE) $(BEOS_PROGRAM_RDEF)
++endif
+ ifdef BEOS_PROGRAM_RESOURCE
+ xres -o $@ $(BEOS_PROGRAM_RESOURCE)
+ mimeset $@
+ endif
+ endif # BeOS
+
+ $(HOST_PROGRAM): $(HOST_PROGOBJS) $(HOST_LIBS_DEPS) $(HOST_EXTRA_DEPS) Makefile Makefile.in
+ ifeq ($(MOZ_OS2_TOOLS),VACPP)
+Index: mozilla/mail/app/Makefile.in
+===================================================================
+RCS file: /cvsroot/mozilla/mail/app/Makefile.in,v
+retrieving revision 1.46.2.10
+diff -u -8 -p -w -r1.46.2.10 Makefile.in
+--- mozilla/mail/app/Makefile.in 22 Oct 2008 21:04:53 -0000 1.46.2.10
++++ mozilla/mail/app/Makefile.in 8 Jul 2009 21:52:18 -0000
+@@ -142,17 +146,20 @@ RCFLAGS += -DMOZ_THUNDERBIRD -I$(srcdir)
+ else
+ RCFLAGS += -DMOZ_THUNDERBIRD --include-dir $(srcdir)
+ endif
+ ifdef BUILD_STATIC_LIBS
+ RCFLAGS += -DMOZ_STATIC_BUILD
+ endif
+ endif
+
+ ifeq (,$(filter-out BeOS Haiku, $(OS_ARCH)))
++ifeq ($(OS_ARCH),Haiku)
++BEOS_PROGRAM_RDEF = $(srcdir)/apprunner-beos.rdef
++endif
+ BEOS_PROGRAM_RESOURCE = $(srcdir)/apprunner-beos.rsrc
+ ifdef BUILD_STATIC_LIBS
+ OS_LIBS += -ltracker -lgame
+ endif
+ endif
+
+ ifeq ($(OS_ARCH),OS2)
+ RESFILE=splashos2.res
+Index: mozilla/xpfe/bootstrap/Makefile.in
+===================================================================
+RCS file: /cvsroot/mozilla/xpfe/bootstrap/Attic/Makefile.in,v
+retrieving revision 1.283.2.6
+diff -u -8 -p -w -r1.283.2.6 Makefile.in
+--- mozilla/xpfe/bootstrap/Makefile.in 29 Sep 2007 20:15:11 -0000 1.283.2.6
++++ mozilla/xpfe/bootstrap/Makefile.in 8 Jul 2009 21:54:55 -0000
+@@ -215,16 +219,19 @@ ifdef GC_LEAK_DETECTOR
+ LIBS += -lboehm
+ endif
+
+ ifdef WRAP_SYSTEM_INCLUDES
+ DEFINES += -DWRAP_SYSTEM_INCLUDES
+ endif
+
+ ifeq ($(MOZ_WIDGET_TOOLKIT),beos)
++ifeq ($(OS_ARCH),Haiku)
++BEOS_PROGRAM_RDEF = $(srcdir)/apprunner-beos.rdef
++endif
+ BEOS_PROGRAM_RESOURCE = $(srcdir)/apprunner-beos.rsrc
+ CPPSRCS += nsNativeAppSupportBeOS.cpp
+ CPPSRCS += nsNativeAppSupportBase.cpp
+ ifdef BUILD_STATIC_LIBS
+ OS_LIBS += -ltracker -lgame
+ endif
+ endif
+
diff --git a/www-client/mozilla-firefox/patches/2009-09-27/r04b-just-rdefs-no-Makefile.patch b/www-client/mozilla-firefox/patches/2009-09-27/r04b-just-rdefs-no-Makefile.patch
new file mode 100644
index 000000000..3b7cba03b
--- /dev/null
+++ b/www-client/mozilla-firefox/patches/2009-09-27/r04b-just-rdefs-no-Makefile.patch
@@ -0,0 +1,532 @@
+Index: /generated/bezilla/mozilla/xpfe/apprunner-beos.rdef
+===================================================================
+--- /generated/bezilla/mozilla/xpfe/apprunner-beos.rdef (revision 0)
++++ /generated/bezilla/mozilla/xpfe/apprunner-beos.rdef (revision 0)
+@@ -0,0 +1,136 @@
++/*
++ * BeZillaBrowser.rdef
++ */
++
++resource app_signature "application/x-vnd.Mozilla-SeaMonkey";
++
++resource app_flags B_SINGLE_LAUNCH;
++
++resource app_version {
++ /*
++ * We are using the source code version number
++ * for our program version.
++ * TODO : implement something better.
++ */
++ major = 1,
++ middle = 8,
++ minor = 1,
++
++ /* 0 = development 1 = alpha 2 = beta
++ 3 = gamma 4 = golden master 5 = final */
++ variety = 0,
++
++ internal = 21,
++
++ short_info = "BeZillaSuite",
++ long_info = "BeZillaSuite is based on Mozilla's source code"
++};
++
++resource file_types message {
++ "types" = "application/x-vnd.Be.URL.file",
++ "types" = "application/x-vnd.Be.URL.ftp",
++ "types" = "application/x-vnd.Be.URL.http",
++ "types" = "application/x-vnd.Be.URL.https",
++ "types" = "application/x-vnd.Be.URL.mailto",
++ "types" = "application/x-vnd.Be.URL.news",
++ "types" = "text/html"
++ /*
++ * Should BeZillaSuite include these additional filetypes?
++ * note: MailNews has them
++ "types" = "applicataion/x-person",
++ "types" = "message/rfc822",
++ "types" = "text/E-mail",
++ "types" = "text/x-email"
++ "types" = "text/x-vnd.Be-MailDraft"
++ */
++};
++
++resource vector_icon {
++ $"6E636966210500020016029E8638A20EBA220EBA9E86384880254A18EA00FFFF"
++ $"8002001602BC9D88BB1F643B1F64BC9D884B716D48772700FFFF80020016023B"
++ $"F73A0000000000003BF73A49B5114976B000FFFF800200160237A0DDB61AF236"
++ $"1AF237A0DD497CAA48588100FFFF800200160238D81CB8152D38152D38D81C48"
++ $"420A499FB600FFFF8002001602397095000000000000397095486EDA49100600"
++ $"FFFF800200160231E5B2BA0EAF3A0EAF31E5B247DA3349779B00FFFF80020016"
++ $"0236BBEFB4543A34543A36BBEF495BDE469BC700FFFF6B0200160236E2E70000"
++ $"0000000036E2E74A2CD64670CD00FFFF800200160237AB1000000000000037AB"
++ $"104AE1D848449500FFFF5702001602375C10B74516374516375C1048B2B04AE9"
++ $"7200FFFF8002001602B07700B74912374912B077004898AD4AD99500FFFF8002"
++ $"00160232CFA5BA0B483A0B4832CFA54A3C584BA00E00FFFF8002001602368CB7"
++ $"000000000000368CB74B3D5E49752800FFFF4F0200160236A81C000000000000"
++ $"36A81C4B94C84A808500FFFF4002000602B738F7362603B62603B738F748BB3F"
++ $"4A241700A91212FFD7121202001602B04887376143B76143B0488748D36C44FB"
++ $"3100FFFF6B02001602B47620362BAAB62BAAB476204A0C144406C600FFFF8002"
++ $"001602B4CAE23409B3B409B3B4CAE24AD8D54611F100FFFF8002001602B328E4"
++ $"324E4AB24E4AB328E44B36A648859C00FFFF8002001602B22376311F03B11F03"
++ $"B223764B891349FFBC00FFFF80010079009803FF000004006002001602B4E6F3"
++ $"319259B19259B4E6F34B2F5D4AA2CA00FFFF0003FFFF0004FFD801FFFF669805"
++ $"000200060237889D389554BBFC4A3AB9D0491ADE4A422000FFF9BAFFFFC10402"
++ $"0006023882A6389353BB177D3B0378484ADD4AF27700C7E3FFFF392FFF020006"
++ $"0237A0CC393C5ABC1AC23A5C164A19B94AFE5400FF9797FFCE3232290633EEEB"
++ $"FFFFAAEAABDBAEBBBEAE2BC0CEB389C02424C074B415BFF0B478BFB4B450BFB7"
++ $"B455BFB6B455BF8CB436BF14B430BF55B42DBEF5B3FFBE82B33EBBDBB3F2BBCE"
++ $"B4D7BBD0B4BABBCBB4DABBC7B4DABBC7B4DABBC8B4DABB45B50ABB45B50ABB44"
++ $"B50ABB37B50DBB37B50DBAD6B534BA1EB58DBA78B560BA1EB58DBA12B593BA12"
++ $"B593BA0FB596B99BB5D6B99BB5D6B99AB5D6B975B5ECB975B5ECB974B5EDB918"
++ $"B626B918B626B917B626B8EDB642B893B681B887B689B86CB69CB7F22AB7B5B7"
++ $"2DB7A9B76EB73CB920B755B8C5B6B5B9A4B380BC3AB4F7BB4BB380BC3AB317BC"
++ $"7FB33E42B755C332B80EC320B7E7C323B7FBC3522CC3C54FBB03C7E8BAF4C7DB"
++ $"BAD1C898BA59CA44BC40CC83BAD4CBC3BDF3CD6FC0A0CDA4C760C888CA38C797"
++ $"C90DC879CB7BC6A2CC38C4DCCB9AC3A6CBB6C3DDCBA2C34CCBC2C1EBCA78BF62"
++ $"C954BF30C9ADBF3FC934BEE9C900BE83C91DBEC2C927BE17C999BCEAC857BA6B"
++ $"C720BABCC767BAABC73FBA2EC7C0B7EEC5B1B563C3F4B6DBC472B66FC405B613"
++ $"C427B41BC12CB2F006032FBAF5C05EBAF5C05EBAF7C05C34C05A34C05B34C05A"
++ $"34C05B0610EE7AAAAAC693C7B5C9E8C667C896C755CAB5C5D3CB14C47FC521B8"
++ $"CDC521B8CDC0B9B834BD7FBA63BC9BBC64B789BF00B92ABE82B789BF00C251BC"
++ $"E5C1CCBED1C0BCBE70C324BB51C5B0BB5AC71ABFC8C4E2C044C512C05CCC1E06"
++ $"04EEBD7FBA63C521B8CDC0B9B834C521B8CDBF40B50AB87FB7A5BC0CB4F7B87F"
++ $"B7A50604FEBD7FBA63C521B8CDC0B9B834C521B8CDBF40B50ABF40B50ABD2DB5"
++ $"21B87FB7A5BA8CB5E9B87FB7A50605BB02B3F7BCF4B5CD36B3F7BCF4B789BF00"
++ $"BA19BDD6B8DABE8835BD1EBC9BBC64B801B9930A04B87FB7A5BD7FBA63BC9BBC"
++ $"64B801B9930A04B3F7BCF4B413C012B789C251B789BF000A04BC7AB801BF99B6"
++ $"C0BE1BB43BBCAAB49E0A05BFE1B69AC187B3FFC341B4ABC30EB77BC204B6CF0A"
++ $"05C3E9B805C594B69AC6D3B825C637BAECC521B8CD0A06B967C223B8A5C3F1BB"
++ $"51C5B0BE70C323BED1C0BCBCE5C1CC0A04B8A5C548B8A5C3F1BB51C5B0BB5AC7"
++ $"1A0606BA0ABC41C6A5BB73C983BCF9CB79BBC8CAD5BE40CC23C05CCC1EC044C5"
++ $"12BFC8C4E20A04C6A1BBC1C7E5BB6BC8ABBCF7C80EBE920A04C9EA41C8C5BFF3"
++ $"CABBC3D4CAE3C2140A06BA90C206BA19C33CBADEC3EBBEA7C1C4BED1C0BCBCE5"
++ $"C1CC0A06BC7AB801BCAAB49EBE1BB43BBE33B460BCDAB4C7BCB1B7EC0A04BFE1"
++ $"B69AC021B6A1C1ADB40DC187B3FF0A04C3E9B805C594B69AC5B7B6C3C41AB825"
++ $"0A04C6A1BBC1C7E5BB6BC7F4BB8EC6B9BBEC0A04C8C5BFF3C9EA41CA07C060C8"
++ $"E5C02B0628AAAAAAAAAAAEEFAAA9BACAB4C3BFCAE3C214C9EA41C8C5BFF3C80F"
++ $"BE90C8ABBCF7C7F4BB8EC7E5BB6BC6A1BBC1C637BAECC6D3B826C5B7B6C3C594"
++ $"B69AC3E9B805C3F9B80FC30EB77BC341B4ABC1ADB40DC187B3FFC068B5C6BF40"
++ $"B50ABE9BB514BF03B507BE9BB514BE1BB43BBCAAB49EBC9EB57CBC9EB57CBB34"
++ $"B5E3B87FB7A5B9BC29B87FB7A5B801B993B3F7BCF4B5CD36B3F7BCF4B413C012"
++ $"B789C251B964C223B8A5C3F1C548BB5AC71ABFC8C4E2C044C512C05CCC1EC693"
++ $"C7B5C9B7C688C894C759CAD2C5BECB14C47F0A06BE4DC302BB334EB8F2C3E4B9"
++ $"9FC21DBCE5C1CCBEAEC0D1020ABFDBBBF7BFE1BBDFBFC9BC38BF63BC91BF9DBC"
++ $"71BEE7BCD8BE03BC31BE4BBCABBE03BC31BE00BC24BE0137BE10BC1ABE4BBC03"
++ $"BE30BC0EBE4BBC03BEE9BBBABEE9BBBABEE9BBBABF7BBB58BF7BBB58BF8FBB45"
++ $"BFBDBB29BFA9BB3440BB2DBFC3BB34BFC3BB34BFD9BB5BBFE7BBB2BFE7BB85BF"
++ $"E7BBC8020ABFD5BC12BFD9BC00BFC3BC4FBF67BC9CBF9CBC80BEFCBCDBBE32BC"
++ $"45BE70BCB4BE32BC45BE2BBC39BE30BC41BE3EBC32BE70BC1DBE58BC27BE70BC"
++ $"1DBEFEBBDDBEFEBBDDBEFEBBDDBF7EBB84BF7EBB84BF90BB77BFB7BB5CBFA7BB"
++ $"66BFBDBB5F40BB6640BB66BFD4BB87BFDCBBD4BFDCBBADBFDCBBEA0605BA02BC"
++ $"2BC6AFC155C3BAC269C139C245C1A9C25CC1A9C1A5C3EFBBF5C7310A04BC7AB8"
++ $"01BF99B6C0C125B79BBFB3B7FF0A03BFE1B69AC3A0B7D5C204B6CF0A05BCAAC6"
++ $"70BCB9C66BBE0FC73AC05BC70BBDF4C7890A04BC34C73FBDE5C88AC04EC88BBD"
++ $"C9C8D80A04BB81C817BD6CC9CFC072C973BD505A0A04BB60C971BD4FCB2BC054"
++ $"CACFBD33CB790A03C6D944C9E8C6DAC695540A03BD9FBC21BEE9BBBAC059BA77"
++ $"0204BF4DBBE8BF4DBC1ABF4DBBB7BF95BB8FBF6FBB8FBFBCBB8FBFD9BBE8BFD9"
++ $"BBB7BFD9BC1ABF95BC42BFBCBC42BF6FBC420A04BAD6C37ABBFAC2FDBAD1C336"
++ $"BA8CC2FD0606BA0ABC2BC6AF35C98ABCC1CB6BBB88CAC8BE00CC16C049CC29C0"
++ $"33C51CBFB5C4EA0A062C472C4E3251364E364730440A06265226592C5C305930"
++ $"522A4F0A0632533259385C3C593C5237C5D3290A000100000A010101000A0201"
++ $"02000A030103000A040104000A050105000A060106000A070107000A08010800"
++ $"0A090109000A0A010A000A0B010B000A0C010C000A0D010D000A0E010E000A0F"
++ $"010F000A100110000A110111000A120112000A130113000A140114000A150115"
++ $"000A1603161718000A170119000A18011A000A18011B000A18011C000A18011D"
++ $"000A18011E000A18011F000A180120000A190121000A180122000A1A0123000A"
++ $"1B0124000A1C0125000A1D032627283841B30C15FF01178400040A1D03262728"
++ $"3841B30C001501178600040A1E01262041B30C0A1F01272041B30C0A20012820"
++ $"41B30C"
++};
++
++
+Index: /generated/bezilla/mozilla/mail/app/apprunner-beos.rdef
+===================================================================
+--- /generated/bezilla/mozilla/mail/app/apprunner-beos.rdef (revision 0)
++++ /generated/bezilla/mozilla/mail/app/apprunner-beos.rdef (revision 0)
+@@ -0,0 +1,126 @@
++/*
++ * BeZillaBrowser.rdef
++ */
++
++resource app_signature "application/x-vnd.Mozilla-Thunderbird";
++
++resource app_flags B_SINGLE_LAUNCH;
++
++resource app_version {
++ /*
++ * We are using the source code version number
++ * for our program version.
++ * TODO : implement something better.
++ */
++ major = 1,
++ middle = 8,
++ minor = 1,
++
++ /* 0 = development 1 = alpha 2 = beta
++ 3 = gamma 4 = golden master 5 = final */
++ variety = 0,
++
++ internal = 21,
++
++ short_info = "BeZillaMailNews",
++ long_info = "BeZillaMailNews is based on Mozilla's source code"
++};
++
++resource file_types message {
++ "types" = "application/x-vnd.Be.URL.mailto",
++ "types" = "application/x-vnd.Be.URL.news",
++ "types" = "applicataion/x-person",
++ "types" = "message/rfc822",
++ "types" = "text/E-mail",
++ "types" = "text/x-email",
++ "types" = "text/x-vnd.Be-MailDraft"
++};
++
++resource vector_icon {
++ $"6E636966200500020016029E8638A20EBA220EBA9E86384880254A18EA00FFFF"
++ $"8002001602BC9D88BB1F643B1F64BC9D884B716D48772700FFFF80020016023B"
++ $"F73A0000000000003BF73A49B5114976B000FFFF800200160237A0DDB61AF236"
++ $"1AF237A0DD497CAA48588100FFFF800200160238D81CB8152D38152D38D81C48"
++ $"420A499FB600FFFF8002001602397095000000000000397095486EDA49100600"
++ $"FFFF800200160231E5B2BA0EAF3A0EAF31E5B247DA3349779B00FFFF80020016"
++ $"0236BBEFB4543A34543A36BBEF495BDE469BC700FFFF6B0200160236E2E70000"
++ $"0000000036E2E74A2CD64670CD00FFFF800200160237AB1000000000000037AB"
++ $"104AE1D848449500FFFF5702001602375C10B74516374516375C1048B2B04AE9"
++ $"7200FFFF8002001602B07700B74912374912B077004898AD4AD99500FFFF8002"
++ $"00160232CFA5BA0B483A0B4832CFA54A3C584BA00E00FFFF8002001602368CB7"
++ $"000000000000368CB74B3D5E49752800FFFF4F0200160236A81C000000000000"
++ $"36A81C4B94C84A808500FFFF4002000602B738F7362603B62603B738F748BB3F"
++ $"4A241700A91212FFD7121202001602B04887376143B76143B0488748D36C44FB"
++ $"3100FFFF6B02001602B47620362BAAB62BAAB476204A0C144406C600FFFF8002"
++ $"001602B4CAE23409B3B409B3B4CAE24AD8D54611F100FFFF8002001602B328E4"
++ $"324E4AB24E4AB328E44B36A648859C00FFFF8002001602B22376311F03B11F03"
++ $"B223764B891349FFBC00FFFF80010079009803FF000004006002001602B4E6F3"
++ $"319259B19259B4E6F34B2F5D4AA2CA00FFFF0003FFFF0004FFD801FFFF669805"
++ $"0002000602389ECD3AF097BC491F3A09894954654ABDFA00FFFFFFFFD9D09303"
++ $"6B5222280633EEEBFFFFAAEAABDBAEBBBEAE2BC0CEB389C02424C074B415BFF0"
++ $"B478BFB4B450BFB7B455BFB6B455BF8CB436BF14B430BF55B42DBEF5B3FFBE82"
++ $"B33EBBDBB3F2BBCEB4D7BBD0B4BABBCBB4DABBC7B4DABBC7B4DABBC8B4DABB45"
++ $"B50ABB45B50ABB44B50ABB37B50DBB37B50DBAD6B534BA1EB58DBA78B560BA1E"
++ $"B58DBA12B593BA12B593BA0FB596B99BB5D6B99BB5D6B99AB5D6B975B5ECB975"
++ $"B5ECB974B5EDB918B626B918B626B917B626B8EDB642B893B681B887B689B86C"
++ $"B69CB7F22AB7B5B72DB7A9B76EB73CB920B755B8C5B6B5B9A4B380BC3AB4F7BB"
++ $"4BB380BC3AB317BC7FB33E42B755C332B80EC320B7E7C323B7FBC3522CC3C54F"
++ $"BB03C7E8BAF4C7DBBAD1C898BA59CA44BC40CC83BAD4CBC3BDF3CD6FC0A0CDA4"
++ $"C760C888CA38C797C90DC879CB7BC6A2CC38C4DCCB9AC3A6CBB6C3DDCBA2C34C"
++ $"CBC2C1EBCA78BF62C954BF30C9ADBF3FC934BEE9C900BE83C91DBEC2C927BE17"
++ $"C999BCEAC857BA6BC720BABCC767BAABC73FBA2EC7C0B7EEC5B1B563C3F4B6DB"
++ $"C472B66FC405B613C427B41BC12CB2F006032FBAF5C05EBAF5C05EBAF7C05C34"
++ $"C05A34C05B34C05A34C05B0610EE7AAAAAC693C7B5C9E8C667C896C755CAB5C5"
++ $"D3CB14C47FC521B8CDC521B8CDC0B9B834BD7FBA63BC9BBC64B789BF00B92ABE"
++ $"82B789BF00C251BCE5C1CCBED1C0BCBE70C324BB51C5B0BB5AC71ABFC8C4E2C0"
++ $"44C512C05CCC1E0604EEBD7FBA63C521B8CDC0B9B834C521B8CDBF40B50AB87F"
++ $"B7A5BC0CB4F7B87FB7A50604FEBD7FBA63C521B8CDC0B9B834C521B8CDBF40B5"
++ $"0ABF40B50ABD2DB521B87FB7A5BA8CB5E9B87FB7A50605BB02B3F7BCF4B5CD36"
++ $"B3F7BCF4B789BF00BA19BDD6B8DABE8835BD1EBC9BBC64B801B9930A04B87FB7"
++ $"A5BD7FBA63BC9BBC64B801B9930A04B3F7BCF4B413C012B789C251B789BF000A"
++ $"04BC7AB801BF99B6C0BE1BB43BBCAAB49E0A05BFE1B69AC187B3FFC341B4ABC3"
++ $"0EB77BC204B6CF0A05C3E9B805C594B69AC6D3B825C637BAECC521B8CD0A06B9"
++ $"67C223B8A5C3F1BB51C5B0BE70C323BED1C0BCBCE5C1CC0A04B8A5C548B8A5C3"
++ $"F1BB51C5B0BB5AC71A0606BA0ABC41C6A5BB73C983BCF9CB79BBC8CAD5BE40CC"
++ $"23C05CCC1EC044C512BFC8C4E20A04C6A1BBC1C7E5BB6BC8ABBCF7C80EBE920A"
++ $"04C9EA41C8C5BFF3CABBC3D4CAE3C2140A06BA90C206BA19C33CBADEC3EBBEA7"
++ $"C1C4BED1C0BCBCE5C1CC0A06BC7AB801BCAAB49EBE1BB43BBE33B460BCDAB4C7"
++ $"BCB1B7EC0A04BFE1B69AC021B6A1C1ADB40DC187B3FF0A04C3E9B805C594B69A"
++ $"C5B7B6C3C41AB8250A04C6A1BBC1C7E5BB6BC7F4BB8EC6B9BBEC0A04C8C5BFF3"
++ $"C9EA41CA07C060C8E5C02B0628AAAAAAAAAAAEEFAAA9BACAB4C3BFCAE3C214C9"
++ $"EA41C8C5BFF3C80FBE90C8ABBCF7C7F4BB8EC7E5BB6BC6A1BBC1C637BAECC6D3"
++ $"B826C5B7B6C3C594B69AC3E9B805C3F9B80FC30EB77BC341B4ABC1ADB40DC187"
++ $"B3FFC068B5C6BF40B50ABE9BB514BF03B507BE9BB514BE1BB43BBCAAB49EBC9E"
++ $"B57CBC9EB57CBB34B5E3B87FB7A5B9BC29B87FB7A5B801B993B3F7BCF4B5CD36"
++ $"B3F7BCF4B413C012B789C251B964C223B8A5C3F1C548BB5AC71ABFC8C4E2C044"
++ $"C512C05CCC1EC693C7B5C9B7C688C894C759CAD2C5BECB14C47F0A06BE4DC302"
++ $"BB334EB8F2C3E4B99FC21DBCE5C1CCBEAEC0D1020ABFDBBBF7BFE1BBDFBFC9BC"
++ $"38BF63BC91BF9DBC71BEE7BCD8BE03BC31BE4BBCABBE03BC31BE00BC24BE0137"
++ $"BE10BC1ABE4BBC03BE30BC0EBE4BBC03BEE9BBBABEE9BBBABEE9BBBABF7BBB58"
++ $"BF7BBB58BF8FBB45BFBDBB29BFA9BB3440BB2DBFC3BB34BFC3BB34BFD9BB5BBF"
++ $"E7BBB2BFE7BB85BFE7BBC8020ABFD5BC12BFD9BC00BFC3BC4FBF67BC9CBF9CBC"
++ $"80BEFCBCDBBE32BC45BE70BCB4BE32BC45BE2BBC39BE30BC41BE3EBC32BE70BC"
++ $"1DBE58BC27BE70BC1DBEFEBBDDBEFEBBDDBEFEBBDDBF7EBB84BF7EBB84BF90BB"
++ $"77BFB7BB5CBFA7BB66BFBDBB5F40BB6640BB66BFD4BB87BFDCBBD4BFDCBBADBF"
++ $"DCBBEA0605BA02BC2BC6AFC155C3BAC269C139C245C1A9C25CC1A9C1A5C3EFBB"
++ $"F5C7310A04BC7AB801BF99B6C0C125B79BBFB3B7FF0A03BFE1B69AC3A0B7D5C2"
++ $"04B6CF0A05BCAAC670BCB9C66BBE0FC73AC05BC70BBDF4C7890A04BC34C73FBD"
++ $"E5C88AC04EC88BBDC9C8D80A04BB81C817BD6CC9CFC072C973BD505A0A04BB60"
++ $"C971BD4FCB2BC054CACFBD33CB790A03C6D944C9E8C6DAC695540A03BD9FBC21"
++ $"BEE9BBBAC059BA770204BF4DBBE8BF4DBC1ABF4DBBB7BF95BB8FBF6FBB8FBFBC"
++ $"BB8FBFD9BBE8BFD9BBB7BFD9BC1ABF95BC42BFBCBC42BF6FBC420A04BAD6C37A"
++ $"BBFAC2FDBAD1C336BA8CC2FD0606BA0ABC2BC6AF35C98ABCC1CB6BBB88CAC8BE"
++ $"00CC16C049CC29C033C51CBFB5C4EA0A04244C245C3C5C3C4C060AEEFE0E244C"
++ $"30542E5432543C4CBB1454BCCAC670BB14543C5CBABCC808BABCC808BA0EC8AC"
++ $"3056B9A856B91756B801C808B8B1C8ACB801C808245CB7A954B7A954B5F4C670"
++ $"280A000100000A010101000A020102000A030103000A040104000A050105000A"
++ $"060106000A070107000A080108000A090109000A0A010A000A0B010B000A0C01"
++ $"0C000A0D010D000A0E010E000A0F010F000A100110000A110111000A12011200"
++ $"0A130113000A140114000A150115000A1603161718000A170119000A18011A00"
++ $"0A18011B000A18011C000A18011D000A18011E000A18011F000A180120000A19"
++ $"0121000A180122000A1A0123000A1B0124000A1C0125000A1D012638C018B358"
++ $"15FF01178400040A1D012638C018B358001501178600040A1E012620C018B358"
++ $"0A1F012720C018B358"
++};
++
++
+Index: /generated/bezilla/mozilla/calendar/sunbird/app/apprunner-beos.rdef
+===================================================================
+--- /generated/bezilla/mozilla/calendar/sunbird/app/apprunner-beos.rdef (revision 0)
++++ /generated/bezilla/mozilla/calendar/sunbird/app/apprunner-beos.rdef (revision 0)
+@@ -0,0 +1,125 @@
++/*
++ * BeZillaBrowser.rdef
++ */
++
++resource app_signature "application/x-vnd.Mozilla-Sunbird";
++
++resource app_flags B_SINGLE_LAUNCH;
++
++resource app_version {
++ /*
++ * We are using the source code version number
++ * for our program version.
++ * TODO : implement something better.
++ */
++ major = 1,
++ middle = 8,
++ minor = 1,
++
++ /* 0 = development 1 = alpha 2 = beta
++ 3 = gamma 4 = golden master 5 = final */
++ variety = 0,
++
++ internal = 21,
++
++ short_info = "BeZillaCalendar",
++ long_info = "BeZillaCalendar is based on Mozilla's source code"
++};
++
++resource file_types message {
++ "types" = "text/csv",
++ "types" = "text/calendar"
++ /*
++ // TODO:
++ // .sdb is mimetype application/octet-stream
++ // is there a more elegant way to handle it?
++ types" = "application/octet-stream"
++ */
++};
++resource vector_icon {
++ $"6E636966200500020016029E8638A20EBA220EBA9E86384880254A18EA00FFFF"
++ $"8002001602BC9D88BB1F643B1F64BC9D884B716D48772700FFFF80020016023B"
++ $"F73A0000000000003BF73A49B5114976B000FFFF800200160237A0DDB61AF236"
++ $"1AF237A0DD497CAA48588100FFFF800200160238D81CB8152D38152D38D81C48"
++ $"420A499FB600FFFF8002001602397095000000000000397095486EDA49100600"
++ $"FFFF800200160231E5B2BA0EAF3A0EAF31E5B247DA3349779B00FFFF80020016"
++ $"0236BBEFB4543A34543A36BBEF495BDE469BC700FFFF6B0200160236E2E70000"
++ $"0000000036E2E74A2CD64670CD00FFFF800200160237AB1000000000000037AB"
++ $"104AE1D848449500FFFF5702001602375C10B74516374516375C1048B2B04AE9"
++ $"7200FFFF8002001602B07700B74912374912B077004898AD4AD99500FFFF8002"
++ $"00160232CFA5BA0B483A0B4832CFA54A3C584BA00E00FFFF8002001602368CB7"
++ $"000000000000368CB74B3D5E49752800FFFF4F0200160236A81C000000000000"
++ $"36A81C4B94C84A808500FFFF4002000602B738F7362603B62603B738F748BB3F"
++ $"4A241700A91212FFD7121202001602B04887376143B76143B0488748D36C44FB"
++ $"3100FFFF6B02001602B47620362BAAB62BAAB476204A0C144406C600FFFF8002"
++ $"001602B4CAE23409B3B409B3B4CAE24AD8D54611F100FFFF8002001602B328E4"
++ $"324E4AB24E4AB328E44B36A648859C00FFFF8002001602B22376311F03B11F03"
++ $"B223764B891349FFBC00FFFF80010079009803FF000004006002001602B4E6F3"
++ $"319259B19259B4E6F34B2F5D4AA2CA00FFFF0003FFFF0004FFD801FFFF669805"
++ $"000200060239CDA03A935CBC02343AF7494899864A8DDC00FFDB97FFFCAF2902"
++ $"0106033B471C0000000000003B36DB472800498C0000F2F2F2AB7D7A7AFFBCA1"
++ $"84280633EEEBFFFFAAEAABDBAEBBBEAE2BC0CEB389C02424C074B415BFF0B478"
++ $"BFB4B450BFB7B455BFB6B455BF8CB436BF14B430BF55B42DBEF5B3FFBE82B33E"
++ $"BBDBB3F2BBCEB4D7BBD0B4BABBCBB4DABBC7B4DABBC7B4DABBC8B4DABB45B50A"
++ $"BB45B50ABB44B50ABB37B50DBB37B50DBAD6B534BA1EB58DBA78B560BA1EB58D"
++ $"BA12B593BA12B593BA0FB596B99BB5D6B99BB5D6B99AB5D6B975B5ECB975B5EC"
++ $"B974B5EDB918B626B918B626B917B626B8EDB642B893B681B887B689B86CB69C"
++ $"B7F22AB7B5B72DB7A9B76EB73CB920B755B8C5B6B5B9A4B380BC3AB4F7BB4BB3"
++ $"80BC3AB317BC7FB33E42B755C332B80EC320B7E7C323B7FBC3522CC3C54FBB03"
++ $"C7E8BAF4C7DBBAD1C898BA59CA44BC40CC83BAD4CBC3BDF3CD6FC0A0CDA4C760"
++ $"C888CA38C797C90DC879CB7BC6A2CC38C4DCCB9AC3A6CBB6C3DDCBA2C34CCBC2"
++ $"C1EBCA78BF62C954BF30C9ADBF3FC934BEE9C900BE83C91DBEC2C927BE17C999"
++ $"BCEAC857BA6BC720BABCC767BAABC73FBA2EC7C0B7EEC5B1B563C3F4B6DBC472"
++ $"B66FC405B613C427B41BC12CB2F006032FBAF5C05EBAF5C05EBAF7C05C34C05A"
++ $"34C05B34C05A34C05B0610EE7AAAAAC693C7B5C9E8C667C896C755CAB5C5D3CB"
++ $"14C47FC521B8CDC521B8CDC0B9B834BD7FBA63BC9BBC64B789BF00B92ABE82B7"
++ $"89BF00C251BCE5C1CCBED1C0BCBE70C324BB51C5B0BB5AC71ABFC8C4E2C044C5"
++ $"12C05CCC1E0604EEBD7FBA63C521B8CDC0B9B834C521B8CDBF40B50AB87FB7A5"
++ $"BC0CB4F7B87FB7A50604FEBD7FBA63C521B8CDC0B9B834C521B8CDBF40B50ABF"
++ $"40B50ABD2DB521B87FB7A5BA8CB5E9B87FB7A50605BB02B3F7BCF4B5CD36B3F7"
++ $"BCF4B789BF00BA19BDD6B8DABE8835BD1EBC9BBC64B801B9930A04B87FB7A5BD"
++ $"7FBA63BC9BBC64B801B9930A04B3F7BCF4B413C012B789C251B789BF000A04BC"
++ $"7AB801BF99B6C0BE1BB43BBCAAB49E0A05BFE1B69AC187B3FFC341B4ABC30EB7"
++ $"7BC204B6CF0A05C3E9B805C594B69AC6D3B825C637BAECC521B8CD0A06B967C2"
++ $"23B8A5C3F1BB51C5B0BE70C323BED1C0BCBCE5C1CC0A04B8A5C548B8A5C3F1BB"
++ $"51C5B0BB5AC71A0606BA0ABC41C6A5BB73C983BCF9CB79BBC8CAD5BE40CC23C0"
++ $"5CCC1EC044C512BFC8C4E20A04C6A1BBC1C7E5BB6BC8ABBCF7C80EBE920A04C9"
++ $"EA41C8C5BFF3CABBC3D4CAE3C2140A06BA90C206BA19C33CBADEC3EBBEA7C1C4"
++ $"BED1C0BCBCE5C1CC0A06BC7AB801BCAAB49EBE1BB43BBE33B460BCDAB4C7BCB1"
++ $"B7EC0A04BFE1B69AC021B6A1C1ADB40DC187B3FF0A04C3E9B805C594B69AC5B7"
++ $"B6C3C41AB8250A04C6A1BBC1C7E5BB6BC7F4BB8EC6B9BBEC0A04C8C5BFF3C9EA"
++ $"41CA07C060C8E5C02B0628AAAAAAAAAAAEEFAAA9BACAB4C3BFCAE3C214C9EA41"
++ $"C8C5BFF3C80FBE90C8ABBCF7C7F4BB8EC7E5BB6BC6A1BBC1C637BAECC6D3B826"
++ $"C5B7B6C3C594B69AC3E9B805C3F9B80FC30EB77BC341B4ABC1ADB40DC187B3FF"
++ $"C068B5C6BF40B50ABE9BB514BF03B507BE9BB514BE1BB43BBCAAB49EBC9EB57C"
++ $"BC9EB57CBB34B5E3B87FB7A5B9BC29B87FB7A5B801B993B3F7BCF4B5CD36B3F7"
++ $"BCF4B413C012B789C251B964C223B8A5C3F1C548BB5AC71ABFC8C4E2C044C512"
++ $"C05CCC1EC693C7B5C9B7C688C894C759CAD2C5BECB14C47F0A06BE4DC302BB33"
++ $"4EB8F2C3E4B99FC21DBCE5C1CCBEAEC0D1020ABFDBBBF7BFE1BBDFBFC9BC38BF"
++ $"63BC91BF9DBC71BEE7BCD8BE03BC31BE4BBCABBE03BC31BE00BC24BE0137BE10"
++ $"BC1ABE4BBC03BE30BC0EBE4BBC03BEE9BBBABEE9BBBABEE9BBBABF7BBB58BF7B"
++ $"BB58BF8FBB45BFBDBB29BFA9BB3440BB2DBFC3BB34BFC3BB34BFD9BB5BBFE7BB"
++ $"B2BFE7BB85BFE7BBC8020ABFD5BC12BFD9BC00BFC3BC4FBF67BC9CBF9CBC80BE"
++ $"FCBCDBBE32BC45BE70BCB4BE32BC45BE2BBC39BE30BC41BE3EBC32BE70BC1DBE"
++ $"58BC27BE70BC1DBEFEBBDDBEFEBBDDBEFEBBDDBF7EBB84BF7EBB84BF90BB77BF"
++ $"B7BB5CBFA7BB66BFBDBB5F40BB6640BB66BFD4BB87BFDCBBD4BFDCBBADBFDCBB"
++ $"EA0605BA02BC2BC6AFC155C3BAC269C139C245C1A9C25CC1A9C1A5C3EFBBF5C7"
++ $"310A04BC7AB801BF99B6C0C125B79BBFB3B7FF0A03BFE1B69AC3A0B7D5C204B6"
++ $"CF0A05BCAAC670BCB9C66BBE0FC73AC05BC70BBDF4C7890A04BC34C73FBDE5C8"
++ $"8AC04EC88BBDC9C8D80A04BB81C817BD6CC9CFC072C973BD505A0A04BB60C971"
++ $"BD4FCB2BC054CACFBD33CB790A03C6D944C9E8C6DAC695540A03BD9FBC21BEE9"
++ $"BBBAC059BA770204BF4DBBE8BF4DBC1ABF4DBBB7BF95BB8FBF6FBB8FBFBCBB8F"
++ $"BFD9BBE8BFD9BBB7BFD9BC1ABF95BC42BFBCBC42BF6FBC420A04BAD6C37ABBFA"
++ $"C2FDBAD1C336BA8CC2FD0606BA0ABC2BC6AF35C98ABCC1CB6BBB88CAC8BE00CC"
++ $"16C049CC29C033C51CBFB5C4EA0A092844284E2A502A5A325A3250344E34442E"
++ $"4202042E3AB9753AB7B23A2A3E2ABE112ABFD52E42B7B242B97542323E32BFD5"
++ $"32BE11280A000100000A010101000A020102000A030103000A040104000A0501"
++ $"05000A060106000A070107000A080108000A090109000A0A010A000A0B010B00"
++ $"0A0C010C000A0D010D000A0E010E000A0F010F000A100110000A110111000A12"
++ $"0112000A130113000A140114000A150115000A1603161718000A170119000A18"
++ $"011A000A18011B000A18011C000A18011D000A18011E000A18011F000A180120"
++ $"000A190121000A180122000A1A0123000A1B0124000A1C0125000A1D012630C3"
++ $"89B47101178400040A1E012620C389B4710A1D012730C389B47101178400040A"
++ $"1F012720C389B471"
++};
++
+Index: /generated/bezilla/mozilla/browser/app/apprunner-beos.rdef
+===================================================================
+--- /generated/bezilla/mozilla/browser/app/apprunner-beos.rdef (revision 0)
++++ /generated/bezilla/mozilla/browser/app/apprunner-beos.rdef (revision 0)
+@@ -0,0 +1,125 @@
++/*
++ * BeZillaBrowser.rdef
++ */
++
++resource app_signature "application/x-vnd.Mozilla-Firefox";
++
++resource app_flags B_SINGLE_LAUNCH;
++
++resource app_version {
++ /*
++ * We are using the source code version number
++ * for our program version.
++ * TODO : implement something better.
++ */
++ major = 1,
++ middle = 8,
++ minor = 1,
++
++ /* 0 = development 1 = alpha 2 = beta
++ 3 = gamma 4 = golden master 5 = final */
++ variety = 0,
++
++ internal = 21,
++
++ short_info = "BeZillaBrowser",
++ long_info = "BeZillaBrowser is based on Mozilla's source code"
++};
++
++resource file_types message {
++ "types" = "application/x-vnd.Be.URL.file",
++ "types" = "application/x-vnd.Be.URL.ftp",
++ "types" = "application/x-vnd.Be.URL.http",
++ "types" = "application/x-vnd.Be.URL.https",
++ "types" = "text/html",
++ "types" = "image/gif",
++ "types" = "image/png"
++};
++
++resource vector_icon {
++ $"6E6369661F0500020016029E8638A20EBA220EBA9E86384880254A18EA00FFFF"
++ $"8002001602BC9D88BB1F643B1F64BC9D884B716D48772700FFFF80020016023B"
++ $"F73A0000000000003BF73A49B5114976B000FFFF800200160237A0DDB61AF236"
++ $"1AF237A0DD497CAA48588100FFFF800200160238D81CB8152D38152D38D81C48"
++ $"420A499FB600FFFF8002001602397095000000000000397095486EDA49100600"
++ $"FFFF800200160231E5B2BA0EAF3A0EAF31E5B247DA3349779B00FFFF80020016"
++ $"0236BBEFB4543A34543A36BBEF495BDE469BC700FFFF6B0200160236E2E70000"
++ $"0000000036E2E74A2CD64670CD00FFFF800200160237AB1000000000000037AB"
++ $"104AE1D848449500FFFF5702001602375C10B74516374516375C1048B2B04AE9"
++ $"7200FFFF8002001602B07700B74912374912B077004898AD4AD99500FFFF8002"
++ $"00160232CFA5BA0B483A0B4832CFA54A3C584BA00E00FFFF8002001602368CB7"
++ $"000000000000368CB74B3D5E49752800FFFF4F0200160236A81C000000000000"
++ $"36A81C4B94C84A808500FFFF4002000602B738F7362603B62603B738F748BB3F"
++ $"4A241700A91212FFD7121202001602B04887376143B76143B0488748D36C44FB"
++ $"3100FFFF6B02001602B47620362BAAB62BAAB476204A0C144406C600FFFF8002"
++ $"001602B4CAE23409B3B409B3B4CAE24AD8D54611F100FFFF8002001602B328E4"
++ $"324E4AB24E4AB328E44B36A648859C00FFFF8002001602B22376311F03B11F03"
++ $"B223764B891349FFBC00FFFF80010079009803FF000004006002001602B4E6F3"
++ $"319259B19259B4E6F34B2F5D4AA2CA00FFFF0003FFFF0004FFD801FFFF669805"
++ $"000201060238CC87BD083D3DCC623981954609924A996B00FFB11BFFFFF9C727"
++ $"0633EEEBFFFFAAEAABDBAEBBBEAE2BC0CEB389C02424C074B415BFF0B478BFB4"
++ $"B450BFB7B455BFB6B455BF8CB436BF14B430BF55B42DBEF5B3FFBE82B33EBBDB"
++ $"B3F2BBCEB4D7BBD0B4BABBCBB4DABBC7B4DABBC7B4DABBC8B4DABB45B50ABB45"
++ $"B50ABB44B50ABB37B50DBB37B50DBAD6B534BA1EB58DBA78B560BA1EB58DBA12"
++ $"B593BA12B593BA0FB596B99BB5D6B99BB5D6B99AB5D6B975B5ECB975B5ECB974"
++ $"B5EDB918B626B918B626B917B626B8EDB642B893B681B887B689B86CB69CB7F2"
++ $"2AB7B5B72DB7A9B76EB73CB920B755B8C5B6B5B9A4B380BC3AB4F7BB4BB380BC"
++ $"3AB317BC7FB33E42B755C332B80EC320B7E7C323B7FBC3522CC3C54FBB03C7E8"
++ $"BAF4C7DBBAD1C898BA59CA44BC40CC83BAD4CBC3BDF3CD6FC0A0CDA4C760C888"
++ $"CA38C797C90DC879CB7BC6A2CC38C4DCCB9AC3A6CBB6C3DDCBA2C34CCBC2C1EB"
++ $"CA78BF62C954BF30C9ADBF3FC934BEE9C900BE83C91DBEC2C927BE17C999BCEA"
++ $"C857BA6BC720BABCC767BAABC73FBA2EC7C0B7EEC5B1B563C3F4B6DBC472B66F"
++ $"C405B613C427B41BC12CB2F006032FBAF5C05EBAF5C05EBAF7C05C34C05A34C0"
++ $"5B34C05A34C05B0610EE7AAAAAC693C7B5C9E8C667C896C755CAB5C5D3CB14C4"
++ $"7FC521B8CDC521B8CDC0B9B834BD7FBA63BC9BBC64B789BF00B92ABE82B789BF"
++ $"00C251BCE5C1CCBED1C0BCBE70C324BB51C5B0BB5AC71ABFC8C4E2C044C512C0"
++ $"5CCC1E0604EEBD7FBA63C521B8CDC0B9B834C521B8CDBF40B50AB87FB7A5BC0C"
++ $"B4F7B87FB7A50604FEBD7FBA63C521B8CDC0B9B834C521B8CDBF40B50ABF40B5"
++ $"0ABD2DB521B87FB7A5BA8CB5E9B87FB7A50605BB02B3F7BCF4B5CD36B3F7BCF4"
++ $"B789BF00BA19BDD6B8DABE8835BD1EBC9BBC64B801B9930A04B87FB7A5BD7FBA"
++ $"63BC9BBC64B801B9930A04B3F7BCF4B413C012B789C251B789BF000A04BC7AB8"
++ $"01BF99B6C0BE1BB43BBCAAB49E0A05BFE1B69AC187B3FFC341B4ABC30EB77BC2"
++ $"04B6CF0A05C3E9B805C594B69AC6D3B825C637BAECC521B8CD0A06B967C223B8"
++ $"A5C3F1BB51C5B0BE70C323BED1C0BCBCE5C1CC0A04B8A5C548B8A5C3F1BB51C5"
++ $"B0BB5AC71A0606BA0ABC41C6A5BB73C983BCF9CB79BBC8CAD5BE40CC23C05CCC"
++ $"1EC044C512BFC8C4E20A04C6A1BBC1C7E5BB6BC8ABBCF7C80EBE920A04C9EA41"
++ $"C8C5BFF3CABBC3D4CAE3C2140A06BA90C206BA19C33CBADEC3EBBEA7C1C4BED1"
++ $"C0BCBCE5C1CC0A06BC7AB801BCAAB49EBE1BB43BBE33B460BCDAB4C7BCB1B7EC"
++ $"0A04BFE1B69AC021B6A1C1ADB40DC187B3FF0A04C3E9B805C594B69AC5B7B6C3"
++ $"C41AB8250A04C6A1BBC1C7E5BB6BC7F4BB8EC6B9BBEC0A04C8C5BFF3C9EA41CA"
++ $"07C060C8E5C02B0628AAAAAAAAAAAEEFAAA9BACAB4C3BFCAE3C214C9EA41C8C5"
++ $"BFF3C80FBE90C8ABBCF7C7F4BB8EC7E5BB6BC6A1BBC1C637BAECC6D3B826C5B7"
++ $"B6C3C594B69AC3E9B805C3F9B80FC30EB77BC341B4ABC1ADB40DC187B3FFC068"
++ $"B5C6BF40B50ABE9BB514BF03B507BE9BB514BE1BB43BBCAAB49EBC9EB57CBC9E"
++ $"B57CBB34B5E3B87FB7A5B9BC29B87FB7A5B801B993B3F7BCF4B5CD36B3F7BCF4"
++ $"B413C012B789C251B964C223B8A5C3F1C548BB5AC71ABFC8C4E2C044C512C05C"
++ $"CC1EC693C7B5C9B7C688C894C759CAD2C5BECB14C47F0A06BE4DC302BB334EB8"
++ $"F2C3E4B99FC21DBCE5C1CCBEAEC0D1020ABFDBBBF7BFE1BBDFBFC9BC38BF63BC"
++ $"91BF9DBC71BEE7BCD8BE03BC31BE4BBCABBE03BC31BE00BC24BE0137BE10BC1A"
++ $"BE4BBC03BE30BC0EBE4BBC03BEE9BBBABEE9BBBABEE9BBBABF7BBB58BF7BBB58"
++ $"BF8FBB45BFBDBB29BFA9BB3440BB2DBFC3BB34BFC3BB34BFD9BB5BBFE7BBB2BF"
++ $"E7BB85BFE7BBC8020ABFD5BC12BFD9BC00BFC3BC4FBF67BC9CBF9CBC80BEFCBC"
++ $"DBBE32BC45BE70BCB4BE32BC45BE2BBC39BE30BC41BE3EBC32BE70BC1DBE58BC"
++ $"27BE70BC1DBEFEBBDDBEFEBBDDBEFEBBDDBF7EBB84BF7EBB84BF90BB77BFB7BB"
++ $"5CBFA7BB66BFBDBB5F40BB6640BB66BFD4BB87BFDCBBD4BFDCBBADBFDCBBEA06"
++ $"05BA02BC2BC6AFC155C3BAC269C139C245C1A9C25CC1A9C1A5C3EFBBF5C7310A"
++ $"04BC7AB801BF99B6C0C125B79BBFB3B7FF0A03BFE1B69AC3A0B7D5C204B6CF0A"
++ $"05BCAAC670BCB9C66BBE0FC73AC05BC70BBDF4C7890A04BC34C73FBDE5C88AC0"
++ $"4EC88BBDC9C8D80A04BB81C817BD6CC9CFC072C973BD505A0A04BB60C971BD4F"
++ $"CB2BC054CACFBD33CB790A03C6D944C9E8C6DAC695540A03BD9FBC21BEE9BBBA"
++ $"C059BA770204BF4DBBE8BF4DBC1ABF4DBBB7BF95BB8FBF6FBB8FBFBCBB8FBFD9"
++ $"BBE8BFD9BBB7BFD9BC1ABF95BC42BFBCBC42BF6FBC420A04BAD6C37ABBFAC2FD"
++ $"BAD1C336BA8CC2FD0606BA0ABC2BC6AF35C98ABCC1CB6BBB88CAC8BE00CC16C0"
++ $"49CC29C033C51CBFB5C4EA060DEE1FBF032F442B4F2B48294B244A2953235029"
++ $"532354295423542E58265A2E585C3030583058385A3B543B543554355335533B"
++ $"503A4A334F354B3348270A000100000A010101000A020102000A030103000A04"
++ $"0104000A050105000A060106000A070107000A080108000A090109000A0A010A"
++ $"000A0B010B000A0C010C000A0D010D000A0E010E000A0F010F000A100110000A"
++ $"110111000A120112000A130113000A140114000A150115000A1603161718000A"
++ $"170119000A18011A000A18011B000A18011C000A18011D000A18011E000A1801"
++ $"1F000A180120000A190121000A180122000A1A0123000A1B0124000A1C012500"
++ $"0A1D012638BFB3B32615FF01178400040A1D012638BFB3B32600150117860004"
++ $"0A1E012620BFB3B326"
++};
++
++
diff --git a/www-client/mozilla-firefox/patches/2009-09-27/r05-fix-shlibsign.README b/www-client/mozilla-firefox/patches/2009-09-27/r05-fix-shlibsign.README
new file mode 100644
index 000000000..65bfa2fbd
--- /dev/null
+++ b/www-client/mozilla-firefox/patches/2009-09-27/r05-fix-shlibsign.README
@@ -0,0 +1,66 @@
+ does this look odd for gcc2
+ #define NUM_ELEM(array) (sizeof(array)/sizeof(array[0])) CK_BBOOL true = CK_TRUE; CK_BBOOL false = CK_FALSE; static PRBool verbose = PR_FALSE;
+ #define NUM_ELEM(array) (sizeof(array)/sizeof(array[0]))
+ CK_BBOOL true = CK_TRUE;
+ CK_BBOOL false = CK_FALSE;
+ static PRBool verbose = PR_FALSE;
+ ignore the first line... bad paste :)
+ looks fine to me
+ here's the error http://haiku.pastebin.com/d3cf782e4
+ and the full file http://haiku.pastebin.com/d4125cc53
+ anyone wanna try ?
+ http://revolf.free.fr/beos/patches/oss-haiku-pci-reservation.diff
+ might have some macro issues there, it's using a ton of macro defines
+ mozilla-specific
+ any ideas what the error is indicating?
+ as I said, something's wrong with one of the macros, looking at the output of gcc -E for that line might be helpful
+ Disreali: does this uid/gid fix also fix the read-only files btw?
+ I think it was -E let me check
+ yep
+ -E with -o too ?
+ yes
+ it'll write the source after preprocessing to the output file
+ so you can see what all those macros actually evaluated to
+ unless that highlights something obvious you'd probably need to enlist tqh though, I know nothing about nspr
+ mmadia: it indicates that someone defines true/false to 1/0
+ so it ends up doing CK_BBOOL 1 = CK_TRUE
+ which is a syntax error
+ ah oops
+ totally overlooked that
+ most likely you one of the Be/Haiku headers is indirectly included
+ BeBuild.h I think does define them
+ you could #undef true and #undef false before those lines to make sure
+ cpp/stl_config.h:# define true 1
+ that should only be if __STL_NO_BOOL is defined though
+ and since it's a cpp header it shouldn't be used there right?
+ not seeing any others in the headers offhand
+ right
+ only other one I see is build/gcc-2.95.3/stdbool.h: #define true 1
+ which definitely isn't involved
+ it's included from SupportDefs
+ /* Grandfathering */
+ #ifndef __cplusplus
+ #include
+ #endif
+ yes but that's headers/build
+ also in headers/os
+ it's quite likely that you end up including SupportDefs.h one way or another
+ as it defines our native int types it's included indirectly by most Be/Haiku headers
+ hm, grep didn't find one in headers/os
+ at least not one doing that define
+ the #undef seems to have worked for now.
+ nah, it includes stdbool.h in haiku
+ that one presumably comes from the toolchain?
+ in beos it did define it at that place as far as I remember
+ stdbool.h that is
+ likely
+ it should be in the gcc headers
+ that explains that
+ not that I could find it off hand
+ ah, it's in the libgcc headers
+
+
+
+
+
+
diff --git a/www-client/mozilla-firefox/patches/2009-09-27/r05-fix-shlibsign.patch b/www-client/mozilla-firefox/patches/2009-09-27/r05-fix-shlibsign.patch
new file mode 100644
index 000000000..c46cbbd9a
--- /dev/null
+++ b/www-client/mozilla-firefox/patches/2009-09-27/r05-fix-shlibsign.patch
@@ -0,0 +1,16 @@
+Index: security/nss/cmd/shlibsign/shlibsign.c
+===================================================================
+--- security/nss/cmd/shlibsign/shlibsign.c (revision 7)
++++ security/nss/cmd/shlibsign/shlibsign.c (working copy)
+@@ -83,6 +83,11 @@
+ /* freebl headers */
+ #include "shsign.h"
+
++#ifdef XP_BEOS
++#undef true
++#undef false
++#endif
++
+ #define NUM_ELEM(array) (sizeof(array)/sizeof(array[0]))
+ CK_BBOOL true = CK_TRUE;
+ CK_BBOOL false = CK_FALSE;
diff --git a/www-client/mozilla-firefox/patches/2009-09-27/r06-nss-gcc4.patch b/www-client/mozilla-firefox/patches/2009-09-27/r06-nss-gcc4.patch
new file mode 100644
index 000000000..2a0496429
--- /dev/null
+++ b/www-client/mozilla-firefox/patches/2009-09-27/r06-nss-gcc4.patch
@@ -0,0 +1,55 @@
+Index: security/nss/cmd/lib/secutil.h
+===================================================================
+--- security/nss/cmd/lib/secutil.h (revision 7)
++++ security/nss/cmd/lib/secutil.h (working copy)
+@@ -450,7 +450,7 @@
+
+ void printflags(char *trusts, unsigned int flags);
+
+-#if !defined(XP_UNIX) && !defined(XP_OS2)
++#if !defined(XP_UNIX) && !defined(XP_OS2) && !defined(XP_BEOS)
+ extern int ffs(unsigned int i);
+ #endif
+
+Index: security/nss/lib/dev/ckhelper.c
+===================================================================
+--- security/nss/lib/dev/ckhelper.c (revision 7)
++++ security/nss/lib/dev/ckhelper.c (working copy)
+@@ -230,13 +230,13 @@
+ PRStatus *rvStatus
+ )
+ {
+- CK_BBOOL bool;
++ CK_BBOOL boolval;
+ CK_ATTRIBUTE_PTR attr;
+ CK_ATTRIBUTE atemplate = { 0, NULL, 0 };
+ CK_RV ckrv;
+ void *epv = nssSlot_GetCryptokiEPV(slot);
+ attr = &atemplate;
+- NSS_CK_SET_ATTRIBUTE_VAR(attr, attribute, bool);
++ NSS_CK_SET_ATTRIBUTE_VAR(attr, attribute, boolval);
+ nssSession_EnterMonitor(session);
+ ckrv = CKAPI(epv)->C_GetAttributeValue(session->handle, object,
+ &atemplate, 1);
+@@ -246,7 +246,7 @@
+ return PR_FALSE;
+ }
+ *rvStatus = PR_SUCCESS;
+- return (PRBool)(bool == CK_TRUE);
++ return (PRBool)(boolval == CK_TRUE);
+ }
+
+ NSS_IMPLEMENT PRStatus
+Index: security/nss/lib/freebl/unix_rand.c
+===================================================================
+--- security/nss/lib/freebl/unix_rand.c (revision 7)
++++ security/nss/lib/freebl/unix_rand.c (working copy)
+@@ -669,7 +669,7 @@
+ #endif /* VMS */
+
+ #ifdef BEOS
+-#include
++#include
+
+ static size_t
+ GetHighResClock(void *buf, size_t maxbytes)
diff --git a/www-client/mozilla-firefox/patches/2009-09-27/r07-working-nspr-from-haikuports.patch b/www-client/mozilla-firefox/patches/2009-09-27/r07-working-nspr-from-haikuports.patch
new file mode 100644
index 000000000..83868d3c9
--- /dev/null
+++ b/www-client/mozilla-firefox/patches/2009-09-27/r07-working-nspr-from-haikuports.patch
@@ -0,0 +1,5411 @@
+Index: nsprpub/pr/include/prtypes.h
+===================================================================
+--- nsprpub/pr/include/prtypes.h (revision 7)
++++ nsprpub/pr/include/prtypes.h (working copy)
+@@ -98,6 +98,24 @@
+
+ #elif defined(XP_BEOS)
+
++/* GCC 3.3 and later support the visibility attribute. */
++#if (__GNUC__ >= 4) || \
++ (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
++#define PR_VISIBILITY_DEFAULT __attribute__((visibility("default")))
++#define PR_EXPORT(__type) extern PR_VISIBILITY_DEFAULT __type
++#define PR_EXPORT_DATA(__type) extern PR_VISIBILITY_DEFAULT __type
++#define PR_IMPORT(__type) extern PR_VISIBILITY_DEFAULT __type
++#define PR_IMPORT_DATA(__type) extern PR_VISIBILITY_DEFAULT __type
++
++#define PR_EXTERN(__type) extern PR_VISIBILITY_DEFAULT __type
++#define PR_IMPLEMENT(__type) PR_VISIBILITY_DEFAULT __type
++#define PR_EXTERN_DATA(__type) extern PR_VISIBILITY_DEFAULT __type
++#define PR_IMPLEMENT_DATA(__type) PR_VISIBILITY_DEFAULT __type
++#define PR_CALLBACK
++#define PR_CALLBACK_DECL
++#define PR_STATIC_CALLBACK(__x) static __x
++
++#else
+ #define PR_EXPORT(__type) extern __declspec(dllexport) __type
+ #define PR_EXPORT_DATA(__type) extern __declspec(dllexport) __type
+ #define PR_IMPORT(__type) extern __declspec(dllexport) __type
+@@ -111,6 +129,7 @@
+ #define PR_CALLBACK
+ #define PR_CALLBACK_DECL
+ #define PR_STATIC_CALLBACK(__x) static __x
++#endif
+
+ #elif defined(WIN16)
+
+Index: nsprpub/pr/include/prio.h
+===================================================================
+--- nsprpub/pr/include/prio.h (revision 7)
++++ nsprpub/pr/include/prio.h (working copy)
+@@ -174,20 +174,20 @@
+ union PRNetAddr {
+ struct {
+ PRUint16 family; /* address family (0x00ff maskable) */
+-#ifdef XP_BEOS
+- char data[10]; /* Be has a smaller structure */
++#ifndef XP_BEOS
++ char data[14]; /* raw address data */
+ #else
+- char data[14]; /* raw address data */
++ char data[30];
+ #endif
+ } raw;
+ struct {
+ PRUint16 family; /* address family (AF_INET) */
+ PRUint16 port; /* port number */
+ PRUint32 ip; /* The actual 32 bits of address */
+-#ifdef XP_BEOS
+- char pad[4]; /* Be has a smaller structure */
++#ifndef XP_BEOS
++ char pad[8];
+ #else
+- char pad[8];
++ char pad[24];
+ #endif
+ } inet;
+ struct {
+@@ -196,6 +196,9 @@
+ PRUint32 flowinfo; /* routing information */
+ PRIPv6Addr ip; /* the actual 128 bits of address */
+ PRUint32 scope_id; /* set of interfaces for a scope */
++#ifdef XP_BEOS
++ char pad[4];
++#endif
+ } ipv6;
+ #if defined(XP_UNIX) || defined(XP_OS2_EMX)
+ struct { /* Unix domain socket address */
+Index: nsprpub/pr/include/md/_beos.cfg
+===================================================================
+--- nsprpub/pr/include/md/_beos.cfg (revision 7)
++++ nsprpub/pr/include/md/_beos.cfg (working copy)
+@@ -20,6 +20,7 @@
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
++ * Fredrik Holmqvist
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+@@ -40,7 +41,6 @@
+
+ #ifndef XP_BEOS
+ #define XP_BEOS
+-#undef XP_UNIX
+ #endif
+
+ #ifndef BEOS
+@@ -57,6 +57,12 @@
+ #undef IS_BIG_ENDIAN
+ #endif
+
++/*
++ * Fixme: Should be done according to arch
++ * Currently only x86/ia64.
++ */
++#define PR_ALIGN_OF_WORD 4
++
+ #define PR_BYTES_PER_BYTE 1
+ #define PR_BYTES_PER_SHORT 2
+ #define PR_BYTES_PER_INT 4
+Index: nsprpub/pr/include/md/_beos.h
+===================================================================
+--- nsprpub/pr/include/md/_beos.h (revision 7)
++++ nsprpub/pr/include/md/_beos.h (working copy)
+@@ -20,6 +20,7 @@
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
++ * Fredrik Holmqvist
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+@@ -38,19 +39,18 @@
+ #ifndef nspr_beos_defs_h___
+ #define nspr_beos_defs_h___
+
+-#include "prtypes.h"
+-#include "prio.h"
+-#include "prthread.h"
+-#include "prproces.h"
+-#include "prmem.h"
+-#include "obsolete/prsem.h"
+ #include
+-
+-#include
+-#include
+ #include
++#include
+
+ /*
++ * Hack for Cross compile
++ */
++#define FD_SETSIZE 1024
++
++#undef bool
++
++/*
+ * Internal configuration macros
+ */
+
+@@ -67,37 +67,39 @@
+ #endif
+ #define PR_DLL_SUFFIX ".so"
+
+-#define _PR_VMBASE 0x30000000
+-#define _PR_STACK_VMBASE 0x50000000
+ #define _MD_DEFAULT_STACK_SIZE 65536L
+-#define _MD_MMAP_FLAGS MAP_PRIVATE
+
+ #undef HAVE_STACK_GROWING_UP
+ #define HAVE_DLL
+-#define _PR_NO_CLOCK_TIMER
+
+ /*
+ * The Atomic operations
+ */
+
+ #define _PR_HAVE_ATOMIC_OPS
++#ifdef __powerpc__
+ #define _MD_INIT_ATOMIC _MD_AtomicInit
++#else
++#define _MD_INIT_ATOMIC()
++#endif
+ #define _MD_ATOMIC_INCREMENT _MD_AtomicIncrement
+ #define _MD_ATOMIC_ADD _MD_AtomicAdd
+ #define _MD_ATOMIC_DECREMENT _MD_AtomicDecrement
+ #define _MD_ATOMIC_SET _MD_AtomicSet
+
++/* Makes sure to don't create cvar when creating sem */
+ #define HAVE_CVAR_BUILT_ON_SEM
++
++/* Not sure this is needed, but no harm. */
+ #define _PR_GLOBAL_THREADS_ONLY
++
+ #define _PR_BTHREADS
+-#define _PR_NEED_FAKE_POLL
+-#define _PR_HAVE_PEEK_BUFFER
+-#define _PR_PEEK_BUFFER_MAX (16 * 1024)
+-#define _PR_FD_NEED_EMULATE_MSG_PEEK(fd) 1
+-#define _PR_CONNECT_DOES_NOT_BIND
++
+ #define _PR_HAVE_O_APPEND
+
+-/* Define threading functions and objects as native BeOS */
++/* Define threading functions and objects as native BeOS
++ Used by bthreads. */
++
+ struct _MDThread {
+ thread_id tid; /* BeOS thread handle */
+ sem_id joinSem; /* sems used to synchronzie joining */
+@@ -105,56 +107,16 @@
+ join this thread */
+ };
+
+-struct _MDThreadStack {
+- PRInt8 notused;
+-};
+-
+ /*
+- * Lock and Semaphore related definitions
+- */
+-
+-struct _MDLock {
+- sem_id semaphoreID;
+- int32 benaphoreCount;
+-};
+-
+-struct _MDCVar {
+- sem_id sem1;
+- sem_id sem2;
+- int16 count;
+-};
+-
+-struct _MDSemaphore {
+- sem_id sid;
+-};
+-
+-/*
+-** CPU-related definitions
+-*/
+-struct _MDCPU {
+- int8 unused;
+-};
+-
+-/*
+ ** Process-related definitions
+ */
+ struct _MDProcess {
+ pid_t pid;
+ };
+
+-struct _MDSegment {
+- PRInt8 notused;
+-};
+-
+ /*
+ ** File- and directory-related definitions
+ */
+-
+-#ifndef BONE_VERSION
+-#define BE_SOCK_SHUTDOWN_READ 0x01
+-#define BE_SOCK_SHUTDOWN_WRITE 0x02
+-#endif
+-
+ struct _MDFileDesc {
+ PRInt32 osfd;
+ PRInt32 sock_state;
+@@ -178,27 +140,21 @@
+
+ #define GETTIMEOFDAY(tp) gettimeofday((tp), NULL)
+
+-/* --- Memory-mapped files stuff --- not implemented on BeOS */
+
+-struct _MDFileMap {
+- PRInt8 unused;
+-};
+-
+ /*
+ * Network related definitions.
+ */
+
+ #ifndef BONE_VERSION
++#define BE_SOCK_SHUTDOWN_READ 0x01
++#define BE_SOCK_SHUTDOWN_WRITE 0x02
++
+ #define IPPROTO_IP 0
+ #define AF_UNIX 2
+ #define TCP_NODELAY SO_NONBLOCK
+ #define SO_LINGER -1
+ #define SO_ERROR 4
+-#endif
+
+-#define _PR_INTERRUPT_CHECK_INTERVAL_SECS 5
+-
+-#ifndef BONE_VERSION
+ /* these aren't actually used. if they are, we're screwed */
+ struct protoent {
+ char *p_name; /* official protocol name */
+@@ -210,169 +166,58 @@
+ struct protoent* getprotobynumber(int number);
+ #endif
+
++/* Used by bnet.c */
++#define _PR_INTERRUPT_CHECK_INTERVAL_SECS 5
++
+ /*
+ * malloc() related definitions.
++ * Avoids prmalloc.c's and prmem's code
+ */
+-
+ #undef _PR_OVERRIDE_MALLOC
+
+ /* Miscellaneous */
+
+ #define _MD_ERRNO() (errno)
+
+-#define _MD_CLEANUP_BEFORE_EXIT _MD_cleanup_before_exit
+-#define _MD_EXIT _MD_exit
++#define _MD_CLEANUP_BEFORE_EXIT()
++#define _MD_EXIT exit
+
+ #define _MD_GET_ENV getenv
+ #define _MD_PUT_ENV putenv
+
+-#define _MD_EARLY_INIT _MD_early_init
+-#define _MD_FINAL_INIT _MD_final_init
++#define _MD_EARLY_INIT()
++#ifdef BONE_VERSION
++#define _MD_FINAL_INIT()
++#else
++#define _MD_FINAL_INIT _MD_final_init_netserver
++#endif
+
+-/* CPU Stuff */
+-
+-#define _MD_INIT_CPUS _MD_init_cpus
+-#define _MD_WAKEUP_CPUS _MD_wakeup_cpus
+-#define _MD_START_INTERRUPTS _MD_start_interrupts
+-#define _MD_STOP_INTERRUPTS _MD_stop_interrupts
+-#define _MD_DISABLE_CLOCK_INTERRUPTS _MD_disable_clock_interrupts
+-#define _MD_BLOCK_CLOCK_INTERRUPTS _MD_block_clock_interrupts
+-#define _MD_UNBLOCK_CLOCK_INTERRUPTS _MD_unblock_clock_interrupts
+-#define _MD_CLOCK_INTERRUPT _MD_clock_interrupt
+-#define _MD_INIT_STACK _MD_init_stack
+-#define _MD_CLEAR_STACK _MD_clear_stack
+-// #define _MD_GET_INTSOFF _MD_get_intsoff
+-// #define _MD_SET_INTSOFF _MD_set_intsoff
+-#define _MD_CURRENT_CPU _MD_current_cpu
+-#define _MD_SET_CURRENT_CPU _MD_set_current_cpu
+-#define _MD_INIT_RUNNING_CPU _MD_init_running_cpu
+-#define _MD_PAUSE_CPU _MD_pause_cpu
+-
+ /* Thread stuff */
+
+ #define _MD_CURRENT_THREAD() PR_GetCurrentThread()
+-// #define _MD_GET_ATTACHED_THREAD _MD_get_attached_thread
+-#define _MD_LAST_THREAD _MD_last_thread
+-#define _MD_SET_CURRENT_THREAD _MD_set_current_THREAD
+-#define _MD_SET_LAST_THREAD _MD_set_last_thread
+-#define _MD_INIT_THREAD _MD_init_thread
+-#define _MD_EXIT_THREAD _MD_exit_thread
+-#define _MD_INIT_ATTACHED_THREAD _MD_init_attached_thread
+
+-#define _MD_SUSPEND_THREAD _MD_suspend_thread
+-#define _MD_RESUME_THREAD _MD_resume_thread
+-#define _MD_SUSPEND_CPU _MD_suspend_cpu
+-#define _MD_RESUME_CPU _MD_resume_cpu
+-#define _MD_BEGIN_SUSPEND_ALL _MD_begin_suspend_all
+-#define _MD_END_SUSPEND_ALL _MD_end_suspend_all
+-#define _MD_BEGIN_RESUME_ALL _MD_begin_resume_all
+-#define _MD_END_RESUME_ALL _MD_end_resume_all
+
+-#define _MD_GET_SP _MD_get_sp
+-
+-#define _MD_CLEAN_THREAD _MD_clean_thread
+-#define _MD_CREATE_PRIMORDIAL_USER_THREAD _MD_create_primordial_user_thread
+-#define _MD_CREATE_USER_THREAD _MD_create_user_thread
+-#define _MD_INIT_PRIMORDIAL_THREAD _MD_init_primordial_thread
+-#define _MD_CREATE_THREAD _MD_create_thread
+-#define _MD_YIELD _MD_yield
+-#define _MD_SET_PRIORITY _MD_set_priority
+-
+-#define _MD_SUSPENDALL _MD_suspendall
+-#define _MD_RESUMEALL _MD_resumeall
+-
+-#define _MD_SWITCH_CONTEXT _MD_switch_context
+-#define _MD_RESTORE_CONTEXT _MD_restore_context
+-
+-#define _MD_WAIT _MD_wait
+-#define _MD_WAKEUP_WAITER _MD_wakeup_waiter
+-
+-#define _MD_SETTHREADAFFINITYMASK _MD_setthreadaffinitymask
+-#define _MD_GETTHREADAFFINITYMASK _MD_getthreadaffinitymask
+-
+-/* Thread Synchronization */
+-
+-#define _MD_INIT_LOCKS _MD_init_locks
+-#define _MD_NEW_LOCK _MD_new_lock
+-#define _MD_FREE_LOCK _MD_free_lock
+-#define _MD_LOCK _MD_lock
+-#define _MD_TEST_AND_LOCK _MD_test_and_lock
+-#define _MD_UNLOCK _MD_unlock
+-#define _MD_IOQ_LOCK _MD_ioq_lock
+-#define _MD_IOQ_UNLOCK _MD_ioq_unlock
+-#define _MD_NEW_SEM _MD_new_sem
+-#define _MD_DESTROY_SEM _MD_destroy_sem
+-#define _MD_TIMED_WAIT_SEM _MD_timed_wait_sem
+-#define _MD_WAIT_SEM _MD_wait_sem
+-#define _MD_POST_SEM _MD_post_sem
+-// #define _MD_NEW_CV _MD_new_cv
+-// #define _MD_FREE_CV _MD_free_cv
+-// #define _MD_WAIT_CV _MD_wait_cv
+-// #define _MD_NOTIFY_CV _MD_notify_cv
+-// #define _MD_NOTIFYALL_CV _MD_notifyall_cv
+-
+ /* File I/O */
+
+-/* don't need any I/O initializations */
+-#define _MD_INIT_IO()
+-#define _MD_INIT_FILEDESC(fd)
++#define _PR_MD_WRITE
+
+-#define _MD_OPEN_DIR _MD_open_dir
+-#define _MD_READ_DIR _MD_read_dir
+-#define _MD_CLOSE_DIR _MD_close_dir
+-#define _MD_MAKE_NONBLOCK _MD_make_nonblock
+-#define _MD_SET_FD_INHERITABLE _MD_set_fd_inheritable
+-#define _MD_INIT_FD_INHERITABLE _MD_init_fd_inheritable
+-#define _MD_QUERY_FD_INHERITABLE _MD_query_fd_inheritable
+-#define _MD_OPEN _MD_open
+-#define _MD_OPEN_FILE _MD_open
+-#define _MD_CLOSE_FILE _MD_close_file
+-#define _MD_READ _MD_read
+-#define _MD_WRITE _MD_write
+-#define _MD_WRITEV _MD_writev
++/*
++These are defined in primpl.h so that they are avail for all, but we
++have no calls, and pthreads doesn't either.
+ #define _MD_LSEEK _MD_lseek
+ #define _MD_LSEEK64 _MD_lseek64
+-#define _MD_FSYNC _MD_fsync
+-#define _MD_DELETE _MD_delete
++
+ #define _MD_GETFILEINFO _MD_getfileinfo
+ #define _MD_GETFILEINFO64 _MD_getfileinfo64
+ #define _MD_GETOPENFILEINFO _MD_getopenfileinfo
+ #define _MD_GETOPENFILEINFO64 _MD_getopenfileinfo64
+-#define _MD_RENAME _MD_rename
+-#define _MD_ACCESS _MD_access
+-#define _MD_STAT stat
+-#define _MD_MKDIR _MD_mkdir
+-#define _MD_MAKE_DIR _MD_mkdir
+-#define _MD_RMDIR _MD_rmdir
+-#define _MD_PR_POLL _MD_pr_poll
++*/
+
+ /* Network I/O */
+
+-#define _MD_CLOSE_SOCKET _MD_close_socket
+-#define _MD_CONNECT _MD_connect
+-#define _MD_ACCEPT _MD_accept
+-#define _MD_BIND _MD_bind
+-#define _MD_LISTEN _MD_listen
+-#define _MD_SHUTDOWN _MD_shutdown
+-#define _MD_RECV _MD_recv
+-#define _MD_SEND _MD_send
+-#define _MD_ACCEPT_READ _MD_accept_read
+-#define _MD_GETSOCKNAME _MD_getsockname
+-#define _MD_GETPEERNAME _MD_getpeername
+-#define _MD_GETSOCKOPT _MD_getsockopt
+-#define _MD_SETSOCKOPT _MD_setsockopt
+-#define _MD_RECVFROM _MD_recvfrom
+-#define _MD_SENDTO _MD_sendto
+-#define _MD_SOCKETPAIR _MD_socketpair
+-#define _MD_SOCKET _MD_socket
+-#define _MD_SOCKETAVAILABLE _MD_socketavailable
+-#define _MD_PIPEAVAILABLE _MD_socketavailable
+-
+ #define _MD_GET_SOCKET_ERROR() (errno)
+ #define _MD_GETHOSTNAME _MD_gethostname
+
+-#define _MD_SELECT select
+-
+ /* Process management */
+
+ #define _MD_CREATE_PROCESS _MD_create_process
+@@ -380,19 +225,6 @@
+ #define _MD_WAIT_PROCESS _MD_wait_process
+ #define _MD_KILL_PROCESS _MD_kill_process
+
+-/* Atomic data operations */
+-
+-// #define _MD_INIT_ATOMIC _MD_init_atomic
+-// #define _MD_ATOMIC_INCREMENT _MD_atomic_increment
+-// #define _MD_ATOMIC_DECREMENT _MD_atomic_decrement
+-// #define _MD_ATOMIC_SET _MD_atomic_set
+-
+-/* memory management */
+-
+-#define _MD_INIT_SEGS _MD_init_segs
+-#define _MD_ALLOC_SEGMENT _MD_alloc_segment
+-#define _MD_FREE_SEGMENT _MD_free_segment
+-
+ /* Memory mapped file I/O */
+
+ #define _MD_CREATE_FILE_MAP _MD_create_file_map
+@@ -403,8 +235,7 @@
+
+ /* Time related */
+
+-#define _MD_NOW _MD_now
+-#define _MD_INTERVAL_INIT _MD_interval_init
++#define _MD_INTERVAL_INIT()
+ #define _MD_GET_INTERVAL _MD_get_interval
+ #define _MD_INTERVAL_PER_SEC _MD_interval_per_sec
+
+@@ -414,200 +245,4 @@
+ #define _MD_TLOCKFILE _MD_tlockfile
+ #define _MD_UNLOCKFILE _MD_unlockfile
+
+-/**
+- * Prototypes for machine dependent function implementations. (Too bad
+- * NSPR's MD system blows so much that we have to reiterate every stinking
+- * thing we implement here in our MD header file.)
+- */
+-
+-/* Miscellaneous */
+-
+-NSPR_API(void) _MD_cleanup_before_exit(void);
+-NSPR_API(void) _MD_exit(PRIntn status);
+-
+-NSPR_API(char*) _MD_get_env(const char *name);
+-NSPR_API(PRIntn) _MD_put_env(const char *name);
+-
+-NSPR_API(void) _MD_early_init(void);
+-NSPR_API(void) _MD_final_init(void);
+-
+-/* CPU Stuff */
+-
+-NSPR_API(void) _MD_init_cpus();
+-NSPR_API(void) _MD_wakeup_cpus();
+-NSPR_API(void) _MD_start_interrupts(void);
+-NSPR_API(void) _MD_stop_interrupts(void);
+-NSPR_API(void) _MD_disable_clock_interrupts(void);
+-NSPR_API(void) _MD_block_clock_interrupts(void);
+-NSPR_API(void) _MD_unblock_clock_interrupts(void);
+-NSPR_API(void) _MD_clock_interrupt(void);
+-// NSPR_API(void) _MD_init_stack(PRThreadStack *ts, PRIntn redzone);
+-// NSPR_API(void) _MD_clear_stack(PRThreadStack* ts);
+-// NSPR_API(PRInt32) _MD_get_intsoff(void);
+-// NSPR_API(void) _MD_set_intsoff(PRInt32 _val);
+-// NSPR_API(_PRCPU*) _MD_current_cpu(void);
+-// NSPR_API(void) _MD_set_current_cpu(_PRCPU *cpu);
+-// NSPR_API(void) _MD_init_running_cpu(_PRCPU *cpu);
+-NSPR_API(PRInt32) _MD_pause_cpu(PRIntervalTime timeout);
+-
+-/* Thread stuff */
+-
+-// NSPR_API(PRThread*) _MD_current_thread(void);
+-NSPR_API(PRThread*) _MD_get_attached_thread(void);
+-NSPR_API(PRThread*) _MD_last_thread(void);
+-NSPR_API(void) _MD_set_current_thread(PRThread *thread);
+-NSPR_API(void) _MD_set_last_thread(PRThread *thread);
+-NSPR_API(PRStatus) _MD_init_thread(PRThread *thread);
+-NSPR_API(void) _MD_exit_thread(PRThread *thread);
+-NSPR_API(PRStatus) _MD_init_attached_thread(PRThread *thread);
+-
+-NSPR_API(void) _MD_suspend_thread(PRThread *thread);
+-NSPR_API(void) _MD_resume_thread(PRThread *thread);
+-// NSPR_API(void) _MD_suspend_cpu(_PRCPU *cpu);
+-// NSPR_API(void) _MD_resume_cpu(_PRCPU *cpu);
+-NSPR_API(void) _MD_begin_suspend_all(void);
+-NSPR_API(void) _MD_end_suspend_all(void);
+-NSPR_API(void) _MD_begin_resume_all(void);
+-NSPR_API(void) _MD_end_resume_all(void);
+-
+-NSPR_API(void *) _MD_get_sp(PRThread *thread);
+-
+-NSPR_API(void) _MD_clean_thread(PRThread *thread);
+-NSPR_API(void) _MD_create_primordial_user_thread(PRThread *);
+-NSPR_API(PRThread*) _MD_create_user_thread(PRUint32 stacksize, void (*start)(void *), void *arg);
+-NSPR_API(void) _MD_init_primordial_thread(PRThread *thread);
+-NSPR_API(PRStatus) _MD_create_thread(PRThread *thread, void (*start)(void *), PRThreadPriority priority, PRThreadScope scope, PRThreadState state, PRUint32 stackSize);
+-NSPR_API(void) _MD_yield(void);
+-NSPR_API(void) _MD_set_priority(struct _MDThread *md, PRThreadPriority newPri);
+-
+-NSPR_API(void) _MD_suspendall(void);
+-NSPR_API(void) _MD_resumeall(void);
+-
+-NSPR_API(void) _MD_init_context(PRThread *thread, char *top, void (*start) (void), PRBool *status);
+-NSPR_API(void) _MD_switch_context(PRThread *thread);
+-NSPR_API(void) _MD_restore_context(PRThread *thread);
+-
+-NSPR_API(PRStatus) _MD_wait(PRThread *, PRIntervalTime timeout);
+-NSPR_API(PRStatus) _MD_wakeup_waiter(PRThread *);
+-
+-NSPR_API(PRInt32) _MD_setthreadaffinitymask(PRThread *thread, PRUint32 mask );
+-NSPR_API(PRInt32) _MD_getthreadaffinitymask(PRThread *thread, PRUint32 *mask);
+-
+-/* Thread Synchronization */
+-
+-NSPR_API(void) _MD_init_locks(void);
+-NSPR_API(PRStatus) _MD_new_lock(struct _MDLock *md);
+-NSPR_API(void) _MD_free_lock(struct _MDLock *md);
+-NSPR_API(void) _MD_lock(struct _MDLock *md);
+-NSPR_API(PRIntn) _MD_test_and_lock(struct _MDLock *md);
+-NSPR_API(void) _MD_unlock(struct _MDLock *md);
+-NSPR_API(void) _MD_ioq_lock(void);
+-NSPR_API(void) _MD_ioq_unlock(void);
+-NSPR_API(void) _MD_new_sem(struct _MDSemaphore *md, PRUintn value);
+-NSPR_API(void) _MD_destroy_sem(struct _MDSemaphore *md);
+-NSPR_API(PRStatus) _MD_timed_wait_sem(struct _MDSemaphore *md, PRIntervalTime timeout);
+-NSPR_API(PRStatus) _MD_wait_sem(struct _MDSemaphore *md);
+-NSPR_API(void) _MD_post_sem(struct _MDSemaphore *md);
+-// NSPR_API(PRInt32) _MD_new_cv(struct _MDCVar *md);
+-// NSPR_API(void) _MD_free_cv(struct _MDCVar *md);
+-// NSPR_API(void) _MD_wait_cv(struct _MDCVar *mdCVar, struct _MDLock *mdLock, PRIntervalTime timeout);
+-// NSPR_API(void) _MD_notify_cv(struct _MDCVar *md, struct _MDLock *lock);
+-// NSPR_API(void) _MD_notifyall_cv(struct _MDCVar *md, struct _MDLock *lock);
+-
+-/* File I/O */
+-
+-// NSPR_API(void) _MD_init_io(void);
+-NSPR_API(PRStatus) _MD_open_dir(struct _MDDir *md,const char *name);
+-NSPR_API(char *) _MD_read_dir(struct _MDDir *md, PRIntn flags);
+-NSPR_API(PRInt32) _MD_close_dir(struct _MDDir *md);
+-NSPR_API(void) _MD_make_nonblock(PRFileDesc *fd);
+-NSPR_API(void) _MD_init_fd_inheritable(PRFileDesc *fd, PRBool imported);
+-NSPR_API(void) _MD_query_fd_inheritable(PRFileDesc *fd);
+-NSPR_API(PRInt32) _MD_open(const char *name, PRIntn osflags, PRIntn mode);
+-NSPR_API(PRInt32) _MD_close_file(PRInt32 osfd);
+-NSPR_API(PRInt32) _MD_read(PRFileDesc *fd, void *buf, PRInt32 amount);
+-NSPR_API(PRInt32) _MD_write(PRFileDesc *fd, const void *buf, PRInt32 amount);
+-NSPR_API(PRInt32) _MD_writev(PRFileDesc *fd, const PRIOVec *iov, PRInt32 iov_size, PRIntervalTime timeout);
+-NSPR_API(PRInt32) _MD_lseek(PRFileDesc *fd, PRInt32 offset, int whence);
+-NSPR_API(PRInt64) _MD_lseek64(PRFileDesc *fd, PRInt64 offset, int whence);
+-NSPR_API(PRInt32) _MD_fsync(PRFileDesc *fd);
+-NSPR_API(PRInt32) _MD_delete(const char *name);
+-NSPR_API(PRInt32) _MD_getfileinfo(const char *fn, PRFileInfo *info);
+-NSPR_API(PRInt32) _MD_getfileinfo64(const char *fn, PRFileInfo64 *info);
+-NSPR_API(PRInt32) _MD_getopenfileinfo(const PRFileDesc *fd, PRFileInfo *info);
+-NSPR_API(PRInt32) _MD_getopenfileinfo64(const PRFileDesc *fd, PRFileInfo64 *info);
+-NSPR_API(PRInt32) _MD_rename(const char *from, const char *to);
+-NSPR_API(PRInt32) _MD_access(const char *name, PRIntn how);
+-NSPR_API(PRInt32) _MD_stat(const char *name, struct stat *buf);
+-NSPR_API(PRInt32) _MD_mkdir(const char *name, PRIntn mode);
+-NSPR_API(PRInt32) _MD_rmdir(const char *name);
+-NSPR_API(PRInt32) _MD_pr_poll(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout);
+-
+-/* Network I/O */
+-NSPR_API(PRInt32) _MD_close_socket(PRInt32 osfd);
+-NSPR_API(PRInt32) _MD_connect(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout);
+-NSPR_API(PRInt32) _MD_accept(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout);
+-NSPR_API(PRInt32) _MD_bind(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen);
+-NSPR_API(PRInt32) _MD_listen(PRFileDesc *fd, PRIntn backlog);
+-NSPR_API(PRInt32) _MD_shutdown(PRFileDesc *fd, PRIntn how);
+-NSPR_API(PRInt32) _MD_recv(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRIntervalTime timeout);
+-NSPR_API(PRInt32) _MD_send(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, PRIntervalTime timeout);
+-NSPR_API(PRInt32) _MD_accept_read(PRFileDesc *sd, PRInt32 *newSock, PRNetAddr **raddr, void *buf, PRInt32 amount, PRIntervalTime timeout);
+-// NSPR_API(PRInt32) _MD_fast_accept(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout, PRBool fast, _PR_AcceptTimeoutCallback callback, void *callbackArg);
+-// NSPR_API(PRInt32) _MD_fast_accept_read(PRFileDesc *sd, PRInt32 *newSock, PRNetAddr **raddr, void *buf, PRInt32 amount, PRIntervalTime timeout, PRBool fast, _PR_AcceptTimeoutCallback callback, void *callbackArg);
+-// NSPR_API(void) _MD_update_accept_context(PRInt32 s, PRInt32 ls);
+-NSPR_API(PRStatus) _MD_getsockname(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen);
+-NSPR_API(PRStatus) _MD_getpeername(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen);
+-NSPR_API(PRStatus) _MD_getsockopt(PRFileDesc *fd, PRInt32 level, PRInt32 optname, char* optval, PRInt32* optlen);
+-NSPR_API(PRStatus) _MD_setsockopt(PRFileDesc *fd, PRInt32 level, PRInt32 optname, const char* optval, PRInt32 optlen);
+-NSPR_API(PRInt32) _MD_recvfrom(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout);
+-NSPR_API(PRInt32) _MD_sendto(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout);
+-NSPR_API(PRInt32) _MD_socketpair(int af, int type, int flags, PRInt32 *osfd);
+-NSPR_API(PRInt32) _MD_socket(int af, int type, int flags);
+-NSPR_API(PRInt32) _MD_socketavailable(PRFileDesc *fd);
+-
+-// NSPR_API(PRInt32) _MD_get_socket_error(void);
+-NSPR_API(PRStatus) _MD_gethostname(char *name, PRUint32 namelen);
+-
+-/* Process management */
+-
+-NSPR_API(PRProcess *) _MD_create_process(const char *path, char *const *argv, char *const *envp, const PRProcessAttr *attr);
+-NSPR_API(PRStatus) _MD_detach_process(PRProcess *process);
+-NSPR_API(PRStatus) _MD_wait_process(PRProcess *process, PRInt32 *exitCode);
+-NSPR_API(PRStatus) _MD_kill_process(PRProcess *process);
+-
+-/* Atomic data operations */
+-
+-// NSPR_API(void) _MD_init_atomic(void);
+-// NSPR_API(PRInt32) _MD_atomic_increment(PRInt32 *);
+-// NSPR_API(PRInt32) _MD_atomic_decrement(PRInt32 *);
+-// NSPR_API(PRInt32) _MD_atomic_set(PRInt32 *, PRInt32);
+-
+-/* Memory management */
+-
+-NSPR_API(void) _MD_init_segs(void);
+-NSPR_API(PRStatus) _MD_alloc_segment(PRSegment *seg, PRUint32 size, void *vaddr);
+-NSPR_API(void) _MD_free_segment(PRSegment *seg);
+-
+-/* Memory mapped file I/O */
+-
+-NSPR_API(PRStatus) _MD_create_file_map(PRFileMap *fmap, PRInt64 size);
+-NSPR_API(PRInt32) _MD_get_mem_map_alignment(void);
+-NSPR_API(void *) _MD_mem_map(PRFileMap *fmap, PRInt64 offset, PRUint32 len);
+-NSPR_API(PRStatus) _MD_mem_unmap(void *addr, PRUint32 size);
+-NSPR_API(PRStatus) _MD_close_file_map(PRFileMap *fmap);
+-
+-/* Time related */
+-
+-NSPR_API(PRTime) _MD_now(void);
+-NSPR_API(void) _MD_interval_init(void);
+-NSPR_API(PRIntervalTime) _MD_get_interval(void);
+-NSPR_API(PRIntervalTime) _MD_interval_per_sec(void);
+-
+-/* File locking */
+-
+-NSPR_API(PRStatus) _MD_lockfile(PRInt32 osfd);
+-NSPR_API(PRStatus) _MD_tlockfile(PRInt32 osfd);
+-NSPR_API(PRStatus) _MD_unlockfile(PRInt32 osfd);
+-
+ #endif /* _nspr_beos_defs_h___*/
+Index: nsprpub/pr/include/private/primpl.h
+===================================================================
+--- nsprpub/pr/include/private/primpl.h (revision 7)
++++ nsprpub/pr/include/private/primpl.h (working copy)
+@@ -50,10 +50,6 @@
+ #include
+ #endif
+
+-#if defined(_PR_BTHREADS)
+-#include
+-#endif
+-
+ #ifdef WINNT
+ /* Need to force service-pack 3 extensions to be defined by
+ ** setting _WIN32_WINNT to NT 4.0 for winsock.h, winbase.h, winnt.h.
+@@ -228,6 +224,20 @@
+
+ #else /* defined(_PR_PTHREADS) */
+
++#ifdef _PR_BTHREADS
++#define _MD_GET_ATTACHED_THREAD() (_PR_MD_CURRENT_THREAD())
++
++#define _PR_IS_NATIVE_THREAD(thread) 1
++#define _PR_IS_NATIVE_THREAD_SUPPORTED() 1
++/*
++extern PRInt32 _PR_MD_WRITE(PRFileDesc *fd, const void *buf, PRInt32 amount);
++#define _PR_MD_WRITE _MD_WRITE
++*/
++NSPR_API(PRThread*) _PR_MD_CURRENT_THREAD(void);
++#define _PR_MD_CURRENT_THREAD _MD_CURRENT_THREAD
++
++#else /* defined(_PR_BTHREADS) */
++
+ NSPR_API(void) PT_FPrintStats(PRFileDesc *fd, const char *msg);
+
+ /*
+@@ -1301,6 +1311,7 @@
+ extern void *_PR_MD_GET_SP(PRThread *thread);
+ #define _PR_MD_GET_SP _MD_GET_SP
+
++#endif /* defined(_PR_BTHREADS) */
+ #endif /* defined(_PR_PTHREADS) */
+
+ /************************************************************************/
+@@ -1555,7 +1566,10 @@
+
+ #if defined(_PR_PTHREADS)
+ #else /* defined(_PR_PTHREADS) */
++#if defined(_PR_BTHREADS)
++#else /* defined(_PR_BTHREADS) */
+ _MDThreadStack md;
++#endif /* defined(_PR_BTHREADS) */
+ #endif /* defined(_PR_PTHREADS) */
+ };
+
+@@ -1608,9 +1622,6 @@
+ #elif defined(_PR_BTHREADS)
+ PRUint32 flags;
+ _MDThread md;
+- PRBool io_pending;
+- PRInt32 io_fd;
+- PRBool io_suspended;
+ #else /* not pthreads or Be threads */
+ _MDLock threadLock; /* Lock to protect thread state variables.
+ * Protects the following fields:
+@@ -1694,7 +1705,9 @@
+ struct PRFileMap {
+ PRFileDesc *fd;
+ PRFileMapProtect prot;
++#if !defined(XP_BEOS)
+ _MDFileMap md;
++#endif /* !defined(XP_BEOS) */
+ };
+
+ /************************************************************************/
+@@ -1777,8 +1790,10 @@
+ #endif /* MOZ_UNICODE */
+
+ extern void _PR_InitSegs(void);
++#if !defined(_PR_BTHREADS)
+ extern void _PR_InitStacks(void);
+ extern void _PR_InitTPD(void);
++#endif /* !defined(_PR_BTHREADS) */
+ extern void _PR_InitMem(void);
+ extern void _PR_InitEnv(void);
+ extern void _PR_InitCMon(void);
+@@ -1830,7 +1845,10 @@
+ PRUintn flags;
+ #if defined(_PR_PTHREADS)
+ #else /* defined(_PR_PTHREADS) */
++#if defined(_PR_BTHREADS)
++#else /* defined(_PR_BTHREADS) */
+ _MDSegment md;
++#endif /* defined(_PR_BTHREADS) */
+ #endif /* defined(_PR_PTHREADS) */
+ };
+
+@@ -2127,7 +2145,7 @@
+
+ /* end PR_GetRandomNoise() related */
+
+-#ifdef XP_BEOS
++#if defined(XP_BEOS) && !defined(BONE_VERSION)
+
+ extern PRLock *_connectLock;
+
+@@ -2142,7 +2160,7 @@
+
+ extern PRUint32 connectCount;
+
+-#endif /* XP_BEOS */
++#endif /* XP_BEOS && !BONE_VERSION */
+
+ PR_END_EXTERN_C
+
+Index: nsprpub/pr/src/Makefile.in
+===================================================================
+--- nsprpub/pr/src/Makefile.in (revision 7)
++++ nsprpub/pr/src/Makefile.in (working copy)
+@@ -281,15 +281,13 @@
+ pthreads/$(OBJDIR)/ptthread.$(OBJ_SUFFIX) \
+ pthreads/$(OBJDIR)/ptmisc.$(OBJ_SUFFIX)
+ else
++ifndef USE_BTHREADS
+ 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 += \
++ misc/$(OBJDIR)/pripcsem.$(OBJ_SUFFIX) \
+ threads/$(OBJDIR)/prcthr.$(OBJ_SUFFIX) \
+ threads/$(OBJDIR)/prdump.$(OBJ_SUFFIX) \
+ threads/$(OBJDIR)/prmon.$(OBJ_SUFFIX) \
+@@ -300,7 +298,6 @@
+ threads/combined/$(OBJDIR)/prustack.$(OBJ_SUFFIX) \
+ threads/combined/$(OBJDIR)/pruthr.$(OBJ_SUFFIX)
+ endif
+-
+ endif
+
+ ifeq ($(USE_CPLUS), 1)
+Index: nsprpub/pr/src/misc/Makefile.in
+===================================================================
+--- nsprpub/pr/src/misc/Makefile.in (revision 7)
++++ nsprpub/pr/src/misc/Makefile.in (working copy)
+@@ -71,10 +71,12 @@
+ $(NULL)
+
+ ifndef USE_PTHREADS
++ifndef USE_BTHREADS
+ CSRCS += \
+ pripcsem.c \
+ $(NULL)
+ endif
++endif
+
+ TARGETS = $(OBJS)
+
+Index: nsprpub/pr/src/misc/prinit.c
+===================================================================
+--- nsprpub/pr/src/misc/prinit.c (revision 7)
++++ nsprpub/pr/src/misc/prinit.c (working copy)
+@@ -196,8 +196,10 @@
+ _PR_InitLocks();
+ _PR_InitAtomic();
+ _PR_InitSegs();
++#if !defined(_PR_BTHREADS)
+ _PR_InitStacks();
+ _PR_InitTPD();
++#endif /*!defined(_PR_BTHREADS) */
+ _PR_InitEnv();
+ _PR_InitLayerCache();
+ _PR_InitClock();
+Index: nsprpub/pr/src/misc/pripcsem.c
+===================================================================
+--- nsprpub/pr/src/misc/pripcsem.c (revision 7)
++++ nsprpub/pr/src/misc/pripcsem.c (working copy)
+@@ -46,9 +46,9 @@
+
+ #include "primpl.h"
+
+-#ifdef _PR_PTHREADS
++#if defined(_PR_PTHREADS) || defined(_PR_BTHREADS)
+
+-#error "This file should not be compiled for the pthreads version"
++#error "This file should not be compiled for the pthreads or bthreads version"
+
+ #else
+
+@@ -127,4 +127,4 @@
+ return _PR_MD_DELETE_SEMAPHORE(osname);
+ }
+
+-#endif /* _PR_PTHREADS */
++#endif /* _PR_PTHREADS || _PR_BTHREADS */
+Index: nsprpub/pr/src/linking/prlink.c
+===================================================================
+--- nsprpub/pr/src/linking/prlink.c (revision 7)
++++ nsprpub/pr/src/linking/prlink.c (working copy)
+@@ -199,8 +199,10 @@
+
+ #ifdef XP_BEOS
+ void* dlh;
++#ifndef XP_HAIKU
+ void* stub_dlh;
+ #endif
++#endif
+ };
+
+ static PRLibrary *pr_loadmap;
+@@ -863,6 +865,19 @@
+ result = pr_UnlockedFindLibrary(name);
+ #endif
+
++#ifdef XP_BEOS
++ /* Havn't seen this happen so far, but it doesn't slow anything
++ down so let's keep it */
++ for (result = pr_loadmap; result != NULL; result = result->next) {
++ /* hopefully, our caller will always use the same string
++ to refer to the same library */
++ if (strcmp(name, result->name) == 0) {
++ result->refCount++;
++ break;
++ }
++ }
++#endif
++
+ if (result != NULL) goto unlock;
+
+ lm = PR_NEWZAP(PRLibrary);
+@@ -1020,29 +1035,14 @@
+ #endif /* HAVE_DLL */
+ #endif /* XP_UNIX */
+
+- lm->refCount = 1;
+-
+ #ifdef XP_BEOS
+- {
+- image_info info;
+- int32 cookie = 0;
++ { /* Code block to allow variable inits. :/ */
++ /* it appears the library isn't yet loaded - load it now */
++#ifdef XP_HAIKU
++ image_id imageid = load_add_on(name);
++#else
+ image_id imageid = B_ERROR;
+ image_id stubid = B_ERROR;
+- PRLibrary *p;
+-
+- 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 */
+- imageid = info.id;
+- lm->refCount++;
+- break;
+- }
+- }
+-
+- if(imageid == 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 -
+@@ -1069,36 +1069,37 @@
+ /* first, attempt to load the stub (thereby loading the
+ component as a shared library */
+ if ((stubid = load_add_on(stubName)) > B_ERROR) {
++
++ const char *endOfPassedName = strrchr(name, '/');
++ image_info info;
++ int32 cookie = 0;
++
+ /* the stub was loaded successfully. */
+ imageid = B_FILE_NOT_FOUND;
++ if( 0 == endOfPassedName )
++ endOfPassedName = name;
++ else
++ endOfPassedName++;
+
+- cookie = 0;
+ while (get_next_image_info(0, &cookie, &info) == B_OK) {
+ const char *endOfSystemName = strrchr(info.name, '/');
+- const 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 */
+ imageid = info.id;
+ break;
+ }
+ }
+-
+ } else {
+ /* we failed to load the "stub" - try to load the
+ component directly as an add-on */
+ stubid = B_ERROR;
+ imageid = load_add_on(name);
+ }
+- }
+-
++#endif /* XP_HAIKU */
+ if (imageid <= B_ERROR) {
+ oserr = imageid;
+ PR_DELETE( lm );
+@@ -1106,12 +1107,15 @@
+ }
+ lm->name = strdup(name);
+ lm->dlh = (void*)imageid;
++#ifndef XP_HAIKU
+ lm->stub_dlh = (void*)stubid;
++#endif
+ lm->next = pr_loadmap;
+ pr_loadmap = lm;
+ }
+-#endif
++#endif /* XP_BEOS */
+
++ lm->refCount = 1;
+ result = lm; /* success */
+ PR_LOG(_pr_linker_lm, PR_LOG_MIN, ("Loaded library %s (load lib)", lm->name));
+
+@@ -1272,11 +1276,15 @@
+ }
+
+ #ifdef XP_BEOS
++#ifdef XP_HAIKU
++ unload_add_on( (image_id) lib->dlh );
++#else
+ if(((image_id)lib->stub_dlh) == B_ERROR)
+ unload_add_on( (image_id) lib->dlh );
+ else
+ unload_add_on( (image_id) lib->stub_dlh);
+-#endif
++#endif /* XP_HAIKU */
++#endif /* XP_BEOS */
+
+ #ifdef XP_UNIX
+ #ifdef HAVE_DLL
+Index: nsprpub/pr/src/bthreads/bsrcs.mk
+===================================================================
+--- nsprpub/pr/src/bthreads/bsrcs.mk (revision 7)
++++ nsprpub/pr/src/bthreads/bsrcs.mk (working copy)
+@@ -20,6 +20,7 @@
+ # the Initial Developer. All Rights Reserved.
+ #
+ # Contributor(s):
++# Fredrik Holmqvist
+ #
+ # Alternatively, the contents of this file may be used under the terms of
+ # either the GNU General Public License Version 2 or later (the "GPL"), or
+@@ -46,4 +47,6 @@
+ btmon.c \
+ btsem.c \
+ btmisc.c \
++ btfile.c \
++ btio.c \
+ $(NULL)
+Index: nsprpub/pr/src/bthreads/btcvar.c
+===================================================================
+--- nsprpub/pr/src/bthreads/btcvar.c (revision 7)
++++ nsprpub/pr/src/bthreads/btcvar.c (working copy)
+@@ -20,6 +20,7 @@
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
++ * Fredrik Holmqvist
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+@@ -35,8 +36,6 @@
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+-#include
+-
+ #include "primpl.h"
+
+ /*
+@@ -130,16 +129,16 @@
+ return PR_SUCCESS;
+ }
+
+- if( atomic_add( &cvar->signalBenCount, 1 ) > 0 )
++ if( _MD_ATOMIC_INCREMENT( &cvar->signalBenCount ) > 1 )
+ {
+ if (acquire_sem(cvar->signalSem) == B_INTERRUPTED)
+ {
+- atomic_add( &cvar->signalBenCount, -1 );
++ _MD_ATOMIC_DECREMENT( &cvar->signalBenCount );
+ return PR_FAILURE;
+ }
+ }
+ cvar->nw += 1;
+- if( atomic_add( &cvar->signalBenCount, -1 ) > 1 )
++ if( _MD_ATOMIC_DECREMENT( &cvar->signalBenCount ) > 0 )
+ {
+ release_sem_etc(cvar->signalSem, 1, B_DO_NOT_RESCHEDULE);
+ }
+@@ -154,7 +153,7 @@
+ err = acquire_sem_etc(cvar->sem, 1, B_RELATIVE_TIMEOUT, PR_IntervalToMicroseconds(timeout) );
+ }
+
+- if( atomic_add( &cvar->signalBenCount, 1 ) > 0 )
++ if( _MD_ATOMIC_INCREMENT( &cvar->signalBenCount ) > 1 )
+ {
+ while (acquire_sem(cvar->signalSem) == B_INTERRUPTED);
+ }
+@@ -165,18 +164,18 @@
+ cvar->ns -= 1;
+ }
+ cvar->nw -= 1;
+- if( atomic_add( &cvar->signalBenCount, -1 ) > 1 )
++ if( _MD_ATOMIC_DECREMENT( &cvar->signalBenCount ) > 0 )
+ {
+ release_sem_etc(cvar->signalSem, 1, B_DO_NOT_RESCHEDULE);
+ }
+
+ PR_Lock( cvar->lock );
+- if(err!=B_NO_ERROR)
++ if(err==B_NO_ERROR || (err == B_TIMED_OUT && timeout!=PR_INTERVAL_NO_TIMEOUT))
+ {
+- return PR_FAILURE;
+- }
+ return PR_SUCCESS;
+ }
++ return PR_FAILURE;
++}
+
+ /*
+ ** Notify ONE thread that is currently waiting on 'cvar'. Which thread is
+@@ -195,11 +194,11 @@
+ PR_NotifyCondVar (PRCondVar *cvar)
+ {
+ status_t err ;
+- if( atomic_add( &cvar->signalBenCount, 1 ) > 0 )
++ if( _MD_ATOMIC_INCREMENT( &cvar->signalBenCount) > 1 )
+ {
+ if (acquire_sem(cvar->signalSem) == B_INTERRUPTED)
+ {
+- atomic_add( &cvar->signalBenCount, -1 );
++ _MD_ATOMIC_DECREMENT( &cvar->signalBenCount );
+ return PR_FAILURE;
+ }
+ }
+@@ -207,7 +206,7 @@
+ {
+ cvar->ns += 1;
+ release_sem_etc(cvar->sem, 1, B_DO_NOT_RESCHEDULE);
+- if( atomic_add( &cvar->signalBenCount, -1 ) > 1 )
++ if( _MD_ATOMIC_DECREMENT( &cvar->signalBenCount) > 0 )
+ {
+ release_sem_etc(cvar->signalSem, 1, B_DO_NOT_RESCHEDULE);
+ }
+@@ -219,7 +218,7 @@
+ }
+ else
+ {
+- if( atomic_add( &cvar->signalBenCount, -1 ) > 1 )
++ if( _MD_ATOMIC_DECREMENT( &cvar->signalBenCount ) > 0 )
+ {
+ release_sem_etc(cvar->signalSem, 1, B_DO_NOT_RESCHEDULE);
+ }
+@@ -241,11 +240,11 @@
+ int32 handshakes;
+ status_t err = B_OK;
+
+- if( atomic_add( &cvar->signalBenCount, 1 ) > 0 )
++ if( _MD_ATOMIC_INCREMENT( &cvar->signalBenCount) > 1 )
+ {
+ if (acquire_sem(cvar->signalSem) == B_INTERRUPTED)
+ {
+- atomic_add( &cvar->signalBenCount, -1 );
++ _MD_ATOMIC_DECREMENT( &cvar->signalBenCount );
+ return PR_FAILURE;
+ }
+ }
+@@ -255,7 +254,7 @@
+ handshakes = cvar->nw - cvar->ns;
+ cvar->ns = cvar->nw;
+ release_sem_etc(cvar->sem, handshakes, B_DO_NOT_RESCHEDULE);
+- if( atomic_add( &cvar->signalBenCount, -1 ) > 1 )
++ if( _MD_ATOMIC_DECREMENT( &cvar->signalBenCount ) > 0 )
+ {
+ release_sem_etc(cvar->signalSem, 1, B_DO_NOT_RESCHEDULE);
+ }
+@@ -267,7 +266,7 @@
+ }
+ else
+ {
+- if( atomic_add( &cvar->signalBenCount, -1 ) > 1 )
++ if( _MD_ATOMIC_DECREMENT( &cvar->signalBenCount ) > 0 )
+ {
+ release_sem_etc(cvar->signalSem, 1, B_DO_NOT_RESCHEDULE);
+ }
+Index: nsprpub/pr/src/bthreads/btlocks.c
+===================================================================
+--- nsprpub/pr/src/bthreads/btlocks.c (revision 7)
++++ nsprpub/pr/src/bthreads/btlocks.c (working copy)
+@@ -43,9 +43,6 @@
+
+ #include "primpl.h"
+
+-#include
+-#include
+-
+ void
+ _PR_InitLocks (void)
+ {
+@@ -61,16 +58,13 @@
+
+ lock = PR_NEWZAP(PRLock);
+ if (lock != NULL) {
+-
+ lock->benaphoreCount = 0;
+ lock->semaphoreID = create_sem( 0, "nsprLockSem" );
+ if( lock->semaphoreID < B_NO_ERROR ) {
+-
+ PR_DELETE( lock );
+ lock = NULL;
+ }
+ }
+-
+ return lock;
+ }
+
+@@ -88,17 +82,18 @@
+ PR_IMPLEMENT(void)
+ PR_Lock (PRLock* lock)
+ {
++ status_t result;
++
+ PR_ASSERT(lock != NULL);
+
+- if( atomic_add( &lock->benaphoreCount, 1 ) > 0 ) {
+-
+- if( acquire_sem(lock->semaphoreID ) != B_NO_ERROR ) {
+-
+- atomic_add( &lock->benaphoreCount, -1 );
++ if( _MD_ATOMIC_INCREMENT( &lock->benaphoreCount) > 1 ) {
++ result = acquire_sem(lock->semaphoreID );
++ PR_ASSERT(result == B_NO_ERROR);
++ if( result != B_NO_ERROR ) {
++ _MD_ATOMIC_DECREMENT( &lock->benaphoreCount);
+ return;
+ }
+ }
+-
+ lock->owner = find_thread( NULL );
+ }
+
+@@ -107,8 +102,7 @@
+ {
+ PR_ASSERT(lock != NULL);
+ lock->owner = NULL;
+- if( atomic_add( &lock->benaphoreCount, -1 ) > 1 ) {
+-
++ if( _MD_ATOMIC_DECREMENT( &lock->benaphoreCount ) > 0 ) {
+ release_sem_etc( lock->semaphoreID, 1, B_DO_NOT_RESCHEDULE );
+ }
+
+Index: nsprpub/pr/src/bthreads/btmisc.c
+===================================================================
+--- nsprpub/pr/src/bthreads/btmisc.c (revision 7)
++++ nsprpub/pr/src/bthreads/btmisc.c (working copy)
+@@ -20,6 +20,7 @@
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
++ * Fredrik Holmqvist
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+@@ -38,11 +39,11 @@
+ #include "primpl.h"
+ #include
+
+-// void _PR_InitCPUs(void) {PT_LOG("_PR_InitCPUs")}
+-// void _MD_StartInterrupts(void) {PT_LOG("_MD_StartInterrupts")}
+-
+-/* this is a total hack.. */
+-
++/* this is a total hack..
++ * It's needed for netserver to compile.
++ * See nsprpub/pr/include/prnetdb.h
++ */
++#ifndef BONE_VERSION
+ struct protoent* getprotobyname(const char* name)
+ {
+ return 0;
+@@ -52,51 +53,17 @@
+ {
+ return 0;
+ }
++#endif
+
+-/* this is needed by prinit for some reason */
+-void
+-_PR_InitStacks (void)
+-{
+-}
+-
+-/* this is needed by prinit for some reason */
+-void
+-_PR_InitTPD (void)
+-{
+-}
+-
+ /*
+-** Create extra virtual processor threads. Generally used with MP systems.
+-*/
+-PR_IMPLEMENT(void)
+- PR_SetConcurrency (PRUintn numCPUs)
+-{
+-}
+-
+-/*
+-** Set thread recycle mode to on (1) or off (0)
+-*/
+-PR_IMPLEMENT(void)
+- PR_SetThreadRecycleMode (PRUint32 flag)
+-{
+-}
+-
+-/*
+ ** Get context registers, return with error for now.
+ */
+-
+ PR_IMPLEMENT(PRWord *)
+ _MD_HomeGCRegisters( PRThread *t, int isCurrent, int *np )
+ {
+ return 0;
+ }
+
+-PR_IMPLEMENT(void *)
+-PR_GetSP( PRThread *t )
+-{
+- return 0;
+-}
+-
+ PR_IMPLEMENT(PRStatus)
+ PR_EnumerateThreads( PREnumerator func, void *arg )
+ {
+Index: nsprpub/pr/src/bthreads/btfile.c
+===================================================================
+--- nsprpub/pr/src/bthreads/btfile.c (revision 0)
++++ nsprpub/pr/src/bthreads/btfile.c (revision 0)
+@@ -0,0 +1,994 @@
++/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
++/* ***** BEGIN LICENSE BLOCK *****
++ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
++ *
++ * The contents of this file are subject to the Mozilla Public License Version
++ * 1.1 (the "License"); you may not use this file except in compliance with
++ * the License. You may obtain a copy of the License at
++ * http://www.mozilla.org/MPL/
++ *
++ * Software distributed under the License is distributed on an "AS IS" basis,
++ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
++ * for the specific language governing rights and limitations under the
++ * License.
++ *
++ * The Original Code is the Netscape Portable Runtime (NSPR).
++ *
++ * The Initial Developer of the Original Code is
++ * Netscape Communications Corporation.
++ * Portions created by the Initial Developer are Copyright (C) 1998-2000
++ * the Initial Developer. All Rights Reserved.
++ *
++ * Contributor(s):
++ * Roy Yokoyama
++ *
++ * Alternatively, the contents of this file may be used under the terms of
++ * either the GNU General Public License Version 2 or later (the "GPL"), or
++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
++ * in which case the provisions of the GPL or the LGPL are applicable instead
++ * of those above. If you wish to allow use of your version of this file only
++ * under the terms of either the GPL or the LGPL, and not to allow others to
++ * use your version of this file under the terms of the MPL, indicate your
++ * decision by deleting the provisions above and replace them with the notice
++ * and other provisions required by the GPL or the LGPL. If you do not delete
++ * the provisions above, a recipient may use your version of this file under
++ * the terms of any one of the MPL, the GPL or the LGPL.
++ *
++ * ***** END LICENSE BLOCK ***** */
++
++#include "primpl.h"
++
++static PRLock *_pr_flock_lock; /* For PR_LockFile() etc. */
++static PRCondVar *_pr_flock_cv; /* For PR_LockFile() etc. */
++
++PRErrorCode
++map_default_error(int err)
++{
++ switch (err) {
++ case EACCES:
++ return PR_NO_ACCESS_RIGHTS_ERROR;
++ case EADDRINUSE:
++ return PR_ADDRESS_IN_USE_ERROR;
++ case EADDRNOTAVAIL:
++ return PR_ADDRESS_NOT_AVAILABLE_ERROR;
++ case EAFNOSUPPORT:
++ return PR_ADDRESS_NOT_SUPPORTED_ERROR;
++ /*Same as EWOULDBLOCK*/
++ case EAGAIN:
++ return PR_WOULD_BLOCK_ERROR;
++#if EALREADY != EBUSY
++ case EALREADY:
++ return PR_ALREADY_INITIATED_ERROR;
++#endif
++ case EBADF:
++ return PR_BAD_DESCRIPTOR_ERROR;
++ case EBUSY:
++ return PR_FILESYSTEM_MOUNTED_ERROR;
++ case ECONNABORTED:
++ return PR_CONNECT_ABORTED_ERROR;
++ case ECONNREFUSED:
++ return PR_CONNECT_REFUSED_ERROR;
++ case EDEADLK:
++ return PR_DEADLOCK_ERROR;
++ case EEXIST:
++ return PR_FILE_EXISTS_ERROR;
++ case EFAULT:
++ return PR_ACCESS_FAULT_ERROR;
++ case EFBIG:
++ return PR_FILE_TOO_BIG_ERROR;
++ case EHOSTUNREACH:
++ return PR_HOST_UNREACHABLE_ERROR;
++ case EINPROGRESS:
++ return PR_IN_PROGRESS_ERROR;
++ case EINTR:
++ return PR_PENDING_INTERRUPT_ERROR;
++ case EINVAL:
++ return PR_INVALID_ARGUMENT_ERROR;
++ case EIO:
++ return PR_IO_ERROR;
++ case EISCONN:
++ return PR_IS_CONNECTED_ERROR;
++ case EISDIR:
++ return PR_IS_DIRECTORY_ERROR;
++ case ELOOP:
++ return PR_LOOP_ERROR;
++ case EMFILE:
++ return PR_PROC_DESC_TABLE_FULL_ERROR;
++ case EMLINK:
++ return PR_MAX_DIRECTORY_ENTRIES_ERROR;
++ case EMSGSIZE:
++ return PR_INVALID_ARGUMENT_ERROR;
++ case ENAMETOOLONG:
++ return PR_NAME_TOO_LONG_ERROR;
++ case ENETUNREACH:
++ return PR_NETWORK_UNREACHABLE_ERROR;
++ case ENFILE:
++ return PR_SYS_DESC_TABLE_FULL_ERROR;
++ case ENOBUFS:
++ return PR_INSUFFICIENT_RESOURCES_ERROR;
++ case ENODEV:
++ case ENOENT:
++ return PR_FILE_NOT_FOUND_ERROR;
++ case ENOLCK:
++ return PR_FILE_IS_LOCKED_ERROR;
++#if 0
++ case ENOLINK:
++ return PR_REMOTE_FILE_ERROR;
++#endif
++ case ENOMEM:
++ return PR_OUT_OF_MEMORY_ERROR;
++ case ENOPROTOOPT:
++ return PR_INVALID_ARGUMENT_ERROR;
++ case ENOSPC:
++ return PR_NO_DEVICE_SPACE_ERROR;
++ case ENOTCONN:
++ return PR_NOT_CONNECTED_ERROR;
++ case ENOTDIR:
++ return PR_NOT_DIRECTORY_ERROR;
++ case ENOTSOCK:
++ return PR_NOT_SOCKET_ERROR;
++ case ENXIO:
++ return PR_FILE_NOT_FOUND_ERROR;
++ case EOPNOTSUPP:
++ return PR_NOT_TCP_SOCKET_ERROR;
++ case EOVERFLOW:
++ return PR_BUFFER_OVERFLOW_ERROR;
++ case EPERM:
++ return PR_NO_ACCESS_RIGHTS_ERROR;
++ case EPIPE:
++ return PR_CONNECT_RESET_ERROR;
++ case EPROTONOSUPPORT:
++ return PR_PROTOCOL_NOT_SUPPORTED_ERROR;
++ case EPROTOTYPE:
++ return PR_ADDRESS_NOT_SUPPORTED_ERROR;
++ case ERANGE:
++ return PR_INVALID_METHOD_ERROR;
++ case EROFS:
++ return PR_READ_ONLY_FILESYSTEM_ERROR;
++ case ESPIPE:
++ return PR_INVALID_METHOD_ERROR;
++ case ETIMEDOUT:
++ return PR_IO_TIMEOUT_ERROR;
++ case EXDEV:
++ return PR_NOT_SAME_DEVICE_ERROR;
++ default:
++ return PR_UNKNOWN_ERROR;
++ }
++}
++
++
++inline void
++set_open_error(int err)
++{
++ PRErrorCode prError;
++ switch (err) {
++ case EAGAIN:
++ case ENOMEM:
++ prError = PR_INSUFFICIENT_RESOURCES_ERROR;
++ break;
++ case EBUSY:
++ prError = PR_IO_ERROR;
++ break;
++ case ENODEV:
++ prError = PR_FILE_NOT_FOUND_ERROR;
++ break;
++ case EOVERFLOW:
++ prError = PR_FILE_TOO_BIG_ERROR;
++ break;
++ case ETIMEDOUT:
++ prError = PR_REMOTE_FILE_ERROR;
++ break;
++ default:
++ prError = map_default_error(err);
++ }
++ PR_SetError(prError, err);
++}
++
++
++inline void
++set_rename_error(int err)
++{
++ PR_SetError(err == EEXIST ? PR_DIRECTORY_NOT_EMPTY_ERROR : map_default_error(err), err);
++}
++
++
++inline void
++set_unlink_error(int err)
++{
++ PR_SetError(err == EPERM ? PR_IS_DIRECTORY_ERROR : map_default_error(err), err);
++}
++
++
++inline void
++set_opendir_error(int err)
++{
++ PR_SetError(map_default_error(err), err);
++}
++
++inline void
++set_closedir_error(int err)
++{
++ PR_SetError( err == EINVAL ? PR_BAD_DESCRIPTOR_ERROR : map_default_error(err), err);
++}
++
++inline void
++set_readdir_error(int err)
++{
++ PRErrorCode prError;
++ switch (err) {
++ case 0:
++ case ENOENT:
++ prError = PR_NO_MORE_FILES_ERROR;
++ break;
++ case EOVERFLOW:
++ case EINVAL:
++ case ENXIO:
++ prError = PR_IO_ERROR;
++ break;
++ default:
++ prError = map_default_error(err);
++ }
++ PR_SetError(prError, err);
++}
++
++
++inline void
++set_mkdir_error(int err)
++{
++ PR_SetError(map_default_error(err), err);
++}
++
++
++inline void
++set_rmdir_error(int err)
++{
++ PRErrorCode prError;
++ switch (err) {
++ case ENOTEMPTY:
++ case EEXIST:
++ case EINVAL:
++ prError = PR_DIRECTORY_NOT_EMPTY_ERROR;
++ break;
++ case ETIMEDOUT:
++ prError = PR_REMOTE_FILE_ERROR;
++ break;
++ default:
++ prError = map_default_error(err);
++ }
++ PR_SetError(prError, err);
++}
++
++
++inline void
++set_close_error(int err)
++{
++ PR_SetError( err == ETIMEDOUT ? PR_REMOTE_FILE_ERROR : map_default_error(err), err);
++}
++
++
++inline void
++set_read_error(int err)
++{
++ PRErrorCode prError;
++ switch (err) {
++ case EINVAL:
++ prError = PR_INVALID_METHOD_ERROR;
++ break;
++ case ENXIO:
++ prError = PR_INVALID_ARGUMENT_ERROR;
++ break;
++ default:
++ prError = map_default_error(err);
++ }
++ PR_SetError(prError, err);
++}
++
++
++inline void
++set_write_error(int err)
++{
++ PRErrorCode prError;
++ switch (err) {
++ case EINVAL:
++ prError = PR_INVALID_METHOD_ERROR;
++ break;
++ case ENXIO:
++ prError = PR_INVALID_ARGUMENT_ERROR;
++ break;
++ case ETIMEDOUT:
++ prError = PR_REMOTE_FILE_ERROR;
++ break;
++ default:
++ prError = map_default_error(err);
++ }
++ PR_SetError(prError, err);
++}
++
++
++inline void
++set_lseek_error(int err)
++{
++ PR_SetError(map_default_error(err), err);
++}
++
++
++inline void
++set_fsync_error(int err)
++{
++ PRErrorCode prError;
++ switch (err) {
++ case EINVAL:
++ prError = PR_INVALID_METHOD_ERROR;
++ break;
++ case ETIMEDOUT:
++ prError = PR_REMOTE_FILE_ERROR;
++ break;
++ default:
++ prError = map_default_error(err);
++ }
++ PR_SetError(prError, err);
++}
++
++
++inline void
++set_fstat_error(int err)
++{
++ PR_SetError(err == ETIMEDOUT ? PR_REMOTE_FILE_ERROR : map_default_error(err), err);
++}
++
++/* TODO: using uint8 instead of bool due to code that uses bool as var name in hard to change places
++ therefore we had to undef it. Or we need to change Haiku's headers around so we can include
++ everything we need except the bool decl. */
++PRFileDesc * bt_CreateFileDesc(PRIntn osfd, const PRIOMethods * methods, _PRTriStateBool inheritable, uint8 nonblocking) {
++ const int blocking = 1;
++ PRFileDesc *fd = _PR_Getfd();
++ if (fd == NULL)
++ {
++ PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
++ return NULL;
++ }
++ fd->secret->md.osfd = osfd;
++ fd->secret->state = _PR_FILEDESC_OPEN;
++ fd->secret->inheritable = inheritable;
++ fd->methods = methods;
++ if (nonblocking)
++ setsockopt(osfd, SOL_SOCKET, SO_NONBLOCK, &blocking, sizeof(blocking));
++ return fd;
++}
++
++
++PR_IMPLEMENT(PRFileDesc*) PR_GetSpecialFD(PRSpecialFD osfd)
++{
++ PR_ASSERT(osfd >= PR_StandardInput && osfd <= PR_StandardError);
++
++ if (!_pr_initialized) _PR_ImplicitInitialization();
++
++ switch (osfd)
++ {
++ case PR_StandardInput: return _pr_stdin;
++ case PR_StandardOutput: return _pr_stdout;
++ case PR_StandardError: return _pr_stderr;
++ default:
++ PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
++ }
++ return NULL;
++} /* PR_GetSpecialFD */
++
++
++PR_IMPLEMENT(PRFileDesc*) PR_Open(const char *name, PRIntn flags, PRIntn mode)
++{
++ return PR_OpenFile(name, flags, mode);
++} /* PR_Open */
++
++PR_IMPLEMENT(PRFileDesc*) PR_OpenFile(const char *name, PRIntn flags, PRIntn mode)
++{
++ PRFileDesc *fd = NULL;
++ PRInt32 osflags;
++ PRInt32 osfd, err;
++
++ if (flags & PR_RDWR) {
++ osflags = O_RDWR;
++ } else if (flags & PR_WRONLY) {
++ osflags = O_WRONLY;
++ } else {
++ osflags = O_RDONLY;
++ }
++
++ if (flags & PR_EXCL)
++ osflags |= O_EXCL;
++ if (flags & PR_APPEND)
++ osflags |= O_APPEND;
++ if (flags & PR_TRUNCATE)
++ osflags |= O_TRUNC;
++ if (flags & PR_SYNC) {
++/* Ummmm. BeOS doesn't appear to
++ support sync in any way shape or
++ form. */
++ return PR_NOT_IMPLEMENTED_ERROR;
++ }
++
++ if (flags & PR_CREATE_FILE)
++ {
++ osflags |= O_CREAT;
++ }
++
++ osfd = open(name, osflags, mode);
++ if (osfd < 0) {
++ err = _MD_ERRNO();
++ set_open_error(err);
++ }
++
++ if(osfd>=0) {
++ fd = bt_CreateFileDesc(osfd, PR_GetFileMethods(), _PR_TRI_TRUE, false);
++ if (fd == NULL) close(osfd); /* $$$ whoops! this is bad $$$ */
++ }
++ return fd;
++} /* PR_OpenFile */
++
++/*
++** Import an existing OS file to NSPR
++*/
++PR_IMPLEMENT(PRFileDesc*) PR_ImportFile(PRInt32 osfd)
++{
++ PRFileDesc *fd = NULL;
++
++ if (!_pr_initialized) _PR_ImplicitInitialization();
++
++ fd = bt_CreateFileDesc(osfd, PR_GetFileMethods(), _PR_TRI_UNKNOWN, false);
++ if (NULL == fd) close(osfd);
++ return fd;
++}
++
++/*
++** Import an existing OS pipe to NSPR
++*/
++PR_IMPLEMENT(PRFileDesc*) PR_ImportPipe(PRInt32 osfd)
++{
++ PRFileDesc *fd = NULL;
++
++ if (!_pr_initialized) _PR_ImplicitInitialization();
++ fd = bt_CreateFileDesc(osfd, PR_GetPipeMethods(), _PR_TRI_UNKNOWN, true);
++
++ if (NULL == fd) close(osfd);
++ return fd;
++}
++
++
++PR_IMPLEMENT(PRStatus) PR_Rename(const char *from, const char *to)
++{
++ PRInt32 rv = -1, err;
++
++ if (0 == access(to, F_OK))
++ PR_SetError(PR_FILE_EXISTS_ERROR, 0);
++ else
++ {
++ rv = rename(from, to);
++ if (rv < 0) {
++ err = _MD_ERRNO();
++ set_rename_error(err);
++ }
++ }
++ if (rv < 0) {
++ return PR_FAILURE;
++ } else {
++ return PR_SUCCESS;
++ }
++}
++
++PR_IMPLEMENT(PRStatus) PR_Delete(const char *name)
++{
++ PRInt32 rv, err;
++
++ rv = unlink(name);
++ if (rv < 0) {
++ err = _MD_ERRNO();
++ set_unlink_error(err);
++ return PR_FAILURE;
++ } else
++ return PR_SUCCESS;
++}
++
++
++PR_IMPLEMENT(PRDir*) PR_OpenDir(const char *name)
++{
++ PRDir *dir;
++ PRInt32 err;
++
++ dir = PR_NEW(PRDir);
++ if (dir) {
++ dir->md.d = opendir(name);
++ if (NULL == dir->md.d) {
++ err = _MD_ERRNO();
++ set_opendir_error(err);
++ PR_DELETE(dir);
++ return NULL;
++ }
++ } else {
++ PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
++ }
++ return dir;
++}
++
++PR_IMPLEMENT(PRDirEntry*) PR_ReadDir(PRDir *dir, PRDirFlags flags)
++{
++ PRInt32 err;
++ struct dirent *de;
++ for (;;) {
++ /*
++ * XXX: readdir() is not MT-safe
++ */
++ _MD_ERRNO() = 0;
++ de = readdir(dir->md.d);
++
++ if (!de) {
++ err = _MD_ERRNO();
++ set_readdir_error(err);
++ return 0;
++ }
++
++ if ((flags & PR_SKIP_DOT) &&
++ (de->d_name[0] == '.') && (de->d_name[1] == 0))
++ continue;
++
++ if ((flags & PR_SKIP_DOT_DOT) &&
++ (de->d_name[0] == '.') && (de->d_name[1] == '.') &&
++ (de->d_name[2] == 0))
++ continue;
++
++ if ((flags & PR_SKIP_HIDDEN) && (de->d_name[1] == '.'))
++ continue;
++
++ break;
++ }
++
++ dir->d.name = de->d_name;
++ return de->d_name ? &dir->d : NULL;
++}
++
++PR_IMPLEMENT(PRStatus) PR_CloseDir(PRDir *dir)
++{
++ PRInt32 rv, err;
++
++ if (dir && dir->md.d) {
++ rv = closedir(dir->md.d);
++ PR_DELETE(dir);
++ if (rv < 0) {
++ err = _MD_ERRNO();
++ set_closedir_error(err);
++ return PR_FAILURE;
++ }
++ }
++ return PR_SUCCESS;
++}
++
++PR_IMPLEMENT(PRStatus) PR_MkDir(const char *name, PRIntn mode)
++{
++ status_t rv;
++ int err;
++
++ rv = mkdir(name, mode);
++
++ if (rv < 0) {
++ err = _MD_ERRNO();
++ set_mkdir_error(err);
++ return PR_FAILURE;
++ }
++ return PR_SUCCESS;
++}
++
++PR_IMPLEMENT(PRStatus) PR_MakeDir(const char *name, PRIntn mode)
++{
++ if (!_pr_initialized) _PR_ImplicitInitialization();
++ return PR_MkDir(name, mode);
++}
++
++PR_IMPLEMENT(PRStatus) PR_RmDir(const char *name)
++{
++ PRInt32 rv, err;
++
++ rv = rmdir(name);
++ if (rv < 0) {
++ err = _MD_ERRNO();
++ set_rmdir_error(err);
++ return PR_FAILURE;
++ } else
++ return PR_SUCCESS;
++}
++
++PR_IMPLEMENT(PRInt32)
++PR_FileDesc2NativeHandle(PRFileDesc *fd)
++{
++ if (fd) {
++ fd = PR_GetIdentitiesLayer(fd, PR_NSPR_IO_LAYER);
++ }
++ if (!fd) {
++ PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
++ return -1;
++ }
++
++ return fd->secret->md.osfd;
++}
++
++#ifdef MOZ_UNICODE
++/*
++ * UTF16 Interface
++ */
++PR_IMPLEMENT(PRDirUTF16*) PR_OpenDirUTF16(const PRUnichar *name)
++{
++ PRDirUTF16 *dir;
++ PRStatus sts;
++
++ dir = PR_NEW(PRDirUTF16);
++ if (dir) {
++ sts = _PR_MD_OPEN_DIR_UTF16(&dir->md,name);
++ if (sts != PR_SUCCESS) {
++ PR_DELETE(dir);
++ return NULL;
++ }
++ } else {
++ PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
++ }
++ return dir;
++}
++
++PR_IMPLEMENT(PRDirEntryUTF16*) PR_ReadDirUTF16(PRDirUTF16 *dir, PRDirFlags flags)
++{
++ /*
++ * _MD_READ_DIR_UTF16 return a PRUnichar* to the name; allocation in
++ * machine-dependent code
++ */
++ PRUnichar* name = _PR_MD_READ_DIR_UTF16(&dir->md, flags);
++ dir->d.name = name;
++ return name ? &dir->d : NULL;
++}
++
++PR_IMPLEMENT(PRStatus) PR_CloseDirUTF16(PRDirUTF16 *dir)
++{
++ PRInt32 rv;
++
++ if (dir) {
++ rv = _PR_MD_CLOSE_DIR_UTF16(&dir->md);
++ PR_DELETE(dir);
++ if (rv < 0)
++ return PR_FAILURE;
++ else
++ return PR_SUCCESS;
++ }
++ return PR_SUCCESS;
++}
++
++#endif /* MOZ_UNICODE */
++
++
++static PRStatus PR_CALLBACK FileClose(PRFileDesc *fd)
++{
++ PRInt32 err;
++ if (!fd || !fd->secret
++ || (fd->secret->state != _PR_FILEDESC_OPEN
++ && fd->secret->state != _PR_FILEDESC_CLOSED)) {
++ PR_SetError(PR_BAD_DESCRIPTOR_ERROR, 0);
++ return PR_FAILURE;
++ }
++
++ if (fd->secret->state == _PR_FILEDESC_OPEN) {
++ if (close(fd->secret->md.osfd) < 0) {
++ err = _MD_ERRNO();
++ set_close_error(err);
++ return PR_FAILURE;
++ }
++ fd->secret->state = _PR_FILEDESC_CLOSED;
++ }
++ PR_ASSERT(fd);
++ _PR_Putfd(fd);
++ return PR_SUCCESS;
++}
++
++static PRInt32 PR_CALLBACK FileRead(PRFileDesc *fd, void *buf, PRInt32 amount)
++{
++ PRInt32 rv,err = 0;
++
++ rv = read(fd->secret->md.osfd, buf, amount);
++ if (rv < 0) {
++ err = _MD_ERRNO();
++ set_read_error(err);
++ PR_ASSERT(rv == -1);
++ }
++ PR_LOG(_pr_io_lm, PR_LOG_MAX, ("read -> %d", rv));
++ return rv;
++}
++
++static PRInt32 PR_CALLBACK FileWrite(PRFileDesc *fd, const void *buf, PRInt32 amount)
++{
++ PRInt32 rv,err = 0;
++ PRInt32 temp, count;
++
++ count = 0;
++ while (amount > 0) {
++ temp = write(fd->secret->md.osfd, buf, amount);
++ if (temp < 0) {
++ err = _MD_ERRNO();
++ set_write_error(err);
++ count = -1;
++ break;
++ }
++ count += temp;
++ if (fd->secret->nonblocking) {
++ break;
++ }
++ buf = (const void*) ((const char*)buf + temp);
++ amount -= temp;
++ }
++ PR_LOG(_pr_io_lm, PR_LOG_MAX, ("write -> %d", count));
++ return count;
++}
++
++static PRInt32 PR_CALLBACK FileAvailable(PRFileDesc *fd)
++{
++ PRInt32 result, cur, end, err;
++
++ cur = lseek(fd->secret->md.osfd, 0, PR_SEEK_CUR);
++
++ if (cur >= 0)
++ end = lseek(fd->secret->md.osfd, 0, PR_SEEK_END);
++
++ if ((cur < 0) || (end < 0)) {
++ err = _MD_ERRNO();
++ set_lseek_error(err);
++ return -1;
++ }
++
++ result = end - cur;
++ lseek(fd->secret->md.osfd, cur, PR_SEEK_SET);
++
++ return result;
++}
++
++static PRInt64 PR_CALLBACK FileAvailable64(PRFileDesc *fd)
++{
++ PRInt64 result, cur, end;
++ PRInt64 minus_one;
++ PRInt32 err;
++
++ cur = lseek(fd->secret->md.osfd, LL_ZERO, PR_SEEK_CUR);
++
++ if (LL_GE_ZERO(cur))
++ end = lseek(fd->secret->md.osfd, LL_ZERO, PR_SEEK_END);
++
++ if (!LL_GE_ZERO(cur) || !LL_GE_ZERO(end)) {
++ LL_I2L(minus_one, -1);
++ err = _MD_ERRNO();
++ set_lseek_error(err);
++ return minus_one;
++ }
++ LL_SUB(result, end, cur);
++ lseek(fd->secret->md.osfd, cur, PR_SEEK_SET);
++ return result;
++}
++
++static PRStatus PR_CALLBACK FileSync(PRFileDesc *fd)
++{
++ PRInt32 result, err;
++ result = fsync(fd->secret->md.osfd);
++ if (result < 0) {
++ err = _MD_ERRNO();
++ set_fsync_error(err);
++ return PR_FAILURE;
++ }
++ return PR_SUCCESS;
++}
++
++static PROffset32 PR_CALLBACK FileSeek(PRFileDesc *fd, PROffset32 offset, PRSeekWhence whence)
++{
++ PROffset32 result;
++ PRInt32 err;
++ result = lseek(fd->secret->md.osfd, offset, whence);
++ if(result<0) {
++ err = _MD_ERRNO();
++ set_lseek_error(err);
++ }
++ return result;
++}
++
++static PROffset64 PR_CALLBACK FileSeek64(PRFileDesc *fd, PROffset64 offset, PRSeekWhence whence)
++{
++ PROffset64 result;
++ PRInt32 err;
++
++ result = lseek(fd->secret->md.osfd, offset, whence);
++ if(!LL_GE_ZERO(result)) {
++ err = _MD_ERRNO();
++ set_lseek_error(err);
++ }
++ return result;
++}
++
++static PRStatus PR_CALLBACK FileGetInfo(PRFileDesc *fd, PRFileInfo *info)
++{
++ struct stat sb;
++ PRInt64 s, s2us;
++ PRInt32 rv, err;
++
++ rv = fstat(fd->secret->md.osfd, &sb);
++ if (rv < 0) {
++ err = _MD_ERRNO();
++ set_fstat_error(err);
++ return PR_FAILURE;
++ }
++ if(info) {
++ if (S_IFREG & sb.st_mode)
++ info->type = PR_FILE_FILE ;
++ else if (S_IFDIR & sb.st_mode)
++ info->type = PR_FILE_DIRECTORY;
++ else
++ info->type = PR_FILE_OTHER;
++ /* Use lower 32 bits of file size */
++ info->size = ( sb.st_size & 0xffffffff);
++ LL_I2L(s, sb.st_mtime);
++ LL_I2L(s2us, PR_USEC_PER_SEC);
++ LL_MUL(s, s, s2us);
++ info->modifyTime = s;
++ LL_I2L(s, sb.st_ctime);
++ LL_MUL(s, s, s2us);
++ info->creationTime = s;
++ }
++ return PR_SUCCESS;
++}
++
++static PRStatus PR_CALLBACK FileGetInfo64(PRFileDesc *fd, PRFileInfo64 *info)
++{
++ struct stat sb;
++ PRInt64 s, s2us;
++ PRInt32 rv, err;
++
++ rv = fstat(fd->secret->md.osfd, &sb);
++ if (rv < 0) {
++ err = _MD_ERRNO();
++ set_fstat_error(err);
++ return PR_FAILURE;
++ }
++ if(info) {
++ if (S_IFREG & sb.st_mode)
++ info->type = PR_FILE_FILE ;
++ else if (S_IFDIR & sb.st_mode)
++ info->type = PR_FILE_DIRECTORY;
++ else
++ info->type = PR_FILE_OTHER;
++ info->size = sb.st_size;
++ LL_I2L(s, sb.st_mtime);
++ LL_I2L(s2us, PR_USEC_PER_SEC);
++ LL_MUL(s, s, s2us);
++ info->modifyTime = s;
++ LL_I2L(s, sb.st_ctime);
++ LL_MUL(s, s, s2us);
++ info->creationTime = s;
++ }
++ return PR_SUCCESS;
++}
++
++static PRInt16 PR_CALLBACK FilePoll(
++ PRFileDesc *fd, PRInt16 in_flags, PRInt16 *out_flags)
++{
++ *out_flags = 0;
++ return in_flags;
++} /* FilePoll */
++
++
++static PRIOMethods _pr_fileMethods = {
++ PR_DESC_FILE,
++ FileClose,
++ FileRead,
++ FileWrite,
++ FileAvailable,
++ FileAvailable64,
++ FileSync,
++ FileSeek,
++ FileSeek64,
++ FileGetInfo,
++ FileGetInfo64,
++ (PRWritevFN)_PR_InvalidInt,
++ (PRConnectFN)_PR_InvalidStatus,
++ (PRAcceptFN)_PR_InvalidDesc,
++ (PRBindFN)_PR_InvalidStatus,
++ (PRListenFN)_PR_InvalidStatus,
++ (PRShutdownFN)_PR_InvalidStatus,
++ (PRRecvFN)_PR_InvalidInt,
++ (PRSendFN)_PR_InvalidInt,
++ (PRRecvfromFN)_PR_InvalidInt,
++ (PRSendtoFN)_PR_InvalidInt,
++ FilePoll,
++ (PRAcceptreadFN)_PR_InvalidInt,
++ (PRTransmitfileFN)_PR_InvalidInt,
++ (PRGetsocknameFN)_PR_InvalidStatus,
++ (PRGetpeernameFN)_PR_InvalidStatus,
++ (PRReservedFN)_PR_InvalidInt,
++ (PRReservedFN)_PR_InvalidInt,
++ (PRGetsocketoptionFN)_PR_InvalidStatus,
++ (PRSetsocketoptionFN)_PR_InvalidStatus,
++ (PRSendfileFN)_PR_InvalidInt,
++ (PRConnectcontinueFN)_PR_InvalidStatus,
++ (PRReservedFN)_PR_InvalidInt,
++ (PRReservedFN)_PR_InvalidInt,
++ (PRReservedFN)_PR_InvalidInt,
++ (PRReservedFN)_PR_InvalidInt
++};
++
++PR_IMPLEMENT(const PRIOMethods*) PR_GetFileMethods(void)
++{
++ return &_pr_fileMethods;
++}
++
++
++static PRInt32 PR_CALLBACK PipeAvailable(PRFileDesc *fd)
++{
++ PRInt32 rv;
++ rv = _bt_socketavailable(fd);
++ return rv;
++}
++
++static PRInt64 PR_CALLBACK PipeAvailable64(PRFileDesc *fd)
++{
++ PRInt64 rv;
++ LL_I2L(rv, _bt_socketavailable(fd));
++ return rv;
++}
++
++static PRStatus PR_CALLBACK PipeSync(PRFileDesc *fd)
++{
++ return PR_SUCCESS;
++}
++
++
++static PRIOMethods _pr_pipeMethods = {
++ PR_DESC_PIPE,
++ FileClose,
++ FileRead,
++ FileWrite,
++ PipeAvailable,
++ PipeAvailable64,
++ PipeSync,
++ (PRSeekFN)_PR_InvalidInt,
++ (PRSeek64FN)_PR_InvalidInt64,
++ (PRFileInfoFN)_PR_InvalidStatus,
++ (PRFileInfo64FN)_PR_InvalidStatus,
++ (PRWritevFN)_PR_InvalidInt,
++ (PRConnectFN)_PR_InvalidStatus,
++ (PRAcceptFN)_PR_InvalidDesc,
++ (PRBindFN)_PR_InvalidStatus,
++ (PRListenFN)_PR_InvalidStatus,
++ (PRShutdownFN)_PR_InvalidStatus,
++ (PRRecvFN)_PR_InvalidInt,
++ (PRSendFN)_PR_InvalidInt,
++ (PRRecvfromFN)_PR_InvalidInt,
++ (PRSendtoFN)_PR_InvalidInt,
++ FilePoll,
++ (PRAcceptreadFN)_PR_InvalidInt,
++ (PRTransmitfileFN)_PR_InvalidInt,
++ (PRGetsocknameFN)_PR_InvalidStatus,
++ (PRGetpeernameFN)_PR_InvalidStatus,
++ (PRReservedFN)_PR_InvalidInt,
++ (PRReservedFN)_PR_InvalidInt,
++ (PRGetsocketoptionFN)_PR_InvalidStatus,
++ (PRSetsocketoptionFN)_PR_InvalidStatus,
++ (PRSendfileFN)_PR_InvalidInt,
++ (PRConnectcontinueFN)_PR_InvalidStatus,
++ (PRReservedFN)_PR_InvalidInt,
++ (PRReservedFN)_PR_InvalidInt,
++ (PRReservedFN)_PR_InvalidInt,
++ (PRReservedFN)_PR_InvalidInt
++};
++
++PR_IMPLEMENT(const PRIOMethods*) PR_GetPipeMethods(void)
++{
++ return &_pr_pipeMethods;
++}
++
++void _PR_InitIO(void) {
++ const PRIOMethods *methods = PR_GetFileMethods();
++ _PR_InitFdCache();
++ _pr_flock_lock = PR_NewLock();
++ _pr_flock_cv = PR_NewCondVar(_pr_flock_lock);
++ _pr_stdin = bt_CreateFileDesc(0, PR_GetFileMethods(), _PR_TRI_UNKNOWN, false);
++ _pr_stdout = bt_CreateFileDesc(1, PR_GetFileMethods(), _PR_TRI_UNKNOWN, false);
++ _pr_stderr = bt_CreateFileDesc(2, PR_GetFileMethods(), _PR_TRI_UNKNOWN, false);
++}
++
+Index: nsprpub/pr/src/bthreads/btsem.c
+===================================================================
+--- nsprpub/pr/src/bthreads/btsem.c (revision 7)
++++ nsprpub/pr/src/bthreads/btsem.c (working copy)
+@@ -38,6 +38,7 @@
+ #include
+
+ #include "primpl.h"
++#include "obsolete/prsem.h"
+
+ /*
+ ** Create a new semaphore object.
+Index: nsprpub/pr/src/bthreads/btio.c
+===================================================================
+--- nsprpub/pr/src/bthreads/btio.c (revision 0)
++++ nsprpub/pr/src/bthreads/btio.c (revision 0)
+@@ -0,0 +1,2424 @@
++/* -*- Mode: C++; c-basic-offset: 4 -*- */
++/* ***** BEGIN LICENSE BLOCK *****
++ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
++ *
++ * The contents of this file are subject to the Mozilla Public License Version
++ * 1.1 (the "License"); you may not use this file except in compliance with
++ * the License. You may obtain a copy of the License at
++ * http://www.mozilla.org/MPL/
++ *
++ * Software distributed under the License is distributed on an "AS IS" basis,
++ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
++ * for the specific language governing rights and limitations under the
++ * License.
++ *
++ * The Original Code is the Netscape Portable Runtime (NSPR).
++ *
++ * The Initial Developer of the Original Code is
++ * Netscape Communications Corporation.
++ * Portions created by the Initial Developer are Copyright (C) 1998-2000
++ * the Initial Developer. All Rights Reserved.
++ *
++ * Contributor(s):
++ *
++ * Alternatively, the contents of this file may be used under the terms of
++ * either the GNU General Public License Version 2 or later (the "GPL"), or
++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
++ * in which case the provisions of the GPL or the LGPL are applicable instead
++ * of those above. If you wish to allow use of your version of this file only
++ * under the terms of either the GPL or the LGPL, and not to allow others to
++ * use your version of this file under the terms of the MPL, indicate your
++ * decision by deleting the provisions above and replace them with the notice
++ * and other provisions required by the GPL or the LGPL. If you do not delete
++ * the provisions above, a recipient may use your version of this file under
++ * the terms of any one of the MPL, the GPL or the LGPL.
++ *
++ * ***** END LICENSE BLOCK ***** */
++
++#include "primpl.h"
++#include
++#include
++#include
++
++#define READ_FD 1
++#define WRITE_FD 2
++
++#ifdef BONE_VERSION
++inline int closesocket(int socket) {
++ return close(socket);
++}
++#endif
++
++
++inline void
++set_stat_error(int err)
++{
++ PR_SetError(err == ETIMEDOUT ? PR_REMOTE_FILE_ERROR : map_default_error(err), err);
++}
++
++inline void
++set_access_error(int err)
++{
++ PR_SetError(err == ETIMEDOUT ? PR_REMOTE_FILE_ERROR : map_default_error(err), err);
++}
++
++inline void
++set_select_error(int err)
++{
++ PR_SetError(map_default_error(err), err);
++}
++
++inline void
++set_writev_error(int err)
++{
++ PR_SetError(map_default_error(err), err);
++}
++
++inline void
++set_connect_error(int err)
++{
++ PRErrorCode prError;
++ switch (err) {
++ case EACCES:
++ case ELOOP:
++ case ENOENT:
++ prError = PR_ADDRESS_NOT_SUPPORTED_ERROR;
++ break;
++ case ENXIO:
++ prError = PR_IO_ERROR;
++ break;
++ default:
++ prError = map_default_error(err);
++ }
++ PR_SetError(prError, err);
++
++}
++
++inline void
++set_accept_error(int err)
++{
++ PR_SetError(err == ENODEV ? PR_NOT_TCP_SOCKET_ERROR : map_default_error(err), err);
++}
++
++
++inline void
++set_bind_error(int err)
++{
++ PRErrorCode prError;
++ switch (err) {
++ case EINVAL:
++ prError = PR_SOCKET_ADDRESS_IS_BOUND_ERROR;
++ break;
++ case EIO:
++ case EISDIR:
++ case ELOOP:
++ case ENOENT:
++ case ENOTDIR:
++ case EROFS:
++ prError = PR_ADDRESS_NOT_SUPPORTED_ERROR;
++ break;
++ case ENXIO:
++ prError = PR_IO_ERROR;
++ break;
++ default:
++ prError = map_default_error(err);
++ }
++ PR_SetError(prError, err);
++}
++
++inline void
++set_listen_error(int err)
++{
++ PR_SetError(map_default_error(err), err);
++}
++
++inline void
++set_shutdown_error(int err)
++{
++ PR_SetError(map_default_error(err), err);
++}
++
++inline void
++set_socketpair_error(int err)
++{
++ PR_SetError(err == ENOMEM ? PR_INSUFFICIENT_RESOURCES_ERROR : map_default_error(err), err);
++}
++
++inline void
++set_recv_error(int err)
++{
++ PR_SetError(map_default_error(err), err);
++}
++
++inline void
++set_recvfrom_error(int err)
++{
++ PR_SetError(map_default_error(err), err);
++}
++
++
++inline void
++set_send_error(int err)
++{
++ PR_SetError(map_default_error(err), err);
++}
++
++inline void
++set_sendto_error(int err)
++{
++ PR_SetError(map_default_error(err), err);
++}
++
++inline void
++set_getsockname_error(int err)
++{
++ PR_SetError(err == ENOMEM ? PR_INSUFFICIENT_RESOURCES_ERROR : map_default_error(err), err);
++}
++
++
++inline void
++set_getpeername_error(int err)
++{
++ PR_SetError(err == ENOMEM ? PR_INSUFFICIENT_RESOURCES_ERROR : map_default_error(err), err);
++}
++
++
++inline void
++set_getsockopt_error(int err)
++{
++ PRErrorCode prError;
++ switch (err) {
++ case EINVAL:
++ prError = PR_BUFFER_OVERFLOW_ERROR;
++ break;
++ case ENOMEM:
++ prError = PR_INSUFFICIENT_RESOURCES_ERROR;
++ break;
++ default:
++ prError = map_default_error(err);
++ }
++ PR_SetError(prError, err);
++}
++
++inline void
++set_setsockopt_error(int err)
++{
++ PRErrorCode prError;
++ switch (err) {
++ case EINVAL:
++ prError = PR_BUFFER_OVERFLOW_ERROR;
++ break;
++ case ENOMEM:
++ prError = PR_INSUFFICIENT_RESOURCES_ERROR;
++ break;
++ default:
++ prError = map_default_error(err);
++ }
++ PR_SetError(prError, err);
++}
++
++
++inline void
++set_socket_error(int err)
++{
++ PR_SetError( err == ENOMEM ? PR_INSUFFICIENT_RESOURCES_ERROR : map_default_error(err), err);
++}
++
++
++PR_IMPLEMENT(PRStatus) PR_GetFileInfo(const char *fn, PRFileInfo *info)
++{
++ struct stat sb;
++ PRInt32 rv, err;
++ PRInt64 s, s2us;
++
++ if (!_pr_initialized) _PR_ImplicitInitialization();
++ rv = stat(fn, &sb);
++ if (rv < 0) {
++ err = _MD_ERRNO();
++ set_stat_error(err);
++ return PR_FAILURE;
++ }
++ if (info) {
++ if (S_IFREG & sb.st_mode)
++ info->type = PR_FILE_FILE;
++ else if (S_IFDIR & sb.st_mode)
++ info->type = PR_FILE_DIRECTORY;
++ else
++ info->type = PR_FILE_OTHER;
++
++ /* Use lower 32 bits of file size */
++ info->size = sb.st_size & 0xffffffff;
++ LL_I2L(s, sb.st_mtime);
++ LL_I2L(s2us, PR_USEC_PER_SEC);
++ LL_MUL(s, s, s2us);
++ info->modifyTime = s;
++ LL_I2L(s, sb.st_ctime);
++ LL_MUL(s, s, s2us);
++ info->creationTime = s;
++ }
++
++ return PR_SUCCESS;
++}
++
++
++PR_IMPLEMENT(PRStatus) PR_GetFileInfo64(const char *fn, PRFileInfo64 *info)
++{
++ struct stat sb;
++ PRInt32 rv, err;
++ PRInt64 s, s2us;
++
++ if (!_pr_initialized) _PR_ImplicitInitialization();
++ rv = stat(fn, &sb);
++ if (rv < 0) {
++ err = _MD_ERRNO();
++ set_stat_error(err);
++ return PR_FAILURE;
++ }
++ if (info) {
++ if (S_IFREG & sb.st_mode)
++ info->type = PR_FILE_FILE;
++ else if (S_IFDIR & sb.st_mode)
++ info->type = PR_FILE_DIRECTORY;
++ else
++ info->type = PR_FILE_OTHER;
++
++ /* For the 64 bit version we can use
++ * the native st_size without modification
++ */
++ info->size = sb.st_size;
++ LL_I2L(s, sb.st_mtime);
++ LL_I2L(s2us, PR_USEC_PER_SEC);
++ LL_MUL(s, s, s2us);
++ info->modifyTime = s;
++ LL_I2L(s, sb.st_ctime);
++ LL_MUL(s, s, s2us);
++ info->creationTime = s;
++ }
++
++ return PR_SUCCESS;
++}
++
++PR_IMPLEMENT(PRStatus) PR_Access(const char *name, PRAccessHow how)
++{
++ PRInt32 rv, err;
++ int checkFlags;
++ struct stat buf;
++
++ switch (how) {
++ case PR_ACCESS_WRITE_OK:
++ checkFlags = S_IWUSR | S_IWGRP | S_IWOTH;
++ break;
++
++ case PR_ACCESS_READ_OK:
++ checkFlags = S_IRUSR | S_IRGRP | S_IROTH;
++ break;
++
++ case PR_ACCESS_EXISTS:
++ /* we don't need to examine st_mode. */
++ break;
++
++ default: {
++ PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
++ return PR_FAILURE;
++ }
++ }
++
++ rv = stat(name, &buf);
++ if (rv == 0 && how != PR_ACCESS_EXISTS && (!(buf.st_mode & checkFlags))) {
++ PR_SetError(PR_NO_ACCESS_RIGHTS_ERROR, 0);
++ return PR_FAILURE;
++ }
++
++ if (rv < 0) {
++ err = _MD_ERRNO();
++ set_access_error(err);
++ return PR_FAILURE;
++ } else
++ return PR_SUCCESS;
++}
++
++
++PRInt32
++_bt_socketavailable (PRFileDesc *fd)
++{
++#ifdef BONE_VERSION
++ PRInt32 result;
++
++ if (ioctl(fd->secret->md.osfd, FIONREAD, &result) < 0) {
++ PR_SetError(PR_BAD_DESCRIPTOR_ERROR, _MD_ERRNO());
++ return -1;
++ }
++ return result;
++#else
++ return PR_NOT_IMPLEMENTED_ERROR;
++#endif
++}
++
++
++#if defined(DEBUG)
++
++PRBool IsValidNetAddr(const PRNetAddr *addr)
++{
++ if ((addr != NULL)
++ && (addr->raw.family != PR_AF_INET6)
++ && (addr->raw.family != PR_AF_INET)) {
++ return PR_FALSE;
++ }
++ return PR_TRUE;
++}
++
++static PRBool IsValidNetAddrLen(const PRNetAddr *addr, PRInt32 addr_len)
++{
++ /*
++ * The definition of the length of a Unix domain socket address
++ * is not uniform, so we don't check it.
++ */
++ if ((addr != NULL)
++ && (PR_NETADDR_SIZE(addr) != addr_len)) {
++ return PR_FALSE;
++ }
++ return PR_TRUE;
++}
++
++#endif /* DEBUG */
++
++static PRInt32 socket_io_wait(PRInt32 osfd, PRInt32 fd_type,
++ PRIntervalTime timeout)
++{
++ PRInt32 rv = -1;
++ struct timeval tv;
++ PRIntervalTime epoch, now, elapsed, remaining;
++ PRBool wait_for_remaining;
++ PRInt32 syserror;
++ fd_set rd_wr;
++
++ switch (timeout) {
++ case PR_INTERVAL_NO_WAIT:
++ PR_SetError(PR_IO_TIMEOUT_ERROR, 0);
++ break;
++ case PR_INTERVAL_NO_TIMEOUT:
++ /*
++ * This is a special case of the 'default' case below.
++ * Please see the comments there.
++ */
++ tv.tv_sec = _PR_INTERRUPT_CHECK_INTERVAL_SECS;
++ tv.tv_usec = 0;
++ FD_ZERO(&rd_wr);
++ do {
++ FD_SET(osfd, &rd_wr);
++ if (fd_type == READ_FD)
++ rv = select(osfd + 1, &rd_wr, NULL, NULL, &tv);
++ else
++ rv = select(osfd + 1, NULL, &rd_wr, NULL, &tv);
++ if (rv == -1 && (syserror = _MD_ERRNO()) != EINTR) {
++#ifdef BONE_VERSION
++ set_select_error(syserror);
++#else
++ if (syserror == EBADF) {
++ PR_SetError(PR_BAD_DESCRIPTOR_ERROR, EBADF);
++ } else {
++ PR_SetError(PR_UNKNOWN_ERROR, syserror);
++ }
++#endif
++ break;
++ }
++ } while (rv == 0 || (rv == -1 && syserror == EINTR));
++ break;
++ default:
++ now = epoch = PR_IntervalNow();
++ remaining = timeout;
++ FD_ZERO(&rd_wr);
++ do {
++ /*
++ * We block in select for at most
++ * _PR_INTERRUPT_CHECK_INTERVAL_SECS seconds,
++ * so that there is an upper limit on the delay
++ * before the interrupt bit is checked.
++ */
++ wait_for_remaining = PR_TRUE;
++ tv.tv_sec = PR_IntervalToSeconds(remaining);
++ if (tv.tv_sec > _PR_INTERRUPT_CHECK_INTERVAL_SECS) {
++ wait_for_remaining = PR_FALSE;
++ tv.tv_sec = _PR_INTERRUPT_CHECK_INTERVAL_SECS;
++ tv.tv_usec = 0;
++ } else {
++ tv.tv_usec = PR_IntervalToMicroseconds(
++ remaining -
++ PR_SecondsToInterval(tv.tv_sec));
++ }
++ FD_SET(osfd, &rd_wr);
++ if (fd_type == READ_FD)
++ rv = select(osfd + 1, &rd_wr, NULL, NULL, &tv);
++ else
++ rv = select(osfd + 1, NULL, &rd_wr, NULL, &tv);
++ /*
++ * we don't consider EINTR a real error
++ */
++ if (rv == -1 && (syserror = _MD_ERRNO()) != EINTR) {
++#ifdef BONE_VERSION
++ set_select_error(syserror);
++#else
++ if (syserror == EBADF) {
++ PR_SetError(PR_BAD_DESCRIPTOR_ERROR, EBADF);
++ } else {
++ PR_SetError(PR_UNKNOWN_ERROR, syserror);
++ }
++#endif
++ break;
++ }
++ /*
++ * We loop again if select timed out or got interrupted
++ * by a signal, and the timeout deadline has not passed yet.
++ */
++ if (rv == 0 || (rv == -1 && syserror == EINTR)) {
++ /*
++ * If select timed out, we know how much time
++ * we spent in blocking, so we can avoid a
++ * PR_IntervalNow() call.
++ */
++ if (rv == 0) {
++ if (wait_for_remaining) {
++ now += remaining;
++ } else {
++ now += PR_SecondsToInterval(tv.tv_sec)
++ + PR_MicrosecondsToInterval(tv.tv_usec);
++ }
++ } else {
++ now = PR_IntervalNow();
++ }
++ elapsed = (PRIntervalTime) (now - epoch);
++ if (elapsed >= timeout) {
++ PR_SetError(PR_IO_TIMEOUT_ERROR, 0);
++ rv = -1;
++ break;
++ } else {
++ remaining = timeout - elapsed;
++ }
++ }
++ } while (rv == 0 || (rv == -1 && syserror == EINTR));
++ break;
++ }
++ return(rv);
++}
++
++
++static PRInt32 PR_CALLBACK SocketWritev(PRFileDesc *fd, const PRIOVec *iov,
++PRInt32 iov_size, PRIntervalTime timeout)
++{
++#ifdef BONE_VERSION
++ int w, err = 0;
++ const PRIOVec *tmp_iov;
++#define LOCAL_MAXIOV 8
++ PRIOVec local_iov[LOCAL_MAXIOV];
++ PRIOVec *iov_copy = NULL;
++ int tmp_out;
++ int index, iov_cnt;
++ int count=0, sz = 0; /* 'count' is the return value. */
++ int i, amount = 0;
++
++ /*
++ * Assume the first writev will succeed. Copy iov's only on
++ * failure.
++ */
++ tmp_iov = iov;
++ for (index = 0; index < iov_size; index++)
++ sz += iov[index].iov_len;
++
++ iov_cnt = iov_size;
++
++ while (sz > 0) {
++/*
++ /*
++ * Calculate the total number of bytes to be sent; needed for
++ * optimization later.
++ * We could avoid this if this number was passed in; but it is
++ * probably not a big deal because iov_size is usually small (less than
++ * 3)
++ */
++ if (!fd->secret->nonblocking) {
++ for (i=0; isecret->md.osfd, (const struct iovec*)tmp_iov, iov_size)) == -1) {
++ err = _MD_ERRNO();
++ if ((err == EAGAIN) || (err == EWOULDBLOCK)) {
++ if (fd->secret->nonblocking) {
++ break;
++ }
++ if ((w = socket_io_wait(fd->secret->md.osfd, WRITE_FD, timeout))<0)
++ goto done;
++
++ } else if (err == EINTR) {
++ continue;
++ } else {
++ break;
++ }
++ }
++ /*
++ * optimization; if bytes sent is less than "amount" call
++ * select before returning. This is because it is likely that
++ * the next writev() call will return EWOULDBLOCK.
++ */
++ if ((!fd->secret->nonblocking) && (w > 0) && (w < amount)
++ && (timeout != PR_INTERVAL_NO_WAIT)) {
++ if (socket_io_wait(fd->secret->md.osfd, WRITE_FD, timeout) < 0) {
++ w = -1;
++ goto done;
++ }
++ }
++
++ if (w < 0) {
++ set_writev_error(err);
++ }
++done:
++
++
++ if (w < 0) {
++ count = -1;
++ break;
++ }
++ count += w;
++ if (fd->secret->nonblocking) {
++ break;
++ }
++ sz -= w;
++
++ if (sz > 0) {
++ /* find the next unwritten vector */
++ for ( index = 0, tmp_out = count;
++ tmp_out >= iov[index].iov_len;
++ tmp_out -= iov[index].iov_len, index++){;} /* nothing to execute */
++
++ if (tmp_iov == iov) {
++ /*
++ * The first writev failed so we
++ * must copy iov's around.
++ * Avoid calloc/free if there
++ * are few enough iov's.
++ */
++ if (iov_size - index <= LOCAL_MAXIOV)
++ iov_copy = local_iov;
++ else if ((iov_copy = (PRIOVec *) PR_CALLOC((iov_size - index) *
++ sizeof *iov_copy)) == NULL) {
++ PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
++ return -1;
++ }
++ tmp_iov = iov_copy;
++ }
++
++ PR_ASSERT(tmp_iov == iov_copy);
++
++ /* fill in the first partial read */
++ iov_copy[0].iov_base = &(((char *)iov[index].iov_base)[tmp_out]);
++ iov_copy[0].iov_len = iov[index].iov_len - tmp_out;
++ index++;
++
++ /* copy the remaining vectors */
++ for (iov_cnt=1; indexsecret->md.osfd;
++
++#ifndef BONE_VERSION
++ fd->secret->md.connectValueValid = PR_FALSE;
++#endif
++#ifdef _PR_HAVE_SOCKADDR_LEN
++ PRNetAddr addrCopy;
++
++ addrCopy = *addr;
++ ((struct sockaddr *) &addrCopy)->sa_len = addrlen;
++ ((struct sockaddr *) &addrCopy)->sa_family = addr->raw.family;
++#endif
++
++ /* (Copied from unix.c)
++ * We initiate the connection setup by making a nonblocking connect()
++ * call. If the connect() call fails, there are two cases we handle
++ * specially:
++ * 1. The connect() call was interrupted by a signal. In this case
++ * we simply retry connect().
++ * 2. The NSPR socket is nonblocking and connect() fails with
++ * EINPROGRESS. We first wait until the socket becomes writable.
++ * Then we try to find out whether the connection setup succeeded
++ * or failed.
++ */
++
++retry:
++#ifdef _PR_HAVE_SOCKADDR_LEN
++ if ((rv = connect(osfd, (struct sockaddr *)&addrCopy, addrlen)) == -1) {
++#else
++ if ((rv = connect(osfd, (struct sockaddr *)addr, addrlen)) == -1) {
++#endif
++ err = _MD_ERRNO();
++#ifndef BONE_VERSION
++ fd->secret->md.connectReturnValue = rv;
++ fd->secret->md.connectReturnError = err;
++ fd->secret->md.connectValueValid = PR_TRUE;
++#endif
++ if( err == EINTR ) {
++#ifndef BONE_VERSION
++ snooze( 100000L );
++#endif
++ goto retry;
++ }
++
++#ifndef BONE_VERSION
++ if(!fd->secret->nonblocking && ((err == EINPROGRESS) || (err==EAGAIN) || (err==EALREADY))) {
++
++ /*
++ ** There's no timeout on this connect, but that's not
++ ** a big deal, since the connect times out anyways
++ ** after 30 seconds. Just sleep for 1/10th of a second
++ ** and retry until we go through or die.
++ */
++ goto retry;
++ }
++
++ if( fd->secret->nonblocking && ((err == EAGAIN) || (err == EINPROGRESS))) {
++ PR_Lock(_connectLock);
++ if (connectCount < sizeof(connectList)/sizeof(connectList[0])) {
++ connectList[connectCount].osfd = osfd;
++ memcpy(&connectList[connectCount].addr, addr, addrlen);
++ connectList[connectCount].addrlen = addrlen;
++ connectList[connectCount].timeout = timeout;
++ connectCount++;
++ PR_Unlock(_connectLock);
++ set_connect_error(err);
++ } else {
++ PR_Unlock(_connectLock);
++ PR_SetError(PR_INSUFFICIENT_RESOURCES_ERROR, 0);
++ }
++ return rv;
++ }
++#else /* BONE_VERSION */
++ if(!fd->secret->nonblocking && (err == EINTR)) {
++
++ rv = socket_io_wait(osfd, WRITE_FD, timeout);
++ if (rv == -1) {
++ return -1;
++ }
++
++ PR_ASSERT(rv == 1);
++/* _MD_beos_get_nonblocking_connect_error always return PR_NOT_IMPLEMENTED..
++ err = _MD_beos_get_nonblocking_connect_error(osfd);
++ if (err != 0) {
++ set_connect_error(err);
++ return -1;
++ }
++*/
++ return 0;
++ }
++#endif
++
++ set_connect_error(err);
++ }
++
++ return rv;
++}
++
++
++static PRStatus PR_CALLBACK SocketConnect(
++ PRFileDesc *fd, const PRNetAddr *addr, PRIntervalTime timeout)
++{
++ PRInt32 rv; /* Return value of _PR_MD_CONNECT */
++ const PRNetAddr *addrp = addr;
++#if defined(_PR_INET6)
++ PRNetAddr addrCopy;
++ if (addr->raw.family == PR_AF_INET6) {
++ addrCopy = *addr;
++ addrCopy.raw.family = AF_INET6;
++ addrp = &addrCopy;
++ }
++#endif
++
++ rv = _bt_CONNECT(fd, addrp, PR_NETADDR_SIZE(addr), timeout);
++ PR_LOG(_pr_io_lm, PR_LOG_MAX, ("connect -> %d", rv));
++ if (rv == 0)
++ return PR_SUCCESS;
++ else
++ return PR_FAILURE;
++}
++
++static PRStatus PR_CALLBACK SocketConnectContinue(
++ PRFileDesc *fd, PRInt16 out_flags)
++{
++ PRInt32 osfd;
++ int err;
++ int rv;
++
++ if (out_flags & PR_POLL_NVAL) {
++ PR_SetError(PR_BAD_DESCRIPTOR_ERROR, 0);
++ return PR_FAILURE;
++ }
++ if ((out_flags & (PR_POLL_WRITE | PR_POLL_EXCEPT | PR_POLL_ERR)) == 0) {
++ PR_ASSERT(out_flags == 0);
++ PR_SetError(PR_IN_PROGRESS_ERROR, 0);
++ return PR_FAILURE;
++ }
++
++ osfd = fd->secret->md.osfd;
++
++
++#ifdef BONE_VERSION /* bug 122364 */
++ /* temporary workaround until getsockopt(SO_ERROR) works in BONE */
++ if (out_flags & PR_POLL_EXCEPT) {
++ PR_SetError(PR_CONNECT_REFUSED_ERROR, 0);
++ return PR_FAILURE;
++ }
++ PR_ASSERT(out_flags & PR_POLL_WRITE);
++ return PR_SUCCESS;
++#else
++ rv = recv(fd->secret->md.osfd, NULL, 0, 0);
++ PR_ASSERT(-1 == rv || 0 == rv);
++
++ if (-1 == rv && 0 != errno && errno != EAGAIN && errno != EWOULDBLOCK ) {
++ set_connect_error(errno);
++ return PR_FAILURE;
++ }
++ else
++ return PR_SUCCESS;
++#endif
++}
++
++PRInt32
++_bt_accept (PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen,
++ PRIntervalTime timeout)
++{
++ PRInt32 osfd = fd->secret->md.osfd;
++ PRInt32 rv, err;
++
++ while ((rv = accept(osfd, (struct sockaddr *) addr,
++ (int *)addrlen)) == -1) {
++ err = _MD_ERRNO();
++
++ if ((err == EAGAIN) || (err == EWOULDBLOCK)) {
++ if (fd->secret->nonblocking) {
++ break;
++ }
++ /* If it's SUPPOSED to be a blocking thread, wait
++ * a while to see if the triggering condition gets
++ * satisfied.
++ */
++ /* Assume that we're always using a native thread */
++ if ((rv = socket_io_wait(osfd, READ_FD, timeout)) < 0)
++ goto done;
++ } else if (err == EINTR) {
++ continue;
++ } else {
++ break;
++ }
++ }
++ if (rv < 0) {
++ set_accept_error(err);
++ } else if (addr != NULL) {
++ /* bug 134099 */
++ err = getpeername(rv, (struct sockaddr *) addr, (int *)addrlen);
++ }
++done:
++#ifdef _PR_HAVE_SOCKADDR_LEN
++ if (rv != -1) {
++ /* Mask off the first byte of struct sockaddr (the length field) */
++ if (addr) {
++ addr->raw.family = ((struct sockaddr *) addr)->sa_family;
++ }
++ }
++#endif /* _PR_HAVE_SOCKADDR_LEN */
++ return(rv);
++}
++
++
++
++static PRFileDesc* PR_CALLBACK SocketAccept(PRFileDesc *fd, PRNetAddr *addr,
++PRIntervalTime timeout)
++{
++ PRInt32 osfd;
++ PRFileDesc *fd2;
++ PRUint32 al;
++
++ al = sizeof(PRNetAddr);
++ osfd = _bt_accept(fd, addr, &al, timeout);
++ if (osfd == -1)
++ return 0;
++ fd2 = bt_CreateFileDesc(osfd, PR_GetTCPMethods(), _PR_TRI_TRUE, true);
++ if (!fd2) {
++ closesocket(osfd);
++
++ return NULL;
++ }
++
++ fd2->secret->nonblocking = fd->secret->nonblocking;
++ fd2->secret->inheritable = fd->secret->inheritable;
++
++#ifdef _PR_INET6
++ if (addr && (AF_INET6 == addr->raw.family))
++ addr->raw.family = PR_AF_INET6;
++#endif
++ PR_ASSERT(IsValidNetAddr(addr) == PR_TRUE);
++ PR_ASSERT(IsValidNetAddrLen(addr, al) == PR_TRUE);
++
++ return fd2;
++}
++
++
++static PRStatus PR_CALLBACK SocketBind(PRFileDesc *fd, const PRNetAddr *addr)
++{
++ PRInt32 result, err;
++ const PRNetAddr *addrp = addr;
++#if defined(_PR_INET6) || defined(_PR_HAVE_SOCKADDR_LEN)
++ PRNetAddr addrCopy;
++#endif
++
++ PR_ASSERT(IsValidNetAddr(addr) == PR_TRUE);
++#if defined(_PR_INET6)
++ if (addr->raw.family == PR_AF_INET6) {
++ addrCopy = *addr;
++ addrCopy.raw.family = AF_INET6;
++ addrp = &addrCopy;
++ }
++#endif
++
++#ifdef _PR_HAVE_SOCKADDR_LEN
++ addrCopy = *addrp;
++ ((struct sockaddr *) &addrCopy)->sa_len = PR_NETADDR_SIZE(addrp);
++ ((struct sockaddr *) &addrCopy)->sa_family = addr->raw.family;
++ result = bind(fd->secret->md.osfd, (struct sockaddr *) &addrCopy, PR_NETADDR_SIZE(addrp));
++#else
++ result = bind(fd->secret->md.osfd, (struct sockaddr *) addrp, PR_NETADDR_SIZE(addrp));
++#endif
++
++
++ if (result < 0) {
++ err = _MD_ERRNO();
++ set_bind_error(err);
++ return PR_FAILURE;
++ }
++ return PR_SUCCESS;
++}
++
++static PRStatus PR_CALLBACK SocketListen(PRFileDesc *fd, PRIntn backlog)
++{
++ PRInt32 result,err;
++#ifndef BONE_VERSION
++ /* Bug workaround! Setting listen to 0 on Be accepts no connections.
++ ** On most UN*Xes this sets the default.
++ */
++
++ if( backlog == 0 ) backlog = 5;
++#endif
++ result = listen(fd->secret->md.osfd, backlog);
++ if (result < 0) {
++ err = _MD_ERRNO();
++ set_listen_error(err);
++ return PR_FAILURE;
++ }
++ return PR_SUCCESS;
++}
++
++static PRStatus PR_CALLBACK SocketShutdown(PRFileDesc *fd, PRIntn how)
++{
++ PRInt32 result,err;
++#ifndef BONE_VERSION
++ if (how == PR_SHUTDOWN_SEND)
++ fd->secret->md.sock_state = BE_SOCK_SHUTDOWN_WRITE;
++ else if (how == PR_SHUTDOWN_RCV)
++ fd->secret->md.sock_state = BE_SOCK_SHUTDOWN_READ;
++ else if (how == PR_SHUTDOWN_BOTH) {
++ fd->secret->md.sock_state = (BE_SOCK_SHUTDOWN_WRITE | BE_SOCK_SHUTDOWN_READ);
++ }
++#else /* BONE_VERSION */
++ result = shutdown(fd->secret->md.osfd, how);
++ if (result < 0) {
++ err = _MD_ERRNO();
++ set_shutdown_error(err);
++ return PR_FAILURE;
++ }
++#endif
++ return PR_SUCCESS;
++}
++
++PRInt32
++_bt_recv (PRFileDesc *fd, void *buf, PRInt32 amount, PRInt32 flags,
++ PRIntervalTime timeout)
++{
++ PRInt32 osfd = fd->secret->md.osfd;
++ PRInt32 rv, err;
++
++#ifndef BONE_VERSION
++ if (fd->secret->md.sock_state & BE_SOCK_SHUTDOWN_READ) {
++ set_recv_error(EPIPE);
++ return -1;
++ }
++#endif
++
++#ifdef BONE_VERSION
++ /*
++ ** Gah, stupid hack. If reading a zero amount, instantly return success.
++ ** BONE beta 6 returns EINVAL for reads of zero bytes, which parts of
++ ** mozilla use to check for socket availability.
++ */
++
++ if( 0 == amount ) return(0);
++#endif
++
++ while ((rv = recv(osfd, buf, amount, flags)) == -1) {
++ err = _MD_ERRNO();
++
++ if ((err == EAGAIN) || (err == EWOULDBLOCK)) {
++ if (fd->secret->nonblocking) {
++ break;
++ }
++ /* If socket was supposed to be blocking,
++ wait a while for the condition to be
++ satisfied. */
++ if ((rv = socket_io_wait(osfd, READ_FD, timeout)) < 0)
++ goto done;
++ } else if (err == EINTR) {
++ continue;
++ } else
++ break;
++ }
++
++ if (rv < 0) {
++ set_recv_error(err);
++ }
++
++done:
++ return(rv);
++}
++
++static PRInt32 PR_CALLBACK SocketRecv(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags,
++PRIntervalTime timeout)
++{
++ PRInt32 rv;
++
++ if ((flags != 0) && (flags != PR_MSG_PEEK)) {
++ PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
++ return -1;
++ }
++
++ PR_LOG(_pr_io_lm, PR_LOG_MAX, ("recv: fd=%p osfd=%d buf=%p amount=%d flags=%d",
++ fd, fd->secret->md.osfd, buf, amount, flags));
++
++
++ rv = _bt_recv(fd, buf, amount, flags, timeout);
++ PR_LOG(_pr_io_lm, PR_LOG_MAX, ("recv -> %d, error = %d, os error = %d",
++ rv, PR_GetError(), PR_GetOSError()));
++
++ return rv;
++}
++
++static PRInt32 PR_CALLBACK SocketRead(PRFileDesc *fd, void *buf, PRInt32 amount)
++{
++ return SocketRecv(fd, buf, amount, 0, PR_INTERVAL_NO_TIMEOUT);
++}
++
++PRInt32
++_bt_send (PRFileDesc *fd, const void *buf, PRInt32 amount, PRInt32 flags,
++ PRIntervalTime timeout)
++{
++ PRInt32 osfd = fd->secret->md.osfd;
++ PRInt32 rv, err;
++
++#ifndef BONE_VERSION
++ if (fd->secret->md.sock_state & BE_SOCK_SHUTDOWN_WRITE)
++ {
++ set_send_error(EPIPE);
++ return -1;
++ }
++#endif
++
++ while ((rv = send(osfd, buf, amount, flags)) == -1) {
++ err = _MD_ERRNO();
++
++ if ((err == EAGAIN) || (err == EWOULDBLOCK)) {
++ if (fd->secret->nonblocking) {
++ break;
++ }
++
++#ifndef BONE_VERSION
++
++ /* in UNIX implementations, you could do a socket_io_wait here.
++ * but since BeOS doesn't yet support WRITE notification in select,
++ * you're spanked.
++ */
++ snooze( 10000L );
++ continue;
++#else /* BONE_VERSION */
++ if ((rv = socket_io_wait(osfd, WRITE_FD, timeout))< 0)
++ goto done;
++#endif
++
++ } else if (err == EINTR) {
++ continue;
++ } else {
++ break;
++ }
++ }
++
++#ifdef BONE_VERSION
++ /*
++ * optimization; if bytes sent is less than "amount" call
++ * select before returning. This is because it is likely that
++ * the next writev() call will return EWOULDBLOCK.
++ */
++ if ((!fd->secret->nonblocking) && (rv > 0) && (rv < amount)
++ && (timeout != PR_INTERVAL_NO_WAIT)) {
++ if (socket_io_wait(osfd, WRITE_FD, timeout) < 0) {
++ rv = -1;
++ goto done;
++ }
++ }
++#endif /* BONE_VERSION */
++
++ if (rv < 0) {
++ set_send_error(err);
++ }
++
++#ifdef BONE_VERSION
++done:
++#endif
++ return(rv);
++}
++
++
++static PRInt32 PR_CALLBACK SocketSend(PRFileDesc *fd, const void *buf, PRInt32 amount,
++PRIntn flags, PRIntervalTime timeout)
++{
++ PRInt32 temp, count;
++
++ count = 0;
++ while (amount > 0) {
++ PR_LOG(_pr_io_lm, PR_LOG_MAX,
++ ("send: fd=%p osfd=%d buf=%p amount=%d",
++ fd, fd->secret->md.osfd, buf, amount));
++ temp = _bt_send(fd, buf, amount, flags, timeout);
++ if (temp < 0) {
++ count = -1;
++ break;
++ }
++
++ count += temp;
++ if (fd->secret->nonblocking) {
++ break;
++ }
++ buf = (const void*) ((const char*)buf + temp);
++
++ amount -= temp;
++ }
++ PR_LOG(_pr_io_lm, PR_LOG_MAX, ("send -> %d", count));
++ return count;
++}
++
++static PRInt32 PR_CALLBACK SocketWrite(PRFileDesc *fd, const void *buf, PRInt32 amount)
++{
++ return SocketSend(fd, buf, amount, 0, PR_INTERVAL_NO_TIMEOUT);
++}
++
++static PRStatus PR_CALLBACK SocketClose(PRFileDesc *fd)
++{
++ if (!fd || !fd->secret
++ || (fd->secret->state != _PR_FILEDESC_OPEN
++ && fd->secret->state != _PR_FILEDESC_CLOSED)) {
++ PR_SetError(PR_BAD_DESCRIPTOR_ERROR, 0);
++ return PR_FAILURE;
++ }
++
++ if (fd->secret->state == _PR_FILEDESC_OPEN) {
++ if (closesocket(fd->secret->md.osfd) < 0) {
++ return PR_FAILURE;
++ }
++
++ fd->secret->state = _PR_FILEDESC_CLOSED;
++ }
++
++ PR_ASSERT(fd);
++ _PR_Putfd(fd);
++ return PR_SUCCESS;
++}
++
++static PRInt32 PR_CALLBACK SocketAvailable(PRFileDesc *fd)
++{
++ PRInt32 rv;
++ rv = _bt_socketavailable(fd);
++ return rv;
++}
++
++static PRInt64 PR_CALLBACK SocketAvailable64(PRFileDesc *fd)
++{
++ PRInt64 rv;
++ LL_I2L(rv, _bt_socketavailable(fd));
++ return rv;
++}
++
++static PRStatus PR_CALLBACK SocketSync(PRFileDesc *fd)
++{
++ return PR_SUCCESS;
++}
++
++PRInt32
++_bt_sendto (PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags,
++ const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout)
++{
++ PRInt32 osfd = fd->secret->md.osfd;
++ PRInt32 rv, err;
++
++#ifdef _PR_HAVE_SOCKADDR_LEN
++ PRNetAddr addrCopy;
++
++ addrCopy = *addr;
++ ((struct sockaddr *) &addrCopy)->sa_len = addrlen;
++ ((struct sockaddr *) &addrCopy)->sa_family = addr->raw.family;
++
++ while ((rv = sendto(osfd, buf, amount, flags,
++ (struct sockaddr *) &addrCopy, addrlen)) == -1) {
++#else
++ while ((rv = sendto(osfd, buf, amount, flags,
++ (struct sockaddr *) addr, addrlen)) == -1) {
++#endif
++ err = _MD_ERRNO();
++
++ if ((err == EAGAIN) || (err == EWOULDBLOCK)) {
++ if (fd->secret->nonblocking) {
++ break;
++ }
++
++#ifdef BONE_VERSION
++ if ((rv = socket_io_wait(osfd, WRITE_FD, timeout))< 0)
++ goto done;
++#endif
++ } else if (err == EINTR) {
++ continue;
++
++ } else {
++ break;
++ }
++ }
++
++ if (rv < 0) {
++ set_sendto_error(err);
++ }
++
++#ifdef BONE_VERSION
++done:
++#endif
++ return(rv);
++}
++
++
++static PRInt32 PR_CALLBACK SocketSendTo(
++ PRFileDesc *fd, const void *buf, PRInt32 amount,
++ PRIntn flags, const PRNetAddr *addr, PRIntervalTime timeout)
++{
++ PRInt32 temp, count;
++ const PRNetAddr *addrp = addr;
++#if defined(_PR_INET6)
++ PRNetAddr addrCopy;
++#endif
++
++ PR_ASSERT(IsValidNetAddr(addr) == PR_TRUE);
++#if defined(_PR_INET6)
++ if (addr->raw.family == PR_AF_INET6) {
++ addrCopy = *addr;
++ addrCopy.raw.family = AF_INET6;
++ addrp = &addrCopy;
++ }
++#endif
++
++ count = 0;
++ while (amount > 0) {
++ temp = _bt_sendto(fd, buf, amount, flags,
++ addrp, PR_NETADDR_SIZE(addr), timeout);
++ if (temp < 0) {
++ count = -1;
++ break;
++ }
++ count += temp;
++ if (fd->secret->nonblocking) {
++ break;
++ }
++ buf = (const void*) ((const char*)buf + temp);
++ amount -= temp;
++ }
++ return count;
++}
++
++PRInt32
++_bt_recvfrom (PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags,
++ PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout)
++{
++ PRInt32 osfd = fd->secret->md.osfd;
++ PRInt32 rv, err;
++
++ while ((*addrlen = PR_NETADDR_SIZE(addr)),
++ ((rv = recvfrom(osfd, buf, amount, flags,
++ (struct sockaddr *) addr,
++ (int *)addrlen)) == -1)) {
++ err = _MD_ERRNO();
++
++ if ((err == EAGAIN) || (err == EWOULDBLOCK)) {
++ if (fd->secret->nonblocking) {
++ break;
++ }
++ if ((rv = socket_io_wait(osfd, READ_FD, timeout)) < 0)
++ goto done;
++
++ } else if (err == EINTR) {
++ continue;
++ } else {
++ break;
++ }
++ }
++
++ if (rv < 0) {
++ set_recvfrom_error(err);
++ }
++
++done:
++#ifdef _PR_HAVE_SOCKADDR_LEN
++ if (rv != -1) {
++ /* ignore the sa_len field of struct sockaddr */
++ if (addr) {
++ addr->raw.family = ((struct sockaddr *) addr)->sa_family;
++ }
++ }
++#endif /* _PR_HAVE_SOCKADDR_LEN */
++ return(rv);
++}
++
++
++
++static PRInt32 PR_CALLBACK SocketRecvFrom(PRFileDesc *fd, void *buf, PRInt32 amount,
++PRIntn flags, PRNetAddr *addr, PRIntervalTime timeout)
++{
++ PRInt32 rv;
++ PRUint32 al;
++
++ al = sizeof(PRNetAddr);
++ rv = _bt_recvfrom(fd, buf, amount, flags, addr, &al, timeout);
++#ifdef _PR_INET6
++ if (addr && (AF_INET6 == addr->raw.family))
++ addr->raw.family = PR_AF_INET6;
++#endif
++ return rv;
++}
++
++static PRInt32 PR_CALLBACK SocketAcceptRead(PRFileDesc *sd, PRFileDesc **nd,
++PRNetAddr **raddr, void *buf, PRInt32 amount,
++PRIntervalTime timeout)
++{
++ /* The socket must be in blocking mode. */
++ if (sd->secret->nonblocking) {
++ PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
++ return -1;
++ }
++ *nd = NULL;
++
++ return PR_EmulateAcceptRead(sd, nd, raddr, buf, amount, timeout);
++}
++
++
++static PRInt32 PR_CALLBACK SocketSendFile(
++ PRFileDesc *sd, PRSendFileData *sfd,
++ PRTransmitFileFlags flags, PRIntervalTime timeout)
++{
++ /* The socket must be in blocking mode. */
++ if (sd->secret->nonblocking) {
++ PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
++ return -1;
++ }
++ return PR_EmulateSendFile(sd, sfd, flags, timeout);
++}
++
++static PRInt32 PR_CALLBACK SocketTransmitFile(PRFileDesc *sd, PRFileDesc *fd,
++const void *headers, PRInt32 hlen, PRTransmitFileFlags flags,
++PRIntervalTime timeout)
++{
++ PRSendFileData sfd;
++
++ sfd.fd = fd;
++ sfd.file_offset = 0;
++ sfd.file_nbytes = 0;
++ sfd.header = headers;
++ sfd.hlen = hlen;
++ sfd.trailer = NULL;
++ sfd.tlen = 0;
++
++ return(SocketSendFile(sd, &sfd, flags, timeout));
++}
++
++static PRStatus PR_CALLBACK SocketGetName(PRFileDesc *fd, PRNetAddr *addr)
++{
++ PRInt32 result, err;
++ PRUint32 addrlen;
++
++ addrlen = sizeof(PRNetAddr);
++ result = getsockname(fd->secret->md.osfd, (struct sockaddr *) addr, &addrlen);
++ if (result < 0) {
++ err = _MD_ERRNO();
++ set_getsockname_error(err);
++ return PR_FAILURE;
++ }
++#ifdef _PR_HAVE_SOCKADDR_LEN
++ if (result == 0) {
++ /* ignore the sa_len field of struct sockaddr */
++ if (addr) {
++ addr->raw.family = ((struct sockaddr *) addr)->sa_family;
++ }
++ }
++#endif /* _PR_HAVE_SOCKADDR_LEN */
++
++#ifdef _PR_INET6
++ if (AF_INET6 == addr->raw.family)
++ addr->raw.family = PR_AF_INET6;
++#endif
++ PR_ASSERT(IsValidNetAddr(addr) == PR_TRUE);
++ PR_ASSERT(IsValidNetAddrLen(addr, addrlen) == PR_TRUE);
++ return PR_SUCCESS;
++}
++
++static PRStatus PR_CALLBACK SocketGetPeerName(PRFileDesc *fd, PRNetAddr *addr)
++{
++ PRInt32 result, err;
++ PRUint32 addrlen;
++
++ addrlen = sizeof(PRNetAddr);
++ result = getpeername(fd->secret->md.osfd, (struct sockaddr *) addr, &addrlen);
++ if (result < 0) {
++ err = _MD_ERRNO();
++ set_getpeername_error(err);
++ return PR_FAILURE;
++ }
++#ifdef _PR_HAVE_SOCKADDR_LEN
++ if (result == 0) {
++ /* ignore the sa_len field of struct sockaddr */
++ if (addr) {
++ addr->raw.family = ((struct sockaddr *) addr)->sa_family;
++ }
++ }
++#endif /* _PR_HAVE_SOCKADDR_LEN */
++
++#ifdef _PR_INET6
++ if (AF_INET6 == addr->raw.family)
++ addr->raw.family = PR_AF_INET6;
++#endif
++ PR_ASSERT(IsValidNetAddr(addr) == PR_TRUE);
++ PR_ASSERT(IsValidNetAddrLen(addr, addrlen) == PR_TRUE);
++ return PR_SUCCESS;
++}
++
++static PRInt16 PR_CALLBACK SocketPoll(
++ PRFileDesc *fd, PRInt16 in_flags, PRInt16 *out_flags)
++{
++ *out_flags = 0;
++ return in_flags;
++} /* SocketPoll */
++
++
++PRStatus PR_CALLBACK SocketGetOption(PRFileDesc *fd, PRSocketOptionData *data)
++{
++ PRStatus rv;
++ PRInt32 level, name, length, err;
++
++ /*
++ * PR_SockOpt_Nonblocking is a special case that does not
++ * translate to a getsockopt() call
++ */
++ if (PR_SockOpt_Nonblocking == data->option)
++ {
++ data->value.non_blocking = fd->secret->nonblocking;
++ return PR_SUCCESS;
++ }
++
++ rv = _PR_MapOptionName(data->option, &level, &name);
++ if (PR_SUCCESS != rv) return rv;
++
++ switch (data->option)
++ {
++ case PR_SockOpt_Linger:
++ {
++#ifdef BONE_VERSION
++ struct linger linger;
++ length = sizeof(linger);
++ if (0 == getsockopt(
++ fd->secret->md.osfd, level, name, (char *) &linger, &length))
++ {
++ PR_ASSERT(sizeof(linger) == length);
++ data->value.linger.polarity =
++ (linger.l_onoff) ? PR_TRUE : PR_FALSE;
++ data->value.linger.linger =
++ PR_SecondsToInterval(linger.l_linger);
++ return PR_SUCCESS;
++ }
++ break;
++#else
++ PR_SetError( PR_NOT_IMPLEMENTED_ERROR, 0 );
++ return PR_FAILURE;
++#endif
++ }
++ case PR_SockOpt_Reuseaddr:
++ case PR_SockOpt_Keepalive:
++ case PR_SockOpt_NoDelay:
++ case PR_SockOpt_Broadcast:
++ {
++ PRIntn value;
++ length = sizeof(value);
++ if (0 == getsockopt(
++ fd->secret->md.osfd, level, name, (char *) &value, &length))
++ {
++ data->value.reuse_addr = (0 == value) ? PR_FALSE : PR_TRUE;
++ return PR_SUCCESS;
++ }
++ break;
++ }
++ case PR_SockOpt_McastLoopback:
++ {
++ PRUint8 bool;
++ length = sizeof(bool);
++ if (0 == getsockopt(
++ fd->secret->md.osfd, level, name, (char*)&bool, &length))
++ {
++ data->value.mcast_loopback = (0 == bool) ? PR_FALSE : PR_TRUE;
++ return PR_SUCCESS;
++ }
++ break;
++ }
++ case PR_SockOpt_RecvBufferSize:
++ case PR_SockOpt_SendBufferSize:
++ case PR_SockOpt_MaxSegment:
++ {
++ PRIntn value;
++ length = sizeof(value);
++ if (0 == getsockopt(
++ fd->secret->md.osfd, level, name, (char*)&value, &length))
++ {
++ data->value.recv_buffer_size = value;
++ return PR_SUCCESS;
++ }
++ break;
++ }
++ case PR_SockOpt_IpTimeToLive:
++ case PR_SockOpt_IpTypeOfService:
++ {
++ /* These options should really be an int (or PRIntn). */
++ length = sizeof(PRUintn);
++ if (0 == getsockopt(
++ fd->secret->md.osfd, level, name, (char*)&data->value.ip_ttl, &length))
++ return PR_SUCCESS;
++ break;
++ }
++ case PR_SockOpt_McastTimeToLive:
++ {
++ PRUint8 ttl;
++ length = sizeof(ttl);
++ if (0 == getsockopt(
++ fd->secret->md.osfd, level, name, (char*)&ttl, &length))
++ {
++ data->value.mcast_ttl = ttl;
++ return PR_SUCCESS;
++ }
++ break;
++ }
++#ifdef IP_ADD_MEMBERSHIP
++ case PR_SockOpt_AddMember:
++ case PR_SockOpt_DropMember:
++ {
++ struct ip_mreq mreq;
++ length = sizeof(mreq);
++ if (0 == getsockopt(
++ fd->secret->md.osfd, level, name, (char*)&mreq, &length))
++ {
++ data->value.add_member.mcaddr.inet.ip =
++ mreq.imr_multiaddr.s_addr;
++ data->value.add_member.ifaddr.inet.ip =
++ mreq.imr_interface.s_addr;
++ return PR_SUCCESS;
++ }
++ break;
++ }
++#endif /* IP_ADD_MEMBERSHIP */
++ case PR_SockOpt_McastInterface:
++ {
++ /* This option is a struct in_addr. */
++ length = sizeof(data->value.mcast_if.inet.ip);
++ if (0 == getsockopt(
++ fd->secret->md.osfd, level, name,
++ (char*)&data->value.mcast_if.inet.ip, &length))
++ return PR_SUCCESS;
++ break;
++ }
++ default:
++ PR_NOT_REACHED("Unknown socket option");
++ break;
++ }
++ err = _MD_ERRNO();
++ set_getsockopt_error(err);
++ return PR_FAILURE;
++} /* SocketGetOption */
++
++PRStatus PR_CALLBACK SocketSetOption(PRFileDesc *fd, const PRSocketOptionData *data)
++{
++ PRStatus rv;
++ PRInt32 level, name, result, err;
++
++ /*
++ * PR_SockOpt_Nonblocking is a special case that does not
++ * translate to a setsockopt call.
++ */
++ if (PR_SockOpt_Nonblocking == data->option)
++ {
++ fd->secret->nonblocking = data->value.non_blocking;
++ return PR_SUCCESS;
++ }
++
++ rv = _PR_MapOptionName(data->option, &level, &name);
++ if (PR_SUCCESS != rv) return rv;
++
++ switch (data->option)
++ {
++ case PR_SockOpt_Linger:
++ {
++#ifdef BONE_VERSION
++ struct linger linger;
++ linger.l_onoff = data->value.linger.polarity;
++ linger.l_linger = PR_IntervalToSeconds(data->value.linger.linger);
++ result = setsockopt(
++ fd->secret->md.osfd, level, name, (char*)&linger, sizeof(linger));
++ break;
++#else
++ PR_SetError( PR_NOT_IMPLEMENTED_ERROR, 0 );
++ return PR_FAILURE;
++#endif
++ }
++ case PR_SockOpt_Reuseaddr:
++ case PR_SockOpt_Keepalive:
++ case PR_SockOpt_NoDelay:
++ case PR_SockOpt_Broadcast:
++ {
++ PRIntn value;
++ value = (data->value.reuse_addr) ? 1 : 0;
++ result = setsockopt(
++ fd->secret->md.osfd, level, name, (char*)&value, sizeof(value));
++ break;
++ }
++ case PR_SockOpt_McastLoopback:
++ {
++ PRUint8 bool;
++ bool = data->value.mcast_loopback ? 1 : 0;
++ result = setsockopt(
++ fd->secret->md.osfd, level, name, (char*)&bool, sizeof(bool));
++ break;
++ }
++ case PR_SockOpt_RecvBufferSize:
++ case PR_SockOpt_SendBufferSize:
++ case PR_SockOpt_MaxSegment:
++ {
++ PRIntn value = data->value.recv_buffer_size;
++ result = setsockopt(
++ fd->secret->md.osfd, level, name, (char*)&value, sizeof(value));
++ break;
++ }
++ case PR_SockOpt_IpTimeToLive:
++ case PR_SockOpt_IpTypeOfService:
++ {
++ /* These options should really be an int (or PRIntn). */
++ result = setsockopt(
++ fd->secret->md.osfd, level, name, (char*)&data->value.ip_ttl, sizeof(PRUintn));
++ break;
++ }
++ case PR_SockOpt_McastTimeToLive:
++ {
++ PRUint8 ttl;
++ ttl = data->value.mcast_ttl;
++ result = setsockopt(
++ fd->secret->md.osfd, level, name, (char*)&ttl, sizeof(ttl));
++ break;
++ }
++#ifdef IP_ADD_MEMBERSHIP
++ case PR_SockOpt_AddMember:
++ case PR_SockOpt_DropMember:
++ {
++ struct ip_mreq mreq;
++ mreq.imr_multiaddr.s_addr =
++ data->value.add_member.mcaddr.inet.ip;
++ mreq.imr_interface.s_addr =
++ data->value.add_member.ifaddr.inet.ip;
++ result = setsockopt(
++ fd->secret->md.osfd, level, name, (char*)&mreq, sizeof(mreq));
++ break;
++ }
++#endif /* IP_ADD_MEMBERSHIP */
++ case PR_SockOpt_McastInterface:
++ {
++ /* This option is a struct in_addr. */
++ result = setsockopt(
++ fd->secret->md.osfd, level, name, (char*)&data->value.mcast_if.inet.ip,
++ sizeof(data->value.mcast_if.inet.ip));
++ break;
++ }
++ default:
++ PR_NOT_REACHED("Unknown socket option");
++ break;
++ }
++ if (0 == result)
++ return PR_SUCCESS;
++ err = _MD_ERRNO();
++ set_setsockopt_error(err);
++ return PR_FAILURE;
++} /* SocketSetOption */
++
++
++
++static PRIOMethods tcpMethods = {
++ PR_DESC_SOCKET_TCP,
++ SocketClose,
++ SocketRead,
++ SocketWrite,
++ SocketAvailable,
++ SocketAvailable64,
++ SocketSync,
++ (PRSeekFN)_PR_InvalidInt,
++ (PRSeek64FN)_PR_InvalidInt64,
++ (PRFileInfoFN)_PR_InvalidStatus,
++ (PRFileInfo64FN)_PR_InvalidStatus,
++ SocketWritev,
++ SocketConnect,
++ SocketAccept,
++ SocketBind,
++ SocketListen,
++ SocketShutdown,
++ SocketRecv,
++ SocketSend,
++ (PRRecvfromFN)_PR_InvalidInt,
++ (PRSendtoFN)_PR_InvalidInt,
++ SocketPoll,
++ SocketAcceptRead,
++ SocketTransmitFile,
++ SocketGetName,
++ SocketGetPeerName,
++ (PRReservedFN)_PR_InvalidInt,
++ (PRReservedFN)_PR_InvalidInt,
++ SocketGetOption,
++ SocketSetOption,
++ SocketSendFile,
++ SocketConnectContinue,
++ (PRReservedFN)_PR_InvalidInt,
++ (PRReservedFN)_PR_InvalidInt,
++ (PRReservedFN)_PR_InvalidInt,
++ (PRReservedFN)_PR_InvalidInt
++};
++
++static PRIOMethods udpMethods = {
++ PR_DESC_SOCKET_UDP,
++ SocketClose,
++ SocketRead,
++ SocketWrite,
++ SocketAvailable,
++ SocketAvailable64,
++ SocketSync,
++ (PRSeekFN)_PR_InvalidInt,
++ (PRSeek64FN)_PR_InvalidInt64,
++ (PRFileInfoFN)_PR_InvalidStatus,
++ (PRFileInfo64FN)_PR_InvalidStatus,
++ SocketWritev,
++ SocketConnect,
++ (PRAcceptFN)_PR_InvalidDesc,
++ SocketBind,
++ SocketListen,
++ SocketShutdown,
++ SocketRecv,
++ SocketSend,
++ SocketRecvFrom,
++ SocketSendTo,
++ SocketPoll,
++ (PRAcceptreadFN)_PR_InvalidInt,
++ (PRTransmitfileFN)_PR_InvalidInt,
++ SocketGetName,
++ SocketGetPeerName,
++ (PRReservedFN)_PR_InvalidInt,
++ (PRReservedFN)_PR_InvalidInt,
++ SocketGetOption,
++ SocketSetOption,
++ (PRSendfileFN)_PR_InvalidInt,
++ (PRConnectcontinueFN)_PR_InvalidStatus,
++ (PRReservedFN)_PR_InvalidInt,
++ (PRReservedFN)_PR_InvalidInt,
++ (PRReservedFN)_PR_InvalidInt,
++ (PRReservedFN)_PR_InvalidInt
++};
++
++
++static PRIOMethods socketpollfdMethods = {
++ (PRDescType) 0,
++ (PRCloseFN)_PR_InvalidStatus,
++ (PRReadFN)_PR_InvalidInt,
++ (PRWriteFN)_PR_InvalidInt,
++ (PRAvailableFN)_PR_InvalidInt,
++ (PRAvailable64FN)_PR_InvalidInt64,
++ (PRFsyncFN)_PR_InvalidStatus,
++ (PRSeekFN)_PR_InvalidInt,
++ (PRSeek64FN)_PR_InvalidInt64,
++ (PRFileInfoFN)_PR_InvalidStatus,
++ (PRFileInfo64FN)_PR_InvalidStatus,
++ (PRWritevFN)_PR_InvalidInt,
++ (PRConnectFN)_PR_InvalidStatus,
++ (PRAcceptFN)_PR_InvalidDesc,
++ (PRBindFN)_PR_InvalidStatus,
++ (PRListenFN)_PR_InvalidStatus,
++ (PRShutdownFN)_PR_InvalidStatus,
++ (PRRecvFN)_PR_InvalidInt,
++ (PRSendFN)_PR_InvalidInt,
++ (PRRecvfromFN)_PR_InvalidInt,
++ (PRSendtoFN)_PR_InvalidInt,
++ SocketPoll,
++ (PRAcceptreadFN)_PR_InvalidInt,
++ (PRTransmitfileFN)_PR_InvalidInt,
++ (PRGetsocknameFN)_PR_InvalidStatus,
++ (PRGetpeernameFN)_PR_InvalidStatus,
++ (PRReservedFN)_PR_InvalidInt,
++ (PRReservedFN)_PR_InvalidInt,
++ (PRGetsocketoptionFN)_PR_InvalidStatus,
++ (PRSetsocketoptionFN)_PR_InvalidStatus,
++ (PRSendfileFN)_PR_InvalidInt,
++ (PRConnectcontinueFN)_PR_InvalidStatus,
++ (PRReservedFN)_PR_InvalidInt,
++ (PRReservedFN)_PR_InvalidInt,
++ (PRReservedFN)_PR_InvalidInt,
++ (PRReservedFN)_PR_InvalidInt
++};
++
++static PRIOMethods _pr_socketpollfd_methods = {
++ (PRDescType) 0,
++ (PRCloseFN)_PR_InvalidStatus,
++ (PRReadFN)_PR_InvalidInt,
++ (PRWriteFN)_PR_InvalidInt,
++ (PRAvailableFN)_PR_InvalidInt,
++ (PRAvailable64FN)_PR_InvalidInt64,
++ (PRFsyncFN)_PR_InvalidStatus,
++ (PRSeekFN)_PR_InvalidInt,
++ (PRSeek64FN)_PR_InvalidInt64,
++ (PRFileInfoFN)_PR_InvalidStatus,
++ (PRFileInfo64FN)_PR_InvalidStatus,
++ (PRWritevFN)_PR_InvalidInt,
++ (PRConnectFN)_PR_InvalidStatus,
++ (PRAcceptFN)_PR_InvalidDesc,
++ (PRBindFN)_PR_InvalidStatus,
++ (PRListenFN)_PR_InvalidStatus,
++ (PRShutdownFN)_PR_InvalidStatus,
++ (PRRecvFN)_PR_InvalidInt,
++ (PRSendFN)_PR_InvalidInt,
++ (PRRecvfromFN)_PR_InvalidInt,
++ (PRSendtoFN)_PR_InvalidInt,
++ SocketPoll,
++ (PRAcceptreadFN)_PR_InvalidInt,
++ (PRTransmitfileFN)_PR_InvalidInt,
++ (PRGetsocknameFN)_PR_InvalidStatus,
++ (PRGetpeernameFN)_PR_InvalidStatus,
++ (PRReservedFN)_PR_InvalidInt,
++ (PRReservedFN)_PR_InvalidInt,
++ (PRGetsocketoptionFN)_PR_InvalidStatus,
++ (PRSetsocketoptionFN)_PR_InvalidStatus,
++ (PRSendfileFN)_PR_InvalidInt,
++ (PRConnectcontinueFN)_PR_InvalidStatus,
++ (PRReservedFN)_PR_InvalidInt,
++ (PRReservedFN)_PR_InvalidInt,
++ (PRReservedFN)_PR_InvalidInt,
++ (PRReservedFN)_PR_InvalidInt
++};
++
++PR_IMPLEMENT(const PRIOMethods*) PR_GetTCPMethods()
++{
++ return &tcpMethods;
++}
++
++PR_IMPLEMENT(const PRIOMethods*) PR_GetUDPMethods()
++{
++ return &udpMethods;
++}
++
++static const PRIOMethods* PR_GetSocketPollFdMethods(void)
++{
++ return &_pr_socketpollfd_methods;
++} /* PR_GetSocketPollFdMethods */
++
++PR_IMPLEMENT(PRInt32) PR_Poll(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout)
++{
++ PRInt32 rv = 0;
++ /*
++ * This code is almost a duplicate of w32poll.c's _PR_MD_PR_POLL().
++ */
++ fd_set rd, wt, ex;
++ PRFileDesc *bottom;
++ PRPollDesc *pd, *epd;
++ PRInt32 maxfd = -1, ready, err;
++ PRIntervalTime remaining, elapsed, start;
++
++ struct timeval tv, *tvp = NULL;
++
++ if (0 == npds) {
++ PR_Sleep(timeout);
++ return rv;
++ }
++
++ FD_ZERO(&rd);
++ FD_ZERO(&wt);
++ FD_ZERO(&ex);
++
++ ready = 0;
++ for (pd = pds, epd = pd + npds; pd < epd; pd++)
++ {
++ PRInt16 in_flags_read = 0, in_flags_write = 0;
++ PRInt16 out_flags_read = 0, out_flags_write = 0;
++
++ if ((NULL != pd->fd) && (0 != pd->in_flags))
++ {
++ if (pd->in_flags & PR_POLL_READ)
++ {
++ in_flags_read = (pd->fd->methods->poll)(pd->fd, pd->in_flags & ~PR_POLL_WRITE, &out_flags_read);
++ }
++ if (pd->in_flags & PR_POLL_WRITE)
++ {
++ in_flags_write = (pd->fd->methods->poll)(pd->fd, pd->in_flags & ~PR_POLL_READ, &out_flags_write);
++ }
++ if ((0 != (in_flags_read & out_flags_read))
++ || (0 != (in_flags_write & out_flags_write)))
++ {
++ /* this one's ready right now */
++ if (0 == ready)
++ {
++ /*
++ * We will have to return without calling the
++ * system poll/select function. So zero the
++ * out_flags fields of all the poll descriptors
++ * before this one.
++ */
++ PRPollDesc *prev;
++ for (prev = pds; prev < pd; prev++)
++ {
++ prev->out_flags = 0;
++ }
++ }
++ ready += 1;
++ pd->out_flags = out_flags_read | out_flags_write;
++ }
++ else
++ {
++ pd->out_flags = 0; /* pre-condition */
++
++ /* make sure this is an NSPR supported stack */
++ bottom = PR_GetIdentitiesLayer(pd->fd, PR_NSPR_IO_LAYER);
++ PR_ASSERT(NULL != bottom); /* what to do about that? */
++ if ((NULL != bottom)
++ && (_PR_FILEDESC_OPEN == bottom->secret->state))
++ {
++ if (0 == ready)
++ {
++ PRInt32 osfd = bottom->secret->md.osfd;
++ if (osfd > maxfd) maxfd = osfd;
++ if (in_flags_read & PR_POLL_READ)
++ {
++ pd->out_flags |= _PR_POLL_READ_SYS_READ;
++ FD_SET(osfd, &rd);
++ }
++ if (in_flags_read & PR_POLL_WRITE)
++ {
++ pd->out_flags |= _PR_POLL_READ_SYS_WRITE;
++ FD_SET(osfd, &wt);
++ }
++ if (in_flags_write & PR_POLL_READ)
++ {
++ pd->out_flags |= _PR_POLL_WRITE_SYS_READ;
++ FD_SET(osfd, &rd);
++ }
++ if (in_flags_write & PR_POLL_WRITE)
++ {
++ pd->out_flags |= _PR_POLL_WRITE_SYS_WRITE;
++ FD_SET(osfd, &wt);
++ }
++ if (pd->in_flags & PR_POLL_EXCEPT) FD_SET(osfd, &ex);
++ }
++ }
++ else
++ {
++ if (0 == ready)
++ {
++ PRPollDesc *prev;
++ for (prev = pds; prev < pd; prev++)
++ {
++ prev->out_flags = 0;
++ }
++ }
++ ready += 1; /* this will cause an abrupt return */
++ pd->out_flags = PR_POLL_NVAL; /* bogii */
++ }
++ }
++ }
++ else
++ {
++ pd->out_flags = 0;
++ }
++ }
++
++ if (0 != ready) return ready; /* no need to block */
++
++ remaining = timeout;
++ start = PR_IntervalNow();
++
++ retry:
++ if (timeout != PR_INTERVAL_NO_TIMEOUT)
++ {
++ PRInt32 ticksPerSecond = PR_TicksPerSecond();
++ tv.tv_sec = remaining / ticksPerSecond;
++ tv.tv_usec = PR_IntervalToMicroseconds( remaining % ticksPerSecond );
++ tvp = &tv;
++ }
++
++ ready = select(maxfd + 1, &rd, &wt, &ex, tvp);
++
++ if (ready == -1 && errno == EINTR)
++ {
++ if (timeout == PR_INTERVAL_NO_TIMEOUT) goto retry;
++ else
++ {
++ elapsed = (PRIntervalTime) (PR_IntervalNow() - start);
++ if (elapsed > timeout) ready = 0; /* timed out */
++ else
++ {
++ remaining = timeout - elapsed;
++ goto retry;
++ }
++ }
++ }
++
++ /*
++ ** Now to unravel the select sets back into the client's poll
++ ** descriptor list. Is this possibly an area for pissing away
++ ** a few cycles or what?
++ */
++ if (ready > 0)
++ {
++ ready = 0;
++ for (pd = pds, epd = pd + npds; pd < epd; pd++)
++ {
++ PRInt16 out_flags = 0;
++ if ((NULL != pd->fd) && (0 != pd->in_flags))
++ {
++ PRInt32 osfd;
++ bottom = PR_GetIdentitiesLayer(pd->fd, PR_NSPR_IO_LAYER);
++ PR_ASSERT(NULL != bottom);
++
++ osfd = bottom->secret->md.osfd;
++
++ if (FD_ISSET(osfd, &rd))
++ {
++ if (pd->out_flags & _PR_POLL_READ_SYS_READ)
++ out_flags |= PR_POLL_READ;
++ if (pd->out_flags & _PR_POLL_WRITE_SYS_READ)
++ out_flags |= PR_POLL_WRITE;
++ }
++ if (FD_ISSET(osfd, &wt))
++ {
++ if (pd->out_flags & _PR_POLL_READ_SYS_WRITE)
++ out_flags |= PR_POLL_READ;
++ if (pd->out_flags & _PR_POLL_WRITE_SYS_WRITE)
++ out_flags |= PR_POLL_WRITE;
++ }
++ if (FD_ISSET(osfd, &ex)) out_flags |= PR_POLL_EXCEPT;
++
++/* Workaround for nonblocking connects under net_server */
++#ifndef BONE_VERSION
++ if (out_flags)
++ {
++ /* check if it is a pending connect */
++ int i = 0, j = 0;
++ PR_Lock( _connectLock );
++ for( i = 0; i < connectCount; i++ )
++ {
++ if(connectList[i].osfd == osfd)
++ {
++ int connectError;
++ int connectResult;
++
++ connectResult = connect(connectList[i].osfd,
++ &connectList[i].addr,
++ connectList[i].addrlen);
++ connectError = errno;
++
++ if(connectResult < 0 )
++ {
++ if(connectError == EINTR || connectError == EWOULDBLOCK ||
++ connectError == EINPROGRESS || connectError == EALREADY)
++ {
++ break;
++ }
++ }
++
++ if(i == (connectCount - 1))
++ {
++ connectList[i].osfd = -1;
++ } else {
++ for(j = i; j < connectCount; j++ )
++ {
++ memcpy( &connectList[j], &connectList[j+1],
++ sizeof(connectList[j]));
++ }
++ }
++ connectCount--;
++
++ bottom->secret->md.connectReturnValue = connectResult;
++ bottom->secret->md.connectReturnError = connectError;
++ bottom->secret->md.connectValueValid = PR_TRUE;
++ break;
++ }
++ }
++ PR_Unlock( _connectLock );
++ }
++#endif
++ }
++ pd->out_flags = out_flags;
++ if (out_flags) ready++;
++ }
++ PR_ASSERT(ready > 0);
++ }
++ else if (ready < 0)
++ {
++ err = _MD_ERRNO();
++ if (err == EBADF)
++ {
++ /* Find the bad fds */
++ ready = 0;
++ for (pd = pds, epd = pd + npds; pd < epd; pd++)
++ {
++ pd->out_flags = 0;
++ if ((NULL != pd->fd) && (0 != pd->in_flags))
++ {
++ bottom = PR_GetIdentitiesLayer(pd->fd, PR_NSPR_IO_LAYER);
++ if (fcntl(bottom->secret->md.osfd, F_GETFL, 0) == -1)
++ {
++ pd->out_flags = PR_POLL_NVAL;
++ ready++;
++ }
++ }
++ }
++ PR_ASSERT(ready > 0);
++ }
++ else set_select_error(err);
++ }
++
++ return ready;
++} /* PR_POLL */
++
++PR_IMPLEMENT(PRFileDesc*) PR_CreateSocketPollFd(PRInt32 osfd)
++{
++ PRFileDesc *fd;
++
++ if (!_pr_initialized) _PR_ImplicitInitialization();
++
++ fd = _PR_Getfd();
++
++ if (fd == NULL) PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
++ else
++ {
++ fd->secret->md.osfd = osfd;
++ fd->secret->inheritable = _PR_TRI_FALSE;
++ fd->secret->state = _PR_FILEDESC_OPEN;
++ fd->methods = PR_GetSocketPollFdMethods();
++ }
++
++ return fd;
++} /* PR_CreateSocketPollFD */
++
++PR_IMPLEMENT(PRStatus) PR_DestroySocketPollFd(PRFileDesc *fd)
++{
++ if (NULL == fd)
++ {
++ PR_SetError(PR_BAD_DESCRIPTOR_ERROR, 0);
++ return PR_FAILURE;
++ }
++ fd->secret->state = _PR_FILEDESC_CLOSED;
++ _PR_Putfd(fd);
++ return PR_SUCCESS;
++} /* PR_DestroySocketPollFd */
++
++
++PR_IMPLEMENT(PRFileDesc *) PR_ImportTCPSocket(PRInt32 osfd)
++{
++ PRFileDesc *fd;
++
++ if (!_pr_initialized) _PR_ImplicitInitialization();
++ fd = bt_CreateFileDesc(osfd, PR_GetTCPMethods(), _PR_TRI_UNKNOWN, true);
++ if (fd == NULL)
++ closesocket(osfd);
++ return(fd);
++}
++
++PR_IMPLEMENT(PRFileDesc *) PR_ImportUDPSocket(PRInt32 osfd)
++{
++ PRFileDesc *fd;
++
++ if (!_pr_initialized) _PR_ImplicitInitialization();
++ fd = bt_CreateFileDesc(osfd, PR_GetUDPMethods(), _PR_TRI_UNKNOWN, true);
++ if (fd == NULL)
++ closesocket(osfd);
++ return(fd);
++}
++
++
++#ifndef XP_HAIKU
++int socketpair (int family, int type, int protocol, int sv[2])
++{
++ int insock, outsock, acceptedsock;
++ struct sockaddr_in addrs[2];
++ int alen;
++ /* that's really only so we can build... */
++ /*fprintf(stderr, "socketpair(%d, %d, %d)\n", family, type, protocol);*/
++ if (family != AF_INET) {
++ /*fatal*/fprintf(stderr, "socketpair(%d, %d, %d): family not supported\n", family, type, protocol);
++ errno = EPFNOSUPPORT;
++ return -1;
++ }
++ if (type != SOCK_DGRAM && type != SOCK_STREAM) {
++ errno = EPROTONOSUPPORT;
++ return -1;
++ }
++ addrs[0].sin_family = AF_INET;
++ addrs[0].sin_port = 0;
++ addrs[0].sin_addr.s_addr = htonl(INADDR_LOOPBACK);
++ addrs[1].sin_family = AF_INET;
++ addrs[1].sin_port = 0;
++ addrs[1].sin_addr.s_addr = htonl(INADDR_LOOPBACK);
++ alen = sizeof(struct sockaddr_in);
++
++ insock = socket(family, type, protocol);
++ if (insock < 0)
++ goto err1;
++ if (bind(insock, (struct sockaddr *)&addrs[0], alen) < 0)
++ goto err2;
++ if (getsockname(insock, (struct sockaddr *)&addrs[0], &alen) < 0)
++ goto err2;
++ if (type == SOCK_STREAM)
++ listen(insock, 2);
++
++ outsock = socket(family, type, protocol);
++ if (outsock < 0)
++ goto err2;
++ alen = sizeof(struct sockaddr_in);
++ if (bind(outsock, (struct sockaddr *)&addrs[1], alen) < 0)
++ goto err2;
++ if (getsockname(outsock, (struct sockaddr *)&addrs[1], &alen) < 0)
++ goto err3;
++ addrs[0].sin_addr.s_addr = htonl(INADDR_LOOPBACK);
++ addrs[1].sin_addr.s_addr = htonl(INADDR_LOOPBACK);
++ /*fprintf(stderr, "socketpair: %08lx:%d <-> %08lx:%d\n",
++ ((struct sockaddr_in *)&addrs[0])->sin_addr.s_addr,
++ ((struct sockaddr_in *)&addrs[0])->sin_port,
++ ((struct sockaddr_in *)&addrs[1])->sin_addr.s_addr,
++ ((struct sockaddr_in *)&addrs[1])->sin_port);*/
++
++ if (connect(outsock, (struct sockaddr *)&addrs[0], alen) < 0)
++ goto err3;
++ if (type == SOCK_DGRAM) {
++ if (connect(insock, (struct sockaddr *)&addrs[1], alen) < 0)
++ goto err3;
++ sv[0] = insock;
++ } else {
++ acceptedsock = accept(insock, (struct sockaddr *)&addrs[1], &alen);
++ if (acceptedsock < 0)
++ goto err3;
++ closesocket(insock);
++ sv[0] = acceptedsock;
++ }
++ sv[1] = outsock;
++ return 0;
++err3:
++ closesocket(outsock);
++err2:
++ closesocket(insock);
++err1:
++ fprintf(stderr,"socketpair: error 0x%08x\n", errno);
++ return -1;
++}
++#endif
++
++PR_IMPLEMENT(PRStatus) PR_NewTCPSocketPair(PRFileDesc *f[])
++{
++ PRInt32 rv, osfd[2];
++
++ if (!_pr_initialized) _PR_ImplicitInitialization();
++#ifdef XP_HAIKU
++ rv = socketpair(AF_UNIX, SOCK_STREAM, 0, osfd);
++#else
++ rv = socketpair(AF_INET, SOCK_STREAM, 0, osfd);
++#endif
++ if (rv == -1) {
++ return PR_FAILURE;
++ }
++ f[0] = bt_CreateFileDesc(osfd[0], PR_GetTCPMethods(), _PR_TRI_TRUE, true);
++ if (NULL == f[0]) {
++ closesocket(osfd[0]);
++ closesocket(osfd[1]);
++ /* PR_AllocFileDesc() has invoked PR_SetError(). */
++ return PR_FAILURE;
++ }
++ f[1] = bt_CreateFileDesc(osfd[1], PR_GetTCPMethods(), _PR_TRI_TRUE, true);
++ if (NULL == f[1]) {
++ PR_Close(f[0]);
++ closesocket(osfd[1]);
++ /* PR_AllocFileDesc() has invoked PR_SetError(). */
++ return PR_FAILURE;
++ }
++ return PR_SUCCESS;
++}
++
++
++PR_IMPLEMENT(PRStatus) PR_GetConnectStatus(const PRPollDesc *pd) {
++ PRInt32 osfd;
++#ifndef BONE_VERSION
++ int rv;
++#endif
++ PRFileDesc *bottom;
++
++ if (pd->out_flags & PR_POLL_NVAL) {
++ PR_SetError(PR_BAD_DESCRIPTOR_ERROR, 0);
++ return PR_FAILURE;
++ }
++
++ if ((pd->out_flags & (PR_POLL_WRITE | PR_POLL_EXCEPT | PR_POLL_ERR)) == 0) {
++ PR_ASSERT(pd->out_flags == 0);
++ PR_SetError(PR_IN_PROGRESS_ERROR, 0);
++ return PR_FAILURE;
++ }
++
++
++ /* Find the NSPR layer and invoke its connectcontinue method */
++ bottom = PR_GetIdentitiesLayer(pd->fd, PR_NSPR_IO_LAYER);
++ if (NULL == bottom)
++ {
++ PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
++ return PR_FAILURE;
++ }
++
++ osfd = bottom->secret->md.osfd;
++#ifdef BONE_VERSION /* bug 122364 */
++ /* temporary workaround until getsockopt(SO_ERROR) works in BONE */
++ if (pd->out_flags & PR_POLL_EXCEPT) {
++ PR_SetError(PR_CONNECT_REFUSED_ERROR, 0);
++ return PR_FAILURE;
++ }
++ PR_ASSERT(pd->out_flags & PR_POLL_WRITE);
++ return PR_SUCCESS;
++#else
++ rv = recv(bottom->secret->md.osfd, NULL, 0, 0);
++ PR_ASSERT(-1 == rv || 0 == rv);
++
++ if (-1 == rv && 0 != errno && errno != EAGAIN && errno != EWOULDBLOCK ) {
++ set_connect_error(errno);
++ return PR_FAILURE;
++ }
++ else
++ return PR_SUCCESS;
++#endif /* BONE_VERSION */
++}
++
++PR_IMPLEMENT(PRFileDesc*) PR_Socket(PRInt32 domain, PRInt32 type, PRInt32 proto)
++{
++ PRInt32 osfd, err;
++ PRFileDesc *fd;
++ PRInt32 tmp_domain = domain;
++
++ if (!_pr_initialized) _PR_ImplicitInitialization();
++ if (PR_AF_INET != domain
++ && PR_AF_INET6 != domain
++ ) {
++ PR_SetError(PR_ADDRESS_NOT_SUPPORTED_ERROR, 0);
++ return NULL;
++ }
++ if( type != SOCK_STREAM && type != SOCK_DGRAM )
++ {
++ PR_SetError(PR_ADDRESS_NOT_SUPPORTED_ERROR, 0);
++ return NULL;
++ }
++
++#if defined(_PR_INET6_PROBE)
++ if (PR_AF_INET6 == domain) {
++ if (_pr_ipv6_is_present == PR_FALSE)
++ domain = AF_INET;
++ else
++ domain = AF_INET6;
++ }
++#elif defined(_PR_INET6)
++ if (PR_AF_INET6 == domain)
++ domain = AF_INET6;
++#else
++ if (PR_AF_INET6 == domain)
++ domain = AF_INET;
++#endif /* _PR_INET6 */
++#ifndef BONE_VERSION
++ osfd = socket(domain, type, 0);
++#else
++ osfd = socket(domain, type, proto);
++#endif
++ if (osfd == -1) {
++ err = _MD_ERRNO();
++ set_socket_error(err);
++ return 0;
++ }
++ fd = bt_CreateFileDesc(osfd, SOCK_STREAM == type?PR_GetTCPMethods() : PR_GetUDPMethods(), _PR_TRI_TRUE, true);
++
++ if (fd != NULL) {
++#if defined(_PR_INET6_PROBE) || !defined(_PR_INET6)
++ /*
++ * For platforms with no support for IPv6
++ * create layered socket for IPv4-mapped IPv6 addresses
++ */
++ if (PR_AF_INET6 == tmp_domain && PR_AF_INET == domain) {
++ if (PR_FAILURE == _pr_push_ipv6toipv4_layer(fd)) {
++ PR_Close(fd);
++ fd = NULL;
++ }
++ }
++#endif
++ } else
++ closesocket(osfd);
++
++ return fd;
++}
++
++
++PR_IMPLEMENT(PRFileDesc *) PR_NewTCPSocket(void)
++{
++ return PR_Socket(AF_INET, SOCK_STREAM, 0);
++}
++
++PR_IMPLEMENT(PRFileDesc*) PR_NewUDPSocket(void)
++{
++ return PR_Socket(AF_INET, SOCK_DGRAM, 0);
++}
++
++PR_IMPLEMENT(PRFileDesc *) PR_OpenTCPSocket(PRIntn af)
++{
++ return PR_Socket(af, SOCK_STREAM, 0);
++}
++
++PR_IMPLEMENT(PRFileDesc*) PR_OpenUDPSocket(PRIntn af)
++{
++ return PR_Socket(af, SOCK_DGRAM, 0);
++}
++
+Index: nsprpub/pr/src/bthreads/btthread.c
+===================================================================
+--- nsprpub/pr/src/bthreads/btthread.c (revision 7)
++++ nsprpub/pr/src/bthreads/btthread.c (working copy)
+@@ -120,12 +120,9 @@
+ */
+
+ beThreadPriority = _bt_MapNSPRToNativePriority( priority );
+-
+ set_thread_priority( find_thread( NULL ), beThreadPriority );
+-
+ primordialThread->priority = priority;
+
+-
+ /* set the thread's state - note that the thread is not joinable */
+ primordialThread->state |= BT_THREAD_PRIMORD;
+ if (type == PR_SYSTEM_THREAD)
+@@ -219,9 +216,7 @@
+ allocated a joinSem for us) - let them know we're
+ ready */
+ delete_sem(me->md.joinSem);
+-
+ PR_Unlock(joinSemLock);
+-
+ }
+ else
+ {
+@@ -229,10 +224,8 @@
+ is our responsibility to allocate the joinSem
+ and block on it */
+ me->md.joinSem = create_sem(0, "join sem");
+-
+ /* we're done accessing our joinSem */
+ PR_Unlock(joinSemLock);
+-
+ /* wait for someone to join us */
+ while (acquire_sem(me->md.joinSem) == B_INTERRUPTED);
+ }
+@@ -243,10 +236,8 @@
+ {
+ /* synchronize access to bt_book */
+ PR_Lock( bt_book.ml );
+-
+ /* decrement the number of currently-alive user threads */
+ bt_book.threadCount--;
+-
+ 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
+@@ -277,9 +268,7 @@
+
+ /* save our PRThread object into our TLS */
+ tls_set(tls_prThreadSlot, thred);
+-
+ thred->startFunc(thred->arg); /* run the dang thing */
+-
+ /* clean up */
+ _bt_CleanupThread(NULL);
+
+@@ -292,7 +281,6 @@
+ PRThreadState state, PRUint32 stackSize)
+ {
+ PRUint32 bePriority;
+-
+ PRThread* thred;
+
+ if (!_pr_initialized) _PR_ImplicitInitialization();
+@@ -305,7 +293,6 @@
+ }
+
+ thred->md.joinSem = B_ERROR;
+-
+ thred->arg = arg;
+ thred->startFunc = start;
+ thred->priority = priority;
+@@ -316,7 +303,6 @@
+ }
+
+ /* keep some books */
+-
+ PR_Lock( bt_book.ml );
+
+ if (type == PR_USER_THREAD)
+@@ -325,9 +311,7 @@
+ }
+
+ PR_Unlock( bt_book.ml );
+-
+ bePriority = _bt_MapNSPRToNativePriority( priority );
+-
+ thred->md.tid = spawn_thread((thread_func)_bt_root, "moz-thread",
+ bePriority, thred);
+ if (thred->md.tid < B_OK) {
+@@ -433,6 +417,13 @@
+ return thred;
+ }
+
++PR_IMPLEMENT(void*)PR_GetSP(PRThread *thred)
++{
++ thread_info tInfo;
++ get_thread_info(thred->md.tid, &tInfo);
++ return tInfo.stack_base; /* or should it be _end? */
++}
++
+ PR_IMPLEMENT(PRThreadScope)
+ PR_GetThreadScope (const PRThread* thred)
+ {
+Index: nsprpub/pr/src/io/prmapopt.c
+===================================================================
+--- nsprpub/pr/src/io/prmapopt.c (revision 7)
++++ nsprpub/pr/src/io/prmapopt.c (working copy)
+@@ -74,7 +74,7 @@
+ #include /* TCP_NODELAY, TCP_MAXSEG */
+ #endif
+
+-#ifndef _PR_PTHREADS
++#if !defined(_PR_PTHREADS) && !defined(_PR_BTHREADS)
+
+ PRStatus PR_CALLBACK _PR_SocketGetSocketOption(PRFileDesc *fd, PRSocketOptionData *data)
+ {
+@@ -99,7 +99,6 @@
+ {
+ case PR_SockOpt_Linger:
+ {
+-#if !defined(XP_BEOS) || defined(BONE_VERSION)
+ struct linger linger;
+ length = sizeof(linger);
+ rv = _PR_MD_GETSOCKOPT(
+@@ -113,10 +112,6 @@
+ PR_SecondsToInterval(linger.l_linger);
+ }
+ break;
+-#else
+- PR_SetError( PR_NOT_IMPLEMENTED_ERROR, 0 );
+- return PR_FAILURE;
+-#endif
+ }
+ case PR_SockOpt_Reuseaddr:
+ case PR_SockOpt_Keepalive:
+@@ -257,17 +252,12 @@
+ {
+ case PR_SockOpt_Linger:
+ {
+-#if !defined(XP_BEOS) || defined(BONE_VERSION)
+ struct linger linger;
+ linger.l_onoff = data->value.linger.polarity;
+ linger.l_linger = PR_IntervalToSeconds(data->value.linger.linger);
+ rv = _PR_MD_SETSOCKOPT(
+ fd, level, name, (char*)&linger, sizeof(linger));
+ break;
+-#else
+- PR_SetError( PR_NOT_IMPLEMENTED_ERROR, 0 );
+- return PR_FAILURE;
+-#endif
+ }
+ case PR_SockOpt_Reuseaddr:
+ case PR_SockOpt_Keepalive:
+@@ -355,7 +345,7 @@
+ return rv;
+ } /* _PR_SocketSetSocketOption */
+
+-#endif /* ! _PR_PTHREADS */
++#endif /* ! _PR_PTHREADS && ! _PR_BTHREADS */
+
+ /*
+ *********************************************************************
+Index: nsprpub/pr/src/md/beos/bsrcs.mk
+===================================================================
+--- nsprpub/pr/src/md/beos/bsrcs.mk (revision 7)
++++ nsprpub/pr/src/md/beos/bsrcs.mk (working copy)
+@@ -20,6 +20,7 @@
+ # the Initial Developer. All Rights Reserved.
+ #
+ # Contributor(s):
++# Fredrik Holmqvist
+ #
+ # Alternatively, the contents of this file may be used under the terms of
+ # either the GNU General Public License Version 2 or later (the "GPL"), or
+@@ -42,13 +43,6 @@
+
+ MDCSRCS = \
+ beos.c \
+- beos_errors.c \
+- bfile.c \
+- bmisc.c \
+- bnet.c \
+ bproc.c \
+- brng.c \
+- bseg.c \
+- btime.c \
+ bmmap.c \
+ $(NULL)
+Index: nsprpub/pr/src/md/beos/bproc.c
+===================================================================
+--- nsprpub/pr/src/md/beos/bproc.c (revision 7)
++++ nsprpub/pr/src/md/beos/bproc.c (working copy)
+@@ -36,8 +36,10 @@
+ * ***** END LICENSE BLOCK ***** */
+
+ #include "primpl.h"
++#include
++#include
+ #include
+-#include
++#include
+
+ #define _PR_SIGNALED_EXITSTATUS 256
+
+Index: nsprpub/pr/src/md/beos/beos.c
+===================================================================
+--- nsprpub/pr/src/md/beos/beos.c (revision 7)
++++ nsprpub/pr/src/md/beos/beos.c (working copy)
+@@ -37,58 +37,87 @@
+
+ #include "primpl.h"
+
+-#include
+-#include
+-#include
+-#include
+-#include
+-#include
+ #include
+-#include
+-#include
+-
+ /*
+ * Make sure _PRSockLen_t is 32-bit, because we will cast a PRUint32* or
+ * PRInt32* pointer to a _PRSockLen_t* pointer.
+ */
+ #define _PRSockLen_t int
+
+-/*
+-** Global lock variable used to bracket calls into rusty libraries that
+-** aren't thread safe (like libc, libX, etc).
+-*/
+-static PRLock *_pr_rename_lock = NULL;
+-static PRMonitor *_pr_Xfe_mon = NULL;
+
++#ifndef BONE_VERSION
++PRLock *_connectLock = NULL;
++
++/* Workaround for nonblocking connects under net_server */
++PRUint32 connectCount = 0;
++ConnectListNode connectList[64];
++
++void
++_MD_final_init_netserver(void)
++{
++ _connectLock = PR_NewLock();
++ PR_ASSERT(NULL != _connectLock);
++ /* Workaround for nonblocking connects under net_server */
++ connectCount = 0;
++}
++#endif /* !BONE_VERSION */
++
++
++#ifdef __powerpc__
++static PRLock *monitor = NULL;
++
++void
++_MD_AtomicInit(void)
++{
++ if (monitor == NULL) {
++ monitor = PR_NewLock();
++ }
++}
++#endif /* __powerpc__ */
++
+ /*
+- * Variables used by the GC code, initialized in _MD_InitSegs().
+- * _pr_zero_fd should be a static variable. Unfortunately, there is
+- * still some Unix-specific code left in function PR_GrowSegment()
+- * in file memory/prseg.c that references it, so it needs
+- * to be a global variable for now.
++** This is exceedingly messy. atomic_add returns the last value, NSPR
++** expects the new value. We just add or subtract 1 from the result.
++** The actual memory update is atomic.
+ */
+-PRInt32 _pr_zero_fd = -1;
+-static PRLock *_pr_md_lock = NULL;
+
+-sigset_t timer_set;
++PRInt32
++_MD_AtomicAdd( PRInt32 *ptr, PRInt32 val )
++{
++ return atomic_add( (long *)ptr, val ) + val;
++}
+
+-void _PR_UnixInit()
++PRInt32
++_MD_AtomicIncrement( PRInt32 *val )
+ {
+- struct sigaction sigact;
+- int rv;
++ return atomic_add( (long *)val, 1 ) + 1;
++}
+
+- sigemptyset(&timer_set);
++PRInt32
++_MD_AtomicDecrement( PRInt32 *val )
++{
++ return atomic_add( (long *)val, -1 ) - 1;
++}
+
+- sigact.sa_handler = SIG_IGN;
+- sigemptyset(&sigact.sa_mask);
+- sigact.sa_flags = 0;
+- rv = sigaction(SIGPIPE, &sigact, 0);
+- PR_ASSERT(0 == rv);
++PRInt32
++_MD_AtomicSet( PRInt32 *val, PRInt32 newval )
++{
++ PRInt32 result;
++#ifdef __powerpc__
++ if (!_pr_initialized) {
++ _PR_ImplicitInitialization();
++ }
++ PR_Lock(monitor);
++ result = *val;
++ *val = newval;
++ PR_Unlock(monitor);
++#else
++ asm volatile ("xchgl %0, %1"
++ : "=r"(result), "=m"(*val)
++ : "0"(newval), "m"(*val));
+
+- _pr_rename_lock = PR_NewLock();
+- PR_ASSERT(NULL != _pr_rename_lock);
+- _pr_Xfe_mon = PR_NewMonitor();
+- PR_ASSERT(NULL != _pr_Xfe_mon);
++#endif /* __powerpc__ */
++ return result;
+ }
+
+ /*
+@@ -98,9 +127,7 @@
+ *
+ * Returns the current time in microseconds since the epoch.
+ * The epoch is midnight January 1, 1970 GMT.
+- * The implementation is machine dependent. This is the Unix
+- * implementation.
+- * Cf. time_t time(time_t *tp)
++ * The implementation is machine dependent.
+ *
+ *-----------------------------------------------------------------------
+ */
+@@ -108,157 +135,75 @@
+ PR_IMPLEMENT(PRTime)
+ PR_Now(void)
+ {
+- struct timeval tv;
+- PRInt64 s, us, s2us;
+-
+- GETTIMEOFDAY(&tv);
+- LL_I2L(s2us, PR_USEC_PER_SEC);
+- LL_I2L(s, tv.tv_sec);
+- LL_I2L(us, tv.tv_usec);
+- LL_MUL(s, s, s2us);
+- LL_ADD(s, s, us);
+- return s;
++ return (PRTime) real_time_clock_usecs();
+ }
+
+ PRIntervalTime
+-_PR_UNIX_GetInterval()
++_MD_get_interval(void)
+ {
+- struct timeval time;
+- PRIntervalTime ticks;
+-
+- (void)GETTIMEOFDAY(&time); /* fallicy of course */
+- ticks = (PRUint32)time.tv_sec * PR_MSEC_PER_SEC; /* that's in milliseconds */
+- ticks += (PRUint32)time.tv_usec / PR_USEC_PER_MSEC; /* so's that */
+- return ticks;
+-} /* _PR_SUNOS_GetInterval */
+-
+-PRIntervalTime _PR_UNIX_TicksPerSecond()
+-{
+- return 1000; /* this needs some work :) */
++ return (PRIntervalTime) real_time_clock_usecs() / 10;
+ }
+
+-/************************************************************************/
+-
+-/*
+-** Special hacks for xlib. Xlib/Xt/Xm is not re-entrant nor is it thread
+-** safe. Unfortunately, neither is mozilla. To make these programs work
+-** in a pre-emptive threaded environment, we need to use a lock.
+-*/
+-
+-void PR_XLock()
++PRIntervalTime
++_MD_interval_per_sec(void)
+ {
+- PR_EnterMonitor(_pr_Xfe_mon);
++ return 100000L;
+ }
+
+-void PR_XUnlock()
++PRSize
++_PR_MD_GetRandomNoise( void *buf, PRSize size )
+ {
+- PR_ExitMonitor(_pr_Xfe_mon);
+-}
++ struct timeval tv;
++ int n = 0;
++ int s;
+
+-PRBool PR_XIsLocked()
+-{
+- return (PR_InMonitor(_pr_Xfe_mon)) ? PR_TRUE : PR_FALSE;
+-}
++ GETTIMEOFDAY(&tv);
+
+-void PR_XWait(int ms)
+-{
+- PR_Wait(_pr_Xfe_mon, PR_MillisecondsToInterval(ms));
++ if ( size >= 0 ) {
++ s = _pr_CopyLowBits((char*)buf+n, size, &tv.tv_usec, sizeof(tv.tv_usec));
++ size -= s;
++ n += s;
+ }
+-
+-void PR_XNotify(void)
+-{
+- PR_Notify(_pr_Xfe_mon);
++ if ( size >= 0 ) {
++ s = _pr_CopyLowBits((char*)buf+n, size, &tv.tv_sec, sizeof(tv.tv_sec));
++ size -= s;
++ n += s;
+ }
++ return n;
++} /* end _PR_MD_GetRandomNoise() */
+
+-void PR_XNotifyAll(void)
+-{
+- PR_NotifyAll(_pr_Xfe_mon);
+-}
+
+-#if !defined(BEOS)
+-#ifdef HAVE_BSD_FLOCK
+-
+-#include
+-
+-PR_IMPLEMENT(PRStatus)
+-_MD_LOCKFILE (PRInt32 f)
++/* Needed by prinit.c:612 */
++void
++_PR_MD_QUERY_FD_INHERITABLE(PRFileDesc *fd)
+ {
+- PRInt32 rv;
+- rv = flock(f, LOCK_EX);
+- if (rv == 0)
+- return PR_SUCCESS;
+- _PR_MD_MAP_FLOCK_ERROR(_MD_ERRNO());
+- return PR_FAILURE;
+-}
++ int flags;
+
+-PR_IMPLEMENT(PRStatus)
+-_MD_TLOCKFILE (PRInt32 f)
+-{
+- PRInt32 rv;
+- rv = flock(f, LOCK_EX|LOCK_NB);
+- if (rv == 0)
+- return PR_SUCCESS;
+- _PR_MD_MAP_FLOCK_ERROR(_MD_ERRNO());
+- return PR_FAILURE;
++ PR_ASSERT(_PR_TRI_UNKNOWN == fd->secret->inheritable);
++ flags = fcntl(fd->secret->md.osfd, F_GETFD, 0);
++ PR_ASSERT(-1 != flags);
++ fd->secret->inheritable = (flags & FD_CLOEXEC) ?
++ _PR_TRI_FALSE : _PR_TRI_TRUE;
+ }
+
+-PR_IMPLEMENT(PRStatus)
+-_MD_UNLOCKFILE (PRInt32 f)
++PRStatus
++_MD_gethostname(char *name, PRUint32 namelen)
+ {
+- PRInt32 rv;
+- rv = flock(f, LOCK_UN);
+- if (rv == 0)
+- return PR_SUCCESS;
+- _PR_MD_MAP_FLOCK_ERROR(_MD_ERRNO());
+- return PR_FAILURE;
+-}
+-#else
++ PRInt32 rv, err;
+
+-PR_IMPLEMENT(PRStatus)
+-_MD_LOCKFILE (PRInt32 f)
+-{
+- PRInt32 rv;
+- rv = lockf(f, F_LOCK, 0);
++ rv = gethostname(name, namelen);
+ if (rv == 0)
+- return PR_SUCCESS;
+- _PR_MD_MAP_LOCKF_ERROR(_MD_ERRNO());
+- return PR_FAILURE;
+-}
+-
+-PR_IMPLEMENT(PRStatus)
+-_MD_TLOCKFILE (PRInt32 f)
+ {
+- PRInt32 rv;
+- rv = lockf(f, F_TLOCK, 0);
+- if (rv == 0)
+- return PR_SUCCESS;
+- _PR_MD_MAP_LOCKF_ERROR(_MD_ERRNO());
+- return PR_FAILURE;
++ err = _MD_ERRNO();
++ switch (err) {
++ case EFAULT:
++ PR_SetError(PR_ACCESS_FAULT_ERROR, err);
++ break;
++ default:
++ PR_SetError(PR_UNKNOWN_ERROR, err);
++ break;
+ }
+-
+-PR_IMPLEMENT(PRStatus)
+-_MD_UNLOCKFILE (PRInt32 f)
+-{
+- PRInt32 rv;
+- rv = lockf(f, F_ULOCK, 0);
+- if (rv == 0)
+- return PR_SUCCESS;
+- _PR_MD_MAP_LOCKF_ERROR(_MD_ERRNO());
+ return PR_FAILURE;
+ }
+-#endif
+-
+-PR_IMPLEMENT(PRStatus)
+- _MD_GETHOSTNAME (char *name, PRUint32 namelen)
+-{
+- PRIntn rv;
+-
+- rv = gethostname(name, namelen);
+- if (0 == rv) {
+ return PR_SUCCESS;
+ }
+- _PR_MD_MAP_GETHOSTNAME_ERROR(_MD_ERRNO());
+- return PR_FAILURE;
+-}
+-
+-#endif
+Index: nsprpub/pr/src/io/Makefile.in
+===================================================================
+--- nsprpub/pr/src/io/Makefile.in (revision 7)
++++ nsprpub/pr/src/io/Makefile.in (working copy)
+@@ -69,6 +69,7 @@
+ $(NULL)
+
+ ifndef USE_PTHREADS
++ifndef USE_BTHREADS
+ CSRCS += \
+ prdir.c \
+ prfile.c \
+@@ -76,6 +77,7 @@
+ prsocket.c \
+ $(NULL)
+ endif
++endif
+
+ TARGETS = $(OBJS)
+
+Index: nsprpub/pr/src/io/prsocket.c
+===================================================================
+--- nsprpub/pr/src/io/prsocket.c (revision 7)
++++ nsprpub/pr/src/io/prsocket.c (working copy)
+@@ -64,7 +64,7 @@
+ * is not uniform, so we don't check it.
+ */
+ if ((addr != NULL)
+-#if defined(XP_UNIX) || defined(XP_OS2_EMX)
++#if defined(XP_UNIX) || defined(XP_OS2_EMX) || defined(XP_BEOS)
+ && (addr->raw.family != AF_UNIX)
+ #endif
+ && (PR_NETADDR_SIZE(addr) != addr_len)) {
+Index: nsprpub/pr/src/memory/prseg.c
+===================================================================
+--- nsprpub/pr/src/memory/prseg.c (revision 7)
++++ nsprpub/pr/src/memory/prseg.c (working copy)
+@@ -37,7 +37,7 @@
+
+ #include "primpl.h"
+
+-#if defined(_PR_PTHREADS)
++#if defined(_PR_PTHREADS) || defined(_PR_BTHREADS)
+
+ /*
+ ** The pthreads version doesn't use these functions.
+@@ -46,7 +46,7 @@
+ {
+ }
+
+-#else /* _PR_PTHREADS */
++#else /* _PR_PTHREADS || defined(_PR_BTHREADS) */
+
+ void _PR_InitSegs(void)
+ {
+@@ -90,4 +90,4 @@
+ PR_DELETE(seg);
+ }
+
+-#endif /* _PR_PTHREADS */
++#endif /* _PR_PTHREADS || defined(_PR_BTHREADS) */
diff --git a/www-client/mozilla-firefox/patches/2009-09-27/r08-misc.patch b/www-client/mozilla-firefox/patches/2009-09-27/r08-misc.patch
new file mode 100644
index 000000000..76ebbd3f4
--- /dev/null
+++ b/www-client/mozilla-firefox/patches/2009-09-27/r08-misc.patch
@@ -0,0 +1,410 @@
+Index: gfx/src/beos/nsFontMetricsBeOS.cpp
+===================================================================
+--- gfx/src/beos/nsFontMetricsBeOS.cpp (revision 7)
++++ gfx/src/beos/nsFontMetricsBeOS.cpp (working copy)
+@@ -128,12 +128,12 @@
+ if (!isgeneric)
+ {
+ // non-generic font
+- if (count_font_styles((font_family)family.get()) <= 0)
++ if (count_font_styles((char *) family.get()) <= 0)
+ {
+ // the specified font does not exist on this computer.
+ continue;
+ }
+- mFontHandle.SetFamilyAndStyle( (font_family)family.get(), NULL );
++ mFontHandle.SetFamilyAndStyle( (char *)family.get(), NULL );
+ fontfound = PR_TRUE;
+ break;
+ }
+@@ -158,9 +158,9 @@
+ prefs->GetBranch("font.name.", getter_AddRefs(branch));
+ branch->GetCharPref(prop, getter_Copies(real_family));
+
+- if (!real_family.IsEmpty() && real_family.Length() <= B_FONT_FAMILY_LENGTH && count_font_styles((font_family)real_family.get()) > 0)
++ if (!real_family.IsEmpty() && real_family.Length() <= B_FONT_FAMILY_LENGTH && count_font_styles((char *)real_family.get()) > 0)
+ {
+- mFontHandle.SetFamilyAndStyle( (font_family)real_family.get(), NULL );
++ mFontHandle.SetFamilyAndStyle( (char *)real_family.get(), NULL );
+ fontfound = PR_TRUE;
+ break;
+ }
+@@ -414,8 +414,8 @@
+ nsFontMetricsBeOS::FamilyExists(const nsString& aName)
+ {
+ NS_ConvertUTF16toUTF8 family(aName);
+- printf("exists? %s", (font_family)family.get());
+- return (count_font_styles((font_family)family.get()) > 0) ? NS_OK : NS_ERROR_FAILURE;
++ printf("exists? %s", (char *)family.get());
++ return (count_font_styles((char *)family.get()) > 0) ? NS_OK : NS_ERROR_FAILURE;
+ }
+
+ // useful UTF-8 utility
+Index: gfx/src/beos/nsRenderingContextBeOS.cpp
+===================================================================
+--- gfx/src/beos/nsRenderingContextBeOS.cpp (revision 7)
++++ gfx/src/beos/nsRenderingContextBeOS.cpp (working copy)
+@@ -351,8 +351,11 @@
+ if (mCurrentBFont == nsnull)
+ {
+ if (mFontMetrics)
+- mFontMetrics->GetFontHandle((nsFontHandle)mCurrentBFont);
+-
++ {
++ nsFontHandle fontHandle;
++ mFontMetrics->GetFontHandle(fontHandle);
++ mCurrentBFont = (BFont *) fontHandle;
++ }
+ if (mCurrentBFont)
+ mView->SetFont(mCurrentBFont);
+ else
+@@ -1127,7 +1130,7 @@
+ NS_IMETHODIMP nsRenderingContextBeOS::GetTextDimensions(const PRUnichar* aString,
+ PRInt32 aLength, PRInt32 aAvailWidth, PRInt32* aBreaks, PRInt32 aNumBreaks,
+ nsTextDimensions& aDimensions, PRInt32& aNumCharsFit, nsTextDimensions& aLastWordDimensions,
+- PRInt32* aFontID = nsnull)
++ PRInt32* aFontID)
+ {
+ nsresult ret_code = NS_ERROR_FAILURE;
+ uint8 utf8buf[1024];
+@@ -1160,7 +1163,7 @@
+
+ NS_IMETHODIMP nsRenderingContextBeOS::GetTextDimensions(const char* aString, PRInt32 aLength,
+ PRInt32 aAvailWidth,PRInt32* aBreaks, PRInt32 aNumBreaks, nsTextDimensions& aDimensions,
+- PRInt32& aNumCharsFit, nsTextDimensions& aLastWordDimensions, PRInt32* aFontID = nsnull)
++ PRInt32& aNumCharsFit, nsTextDimensions& aLastWordDimensions, PRInt32* aFontID)
+ {
+ // Code is borrowed from win32 implementation including comments.
+ // Minor changes are introduced due multibyte/utf-8 nature of char* strings handling in BeOS.
+Index: toolkit/xre/nsAppRunner.cpp
+===================================================================
+--- toolkit/xre/nsAppRunner.cpp (revision 7)
++++ toolkit/xre/nsAppRunner.cpp (working copy)
+@@ -1361,9 +1361,10 @@
+ #elif defined(XP_BEOS)
+ int32 cookie = 0;
+ image_info info;
+-
++ do {
+ if(get_next_image_info(0, &cookie, &info) != B_OK)
+ return NS_ERROR_FAILURE;
++ } while(info.type != B_APP_IMAGE);
+
+ rv = NS_NewNativeLocalFile(nsDependentCString(info.name), PR_TRUE,
+ getter_AddRefs(lf));
+Index: toolkit/xre/nsXREDirProvider.cpp
+===================================================================
+--- toolkit/xre/nsXREDirProvider.cpp (revision 7)
++++ toolkit/xre/nsXREDirProvider.cpp (working copy)
+@@ -76,7 +76,7 @@
+ #include "nsILocalFileMac.h"
+ #endif
+ #ifdef XP_BEOS
+-#include
++#include
+ #include
+ #endif
+ #ifdef XP_UNIX
+Index: widget/src/beos/nsAppShell.cpp
+===================================================================
+--- widget/src/beos/nsAppShell.cpp (revision 7)
++++ widget/src/beos/nsAppShell.cpp (working copy)
+@@ -118,10 +118,28 @@
+ // NOTE: this needs to be run from within the main application thread
+ char portname[64];
+ char semname[64];
++ int32 cookie = 0;
++ image_info iinfo;
++ char *leaf = NULL;
++ do {
++ if (get_next_image_info(0, &cookie, &iinfo) == B_OK &&
++ strlen(iinfo.name) > 0 &&
++ (leaf = strrchr(iinfo.name, '/')) != NULL)
++ {
++ leaf++;
++ PR_snprintf(portname, sizeof(portname), "event%lx",
++ (long unsigned) find_thread(leaf));
++ PR_snprintf(semname, sizeof(semname), "sync%lx",
++ (long unsigned) find_thread(leaf));
++ }
++ else
++ {
+ PR_snprintf(portname, sizeof(portname), "event%lx",
+- (long unsigned) PR_GetCurrentThread());
++ (long unsigned) find_thread(0));
+ PR_snprintf(semname, sizeof(semname), "sync%lx",
+- (long unsigned) PR_GetCurrentThread());
++ (long unsigned) find_thread(0));
++ }
++ } while(iinfo.type != B_APP_IMAGE);
+
+ #ifdef DEBUG
+ printf("nsAppShell::Create portname: %s, semname: %s\n", portname, semname);
+@@ -342,8 +360,22 @@
+ {
+ // should we check for eventport initialization ?
+ char portname[64];
++ int32 cookie = 0;
++ image_info iinfo;
++ char *leaf = NULL;
++ do {
++ if (get_next_image_info(0, &cookie, &iinfo) == B_OK &&
++ strlen(iinfo.name) > 0 &&
++ (leaf = strrchr(iinfo.name, '/')) != NULL)
++ {
++ leaf++;
++ PR_snprintf(portname, sizeof(portname), "event%lx",
++ (long unsigned) find_thread(leaf));
++ }
++ else
+ PR_snprintf(portname, sizeof(portname), "event%lx",
+- (long unsigned) PR_GetCurrentThread());
++ (long unsigned) find_thread(0)/*PR_GetCurrentThread()*/);
++ } while(iinfo.type != B_APP_IMAGE);
+
+ if((eventport = find_port(portname)) < 0)
+ {
+Index: widget/src/beos/nsDragService.cpp
+===================================================================
+--- widget/src/beos/nsDragService.cpp (revision 7)
++++ widget/src/beos/nsDragService.cpp (working copy)
+@@ -255,7 +255,7 @@
+ bool noBitmap = true;
+
+ //This is the code for image-dragging, currently disabled. See comments in beginning of file.
+-# ifdef 0
++#if 0
+ do
+ {
+ PRUint32 dataSize;
+Index: widget/src/beos/nsToolkit.cpp
+===================================================================
+--- widget/src/beos/nsToolkit.cpp (revision 7)
++++ widget/src/beos/nsToolkit.cpp (working copy)
+@@ -42,6 +42,7 @@
+ #include "nsSwitchToUIThread.h"
+ #include "plevent.h"
+ #include "prprf.h"
++#include
+
+ //
+ // Static thread local storage index of the Toolkit
+@@ -89,10 +90,26 @@
+ delete info;
+
+ // system wide unique names
++ int32 cookie = 0;
++ image_info iinfo;
++ char *leaf = NULL;
++ do {
++ if (get_next_image_info(0, &cookie, &iinfo) == B_OK &&
++ strlen(iinfo.name) > 0 &&
++ (leaf = strrchr(iinfo.name, '/')) != NULL)
++ {
++ leaf++;
++ PR_snprintf(portname, sizeof(portname), "event%lx",
++ (long unsigned) find_thread(leaf));
++ }
++ else
++ {
+ PR_snprintf(portname, sizeof(portname), "event%lx",
+- (long unsigned) PR_GetCurrentThread());
++ (long unsigned) find_thread(0));
++ }
++ } while(iinfo.type != B_APP_IMAGE);
+
+- port_id event = create_port(100, portname);
++ port_id event = create_port(200, portname);
+
+ while(read_port(event, &code, &id, sizeof(id)) >= 0)
+ {
+@@ -130,6 +147,7 @@
+ {
+ localthread = false;
+ mGuiThread = NULL;
++ mGUIThreadID = 0;
+ }
+
+
+@@ -188,6 +206,22 @@
+ }
+ }
+
++ image_info iinfo;
++ int32 cookie = 0;
++ char *leaf = NULL;
++ do {
++ if (get_next_image_info(0, &cookie, &iinfo) == B_OK &&
++ strlen(iinfo.name) > 0 &&
++ (leaf = strrchr(iinfo.name, '/')) != NULL)
++ {
++ leaf++;
++ mGUIThreadID = find_thread(leaf);
++ }
++ else
++ {
++ mGUIThreadID = find_thread(0);
++ }
++ } while(iinfo.type != B_APP_IMAGE);
+ // at this point the thread is running
+ PR_ExitMonitor(monitor);
+ PR_DestroyMonitor(monitor);
+@@ -218,7 +252,22 @@
+ }
+
+ cached = false;
+-
++ image_info iinfo;
++ int32 cookie = 0;
++ char *leaf = NULL;
++ do {
++ if (get_next_image_info(0, &cookie, &iinfo) == B_OK &&
++ strlen(iinfo.name) > 0 &&
++ (leaf = strrchr(iinfo.name, '/')) != NULL)
++ {
++ leaf++;
++ mGUIThreadID = find_thread(leaf);
++ }
++ else
++ {
++ mGUIThreadID = find_thread(0);
++ }
++ } while(iinfo.type != B_APP_IMAGE);
+ return NS_OK;
+ }
+
+@@ -227,9 +276,8 @@
+ if(! cached)
+ {
+ char portname[64];
+-
+ PR_snprintf(portname, sizeof(portname), "event%lx",
+- (long unsigned) mGuiThread);
++ (long unsigned) mGUIThreadID);
+
+ eventport = find_port(portname);
+
+Index: widget/src/beos/nsToolkit.h
+===================================================================
+--- widget/src/beos/nsToolkit.h (revision 7)
++++ widget/src/beos/nsToolkit.h (working copy)
+@@ -71,6 +71,7 @@
+ protected:
+ // Thread Id of the "main" Gui thread.
+ PRThread *mGuiThread;
++ thread_id mGUIThreadID;
+ static void RunPump(void* arg);
+ void GetInterface();
+ bool cached;
+Index: xpcom/reflect/xptcall/src/md/unix/xptc_platforms_unixish_x86.h
+===================================================================
+--- xpcom/reflect/xptcall/src/md/unix/xptc_platforms_unixish_x86.h (revision 7)
++++ xpcom/reflect/xptcall/src/md/unix/xptc_platforms_unixish_x86.h (working copy)
+@@ -138,8 +138,13 @@
+ #endif
+
+ #elif defined(__BEOS__)
++#if (__GNUC__ == 2)
+ #define CFRONT_STYLE_THIS_ADJUST
++#else
++#define THUNK_BASED_THIS_ADJUST
++#endif
+
++
+ #elif defined(__sun__) || defined(__sun)
+ #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
+ #define THUNK_BASED_THIS_ADJUST
+Index: xpcom/threads/plevent.c
+===================================================================
+--- xpcom/threads/plevent.c (revision 7)
++++ xpcom/threads/plevent.c (working copy)
+@@ -66,6 +66,8 @@
+
+ #if defined(XP_BEOS)
+ #include
++#include
++#include
+ #endif
+
+ #if defined(XP_MACOSX)
+@@ -908,10 +910,39 @@
+
+ char portname[64];
+ char semname[64];
++
++struct _MDThread
++{
++ thread_id tid;
++ sem_id joinSem;
++ PRBool is_joining;
++};
++ struct _MDThread md;
++
++
++//#include "private/primpl.h"
++ image_info iinfo;
++ int32 icookie = 0;
++ char *leaf = NULL;
++ do {
++ if (get_next_image_info(0, &icookie, &iinfo) == B_OK &&
++ strlen(iinfo.name) > 0 &&
++ (leaf = strrchr(iinfo.name, '/')) != NULL)
++ {
++ leaf++;
++ PR_snprintf(portname, sizeof(portname), "event%lx",
++ (long unsigned) find_thread(leaf));
++ PR_snprintf(semname, sizeof(semname), "sync%lx",
++ (long unsigned) find_thread(leaf));
++ }
++ else
++ {
+ PR_snprintf(portname, sizeof(portname), "event%lx",
+- (long unsigned) self->handlerThread);
++ (long unsigned) find_thread(0));
+ PR_snprintf(semname, sizeof(semname), "sync%lx",
+- (long unsigned) self->handlerThread);
++ (long unsigned) find_thread(0));
++ }
++ } while(iinfo.type != B_APP_IMAGE);
+
+ self->eventport = find_port(portname);
+ while(get_next_sem_info(0, &cookie, &info) == B_OK)
+@@ -931,7 +962,7 @@
+ {
+ delete_port( self->eventport );
+ }
+- self->eventport = create_port(200, portname);
++ self->eventport = create_port(512, portname);
+ /* We don't use the sem, but it has to be there
+ */
+ create_sem(0, semname);
+@@ -1264,6 +1295,7 @@
+ thread_id waitingThread;
+ };
+
++
+ static PRStatus
+ _pl_NativeNotify(PLEventQueue* self)
+ {
+@@ -1274,6 +1306,7 @@
+
+ return PR_SUCCESS; /* Is this correct? */
+ }
++
+ #endif /* XP_BEOS */
+
+ #if defined(XP_MACOSX)
+Index: xpfe/bootstrap/nsSigHandlers.cpp
+===================================================================
+--- xpfe/bootstrap/nsSigHandlers.cpp (revision 7)
++++ xpfe/bootstrap/nsSigHandlers.cpp (working copy)
+@@ -60,7 +60,8 @@
+ #endif
+
+ #ifdef XP_BEOS
+-#include
++#include
++#include
+ #include
+ #include "nsCOMPtr.h"
+ #include "nsIServiceManager.h"
diff --git a/www-client/mozilla-firefox/patches/2009-09-27/r09-sunbird-options-fix.patch b/www-client/mozilla-firefox/patches/2009-09-27/r09-sunbird-options-fix.patch
new file mode 100644
index 000000000..2c91e2aa3
--- /dev/null
+++ b/www-client/mozilla-firefox/patches/2009-09-27/r09-sunbird-options-fix.patch
@@ -0,0 +1,18 @@
+Index: calendar/base/content/preferences/preferences.xul
+===================================================================
+--- calendar/base/content/preferences/preferences.xul (revision 7)
++++ calendar/base/content/preferences/preferences.xul (working copy)
+@@ -71,8 +71,13 @@
+ style="&prefWindow.styleGNOME;">
+ #endif
+ #endif
++#ifdef XP_BEOS
++ title="&prefWindow.titleGNOME;"
++ style="&prefWindow.styleGNOME;">
+ #endif
++#endif
+
++
+ Bookmarks Toolbar Folder
+ Add bookmarks to this folder to see them displayed on the Bookmarks Toolbar
+
+-
- Getting Started
+-
- Latest Headlines
++
- Haiku WebSite
++
- Nightly Builds
+
+
+- Mozilla Firefox
++ BeZilla Browser
+
+-
- Help and Tutorials
+-
- Customize Firefox
+-
- Get Involved
+-
- About Us
++
- BeZilla Blog
++
- Report an Issue
++
- View Known Issues
+
++
Haiku Bookmarks
++
++
- Nightly Builds
++
- Optional Packages
++
- Bug Tracker
++
- Haiku User Guide
++
- BeBook
++
- Welcome
++
++ Software for Haiku
++
++
- OSDrawer.net
++
- HaikuWare
++
- Zeta-Games
++
- BeBits
++
++
Haiku WebSite
++
+
+Index: profile/defaults/bookmarks.html
+===================================================================
+--- profile/defaults/bookmarks.html (revision 7)
++++ profile/defaults/bookmarks.html (working copy)
+@@ -7,35 +7,34 @@
+
Bookmarks
+
+
+-
-
+-
+-
- mozilla.org
+-
- mozillaZine
+-
- mozdev.org
++
- Get Bookmark Add-ons
++
++ Bookmarks Toolbar Folder
++ - Add bookmarks to this folder to see them displayed on the Bookmarks Toolbar
++
++
- Haiku WebSite
++
- Nightly Builds
+
+-
Mozilla Project
++
++ BeZilla Browser
+
+-
mozilla.org
+-
+-
- The Mozilla Organization
+-
- SeaMonkey Project
+-
- Mozilla Products
+-
- Feedback
+-
+-
Community & Support
+-
+-
- mozillaZine
+-
- SeaMonkey Support (mozillaZine)
+-
- mozdev.org
+-
- Mozilla Plug-in Information (mozdev)
+-
- Mozilla Extensions (mozdev)
+-
++
- BeZilla Blog
++
- Report an Issue
++
- View Known Issues
+
+-
Search the Web
++ Haiku Bookmarks
+
+-
- Google
+-
- Google Groups
+-
- Google News
++
- Nightly Builds
++
- Optional Packages
++
- Bug Tracker
++
++ Software for Haiku
++
++
- OSDrawer.net
++
- HaikuWare
++
- Zeta-Games
++
- BeBits
+
+-
++ - Haiku WebSite
++
+
+Index: browser/base/content/dynamic-bebook-v1.html
+===================================================================
+--- browser/base/content/dynamic-bebook-v1.html (revision 0)
++++ browser/base/content/dynamic-bebook-v1.html (revision 0)
+@@ -0,0 +1,32 @@
++
++
++ Opening the welcome page...
++
++
++
++ Opening the welcome page...
++
++
+Index: browser/base/content/dynamic-bebook-v2.html
+===================================================================
+--- browser/base/content/dynamic-bebook-v2.html (revision 0)
++++ browser/base/content/dynamic-bebook-v2.html (revision 0)
+@@ -0,0 +1,56 @@
++
++
++
++
++
++
++Welcome to Haiku!
++
++
++
++
++
++
++
+Index: browser/base/content/dynamic-userguide-v1.html
+===================================================================
+--- browser/base/content/dynamic-userguide-v1.html (revision 0)
++++ browser/base/content/dynamic-userguide-v1.html (revision 0)
+@@ -0,0 +1,32 @@
++
++
++ Opening the welcome page...
++
++
++
++ Opening the welcome page...
++
++
+Index: browser/base/content/dynamic-userguide-v2.html
+===================================================================
+--- browser/base/content/dynamic-userguide-v2.html (revision 0)
++++ browser/base/content/dynamic-userguide-v2.html (revision 0)
+@@ -0,0 +1,56 @@
++
++
++
++
++
++
++Welcome to Haiku!
++
++
++
++
++
++
++
+Index: browser/base/content/dynamic-welcome-v1.html
+===================================================================
+--- browser/base/content/dynamic-welcome-v1.html (revision 0)
++++ browser/base/content/dynamic-welcome-v1.html (revision 0)
+@@ -0,0 +1,32 @@
++
++
++ Opening the welcome page...
++
++
++
++ Opening the welcome page...
++
++
+Index: browser/base/content/dynamic-welcome-v2.html
+===================================================================
+--- browser/base/content/dynamic-welcome-v2.html (revision 0)
++++ browser/base/content/dynamic-welcome-v2.html (revision 0)
+@@ -0,0 +1,56 @@
++
++
++
++
++
++
++Welcome to Haiku!
++
++
++
++
++
++
++
diff --git a/www-client/mozilla-firefox/patches/2009-09-27/r12-releasenotes.patch b/www-client/mozilla-firefox/patches/2009-09-27/r12-releasenotes.patch
new file mode 100644
index 000000000..500251404
--- /dev/null
+++ b/www-client/mozilla-firefox/patches/2009-09-27/r12-releasenotes.patch
@@ -0,0 +1,19 @@
+Index: browser/app/firefox-branding.js
+===================================================================
+--- browser/app/firefox-branding.js (revision 7)
++++ browser/app/firefox-branding.js (working copy)
+@@ -1,5 +1,4 @@
+ pref("startup.homepage_override_url","http://www.mozilla.org/projects/%APP%/%VERSION%/whatsnew/");
+-pref("startup.homepage_welcome_url","http://www.mozilla.org/projects/%APP%/%VERSION%/firstrun/");
+ // URL user can browse to manually if for some reason all update installation
+ // attempts fail.
+ pref("app.update.url.manual", "http://www.mozilla.org/products/%APP%/");
+@@ -8,7 +7,7 @@
+ pref("app.update.url.details", "http://www.mozilla.org/projects/%APP%/");
+
+ // Release notes URL
+-pref("app.releaseNotesURL", "http://www.mozilla.org/projects/%APP%/%VERSION%/releasenotes/");
++pref("app.releaseNotesURL", "about:buildconfig");
+
+ // Search codes belong only in builds with official branding
+ pref("browser.search.param.yahoo-fr", "");