[go: up one dir, main page]

File: configure.in

package info (click to toggle)
ale 0.9.0.3-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 7,192 kB
  • ctags: 3,623
  • sloc: cpp: 21,826; sh: 10,106; xml: 4,129; ansic: 2,343; makefile: 563; perl: 454; exp: 319
file content (375 lines) | stat: -rw-r--r-- 12,790 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

# Copyright 2006 David Hilvert <dhilvert@auricle.dyndns.org>,
#                              <dhilvert@ugcs.caltech.edu>

#  This file is part of the Anti-Lamenessing Engine.
#
#  The Anti-Lamenessing Engine is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 3 of the License, or
#  (at your option) any later version.
#
#  The Anti-Lamenessing Engine is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with Anti-Lamenessing Engine; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

#  Parts of this file were automatically generated by the GNU project's
#  configuration generator 'autoscan', part of the 'autoconf' package from the
#  'autotools' family of build and installation tools.


#
# Preliminaries
#

AC_PREREQ(2.60)
AC_INIT(ALE, translit(m4_include(VERSION),'
'), ale@ventricle.dyndns.org)
AC_CONFIG_SRCDIR([ale_accum.h])
AC_CONFIG_HEADER([config.h])

AM_INIT_AUTOMAKE

# Checks for programs.
AC_PROG_CXX
AC_PROG_CC

# The strtod check breaks cross-compilation, so disable it.
AC_DEFUN([AC_FUNC_STRTOD],[])

#GNULib startup
gl_EARLY

# Libtool
AC_PROG_LIBTOOL

# For gnulib.
#gl_SOURCE_BASE(gl)
#gl_M4_BASE(m4)
#gl_LIB(lib)
gl_MODULES(strndup)
gl_INIT

# Checks for libraries.
# FIXME: Replace `main' with a function in `-lm':
AC_CHECK_LIB([m], [main])

# Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([limits.h stdint.h stdlib.h string.h sys/ioctl.h unistd.h time.h sys/time.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_INT16_T
AC_TYPE_SIZE_T
AC_TYPE_UINT16_T

# Checks for library functions.  (Commented calls cause problems for cross-compilation.)
AC_FUNC_ERROR_AT_LINE
AC_FUNC_FORK
AC_PROG_GCC_TRADITIONAL
# AC_FUNC_MALLOC
# AC_FUNC_REALLOC
AC_FUNC_SELECT_ARGTYPES
AC_FUNC_STRTOD
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([floor memset pow select sqrt strchr strcspn strdup strndup strspn strtol nrand48 rand_r gettimeofday nanosleep])

if test x$enable_threads != xno; then

	# Check for POSIX threads.
	ACX_PTHREAD()
fi

# Determine whether multithreading should be used.
AC_ARG_ENABLE(threads,    [  --enable-threads        enable multithreading: auto, no, yes (default=auto)])
if test x$enable_threads != xno \
&& test x$acx_pthread_ok = xyes; then
	PTHREAD_CFLAGS="$PTHREAD_CFLAGS -DUSE_PTHREAD=1"

	#
	# XXX: This is probably wrong.
	#

	if test x$PTHREAD_CXX = x; then
		PTHREAD_CXX="$CXX"
	fi

	#
	# CC replacement logic from ImageMagick's configuration process
	#

    	if test "$CC" != "$PTHREAD_CC"; then 
		AC_MSG_WARN([Replacing compiler $CC with compiler $PTHREAD_CC to support pthreads.])
	        CC="$PTHREAD_CC" 
	fi 
	if test  "$CXX" != "$PTHREAD_CXX"; then
	    	AC_MSG_WARN([Replacing compiler $CXX with compiler $PTHREAD_CXX to support pthreads.]) 
		CXX="$PTHREAD_CXX" 
	fi
fi

if test x$enable_threads = xyes \
&& test x$acx_pthread_ok = xno; then
	AC_MSG_ERROR([Multithreaded build requested (--enable-threads=yes), but no usable library was found.])
fi
		

# Determine whether assertions should be enabled.
AC_ARG_ENABLE(assertions, [  --enable-assertions     check runtime assertions (default=yes)])
if test x$enable_assertions = xno; then
	ASSERT_FLAGS="-DNDEBUG"
else
	ASSERT_FLAGS="-DDEBUG"
fi

# Determine whether ImageMagick should be linked
AC_ARG_WITH(imagemagick, [  --with-imagemagick      ImageMagick file handling: auto,no,yes (default=auto)])
if test x$with_imagemagick != xno; then

	# AC_CHECK_TOOL is somewhat broken for cross-compilation in
	# some versions of autoconf, so use a conditional instead.
	
	if test x$host = x$build \
	|| test x$host = x; then 
		AC_CHECK_TOOL(MAGICK_CONFIG, Magick-config, no)
	else
		AC_CHECK_PROG(MAGICK_CONFIG, ${ac_tool_prefix}Magick-config, ${ac_tool_prefix}Magick-config, no)
	fi

	if test x$MAGICK_CONFIG != xno; then

		# Bugs have been encountered in certain versions of ImageMagick
		# older than 6.0.6.  Until a test is written to check for these
		# bugs, check the version number instead.
		#
		# Since GraphicsMagick uses different version numbering, accept
		# any version number from a GraphicsMagick installation.
		
		IMAGEMAGICK_VERSION=`Magick-config --version`
		IMAGEMAGICK_VERSION_A=`echo $IMAGEMAGICK_VERSION | cut -f 1 -d '.'`
		IMAGEMAGICK_VERSION_B=`echo $IMAGEMAGICK_VERSION | cut -f 2 -d '.'`
		IMAGEMAGICK_VERSION_C=`echo $IMAGEMAGICK_VERSION | cut -f 3 -d '.'`
		
		if test -x `which GraphicsMagick-config` \
		|| test $IMAGEMAGICK_VERSION_A -gt 6 \
		|| ( test $IMAGEMAGICK_VERSION_A -eq 6 \
		  && test $IMAGEMAGICK_VERSION_B -gt 0 ) \
		|| ( test $IMAGEMAGICK_VERSION_A -eq 6 \
		  && test $IMAGEMAGICK_VERSION_B -eq 0 \
		  && test $IMAGEMAGICK_VERSION_C -ge 6 ); then
		  	IMAGEMAGICK_CFLAGS=`$MAGICK_CONFIG --cflags`
			IMAGEMAGICK_CPPFLAGS="`$MAGICK_CONFIG --cppflags` -DUSE_MAGICK"
			IMAGEMAGICK_LDFLAGS=`$MAGICK_CONFIG --ldflags`
			IMAGEMAGICK_LIBS=`$MAGICK_CONFIG --libs`
		else
			AC_MSG_WARN([not using ImageMagick older than 6.0.6 (found $IMAGEMAGICK_VERSION)])
		fi
	fi
else
	IMAGEMAGICK_CFLAGS=""
	IMAGEMAGICK_CPPFLAGS=""
	IMAGEMAGICK_LDFLAGS=""
	IMAGEMAGICK_LIBS=""
fi

# Fatal error if user flag for ImageMagick could not be satisified
if test x$with_imagemagick = xyes \
&& test x$IMAGEMAGICK_CPPFLAGS = x; then
	AC_MSG_ERROR([ImageMagick build requested (--enable-imagemagick=yes), but no suitable version was found.])
fi

# Determine whether FFTW should be linked
AC_ARG_WITH(fftw3, [  --with-fftw3            FFTW3 fourier transforms: auto,no,yes (default=auto)])
if test x$with_fftw3 != xno; then
	AC_CHECK_LIB([fftw3], [main], LIBS="-lfftw3 $LIBS" FFTW_CPPFLAGS="-DUSE_FFTW")
fi

# Fatal error if user flag for FFTW could not be satisified
if test x$with_fftw3 = xyes \
&& test x$FFTW_CPPFLAGS = x; then
	AC_MSG_ERROR([FFTW3 build requested (--enable-fftw3=yes), but no suitable version was found.])
fi

# Determine the precision of colors that should be used
AC_ARG_WITH(colors, [  --with-colors=[TYPE]      use TYPE colors: single,double,fixed32,fixed16 (default=single)])
if test x$with_colors = xsingle \
|| test x$with_colors = x; then
	COLOR_CPPFLAGS="-DALE_COLORS=SINGLE"
elif test x$with_colors = xdouble; then
	COLOR_CPPFLAGS="-DALE_COLORS=DOUBLE"
elif test x$with_colors = xfixed16; then
	COLOR_CPPFLAGS="-DALE_COLORS=FIXED16"
elif test x$with_colors = xfixed32; then
	COLOR_CPPFLAGS="-DALE_COLORS=FIXED32"
else
	AC_MSG_ERROR(option --with-colors=$with_colors is not currently supported)
fi

# Determine the precision of coordinates that should be used
AC_ARG_WITH(coords, [  --with-coords=[TYPE]      use TYPE coords: single,double,fixed32,fixed16 (default=single)])
if test x$with_coords = xsingle \
|| test x$with_coords = x; then
	COORD_CPPFLAGS="-DALE_COORDINATES=SINGLE"
elif test x$with_coords = xdouble; then
	COORD_CPPFLAGS="-DALE_COORDINATES=DOUBLE"
elif test x$with_coords = xfixed16; then
	COORD_CPPFLAGS="-DALE_COORDINATES=FIXED16"
elif test x$with_coords = xfixed32; then
	COORD_CPPFLAGS="-DALE_COORDINATES=FIXED32"
else
	AC_MSG_ERROR(option --with-coords=$with_coords is not currently supported)
fi

# Determine whether optimizations should be used
AC_ARG_ENABLE(optimization, [  --enable-optimizations  use optimization code (default=yes)])
if test x$enable_optimizations = xyes \
|| test x$enable_optimizations = x; then
	OPTIMIZATION_CPPFLAGS="-DOPTIMIZATIONS=1"
elif test x$enable_optimizations = xno; then
	OPTIMIZATION_CPPFLAGS="-DOPTIMIZATIONS=0"
else
	AC_MSG_ERROR(option --enable-optimizations=$enable_optimizations is not currently supported)
fi

# Determine whether hash maps should be used.
AC_ARG_WITH(hashmap, [  --with-hashmap=[TYPE]     Use TYPE hash map: no,gnu,std (default=no)])
if test x$with_hashmap = xno \
|| test x$with_hashmap = x; then
	STL_CPPFLAGS=""
elif test x$with_hashmap = xgnu; then
  	AC_CACHE_CHECK(whether GNU hash maps are available, ac_cv_gnu_hash,[
		AC_LANG_SAVE
		AC_LANG_CPLUSPLUS
		AC_TRY_COMPILE([
			#include <ext/hash_map>
			struct node_hash
			{
				size_t operator()(int n) const
				{
					return __gnu_cxx::hash<int>()(n);
				}
			};
			typedef __gnu_cxx::hash_map<int, int, node_hash> int_map_t;
		],[
			int_map_t foo;
		], ac_cv_gnu_hash=yes, ac_cv_gnu_hash=no)
		AC_LANG_RESTORE])
	if test $ac_cv_gnu_hash = yes; then
		STL_CPPFLAGS="-DHASH_MAP_GNU"
	else
		AC_MSG_ERROR([option --with-hashmap=gnu specified, but this configuration fails.])
	fi
elif test x$with_hashmap = xstd; then
  	AC_CACHE_CHECK(whether std hash maps are available, ac_cv_std_hash,[
		AC_LANG_SAVE
		AC_LANG_CPLUSPLUS
		AC_TRY_COMPILE([
			#include <ext/hash_map>
			typedef std::hash_map<int, int> int_map_t;
		],[
			int_map_t foo;
		], ac_cv_std_hash=yes, ac_cv_std_hash=no)
		AC_LANG_RESTORE])
	if test $ac_cv_std_hash = yes; then
		STL_CPPFLAGS="-DHASH_MAP_STD"
	else
		AC_MSG_ERROR([option --with-hashmap=std specified, but this configuration fails.])
	fi
else
	AC_MSG_ERROR(option --with-hashmap=$with_hashmap is not currently supported)
fi


# Determine whether ioctl() should be used for determining window dimensions
AC_ARG_ENABLE(getsize, [  --enable-getsize        get terminal size: auto,no,yes (default=auto)
                            (not doing this disables certain UI updates)])
if test x$enable_getsize != xno; then

	# Check for Unix facilities.
	AC_CHECK_HEADER(sys/ioctl.h, AC_DEFINE([HAVE_SYS_IOCTL_H]))
	AC_CHECK_FUNC(ioctl, AC_DEFINE([HAVE_IOCTL], [], [ioctl() function is available.]))
	AC_CHECK_DECL(TIOCGWINSZ, have_winsz=yes, have_winsz=no, [#include <sys/ioctl.h>])

	if test x$ac_cv_header_sys_ioctl_h = xyes \
	&& test x$ac_cv_func_ioctl = xyes \
	&& test x$have_winsz = xyes; then
		IOCTL_CPPFLAGS="-DUSE_IOCTL"
	fi
fi

# Fatal error if IOCTL configuration could not be satisfied
if test x$enable_getsize = xyes \
&& test x$IOCTL_CPPFLAGS = x; then
	if test x$ac_cv_header_sys_ioctl_h != xyes; then
		AC_MSG_ERROR([ioctl() for window size requested (--enable-getsize=yes), but sys/ioctl.h was not found.])
	fi
	if test x$ac_cv_func_ioctl != xyes; then
		AC_MSG_ERROR([ioctl() for window size requested (--enable-getsize=yes), but ioctl() was not found.])
	fi
	if test x$have_winsz != xyes; then
		AC_MSG_ERROR([ioctl() for window size requested (--enable-getsize=yes), but TIOCGWINSZ was not found.])
	fi
	AC_MSG_ERROR([ioctl() for window size requested (--enable-getsize=yes), but this configuration fails.])
fi

# Determine whether the --wmx flag should be supported
AC_ARG_ENABLE(wmx, [  --enable-wmx            Enable --wmx option: auto,no,yes (default=auto)
                            (this option requires execlp() and fork())])
if test x$enable_wmx != xno; then

	# Check for Unix facilities.
	AC_CHECK_HEADER(unistd.h, AC_DEFINE([HAVE_UNISTD_H]))
	AC_CHECK_FUNC(execlp, AC_DEFINE([HAVE_EXECLP], [], [execlp() function is available.]))

	if test x$ac_cv_func_fork_works = xyes \
	&& test x$ac_cv_header_unistd_h = xyes \
	&& test x$ac_cv_func_execlp = xyes; then
		UNIX_CPPFLAGS="-DUSE_UNIX"
	fi
fi

# Fatal error if --wmx configuration could not be satisified
if test x$enable_wmx = xyes \
&& test x$UNIX_CPPFLAGS = x; then
	if test x$ac_cv_func_execlp != xyes; then
		AC_MSG_ERROR([--wmx support requested (--enable-wmx=yes), but execlp() was not found.])
	fi
	if test x$ac_cv_header_unistd_h != xyes; then
		AC_MSG_ERROR([--wmx support requested (--enable-wmx=yes), but unistd.h header was not found.])
	fi
	if test x$ac_cv_func_fork_works != xyes; then
		AC_MSG_ERROR([--wmx support requested (--enable-wmx=yes), but a working fork() was not found.])
	fi
	AC_MSG_ERROR([--wmx support requested (--enable-wmx=yes), but this configuration fails.])
fi

OPTION_CPPFLAGS="$ASSERT_FLAGS $IMAGEMAGICK_CPPFLAGS $FFTW_CPPFLAGS $UNIX_CPPFLAGS $IOCTL_CPPFLAGS $COORD_CPPFLAGS $COLOR_CPPFLAGS $OPTIMIZATION_CPPFLAGS $STL_CPPFLAGS"
OPTION_CFLAGS="$IMAGEMAGICK_CFLAGS $PTHREAD_CFLAGS"
OPTION_LDFLAGS="$IMAGEMAGICK_LDFLAGS"
OPTION_LIBS="$PTHREAD_LIBS $IMAGEMAGICK_LIBS"

AC_SUBST(OPTION_CPPFLAGS)
AC_SUBST(OPTION_CFLAGS)
AC_SUBST(OPTION_LDFLAGS)
AC_SUBST(OPTION_LIBS)

AC_CONFIG_FILES([Makefile lib/Makefile])

AC_OUTPUT

# Since the generated Makefile seems to sometimes miss build steps that are
# required due to reconfiguration, 'make clean' here.

AC_MSG_NOTICE(making clean)
make clean &> /dev/null