From d2044bee8a3ffc775ce54f4c26d32f5bdf0b8936 Mon Sep 17 00:00:00 2001 From: Liong Sauw Ming Date: Mon, 30 Sep 2013 05:12:29 +0000 Subject: Re #1516: Add feature to ignore certain compilation flags from the --use-ndk-cflags option. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4604 74dad513-b988-da41-8d7b-12977e46ad98 --- configure-android | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'configure-android') diff --git a/configure-android b/configure-android index 5ddfb333..386c01f8 100755 --- a/configure-android +++ b/configure-android @@ -22,6 +22,11 @@ if test "$*" = "--help" -o "$*" = "-h"; then echo " e.g. armeabi-v7a, mips, x86. By default, the target" echo " architecture is armeabi. Only used when" echo " --use-ndk-cflags is specified." + echo " IGNORE_CFLAGS Optionally specify compilation flags to be ignored." + echo " Each grepped flag that satisfies the criteria will" + echo " be ignored. Default:" + echo " IGNORE_CFLAGS=\"\-M\|\-f*stack\|\-f*alias\"" + echo " Only used when --use-ndk-cflags is specified." echo "" exit 0 fi @@ -55,6 +60,9 @@ fi if test "$1" = "--use-ndk-cflags"; then shift ADD_CFLAGS="1" + if test "x${IGNORE_CFLAGS}" = "x"; then + IGNORE_CFLAGS="\-M\|\-f*stack\|\-f*alias" + fi for i in `${ANDROID_NDK_ROOT}/ndk-build -n -C ${ANDROID_NDK_ROOT}/samples/hello-jni NDK_LOG=1 APP_PLATFORM=${APP_PLATFORM} APP_ABI=${TARGET_ABI}`; do if test "x${NDK_CXX}" != "x" -a "$i" = "-o"; then break; fi @@ -67,9 +75,11 @@ if test "$1" = "--use-ndk-cflags"; then fi # Parse NDK CFLAGS - if test "x${NDK_CC}" != "x" -a "x`echo $i|grep 'hello-jni'`" = "x" -a "x`echo $i|grep '\-M'`" = "x" -a "${ADD_CFLAGS}" = "1"; then + if test "x${NDK_CC}" != "x" -a "x`echo $i|grep 'hello-jni'`" = "x" -a "${ADD_CFLAGS}" = "1"; then if test "$i" = "-c"; then ADD_CFLAGS="0"; else - NDK_CFLAGS="${NDK_CFLAGS} $i" + if test "x`echo $i|grep ${IGNORE_CFLAGS}`" = "x"; then + NDK_CFLAGS="${NDK_CFLAGS} $i" + fi fi fi @@ -88,7 +98,7 @@ if test "$1" = "--use-ndk-cflags"; then export LDFLAGS="${LDFLAGS} -nostdlib -L${ANDROID_SYSROOT}/usr/lib/" export LIBS="${LIBS} -lc -lgcc" - export CFLAGS="${CFLAGS} ${NDK_CFLAGS}" + export CFLAGS="${NDK_CFLAGS} ${CFLAGS}" export CPPFLAGS="${CFLAGS}" export CXXFLAGS="${NDK_CXXFLAGS}" -- cgit v1.2.3