]> Dogcows Code - chaz/yoink/blob - configure.ac
testing new non-autotools build system
[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 [AS_HELP_STRING([--enable-debug],
40 [include debugging symbols and code paths])],
41 [debug=$enableval],
42 [debug=no])
43
44 AC_ARG_ENABLE([double-precision],
45 [AS_HELP_STRING([--enable-double-precision],
46 [use doubles instead of floats])],
47 [double_precision=$enableval],
48 [double_precision=no])
49
50 AC_ARG_ENABLE([profile],
51 [AS_HELP_STRING([--enable-profile],
52 [make a binary with code profiling instructions])],
53 [profile=$enableval],
54 [profile=no])
55
56 AC_ARG_ENABLE([extra-warnings],
57 [AS_HELP_STRING([--enable-extra-warnings],
58 [make the gcc compiler give more warnings])],
59 [extra_warnings=$enableval],
60 [extra_warnings=no])
61
62 AC_ARG_ENABLE([link-sh],
63 [AS_HELP_STRING([--enable-link-sh],
64 [give the executable fewer direct dependencies])],
65 [link_sh=$enableval],
66 [link_sh=no])
67
68 AC_ARG_ENABLE([clock_gettime],
69 [AS_HELP_STRING([--enable-clock_gettime],
70 [use clock_gettime() instead of SDL_GetTicks()])],
71 [clock_gettime=$enableval],
72 [clock_gettime=no])
73
74 AC_ARG_ENABLE([threads],
75 [AS_HELP_STRING([--enable-threads],
76 [use threads for concurrency where appropriate])],
77 [threads=$enableval],
78 [threads=no])
79
80 AC_ARG_ENABLE([hotloading],
81 [AS_HELP_STRING([--enable-hotloading],
82 [monitor assets and reload them when they change])],
83 [hotloading=$enableval],
84 [hotloading=no])
85
86 AC_ARG_WITH([gtk],
87 [AS_HELP_STRING([--with-gtk],
88 [use gtk2 modal dialogs])],
89 [gtk=$withval],
90 [gtk=no])
91
92 AC_ARG_WITH([qt4],
93 [AS_HELP_STRING([--with-qt4],
94 [use qt4 modal dialogs; overridden by --with-gtk])],
95 [qt4=$withval],
96 [qt4=no])
97
98
99 if test x$debug = xyes
100 then
101 CFLAGS="$CFLAGS -DDEBUG -ggdb -O0 -Wall -Wno-uninitialized"
102 CXXFLAGS="$CXXFLAGS -DDEBUG -ggdb -O0 -Wall -Wno-uninitialized"
103 else
104 CFLAGS="$CFLAGS -DNDEBUG"
105 CXXFLAGS="$CXXFLAGS -DNDEBUG"
106 fi
107
108 if test x$double_precision = xyes
109 then
110 AC_DEFINE([USE_DOUBLE_PRECISION], 1,
111 [Define to 1 if you want to use doubles instead of floats.])
112 fi
113
114 if test x$profile = xyes
115 then
116 CFLAGS="$CFLAGS -pg"
117 CXXFLAGS="$CXXFLAGS -pg"
118 AC_DEFINE([PROFILING_ENABLED], 1,
119 [Define to 1 if profiling is built in.])
120 fi
121
122 if test x$extra_warnings = xyes
123 then
124 CFLAGS="$CFLAGS -Wextra -Wno-unused-parameter"
125 CXXFLAGS="$CXXFLAGS -Wextra -Wno-unused-parameter"
126 fi
127
128 AM_CONDITIONAL([LINK_SH], [test x$link_sh = xyes])
129
130 if test x$threads = xyes
131 then
132 AC_DEFINE([USE_THREADS], 1,
133 [Define to 1 if you want to use threads when applicable.])
134 fi
135
136 if test x$hotloading = xyes
137 then
138 AC_DEFINE([USE_HOTLOADING], 1,
139 [Define to 1 if you want to use hotloading assets.])
140 fi
141
142 if test x$gtk = xyes
143 then
144 AC_DEFINE([USE_GTK], 1,
145 [Define to 1 if you want to use GTK+ modal dialogs.])
146 elif test x$qt4 = xyes
147 then
148 AC_DEFINE([USE_QT4], 1,
149 [Define to 1 if you want to use QT4 modal dialogs.])
150 fi
151
152
153 if test "x$prefix" = xNONE
154 then
155 prefix="$ac_default_prefix"
156 fi
157
158 if test x$WIN32 = xyes
159 then
160 DATADIR="data"
161 else
162 eval eval DATADIR="${datadir}/$PACKAGE"
163 fi
164
165 AC_SUBST([DATADIR])
166 AC_DEFINE_UNQUOTED([YOINK_DATADIR], ["$DATADIR"],
167 [Define to the path of the game asset directory.])
168
169
170 ####
171 AC_MSG_NOTICE([Checks for programs.])
172 ####
173
174 AC_PROG_CXX
175 AC_PROG_CC
176 AC_PROG_INSTALL
177 AC_PROG_RANLIB
178 AM_PROG_CC_C_O
179
180 PKG_PROG_PKG_CONFIG
181
182 AC_PATH_PROGS([CUT], [cut])
183 if test x$CUT = x
184 then
185 AC_MSG_ERROR([The cut program is required.])
186 fi
187
188 AC_PATH_PROGS([FIND], [find])
189 if test x$FIND = x
190 then
191 AC_MSG_ERROR([The find program is required.])
192 fi
193
194 if test x$WIN32 = xyes
195 then
196 AC_PATH_PROGS([WINDRES],
197 [windres $host_alias-windres $host_os-windres])
198 if test x$WINDRES = x
199 then
200 AC_MSG_ERROR([The windres program is required.])
201 fi
202
203 AC_PATH_PROGS([ZIP], [zip])
204 if test x$ZIP = x
205 then
206 AC_MSG_WARN([The zip program is needed to build a portable package.])
207 fi
208
209 AC_PATH_PROGS([MAKENSIS], [makensis])
210 if test x$MAKENSIS = x
211 then
212 AC_MSG_WARN([The makensis program is needed to build an installer.])
213 fi
214
215 AC_PATH_PROGS([GROFF], [groff])
216 if test x$GROFF = x
217 then
218 AC_MSG_WARN([The groff program is needed to create the manual page.])
219 fi
220 elif test x$NETBSD = xyes
221 then
222 AC_PATH_PROGS([PKGLINT], [pkglint])
223 fi
224
225 AM_CONDITIONAL([HAVE_MAKENSIS], [test x$MAKENSIS != x])
226
227 ####
228 AC_MSG_NOTICE([Checks for libraries.])
229 ####
230
231 ##### boost#####
232 website="http://www.boost.org/"
233 BOOST_BIND
234 BOOST_FUNCTION
235 BOOST_SMART_PTR
236 BOOST_STRING_ALGO
237
238 ##### SDL #####
239 website="http://www.libsdl.org/"
240 PKG_CHECK_MODULES([SDL], [sdl],
241 [LIBS="$LIBS $SDL_LIBS"
242 CFLAGS="$CFLAGS $SDL_CFLAGS"
243 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"],
244 [missing=yes
245 AC_MSG_WARN([Missing SDL ($website)])])
246
247 ##### opengl, glu #####
248 website="http://www.mesa3d.org/"
249 PKG_CHECK_MODULES([OPENGL], [gl glu],
250 [LIBS="$LIBS $OPENGL_LIBS"
251 CFLAGS="$CFLAGS $OPENGL_CFLAGS"
252 CXXFLAGS="$CXXFLAGS $OPENGL_CFLAGS"],
253 [missing=yes
254 AC_MSG_WARN([Missing OpenGL ($website)])])
255
256 ##### libpng #####
257 website="http://www.libpng.org/pub/png/libpng.html"
258 PKG_CHECK_MODULES([PNG], [libpng],
259 [LIBS="$LIBS $PNG_LIBS"
260 CFLAGS="$CFLAGS $PNG_CFLAGS"
261 CXXFLAGS="$CXXFLAGS $PNG_CFLAGS"],
262 [missing=yes
263 AC_MSG_WARN([Missing libpng ($website)])])
264
265 ##### openal #####
266 website="http://connect.creativelabs.com/openal/"
267 PKG_CHECK_MODULES([OPENAL], [openal],
268 [LIBS="$LIBS $OPENAL_LIBS"
269 CFLAGS="$CFLAGS $OPENAL_CFLAGS"
270 CXXFLAGS="$CXXFLAGS $OPENAL_CFLAGS"],
271 [missing=yes
272 AC_MSG_WARN([Missing OpenAL ($website)])])
273
274 ##### libvorbis #####
275 website="http://www.xiph.org/downloads/"
276 PKG_CHECK_MODULES([VORBIS], [vorbisfile],
277 [LIBS="$LIBS $VORBIS_LIBS"
278 CFLAGS="$CFLAGS $VORBIS_CFLAGS"
279 CXXFLAGS="$CXXFLAGS $VORBIS_CFLAGS"],
280 [missing=yes
281 AC_MSG_WARN([Missing libvorbisfile ($website)])])
282
283 ##### liblua #####
284 website="http://www.lua.org/"
285 PKG_CHECK_MODULES([LUA], [lua],
286 [LIBS="$LIBS $LUA_LIBS"
287 CFLAGS="$CFLAGS $LUA_CFLAGS"
288 CXXFLAGS="$CXXFLAGS $LUA_CFLAGS"],
289 [missing=yes
290 AC_MSG_WARN([Missing liblua ($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 AC_MSG_WARN([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([QT4], [QtGui],
309 [LIBS="$LIBS $QT4_LIBS"
310 CFLAGS="$CFLAGS $QT4_CFLAGS"
311 CXXFLAGS="$CXXFLAGS $QT4_CFLAGS"],
312 [missing=yes
313 AC_MSG_WARN([Missing QT4 ($website)])])
314 fi
315
316 if test x$WIN32 = xyes
317 then
318 # On Windows, sockets are in the ws2_32 library.
319 LIBS="$LIBS -lws2_32"
320 fi
321
322 if test x$missing = xyes
323 then
324 AC_MSG_ERROR([You are missing some required libraries.])
325 fi
326
327
328 ####
329 AC_MSG_NOTICE([Checks for header files.])
330 ####
331
332 AC_HEADER_STDBOOL
333 AC_HEADER_STDC
334 AC_CHECK_HEADERS([arpa/inet.h byteswap.h fcntl.h stddef.h stdint.h stdlib.h string.h unistd.h])
335
336
337 ####
338 AC_MSG_NOTICE([Checks for types.])
339 ####
340
341 AC_TYPE_UINT8_T
342 AC_TYPE_UINT16_T
343 AC_TYPE_UINT32_T
344 AC_TYPE_UINT64_T
345 AC_TYPE_SIZE_T
346
347
348 ####
349 AC_MSG_NOTICE([Checks for compiler characteristics.])
350 ####
351
352 AC_C_STRINGIZE
353 AC_C_INLINE
354
355
356 ####
357 AC_MSG_NOTICE([Checks for library functions.])
358 ####
359
360 AC_FUNC_ERROR_AT_LINE
361 AC_FUNC_STRTOD
362 AC_CHECK_FUNCS([fcntl nanosleep strchr strcspn strrchr strstr])
363
364 if test x$clock_gettime = xyes
365 then
366 AC_SEARCH_LIBS([clock_gettime], [rt],
367 [clock_gettime=yes],
368 [clock_gettime=no])
369 if test x$clock_gettime = xyes
370 then
371 AC_DEFINE([HAVE_CLOCK_GETTIME], 1,
372 [Define to 1 if you have the 'clock_gettime' function.])
373 else
374 AC_MSG_WARN([Falling back to SDL_GetTicks().])
375 fi
376 fi
377
378
379 #
380 # Find the game resources to install.
381 #
382
383 DATA_FILES=$(echo $(cd data && find . -name "*.lua" \
384 -o -name "*.ogg" \
385 -o -name "*.png" \
386 -o -name "yoinkrc"))
387 AC_SUBST([DATA_FILES])
388
389
390 #
391 # Split the version number into components.
392 # These definitions are used in the win32 resource file, src/yoink.rc.
393 #
394
395 VERSION_MAJOR=$(echo $VERSION | cut -d. -f1)
396 VERSION_MINOR=$(echo $VERSION | cut -d. -f2)
397 VERSION_REVISION=$(echo $VERSION | cut -d. -f3)
398
399 AC_DEFINE_UNQUOTED([VERSION_MAJOR], [${VERSION_MAJOR:-0}],
400 [Define to major version number component.])
401
402 AC_DEFINE_UNQUOTED([VERSION_MINOR], [${VERSION_MINOR:-0}],
403 [Define to minor version number component.])
404
405 AC_DEFINE_UNQUOTED([VERSION_REVISION], [${VERSION_REVISION:-0}],
406 [Define to revision version number component.])
407
408 PVERSION="${VERSION_MAJOR:-0}.${VERSION_MINOR:-0}.${VERSION_REVISION:-0}.0"
409 AC_SUBST([PVERSION])
410
411 if githead=$(git log -n1 --date=short --pretty=format:"%h (%ad)")
412 then
413 AC_DEFINE_UNQUOTED([YOINK_GITHEAD], ["$githead"],
414 [Define to the git commit currently checked out.])
415 fi
416
417
418 #
419 # Create the build files.
420 #
421
422 AC_CONFIG_FILES([Makefile
423 data/Makefile
424 doc/yoink.6
425 src/Makefile])
426
427 AC_CONFIG_HEADERS([src/config.h])
428
429 AC_OUTPUT
430
431
432 #
433 # Print a friendly little message.
434 #
435
436 echo ""
437 echo " Configuration complete! :-)"
438 echo ""
439 echo " Host: $target"
440 echo " Prefix: $prefix"
441 echo " Data: $DATADIR"
442 echo ""
443 echo " CXX: $CXX"
444 echo " CXXFLAGS: $(echo $CXXFLAGS)"
445 echo " LIBS: $(echo $LIBS)"
446 echo ""
447 echo " To finish the installation, execute:"
448 echo " make"
449 echo " make install"
450 echo ""
451
This page took 0.047249 seconds and 4 git commands to generate.