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])
20 # Checks for programs.
21 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32 AC_PATH_PROGS([DOXYGEN], [doxygen])
36 # Configure platform-specific stuff.
37 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43 AC_PATH_PROGS([WINDRES], [windres $host_alias-windres $host_os-windres])
44 if test "x$WINDRES" = x
46 AC_MSG_ERROR([windres could not be found])
48 AC_PATH_PROGS([MAKENSIS], [makensis])
56 LIBS="$LIBS -Wl,-framework"
60 AM_CONDITIONAL([WIN32], test "$WIN32" = "yes")
64 # Checks for configuration arguments.
65 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
67 AC_ARG_ENABLE([debug],
68 [ --enable-debug include debugging symbols and features],
72 AC_ARG_ENABLE([double-precision],
73 [ --enable-double-precision use doubles instead of floats],
74 [double_precision=$enableval],
75 [double_precision=no])
77 AC_ARG_ENABLE([profile],
78 [ --enable-profile make a binary with code profiling instructions],
82 AC_ARG_ENABLE([extra-warnings],
83 [ --enable-extra-warnings make the gcc compiler give more warnings],
84 [extra_warnings=$enableval],
87 AC_ARG_ENABLE([clock_gettime],
88 [ --enable-clock_gettime use clock_gettime() instead of SDL_GetTicks()],
89 [clock_gettime=$enableval],
92 AC_ARG_ENABLE([threads],
93 [ --enable-threads use threads for concurrency where appropriate],
98 [ --enable-gtk enable GTK+ modal dialogs],
103 [ --enable-qt4 enable QT modal dialogs],
108 if test x$debug = xyes
110 CFLAGS="$CFLAGS -DDEBUG -ggdb -O0 -Wall -Wno-uninitialized"
111 CXXFLAGS="$CXXFLAGS -DDEBUG -ggdb -O0 -Wall -Wno-uninitialized"
113 CFLAGS="$CFLAGS -DNDEBUG"
114 CXXFLAGS="$CXXFLAGS -DNDEBUG"
117 if test x$double_precision = xyes
119 AC_DEFINE([USE_DOUBLE_PRECISION], 1,
120 [Define to 1 if you want to use doubles instead of floats.])
123 if test x$profile = xyes
126 CXXFLAGS="$CXXFLAGS -pg"
127 AC_DEFINE([PROFILING_ENABLED], 1,
128 [Define to 1 if profiling is built in.])
131 if test x$extra_warnings = xyes
133 CFLAGS="$CFLAGS -Wextra -Wno-unused-parameter"
134 CXXFLAGS="$CXXFLAGS -Wextra -Wno-unused-parameter"
137 if test x$threads = xyes
139 AC_DEFINE([USE_THREADS], 1,
140 [Define to 1 if you want to use threads when applicable.])
145 AC_DEFINE([USE_GTK], 1,
146 [Define to 1 if you want to use GTK+ modal dialogs.])
147 elif test x$qt4 = xyes
149 AC_DEFINE([USE_QT4], 1,
150 [Define to 1 if you want to use QT4 modal dialogs.])
154 if test "x$prefix" = xNONE
156 prefix="$ac_default_prefix"
159 if test x$WIN32 = xyes
163 eval eval DATADIR="${datadir}/$PACKAGE"
167 AC_DEFINE_UNQUOTED([YOINK_DATADIR], ["$DATADIR"],
168 [Define to path of game asset directory.])
172 # Split the version number into components.
173 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
175 VERSION_MAJOR=$(echo $VERSION | cut -d. -f1)
176 VERSION_MINOR=$(echo $VERSION | cut -d. -f2)
177 VERSION_REVISION=$(echo $VERSION | cut -d. -f3)
179 AC_DEFINE_UNQUOTED([VERSION_MAJOR], [${VERSION_MAJOR:-0}],
180 [Define to major version number component.])
182 AC_DEFINE_UNQUOTED([VERSION_MINOR], [${VERSION_MINOR:-0}],
183 [Define to minor version number component.])
185 AC_DEFINE_UNQUOTED([VERSION_REVISION], [${VERSION_REVISION:-0}],
186 [Define to revision version number component.])
188 if test x$WIN32 = xyes
190 PVERSION="${VERSION_MAJOR:-0}.${VERSION_MINOR:-0}.${VERSION_REVISION:-0}.0"
194 # these are used in src/yoink.rc
198 # Checks for system functions/headers and compiler characteristics.
199 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
210 AC_FUNC_ERROR_AT_LINE
212 AC_CHECK_FUNCS([nanosleep strchr strcspn strrchr strstr])
216 AC_CHECK_HEADERS([stddef.h stdint.h stdlib.h string.h unistd.h])
218 ##### clock_gettime #####
219 if test x$clock_gettime = xyes
221 AC_SEARCH_LIBS([clock_gettime], [rt],
222 [AC_DEFINE([HAVE_CLOCK_GETTIME], 1,
223 [Define to 1 if you have the 'clock_gettime' function.])])
228 # Checks for build dependencies.
229 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
231 echo "checking for dependencies..."
234 website="http://www.boost.org/"
241 website="http://www.libsdl.org/"
242 PKG_CHECK_MODULES([SDL], [sdl],
243 [LIBS="$LIBS $SDL_LIBS"
244 CFLAGS="$CFLAGS $SDL_CFLAGS"
245 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"],
247 echo "***** Missing SDL ($website) *****"])
249 ##### opengl, glu #####
250 website="http://www.mesa3d.org/"
251 PKG_CHECK_MODULES([OPENGL], [gl glu],
252 [LIBS="$LIBS $OPENGL_LIBS"
253 CFLAGS="$CFLAGS $OPENGL_CFLAGS"
254 CXXFLAGS="$CXXFLAGS $GLU_CFLAGS"],
256 echo "***** Missing OpenGL ($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 echo "***** Missing liblua ($website) *****"])
268 website="http://www.libpng.org/pub/png/libpng.html"
269 PKG_CHECK_MODULES([PNG], [libpng],
270 [LIBS="$LIBS $PNG_LIBS"
271 CFLAGS="$CFLAGS $PNG_CFLAGS"
272 CXXFLAGS="$CXXFLAGS $PNG_CFLAGS"],
274 echo "***** Missing libpng ($website) *****"])
277 website="http://connect.creativelabs.com/openal/"
278 PKG_CHECK_MODULES([OPENAL], [openal],
279 [LIBS="$LIBS $OPENAL_LIBS"
280 CFLAGS="$CFLAGS $OPENAL_CFLAGS"
281 CXXFLAGS="$CXXFLAGS $OPENAL_CFLAGS"],
283 echo "***** Missing OpenAL ($website) *****"])
285 ##### libvorbis #####
286 website="http://www.xiph.org/downloads/"
287 PKG_CHECK_MODULES([VORBIS], [vorbisfile],
288 [LIBS="$LIBS $VORBIS_LIBS"
289 CFLAGS="$CFLAGS $VORBIS_CFLAGS"
290 CXXFLAGS="$CXXFLAGS $VORBIS_CFLAGS"],
292 echo "***** Missing libvorbisfile ($website) *****"])
297 website="http://www.gtk.org/"
298 PKG_CHECK_MODULES([GTK], [gtk+-2.0],
299 [LIBS="$LIBS $GTK_LIBS"
300 CFLAGS="$CFLAGS $GTK_CFLAGS"
301 CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"],
303 echo "***** Missing GTK+-2.0 ($website) *****"])
309 website="http://qt.nokia.com/"
310 PKG_CHECK_MODULES([QT], [QtGui],
311 [LIBS="$LIBS $QT_LIBS"
312 CFLAGS="$CFLAGS $QT_CFLAGS"
313 CXXFLAGS="$CXXFLAGS $QT_CFLAGS"],
315 echo "***** Missing QT ($website) *****"])
319 if test x$missing == xyes
321 AC_MSG_ERROR([Please resolve the missing dependencies, and try again.])
326 # Find the game resources to install.
327 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
329 DATA_FILES=$(echo $(cd data && find . -name "*.lua" \
333 AC_SUBST([DATA_FILES])
337 # Create the build files.
338 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
340 AC_CONFIG_FILES([Makefile
346 AC_CONFIG_HEADERS([src/config.h])
352 # Print a friendly little message.
353 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
356 echo " Configuration complete! :-)"
358 echo " Host: $target"
359 echo " Prefix: $prefix"
360 echo " Data: $DATADIR"
363 echo " CXXFLAGS: $(echo $CXXFLAGS)"
364 echo " LIBS: $(echo $LIBS)"
366 echo " To finish the installation, execute:"