build: Add SDL2_image detection.
[guile-sdl2.git] / configure.ac
1 # -*- Autoconf -*-
2 #
3 # guile-sdl2 --- FFI bindings for SDL2
4 # Copyright © 2015 David Thompson <davet@gnu.org>
5 #
6 # This file is part of guile-sdl2.
7 #
8 # Guile-sdl2 is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU Lesser General Public License as
10 # published by the Free Software Foundation; either version 3 of the
11 # License, or (at your option) any later version.
12 #
13 # Guile-sdl2 is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
17 #
18 # You should have received a copy of the GNU Lesser General Public
19 # License along with guile-sdl2. If not, see
20 # <http://www.gnu.org/licenses/>.
21
22 AC_INIT(guile-sdl2, 0.1)
23 AC_CONFIG_SRCDIR(sdl2)
24 AC_CONFIG_AUX_DIR([build-aux])
25 AM_INIT_AUTOMAKE([color-tests -Wall -Wno-portability foreign])
26 AM_SILENT_RULES([yes])
27
28 AC_CONFIG_FILES([Makefile sdl2/config.scm])
29 AC_CONFIG_FILES([pre-inst-env], [chmod +x pre-inst-env])
30
31 GUILE_PROGS([2.0.9])
32
33 # Core SDL2
34 PKG_CHECK_MODULES([SDL2], [sdl2])
35
36 LIBSDL2="libSDL2"
37 LIBSDL2_LIBDIR="no"
38 LIBSDL2_PREFIX="no"
39
40 AC_ARG_WITH([libsdl2-prefix],
41 [AS_HELP_STRING([--with-libsdl2-prefix=DIR], [search for SDL2 in DIR])],
42 [case "$withval" in
43 yes|no)
44 ;;
45 *)
46 LIBSDL2="$withval/lib/libSDL2"
47 LIBSDL2_PREFIX="$withval"
48 LIBSDL2_LIBDIR="$withval/lib"
49 ;;
50 esac])
51
52 dnl Library name suitable for `dynamic-link'.
53 AC_MSG_CHECKING([for libSDL2 shared library name])
54 AC_MSG_RESULT([$LIBSDL2])
55 AC_SUBST([LIBSDL2])
56 AC_SUBST([LIBSDL2_PREFIX])
57 AC_SUBST([LIBSDL2_LIBDIR])
58
59 # SDL2_image
60 AC_ARG_WITH([libsdl2_image],
61 AS_HELP_STRING([--with-libsdl2-image],
62 [Build with the SDL2_image library]),
63 [], [with_libsdl2_image=yes])
64
65
66 if test "x$with_libsdl2_image" = "xyes"; then
67 PKG_CHECK_MODULES([SDL2_image], [SDL2_image])
68 fi
69
70 LIBSDL2_IMAGE="libSDL2_image"
71 LIBSDL2_IMAGE_LIBDIR="no"
72 LIBSDL2_IMAGE_PREFIX="no"
73
74 AC_ARG_WITH([libsdl2-image-prefix],
75 [AS_HELP_STRING([--with-libsdl2-image-prefix=DIR],
76 [search for SDL2_image in DIR])],
77 [case "$withval" in
78 yes|no)
79 ;;
80 *)
81 LIBSDL2_IMAGE="$withval/lib/libSDL2_image"
82 LIBSDL2_IMAGE_PREFIX="$withval"
83 LIBSDL2_IMAGE_LIBDIR="$withval/lib"
84 ;;
85 esac])
86
87 AM_CONDITIONAL([WITH_LIBSDL2_IMAGE], [test "x$with_libsdl2_image" = "xyes"])
88
89 if test "x$with_libsdl2_image" = "xyes"; then
90 AC_MSG_CHECKING([for libSDL2_image shared library name])
91 AC_MSG_RESULT([$LIBSDL2_IMAGE])
92 fi
93
94 AC_SUBST([LIBSDL2_IMAGE])
95 AC_SUBST([LIBSDL2_IMAGE_PREFIX])
96 AC_SUBST([LIBSDL2_IMAGE_LIBDIR])
97
98 AC_OUTPUT