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