diff options
author | Simon Howard | 2009-09-10 20:28:59 +0000 |
---|---|---|
committer | Simon Howard | 2009-09-10 20:28:59 +0000 |
commit | 100b658b470ecaf9ff5e2c3407bfff224e91fb01 (patch) | |
tree | b04f71ab6203c38f7a5f9039c8ad0b69ac280848 /acinclude.m4 | |
parent | ba1accec2394c6ee70c5c79a42827099ef20e638 (diff) | |
parent | be3bba2a1cf9551778683e25f61bffc7c187f93c (diff) | |
download | chocolate-doom-100b658b470ecaf9ff5e2c3407bfff224e91fb01.tar.gz chocolate-doom-100b658b470ecaf9ff5e2c3407bfff224e91fb01.tar.bz2 chocolate-doom-100b658b470ecaf9ff5e2c3407bfff224e91fb01.zip |
Merge from trunk.
Subversion-branch: /branches/opl-branch
Subversion-revision: 1662
Diffstat (limited to 'acinclude.m4')
-rw-r--r-- | acinclude.m4 | 31 |
1 files changed, 31 insertions, 0 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" +]) + |