2 # Process this file with autoconf to produce a configure script.
4 # Copyright 2006 David Hilvert <dhilvert@auricle.dyndns.org>,
5 # <dhilvert@ugcs.caltech.edu>
7 # This file is part of the Anti-Lamenessing Engine.
9 # The Anti-Lamenessing Engine is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
14 # The Anti-Lamenessing Engine is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with Anti-Lamenessing Engine; if not, write to the Free Software
21 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 # Parts of this file were automatically generated by the GNU project's
24 # configuration generator 'autoscan', part of the 'autoconf' package from the
25 # 'autotools' family of build and installation tools.
33 AC_INIT(ALE, 0.8.5-prerelease, ale@ventricle.dyndns.org)
34 AC_CONFIG_SRCDIR([ale_accum.h])
35 AC_CONFIG_HEADER([config.h])
39 # Checks for programs.
43 # The strtod check breaks cross-compilation, so disable it.
44 AC_DEFUN([AC_FUNC_STRTOD],[])
59 # Checks for libraries.
60 # FIXME: Replace `main' with a function in `-lm':
61 AC_CHECK_LIB([m], [main])
63 # Checks for header files.
66 AC_CHECK_HEADERS([limits.h stdint.h stdlib.h string.h sys/ioctl.h unistd.h])
68 # Checks for typedefs, structures, and compiler characteristics.
75 # Checks for library functions. (Commented calls cause problems for cross-compilation.)
78 AC_PROG_GCC_TRADITIONAL
81 AC_FUNC_SELECT_ARGTYPES
84 AC_CHECK_FUNCS([floor memset pow select sqrt strchr strcspn strdup strndup strspn strtol])
86 # Determine whether assertions should be enabled.
87 AC_ARG_ENABLE(assertions, [ --enable-assertions check runtime assertions (default=yes)])
88 if test x$enable_assertions = xno; then
89 ASSERT_FLAGS="-DNDEBUG"
91 ASSERT_FLAGS="-DDEBUG"
94 # Determine whether ImageMagick should be linked
95 AC_ARG_WITH(imagemagick, [ --with-imagemagick ImageMagick file handling: auto,no,yes (default=auto)])
96 if test x$with_imagemagick != xno; then
98 # AC_CHECK_TOOL is somewhat broken for cross-compilation in
99 # some versions of autoconf, so use a conditional instead.
101 if test x$host = x$build \
102 || test x$host = x; then
103 AC_CHECK_TOOL(MAGICK_CONFIG, Magick-config, no)
105 AC_CHECK_PROG(MAGICK_CONFIG, ${ac_tool_prefix}Magick-config, ${ac_tool_prefix}Magick-config, no)
108 if test x$MAGICK_CONFIG != xno; then
110 # Bugs have been encountered in certain versions of ImageMagick
111 # older than 6.0.6. Until a test is written to check for these
112 # bugs, check the version number instead.
114 IMAGEMAGICK_VERSION=`Magick-config --version`
115 IMAGEMAGICK_VERSION_A=`echo $IMAGEMAGICK_VERSION | cut -f 1 -d '.'`
116 IMAGEMAGICK_VERSION_B=`echo $IMAGEMAGICK_VERSION | cut -f 2 -d '.'`
117 IMAGEMAGICK_VERSION_C=`echo $IMAGEMAGICK_VERSION | cut -f 3 -d '.'`
119 if test $IMAGEMAGICK_VERSION_A -gt 6 \
120 || ( test $IMAGEMAGICK_VERSION_A -eq 6 \
121 && test $IMAGEMAGICK_VERSION_B -gt 0 ) \
122 || ( test $IMAGEMAGICK_VERSION_A -eq 6 \
123 && test $IMAGEMAGICK_VERSION_B -eq 0 \
124 && test $IMAGEMAGICK_VERSION_C -ge 6 ); then
125 IMAGEMAGICK_CFLAGS=`$MAGICK_CONFIG --cflags`
126 IMAGEMAGICK_CPPFLAGS="`$MAGICK_CONFIG --cppflags` -DUSE_MAGICK"
127 IMAGEMAGICK_LDFLAGS=`$MAGICK_CONFIG --ldflags`
128 IMAGEMAGICK_LIBS=`$MAGICK_CONFIG --libs`
130 AC_MSG_WARN([not using ImageMagick older than 6.0.6 (found $IMAGEMAGICK_VERSION)])
134 IMAGEMAGICK_CFLAGS=""
135 IMAGEMAGICK_CPPFLAGS=""
136 IMAGEMAGICK_LDFLAGS=""
140 # Fatal error if user flag for ImageMagick could not be satisified
141 if test x$with_imagemagick = xyes \
142 && test x$IMAGEMAGICK_CPPFLAGS = x; then
143 AC_MSG_ERROR([ImageMagick build requested (--enable-imagemagick=yes), but no suitable version was found.])
146 # Determine whether FFTW should be linked
147 AC_ARG_WITH(fftw3, [ --with-fftw3 FFTW3 fourier transforms: auto,no,yes (default=auto)])
148 if test x$with_fftw3 != xno; then
149 AC_CHECK_LIB([fftw3], [main], LIBS="-lfftw3 $LIBS" FFTW_CPPFLAGS="-DUSE_FFTW")
152 # Fatal error if user flag for FFTW could not be satisified
153 if test x$with_fftw3 = xyes \
154 && test x$FFTW_CPPFLAGS = x; then
155 AC_MSG_ERROR([FFTW3 build requested (--enable-fftw3=yes), but no suitable version was found.])
158 # Determine the precision of colors that should be used
159 AC_ARG_WITH(colors, [ --with-colors=[TYPE] use TYPE colors: single,double (default=single)])
160 if test x$with_colors = xsingle \
161 || test x$with_colors = x; then
162 COLOR_CPPFLAGS="-DALE_COLORS=SINGLE"
163 elif test x$with_colors = xdouble; then
164 COLOR_CPPFLAGS="-DALE_COLORS=DOUBLE"
166 AC_MSG_ERROR(option --with-colors=$with_colors is not currently supported)
169 # Determine the precision of coordinates that should be used
170 AC_ARG_WITH(coords, [ --with-coords=[TYPE] use TYPE coords: single,double (default=single)])
171 if test x$with_coords = xsingle \
172 || test x$with_coords = x; then
173 COORD_CPPFLAGS="-DALE_COORDINATES=SINGLE"
174 elif test x$with_coords = xdouble; then
175 COORD_CPPFLAGS="-DALE_COORDINATES=DOUBLE"
177 AC_MSG_ERROR(option --with-coords=$with_coords is not currently supported)
180 # Determine whether optimizations should be used
181 AC_ARG_ENABLE(optimization, [ --enable-optimizations use optimization code (default=yes)])
182 if test x$enable_optimizations = xyes \
183 || test x$enable_optimizations = x; then
184 OPTIMIZATION_CPPFLAGS="-DOPTIMIZATIONS=1"
185 elif test x$enable_optimizations = xno; then
186 OPTIMIZATION_CPPFLAGS="-DOPTIMIZATIONS=0"
188 AC_MSG_ERROR(option --enable-optimizations=$enable_optimizations is not currently supported)
191 # Determine whether hash maps should be used.
192 AC_ARG_WITH(hashmap, [ --with-hashmap=[TYPE] Use TYPE hash map: no,gnu,std (default=no)])
193 if test x$with_hashmap = xno \
194 || test x$with_hashmap = x; then
196 elif test x$with_hashmap = xgnu; then
197 AC_CACHE_CHECK(whether GNU hash maps are available, ac_cv_gnu_hash,[
201 #include <ext/hash_map>
204 size_t operator()(int n) const
206 return __gnu_cxx::hash<int>()(n);
209 typedef __gnu_cxx::hash_map<int, int, node_hash> int_map_t;
212 ], ac_cv_gnu_hash=yes, ac_cv_gnu_hash=no)
214 if test $ac_cv_gnu_hash = yes; then
215 STL_CPPFLAGS="-DHASH_MAP_GNU"
217 AC_MSG_ERROR([option --with-hashmap=gnu specified, but this configuration fails.])
219 elif test x$with_hashmap = xstd; then
220 AC_CACHE_CHECK(whether std hash maps are available, ac_cv_std_hash,[
224 #include <ext/hash_map>
225 typedef std::hash_map<int, int> int_map_t;
228 ], ac_cv_std_hash=yes, ac_cv_std_hash=no)
230 if test $ac_cv_std_hash = yes; then
231 STL_CPPFLAGS="-DHASH_MAP_STD"
233 AC_MSG_ERROR([option --with-hashmap=std specified, but this configuration fails.])
236 AC_MSG_ERROR(option --with-hashmap=$with_hashmap is not currently supported)
240 # Determine whether ioctl() should be used for determining window dimensions
241 AC_ARG_ENABLE(getsize, [ --enable-getsize get terminal size: auto,no,yes (default=auto)
242 (not doing this disables certain UI updates)])
243 if test x$enable_getsize != xno; then
245 # Check for Unix facilities.
246 AC_CHECK_HEADER(sys/ioctl.h, AC_DEFINE([HAVE_SYS_IOCTL_H]))
247 AC_CHECK_FUNC(ioctl, AC_DEFINE([HAVE_IOCTL], [], [ioctl() function is available.]))
248 AC_CHECK_DECL(TIOCGWINSZ, have_winsz=yes, have_winsz=no, [#include <sys/ioctl.h>])
250 if test x$ac_cv_header_sys_ioctl_h = xyes \
251 && test x$ac_cv_func_ioctl = xyes \
252 && test x$have_winsz = xyes; then
253 IOCTL_CPPFLAGS="-DUSE_IOCTL"
257 # Fatal error if IOCTL configuration could not be satisfied
258 if test x$enable_getsize = xyes \
259 && test x$IOCTL_CPPFLAGS = x; then
260 if test x$ac_cv_header_sys_ioctl_h != xyes; then
261 AC_MSG_ERROR([ioctl() for window size requested (--enable-getsize=yes), but sys/ioctl.h was not found.])
263 if test x$ac_cv_func_ioctl != xyes; then
264 AC_MSG_ERROR([ioctl() for window size requested (--enable-getsize=yes), but ioctl() was not found.])
266 if test x$have_winsz != xyes; then
267 AC_MSG_ERROR([ioctl() for window size requested (--enable-getsize=yes), but TIOCGWINSZ was not found.])
269 AC_MSG_ERROR([ioctl() for window size requested (--enable-getsize=yes), but this configuration fails.])
272 # Determine whether the --wmx flag should be supported
273 AC_ARG_ENABLE(wmx, [ --enable-wmx Enable --wmx option: auto,no,yes (default=auto)
274 (this option requires execlp() and fork())])
275 if test x$enable_wmx != xno; then
277 # Check for Unix facilities.
278 AC_CHECK_HEADER(unistd.h, AC_DEFINE([HAVE_UNISTD_H]))
279 AC_CHECK_FUNC(execlp, AC_DEFINE([HAVE_EXECLP], [], [execlp() function is available.]))
281 if test x$ac_cv_func_fork_works = xyes \
282 && test x$ac_cv_header_unistd_h = xyes \
283 && test x$ac_cv_func_execlp = xyes; then
284 UNIX_CPPFLAGS="-DUSE_UNIX"
288 # Fatal error if --wmx configuration could not be satisified
289 if test x$enable_wmx = xyes \
290 && test x$UNIX_CPPFLAGS = x; then
291 if test x$ac_cv_func_execlp != xyes; then
292 AC_MSG_ERROR([--wmx support requested (--enable-wmx=yes), but execlp() was not found.])
294 if test x$ac_cv_header_unistd_h != xyes; then
295 AC_MSG_ERROR([--wmx support requested (--enable-wmx=yes), but unistd.h header was not found.])
297 if test x$ac_cv_func_fork_works != xyes; then
298 AC_MSG_ERROR([--wmx support requested (--enable-wmx=yes), but a working fork() was not found.])
300 AC_MSG_ERROR([--wmx support requested (--enable-wmx=yes), but this configuration fails.])
303 OPTION_CPPFLAGS="$ASSERT_FLAGS $IMAGEMAGICK_CPPFLAGS $FFTW_CPPFLAGS $UNIX_CPPFLAGS $IOCTL_CPPFLAGS $COORD_CPPFLAGS $COLOR_CPPFLAGS $OPTIMIZATION_CPPFLAGS $STL_CPPFLAGS"
304 OPTION_CFLAGS="$IMAGEMAGICK_CFLAGS"
305 OPTION_LDFLAGS="$IMAGEMAGICK_LDFLAGS"
306 OPTION_LIBS="$IMAGEMAGICK_LIBS"
308 AC_SUBST(OPTION_CPPFLAGS)
309 AC_SUBST(OPTION_CFLAGS)
310 AC_SUBST(OPTION_LDFLAGS)
311 AC_SUBST(OPTION_LIBS)
313 AC_CONFIG_FILES([Makefile lib/Makefile])
317 # Since the generated Makefile seems to sometimes miss build steps that are
318 # required due to reconfiguration, 'make clean' here.
320 AC_MSG_NOTICE(making clean)
321 make clean &> /dev/null