Skip to content

Commit

Permalink
configure.ac: change SDL2 check to work on mingw-w64
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
hanetzer committed Jan 8, 2018
1 parent f03f74d commit 11637c1
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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]]),
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 11637c1

Please sign in to comment.