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_WITH([gui-toolkit],
81 [AS_HELP_STRING([--with-gui-toolkit=ARG],
82 [possible values: none (default), gtk, qt4])],
83 [gui_toolkit=$withval],
87 if test x$debug = xyes
89 CFLAGS="$CFLAGS -DDEBUG -ggdb -O0 -Wall -Wno-uninitialized"
90 CXXFLAGS="$CXXFLAGS -DDEBUG -ggdb -O0 -Wall -Wno-uninitialized"
92 CFLAGS="$CFLAGS -DNDEBUG"
93 CXXFLAGS="$CXXFLAGS -DNDEBUG"
96 if test x$double_precision = xyes
98 AC_DEFINE([USE_DOUBLE_PRECISION], 1,
99 [Define to 1 if you want to use doubles instead of floats.])
102 if test x$profile = xyes
105 CXXFLAGS="$CXXFLAGS -pg"
106 AC_DEFINE([PROFILING_ENABLED], 1,
107 [Define to 1 if profiling is built in.])
110 if test x$extra_warnings = xyes
112 CFLAGS="$CFLAGS -Wextra -Wno-unused-parameter"
113 CXXFLAGS="$CXXFLAGS -Wextra -Wno-unused-parameter"
116 AM_CONDITIONAL([LINK_SH], [test x$link_sh = xyes])
118 if test x$threads = xyes
120 AC_DEFINE([USE_THREADS], 1,
121 [Define to 1 if you want to use threads when applicable.])
124 if test x$gui_toolkit = xgtk
126 AC_DEFINE([USE_GTK], 1,
127 [Define to 1 if you want to use GTK+ modal dialogs.])
128 elif test x$gui_toolkit = xqt4
130 AC_DEFINE([USE_QT4], 1,
131 [Define to 1 if you want to use QT4 modal dialogs.])
135 if test "x$prefix" = xNONE
137 prefix="$ac_default_prefix"
140 if test x$WIN32 = xyes
144 eval eval DATADIR="${datadir}/$PACKAGE"
148 AC_DEFINE_UNQUOTED([YOINK_DATADIR], ["$DATADIR"],
149 [Define to the path of the game asset directory.])
153 AC_MSG_NOTICE([Checks for programs.])
164 AC_PATH_PROGS([CUT], [cut])
167 AC_MSG_ERROR([The cut program is required.])
170 AC_PATH_PROGS([FIND], [find])
173 AC_MSG_ERROR([The find program is required.])
176 if test x$WIN32 = xyes
178 AC_PATH_PROGS([WINDRES],
179 [windres $host_alias-windres $host_os-windres])
180 if test x$WINDRES = x
182 AC_MSG_ERROR([The windres program is required.])
185 AC_PATH_PROGS([ZIP], [zip])
188 AC_MSG_WARN([The zip program is needed to build a portable package.])
191 AC_PATH_PROGS([MAKENSIS], [makensis])
192 if test x$MAKENSIS = x
194 AC_MSG_WARN([The makensis program is needed to build an installer.])
197 AC_PATH_PROGS([GROFF], [groff])
200 AC_MSG_WARN([The groff program is needed to create the manual page.])
202 elif test x$NETBSD = xyes
204 AC_PATH_PROGS([PKGLINT], [pkglint])
207 AM_CONDITIONAL([HAVE_MAKENSIS], [test x$MAKENSIS != x])
210 AC_MSG_NOTICE([Checks for libraries.])
214 website="http://www.libsdl.org/"
215 PKG_CHECK_MODULES([SDL], [sdl],
216 [LIBS="$LIBS $SDL_LIBS"
217 CFLAGS="$CFLAGS $SDL_CFLAGS"
218 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"],
220 AC_MSG_WARN([Missing SDL ($website)])])
222 ##### opengl, glu #####
223 website="http://www.mesa3d.org/"
224 PKG_CHECK_MODULES([OPENGL], [gl glu],
225 [LIBS="$LIBS $OPENGL_LIBS"
226 CFLAGS="$CFLAGS $OPENGL_CFLAGS"
227 CXXFLAGS="$CXXFLAGS $OPENGL_CFLAGS"],
229 AC_MSG_WARN([Missing OpenGL ($website)])])
232 website="http://www.libpng.org/pub/png/libpng.html"
233 PKG_CHECK_MODULES([PNG], [libpng],
234 [LIBS="$LIBS $PNG_LIBS"
235 CFLAGS="$CFLAGS $PNG_CFLAGS"
236 CXXFLAGS="$CXXFLAGS $PNG_CFLAGS"],
238 AC_MSG_WARN([Missing libpng ($website)])])
241 website="http://connect.creativelabs.com/openal/"
242 PKG_CHECK_MODULES([OPENAL], [openal],
243 [LIBS="$LIBS $OPENAL_LIBS"
244 CFLAGS="$CFLAGS $OPENAL_CFLAGS"
245 CXXFLAGS="$CXXFLAGS $OPENAL_CFLAGS"],
247 AC_MSG_WARN([Missing OpenAL ($website)])])
249 ##### libvorbis #####
250 website="http://www.xiph.org/downloads/"
251 PKG_CHECK_MODULES([VORBIS], [vorbisfile],
252 [LIBS="$LIBS $VORBIS_LIBS"
253 CFLAGS="$CFLAGS $VORBIS_CFLAGS"
254 CXXFLAGS="$CXXFLAGS $VORBIS_CFLAGS"],
256 AC_MSG_WARN([Missing libvorbisfile ($website)])])
259 website="http://www.lua.org/"
260 PKG_CHECK_MODULES([LUA], [lua],
261 [LIBS="$LIBS $LUA_LIBS"
262 CFLAGS="$CFLAGS $LUA_CFLAGS"
263 CXXFLAGS="$CXXFLAGS $LUA_CFLAGS"],
265 AC_MSG_WARN([Missing liblua ($website)])])
268 if test x$gui_toolkit = xgtk
270 website="http://www.gtk.org/"
271 PKG_CHECK_MODULES([GTK], [gtk+-2.0],
272 [LIBS="$LIBS $GTK_LIBS"
273 CFLAGS="$CFLAGS $GTK_CFLAGS"
274 CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"],
276 AC_MSG_WARN([Missing GTK+-2.0 ($website)])])
280 if test x$gui_toolkit = xqt4
282 website="http://qt.nokia.com/"
283 PKG_CHECK_MODULES([QT4], [QtGui],
284 [LIBS="$LIBS $QT4_LIBS"
285 CFLAGS="$CFLAGS $QT4_CFLAGS"
286 CXXFLAGS="$CXXFLAGS $QT4_CFLAGS"],
288 AC_MSG_WARN([Missing QT4 ($website)])])
291 if test x$missing = xyes
293 AC_MSG_ERROR([You are missing some required libraries.])
298 AC_MSG_NOTICE([Checks for header files.])
303 AC_CHECK_HEADERS([stddef.h stdint.h stdlib.h string.h unistd.h])
312 AC_MSG_NOTICE([Checks for types.])
323 AC_MSG_NOTICE([Checks for compiler characteristics.])
331 AC_MSG_NOTICE([Checks for library functions.])
334 AC_FUNC_ERROR_AT_LINE
336 AC_CHECK_FUNCS([nanosleep strchr strcspn strrchr strstr])
338 if test x$clock_gettime = xyes
340 AC_SEARCH_LIBS([clock_gettime], [rt],
343 if test x$clock_gettime = xyes
345 AC_DEFINE([HAVE_CLOCK_GETTIME], 1,
346 [Define to 1 if you have the 'clock_gettime' function.])
348 AC_MSG_WARN([Falling back to SDL_GetTicks().])
354 # Find the game resources to install.
357 DATA_FILES=$(echo $(cd data && find . -name "*.lua" \
361 AC_SUBST([DATA_FILES])
365 # Split the version number into components.
366 # These definitions are used in the win32 resource file, src/yoink.rc.
369 VERSION_MAJOR=$(echo $VERSION | cut -d. -f1)
370 VERSION_MINOR=$(echo $VERSION | cut -d. -f2)
371 VERSION_REVISION=$(echo $VERSION | cut -d. -f3)
373 AC_DEFINE_UNQUOTED([VERSION_MAJOR], [${VERSION_MAJOR:-0}],
374 [Define to major version number component.])
376 AC_DEFINE_UNQUOTED([VERSION_MINOR], [${VERSION_MINOR:-0}],
377 [Define to minor version number component.])
379 AC_DEFINE_UNQUOTED([VERSION_REVISION], [${VERSION_REVISION:-0}],
380 [Define to revision version number component.])
382 PVERSION="${VERSION_MAJOR:-0}.${VERSION_MINOR:-0}.${VERSION_REVISION:-0}.0"
385 if githead=$(git log -n1 --date=short --pretty=format:"%h (%ad)")
387 AC_DEFINE_UNQUOTED([YOINK_GITHEAD], ["$githead"],
388 [Define to the git commit currently checked out.])
393 # Create the build files.
396 AC_CONFIG_FILES([Makefile
401 AC_CONFIG_HEADERS([src/config.h])
407 # Print a friendly little message.
411 echo " Configuration complete! :-)"
413 echo " Host: $target"
414 echo " Prefix: $prefix"
415 echo " Data: $DATADIR"
418 echo " CXXFLAGS: $(echo $CXXFLAGS)"
419 echo " LIBS: $(echo $LIBS)"
421 echo " To finish the installation, execute:"