build: Add SDL2_image detection.
[guile-sdl2.git] / configure.ac
CommitLineData
9ce20c40
DT
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
22AC_INIT(guile-sdl2, 0.1)
23AC_CONFIG_SRCDIR(sdl2)
24AC_CONFIG_AUX_DIR([build-aux])
25AM_INIT_AUTOMAKE([color-tests -Wall -Wno-portability foreign])
26AM_SILENT_RULES([yes])
27
28AC_CONFIG_FILES([Makefile sdl2/config.scm])
29AC_CONFIG_FILES([pre-inst-env], [chmod +x pre-inst-env])
30
31GUILE_PROGS([2.0.9])
1de096a7
DT
32
33# Core SDL2
9ce20c40
DT
34PKG_CHECK_MODULES([SDL2], [sdl2])
35
36LIBSDL2="libSDL2"
37LIBSDL2_LIBDIR="no"
38LIBSDL2_PREFIX="no"
39
40AC_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
52dnl Library name suitable for `dynamic-link'.
53AC_MSG_CHECKING([for libSDL2 shared library name])
54AC_MSG_RESULT([$LIBSDL2])
55AC_SUBST([LIBSDL2])
56AC_SUBST([LIBSDL2_PREFIX])
57AC_SUBST([LIBSDL2_LIBDIR])
58
1de096a7
DT
59# SDL2_image
60AC_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
66if test "x$with_libsdl2_image" = "xyes"; then
67 PKG_CHECK_MODULES([SDL2_image], [SDL2_image])
68fi
69
70LIBSDL2_IMAGE="libSDL2_image"
71LIBSDL2_IMAGE_LIBDIR="no"
72LIBSDL2_IMAGE_PREFIX="no"
73
74AC_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
87AM_CONDITIONAL([WITH_LIBSDL2_IMAGE], [test "x$with_libsdl2_image" = "xyes"])
88
89if test "x$with_libsdl2_image" = "xyes"; then
90 AC_MSG_CHECKING([for libSDL2_image shared library name])
91 AC_MSG_RESULT([$LIBSDL2_IMAGE])
92fi
93
94AC_SUBST([LIBSDL2_IMAGE])
95AC_SUBST([LIBSDL2_IMAGE_PREFIX])
96AC_SUBST([LIBSDL2_IMAGE_LIBDIR])
97
9ce20c40 98AC_OUTPUT