build: Add SDL2_image detection.
authorDavid Thompson <dthompson2@worcester.edu>
Thu, 17 Dec 2015 03:51:16 +0000 (22:51 -0500)
committerDavid Thompson <dthompson2@worcester.edu>
Thu, 17 Dec 2015 04:15:09 +0000 (23:15 -0500)
configure.ac
sdl2/config.scm.in

index 5d25c46..2aa1696 100644 (file)
@@ -29,6 +29,8 @@ AC_CONFIG_FILES([Makefile sdl2/config.scm])
 AC_CONFIG_FILES([pre-inst-env], [chmod +x pre-inst-env])
 
 GUILE_PROGS([2.0.9])
+
+# Core SDL2
 PKG_CHECK_MODULES([SDL2], [sdl2])
 
 LIBSDL2="libSDL2"
@@ -54,4 +56,43 @@ AC_SUBST([LIBSDL2])
 AC_SUBST([LIBSDL2_PREFIX])
 AC_SUBST([LIBSDL2_LIBDIR])
 
+# SDL2_image
+AC_ARG_WITH([libsdl2_image],
+  AS_HELP_STRING([--with-libsdl2-image],
+                 [Build with the SDL2_image library]),
+  [], [with_libsdl2_image=yes])
+
+
+if test "x$with_libsdl2_image" = "xyes"; then
+   PKG_CHECK_MODULES([SDL2_image], [SDL2_image])
+fi
+
+LIBSDL2_IMAGE="libSDL2_image"
+LIBSDL2_IMAGE_LIBDIR="no"
+LIBSDL2_IMAGE_PREFIX="no"
+
+AC_ARG_WITH([libsdl2-image-prefix],
+  [AS_HELP_STRING([--with-libsdl2-image-prefix=DIR],
+                  [search for SDL2_image in DIR])],
+  [case "$withval" in
+    yes|no)
+      ;;
+    *)
+      LIBSDL2_IMAGE="$withval/lib/libSDL2_image"
+      LIBSDL2_IMAGE_PREFIX="$withval"
+      LIBSDL2_IMAGE_LIBDIR="$withval/lib"
+      ;;
+   esac])
+
+AM_CONDITIONAL([WITH_LIBSDL2_IMAGE], [test "x$with_libsdl2_image" = "xyes"])
+
+if test "x$with_libsdl2_image" = "xyes"; then
+   AC_MSG_CHECKING([for libSDL2_image shared library name])
+   AC_MSG_RESULT([$LIBSDL2_IMAGE])
+fi
+
+AC_SUBST([LIBSDL2_IMAGE])
+AC_SUBST([LIBSDL2_IMAGE_PREFIX])
+AC_SUBST([LIBSDL2_IMAGE_LIBDIR])
+
 AC_OUTPUT
index 4ab9a06..99d8be9 100644 (file)
@@ -1,5 +1,9 @@
 (define-module (sdl2 config)
-  #:export (%libsdl2))
+  #:export (%libsdl2
+            %libsdl2-image))
 
 (define %libsdl2
   "@LIBSDL2@")
+
+(define %libsdl2-image
+  "@LIBSDL2_IMAGE@")