Merge pull request #4433 from kumpera/android-fixes
[mono.git] / configure.ac
index c3a0beb8a9446d9cb2c5bdd634739a1f9e1cb0db..a8dcb129243b70243727efadf002dd69333022b1 100644 (file)
@@ -1428,8 +1428,6 @@ if test x$host_win32 = xno; then
 
        AC_CHECK_FUNCS(getgrgid_r)
        AC_CHECK_FUNCS(getgrnam_r)
-       AC_CHECK_FUNCS(getpwnam_r)
-       AC_CHECK_FUNCS(getpwuid_r)
        AC_CHECK_FUNCS(getresuid)
        AC_CHECK_FUNCS(setresuid)
        AC_CHECK_FUNCS(kqueue)
@@ -1450,6 +1448,11 @@ if test x$host_win32 = xno; then
        AC_CHECK_FUNCS(sched_setaffinity)
        AC_CHECK_FUNCS(sched_getcpu)
 
+       if test x$platform_android != xyes; then
+               AC_CHECK_FUNCS(getpwnam_r)
+               AC_CHECK_FUNCS(getpwuid_r)
+       fi
+
        dnl ****************************************************************
        dnl *** Check for sched_setaffinity from glibc versions before   ***
        dnl *** 2.3.4. The older versions of the function only take 2    ***
@@ -3310,7 +3313,6 @@ if test "x$host" != "x$target"; then
                TARGET=ARM;
                arch_target=arm;
                AC_DEFINE(TARGET_ARM, 1, [...])
-               AC_DEFINE(TARGET_ANDROID, 1, [...])
                ACCESS_UNALIGNED="no"
                CPPFLAGS="$CPPFLAGS -D__ARM_EABI__"
                # Can't use tls, since it depends on the runtime detection of tls offsets
@@ -3323,6 +3325,11 @@ if test "x$host" != "x$target"; then
                        CPPFLAGS="$CPPFLAGS"
                        ;;
                armv5-*-linux-androideabi*)
+                       AC_DEFINE(TARGET_ANDROID, 1, [...])
+                       CPPFLAGS="$CPPFLAGS"
+                       ;;
+               *-linux-androideabi*)
+                       AC_DEFINE(TARGET_ANDROID, 1, [...])
                        CPPFLAGS="$CPPFLAGS"
                        ;;
                esac
@@ -3342,23 +3349,33 @@ if test "x$host" != "x$target"; then
                TARGET=X86;
                arch_target=x86;
                AC_DEFINE(TARGET_X86, 1, [...])
-               AC_DEFINE(TARGET_ANDROID, 1, [...])
                CPPFLAGS="$CPPFLAGS"
                # Can't use tls, since it depends on the runtime detection of tls offsets
                # in mono-compiler.h            
                with_tls=pthread
                target_mach=no
+
+               case "$target" in
+               *-linux-android*)
+                       AC_DEFINE(TARGET_ANDROID, 1, [...])
+                       ;;
+               esac
                ;;
    x86_64*-linux-*)
                TARGET=AMD64;
                arch_target=amd64;
                AC_DEFINE(TARGET_AMD64, 1, [...])
-               AC_DEFINE(TARGET_ANDROID, 1, [...])
                CPPFLAGS="$CPPFLAGS"
                # Can't use tls, since it depends on the runtime detection of tls offsets
                # in mono-compiler.h
                with_tls=pthread
                target_mach=no
+
+               case "$target" in
+               *-linux-android*)
+                       AC_DEFINE(TARGET_ANDROID, 1, [...])
+                       ;;
+               esac
                ;;
    x86_64-ps4-freebsd)
                TARGET=AMD64;
@@ -3377,12 +3394,16 @@ if test "x$host" != "x$target"; then
                TARGET=ARM64;
                arch_target=arm64;
                AC_DEFINE(TARGET_ARM64, 1, [...])
-               AC_DEFINE(TARGET_ANDROID, 1, [...])
                CPPFLAGS="$CPPFLAGS"
                # Can't use tls, since it depends on the runtime detection of tls offsets
                # in mono-compiler.h
                with_tls=pthread
                target_mach=no
+               case "$target" in
+               *-linux-android*)
+                       AC_DEFINE(TARGET_ANDROID, 1, [...])
+                       ;;
+               esac
                ;;
        aarch64-*)
                TARGET=ARM64