diff --git a/configure b/configure index 6c9bebda8..f8ee03db3 100755 --- a/configure +++ b/configure @@ -23555,8 +23555,10 @@ case "$host" in ANDROID_CFLAGS="-DGL_GLEXT_PROTOTYPES" CFLAGS="$CFLAGS $ANDROID_CFLAGS" SDL_CFLAGS="$SDL_CFLAGS $ANDROID_CFLAGS" + SDL_LIBS="$SDL_LIBS -lSDL2main -Wl,-u,SDL_main_dummy" EXTRA_CFLAGS="$EXTRA_CFLAGS $ANDROID_CFLAGS" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl -lGLESv1_CM -lGLESv2 -llog -landroid" + SDLMAIN_SOURCES="$srcdir/src/main/android/*.c" if test x$enable_video = xyes; then SOURCES="$SOURCES $srcdir/src/core/android/*.c $srcdir/src/video/android/*.c" diff --git a/configure.in b/configure.in index 04f293318..a97ba7fb0 100644 --- a/configure.in +++ b/configure.in @@ -3160,8 +3160,10 @@ case "$host" in ANDROID_CFLAGS="-DGL_GLEXT_PROTOTYPES" CFLAGS="$CFLAGS $ANDROID_CFLAGS" SDL_CFLAGS="$SDL_CFLAGS $ANDROID_CFLAGS" + SDL_LIBS="$SDL_LIBS -lSDL2main -Wl,-u,SDL_main_dummy" EXTRA_CFLAGS="$EXTRA_CFLAGS $ANDROID_CFLAGS" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl -lGLESv1_CM -lGLESv2 -llog -landroid" + SDLMAIN_SOURCES="$srcdir/src/main/android/*.c" if test x$enable_video = xyes; then SOURCES="$SOURCES $srcdir/src/core/android/*.c $srcdir/src/video/android/*.c" diff --git a/src/main/android/SDL_android_main.c b/src/main/android/SDL_android_main.c index 9b90a38cb..db6ae4fbb 100644 --- a/src/main/android/SDL_android_main.c +++ b/src/main/android/SDL_android_main.c @@ -15,6 +15,9 @@ *******************************************************************************/ #include +/* Dummy symbol so '-u SDL_main_dummy' forces ld to link in libSDL2main.a */ +JNIEXPORT int SDL_main_dummy; + /* Called before SDL_main() to initialize JNI bindings in SDL library */ extern void SDL_Android_Init(JNIEnv* env, jclass cls);