From 11637c1142483a7b07f59d8c4782c65ea323d831 Mon Sep 17 00:00:00 2001 From: "Marty E. Plummer" Date: Sun, 7 Jan 2018 20:18:00 -0600 Subject: [PATCH] configure.ac: change SDL2 check to work on mingw-w64 One only needs -lSDL2main and -mwindows when building an application linked against SDL2, not a library which is linked against SDL2. Without this change you'll only be able to build a static libSDL_sound.a because libtool freaks over libmingw32.a and libSDL2main.a not having a real library/dll to go with them. Signed-off-by: Marty E. Plummer --- configure.ac | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/configure.ac b/configure.ac index 099b638..6cbd1bb 100644 --- a/configure.ac +++ b/configure.ac @@ -93,17 +93,6 @@ dnl --------------------------------------------------------------------- dnl Checks for libraries. dnl --------------------------------------------------------------------- -dnl Check for SDL -SDL_VERSION=2.0.0 -AC_SUBST(SDL_VERSION) -AM_PATH_SDL2($SDL_VERSION, - :, - AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]) -) -CFLAGS="$CFLAGS $SDL_CFLAGS" -LIBS="$LIBS $SDL_LIBS" - - dnl Check for voc decoder inclusion... AC_ARG_ENABLE([voc], AS_HELP_STRING([--enable-voc], [enable VOC decoding [default=yes]]), @@ -276,6 +265,18 @@ AC_TYPE_SIZE_T AC_FUNC_MEMCMP AC_CHECK_FUNCS([malloc memset strrchr setbuf]) +dnl Check for SDL2 +dnl Moved here because the -Dmain=SDL_main in SDL_CFLAGS throws +dnl off quite a lot of other autotools flags. +PKG_CHECK_MODULES([SDL],[sdl2],[sdl_found=yes],[sdl_found=no]) +AC_CHECK_LIB(SDL2, SDL_Init, have_sdl=yes) +AS_IF([test x$sdl_found = xyes -a x$have_sdl = xyes], [ + AX_APPEND_LINK_FLAGS([-lSDL2],[LIBS]) + AX_APPEND_COMPILE_FLAGS([$SDL_CFLAGS],[CFLAGS]) +], [ + AC_MSG_ERROR([*** SDL2 required! ***]) +]) + AX_APPEND_COMPILE_FLAGS([-D_REENTRANT -D_THREAD_SAFE],[CFLAGS]) dnl Add Makefile conditionals