diff --git a/crossplatform/configure.ac b/crossplatform/configure.ac index e33a94a0d..f9218c5ce 100644 --- a/crossplatform/configure.ac +++ b/crossplatform/configure.ac @@ -81,17 +81,27 @@ AC_ARG_WITH(mp3, [ --with-mp3 built support for Mp3 files (default)], [ mp3=$withval ], [ mp3=yes ]) +# windows conditional +case $host_os in + *mingw32* ) MINGW32=yes;; + * ) MINGW32=no;; +esac +if test x"$MINGW32" = "xyes"; then + AC_DEFINE(WIN32, 1, [Windows build]) + LIBS="$LIBS -lmingw32" +fi + AM_PATH_SDL([1.1.4], [sdl_found="yes"], [sdl_found="no"]) if test "$sdl_found" = yes; then - CPPFLAGS="$CPPFLAGS $SDL_CFLAGS" - CFLAGS="$CFLAGS $SDL_CFLAGS" - LIBS="$LIBS $SDL_LIBS" + WZ_CPPFLAGS="$CPPFLAGS $SDL_CFLAGS" + WZ_CFLAGS="$CFLAGS $SDL_CFLAGS" + WZ_LIBS="$WZ_LIBS $SDL_LIBS" else AC_MSG_ERROR([You need to install SDL (http://www.libsdl.org/).]) fi AC_PATH_SDLNET([ - CPPFLAGS="$CPPFLAGS $SDLNETINC" LIBS="$LIBS $SDLNETLIB"], + WZ_CPPFLAGS="$WZ_CPPFLAGS $SDLNETINC" WZ_LIBS="$WZ_LIBS $SDLNETLIB"], AC_MSG_ERROR(SDL_net is not installed)) if test "x$opengl" != xno; then @@ -121,7 +131,7 @@ AC_CHECK_LIB(jpeg, main, , [AC_MSG_ERROR([You need to install the jpeg library.] AC_MSG_CHECKING([OpenGL]) if test "x$opengl" = xyes; then AC_DEFINE(WZ_OPENGL, 1, [OpenGL acceleration]) - LIBS="$LIBS -l$GLLIB -ljpeg" + WZ_LIBS="$WZ_LIBS -l$GLLIB -ljpeg" AC_SUBST(RENDERER, "ivis_opengl") AC_MSG_RESULT([yes]) else @@ -134,6 +144,8 @@ if test "x$openal" != xno; then AL_lib=yes AC_CHECK_LIB(openal, main, ALLIB=openal, [AC_CHECK_LIB(openal32, main, ALLIB=openal32, AL_lib=no)]) + # On Windows (and perhaps some other platforms), Alut is a separate library + AC_CHECK_LIB(alut, main, ALUTLIB="-lalut", ALUTLIB="") if test "x$AL_lib" = "xno"; then if test "x$openal" = xyes; then AC_MSG_ERROR([You need to install OpenAL.]) @@ -154,7 +166,7 @@ if test "x$openal" != xno; then fi AC_MSG_CHECKING([OpenAL]) if test "x$openal" = xyes; then - LIBS="$LIBS -l$ALLIB" + WZ_LIBS="$WZ_LIBS -l$ALLIB $ALUTLIB" AC_DEFINE(WZ_OPENAL, 1, [OpenAL support]) AC_MSG_RESULT([yes]) else @@ -177,7 +189,7 @@ else if test "x$have_vorbis" = "xyes" then oggmusic=yes - LIBS="$LIBS -lvorbisfile -lvorbis -logg" + WZ_LIBS="$WZ_LIBS -lvorbisfile -lvorbis -logg" else AC_DEFINE(WZ_NOOGG, 1, [Disable ogg vorbis support]) fi @@ -204,14 +216,11 @@ fi # -m32 forces 32-bit compile, since code is not clean enough for 64-bit yet CFLAGS="$CFLAGS -Wall -DYY_STATIC -m32" -# windows conditional -case $host_os in - *mingw32* ) MINGW32=yes;; - * ) MINGW32=no;; -esac -if test x"$MINGW32" = "xyes"; then - AC_DEFINE(WIN32, 1, [Windows build]) -fi +# only now set the LIBS/CFLAGS/CPPFLAGS lines, if set earlier it will give +# strange error messages when something is wrong +LIBS="$LIBS $WZ_LIBS" +CFLAGS="$CFLAGS $WZ_CFLAGS" +CPPFLAGS="$CPPFLAGS $WZ_CPPFLAGS" AC_CONFIG_FILES([Makefile lib/Makefile