From aa485c29daf3378979ba89bb9f8dcf1ae986a0ec Mon Sep 17 00:00:00 2001 From: Brad Lassey Date: Tue, 30 Mar 2010 15:23:44 -0400 Subject: [PATCH] update nspr to NSPR_HEAD_20100330 to pick up support for android r=ted --HG-- extra : rebase_source : 90577e9e3385b0d866e4860e0c6c89bfe382881e --- nsprpub/config/autoconf.mk.in | 6 +- nsprpub/config/rules.mk | 2 +- nsprpub/configure | 401 ++++++++++++++++++++---------- nsprpub/configure.in | 165 +++++++++--- nsprpub/lib/ds/plarena.c | 22 +- nsprpub/lib/ds/plarena.h | 7 +- nsprpub/lib/ds/plarenas.h | 5 + nsprpub/lib/ds/plds.def | 5 + nsprpub/pr/include/md/_linux.h | 5 + nsprpub/pr/include/prbit.h | 43 ++++ nsprpub/pr/include/prlog.h | 8 - nsprpub/pr/include/prtypes.h | 8 + nsprpub/pr/src/linking/prlink.c | 8 +- nsprpub/pr/src/malloc/prmem.c | 4 +- nsprpub/pr/src/misc/prdtoa.c | 15 ++ nsprpub/pr/src/misc/prlog2.c | 30 +-- nsprpub/pr/src/misc/prnetdb.c | 13 +- nsprpub/pr/src/misc/prtime.c | 2 +- nsprpub/pr/src/pthreads/ptsynch.c | 73 +++--- nsprpub/pr/tests/Makefile.in | 5 + 20 files changed, 583 insertions(+), 244 deletions(-) diff --git a/nsprpub/config/autoconf.mk.in b/nsprpub/config/autoconf.mk.in index a1a4b78fca0..36b131403de 100644 --- a/nsprpub/config/autoconf.mk.in +++ b/nsprpub/config/autoconf.mk.in @@ -35,8 +35,10 @@ MOD_PATCH_VERSION = @MOD_PATCH_VERSION@ LIBNSPR = @LIBNSPR@ LIBPLC = @LIBPLC@ -CROSS_COMPILE = @CROSS_COMPILE@ -BUILD_OPT = @MOZ_OPTIMIZE@ +CROSS_COMPILE = @CROSS_COMPILE@ +BUILD_OPT = @MOZ_OPTIMIZE@ +MOZ_DEBUG = @MOZ_DEBUG@ +MOZ_DEBUG_SYMBOLS = @MOZ_DEBUG_SYMBOLS@ USE_CPLUS = @USE_CPLUS@ USE_IPV6 = @USE_IPV6@ diff --git a/nsprpub/config/rules.mk b/nsprpub/config/rules.mk index eed1a19232d..794b1ae5de5 100644 --- a/nsprpub/config/rules.mk +++ b/nsprpub/config/rules.mk @@ -141,7 +141,7 @@ endif ifndef TARGETS ifeq (,$(filter-out WINNT WINCE OS2,$(OS_ARCH))) TARGETS = $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) -ifndef BUILD_OPT +ifdef MOZ_DEBUG_SYMBOLS ifdef MSC_VER ifneq (,$(filter-out 1100 1200,$(MSC_VER))) TARGETS += $(SHARED_LIB_PDB) diff --git a/nsprpub/configure b/nsprpub/configure index 2a9da318a1c..11713df8e04 100755 --- a/nsprpub/configure +++ b/nsprpub/configure @@ -11,6 +11,15 @@ ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: +ac_help="$ac_help + --with-android-ndk=DIR + location where the Android NDK can be found" +ac_help="$ac_help + --with-android-toolchain=DIR + location of the android toolchain, default NDK/build/prebuilt/HOST/arm-eabi-4.4.0" +ac_help="$ac_help + --with-android-platform=DIR + location of platform dir, default NDK/build/platforms/android-5/arch-arm" ac_help="$ac_help --with-dist-prefix=DIST_PREFIX place build files in DIST_PREFIX [dist]" @@ -24,10 +33,12 @@ ac_help="$ac_help ac_help="$ac_help --with-mozilla Compile NSPR with Mozilla support" ac_help="$ac_help - --enable-optimize(=val) Enable code optimizations (val, ie. -O2) " + --enable-optimize[=OPT] Enable code optimizations (ie. -O2) " ac_help="$ac_help - --disable-debug Do not compile in debugging symbols - --enable-debug(=val) Enable debugging (debug flags val)" + --enable-debug[=DBG] Enable debugging (using compiler flags DBG)" +ac_help="$ac_help + --enable-debug-symbols[=DBG] Enable debugging symbols + (using compiler flags DBG)" ac_help="$ac_help --enable-win32-target=\$t Specify win32 flavor. (WIN95 or WINNT)" @@ -631,7 +642,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:635: checking host system type" >&5 +echo "configure:646: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -652,7 +663,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:656: checking target system type" >&5 +echo "configure:667: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -670,7 +681,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:674: checking build system type" >&5 +echo "configure:685: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -742,7 +753,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:746: checking for $ac_word" >&5 +echo "configure:757: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -797,6 +808,74 @@ if test -n "$_WIN32_MSVC"; then SKIP_LIBRARY_CHECKS=1 fi + +# Check whether --with-android-ndk or --without-android-ndk was given. +if test "${with_android_ndk+set}" = set; then + withval="$with_android_ndk" + android_ndk=$withval +fi + + +# Check whether --with-android-toolchain or --without-android-toolchain was given. +if test "${with_android_toolchain+set}" = set; then + withval="$with_android_toolchain" + android_toolchain=$withval +fi + + +# Check whether --with-android-platform or --without-android-platform was given. +if test "${with_android_platform+set}" = set; then + withval="$with_android_platform" + android_platform=$withval +fi + + +if test "$target" = "arm-android-eabi" ; then + if test -z "$android_ndk" ; then + { echo "configure: error: You must specify --with-android-ndk=/path/to/ndk when targeting Android." 1>&2; exit 1; } + fi + + if test -z "$android_toolchain" ; then + android_toolchain="$android_ndk"/build/prebuilt/`uname -s | tr "[:upper:]" "[:lower:]"`-x86/arm-eabi-4.4.0 + fi + + if test -z "$android_platform" ; then + android_platform="$android_ndk"/build/platforms/android-5/arch-arm + fi + + AS="$android_toolchain"/bin/arm-eabi-as + CC="$android_toolchain"/bin/arm-eabi-gcc + CXX="$android_toolchain"/bin/arm-eabi-g++ + CPP="$android_toolchain"/bin/arm-eabi-cpp + LD="$android_toolchain"/bin/arm-eabi-ld + AR="$android_toolchain"/bin/arm-eabi-ar + RANLIB="$android_toolchain"/bin/arm-eabi-ranlib + STRIP="$android_toolchain"/bin/arm-eabi-strip + + CPPFLAGS="-I$android_platform/usr/include $CPPFLAGS" + CFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions -march=armv5te -mthumb-interwork $CFLAGS" + CXXFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fpic -fno-short-enums -fno-exceptions -march=armv5te -mthumb-interwork -mthumb $CXXFLAGS" + LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform $LDFLAGS" + + if test -z "$HOST_CPPFLAGS" ; then + HOST_CPPFLAGS=" " + fi + if test -z "$HOST_CFLAGS" ; then + HOST_CFLAGS=" " + fi + if test -z "$HOST_CXXFLAGS" ; then + HOST_CXXFLAGS=" " + fi + if test -z "$HOST_LDFLAGS" ; then + HOST_LDFLAGS=" " + fi + + cat >> confdefs.h <<\EOF +#define ANDROID 1 +EOF + +fi + dist_prefix='${MOD_DEPTH}/dist' dist_bindir='${dist_prefix}/bin' dist_includedir='${dist_prefix}/include/nspr' @@ -864,29 +943,49 @@ fi if test "${enable_optimize+set}" = set; then enableval="$enable_optimize" if test "$enableval" != "no"; then - MOZ_OPTIMIZE=1 - if test -n "$enableval" && test "$enableval" != "yes"; then - _OPTIMIZE_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'` + MOZ_OPTIMIZE=1 + if test -n "$enableval" -a "$enableval" != "yes"; then + _OPTIMIZE_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'` _SAVE_OPTIMIZE_FLAGS=$_OPTIMIZE_FLAGS - fi + fi else - MOZ_OPTIMIZE= - fi + MOZ_OPTIMIZE= + fi fi # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" - if test "$enableval" = "no"; then - MOZ_DEBUG= - else - MOZ_DEBUG=1 - if test -n "$enableval" && test "$enableval" != "yes"; then - _DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'` - _SAVE_DEBUG_FLAGS=$_DEBUG_FLAGS - fi - fi + if test "$enableval" != "no"; then + MOZ_DEBUG=1 + MOZ_DEBUG_SYMBOLS=1 + if test -n "$enableval" -a "$enableval" != "yes"; then + _DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'` + _SAVE_DEBUG_FLAGS=$_DEBUG_FLAGS + fi + else + MOZ_DEBUG= + fi +else + MOZ_DEBUG= +fi + + +# Check whether --enable-debug-symbols or --disable-debug-symbols was given. +if test "${enable_debug_symbols+set}" = set; then + enableval="$enable_debug_symbols" + if test "$enableval" != "no"; then + MOZ_DEBUG_SYMBOLS=1 + if test -n "$enableval" -a "$enableval" != "yes"; then + if test -z "$_SAVE_DEBUG_FLAGS"; then + _DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'` + _SAVE_DEBUG_FLAGS=$_DEBUG_FLAGS + else + { echo "configure: error: --enable-debug-symbols flags cannot be used with --enable-debug flags" 1>&2; exit 1; } + fi + fi + fi fi @@ -1067,7 +1166,7 @@ if test -z "$SKIP_PATH_CHECKS"; then # Extract the first word of "$WHOAMI whoami", so it can be a program name with args. set dummy $WHOAMI whoami; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1071: checking for $ac_word" >&5 +echo "configure:1170: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_WHOAMI'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1138,13 +1237,13 @@ if test "$target" != "$host"; then _SAVE_LDFLAGS="$LDFLAGS" echo $ac_n "checking for $host compiler""... $ac_c" 1>&6 -echo "configure:1142: checking for $host compiler" >&5 +echo "configure:1241: checking for $host compiler" >&5 for ac_prog in $HOST_CC gcc cc /usr/ucb/cc do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1148: checking for $ac_word" >&5 +echo "configure:1247: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_HOST_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1190,16 +1289,16 @@ test -n "$HOST_CC" || HOST_CC="""" LDFLAGS="$HOST_LDFLAGS" echo $ac_n "checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1194: checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works" >&5 +echo "configure:1293: checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1302: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_prog_host_cc_works=1 echo "$ac_t""yes" 1>&6 else @@ -1228,7 +1327,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1232: checking for $ac_word" >&5 +echo "configure:1331: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1262,7 +1361,7 @@ test -n "$CC" || CC="echo" # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1266: checking for $ac_word" >&5 +echo "configure:1365: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1292,7 +1391,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1296: checking for $ac_word" >&5 +echo "configure:1395: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1343,7 +1442,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1347: checking for $ac_word" >&5 +echo "configure:1446: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1375,7 +1474,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1379: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1478: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -1386,12 +1485,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 1390 "configure" +#line 1489 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1395: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1494: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1417,12 +1516,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1421: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1520: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1426: checking whether we are using GNU C" >&5 +echo "configure:1525: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1431,7 +1530,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1435: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1534: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -1450,7 +1549,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1454: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1553: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1487,7 +1586,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1491: checking for $ac_word" >&5 +echo "configure:1590: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1523,7 +1622,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1527: checking for $ac_word" >&5 +echo "configure:1626: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1555,7 +1654,7 @@ test -n "$CXX" || CXX="gcc" echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1559: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 +echo "configure:1658: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 ac_ext=C # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -1566,12 +1665,12 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext << EOF -#line 1570 "configure" +#line 1669 "configure" #include "confdefs.h" int main(){return(0);} EOF -if { (eval echo configure:1575: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1674: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cxx_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1597,12 +1696,12 @@ if test $ac_cv_prog_cxx_works = no; then { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1601: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1700: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 cross_compiling=$ac_cv_prog_cxx_cross echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 -echo "configure:1606: checking whether we are using GNU C++" >&5 +echo "configure:1705: checking whether we are using GNU C++" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1611,7 +1710,7 @@ else yes; #endif EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1615: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1714: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gxx=yes else ac_cv_prog_gxx=no @@ -1630,7 +1729,7 @@ ac_test_CXXFLAGS="${CXXFLAGS+set}" ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS= echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 -echo "configure:1634: checking whether ${CXX-g++} accepts -g" >&5 +echo "configure:1733: checking whether ${CXX-g++} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1675,7 +1774,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1679: checking for $ac_word" >&5 +echo "configure:1778: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1710,7 +1809,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1714: checking for $ac_word" >&5 +echo "configure:1813: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1745,7 +1844,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1749: checking for $ac_word" >&5 +echo "configure:1848: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1780,7 +1879,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1784: checking for $ac_word" >&5 +echo "configure:1883: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1815,7 +1914,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1819: checking for $ac_word" >&5 +echo "configure:1918: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1850,7 +1949,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1854: checking for $ac_word" >&5 +echo "configure:1953: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1885,7 +1984,7 @@ else # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1889: checking for $ac_word" >&5 +echo "configure:1988: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1915,7 +2014,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1919: checking for $ac_word" >&5 +echo "configure:2018: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1966,7 +2065,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1970: checking for $ac_word" >&5 +echo "configure:2069: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1998,7 +2097,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2002: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:2101: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -2009,12 +2108,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 2013 "configure" +#line 2112 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:2018: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2117: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -2040,12 +2139,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2044: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2143: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:2049: checking whether we are using GNU C" >&5 +echo "configure:2148: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2054,7 +2153,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2058: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2157: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -2073,7 +2172,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:2077: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:2176: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2113,7 +2212,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2117: checking for $ac_word" >&5 +echo "configure:2216: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2145,7 +2244,7 @@ test -n "$CXX" || CXX="gcc" echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2149: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 +echo "configure:2248: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 ac_ext=C # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -2156,12 +2255,12 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext << EOF -#line 2160 "configure" +#line 2259 "configure" #include "confdefs.h" int main(){return(0);} EOF -if { (eval echo configure:2165: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2264: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cxx_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -2187,12 +2286,12 @@ if test $ac_cv_prog_cxx_works = no; then { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2191: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2290: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 cross_compiling=$ac_cv_prog_cxx_cross echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 -echo "configure:2196: checking whether we are using GNU C++" >&5 +echo "configure:2295: checking whether we are using GNU C++" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2201,7 +2300,7 @@ else yes; #endif EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:2205: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:2304: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gxx=yes else ac_cv_prog_gxx=no @@ -2220,7 +2319,7 @@ ac_test_CXXFLAGS="${CXXFLAGS+set}" ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS= echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 -echo "configure:2224: checking whether ${CXX-g++} accepts -g" >&5 +echo "configure:2323: checking whether ${CXX-g++} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2254,7 +2353,7 @@ fi fi fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:2258: checking how to run the C preprocessor" >&5 +echo "configure:2357: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -2269,13 +2368,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2279: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2378: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2286,13 +2385,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2296: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2395: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2303,13 +2402,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2313: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2412: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2336,7 +2435,7 @@ echo "$ac_t""$CPP" 1>&6 # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2340: checking for $ac_word" >&5 +echo "configure:2439: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2368,7 +2467,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2372: checking for $ac_word" >&5 +echo "configure:2471: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2409,7 +2508,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2413: checking for $ac_word" >&5 +echo "configure:2512: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2450,7 +2549,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2454: checking for $ac_word" >&5 +echo "configure:2553: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2491,7 +2590,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2495: checking for $ac_word" >&5 +echo "configure:2594: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2532,7 +2631,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2536: checking for $ac_word" >&5 +echo "configure:2635: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_WINDRES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2600,7 +2699,7 @@ else fi echo $ac_n "checking for gcc -pipe support""... $ac_c" 1>&6 -echo "configure:2604: checking for gcc -pipe support" >&5 +echo "configure:2703: checking for gcc -pipe support" >&5 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then echo '#include ' > dummy-hello.c echo 'int main() { printf("Hello World\n"); return 0; }' >> dummy-hello.c @@ -2615,14 +2714,14 @@ if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then _SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -pipe" cat > conftest.$ac_ext < int main() { printf("Hello World\n"); ; return 0; } EOF -if { (eval echo configure:2626: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2725: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* _res_gcc_pipe="yes" else @@ -2649,7 +2748,7 @@ fi if test "$GNU_CC"; then echo $ac_n "checking for visibility(hidden) attribute""... $ac_c" 1>&6 -echo "configure:2653: checking for visibility(hidden) attribute" >&5 +echo "configure:2752: checking for visibility(hidden) attribute" >&5 if eval "test \"`echo '$''{'ac_cv_visibility_hidden'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2673,7 +2772,7 @@ echo "$ac_t""$ac_cv_visibility_hidden" 1>&6 EOF echo $ac_n "checking for visibility pragma support""... $ac_c" 1>&6 -echo "configure:2677: checking for visibility pragma support" >&5 +echo "configure:2776: checking for visibility pragma support" >&5 if eval "test \"`echo '$''{'ac_cv_visibility_pragma'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2726,7 +2825,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2730: checking for $ac_word" >&5 +echo "configure:2829: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2976,17 +3075,17 @@ EOF DSO_LDOPTS='-brtl -bnortllib -bM:SRE -bnoentry -bexpall -blibpath:/usr/lib:/lib' ac_safe=`echo "sys/atomic_op.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/atomic_op.h""... $ac_c" 1>&6 -echo "configure:2980: checking for sys/atomic_op.h" >&5 +echo "configure:3079: checking for sys/atomic_op.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2990: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3089: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3143,7 +3242,7 @@ EOF _DEBUG_FLAGS='-gdwarf-2 -O0' MKSHLIB='$(CCC) $(DSO_LDOPTS) -o $@' echo $ac_n "checking for gethostbyaddr in -lbind""... $ac_c" 1>&6 -echo "configure:3147: checking for gethostbyaddr in -lbind" >&5 +echo "configure:3246: checking for gethostbyaddr in -lbind" >&5 ac_lib_var=`echo bind'_'gethostbyaddr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3151,7 +3250,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lbind $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3265: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3870,6 +3969,45 @@ EOF esac ;; +arm-android-eabi) + if test -z "$USE_NSPR_THREADS"; then + USE_PTHREADS=1 + IMPL_STRATEGY=_PTH + fi + cat >> confdefs.h <<\EOF +#define XP_UNIX 1 +EOF + + cat >> confdefs.h <<\EOF +#define _GNU_SOURCE 1 +EOF + + cat >> confdefs.h <<\EOF +#define HAVE_FCNTL_FILE_LOCKING 1 +EOF + + cat >> confdefs.h <<\EOF +#define LINUX 1 +EOF + + CFLAGS="$CFLAGS -Wall" + CXXFLAGS="$CXXFLAGS -Wall" + MDCPUCFG_H=_linux.cfg + PR_MD_CSRCS=linux.c + MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@' + DSO_CFLAGS=-fPIC + DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)' + _OPTIMIZE_FLAGS=-O2 + _DEBUG_FLAGS="-g -fno-inline" # most people on linux use gcc/gdb, and that + # combo is not yet good at debugging inlined + # functions (even when using DWARF2 as the + # debugging format) + COMPILER_TAG=_glibc + CPU_ARCH=arm + CPU_ARCH_TAG=_arm + OS_TARGET=Android + ;; + *-linux*|*-gnu*|*-k*bsd*-gnu) if test -z "$USE_NSPR_THREADS"; then USE_PTHREADS=1 @@ -4030,7 +4168,7 @@ EOF CFLAGS="$CFLAGS -W3 -nologo -GF -Gy" DLLFLAGS="$DLLFLAGS -OUT:\"\$@\"" - _DEBUG_FLAGS=-Z7 + _DEBUG_FLAGS=-Zi _OPTIMIZE_FLAGS=-O2 if test -z "$MOZ_OPTIMIZE"; then CFLAGS="$CFLAGS -Od" @@ -4051,19 +4189,16 @@ EOF DEFINES="$DEFINES -U_DEBUG" fi - if test -n "$MOZ_OPTIMIZE"; then - if test -n "$MOZ_DEBUG_SYMBOLS"; then - _OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Zi" + if test -n "$MOZ_DEBUG_SYMBOLS"; then + if test -n "$MOZ_OPTIMIZE"; then DLLFLAGS="$DLLFLAGS -DEBUG -OPT:REF" LDFLAGS="$LDFLAGS -DEBUG -OPT:REF" + else + DLLFLAGS="$DLLFLAGS -DEBUG" + LDFLAGS="$LDFLAGS -DEBUG" fi fi - if test -n "$MOZ_DEBUG"; then - DLLFLAGS="$DLLFLAGS -DEBUG" - LDFLAGS="$LDFLAGS -DEBUG" - fi - OS_DLLFLAGS="-nologo -DLL -SUBSYSTEM:WINDOWS" if test "$MSC_VER" -le "1200" -a -z "$MOZ_DEBUG_SYMBOLS"; then OS_DLLFLAGS="$OS_DLLFLAGS -PDB:NONE" @@ -4196,7 +4331,7 @@ EOF LIBPLC='$(dist_libdir)/plc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)' DLLFLAGS='-OUT:"$@"' - if test -n "$MOZ_DEBUG_SYMBOLS" || test -n "$MOZ_DEBUG"; then + if test -n "$MOZ_DEBUG_SYMBOLS"; then OS_LDFLAGS='-DEBUG -DEBUGTYPE:CV' OS_DLLFLAGS='-DEBUG -DEBUGTYPE:CV' DSO_LDOPTS='-DEBUG -DEBUGTYPE:CV' @@ -4476,17 +4611,17 @@ EOF _OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Olimit 4000" ac_safe=`echo "machine/builtins.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for machine/builtins.h""... $ac_c" 1>&6 -echo "configure:4480: checking for machine/builtins.h" >&5 +echo "configure:4615: checking for machine/builtins.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4490: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4625: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5135,7 +5270,7 @@ case $target in ;; *) echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:5139: checking for dlopen in -ldl" >&5 +echo "configure:5274: checking for dlopen in -ldl" >&5 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5143,7 +5278,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5293: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5171,17 +5306,17 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_safe=`echo "dlfcn.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for dlfcn.h""... $ac_c" 1>&6 -echo "configure:5175: checking for dlfcn.h" >&5 +echo "configure:5310: checking for dlfcn.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5185: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5320: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5214,13 +5349,13 @@ esac if test $ac_cv_prog_gcc = yes; then echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 -echo "configure:5218: checking whether ${CC-cc} needs -traditional" >&5 +echo "configure:5353: checking whether ${CC-cc} needs -traditional" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_pattern="Autoconf.*'x'" cat > conftest.$ac_ext < Autoconf TIOCGETP @@ -5238,7 +5373,7 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext < Autoconf TCGETA @@ -5262,12 +5397,12 @@ fi for ac_func in lchown strerror do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5266: checking for $ac_func" >&5 +echo "configure:5401: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5429: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5331,7 +5466,7 @@ hpux*) if test -z "$GNU_CC"; then echo $ac_n "checking for +Olit support""... $ac_c" 1>&6 -echo "configure:5335: checking for +Olit support" >&5 +echo "configure:5470: checking for +Olit support" >&5 if eval "test \"`echo '$''{'ac_cv_hpux_usable_olit_option'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5373,7 +5508,7 @@ wince*) *) echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6 -echo "configure:5377: checking for pthread_create in -lpthreads" >&5 +echo "configure:5512: checking for pthread_create in -lpthreads" >&5 echo " #include void *foo(void *v) { return v; } @@ -5395,7 +5530,7 @@ echo " echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 -echo "configure:5399: checking for pthread_create in -lpthread" >&5 +echo "configure:5534: checking for pthread_create in -lpthread" >&5 echo " #include void *foo(void *v) { return v; } @@ -5417,7 +5552,7 @@ echo " echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6 -echo "configure:5421: checking for pthread_create in -lc_r" >&5 +echo "configure:5556: checking for pthread_create in -lc_r" >&5 echo " #include void *foo(void *v) { return v; } @@ -5439,7 +5574,7 @@ echo " echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6 -echo "configure:5443: checking for pthread_create in -lc" >&5 +echo "configure:5578: checking for pthread_create in -lc" >&5 echo " #include void *foo(void *v) { return v; } @@ -5571,7 +5706,7 @@ if test -n "$USE_PTHREADS"; then rm -f conftest* ac_cv_have_dash_pthread=no echo $ac_n "checking whether ${CC-cc} accepts -pthread""... $ac_c" 1>&6 -echo "configure:5575: checking whether ${CC-cc} accepts -pthread" >&5 +echo "configure:5710: checking whether ${CC-cc} accepts -pthread" >&5 echo 'int main() { return 0; }' | cat > conftest.c ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1 if test $? -eq 0; then @@ -5594,7 +5729,7 @@ echo "configure:5575: checking whether ${CC-cc} accepts -pthread" >&5 ac_cv_have_dash_pthreads=no if test "$ac_cv_have_dash_pthread" = "no"; then echo $ac_n "checking whether ${CC-cc} accepts -pthreads""... $ac_c" 1>&6 -echo "configure:5598: checking whether ${CC-cc} accepts -pthreads" >&5 +echo "configure:5733: checking whether ${CC-cc} accepts -pthreads" >&5 echo 'int main() { return 0; }' | cat > conftest.c ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1 if test $? -eq 0; then @@ -5882,7 +6017,7 @@ if test -n "$MOZ_OPTIMIZE"; then CXXFLAGS="$CXXFLAGS $_OPTIMIZE_FLAGS" fi -if test -n "$MOZ_DEBUG_SYMBOLS" || test -n "$MOZ_DEBUG"; then +if test -n "$MOZ_DEBUG_SYMBOLS"; then CFLAGS="$CFLAGS $_DEBUG_FLAGS" CXXFLAGS="$CXXFLAGS $_DEBUG_FLAGS" fi @@ -6001,6 +6136,8 @@ esac + + @@ -6128,7 +6265,7 @@ s%\[%\\&%g s%\]%\\&%g s%\$%$$%g EOF -DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' ' | tr '\015' ' '` # Manually modified for MKS support. rm -f conftest.defs @@ -6239,6 +6376,8 @@ s%@GCC_USE_GNU_LD@%$GCC_USE_GNU_LD%g s%@MSC_VER@%$MSC_VER%g s%@CROSS_COMPILE@%$CROSS_COMPILE%g s%@MOZ_OPTIMIZE@%$MOZ_OPTIMIZE%g +s%@MOZ_DEBUG@%$MOZ_DEBUG%g +s%@MOZ_DEBUG_SYMBOLS@%$MOZ_DEBUG_SYMBOLS%g s%@USE_CPLUS@%$USE_CPLUS%g s%@USE_IPV6@%$USE_IPV6%g s%@USE_N32@%$USE_N32%g diff --git a/nsprpub/configure.in b/nsprpub/configure.in index 26eb220ed3e..e7603374e53 100644 --- a/nsprpub/configure.in +++ b/nsprpub/configure.in @@ -127,6 +127,71 @@ if test -n "$_WIN32_MSVC"; then SKIP_LIBRARY_CHECKS=1 fi +dnl ======================================================== +dnl = Android uses a very custom (hacky) toolchain; we need to do this +dnl = here, so that the compiler checks can succeed +dnl ======================================================== + +AC_ARG_WITH(android-ndk, +[ --with-android-ndk=DIR + location where the Android NDK can be found], + android_ndk=$withval) + +AC_ARG_WITH(android-toolchain, +[ --with-android-toolchain=DIR + location of the android toolchain, default NDK/build/prebuilt/HOST/arm-eabi-4.4.0], + android_toolchain=$withval) + +AC_ARG_WITH(android-platform, +[ --with-android-platform=DIR + location of platform dir, default NDK/build/platforms/android-5/arch-arm], + android_platform=$withval) + +if test "$target" = "arm-android-eabi" ; then + if test -z "$android_ndk" ; then + AC_MSG_ERROR([You must specify --with-android-ndk=/path/to/ndk when targeting Android.]) + fi + + if test -z "$android_toolchain" ; then + android_toolchain="$android_ndk"/build/prebuilt/`uname -s | tr "[[:upper:]]" "[[:lower:]]"`-x86/arm-eabi-4.4.0 + fi + + if test -z "$android_platform" ; then + android_platform="$android_ndk"/build/platforms/android-5/arch-arm + fi + + dnl set up compilers + AS="$android_toolchain"/bin/arm-eabi-as + CC="$android_toolchain"/bin/arm-eabi-gcc + CXX="$android_toolchain"/bin/arm-eabi-g++ + CPP="$android_toolchain"/bin/arm-eabi-cpp + LD="$android_toolchain"/bin/arm-eabi-ld + AR="$android_toolchain"/bin/arm-eabi-ar + RANLIB="$android_toolchain"/bin/arm-eabi-ranlib + STRIP="$android_toolchain"/bin/arm-eabi-strip + + CPPFLAGS="-I$android_platform/usr/include $CPPFLAGS" + CFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions -march=armv5te -mthumb-interwork $CFLAGS" + CXXFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fpic -fno-short-enums -fno-exceptions -march=armv5te -mthumb-interwork -mthumb $CXXFLAGS" + LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform $LDFLAGS" + + dnl prevent cross compile section from using these flags as host flags + if test -z "$HOST_CPPFLAGS" ; then + HOST_CPPFLAGS=" " + fi + if test -z "$HOST_CFLAGS" ; then + HOST_CFLAGS=" " + fi + if test -z "$HOST_CXXFLAGS" ; then + HOST_CXXFLAGS=" " + fi + if test -z "$HOST_LDFLAGS" ; then + HOST_LDFLAGS=" " + fi + + AC_DEFINE(ANDROID) +fi + dnl ======================================================== dnl = dnl = Check options that may affect the compiler @@ -181,29 +246,45 @@ AC_ARG_WITH(mozilla, fi]) AC_ARG_ENABLE(optimize, - [ --enable-optimize(=val) Enable code optimizations (val, ie. -O2) ], + [ --enable-optimize[=OPT] Enable code optimizations (ie. -O2) ], [ if test "$enableval" != "no"; then - MOZ_OPTIMIZE=1 - if test -n "$enableval" && test "$enableval" != "yes"; then - _OPTIMIZE_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'` + MOZ_OPTIMIZE=1 + if test -n "$enableval" -a "$enableval" != "yes"; then + _OPTIMIZE_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'` _SAVE_OPTIMIZE_FLAGS=$_OPTIMIZE_FLAGS - fi + fi else - MOZ_OPTIMIZE= - fi ]) + MOZ_OPTIMIZE= + fi ]) AC_ARG_ENABLE(debug, - [ --disable-debug Do not compile in debugging symbols - --enable-debug(=val) Enable debugging (debug flags val)], - [ if test "$enableval" = "no"; then - MOZ_DEBUG= - else - MOZ_DEBUG=1 - if test -n "$enableval" && test "$enableval" != "yes"; then - _DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'` - _SAVE_DEBUG_FLAGS=$_DEBUG_FLAGS - fi - fi]) + [ --enable-debug[=DBG] Enable debugging (using compiler flags DBG)], + [ if test "$enableval" != "no"; then + MOZ_DEBUG=1 + MOZ_DEBUG_SYMBOLS=1 + if test -n "$enableval" -a "$enableval" != "yes"; then + _DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'` + _SAVE_DEBUG_FLAGS=$_DEBUG_FLAGS + fi + else + MOZ_DEBUG= + fi ], + MOZ_DEBUG=) + +AC_ARG_ENABLE(debug-symbols, + [ --enable-debug-symbols[=DBG] Enable debugging symbols + (using compiler flags DBG)], + [ if test "$enableval" != "no"; then + MOZ_DEBUG_SYMBOLS=1 + if test -n "$enableval" -a "$enableval" != "yes"; then + if test -z "$_SAVE_DEBUG_FLAGS"; then + _DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'` + _SAVE_DEBUG_FLAGS=$_DEBUG_FLAGS + else + AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags]) + fi + fi + fi ]) AC_ARG_ENABLE(win32-target, [ --enable-win32-target=\$t @@ -1412,6 +1493,33 @@ tools are selected during the Xcode/Developer Tools installation.]) esac ;; +arm-android-eabi) + if test -z "$USE_NSPR_THREADS"; then + USE_PTHREADS=1 + IMPL_STRATEGY=_PTH + fi + AC_DEFINE(XP_UNIX) + AC_DEFINE(_GNU_SOURCE) + AC_DEFINE(HAVE_FCNTL_FILE_LOCKING) + AC_DEFINE(LINUX) + CFLAGS="$CFLAGS -Wall" + CXXFLAGS="$CXXFLAGS -Wall" + MDCPUCFG_H=_linux.cfg + PR_MD_CSRCS=linux.c + MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@' + DSO_CFLAGS=-fPIC + DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)' + _OPTIMIZE_FLAGS=-O2 + _DEBUG_FLAGS="-g -fno-inline" # most people on linux use gcc/gdb, and that + # combo is not yet good at debugging inlined + # functions (even when using DWARF2 as the + # debugging format) + COMPILER_TAG=_glibc + CPU_ARCH=arm + CPU_ARCH_TAG=_arm + OS_TARGET=Android + ;; + *-linux*|*-gnu*|*-k*bsd*-gnu) if test -z "$USE_NSPR_THREADS"; then USE_PTHREADS=1 @@ -1542,7 +1650,7 @@ tools are selected during the Xcode/Developer Tools installation.]) CFLAGS="$CFLAGS -W3 -nologo -GF -Gy" DLLFLAGS="$DLLFLAGS -OUT:\"\$@\"" - _DEBUG_FLAGS=-Z7 + _DEBUG_FLAGS=-Zi _OPTIMIZE_FLAGS=-O2 if test -z "$MOZ_OPTIMIZE"; then CFLAGS="$CFLAGS -Od" @@ -1560,19 +1668,16 @@ tools are selected during the Xcode/Developer Tools installation.]) DEFINES="$DEFINES -U_DEBUG" fi - if test -n "$MOZ_OPTIMIZE"; then - if test -n "$MOZ_DEBUG_SYMBOLS"; then - _OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Zi" + if test -n "$MOZ_DEBUG_SYMBOLS"; then + if test -n "$MOZ_OPTIMIZE"; then DLLFLAGS="$DLLFLAGS -DEBUG -OPT:REF" LDFLAGS="$LDFLAGS -DEBUG -OPT:REF" + else + DLLFLAGS="$DLLFLAGS -DEBUG" + LDFLAGS="$LDFLAGS -DEBUG" fi fi - if test -n "$MOZ_DEBUG"; then - DLLFLAGS="$DLLFLAGS -DEBUG" - LDFLAGS="$LDFLAGS -DEBUG" - fi - OS_DLLFLAGS="-nologo -DLL -SUBSYSTEM:WINDOWS" if test "$MSC_VER" -le "1200" -a -z "$MOZ_DEBUG_SYMBOLS"; then OS_DLLFLAGS="$OS_DLLFLAGS -PDB:NONE" @@ -1666,7 +1771,7 @@ tools are selected during the Xcode/Developer Tools installation.]) LIBPLC='$(dist_libdir)/plc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)' DLLFLAGS='-OUT:"$@"' - if test -n "$MOZ_DEBUG_SYMBOLS" || test -n "$MOZ_DEBUG"; then + if test -n "$MOZ_DEBUG_SYMBOLS"; then OS_LDFLAGS='-DEBUG -DEBUGTYPE:CV' OS_DLLFLAGS='-DEBUG -DEBUGTYPE:CV' DSO_LDOPTS='-DEBUG -DEBUGTYPE:CV' @@ -2726,7 +2831,7 @@ if test -n "$MOZ_OPTIMIZE"; then CXXFLAGS="$CXXFLAGS $_OPTIMIZE_FLAGS" fi -if test -n "$MOZ_DEBUG_SYMBOLS" || test -n "$MOZ_DEBUG"; then +if test -n "$MOZ_DEBUG_SYMBOLS"; then CFLAGS="$CFLAGS $_DEBUG_FLAGS" CXXFLAGS="$CXXFLAGS $_DEBUG_FLAGS" fi @@ -2775,6 +2880,8 @@ AC_SUBST(MSC_VER) AC_SUBST(CROSS_COMPILE) AC_SUBST(MOZ_OPTIMIZE) +AC_SUBST(MOZ_DEBUG) +AC_SUBST(MOZ_DEBUG_SYMBOLS) AC_SUBST(USE_CPLUS) AC_SUBST(USE_IPV6) diff --git a/nsprpub/lib/ds/plarena.c b/nsprpub/lib/ds/plarena.c index 2d274588474..a6a78ae3701 100644 --- a/nsprpub/lib/ds/plarena.c +++ b/nsprpub/lib/ds/plarena.c @@ -256,6 +256,21 @@ PR_IMPLEMENT(void *) PL_ArenaGrow( return newp; } +static void ClearArenaList(PLArena *a, PRInt32 pattern) +{ + + for (; a; a = a->next) { + PR_ASSERT(a->base <= a->avail && a->avail <= a->limit); + a->avail = a->base; + PL_CLEAR_UNUSED_PATTERN(a, pattern); + } +} + +PR_IMPLEMENT(void) PL_ClearArenaPool(PLArenaPool *pool, PRInt32 pattern) +{ + ClearArenaList(pool->first.next, pattern); +} + /* * Free tail arenas linked after head, which may not be the true list head. * Reset pool->current to point to head in case it pointed at a tail arena. @@ -270,12 +285,7 @@ static void FreeArenaList(PLArenaPool *pool, PLArena *head, PRBool reallyFree) return; #ifdef DEBUG - do { - PR_ASSERT(a->base <= a->avail && a->avail <= a->limit); - a->avail = a->base; - PL_CLEAR_UNUSED(a); - } while ((a = a->next) != 0); - a = *ap; + ClearArenaList(a, PL_FREE_PATTERN); #endif if (reallyFree) { diff --git a/nsprpub/lib/ds/plarena.h b/nsprpub/lib/ds/plarena.h index 38f3e3990a5..d609404606e 100644 --- a/nsprpub/lib/ds/plarena.h +++ b/nsprpub/lib/ds/plarena.h @@ -138,11 +138,12 @@ struct PLArenaPool { #define PL_ARENA_MARK(pool) ((void *) (pool)->current->avail) #define PR_UPTRDIFF(p,q) ((PRUword)(p) - (PRUword)(q)) +#define PL_CLEAR_UNUSED_PATTERN(a, pattern) \ + (PR_ASSERT((a)->avail <= (a)->limit), \ + memset((void*)(a)->avail, (pattern), (a)->limit - (a)->avail)) #ifdef DEBUG #define PL_FREE_PATTERN 0xDA -#define PL_CLEAR_UNUSED(a) (PR_ASSERT((a)->avail <= (a)->limit), \ - memset((void*)(a)->avail, PL_FREE_PATTERN, \ - (a)->limit - (a)->avail)) +#define PL_CLEAR_UNUSED(a) PL_CLEAR_UNUSED_PATTERN((a), PL_FREE_PATTERN) #define PL_CLEAR_ARENA(a) memset((void*)(a), PL_FREE_PATTERN, \ (a)->limit - (PRUword)(a)) #else diff --git a/nsprpub/lib/ds/plarenas.h b/nsprpub/lib/ds/plarenas.h index e3eca358b48..778d3af5dec 100644 --- a/nsprpub/lib/ds/plarenas.h +++ b/nsprpub/lib/ds/plarenas.h @@ -108,6 +108,11 @@ PR_EXTERN(void *) PL_ArenaGrow( PR_EXTERN(void) PL_ArenaRelease(PLArenaPool *pool, char *mark); +/* +** memset contents of all arenas in pool to pattern +*/ +PR_EXTERN(void) PL_ClearArenaPool(PLArenaPool *pool, PRInt32 pattern); + PR_END_EXTERN_C #endif /* defined(PLARENAS_H) */ diff --git a/nsprpub/lib/ds/plds.def b/nsprpub/lib/ds/plds.def index d72796a4c21..a80e2bca484 100644 --- a/nsprpub/lib/ds/plds.def +++ b/nsprpub/lib/ds/plds.def @@ -81,3 +81,8 @@ libVersionPoint; PL_HashTableLookupConst; PL_HashTableRawLookupConst; ;+} NSPR_4.0; +;+ +;+NSPR_4.8.5 { +;+ global: +PL_ClearArenaPool; +;+} NSPR_4.1; diff --git a/nsprpub/pr/include/md/_linux.h b/nsprpub/pr/include/md/_linux.h index a0ab07d35f6..a1251920911 100644 --- a/nsprpub/pr/include/md/_linux.h +++ b/nsprpub/pr/include/md/_linux.h @@ -100,6 +100,9 @@ */ #define HAVE_DLL #define USE_DLFCN +#if defined(ANDROID) +#define NO_DLOPEN_NULL +#endif #ifdef __FreeBSD_kernel__ #define _PR_HAVE_SOCKADDR_LEN @@ -277,8 +280,10 @@ static inline PRInt32 _MD_ATOMIC_SET(PRInt32 *ptr, PRInt32 nv) #define _PR_HAVE_GETADDRINFO #define _PR_INET6_PROBE #endif +#ifndef ANDROID #define _PR_HAVE_SYSV_SEMAPHORES #define PR_HAVE_SYSV_NAMED_SHARED_MEMORY +#endif #if (__GLIBC__ >= 2) && defined(_PR_PTHREADS) #define _PR_HAVE_GETHOST_R #define _PR_HAVE_GETHOST_R_INT diff --git a/nsprpub/pr/include/prbit.h b/nsprpub/pr/include/prbit.h index 1f4fc843e40..1253ccad3cb 100644 --- a/nsprpub/pr/include/prbit.h +++ b/nsprpub/pr/include/prbit.h @@ -41,6 +41,33 @@ #include "prtypes.h" PR_BEGIN_EXTERN_C +/* replace compare/jump/add/shift sequence with x86 BSF/BSR instruction */ +#if defined(_WIN32) && (_MSC_VER >= 1300) && (defined(_M_IX86) || defined(_M_AMD64)) + unsigned char _BitScanForward(unsigned long * Index, unsigned long Mask); + unsigned char _BitScanReverse(unsigned long * Index, unsigned long Mask); +# pragma intrinsic(_BitScanForward,_BitScanReverse) + __forceinline static int __prBitScanForward32(unsigned int val) + { + unsigned long idx; + _BitScanForward(&idx, (unsigned long)val); + return( (int)idx ); + } + __forceinline static int __prBitScanReverse32(unsigned int val) + { + unsigned long idx; + _BitScanReverse(&idx, (unsigned long)val); + return( (int)(31-idx) ); + } +# define pr_bitscan_ctz32(val) __prBitScanForward32(val) +# define pr_bitscan_clz32(val) __prBitScanReverse32(val) +# define PR_HAVE_BUILTIN_BITSCAN32 +#elif ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) && \ + (defined(__i386__) || defined(__x86_64__)) +# define pr_bitscan_ctz32(val) __builtin_ctz(val) +# define pr_bitscan_clz32(val) __builtin_clz(val) +# define PR_HAVE_BUILTIN_BITSCAN32 +#endif /* MSVC || GCC */ + /* ** A prbitmap_t is a long integer that can be used for bitmaps */ @@ -67,6 +94,13 @@ NSPR_API(PRIntn) PR_FloorLog2(PRUint32 i); ** Macro version of PR_CeilingLog2: Compute the log of the least power of ** 2 greater than or equal to _n. The result is returned in _log2. */ +#ifdef PR_HAVE_BUILTIN_BITSCAN32 +#define PR_CEILING_LOG2(_log2,_n) \ + PR_BEGIN_MACRO \ + PRUint32 j_ = (PRUint32)(_n); \ + (_log2) = (j_ <= 1 ? 0 : 32 - pr_bitscan_clz32(j_ - 1)); \ + PR_END_MACRO +#else #define PR_CEILING_LOG2(_log2,_n) \ PR_BEGIN_MACRO \ PRUint32 j_ = (PRUint32)(_n); \ @@ -84,6 +118,7 @@ NSPR_API(PRIntn) PR_FloorLog2(PRUint32 i); if ((j_) >> 1) \ (_log2) += 1; \ PR_END_MACRO +#endif /* PR_HAVE_BUILTIN_BITSCAN32 */ /* ** Macro version of PR_FloorLog2: Compute the log of the greatest power of @@ -91,6 +126,13 @@ NSPR_API(PRIntn) PR_FloorLog2(PRUint32 i); ** ** This is equivalent to finding the highest set bit in the word. */ +#ifdef PR_HAVE_BUILTIN_BITSCAN32 +#define PR_FLOOR_LOG2(_log2,_n) \ + PR_BEGIN_MACRO \ + PRUint32 j_ = (PRUint32)(_n); \ + (_log2) = 31 - pr_bitscan_clz32((j_) | 1); \ + PR_END_MACRO +#else #define PR_FLOOR_LOG2(_log2,_n) \ PR_BEGIN_MACRO \ PRUint32 j_ = (PRUint32)(_n); \ @@ -106,6 +148,7 @@ NSPR_API(PRIntn) PR_FloorLog2(PRUint32 i); if ((j_) >> 1) \ (_log2) += 1; \ PR_END_MACRO +#endif /* PR_HAVE_BUILTIN_BITSCAN32 */ /* ** Macros for rotate left and right. The argument 'a' must be an unsigned diff --git a/nsprpub/pr/include/prlog.h b/nsprpub/pr/include/prlog.h index c5f6c62275d..d2ca5d71526 100644 --- a/nsprpub/pr/include/prlog.h +++ b/nsprpub/pr/include/prlog.h @@ -248,14 +248,6 @@ NSPR_API(void) PR_Assert(const char *s, const char *file, PRIntn ln); #endif /* defined(DEBUG) || defined(FORCE_PR_ASSERT) */ -/* -** Compile-time assert. "condition" must be a constant expression. -** The macro can be used only in places where an "extern" declaration is -** allowed. -*/ -#define PR_STATIC_ASSERT(condition) \ - extern void pr_static_assert(int arg[(condition) ? 1 : -1]) - PR_END_EXTERN_C #endif /* prlog_h___ */ diff --git a/nsprpub/pr/include/prtypes.h b/nsprpub/pr/include/prtypes.h index dd66d0f5950..fcebc44517a 100644 --- a/nsprpub/pr/include/prtypes.h +++ b/nsprpub/pr/include/prtypes.h @@ -519,6 +519,14 @@ typedef unsigned long PRUword; /********* ????????????? End Fix me ?????????????????????????????? *****/ #endif /* NO_NSPR_10_SUPPORT */ +/* +** Compile-time assert. "condition" must be a constant expression. +** The macro can be used only in places where an "extern" declaration is +** allowed. +*/ +#define PR_STATIC_ASSERT(condition) \ + extern void pr_static_assert(int arg[(condition) ? 1 : -1]) + PR_END_EXTERN_C #endif /* prtypes_h___ */ diff --git a/nsprpub/pr/src/linking/prlink.c b/nsprpub/pr/src/linking/prlink.c index a68e464edb0..7cc55c4e847 100644 --- a/nsprpub/pr/src/linking/prlink.c +++ b/nsprpub/pr/src/linking/prlink.c @@ -198,7 +198,7 @@ void _PR_InitLinker(void) #elif defined(XP_UNIX) #ifdef HAVE_DLL -#ifdef USE_DLFCN +#if defined(USE_DLFCN) && !defined(NO_DLOPEN_NULL) h = dlopen(0, RTLD_LAZY); if (!h) { char *error; @@ -214,8 +214,8 @@ void _PR_InitLinker(void) #elif defined(USE_HPSHL) h = NULL; /* don't abort with this NULL */ -#elif defined(USE_MACH_DYLD) - h = NULL; /* XXXX toshok */ +#elif defined(USE_MACH_DYLD) || defined(NO_DLOPEN_NULL) + h = NULL; /* XXXX toshok */ /* XXXX vlad */ #else #error no dll strategy #endif /* USE_DLFCN */ @@ -1354,7 +1354,7 @@ PR_LoadStaticLibrary(const char *name, const PRStaticLinkTable *slt) PR_IMPLEMENT(char *) PR_GetLibraryFilePathname(const char *name, PRFuncPtr addr) { -#if defined(USE_DLFCN) && (defined(SOLARIS) || defined(FREEBSD) \ +#if defined(USE_DLFCN) && !defined(ANDROID) && (defined(SOLARIS) || defined(FREEBSD) \ || defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \ || defined(DARWIN)) Dl_info dli; diff --git a/nsprpub/pr/src/malloc/prmem.c b/nsprpub/pr/src/malloc/prmem.c index 73fa59bcb73..24a924dca76 100644 --- a/nsprpub/pr/src/malloc/prmem.c +++ b/nsprpub/pr/src/malloc/prmem.c @@ -117,7 +117,7 @@ _PR_DestroyZones(void) #ifdef HAVE_DLL -#ifdef USE_DLFCN +#if defined(USE_DLFCN) && !defined(NO_DLOPEN_NULL) #include @@ -150,7 +150,7 @@ pr_FindSymbolInProg(const char *name) return sym; } -#elif defined(USE_MACH_DYLD) +#elif defined(USE_MACH_DYLD) || defined(NO_DLOPEN_NULL) static void * pr_FindSymbolInProg(const char *name) diff --git a/nsprpub/pr/src/misc/prdtoa.c b/nsprpub/pr/src/misc/prdtoa.c index e1507dfabdb..4f26b204f29 100644 --- a/nsprpub/pr/src/misc/prdtoa.c +++ b/nsprpub/pr/src/misc/prdtoa.c @@ -46,6 +46,7 @@ #endif #include "primpl.h" +#include "prbit.h" #define MULTIPLE_THREADS #define ACQUIRE_DTOA_LOCK(n) PR_Lock(dtoa_lock[n]) @@ -742,6 +743,9 @@ hi0bits (register ULong x) #endif { +#ifdef PR_HAVE_BUILTIN_BITSCAN32 + return( (!x) ? 32 : pr_bitscan_clz32(x) ); +#else register int k = 0; if (!(x & 0xffff0000)) { @@ -766,6 +770,7 @@ hi0bits return 32; } return k; +#endif /* PR_HAVE_BUILTIN_BITSCAN32 */ } static int @@ -776,6 +781,15 @@ lo0bits (ULong *y) #endif { +#ifdef PR_HAVE_BUILTIN_BITSCAN32 + int k; + ULong x = *y; + + if (x>1) + *y = ( x >> (k = pr_bitscan_ctz32(x)) ); + else + k = ((x ^ 1) << 5); +#else register int k; register ULong x = *y; @@ -813,6 +827,7 @@ lo0bits return 32; } *y = x; +#endif /* PR_HAVE_BUILTIN_BITSCAN32 */ return k; } diff --git a/nsprpub/pr/src/misc/prlog2.c b/nsprpub/pr/src/misc/prlog2.c index d1a688ad70c..979be957c61 100644 --- a/nsprpub/pr/src/misc/prlog2.c +++ b/nsprpub/pr/src/misc/prlog2.c @@ -42,20 +42,8 @@ */ PR_IMPLEMENT(PRIntn) PR_CeilingLog2(PRUint32 n) { - PRIntn log2 = 0; - - if (n & (n-1)) - log2++; - if (n >> 16) - log2 += 16, n >>= 16; - if (n >> 8) - log2 += 8, n >>= 8; - if (n >> 4) - log2 += 4, n >>= 4; - if (n >> 2) - log2 += 2, n >>= 2; - if (n >> 1) - log2++; + PRIntn log2; + PR_CEILING_LOG2(log2, n); return log2; } @@ -65,17 +53,7 @@ PR_IMPLEMENT(PRIntn) PR_CeilingLog2(PRUint32 n) */ PR_IMPLEMENT(PRIntn) PR_FloorLog2(PRUint32 n) { - PRIntn log2 = 0; - - if (n >> 16) - log2 += 16, n >>= 16; - if (n >> 8) - log2 += 8, n >>= 8; - if (n >> 4) - log2 += 4, n >>= 4; - if (n >> 2) - log2 += 2, n >>= 2; - if (n >> 1) - log2++; + PRIntn log2; + PR_FLOOR_LOG2(log2, n); return log2; } diff --git a/nsprpub/pr/src/misc/prnetdb.c b/nsprpub/pr/src/misc/prnetdb.c index 8a2a00c4fb3..355f3c8f627 100644 --- a/nsprpub/pr/src/misc/prnetdb.c +++ b/nsprpub/pr/src/misc/prnetdb.c @@ -95,7 +95,8 @@ PRLock *_pr_dnsLock = NULL; #if defined(SOLARIS) || (defined(BSDI) && defined(_REENTRANT)) \ || (defined(LINUX) && defined(_REENTRANT) \ - && !(defined(__GLIBC__) && __GLIBC__ >= 2)) + && !(defined(__GLIBC__) && __GLIBC__ >= 2)) \ + && !defined(ANDROID) #define _PR_HAVE_GETPROTO_R #define _PR_HAVE_GETPROTO_R_POINTER #endif @@ -1185,6 +1186,16 @@ PR_IMPLEMENT(PRStatus) PR_GetHostByAddr( * any usable implementation. */ +#if defined(ANDROID) +/* Android's Bionic libc system includes prototypes for these in netdb.h, + * but doesn't actually include implementations. It uses the 5-arg form, + * so these functions end up not matching the prototype. So just rename + * them if not found. + */ +#define getprotobyname_r _pr_getprotobyname_r +#define getprotobynumber_r _pr_getprotobynumber_r +#endif + static struct protoent *getprotobyname_r(const char* name) { return getprotobyname(name); diff --git a/nsprpub/pr/src/misc/prtime.c b/nsprpub/pr/src/misc/prtime.c index dee268cba94..0a6096413fd 100644 --- a/nsprpub/pr/src/misc/prtime.c +++ b/nsprpub/pr/src/misc/prtime.c @@ -1728,7 +1728,7 @@ PR_FormatTime(char *buf, int buflen, const char *fmt, const PRExplodedTime *tm) #if defined(SUNOS4) || (__GLIBC__ >= 2) || defined(XP_BEOS) \ || defined(NETBSD) || defined(OPENBSD) || defined(FREEBSD) \ - || defined(DARWIN) || defined(SYMBIAN) + || defined(DARWIN) || defined(SYMBIAN) || defined(ANDROID) a.tm_zone = NULL; a.tm_gmtoff = tm->tm_params.tp_gmt_offset + tm->tm_params.tp_dst_offset; diff --git a/nsprpub/pr/src/pthreads/ptsynch.c b/nsprpub/pr/src/pthreads/ptsynch.c index 8b141cd1471..3f3b2720136 100644 --- a/nsprpub/pr/src/pthreads/ptsynch.c +++ b/nsprpub/pr/src/pthreads/ptsynch.c @@ -196,7 +196,7 @@ PR_IMPLEMENT(void) PR_DestroyLock(PRLock *lock) memset(lock, 0xaf, sizeof(PRLock)); pt_debug.locks_destroyed += 1; #endif - PR_DELETE(lock); + PR_Free(lock); } /* PR_DestroyLock */ PR_IMPLEMENT(void) PR_Lock(PRLock *lock) @@ -374,7 +374,7 @@ PR_IMPLEMENT(void) PR_DestroyCondVar(PRCondVar *cvar) memset(cvar, 0xaf, sizeof(PRCondVar)); pt_debug.cvars_destroyed += 1; #endif - PR_DELETE(cvar); + PR_Free(cvar); } } /* PR_DestroyCondVar */ @@ -463,6 +463,7 @@ PR_IMPLEMENT(PRMonitor*) PR_NewMonitor(void) { PRMonitor *mon; PRCondVar *cvar; + int rv; if (!_pr_initialized) _PR_ImplicitInitialization(); @@ -473,25 +474,37 @@ PR_IMPLEMENT(PRMonitor*) PR_NewMonitor(void) return NULL; } mon = PR_NEWZAP(PRMonitor); - if (mon != NULL) + if (mon == NULL) { - int rv; - rv = _PT_PTHREAD_MUTEX_INIT(mon->lock.mutex, _pt_mattr); - PR_ASSERT(0 == rv); + PR_Free(cvar); + PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0); + return NULL; + } - _PT_PTHREAD_INVALIDATE_THR_HANDLE(mon->owner); + rv = _PT_PTHREAD_MUTEX_INIT(mon->lock.mutex, _pt_mattr); + PR_ASSERT(0 == rv); + if (0 != rv) + { + PR_Free(mon); + PR_Free(cvar); + PR_SetError(PR_OPERATION_NOT_SUPPORTED_ERROR, 0); + return NULL; + } - mon->cvar = cvar; - rv = _PT_PTHREAD_COND_INIT(mon->cvar->cv, _pt_cvar_attr); - PR_ASSERT(0 == rv); - mon->entryCount = 0; - mon->cvar->lock = &mon->lock; - if (0 != rv) - { - PR_DELETE(mon); - PR_DELETE(cvar); - mon = NULL; - } + _PT_PTHREAD_INVALIDATE_THR_HANDLE(mon->owner); + + mon->cvar = cvar; + rv = _PT_PTHREAD_COND_INIT(mon->cvar->cv, _pt_cvar_attr); + PR_ASSERT(0 == rv); + mon->entryCount = 0; + mon->cvar->lock = &mon->lock; + if (0 != rv) + { + pthread_mutex_destroy(&mon->lock.mutex); + PR_Free(mon); + PR_Free(cvar); + PR_SetError(PR_OPERATION_NOT_SUPPORTED_ERROR, 0); + return NULL; } return mon; } /* PR_NewMonitor */ @@ -513,7 +526,7 @@ PR_IMPLEMENT(void) PR_DestroyMonitor(PRMonitor *mon) #if defined(DEBUG) memset(mon, 0xaf, sizeof(PRMonitor)); #endif - PR_DELETE(mon); + PR_Free(mon); } /* PR_DestroyMonitor */ @@ -674,7 +687,7 @@ PR_IMPLEMENT(void) PR_DestroySem(PRSemaphore *semaphore) "PR_DestroySem", "locks & condition variables"); PR_DestroyLock(semaphore->cvar->lock); PR_DestroyCondVar(semaphore->cvar); - PR_DELETE(semaphore); + PR_Free(semaphore); } /* PR_DestroySem */ PR_IMPLEMENT(PRSemaphore*) PR_NewSem(PRUintn value) @@ -700,7 +713,7 @@ PR_IMPLEMENT(PRSemaphore*) PR_NewSem(PRUintn value) } PR_DestroyLock(lock); } - PR_DELETE(semaphore); + PR_Free(semaphore); } return NULL; } @@ -757,7 +770,7 @@ PR_IMPLEMENT(PRSem *) PR_OpenSemaphore( if ((sem_t *) -1 == sem->sem) { _PR_MD_MAP_DEFAULT_ERROR(errno); - PR_DELETE(sem); + PR_Free(sem); return NULL; } return sem; @@ -796,7 +809,7 @@ PR_IMPLEMENT(PRStatus) PR_CloseSemaphore(PRSem *sem) _PR_MD_MAP_DEFAULT_ERROR(errno); return PR_FAILURE; } - PR_DELETE(sem); + PR_Free(sem); return PR_SUCCESS; } @@ -907,7 +920,7 @@ PR_IMPLEMENT(PRSem *) PR_OpenSemaphore( if (semctl(sem->semid, 0, SETVAL, arg) == -1) { _PR_MD_MAP_DEFAULT_ERROR(errno); - PR_DELETE(sem); + PR_Free(sem); return NULL; } /* call semop to set sem_otime to nonzero */ @@ -917,7 +930,7 @@ PR_IMPLEMENT(PRSem *) PR_OpenSemaphore( if (semop(sem->semid, &sop, 1) == -1) { _PR_MD_MAP_DEFAULT_ERROR(errno); - PR_DELETE(sem); + PR_Free(sem); return NULL; } return sem; @@ -926,7 +939,7 @@ PR_IMPLEMENT(PRSem *) PR_OpenSemaphore( if (errno != EEXIST || flags & PR_SEM_EXCL) { _PR_MD_MAP_DEFAULT_ERROR(errno); - PR_DELETE(sem); + PR_Free(sem); return NULL; } } @@ -935,7 +948,7 @@ PR_IMPLEMENT(PRSem *) PR_OpenSemaphore( if (sem->semid == -1) { _PR_MD_MAP_DEFAULT_ERROR(errno); - PR_DELETE(sem); + PR_Free(sem); return NULL; } for (i = 0; i < MAX_TRIES; i++) @@ -948,7 +961,7 @@ PR_IMPLEMENT(PRSem *) PR_OpenSemaphore( if (i == MAX_TRIES) { PR_SetError(PR_IO_TIMEOUT_ERROR, 0); - PR_DELETE(sem); + PR_Free(sem); return NULL; } return sem; @@ -986,7 +999,7 @@ PR_IMPLEMENT(PRStatus) PR_PostSemaphore(PRSem *sem) PR_IMPLEMENT(PRStatus) PR_CloseSemaphore(PRSem *sem) { - PR_DELETE(sem); + PR_Free(sem); return PR_SUCCESS; } @@ -1112,7 +1125,7 @@ PR_IMPLEMENT(void) PRP_DestroyNakedCondVar(PRCondVar *cvar) #if defined(DEBUG) memset(cvar, 0xaf, sizeof(PRCondVar)); #endif - PR_DELETE(cvar); + PR_Free(cvar); } /* PRP_DestroyNakedCondVar */ PR_IMPLEMENT(PRStatus) PRP_NakedWait( diff --git a/nsprpub/pr/tests/Makefile.in b/nsprpub/pr/tests/Makefile.in index 98175f97b23..695ce684168 100644 --- a/nsprpub/pr/tests/Makefile.in +++ b/nsprpub/pr/tests/Makefile.in @@ -450,6 +450,11 @@ LIBPTHREAD = -ldce endif endif +ifeq ($(OS_TARGET),Android) +LDOPTS=$(OS_LDFLAGS) +LIBPTHREAD= +XCFLAGS=${OS_CFLAGS} +endif ##################################################### #