From 21a28110472ab7270023418cef652aa87622c5a1 Mon Sep 17 00:00:00 2001 From: Mounir Lamouri Date: Tue, 13 Sep 2011 15:35:23 -0700 Subject: [PATCH] Bug 686350 - Check in configure script that the selected Android SDK is correct. r=glandium --- configure.in | 22 ++++++++++++++++++++++ js/src/configure.in | 22 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/configure.in b/configure.in index 0df935078c7..4bde68bc335 100644 --- a/configure.in +++ b/configure.in @@ -295,6 +295,28 @@ case "$target" in if test -z "$android_sdk" ; then AC_MSG_ERROR([You must specify --with-android-sdk=/path/to/sdk when targeting Android.]) + else + if ! test -e "$android_sdk"/source.properties ; then + AC_MSG_ERROR([The path in --with-android-sdk isn't valid (source.properties hasn't been found).]) + fi + + # Minimum Android SDK API Level we require. + android_min_api_level=13 + + # Get the api level from "$android_sdk"/source.properties. + android_api_level=`$AWK -F = '$1 == "AndroidVersion.ApiLevel" {print $2}' "$android_sdk"/source.properties` + + if test -z "$android_api_level" ; then + AC_MSG_ERROR([Unexpected error: no AndroidVersion.ApiLevel field has been found in source.properties.]) + fi + + if ! test "$android_api_level" -eq "$android_api_level" ; then + AC_MSG_ERROR([Unexpected error: the found android api value isn't a number! (found $android_api_level)]) + fi + + if test $android_api_level -lt $android_min_api_level ; then + AC_MSG_ERROR([The given Android SDK provides API level $android_api_level ($android_min_api_level or higher required).]) + fi fi android_platform_tools="$android_sdk"/../../platform-tools diff --git a/js/src/configure.in b/js/src/configure.in index 34d57e12f6d..b26d35085d2 100644 --- a/js/src/configure.in +++ b/js/src/configure.in @@ -291,6 +291,28 @@ case "$target" in android_platform_tools="$android_sdk"/../../platform-tools if test ! -d "$android_platform_tools" ; then android_platform_tools="$android_sdk"/tools # SDK Tools < r8 + else + if ! test -e "$android_sdk"/source.properties ; then + AC_MSG_ERROR([The path in --with-android-sdk isn't valid (source.properties hasn't been found).]) + fi + + # Minimum Android SDK API Level we require. + android_min_api_level=13 + + # Get the api level from "$android_sdk"/source.properties. + android_api_level=`$AWK -F = '$1 == "AndroidVersion.ApiLevel" {print $2}' "$android_sdk"/source.properties` + + if test -z "$android_api_level" ; then + AC_MSG_ERROR([Unexpected error: no AndroidVersion.ApiLevel field has been found in source.properties.]) + fi + + if ! test "$android_api_level" -eq "$android_api_level" ; then + AC_MSG_ERROR([Unexpected error: the found android api value isn't a number! (found $android_api_level)]) + fi + + if test $android_api_level -lt $android_min_api_level ; then + AC_MSG_ERROR([The given Android SDK provides API level $android_api_level ($android_min_api_level or higher required).]) + fi fi if test -z "$android_toolchain" ; then