diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in index 2ffcd214da4d..3a5c33797602 100644 --- a/config/autoconf.mk.in +++ b/config/autoconf.mk.in @@ -652,3 +652,9 @@ MOZ_OFFICIAL_BRANDING = @MOZ_OFFICIAL_BRANDING@ HAVE_CLOCK_MONOTONIC = @HAVE_CLOCK_MONOTONIC@ REALTIME_LIBS = @REALTIME_LIBS@ + +ANDROID_NDK = @ANDROID_NDK@ +ANDROID_TOOLCHAIN = @ANDROID_TOOLCHAIN@ +ANDROID_PLATFORM = @ANDROID_PLATFORM@ +ANDROID_SDK = @ANDROID_SDK@ +ANDROID_TOOLS = @ANDROID_TOOLS@ diff --git a/configure.in b/configure.in index 1f21ad18184a..9764062ccf1b 100644 --- a/configure.in +++ b/configure.in @@ -239,6 +239,108 @@ if test -z "$PERL" || test "$PERL" = ":"; then AC_MSG_ERROR([perl not found in \$PATH]) 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 ======================================================== + +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 NDK platform dir, default NDK/build/platforms/android-5/arch-arm], + android_platform=$withval) + +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 + location where the Android Tools can be found (base directory, e.g. .../android/tools)], + android_tools=$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_sdk" ; then + AC_MSG_ERROR([You must specify --with-android-sdk=/path/to/sdk when targeting Android.]) + fi + + if test -z "$android_tools" ; then + 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 + 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 -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 + dnl NDK.) + LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform -llog -Wl,--allow-shlib-undefined $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 + + ANDROID_NDK="${android_ndk}" + ANDROID_TOOLCHAIN="{android_toolchain}" + ANDROID_PLATFORM="{android_platform}" + ANDROID_SDK="${android_sdk}" + ANDROID_TOOLS="${android_tools}" + + AC_DEFINE(ANDROID) + 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) +AC_SUBST(ANDROID_TOOLS) + dnl ======================================================== dnl Checks for compilers. dnl ======================================================== @@ -1149,6 +1251,9 @@ if test -n "$CROSS_COMPILE"; then winmo*) OS_ARCH=WINCE ;; darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;; esac + case "${target}" in + arm-android-eabi) OS_ARCH=Linux OS_TARGET=Android ;; + esac else OS_TARGET=`uname -s` OS_ARCH=`uname -s | sed -e 's|/|_|g'` @@ -2788,6 +2893,18 @@ alpha*-*-osf*) HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"' ;; +*-android*) + AC_DEFINE(NO_PW_GECOS) + no_x=yes + _PLATFORM_DEFAULT_TOOLKIT=cairo-android + TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"' + + MOZ_GFX_OPTIMIZE_MOBILE=1 + MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fomit-frame-pointer" + + dnl MOZ_MEMORY=1 + ;; + esac dnl Only one oddball right now (QNX), but this gives us flexibility @@ -4366,8 +4483,11 @@ LDFLAGS=$_SAVE_LDFLAGS if test "$ac_cv_thread_keyword" = yes; then # mips builds fail with TLS variables because of a binutils bug. # See bug 528687 - case "${target_cpu}" in - mips*) + case "${target}" in + mips*-*) + : + ;; + *-android*) : ;; *) @@ -5058,7 +5178,8 @@ MOZ_ARG_HEADER(Toolkit Options) -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \ -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \ -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \ - -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" + -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \ + -o "$_DEFAULT_TOOLKIT" = "cairo-android" then dnl nglayout only supports building with one toolkit, dnl so ignore everything after the first comma (","). @@ -5166,6 +5287,13 @@ cairo-cocoa) MOZ_FS_LAYOUT=bundle MOZ_WEBGL=1 ;; + +cairo-android) + AC_DEFINE(MOZ_WIDGET_ANDROID) + MOZ_WIDGET_TOOLKIT=android + MOZ_WEBGL= + ;; + esac if test "$MOZ_ENABLE_XREMOTE"; then @@ -5624,7 +5752,7 @@ dnl ======================================================== dnl = Disable IPC support for tabs and plugins dnl ======================================================== case "${target}" in -*-wince*) +*-wince*|*-android*) MOZ_IPC= ;; esac