summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--acinclude.m431
-rw-r--r--configure.in52
-rw-r--r--wince/Makefile.am2
-rw-r--r--wince/dummy.c8
4 files changed, 73 insertions, 20 deletions
diff --git a/acinclude.m4 b/acinclude.m4
new file mode 100644
index 00000000..ac54f4b9
--- /dev/null
+++ b/acinclude.m4
@@ -0,0 +1,31 @@
+
+dnl Macro to check if autoconf's compile tests have been broken by
+dnl SDL. Tries to build the simplest possible program, and if it
+dnl fails, calls the given block.
+
+AC_DEFUN([AC_CHECK_SDL_BREAKAGE], [
+ AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [], [
+ $1
+ ])
+])
+
+dnl Macro to work around SDL redefining main. The provided block
+dnl is run with main #defined to SDL_main via a compiler switch
+dnl if autoconf tests are found to be broken.
+
+AC_DEFUN([AC_SDL_MAIN_WORKAROUND], [
+ sdl_workaround_saved_CFLAGS="$CFLAGS"
+
+ AC_CHECK_SDL_BREAKAGE([
+ CFLAGS="$CFLAGS -Dmain=SDL_main"
+ ])
+
+ AC_CHECK_SDL_BREAKAGE([
+ AC_MSG_ERROR([Autoconf checks broken by SDL, and can't figure out how to fix them.])
+ ])
+
+ $1
+
+ CFLAGS="$sdl_workaround_saved_CFLAGS"
+])
+
diff --git a/configure.in b/configure.in
index 4b29cee5..f77d6ebd 100644
--- a/configure.in
+++ b/configure.in
@@ -39,20 +39,42 @@ AM_PATH_SDL(1.1.3)
CFLAGS="$CFLAGS $SDL_CFLAGS"
LDFLAGS="$LDFLAGS $SDL_LIBS"
-AC_CHECK_LIB(SDL_mixer,Mix_LoadMUS,[
- SDLMIXER_LIBS="$SDLMIXER_LIBS -lSDL_mixer"
-],[
- echo "*** Could not find SDL_mixer. Please install it."
- exit -1
-])
+# On some platforms, SDL renames main() to SDL_main() using a #define,
+# so that its own main, stored in the SDLmain library, can be run first.
+# Unfortunately, this causes problems for autoconf, which builds
+# test programs to probe the system. All library/header/symbol checks
+# must be run in this block, that performs a workaround for the problem.
+
+AC_SDL_MAIN_WORKAROUND([
+
+ # Check for SDL_mixer.
+
+ AC_CHECK_LIB(SDL_mixer,Mix_LoadMUS,[
+ SDLMIXER_LIBS="$SDLMIXER_LIBS -lSDL_mixer"
+ ],[
+ echo "*** Could not find SDL_mixer. Please install it."
+ exit -1
+ ])
+
+ # Check for SDL_net.
+
+ AC_CHECK_LIB(SDL_net,SDLNet_UDP_Send,[
+ SDLNET_LIBS="$SDLNET_LIBS -lSDL_net"
+ ],[
+ echo "*** Could not find SDL_net. Please install it."
+ exit -1
+ ])
+
+ # Check for libsamplerate.
-AC_CHECK_LIB(SDL_net,SDLNet_UDP_Send,[
- SDLNET_LIBS="$SDLNET_LIBS -lSDL_net"
-],[
- echo "*** Could not find SDL_net. Please install it."
- exit -1
+ AC_CHECK_LIB(samplerate, src_new)
+
+ AC_CHECK_HEADERS([linux/kd.h dev/isa/spkrio.h dev/speaker/speaker.h])
+ AC_CHECK_FUNCS(mmap sched_setaffinity)
])
+AC_CHECK_TOOL(WINDRES, windres, )
+
# Windows CE build?
WINDOWS_CE=false
@@ -66,14 +88,6 @@ case "$host" in
;;
esac
-AC_CHECK_HEADERS([linux/kd.h dev/isa/spkrio.h dev/speaker/speaker.h])
-AC_CHECK_FUNCS(mmap sched_setaffinity)
-
-# DWF 2008-02-10: FIXME
-AC_CHECK_LIB(samplerate, src_new)
-
-AC_CHECK_TOOL(WINDRES, windres, )
-
AM_CONDITIONAL(WINDOWS_CE, $WINDOWS_CE)
AM_CONDITIONAL(HAVE_WINDRES, test "$WINDRES" != "")
AM_CONDITIONAL(HAVE_PYTHON, $HAVE_PYTHON)
diff --git a/wince/Makefile.am b/wince/Makefile.am
index 7d694377..476b9a67 100644
--- a/wince/Makefile.am
+++ b/wince/Makefile.am
@@ -10,7 +10,7 @@ libc_wince_a_SOURCES = \
else
-libc_wince_a_SOURCES =
+libc_wince_a_SOURCES = dummy.c
endif
diff --git a/wince/dummy.c b/wince/dummy.c
new file mode 100644
index 00000000..68af0caa
--- /dev/null
+++ b/wince/dummy.c
@@ -0,0 +1,8 @@
+
+// Dummy source file so that the Windows CE workaround library is
+// not empty. Some platforms don't like empty libraries.
+
+void DummyWindowsCEFunction(void)
+{
+}
+