Partial fix for bug 2758 - Android issues with NDK r10c and API-21
authorSam Lantinga <slouken@libsdl.org>
Wed, 17 Jun 2015 00:07:45 -0700
changeset 9752 f2d87d87509f
parent 9751 47ae0a3aa68f
child 9753 24ddf7210dbc
Partial fix for bug 2758 - Android issues with NDK r10c and API-21 Sylvain When using API 21 and running on an old device (android < 5.0 ?) some function are missing. functions are (at least) : signal, sigemptyset, atof, stpcpy (strcat and strcpy), srand, rand. Very few modifications on SDL to get this working : on SDL ====== Undefine android configuration : HAVE_SIGNAL HAVE_SIGACTION HAVE_ATOF In "SDL_systrhead.c", comment out the few block of lines with "sigemptyset". Android.mk: remove the compilation of "test" directory because it contains a few rand/srand calls Also, there are more discussions about this in internet : https://groups.google.com/forum/#!topic/android-ndk/RjO9WmG9pfE http://stackoverflow.com/questions/25475055/android-ndk-load-library-cannot-locate-srand
include/SDL_config_android.h
src/thread/pthread/SDL_systhread.c
--- a/include/SDL_config_android.h	Wed Jun 17 00:00:53 2015 -0700
+++ b/include/SDL_config_android.h	Wed Jun 17 00:07:45 2015 -0700
@@ -43,7 +43,6 @@
 #define HAVE_STDINT_H   1
 #define HAVE_CTYPE_H    1
 #define HAVE_MATH_H 1
-#define HAVE_SIGNAL_H   1
 
 /* C library functions */
 #define HAVE_MALLOC 1
@@ -76,7 +75,6 @@
 #define HAVE_STRTOULL   1
 #define HAVE_STRTOD 1
 #define HAVE_ATOI   1
-#define HAVE_ATOF   1
 #define HAVE_STRCMP 1
 #define HAVE_STRNCMP    1
 #define HAVE_STRCASECMP 1
@@ -103,7 +101,6 @@
 #define HAVE_SQRTF  1
 #define HAVE_TAN    1
 #define HAVE_TANF   1
-#define HAVE_SIGACTION  1
 #define HAVE_SETJMP 1
 #define HAVE_NANOSLEEP  1
 #define HAVE_SYSCONF    1
--- a/src/thread/pthread/SDL_systhread.c	Wed Jun 17 00:00:53 2015 -0700
+++ b/src/thread/pthread/SDL_systhread.c	Wed Jun 17 00:07:45 2015 -0700
@@ -159,14 +159,15 @@
     }
 
    /* NativeClient does not yet support signals.*/
-#ifndef __NACL__
+#if !defined(__ANDROID__) && !defined(__NACL__)
     /* Mask asynchronous signals for this thread */
     sigemptyset(&mask);
     for (i = 0; sig_list[i]; ++i) {
         sigaddset(&mask, sig_list[i]);
     }
     pthread_sigmask(SIG_BLOCK, &mask, 0);
-#endif
+#endif /* !__ANDROID__ && !__NACL__ */
+
 
 #ifdef PTHREAD_CANCEL_ASYNCHRONOUS
     /* Allow ourselves to be asynchronously cancelled */