4 # Process this file with autoconf to produce a configure script.
9 AC_INIT([Yoink],[0.1],[chaz@dogcows.com],[yoink])
13 AC_CONFIG_SRCDIR([src/version.c])
14 AC_CONFIG_MACRO_DIR([m4])
16 AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip])
20 # Determine the target platform.
24 *mingw32*) WIN32=yes ;;
25 *-apple-darwin*) MACOSX=yes ;;
26 *netbsd*) NETBSD=yes ;;
29 AM_CONDITIONAL([WIN32], [test x$WIN32 = xyes])
30 AM_CONDITIONAL([MACOSX], [test x$MACOSX = xyes])
31 AM_CONDITIONAL([NETBSD], [test x$NETBSD = xyes])
35 # Checks for configuration arguments.
38 AC_ARG_ENABLE([debug],
39 [AS_HELP_STRING([--enable-debug],
40 [include debugging symbols and code paths])],
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])
50 AC_ARG_ENABLE([profile],
51 [AS_HELP_STRING([--enable-profile],
52 [make a binary with code profiling instructions])],
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],
62 AC_ARG_ENABLE([link-sh],
63 [AS_HELP_STRING([--enable-link-sh],
64 [give the executable fewer direct dependencies])],
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],
74 AC_ARG_ENABLE([threads],
75 [AS_HELP_STRING([--enable-threads],
76 [use threads for concurrency where appropriate])],
80 AC_ARG_ENABLE([hotloading],
81 [AS_HELP_STRING([--enable-hotloading],
82 [monitor assets and reload them when they change])],
83 [hotloading=$enableval],
87 [AS_HELP_STRING([--with-gtk],
88 [use gtk2 modal dialogs])],
93 [AS_HELP_STRING([--with-qt4],
94 [use qt4 modal dialogs; overridden by --with-gtk])],
99 if test x$debug = xyes
101 CFLAGS="$CFLAGS -DDEBUG -ggdb -O0 -Wall -Wno-uninitialized"
102 CXXFLAGS="$CXXFLAGS -DDEBUG -ggdb -O0 -Wall -Wno-uninitialized"
104 CFLAGS="$CFLAGS -DNDEBUG"
105 CXXFLAGS="$CXXFLAGS -DNDEBUG"
108 if test x$double_precision = xyes
110 AC_DEFINE([USE_DOUBLE_PRECISION], 1,
111 [Define to 1 if you want to use doubles instead of floats.])
114 if test x$profile = xyes
117 CXXFLAGS="$CXXFLAGS -pg"
118 AC_DEFINE([PROFILING_ENABLED], 1,
119 [Define to 1 if profiling is built in.])
122 if test x$extra_warnings = xyes
124 CFLAGS="$CFLAGS -Wextra -Wno-unused-parameter"
125 CXXFLAGS="$CXXFLAGS -Wextra -Wno-unused-parameter"
128 AM_CONDITIONAL([LINK_SH], [test x$link_sh = xyes])
130 if test x$threads = xyes
132 AC_DEFINE([USE_THREADS], 1,
133 [Define to 1 if you want to use threads when applicable.])
136 if test x$hotloading = xyes
138 AC_DEFINE([USE_HOTLOADING], 1,
139 [Define to 1 if you want to use hotloading assets.])
144 AC_DEFINE([USE_GTK], 1,
145 [Define to 1 if you want to use GTK+ modal dialogs.])
146 elif test x$qt4 = xyes
148 AC_DEFINE([USE_QT4], 1,
149 [Define to 1 if you want to use QT4 modal dialogs.])
153 if test "x$prefix" = xNONE
155 prefix="$ac_default_prefix"
158 if test x$WIN32 = xyes
162 eval eval DATADIR="${datadir}/$PACKAGE"
166 AC_DEFINE_UNQUOTED([YOINK_DATADIR], ["$DATADIR"],
167 [Define to the path of the game asset directory.])
171 AC_MSG_NOTICE([Checks for programs.])
182 AC_PATH_PROGS([CUT], [cut])
185 AC_MSG_ERROR([The cut program is required.])
188 AC_PATH_PROGS([FIND], [find])
191 AC_MSG_ERROR([The find program is required.])
194 if test x$WIN32 = xyes
196 AC_PATH_PROGS([WINDRES],
197 [windres $host_alias-windres $host_os-windres])
198 if test x$WINDRES = x
200 AC_MSG_ERROR([The windres program is required.])
203 AC_PATH_PROGS([ZIP], [zip])
206 AC_MSG_WARN([The zip program is needed to build a portable package.])
209 AC_PATH_PROGS([MAKENSIS], [makensis])
210 if test x$MAKENSIS = x
212 AC_MSG_WARN([The makensis program is needed to build an installer.])
215 AC_PATH_PROGS([GROFF], [groff])
218 AC_MSG_WARN([The groff program is needed to create the manual page.])
220 elif test x$NETBSD = xyes
222 AC_PATH_PROGS([PKGLINT], [pkglint])
225 AM_CONDITIONAL([HAVE_MAKENSIS], [test x$MAKENSIS != x])
228 AC_MSG_NOTICE([Checks for libraries.])
232 website="http://www.boost.org/"
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"],
245 AC_MSG_WARN([Missing SDL ($website)])])
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"],
254 AC_MSG_WARN([Missing OpenGL ($website)])])
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"],
263 AC_MSG_WARN([Missing libpng ($website)])])
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"],
272 AC_MSG_WARN([Missing OpenAL ($website)])])
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"],
281 AC_MSG_WARN([Missing libvorbisfile ($website)])])
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"],
290 AC_MSG_WARN([Missing liblua ($website)])])
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"],
301 AC_MSG_WARN([Missing GTK+-2.0 ($website)])])
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"],
313 AC_MSG_WARN([Missing QT4 ($website)])])
316 if test x$WIN32 = xyes
318 # On Windows, sockets are in the ws2_32 library.
319 LIBS="$LIBS -lws2_32"
322 if test x$missing = xyes
324 AC_MSG_ERROR([You are missing some required libraries.])
329 AC_MSG_NOTICE([Checks for header files.])
334 AC_CHECK_HEADERS([arpa/inet.h byteswap.h fcntl.h stddef.h stdint.h stdlib.h string.h unistd.h])
338 AC_MSG_NOTICE([Checks for types.])
349 AC_MSG_NOTICE([Checks for compiler characteristics.])
357 AC_MSG_NOTICE([Checks for library functions.])
360 AC_FUNC_ERROR_AT_LINE
362 AC_CHECK_FUNCS([fcntl nanosleep strchr strcspn strrchr strstr])
364 if test x$clock_gettime = xyes
366 AC_SEARCH_LIBS([clock_gettime], [rt],
369 if test x$clock_gettime = xyes
371 AC_DEFINE([HAVE_CLOCK_GETTIME], 1,
372 [Define to 1 if you have the 'clock_gettime' function.])
374 AC_MSG_WARN([Falling back to SDL_GetTicks().])
380 # Find the game resources to install.
383 DATA_FILES=$(echo $(cd data && find . -name "*.lua" \
387 AC_SUBST([DATA_FILES])
391 # Split the version number into components.
392 # These definitions are used in the win32 resource file, src/yoink.rc.
395 VERSION_MAJOR=$(echo $VERSION | cut -d. -f1)
396 VERSION_MINOR=$(echo $VERSION | cut -d. -f2)
397 VERSION_REVISION=$(echo $VERSION | cut -d. -f3)
399 AC_DEFINE_UNQUOTED([VERSION_MAJOR], [${VERSION_MAJOR:-0}],
400 [Define to major version number component.])
402 AC_DEFINE_UNQUOTED([VERSION_MINOR], [${VERSION_MINOR:-0}],
403 [Define to minor version number component.])
405 AC_DEFINE_UNQUOTED([VERSION_REVISION], [${VERSION_REVISION:-0}],
406 [Define to revision version number component.])
408 PVERSION="${VERSION_MAJOR:-0}.${VERSION_MINOR:-0}.${VERSION_REVISION:-0}.0"
411 if githead=$(git log -n1 --date=short --pretty=format:"%h (%ad)")
413 AC_DEFINE_UNQUOTED([YOINK_GITHEAD], ["$githead"],
414 [Define to the git commit currently checked out.])
419 # Create the build files.
422 AC_CONFIG_FILES([Makefile
427 AC_CONFIG_HEADERS([src/config.h])
433 # Print a friendly little message.
437 echo " Configuration complete! :-)"
439 echo " Host: $target"
440 echo " Prefix: $prefix"
441 echo " Data: $DATADIR"
444 echo " CXXFLAGS: $(echo $CXXFLAGS)"
445 echo " LIBS: $(echo $LIBS)"
447 echo " To finish the installation, execute:"