summaryrefslogtreecommitdiff
path: root/hints
diff options
context:
space:
mode:
Diffstat (limited to 'hints')
-rw-r--r--hints/linux-android.sh92
1 files changed, 92 insertions, 0 deletions
diff --git a/hints/linux-android.sh b/hints/linux-android.sh
index ae8be9d73b..1c5281f4d0 100644
--- a/hints/linux-android.sh
+++ b/hints/linux-android.sh
@@ -12,6 +12,98 @@ d_setlocale='undef'
d_setlocale_r='undef'
i_locale='undef'
+# Bionic defines several stubs that just warn and return NULL
+# https://gitorious.org/0xdroid/bionic/blobs/70b2ef0ec89a9c9d4c2d4bcab728a0e72bafb18e/libc/bionic/stubs.c
+# https://android.googlesource.com/platform/bionic/+/master/libc/bionic/stubs.cpp
+
+# If they warn with 'FIX' or 'Android', assume they are the stubs
+# we want to avoid.
+
+# These are all stubs as well, but the core doesn't use them:
+# getusershell setusershell endusershell
+
+# This script UU/archname.cbu will get 'called-back' by Configure.
+cat > UU/archname.cbu <<'EOCBU'
+# egrep pattern to detect a stub warning on Android.
+# Right now we're checking for:
+# Android 2.x: FIX ME! implement FUNC
+# Android 4.x: FUNC is not implemented on Android
+android_stub='FIX|Android'
+
+cat > try.c << 'EOM'
+#include <netdb.h>
+int main() { (void) getnetbyname("foo"); return(0); }
+EOM
+$cc $ccflags try.c -o try
+android_warn=`$run ./try 2>&1 | $egrep "$android_stub"`
+if test "X$android_warn" != X; then
+ d_getnbyname="$undef"
+fi
+
+cat > try.c << 'EOM'
+#include <netdb.h>
+int main() { (void) getnetbyaddr((uint32_t)1, AF_INET); return(0); }
+EOM
+$cc $ccflags try.c -o try
+android_warn=`$run ./try 2>&1 | $egrep "$android_stub"`
+if test "X$android_warn" != X; then
+ d_getnbyaddr="$undef"
+fi
+
+cat > try.c << 'EOM'
+#include <stdio.h>
+#include <mntent.h>
+#include <unistd.h>
+int main() { (void) getmntent(stdout); return(0); }
+EOM
+$cc $ccflags try.c -o try
+android_warn=`$run ./try 2>&1 | $egrep "$android_stub"`
+if test "X$android_warn" != X; then
+ d_getmntent="$undef"
+fi
+
+cat > try.c << 'EOM'
+#include <netdb.h>
+int main() { (void) getprotobyname("foo"); return(0); }
+EOM
+$cc $ccflags try.c -o try
+android_warn=`$run ./try 2>&1 | $egrep "$android_stub"`
+if test "X$android_warn" != X; then
+ d_getpbyname="$undef"
+fi
+
+cat > try.c << 'EOM'
+#include <netdb.h>
+int main() { (void) getprotobynumber(1); return(0); }
+EOM
+$cc $ccflags try.c -o try
+android_warn=`$run ./try 2>&1 | $egrep "$android_stub"`
+if test "X$android_warn" != X; then
+ d_getpbynumber="$undef"
+fi
+
+cat > try.c << 'EOM'
+#include <sys/types.h>
+#include <pwd.h>
+int main() { endpwent(); return(0); }
+EOM
+$cc $ccflags try.c -o try
+android_warn=`$run ./try 2>&1 | $egrep "$android_stub"`
+if test "X$android_warn" != X; then
+ d_endpwent="$undef"
+fi
+
+cat > try.c << 'EOM'
+#include <unistd.h>
+int main() { (void) ttyname(STDIN_FILENO); return(0); }
+EOM
+$cc $ccflags try.c -o try
+android_warn=`$run ./try 2>&1 | $egrep "$android_stub"`
+if test "X$android_warn" != X; then
+ d_ttyname="$undef"
+fi
+
+EOCBU
case "$src" in
/*) run=$src/Cross/run