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