- Set your PATH so the Android NDK tools (arm-linux-androideabi-cpp, arm-linux-androideabi-gcc, and friends) are on PATH:
$ echo $PATH
/opt/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86_64/bin:
/opt/android-sdk-macosx/tools/:/opt/android-sdk-macosx/platform-tools/:
/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:
/opt/X11/bin:/usr/local/MacGPG2/bin
- Ensure ANDROID_NDK_ROOT is set (this is an Android requirement, see https://groups.google.com/d/msg/android-ndk/qZjhOaynHXc/Szy_KYY9GcwJ):
$ echo $ANDROID_NDK_ROOT
/opt/android-ndk-r9
- Export the tools:
export CPP=arm-linux-androideabi-cpp
export CC=arm-linux-androideabi-cc
...
export LD=arm-linux-androideabi-ld
...
- Export CPPFLAGS, CFLAGS, and CXXFLAGS with SYSROOT (some autotools tests don't honor the config option):
$ echo $ANDROID_SYSROOT
/opt/android-ndk-r9/platforms/android-14/arch-arm
export CPPFLAGS="--sysroot=$ANDROID_SYSROOT"
export CFLAGS="--sysroot=$ANDROID_SYSROOT"
export CXXFLAGS="--sysroot=$ANDROID_SYSROOT"
- Configure as follows (
--build=arm-android
breaks config):
$ ./configure --host=x86_64-darwin --build=arm --with-sysroot=$ANDROID_SYSROOT
checking build system type... arm-unknown-none
checking host system type... x86_64-pc-none
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
from https://lists.gnu.org/archive/html/autoconf/2013-10/msg00004.html