ref: a0062502d183d5d526c1f801b1206234b664898b
parent: 3fd9acf6e0d664858162ac369ae8670f40edea11
author: Simon Howard <[email protected]>
date: Tue Dec 9 14:56:43 EST 2008
Add SDL_CFLAGS, SDL_LDFLAGS to default compile flags, and check for SDL in configure before checking for libraries and headers, to fix Windows. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1412
--- a/configure.in
+++ b/configure.in
@@ -7,7 +7,6 @@
AC_PROG_CC
AC_PROG_RANLIB
AC_CHECK_PROG(HAVE_PYTHON, python, true, false)
-AC_CHECK_FUNCS(mmap)
OPT_LEVEL=2
@@ -25,17 +24,27 @@
CFLAGS="-O$OPT_LEVEL -g -Wall $orig_CFLAGS"
fi
-AC_CHECK_HEADERS([linux/kd.h dev/isa/spkrio.h dev/speaker/speaker.h])
+dnl Search for SDL ...
AM_PATH_SDL(1.1.3)
+# Add the SDL compiler flags to the default compiler flag variables.
+# It is important to do this now, before checking for headers and
+# library functions. The reason being that on Windows, sdl-config
+# sets the -mno-cygwin compiler option in order to generate MinGW
+# executables. If we don't do this now, we might end up discovering
+# header files that are not actually available to us when we come
+# to compile.
+
+CFLAGS="$CFLAGS $SDL_CFLAGS"
+LDFLAGS="$LDFLAGS $SDL_LIBS"
+
AC_CHECK_LIB(SDL_mixer,Mix_LoadMUS,[
-dnl AC_DEFINE(HAVE_LIBSDL_MIXER)
SDLMIXER_LIBS="$SDLMIXER_LIBS -lSDL_mixer"
],[
echo "*** Could not find SDL_mixer. Please install it."
exit -1
-],$SDL_LIBS $SDLMIXER_LIBS)
+])
AC_CHECK_LIB(SDL_net,SDLNet_UDP_Send,[
SDLNET_LIBS="$SDLNET_LIBS -lSDL_net"
@@ -42,7 +51,10 @@
],[
echo "*** Could not find SDL_net. Please install it."
exit -1
-] ,$SDL_LIBS $SDLNET_LIBS)
+])
+
+AC_CHECK_HEADERS([linux/kd.h dev/isa/spkrio.h dev/speaker/speaker.h])
+AC_CHECK_FUNCS(mmap)
# DWF 2008-02-10: FIXME
AC_CHECK_LIB(samplerate, src_new)
--- a/pcsound/Makefile.am
+++ b/pcsound/Makefile.am
@@ -1,5 +1,5 @@
-AM_CFLAGS= @SDL_CFLAGS@ @SDLMIXER_CFLAGS@
+AM_CFLAGS=@SDLMIXER_CFLAGS@
noinst_LIBRARIES=libpcsound.a
--- a/setup/Makefile.am
+++ b/setup/Makefile.am
@@ -1,11 +1,10 @@
gamesdir = $(prefix)/games
-AM_CFLAGS = @SDL_CFLAGS@ -I../textscreen -I../src -DINSTALL_DIR="\"$(gamesdir)\""
+AM_CFLAGS = -I../textscreen -I../src -DINSTALL_DIR="\"$(gamesdir)\""
games_PROGRAMS = chocolate-setup
-chocolate_setup_LDADD = ../textscreen/libtextscreen.a @LDFLAGS@ @SDL_LIBS@
SOURCE_FILES = \
compatibility.c compatibility.h \
configfile.c configfile.h \
@@ -31,6 +30,8 @@
else
chocolate_setup_SOURCES=$(SOURCE_FILES)
endif
+
+chocolate_setup_LDADD = ../textscreen/libtextscreen.a @LDFLAGS@
.rc.o:
$(WINDRES) $^ -o $@
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,7 +3,7 @@
games_PROGRAMS = chocolate-doom chocolate-server
-AM_CFLAGS = -I../textscreen -I../pcsound @SDL_CFLAGS@ @SDLMIXER_CFLAGS@ @SDLNET_CFLAGS@
+AM_CFLAGS = -I../textscreen -I../pcsound @SDLMIXER_CFLAGS@ @SDLNET_CFLAGS@
DEDSERV_FILES=\
d_dedicated.c \
@@ -21,7 +21,7 @@
z_native.c z_zone.h
chocolate_server_SOURCES=$(DEDSERV_FILES)
-chocolate_server_LDADD = @LDFLAGS@ @SDL_LIBS@ @SDLNET_LIBS@
+chocolate_server_LDADD = @LDFLAGS@ @SDLNET_LIBS@
MAIN_SOURCE_FILES=\
am_map.c am_map.h \
@@ -169,7 +169,12 @@
chocolate_doom_SOURCES=$(SOURCE_FILES)
endif
-chocolate_doom_LDADD = ../textscreen/libtextscreen.a ../pcsound/libpcsound.a @LDFLAGS@ @SDL_LIBS@ @SDLMIXER_LIBS@ @SDLNET_LIBS@
+chocolate_doom_LDADD = \
+ ../textscreen/libtextscreen.a \
+ ../pcsound/libpcsound.a \
+ @LDFLAGS@ \
+ @SDLMIXER_LIBS@ \
+ @SDLNET_LIBS@
EXTRA_DIST = \
icon.c \
--- a/textscreen/Makefile.am
+++ b/textscreen/Makefile.am
@@ -1,5 +1,5 @@
-AM_CFLAGS = @SDL_CFLAGS@ -I../src
+AM_CFLAGS = -I../src
# build this directory before the examples directory.
--- a/textscreen/examples/Makefile.am
+++ b/textscreen/examples/Makefile.am
@@ -1,5 +1,5 @@
-AM_CFLAGS = @SDL_CFLAGS@ -I.. -I../../src
+AM_CFLAGS = -I.. -I../../src
noinst_PROGRAMS=guitest calculator