1 # Copyright 2008 David Hilvert <dhilvert@gmail.com>
3 # This file is part of libale.
5 # libale is free software: you can redistribute it and/or modify it under the
6 # terms of the GNU Affero General Public License as published by the Free
7 # Software Foundation, either version 3 of the License, or (at your option)
10 # libale is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 # FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
15 # You should have received a copy of the GNU Affero General Public License
16 # along with libale. If not, see <http://www.gnu.org/licenses/>.
23 AC_INIT(libale,translit(m4_include(VERSION),'
24 '), ale@ventricle.dyndns.org)
25 AC_CONFIG_SRCDIR([include/ale.h])
26 AC_CONFIG_HEADER([config.h])
45 AC_CHECK_HEADER([stdint.h])
46 AC_CHECK_HEADER([inttypes.h])
54 if test "x$no_glut" = xyes; then
55 AC_MSG_ERROR([Usable GLUT configuration was not found.])
58 AC_CHECK_HEADER(GL/glew.h,, [AC_MSG_ERROR([Usable GLEW configuration was not found. (GL/glew.h not found)])])
59 AC_CHECK_LIB([GLEW], [glewInit], [GLEW_LIBS="-lGLEW"], [AC_MSG_ERROR([Usable GLEW configuration was not found. (GLEW library not found)])])
66 AC_CHECK_HEADER(libguile.h,, [AC_MSG_ERROR([Usable guile library was not found. (libguile.h not found)])])
71 AC_CHECK_DECL(scm_from_locale_string,, [AC_MSG_ERROR([Guile installation does not support scm_from_locale_string. (Try upgrading to Guile 1.8 or later.)])], [#include <libguile.h>])
78 # The following tests are taken from ALE's configure.in.
81 # Determine whether ImageMagick should be linked
82 AC_ARG_WITH(imagemagick, [ --with-imagemagick ImageMagick file handling: auto,no,yes (default=auto)])
83 if test x$with_imagemagick != xno; then
85 # AC_CHECK_TOOL is somewhat broken for cross-compilation in
86 # some versions of autoconf, so use a conditional instead.
88 if test x$host = x$build \
89 || test x$host = x; then
90 AC_CHECK_TOOL(MAGICK_CONFIG, Magick-config, no)
92 AC_CHECK_PROG(MAGICK_CONFIG, ${ac_tool_prefix}Magick-config, ${ac_tool_prefix}Magick-config, no)
95 if test x$MAGICK_CONFIG != xno; then
97 # Bugs have been encountered in certain versions of ImageMagick
98 # older than 6.0.6. Until a test is written to check for these
99 # bugs, check the version number instead.
101 IMAGEMAGICK_VERSION=`Magick-config --version`
102 IMAGEMAGICK_VERSION_A=`echo $IMAGEMAGICK_VERSION | cut -f 1 -d '.'`
103 IMAGEMAGICK_VERSION_B=`echo $IMAGEMAGICK_VERSION | cut -f 2 -d '.'`
104 IMAGEMAGICK_VERSION_C=`echo $IMAGEMAGICK_VERSION | cut -f 3 -d '.'`
106 if test -x `which GraphicsMagick-config` \
107 || test $IMAGEMAGICK_VERSION_A -gt 6 \
108 || ( test $IMAGEMAGICK_VERSION_A -eq 6 \
109 && test $IMAGEMAGICK_VERSION_B -gt 0 ) \
110 || ( test $IMAGEMAGICK_VERSION_A -eq 6 \
111 && test $IMAGEMAGICK_VERSION_B -eq 0 \
112 && test $IMAGEMAGICK_VERSION_C -ge 6 ); then
113 AC_DEFINE([HAVE_IMAGEMAGICK], [1],
114 [Use ImageMagick for file loading and saving.])
115 IMAGEMAGICK_CFLAGS=`$MAGICK_CONFIG --cflags`
116 IMAGEMAGICK_CPPFLAGS=`$MAGICK_CONFIG --cppflags`
117 IMAGEMAGICK_LDFLAGS=`$MAGICK_CONFIG --ldflags`
118 IMAGEMAGICK_LIBS=`$MAGICK_CONFIG --libs`
120 AC_MSG_WARN([not using ImageMagick older than 6.0.6 (found $IMAGEMAGICK_VERSION)])
124 IMAGEMAGICK_CFLAGS=""
125 IMAGEMAGICK_CPPFLAGS=""
126 IMAGEMAGICK_LDFLAGS=""
130 # Fatal error if user flag for ImageMagick could not be satisified
131 if test x$with_imagemagick = xyes \
132 && test x$IMAGEMAGICK_CPPFLAGS = x; then
133 AC_MSG_ERROR([ImageMagick build requested (--enable-imagemagick=yes), but no suitable version was found.])
138 ## Substitution variables
141 LIBALE_CFLAGS="$GLUT_CFLAGS $GUILE_CFLAGS $IMAGEMAGICK_CFLAGS $IMAGEMAGICK_CPPFLAGS"
142 LIBALE_LIBS="$GLUT_LIBS $GLEW_LIBS $IMAGEMAGICK_LIBS"
143 LIBALE_LDFLAGS="$GUILE_LDFLAGS $IMAGEMAGICK_LDFLAGS"
145 AC_SUBST(LIBALE_CFLAGS)
146 AC_SUBST(LIBALE_LIBS)
147 AC_SUBST(LIBALE_LDFLAGS)
149 AC_CONFIG_FILES([Makefile])
153 # Since the generated Makefile seems to sometimes miss build steps that are
154 # required due to reconfiguration, 'make clean' here.
156 AC_MSG_NOTICE(making clean)
157 make clean &> /dev/null