Skip to content

Instantly share code, notes, and snippets.

@revmischa
Last active February 9, 2019 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save revmischa/b96401d51e9af90bb8e51e955435200e to your computer and use it in GitHub Desktop.
Save revmischa/b96401d51e9af90bb8e51e955435200e to your computer and use it in GitHub Desktop.
Autoconf m4 to check if minimum SDL library version exists
# SDL
AC_ARG_ENABLE([sdl], AS_HELP_STRING([--enable-sdl], [Build SDL2 application]), [], [enable_sdl=check])
AS_IF([test "$enable_sdl" != "no"], [
m4_include([m4/sdl2.m4])
SDL_VERSION="2.0.5"
AS_IF([test "$TRAVIS"], [SDL_VERSION=2.0.2]) # travis has old SDL, we don't care
AS_IF([test "$EMSCRIPTEN"], [SDL_VERSION=2.0.0]) # emscripten has old SDL, we don't care
# Check for libSDL >= $SDL_VERSION
found_sdl=no
AM_PATH_SDL2($SDL_VERSION,
[found_sdl=yes; enable_sdl=yes],
[:])
AC_MSG_CHECKING(SDL2 >= $SDL_VERSION)
AS_IF([test "$found_sdl" = "yes"], AC_MSG_RESULT([yes]), AC_MSG_RESULT(no))
# blow up if user asked for SDL and we don't have it
AS_IF([test "$enable_sdl" = "yes" && test "$found_sdl" = "no"], AC_MSG_ERROR([*** SDL version >= $SDL_VERSION not found!]))
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment