bug 577635 - android_stub.h broken for android platform version 8 r=khuey
authorBrad Lassey <blassey@mozilla.com>
Fri, 16 Jul 2010 12:11:09 -0400
changeset 47826 0f1fddce41e12d15d5c08a47b5cabf23d3201e55
parent 47825 8e58befb03a5be475c766b99d3c59ffd3d560c95
child 47827 525cbac0423c60470e3bb8959f961a9680008258
push idunknown
push userunknown
push dateunknown
reviewerskhuey
bugs577635
milestone2.0b2pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 577635 - android_stub.h broken for android platform version 8 r=khuey
configure.in
js/src/configure.in
security/manager/android_stub.h
--- a/configure.in
+++ b/configure.in
@@ -249,20 +249,28 @@ MOZ_ARG_WITH_STRING(android-ndk,
                           location where the Android NDK can be found],
     android_ndk=$withval)
 
 MOZ_ARG_WITH_STRING(android-toolchain,
 [  --with-android-toolchain=DIR
                           location of the android toolchain, default NDK/build/prebuilt/HOST/arm-eabi-4.4.0],
     android_toolchain=$withval)
 
-MOZ_ARG_WITH_STRING(android-platform,
-[  --with-android-platform=DIR
-                          location of NDK platform dir, default NDK/build/platforms/android-5/arch-arm],
-    android_platform=$withval)
+
+MOZ_ARG_WITH_STRING(android-version,
+[  --with-android-version=VER
+                          android platform version, default 5],
+    android_version=$withval,
+    android_version=5)
+
+MOZ_ARG_WITH_STRING(android-arch,
+[  --with-android-arch=ARCH
+                          android platform architecture, default arm],
+    android_arch=$withval,
+    android_arch=arm)
 
 MOZ_ARG_WITH_STRING(android-sdk,
 [  --with-android-sdk=DIR
                           location where the Android SDK can be found (base directory, e.g. .../android/platforms/android-6)],
     android_sdk=$withval)
 
 MOZ_ARG_WITH_STRING(android-tools,
 [  --with-android-tools=DIR
@@ -282,28 +290,28 @@ if test "$target" = "arm-android-eabi" ;
         AC_MSG_ERROR([You must specify --with-android-tools=/path/to/sdk/tools 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
+       android_platform="$android_ndk"/build/platforms/android-"$android_version"/arch-"$android_arch"
     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
+    if test -z "$AS"; then AS="$android_toolchain"/bin/arm-eabi-as; fi
+    if test -z "$CC"; then CC="$android_toolchain"/bin/arm-eabi-gcc; fi
+    if test -z "$CXX"; then CXX="$android_toolchain"/bin/arm-eabi-g++; fi
+    if test -z "$CPP"; then CPP="$android_toolchain"/bin/arm-eabi-cpp; fi
+    if test -z "$LD"; then LD="$android_toolchain"/bin/arm-eabi-ld; fi
+    if test -z "$AR"; then AR="$android_toolchain"/bin/arm-eabi-ar; fi
+    if test -z "$RANLIB"; then RANLIB="$android_toolchain"/bin/arm-eabi-ranlib; fi
+    if test -z "$STRIP"; then STRIP="$android_toolchain"/bin/arm-eabi-strip; fi
 
     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 -fno-short-enums -fno-exceptions -march=armv5te -mthumb-interwork $CXXFLAGS"
 
     dnl Add -llog by default, since we use it all over the place.
     dnl Add --allow-shlib-undefined, because libGLESv2 links to an
     dnl undefined symbol (present on the hardware, just not in the
@@ -326,16 +334,17 @@ if test "$target" = "arm-android-eabi" ;
 
     ANDROID_NDK="${android_ndk}"
     ANDROID_TOOLCHAIN="{android_toolchain}"
     ANDROID_PLATFORM="{android_platform}"
     ANDROID_SDK="${android_sdk}"
     ANDROID_TOOLS="${android_tools}"
 
     AC_DEFINE(ANDROID)
+    AC_DEFINE_UNQUOTED(ANDROID_VERSION, $android_version)
     CROSS_COMPILE=1
     MOZ_CHROME_FILE_FORMAT=omni
 fi
 
 AC_SUBST(ANDROID_NDK)
 AC_SUBST(ANDROID_TOOLCHAIN)
 AC_SUBST(ANDROID_PLATFORM)
 AC_SUBST(ANDROID_SDK)
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -215,43 +215,50 @@ MOZ_ARG_WITH_STRING(android-ndk,
 [  --with-android-ndk=DIR  location where the Android NDK can be found],
     android_ndk=$withval)
 
 MOZ_ARG_WITH_STRING(android-toolchain,
 [  --with-android-toolchain=DIR
                           location of the android toolchain, default NDK/build/prebuilt/HOST/arm-eabi-4.4.0],
     android_toolchain=$withval)
 
-MOZ_ARG_WITH_STRING(android-platform,
-[  --with-android-platform=DIR
-                          location of platform dir, default NDK/build/platforms/android-5/arch-arm],
-    android_platform=$withval)
+
+MOZ_ARG_WITH_STRING(android-version,
+[  --with-android-version=VER
+                          android platform version, default 5],
+    android_version=$withval,
+    android_version=5)
+
+MOZ_ARG_WITH_STRING(android-arch,
+[  --with-android-arch=ARCH
+                          android platform architecture, default arm],
+    android_arch=$withval,
+    android_arch=arm)
 
 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
+       android_platform="$android_ndk"/build/platforms/android-"$android_version"/arch-"$android_arch"
     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
+    if test -z "$AS"; then AS="$android_toolchain"/bin/arm-eabi-as; fi
+    if test -z "$CC"; then CC="$android_toolchain"/bin/arm-eabi-gcc; fi
+    if test -z "$CXX"; then CXX="$android_toolchain"/bin/arm-eabi-g++; fi
+    if test -z "$CPP"; then CPP="$android_toolchain"/bin/arm-eabi-cpp; fi
+    if test -z "$LD"; then LD="$android_toolchain"/bin/arm-eabi-ld; fi
+    if test -z "$AR"; then AR="$android_toolchain"/bin/arm-eabi-ar; fi
+    if test -z "$RANLIB"; then RANLIB="$android_toolchain"/bin/arm-eabi-ranlib; fi
+    if test -z "$STRIP"; then STRIP="$android_toolchain"/bin/arm-eabi-strip; fi
 
     CPPFLAGS="-I$android_platform/usr/include $CPPFLAGS"
     CFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions $CFLAGS"
     CXXFLAGS="-mandroid -std=gnu++0x -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions $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
@@ -269,16 +276,17 @@ if test "$target" = "arm-android-eabi" ;
 
     # save these for libffi's subconfigure,
     # which doesn't know how to figure this stuff out on its own
     ANDROID_CFLAGS="$CFLAGS"
     ANDROID_CPPFLAGS="$CPPFLAGS"
     ANDROID_LDFLAGS="$LDFLAGS"
 
     AC_DEFINE(ANDROID)
+    AC_DEFINE_UNQUOTED(ANDROID_VERSION, $android_version)
     AC_DEFINE(FORCE_LITTLE_ENDIAN)
 fi
 
 dnl ========================================================
 dnl Checks for compilers.
 dnl ========================================================
 
 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
--- a/security/manager/android_stub.h
+++ b/security/manager/android_stub.h
@@ -35,23 +35,26 @@
  * ***** END LICENSE BLOCK ***** */
 
 /* This file allows NSS to build by stubbing out
  * features that aren't provided by Android/Bionic */
 
 #ifndef ANDROID_STUB_H
 #define ANDROID_STUB_H
 
+#include "dlfcn.h"
+#if ANDROID_VERSION >= 8
 /* because dladdr isn't supported in android 2.1 and older.
  * however, it exists in the android repos so.. maybe someday. */
 typedef struct {
   char *dli_fname;
 } Dl_info;
 
 #define dladdr(foo, bar) 0
+#endif
 
 /* sysinfo is defined but not implemented.
  * we may be able to implement it ourselves. */
 #define _SYS_SYSINFO_H_
 
 #include <sys/cdefs.h>
 #include <linux/kernel.h>