]> Dogcows Code - chaz/yoink/blob - configure.ac
preliminary AM_SILENT_RULES support
[chaz/yoink] / configure.ac
1
2 #
3 # Yoink
4 # Process this file with autoconf to produce a configure script.
5 #
6
7 AC_PREREQ([2.60])
8
9 AC_INIT([Yoink], [0.1], [chaz@dogcows.com], [yoink])
10
11 AC_CANONICAL_TARGET
12
13 AC_CONFIG_SRCDIR([src/GameLayer.cc])
14 AC_CONFIG_MACRO_DIR([m4])
15
16 AM_INIT_AUTOMAKE([subdir-objects])
17 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
18
19
20 #
21 # Checks for programs.
22 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23
24 AC_PROG_CXX
25 AC_PROG_CC
26 AC_PROG_CPP
27 AC_PROG_INSTALL
28 AC_PROG_RANLIB
29 AM_PROG_CC_C_O
30
31 PKG_PROG_PKG_CONFIG
32
33 AC_PATH_PROGS([DOXYGEN], [doxygen])
34 AC_SUBST(DOXYGEN)
35
36 #
37 # Configure platform-specific stuff.
38 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
39
40 case "${host}" in
41 *mingw32*)
42 MINGW32=yes
43 WIN32=yes
44 AC_PATH_PROGS([WINDRES], [windres $host_alias-windres $host_os-windres])
45 if test "x$WINDRES" = x
46 then
47 AC_MSG_ERROR([windres could not be found])
48 fi
49 AC_PATH_PROGS([MAKENSIS], [makensis])
50 ;;
51 *cygwin*)
52 CYGWIN=yes
53 WIN32=yes
54 ;;
55 *-apple-darwin*)
56 MACOSX=yes
57 LIBS="$LIBS -Wl,-framework"
58 ;;
59 esac
60
61 AM_CONDITIONAL([WIN32], test "$WIN32" = "yes")
62
63
64 #
65 # Checks for configuration arguments.
66 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
67
68 AC_ARG_ENABLE([debug],
69 [ --enable-debug include debugging symbols and features],
70 [debug=$enableval],
71 [debug=no])
72
73 AC_ARG_ENABLE([double-precision],
74 [ --enable-double-precision use double-precision numbers],
75 [double_precision=$enableval],
76 [double_precision=no])
77
78 AC_ARG_ENABLE([profile],
79 [ --enable-profile make a binary for use with gprof profiler],
80 [profile=$enableval],
81 [profile=no])
82
83 AC_ARG_ENABLE([extra-warnings],
84 [ --enable-extra-warnings make the gcc compiler give more warnings],
85 [extra_warnings=$enableval],
86 [extra_warnings=no])
87
88 AC_ARG_ENABLE([threads],
89 [ --enable-threads use threads for some parallel tasks],
90 [threads=$enableval],
91 [threads=no])
92
93 AC_ARG_ENABLE([gtk],
94 [ --enable-gtk enable GTK+ info/warning dialogs],
95 [gtk=$enableval],
96 [gtk=no])
97
98 AC_ARG_ENABLE([qt4],
99 [ --enable-qt4 enable QT info/warning dialogs],
100 [qt4=$enableval],
101 [qt4=no])
102
103 AC_ARG_WITH([log-level],
104 [AS_HELP_STRING([--with-log-level=NUM],
105 [0, none... 1, errors... 4, everything (default: 3)])],
106 [log_level=$withval],
107 [log_level=3])
108
109
110 if test x$debug = xyes
111 then
112 CFLAGS="$CFLAGS -DDEBUG -Wall -Wno-uninitialized"
113 CXXFLAGS="$CXXFLAGS -DDEBUG -Wall -Wno-uninitialized"
114 else
115 CFLAGS="$CFLAGS -DNDEBUG"
116 CXXFLAGS="$CXXFLAGS -DNDEBUG"
117 fi
118
119 if test x$double_precision = xyes
120 then
121 AC_DEFINE([USE_DOUBLE_PRECISION], 1,
122 [Define to 1 if you want to use doubles instead of floats.])
123 fi
124
125 if test x$profile = xyes
126 then
127 CFLAGS="$CFLAGS -pg"
128 CXXFLAGS="$CXXFLAGS -pg"
129 AC_DEFINE([PROFILING_ENABLED], 1,
130 [Define to 1 if profiling is built in.])
131 fi
132
133 if test x$extra_warnings = xyes
134 then
135 CFLAGS="$CFLAGS -Wextra -Wno-unused-parameter"
136 CXXFLAGS="$CXXFLAGS -Wextra -Wno-unused-parameter"
137 fi
138
139 if test x$threads = xyes
140 then
141 AC_DEFINE([USE_THREADS], 1,
142 [Define to 1 if you want to use threads for parallel tasks.])
143 fi
144
145 if test x$gtk = xyes
146 then
147 AC_DEFINE([USE_GTK], 1,
148 [Define to 1 if you want to use GTK+ info/error dialogs.])
149 elif test x$qt4 = xyes
150 then
151 AC_DEFINE([USE_QT4], 1,
152 [Define to 1 if you want to use QT info/error dialogs.])
153 fi
154
155 AC_DEFINE_UNQUOTED([YOINK_LOGLEVEL], [$log_level],
156 [Define to detail level of logging.])
157
158
159 if test "x$prefix" = xNONE
160 then
161 prefix="$ac_default_prefix"
162 fi
163
164 if test x$WIN32 = xyes
165 then
166 DATADIR="data"
167 else
168 eval eval DATADIR="${datadir}/$PACKAGE"
169 fi
170
171 AC_SUBST([DATADIR])
172 AC_DEFINE_UNQUOTED([YOINK_DATADIR], ["$DATADIR"],
173 [Define to path of game asset directory.])
174
175
176 #
177 # Split the version number into components.
178 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
179
180 VERSION_MAJOR=$(echo $VERSION | cut -d. -f1)
181 VERSION_MINOR=$(echo $VERSION | cut -d. -f2)
182 VERSION_REVISION=$(echo $VERSION | cut -d. -f3)
183
184 AC_DEFINE_UNQUOTED([VERSION_MAJOR], [${VERSION_MAJOR:-0}],
185 [Define to major version number component.])
186
187 AC_DEFINE_UNQUOTED([VERSION_MINOR], [${VERSION_MINOR:-0}],
188 [Define to minor version number component.])
189
190 AC_DEFINE_UNQUOTED([VERSION_REVISION], [${VERSION_REVISION:-0}],
191 [Define to revision version number component.])
192
193 if test x$WIN32 = xyes
194 then
195 PVERSION="${VERSION_MAJOR:-0}.${VERSION_MINOR:-0}.${VERSION_REVISION:-0}.0"
196 AC_SUBST([PVERSION])
197 fi
198
199 # these are used in src/yoink.rc
200
201
202 #
203 # Checks for system functions/headers and compiler characteristics.
204 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
205
206 AC_C_STRINGIZE
207 AC_C_INLINE
208
209 AC_TYPE_UINT8_T
210 AC_TYPE_UINT16_T
211 AC_TYPE_UINT32_T
212 AC_TYPE_SIZE_T
213 AC_TYPE_SSIZE_T
214
215 AC_FUNC_ERROR_AT_LINE
216 AC_FUNC_STRTOD
217 AC_CHECK_FUNCS([nanosleep strchr strcspn strrchr strstr])
218
219 AC_HEADER_STDBOOL
220 AC_HEADER_STDC
221 AC_CHECK_HEADERS([stddef.h stdint.h stdlib.h string.h unistd.h])
222
223
224 #
225 # Checks for build dependencies.
226 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
227
228 ##### boost #####
229 website="http://www.boost.org/"
230 BOOST_SMART_PTR
231 BOOST_STRING_ALGO
232 BOOST_BIND
233 BOOST_FUNCTION
234
235 ##### SDL #####
236 website="http://www.libsdl.org/"
237 AM_PATH_SDL([1.2.10],
238 [CFLAGS="$CFLAGS $SDL_CFLAGS"
239 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
240 LIBS="$LIBS $SDL_LIBS"])
241
242 ##### opengl, glu #####
243 website="http://www.mesa3d.org/"
244 AC_CHECK_HEADERS([GL/gl.h GL/glu.h],,
245 [missing=yes
246 echo "***** Missing GL headers ($website) *****"])
247 if test x$WIN32 = xyes
248 then
249 # autoconf library search macro doesn't find opengl32 on windows because it uses
250 # different name hashing, but it links fine; assume it's there
251 LIBS="$LIBS -lglu32 -lopengl32"
252 else
253 AC_SEARCH_LIBS([glEnable], [GL MesaGL],,
254 [missing=yes
255 echo "***** Missing libGL ($website) *****"])
256 AC_SEARCH_LIBS([gluDisk], [GLU MesaGLU],,
257 [missing=yes
258 echo "***** Missing libGLU ($website) *****"])
259 fi
260
261 ##### openal #####
262 website="http://connect.creativelabs.com/openal/"
263 AC_CHECK_HEADERS([AL/al.h AL/alc.h],,
264 [missing=yes
265 echo "***** Missing OpenAL headers ($website) *****"])
266 AC_SEARCH_LIBS([alEnable], [openal OpenAL32],,
267 [missing=yes
268 echo "***** Missing libopenal ($website) *****"])
269
270 ##### SDL_image #####
271 website="http://www.libsdl.org/projects/SDL_image/"
272 AC_CHECK_HEADERS([SDL/SDL_image.h],,
273 [missing=yes
274 echo "***** Missing SDL_image header ($website) *****"])
275 AC_SEARCH_LIBS([IMG_Load], [SDL_image],,
276 [missing=yes
277 echo "***** Missing libSDL_image ($website) *****"])
278
279 ##### libvorbis #####
280 website="http://www.xiph.org/downloads/"
281 AC_CHECK_HEADERS([vorbis/codec.h vorbis/vorbisfile.h],,
282 [missing=yes
283 echo "***** Missing vorbis headers ($website) *****"])
284 AC_SEARCH_LIBS([ov_open], [vorbisfile],,
285 [missing=yes
286 echo "***** Missing libvorbisfile ($website) *****"])
287
288 ##### liblua #####
289 website="http://www.lua.org/"
290 AC_CHECK_HEADERS([lua.h],,
291 [missing=yes
292 echo "***** Missing lua headers ($website) *****"])
293 AC_SEARCH_LIBS([lua_load], [lua],,
294 [missing=yes
295 echo "***** Missing liblua ($website) *****"])
296
297 if test x$gtk = xyes
298 then
299 ##### GTK+ 2.0 #####
300 website="http://www.gtk.org/"
301 PKG_CHECK_MODULES([GTK], [gtk+-2.0],
302 [LIBS="$LIBS $GTK_LIBS"
303 CFLAGS="$CFLAGS $GTK_CFLAGS"
304 CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"],
305 [missing=yes
306 echo "***** Missing GTK+-2.0 ($website) *****"])
307 fi
308
309 if test x$qt4 = xyes
310 then
311 ##### QT4 #####
312 website="http://qt.nokia.com/"
313 PKG_CHECK_MODULES([QT], [QtGui],
314 [LIBS="$LIBS $QT_LIBS"
315 CFLAGS="$CFLAGS $QT_CFLAGS"
316 CXXFLAGS="$CXXFLAGS $QT_CFLAGS"],
317 [missing=yes
318 echo "***** Missing QT ($website) *****"])
319 fi
320
321 ##### librt (optional) #####
322 AC_SEARCH_LIBS([clock_gettime], [rt],
323 [AC_DEFINE([HAVE_CLOCK_GETTIME], 1,
324 [Define to 1 if you have the 'clock_gettime' function.])])
325
326
327 if test x$missing == xyes
328 then
329 AC_MSG_WARN([You may be missing some dependencies--see messages above.])
330 fi
331
332
333 #
334 # Find the data files to install.
335 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
336
337 DATA_FILES=$(echo $(cd data; \
338 find . -name "*.lua" \
339 -o -name "*.ogg" \
340 -o -name "*.png" \
341 -o -name "yoinkrc"))
342 AC_SUBST([DATA_FILES])
343
344
345 #
346 # Create the build files.
347 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
348
349 AC_CONFIG_FILES([Makefile
350 data/Makefile
351 doc/Makefile
352 doc/yoink.6
353 src/Makefile])
354
355 if test x$WIN32 = xyes
356 then
357 AC_CONFIG_FILES([win32/Makefile win32/mkpackage.sh])
358 fi
359
360
361 AC_CONFIG_HEADERS([src/config.h])
362
363 AC_OUTPUT
364
365
366 #
367 # Print a friendly little message.
368 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
369
370 echo ""
371 echo " Configuration complete! :-)"
372 echo ""
373 echo " Target: $target"
374 echo " Prefix: $prefix"
375 echo " Data Directory: $DATADIR"
376 echo " Log Level: $log_level"
377 echo " Debug: $debug"
378 echo " Double Precision: $double_precision"
379 echo " Profile: $profile"
380 echo " Extra Warnings: $extra_warnings"
381 echo ""
382 echo " To finish the installation, execute:"
383 echo " make"
384 echo " make install"
385 echo ""
386
This page took 0.051652 seconds and 5 git commands to generate.