549e0ebf1ea4595dad24e8ce020b5de96f98ad94
[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.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_PKG([2.2 2.0])
32 GUILE_PROGS
33
34 # Core SDL2
35 PKG_CHECK_MODULES([SDL2], [sdl2])
36
37 LIBSDL2="libSDL2"
38 LIBSDL2_LIBDIR="no"
39 LIBSDL2_PREFIX="no"
40
41 AC_ARG_WITH([libsdl2-prefix],
42 [AS_HELP_STRING([--with-libsdl2-prefix=DIR], [search for SDL2 in DIR])],
43 [case "$withval" in
44 yes|no)
45 ;;
46 *)
47 LIBSDL2="$withval/lib/libSDL2"
48 LIBSDL2_PREFIX="$withval"
49 LIBSDL2_LIBDIR="$withval/lib"
50 ;;
51 esac])
52
53 dnl Library name suitable for `dynamic-link'.
54 AC_MSG_CHECKING([for libSDL2 shared library name])
55 AC_MSG_RESULT([$LIBSDL2])
56 AC_SUBST([LIBSDL2])
57 AC_SUBST([LIBSDL2_PREFIX])
58 AC_SUBST([LIBSDL2_LIBDIR])
59
60 # SDL2_image
61 AC_ARG_WITH([libsdl2_image],
62 AS_HELP_STRING([--with-libsdl2-image],
63 [Build with the SDL2_image library]),
64 [], [with_libsdl2_image=yes])
65
66
67 if test "x$with_libsdl2_image" = "xyes"; then
68 PKG_CHECK_MODULES([SDL2_image], [SDL2_image])
69 fi
70
71 LIBSDL2_IMAGE="libSDL2_image"
72 LIBSDL2_IMAGE_LIBDIR="no"
73 LIBSDL2_IMAGE_PREFIX="no"
74
75 AC_ARG_WITH([libsdl2-image-prefix],
76 [AS_HELP_STRING([--with-libsdl2-image-prefix=DIR],
77 [search for SDL2_image in DIR])],
78 [case "$withval" in
79 yes|no)
80 ;;
81 *)
82 LIBSDL2_IMAGE="$withval/lib/libSDL2_image"
83 LIBSDL2_IMAGE_PREFIX="$withval"
84 LIBSDL2_IMAGE_LIBDIR="$withval/lib"
85 ;;
86 esac])
87
88 AM_CONDITIONAL([WITH_LIBSDL2_IMAGE], [test "x$with_libsdl2_image" = "xyes"])
89
90 if test "x$with_libsdl2_image" = "xyes"; then
91 AC_MSG_CHECKING([for libSDL2_image shared library name])
92 AC_MSG_RESULT([$LIBSDL2_IMAGE])
93 fi
94
95 AC_SUBST([LIBSDL2_IMAGE])
96 AC_SUBST([LIBSDL2_IMAGE_PREFIX])
97 AC_SUBST([LIBSDL2_IMAGE_LIBDIR])
98
99 # SDL2_ttf
100 AC_ARG_WITH([libsdl2_ttf],
101 AS_HELP_STRING([--with-libsdl2-ttf],
102 [Build with the SDL2_ttf library]),
103 [], [with_libsdl2_ttf=yes])
104
105 if test "x$with_libsdl2_ttf" = "xyes"; then
106 PKG_CHECK_MODULES([SDL2_ttf], [SDL2_ttf])
107 fi
108
109 LIBSDL2_TTF="libSDL2_ttf"
110 LIBSDL2_TTF_LIBDIR="no"
111 LIBSDL2_TTF_PREFIX="no"
112
113 AC_ARG_WITH([libsdl2-ttf-prefix],
114 [AS_HELP_STRING([--with-libsdl2-ttf-prefix=DIR],
115 [search for SDL2_ttf in DIR])],
116 [case "$withval" in
117 yes|no)
118 ;;
119 *)
120 LIBSDL2_TTF="$withval/lib/libSDL2_ttf"
121 LIBSDL2_TTF_PREFIX="$withval"
122 LIBSDL2_TTF_LIBDIR="$withval/lib"
123 ;;
124 esac])
125
126 AM_CONDITIONAL([WITH_LIBSDL2_TTF], [test "x$with_libsdl2_ttf" = "xyes"])
127
128 if test "x$with_libsdl2_ttf" = "xyes"; then
129 AC_MSG_CHECKING([for libSDL2_ttf shared library name])
130 AC_MSG_RESULT([$LIBSDL2_TTF])
131 fi
132
133 AC_SUBST([LIBSDL2_TTF])
134 AC_SUBST([LIBSDL2_TTF_PREFIX])
135 AC_SUBST([LIBSDL2_TTF_LIBDIR])
136
137 # SDL2_mixer
138 AC_ARG_WITH([libsdl2_mixer],
139 AS_HELP_STRING([--with-libsdl2-mixer],
140 [Build with the SDL2_mixer library]),
141 [], [with_libsdl2_mixer=yes])
142
143 if test "x$with_libsdl2_mixer" = "xyes"; then
144 PKG_CHECK_MODULES([SDL2_mixer], [SDL2_mixer])
145 fi
146
147 LIBSDL2_MIXER="libSDL2_mixer"
148 LIBSDL2_MIXER_LIBDIR="no"
149 LIBSDL2_MIXER_PREFIX="no"
150
151 AC_ARG_WITH([libsdl2-mixer-prefix],
152 [AS_HELP_STRING([--with-libsdl2-mixer-prefix=DIR],
153 [search for SDL2_mixer in DIR])],
154 [case "$withval" in
155 yes|no)
156 ;;
157 *)
158 LIBSDL2_MIXER="$withval/lib/libSDL2_mixer"
159 LIBSDL2_MIXER_PREFIX="$withval"
160 LIBSDL2_MIXER_LIBDIR="$withval/lib"
161 ;;
162 esac])
163
164 AM_CONDITIONAL([WITH_LIBSDL2_MIXER], [test "x$with_libsdl2_mixer" = "xyes"])
165
166 if test "x$with_libsdl2_mixer" = "xyes"; then
167 AC_MSG_CHECKING([for libSDL2_mixer shared library name])
168 AC_MSG_RESULT([$LIBSDL2_MIXER])
169 fi
170
171 AC_SUBST([LIBSDL2_MIXER])
172 AC_SUBST([LIBSDL2_MIXER_PREFIX])
173 AC_SUBST([LIBSDL2_MIXER_LIBDIR])
174
175 AC_OUTPUT