3 dnl SDL workaround autoconf macros, by Simon Howard.
4 dnl I release the contents of this file to the public domain.
7 dnl Macro to check if autoconf's compile tests have been broken by
8 dnl SDL. Tries to build the simplest possible program, and if it
9 dnl fails, calls the given block.
11 AC_DEFUN([AC_CHECK_SDL_BREAKAGE], [
12 AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [], [
17 dnl Macro to work around SDL redefining main. The provided block
18 dnl is run with main #defined to SDL_main via a compiler switch
19 dnl if autoconf tests are found to be broken.
21 AC_DEFUN([AC_SDL_MAIN_WORKAROUND], [
22 sdl_workaround_saved_CFLAGS="$CFLAGS"
24 AC_CHECK_SDL_BREAKAGE([
25 CFLAGS="$CFLAGS -Dmain=SDL_main"
28 AC_CHECK_SDL_BREAKAGE([
29 AC_MSG_ERROR([Autoconf checks broken by SDL, and can't figure out how to fix them.])
34 CFLAGS="$sdl_workaround_saved_CFLAGS"