Don't crash if key settings are set in a configuration file that are out of range...
[chocolate-doom.git] / acinclude.m4
blobed7e4d31b5c1d9a5fc883f49633c2fe2669645e1
2 dnl
3 dnl SDL workaround autoconf macros, by Simon Howard.
4 dnl I release the contents of this file to the public domain.
5 dnl
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([], []), [], [
13         $1
14     ])
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"
26     ])
28     AC_CHECK_SDL_BREAKAGE([
29         AC_MSG_ERROR([Autoconf checks broken by SDL, and can't figure out how to fix them.])
30     ])
32     $1
34     CFLAGS="$sdl_workaround_saved_CFLAGS"