d4be8382f66cae1066bf012a2b2c13f677d9e649
[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.61)
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([dist-bzip2 no-dist-gzip])
17
18
19 #
20 # Determine the target platform.
21 #
22
23 case "${host}" in
24 *mingw32*) WIN32=yes ;;
25 *-apple-darwin*) MACOSX=yes ;;
26 *netbsd*) NETBSD=yes ;;
27 esac
28
29 AM_CONDITIONAL([WIN32], [test x$WIN32 = xyes])
30 AM_CONDITIONAL([MACOSX], [test x$MACOSX = xyes])
31 AM_CONDITIONAL([NETBSD], [test x$NETBSD = xyes])
32
33
34 #
35 # Checks for configuration arguments.
36 #
37
38 AC_ARG_ENABLE([debug],
39 [ --enable-debug include debugging symbols and features],
40 [debug=$enableval],
41 [debug=no])
42
43 AC_ARG_ENABLE([double-precision],
44 [ --enable-double-precision use doubles instead of floats],
45 [double_precision=$enableval],
46 [double_precision=no])
47
48 AC_ARG_ENABLE([profile],
49 [ --enable-profile make a binary with code profiling instructions],
50 [profile=$enableval],
51 [profile=no])
52
53 AC_ARG_ENABLE([extra-warnings],
54 [ --enable-extra-warnings make the gcc compiler give more warnings],
55 [extra_warnings=$enableval],
56 [extra_warnings=no])
57
58 AC_ARG_ENABLE([clock_gettime],
59 [ --enable-clock_gettime use clock_gettime() instead of SDL_GetTicks()],
60 [clock_gettime=$enableval],
61 [clock_gettime=no])
62
63 AC_ARG_ENABLE([threads],
64 [ --enable-threads use threads for concurrency where appropriate],
65 [threads=$enableval],
66 [threads=no])
67
68 AC_ARG_ENABLE([gtk],
69 [ --enable-gtk enable GTK+ modal dialogs],
70 [gtk=$enableval],
71 [gtk=no])
72
73 AC_ARG_ENABLE([qt4],
74 [ --enable-qt4 enable QT modal dialogs],
75 [qt4=$enableval],
76 [qt4=no])
77
78
79 if test x$debug = xyes
80 then
81 CFLAGS="$CFLAGS -DDEBUG -ggdb -O0 -Wall -Wno-uninitialized"
82 CXXFLAGS="$CXXFLAGS -DDEBUG -ggdb -O0 -Wall -Wno-uninitialized"
83 else
84 CFLAGS="$CFLAGS -DNDEBUG"
85 CXXFLAGS="$CXXFLAGS -DNDEBUG"
86 fi
87
88 if test x$double_precision = xyes
89 then
90 AC_DEFINE([USE_DOUBLE_PRECISION], 1,
91 [Define to 1 if you want to use doubles instead of floats.])
92 fi
93
94 if test x$profile = xyes
95 then
96 CFLAGS="$CFLAGS -pg"
97 CXXFLAGS="$CXXFLAGS -pg"
98 AC_DEFINE([PROFILING_ENABLED], 1,
99 [Define to 1 if profiling is built in.])
100 fi
101
102 if test x$extra_warnings = xyes
103 then
104 CFLAGS="$CFLAGS -Wextra -Wno-unused-parameter"
105 CXXFLAGS="$CXXFLAGS -Wextra -Wno-unused-parameter"
106 fi
107
108 if test x$threads = xyes
109 then
110 AC_DEFINE([USE_THREADS], 1,
111 [Define to 1 if you want to use threads when applicable.])
112 fi
113
114 if test x$gtk = xyes
115 then
116 AC_DEFINE([USE_GTK], 1,
117 [Define to 1 if you want to use GTK+ modal dialogs.])
118 elif test x$qt4 = xyes
119 then
120 AC_DEFINE([USE_QT4], 1,
121 [Define to 1 if you want to use QT4 modal dialogs.])
122 fi
123
124
125 if test "x$prefix" = xNONE
126 then
127 prefix="$ac_default_prefix"
128 fi
129
130 if test x$WIN32 = xyes
131 then
132 DATADIR="data"
133 else
134 eval eval DATADIR="${datadir}/$PACKAGE"
135 fi
136
137 AC_SUBST([DATADIR])
138 AC_DEFINE_UNQUOTED([YOINK_DATADIR], ["$DATADIR"],
139 [Define to the path of the game asset directory.])
140
141
142 ####
143 AC_MSG_NOTICE([Checks for programs.])
144 ####
145
146 AC_PROG_CXX
147 AC_PROG_CC
148 AC_PROG_INSTALL
149 AC_PROG_RANLIB
150 AM_PROG_CC_C_O
151
152 PKG_PROG_PKG_CONFIG
153
154 AC_PATH_PROGS([CUT], [cut])
155 if test x$CUT = x
156 then
157 AC_MSG_ERROR([The cut program is required.])
158 fi
159
160 AC_PATH_PROGS([FIND], [find])
161 if test x$FIND = x
162 then
163 AC_MSG_ERROR([The find program is required.])
164 fi
165
166 if test x$WIN32 = xyes
167 then
168 AC_PATH_PROGS([WINDRES],
169 [windres $host_alias-windres $host_os-windres])
170 if test x$WINDRES = x
171 then
172 AC_MSG_ERROR([The windres program is required.])
173 fi
174
175 AC_PATH_PROGS([ZIP], [zip])
176 if test x$ZIP = x
177 then
178 AC_MSG_WARN([The zip program is needed to build a portable package.])
179 fi
180
181 AC_PATH_PROGS([MAKENSIS], [makensis])
182 if test x$MAKENSIS = x
183 then
184 AC_MSG_WARN([The makensis program is needed to build an installer.])
185 fi
186
187 AC_PATH_PROGS([GROFF], [groff])
188 if test x$GROFF = x
189 then
190 AC_MSG_WARN([The groff program is needed to create the manual page.])
191 fi
192 elif test x$NETBSD = xyes
193 then
194 AC_PATH_PROGS([PKGLINT], [pkglint])
195 fi
196
197 AM_CONDITIONAL([HAVE_MAKENSIS], [test x$MAKENSIS != x])
198
199 ####
200 AC_MSG_NOTICE([Checks for libraries.])
201 ####
202
203 ##### SDL #####
204 website="http://www.libsdl.org/"
205 PKG_CHECK_MODULES([SDL], [sdl],
206 [LIBS="$LIBS $SDL_LIBS"
207 CFLAGS="$CFLAGS $SDL_CFLAGS"
208 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"],
209 [missing=yes
210 AC_MSG_WARN([Missing SDL ($website)])])
211
212 ##### opengl, glu #####
213 website="http://www.mesa3d.org/"
214 PKG_CHECK_MODULES([OPENGL], [gl glu],
215 [LIBS="$LIBS $OPENGL_LIBS"
216 CFLAGS="$CFLAGS $OPENGL_CFLAGS"
217 CXXFLAGS="$CXXFLAGS $OPENGL_CFLAGS"],
218 [missing=yes
219 AC_MSG_WARN([Missing OpenGL ($website)])])
220
221 ##### libpng #####
222 website="http://www.libpng.org/pub/png/libpng.html"
223 PKG_CHECK_MODULES([PNG], [libpng],
224 [LIBS="$LIBS $PNG_LIBS"
225 CFLAGS="$CFLAGS $PNG_CFLAGS"
226 CXXFLAGS="$CXXFLAGS $PNG_CFLAGS"],
227 [missing=yes
228 AC_MSG_WARN([Missing libpng ($website)])])
229
230 ##### openal #####
231 website="http://connect.creativelabs.com/openal/"
232 PKG_CHECK_MODULES([OPENAL], [openal],
233 [LIBS="$LIBS $OPENAL_LIBS"
234 CFLAGS="$CFLAGS $OPENAL_CFLAGS"
235 CXXFLAGS="$CXXFLAGS $OPENAL_CFLAGS"],
236 [missing=yes
237 AC_MSG_WARN([Missing OpenAL ($website)])])
238
239 ##### libvorbis #####
240 website="http://www.xiph.org/downloads/"
241 PKG_CHECK_MODULES([VORBIS], [vorbisfile],
242 [LIBS="$LIBS $VORBIS_LIBS"
243 CFLAGS="$CFLAGS $VORBIS_CFLAGS"
244 CXXFLAGS="$CXXFLAGS $VORBIS_CFLAGS"],
245 [missing=yes
246 AC_MSG_WARN([Missing libvorbisfile ($website)])])
247
248 ##### liblua #####
249 website="http://www.lua.org/"
250 PKG_CHECK_MODULES([LUA], [lua],
251 [LIBS="$LIBS $LUA_LIBS"
252 CFLAGS="$CFLAGS $LUA_CFLAGS"
253 CXXFLAGS="$CXXFLAGS $LUA_CFLAGS"],
254 [missing=yes
255 AC_MSG_WARN([Missing liblua ($website)])])
256
257 ##### GTK+ 2.0 #####
258 if test x$gtk = xyes
259 then
260 website="http://www.gtk.org/"
261 PKG_CHECK_MODULES([GTK], [gtk+-2.0],
262 [LIBS="$LIBS $GTK_LIBS"
263 CFLAGS="$CFLAGS $GTK_CFLAGS"
264 CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"],
265 [missing=yes
266 AC_MSG_WARN([Missing GTK+-2.0 ($website)])])
267 fi
268
269 ##### QT4 #####
270 if test x$qt4 = xyes
271 then
272 website="http://qt.nokia.com/"
273 PKG_CHECK_MODULES([QT], [QtGui],
274 [LIBS="$LIBS $QT_LIBS"
275 CFLAGS="$CFLAGS $QT_CFLAGS"
276 CXXFLAGS="$CXXFLAGS $QT_CFLAGS"],
277 [missing=yes
278 AC_MSG_WARN([Missing QT ($website)])])
279 fi
280
281 if test x$missing = xyes
282 then
283 AC_MSG_ERROR([You are missing some required libraries.])
284 fi
285
286
287 ####
288 AC_MSG_NOTICE([Checks for header files.])
289 ####
290
291 AC_HEADER_STDBOOL
292 AC_HEADER_STDC
293 AC_CHECK_HEADERS([stddef.h stdint.h stdlib.h string.h unistd.h])
294
295 BOOST_SMART_PTR
296 BOOST_STRING_ALGO
297 BOOST_BIND
298 BOOST_FUNCTION
299
300
301 ####
302 AC_MSG_NOTICE([Checks for types.])
303 ####
304
305 AC_TYPE_UINT8_T
306 AC_TYPE_UINT16_T
307 AC_TYPE_UINT32_T
308 AC_TYPE_SIZE_T
309 AC_TYPE_SSIZE_T
310
311
312 ####
313 AC_MSG_NOTICE([Checks for compiler characteristics.])
314 ####
315
316 AC_C_STRINGIZE
317 AC_C_INLINE
318
319
320 ####
321 AC_MSG_NOTICE([Checks for library functions.])
322 ####
323
324 AC_FUNC_ERROR_AT_LINE
325 AC_FUNC_STRTOD
326 AC_CHECK_FUNCS([nanosleep strchr strcspn strrchr strstr])
327
328 if test x$clock_gettime = xyes
329 then
330 AC_SEARCH_LIBS([clock_gettime], [rt],
331 [clock_gettime=yes],
332 [clock_gettime=no])
333 if test x$clock_gettime = xyes
334 then
335 AC_DEFINE([HAVE_CLOCK_GETTIME], 1,
336 [Define to 1 if you have the 'clock_gettime' function.])
337 else
338 AC_MSG_WARN([Falling back to SDL_GetTicks().])
339 fi
340 fi
341
342
343 #
344 # Find the game resources to install.
345 #
346
347 DATA_FILES=$(echo $(cd data && find . -name "*.lua" \
348 -o -name "*.ogg" \
349 -o -name "*.png" \
350 -o -name "yoinkrc"))
351 AC_SUBST([DATA_FILES])
352
353
354 #
355 # Split the version number into components.
356 # These definitions are used in the win32 resource file, src/yoink.rc.
357 #
358
359 VERSION_MAJOR=$(echo $VERSION | cut -d. -f1)
360 VERSION_MINOR=$(echo $VERSION | cut -d. -f2)
361 VERSION_REVISION=$(echo $VERSION | cut -d. -f3)
362
363 AC_DEFINE_UNQUOTED([VERSION_MAJOR], [${VERSION_MAJOR:-0}],
364 [Define to major version number component.])
365
366 AC_DEFINE_UNQUOTED([VERSION_MINOR], [${VERSION_MINOR:-0}],
367 [Define to minor version number component.])
368
369 AC_DEFINE_UNQUOTED([VERSION_REVISION], [${VERSION_REVISION:-0}],
370 [Define to revision version number component.])
371
372 PVERSION="${VERSION_MAJOR:-0}.${VERSION_MINOR:-0}.${VERSION_REVISION:-0}.0"
373 AC_SUBST([PVERSION])
374
375
376 #
377 # Create the build files.
378 #
379
380 AC_CONFIG_FILES([Makefile
381 data/Makefile
382 doc/yoink.6
383 src/Makefile])
384
385 AC_CONFIG_HEADERS([src/config.h])
386
387 AC_OUTPUT
388
389
390 #
391 # Print a friendly little message.
392 #
393
394 echo ""
395 echo " Configuration complete! :-)"
396 echo ""
397 echo " Host: $target"
398 echo " Prefix: $prefix"
399 echo " Data: $DATADIR"
400 echo ""
401 echo " CXX: $CXX"
402 echo " CXXFLAGS: $(echo $CXXFLAGS)"
403 echo " LIBS: $(echo $LIBS)"
404 echo ""
405 echo " To finish the installation, execute:"
406 echo " make"
407 echo " make install"
408 echo ""
409
This page took 0.043452 seconds and 3 git commands to generate.