summaryrefslogtreecommitdiff
path: root/acinclude.m4
diff options
context:
space:
mode:
authorJames Haley2010-01-26 00:59:02 +0000
committerJames Haley2010-01-26 00:59:02 +0000
commitb80409202d07732ec201c9816887262b505b81d4 (patch)
tree364dcb86f2c22411a720447bfa21c4de9191ff6f /acinclude.m4
parent66e8dc63bd0b384c99f0d0ff60b3d75c42d441b1 (diff)
parent8f6edc1f7402215c5e38d1f03939ce6b5ff5e3ae (diff)
downloadchocolate-doom-b80409202d07732ec201c9816887262b505b81d4.tar.gz
chocolate-doom-b80409202d07732ec201c9816887262b505b81d4.tar.bz2
chocolate-doom-b80409202d07732ec201c9816887262b505b81d4.zip
Merge from raven-branch
Subversion-branch: /branches/strife-branch Subversion-revision: 1825
Diffstat (limited to 'acinclude.m4')
-rw-r--r--acinclude.m436
1 files changed, 36 insertions, 0 deletions
diff --git a/acinclude.m4 b/acinclude.m4
new file mode 100644
index 00000000..ed7e4d31
--- /dev/null
+++ b/acinclude.m4
@@ -0,0 +1,36 @@
+
+dnl
+dnl SDL workaround autoconf macros, by Simon Howard.
+dnl I release the contents of this file to the public domain.
+dnl
+
+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"
+])
+