aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac36
1 files changed, 15 insertions, 21 deletions
diff --git a/configure.ac b/configure.ac
index f74eefb..69ca562 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8,27 +8,21 @@ AM_INIT_AUTOMAKE([foreign subdir-objects])
AC_CONFIG_FILES([Makefile])
SDL_VERSION=2.0
-AM_PATH_SDL2($SDL_VERSION,
- :,
- AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
-)
-AC_CANONICAL_HOST
-AS_CASE(["$host_os"],
- [linux-gnu], [
- DEPS_CFLAGS="$SDL_CFLAGS"
- DEPS_LIBS="$SDL_LIBS"
- ],
- [mingw32], [
- DEPS_CFLAGS="-Ix86_64-w64-mingw32/include/SDL2"
- DEPS_LIBS="-Lx86_64-w64-mingw32/lib -lSDL2 -municode"
- AC_DEFINE([__WINDOWS__], [], [Compile for Windows])
- ],
- [*], [
- AC_MSG_ERROR([Unsupported OS.])
- ]
-)
-AC_SUBST([DEPS_CFLAGS])
-AC_SUBST([DEPS_LIBS])
+AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
+ sdl_prefix="$withval", sdl_prefix="")
+AS_IF([test "x$sdl_prefix" = x], [
+ PKG_CHECK_MODULES([SDL], [sdl2 >= $SDL_VERSION], [sdl_loaded=yes])
+ ], [
+ sdl_config="$sdl_prefix/bin/sdl2-config"
+ SDL_CFLAGS=`"$sdl_config" --prefix="$sdl_prefix" --cflags`
+ SDL_LIBS=`"$sdl_config" --prefix="$sdl_prefix" --libs`
+ sdl_loaded=yes # TODO: check if sdl is present, check version
+ ])
+AS_IF([test "x$sdl_loaded" != xyes], [AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])])
+DEPS_CFLAGS="$SDL_CFLAGS"
+DEPS_LIBS="$SDL_LIBS"
+AC_SUBST(DEPS_CFLAGS)
+AC_SUBST(DEPS_LIBS)
# AC_DEFINE([ENABLE_NCURSES], [], [Enable ncurses])
# AC_CHECK_LIB([ncurses], [initscr])