Bug 1280600: Cleanup Android-version variables in configure scripts, r=glandium
Not all Android releases come with their own platform release. This patch adds
a switch statement to MOZ_ANDROID_NDK to use the previous platform release in
this case.
For several tests, the autoconf script 'old-configure.in' uses an internal
variable 'ANDROID_VERSION'. The stored value comes from the environment
variable 'PLATFORM_SDK_VERSION'. This patch replaces 'ANDROID_VERSION' by
'android_version', which is defined by MOZ_ANDROID_NDK from a command-line
parameter.
MozReview-Commit-ID: EbDgZX2aJgJ
--- a/build/autoconf/android.m4
+++ b/build/autoconf/android.m4
@@ -34,17 +34,34 @@ case "$target" in
i?86)
target_name=x86
;;
mipsel)
target_name=mips
;;
esac
- android_platform="$android_ndk"/platforms/android-"$android_version"/arch-"$target_name"
+ dnl Not all Android releases have their own platform release. We use
+ dnl the next lower platform version in these cases.
+ case $android_version in
+ 11|10)
+ android_platform_version=9
+ ;;
+ 20)
+ android_platform_version=19
+ ;;
+ 22)
+ android_platform_version=21
+ ;;
+ *)
+ android_platform_version=$android_version
+ ;;
+ esac
+
+ android_platform="$android_ndk"/platforms/android-"$android_platform_version"/arch-"$target_name"
if test -d "$android_platform" ; then
AC_MSG_RESULT([$android_platform])
else
AC_MSG_ERROR([not found. Please check your NDK. With the current configuration, it should be in $android_platform])
fi
CPPFLAGS="-idirafter $android_platform/usr/include $CPPFLAGS"
--- a/old-configure.in
+++ b/old-configure.in
@@ -94,30 +94,25 @@ MOZ_BUILD_ROOT=`pwd -W 2>/dev/null || pw
DIST="$MOZ_BUILD_ROOT/dist"
MOZ_DEFAULT_COMPILER
if test "$COMPILE_ENVIRONMENT"; then
MOZ_ANDROID_NDK
fi # COMPILE_ENVIRONMENT
-if test -n "$gonkdir" ; then
+if test -n "$gonkdir"; then
dnl export for js/src/configure. We can't pass the option down normally,
dnl because it's a `--enable-project=b2g`-only option.
export gonkdir
kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
android_source="$gonkdir"
ANDROID_SOURCE="$android_source"
- dnl Default to ICS
- ANDROID_VERSION=15
- if test -n "${PLATFORM_SDK_VERSION}"; then
- ANDROID_VERSION="${PLATFORM_SDK_VERSION}"
- fi
-
- case "$ANDROID_VERSION" in
+
+ case "$android_version" in
15)
CPPFLAGS="-I$gonkdir/frameworks/base/opengl/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/frameworks/base/include -I$gonkdir/frameworks/base/services/camera -I$gonkdir/frameworks/base/include/media/ -I$gonkdir/frameworks/base/include/media/stagefright -I$gonkdir/frameworks/base/include/media/stagefright/openmax -I$gonkdir/frameworks/base/media/libstagefright/rtsp -I$gonkdir/frameworks/base/media/libstagefright/include -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib -I$gonkdir/dalvik/libnativehelper/include/nativehelper $CPPFLAGS"
MOZ_NFC=1
MOZ_B2G_CAMERA=1
MOZ_OMX_DECODER=1
AC_SUBST(MOZ_OMX_DECODER)
MOZ_RTSP=1
MOZ_SECUREELEMENT=1
@@ -155,17 +150,17 @@ if test -n "$gonkdir" ; then
AC_DEFINE(MOZ_OMX_ENCODER)
AC_SUBST(MOZ_AUDIO_OFFLOAD)
AC_DEFINE(MOZ_AUDIO_OFFLOAD)
MOZ_B2G_CAMERA=1
MOZ_NFC=1
MOZ_RTSP=1
;;
*)
- AC_MSG_ERROR([Unsupported platform version: $ANDROID_VERSION])
+ AC_MSG_ERROR([Unsupported platform version: $android_version])
;;
esac
dnl Enable Bluetooth backends depending on available drivers
if test -d "$gonkdir/system/bluetoothd"; then
MOZ_B2G_BT=1
MOZ_B2G_BT_DAEMON=1
fi
@@ -175,20 +170,24 @@ if test -n "$gonkdir" ; then
fi
CPPFLAGS="-I$gonkdir/system -I$gonkdir/system/core/include -I$gonkdir/hardware/libhardware/include -I$gonkdir/external/valgrind/fxos-include $CPPFLAGS"
LDFLAGS="-L$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib -Wl,-rpath-link=$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib $LDFLAGS"
dnl Add -llog by default, since we use it all over the place.
LIBS="$LIBS -llog"
AC_DEFINE(ANDROID)
- AC_DEFINE_UNQUOTED(ANDROID_VERSION, $ANDROID_VERSION)
- AC_SUBST(ANDROID_VERSION)
+ AC_DEFINE_UNQUOTED(ANDROID_VERSION, $android_version)
AC_DEFINE(HAVE_SYS_UIO_H)
AC_DEFINE(HAVE_PTHREADS)
+
+ dnl ANDROID_VERSION is only required for the AC_SUBST below
+ ANDROID_VERSION=$android_version
+ AC_SUBST(ANDROID_VERSION)
+
direct_nspr_config=1
else
case "$target" in
*-android*|*-linuxandroid*)
ZLIB_DIR=yes
AC_DEFINE(ANDROID)
;;
@@ -3522,19 +3521,19 @@ MOZ_ARG_DISABLE_BOOL(directshow,
if test -n "$MOZ_DIRECTSHOW"; then
AC_DEFINE(MOZ_DIRECTSHOW)
fi;
dnl ========================================================
dnl = Built-in fragmented MP4 support.
dnl ========================================================
-if test x"$MOZ_WIDGET_TOOLKIT" = x"gonk" -a -n "$MOZ_FMP4" -a -n "$ANDROID_VERSION"; then
- # we now know for sure that $ANDROID_VERSION is not an empty string!
- if test "$ANDROID_VERSION" -ge "18"; then
+if test x"$MOZ_WIDGET_TOOLKIT" = x"gonk" -a -n "$MOZ_FMP4" -a -n "$android_version"; then
+ # we now know for sure that $android_version is not an empty string!
+ if test "$android_version" -ge "18"; then
MOZ_GONK_MEDIACODEC=1
AC_SUBST(MOZ_GONK_MEDIACODEC)
fi
fi
dnl ========================================================
dnl = Enable media plugin support