1 dnl This Source Code Form is subject to the terms of the Mozilla Public
2 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
3 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 AC_DEFUN([MOZ_ANDROID_NDK],
9 *-android*|*-linuxandroid*)
10 dnl $android_platform will be set for us by Python configure.
11 directory_include_args="-isystem $android_system -isystem $android_sysroot/usr/include"
13 # clang will do any number of interesting things with host tools unless we tell
14 # it to use the NDK tools.
15 extra_opts="-gcc-toolchain $(dirname $(dirname $TOOLCHAIN_PREFIX))"
16 CPPFLAGS="$extra_opts -D__ANDROID_API__=$android_version $CPPFLAGS"
17 ASFLAGS="$extra_opts $ASFLAGS"
18 LDFLAGS="$extra_opts $LDFLAGS"
20 CPPFLAGS="$directory_include_args $CPPFLAGS"
21 CFLAGS="-fno-short-enums -fno-exceptions $CFLAGS"
22 CXXFLAGS="-fno-short-enums -fno-exceptions $CXXFLAGS $stlport_cppflags"
23 ASFLAGS="$directory_include_args -DANDROID $ASFLAGS"
25 LDFLAGS="-L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform $LDFLAGS"
31 AC_DEFUN([MOZ_ANDROID_CPU_ARCH],
34 if test "$OS_TARGET" = "Android"; then
37 ANDROID_CPU_ARCH=armeabi-v7a
43 ANDROID_CPU_ARCH=x86_64
46 ANDROID_CPU_ARCH=arm64-v8a
50 AC_SUBST(ANDROID_CPU_ARCH)
54 AC_DEFUN([MOZ_ANDROID_STLPORT],
57 if test "$OS_TARGET" = "Android"; then
58 if test -z "$STLPORT_LIBS"; then
59 # android-ndk-r8b and later
60 cxx_libs="$android_ndk/sources/cxx-stl/llvm-libc++/libs/$ANDROID_CPU_ARCH"
61 # NDK r12 removed the arm/thumb library split and just made
62 # everything thumb by default. Attempt to compensate.
63 if test "$MOZ_THUMB2" = 1 -a -d "$cxx_libs/thumb"; then
64 cxx_libs="$cxx_libs/thumb"
67 if ! test -e "$cxx_libs/libc++_static.a"; then
68 AC_MSG_ERROR([Couldn't find path to llvm-libc++ in the android ndk])
71 STLPORT_LIBS="-L$cxx_libs -lc++_static"
72 # NDK r12 split the libc++ runtime libraries into pieces.
73 for lib in c++abi unwind android_support; do
74 if test -e "$cxx_libs/lib${lib}.a"; then
75 STLPORT_LIBS="$STLPORT_LIBS -l${lib}"
80 AC_SUBST_LIST([STLPORT_LIBS])
85 dnl Configure an Android SDK.
86 AC_DEFUN([MOZ_ANDROID_SDK],
89 MOZ_ARG_WITH_STRING(android-min-sdk,
90 [ --with-android-min-sdk=[VER] Impose a minimum Firefox for Android SDK version],
91 [ MOZ_ANDROID_MIN_SDK_VERSION=$withval ])
93 MOZ_ARG_WITH_STRING(android-max-sdk,
94 [ --with-android-max-sdk=[VER] Impose a maximum Firefox for Android SDK version],
95 [ MOZ_ANDROID_MAX_SDK_VERSION=$withval ])
97 if test -n "$MOZ_ANDROID_MIN_SDK_VERSION"; then
98 if test -n "$MOZ_ANDROID_MAX_SDK_VERSION"; then
99 if test $MOZ_ANDROID_MAX_SDK_VERSION -lt $MOZ_ANDROID_MIN_SDK_VERSION ; then
100 AC_MSG_ERROR([--with-android-max-sdk must be at least the value of --with-android-min-sdk.])
104 if test $MOZ_ANDROID_MIN_SDK_VERSION -gt $ANDROID_TARGET_SDK ; then
105 AC_MSG_ERROR([--with-android-min-sdk is expected to be less than $ANDROID_TARGET_SDK])
108 AC_SUBST(MOZ_ANDROID_MIN_SDK_VERSION)
111 AC_SUBST(MOZ_ANDROID_MAX_SDK_VERSION)