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/GameLayer.cc])
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])
49 AC_PATH_PROGS([MAKENSIS], [makensis])
58 LIBS="$LIBS -Wl,-framework"
65 AM_CONDITIONAL([LINUX], test "$LINUX" = "yes")
66 AM_CONDITIONAL([WIN32], test "$WIN32" = "yes")
70 # Checks for configuration arguments.
71 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
73 AC_ARG_ENABLE([debug],
74 [ --enable-debug include debugging symbols and features],
78 AC_ARG_ENABLE([double-precision],
79 [ --enable-double-precision use double-precision numbers],
80 [double_precision=$enableval],
81 [double_precision=no])
83 AC_ARG_ENABLE([profile],
84 [ --enable-profile make a binary for use with gprof profiler],
88 AC_ARG_ENABLE([extra-warnings],
89 [ --enable-extra-warnings make the gcc compiler give more warnings],
90 [extra_warnings=$enableval],
93 AC_ARG_ENABLE([threads],
94 [ --enable-threads use threads for some parallel tasks],
99 [ --enable-gtk enable GTK+ info/warning dialogs],
104 [ --enable-qt4 enable QT info/warning dialogs],
108 AC_ARG_WITH([log-level],
109 [AS_HELP_STRING([--with-log-level=NUM],
110 [0, none... 1, errors... 4, everything (default: 3)])],
111 [log_level=$withval],
115 if test x$debug = xyes
117 CFLAGS="$CFLAGS -DDEBUG -Wall -Wno-uninitialized"
118 CXXFLAGS="$CXXFLAGS -DDEBUG -Wall -Wno-uninitialized"
120 CFLAGS="$CFLAGS -DNDEBUG"
121 CXXFLAGS="$CXXFLAGS -DNDEBUG"
124 if test x$double_precision = xyes
126 AC_DEFINE([USE_DOUBLE_PRECISION], 1,
127 [Define to 1 if you want to use doubles instead of floats.])
130 if test x$profile = xyes
133 CXXFLAGS="$CXXFLAGS -pg"
134 AC_DEFINE([PROFILING_ENABLED], 1,
135 [Define to 1 if profiling is built in.])
138 if test x$extra_warnings = xyes
140 CFLAGS="$CFLAGS -Wextra -Wno-unused-parameter"
141 CXXFLAGS="$CXXFLAGS -Wextra -Wno-unused-parameter"
144 if test x$threads = xyes
146 AC_DEFINE([USE_THREADS], 1,
147 [Define to 1 if you want to use threads for parallel tasks.])
152 AC_DEFINE([USE_GTK], 1,
153 [Define to 1 if you want to use GTK+ info/error dialogs.])
157 AC_DEFINE([USE_QT4], 1,
158 [Define to 1 if you want to use QT info/error dialogs.])
162 AC_DEFINE_UNQUOTED([YOINK_LOGLEVEL], [$log_level],
163 [Define to detail level of logging.])
166 if test "x$prefix" = xNONE
168 prefix="$ac_default_prefix"
171 if test x$WIN32 = xyes
175 eval eval DATADIR="${datadir}/$PACKAGE"
179 AC_DEFINE_UNQUOTED([YOINK_DATADIR], ["$DATADIR"],
180 [Define to path of game asset directory.])
184 # Split the version number into components.
185 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
187 VERSION_MAJOR=$(echo $VERSION | cut -d. -f1)
188 VERSION_MINOR=$(echo $VERSION | cut -d. -f2)
189 VERSION_REVISION=$(echo $VERSION | cut -d. -f3)
191 AC_DEFINE_UNQUOTED([VERSION_MAJOR], [${VERSION_MAJOR:-0}],
192 [Define to major version number component.])
194 AC_DEFINE_UNQUOTED([VERSION_MINOR], [${VERSION_MINOR:-0}],
195 [Define to minor version number component.])
197 AC_DEFINE_UNQUOTED([VERSION_REVISION], [${VERSION_REVISION:-0}],
198 [Define to revision version number component.])
200 if test x$WIN32 = xyes
202 PVERSION="${VERSION_MAJOR:-0}.${VERSION_MINOR:-0}.${VERSION_REVISION:-0}.0"
206 # these are used in src/yoink.rc
210 # Checks for system functions/headers and compiler characteristics.
211 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
222 AC_FUNC_ERROR_AT_LINE
224 AC_CHECK_FUNCS([nanosleep strchr strcspn strrchr strstr])
228 AC_CHECK_HEADERS([stddef.h stdint.h stdlib.h string.h unistd.h])
232 # Checks for build dependencies.
233 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
236 website="http://www.boost.org/"
243 website="http://www.libsdl.org/"
244 AM_PATH_SDL([1.2.10],
245 [CFLAGS="$CFLAGS $SDL_CFLAGS"
246 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
247 LIBS="$LIBS $SDL_LIBS"])
249 ##### opengl, glu #####
250 website="http://www.mesa3d.org/"
251 AC_CHECK_HEADERS([GL/gl.h GL/glu.h],,
253 echo "***** Missing GL headers ($website) *****"])
254 if test x$WIN32 == xyes
256 # autoconf library search macro doesn't find opengl32 on windows because it uses
257 # different name hashing, but it links fine; assume it's there
258 LIBS="$LIBS -lglu32 -lopengl32"
260 AC_SEARCH_LIBS([glEnable], [GL MesaGL],,
262 echo "***** Missing libGL ($website) *****"])
263 AC_SEARCH_LIBS([gluDisk], [GLU MesaGLU],,
265 echo "***** Missing libGLU ($website) *****"])
268 ##### openal, alut #####
269 website="http://connect.creativelabs.com/openal/"
270 AC_CHECK_HEADERS([AL/al.h AL/alut.h],,
272 echo "***** Missing OpenAL headers ($website) *****"])
273 AC_SEARCH_LIBS([alEnable], [openal openal32],,
275 echo "***** Missing libopenal ($website) *****"])
276 AC_SEARCH_LIBS([alutInit], [alut],,
278 echo "***** Missing libalut ($website) *****"])
280 ##### SDL_image #####
281 website="http://www.libsdl.org/projects/SDL_image/"
282 AC_CHECK_HEADERS([SDL/SDL_image.h],,
284 echo "***** Missing SDL_image header ($website) *****"])
285 AC_SEARCH_LIBS([IMG_Load], [SDL_image],,
287 echo "***** Missing libSDL_image ($website) *****"])
289 ##### libvorbis #####
290 website="http://www.xiph.org/downloads/"
291 AC_CHECK_HEADERS([vorbis/codec.h vorbis/vorbisfile.h],,
293 echo "***** Missing vorbis headers ($website) *****"])
294 AC_SEARCH_LIBS([ov_open], [vorbisfile],,
296 echo "***** Missing libvorbisfile ($website) *****"])
299 website="http://www.lua.org/"
300 AC_CHECK_HEADERS([lua.h],,
302 echo "***** Missing lua headers ($website) *****"])
303 AC_SEARCH_LIBS([lua_load], [lua],,
305 echo "***** Missing liblua ($website) *****"])
310 website="http://www.gtk.org/"
311 PKG_CHECK_MODULES([GTK], [gtk+-2.0],
312 [LIBS="$LIBS $GTK_LIBS"
313 CFLAGS="$CFLAGS $GTK_CFLAGS"
314 CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"],
316 echo "***** Missing GTK+-2.0 ($website) *****"])
322 website="http://qt.nokia.com/"
323 PKG_CHECK_MODULES([QT], [QtGui],
324 [LIBS="$LIBS $QT_LIBS"
325 CFLAGS="$CFLAGS $QT_CFLAGS"
326 CXXFLAGS="$CXXFLAGS $QT_CFLAGS"],
328 echo "***** Missing QT ($website) *****"])
331 ##### librt (optional) #####
332 AC_SEARCH_LIBS([clock_gettime], [rt],
333 [AC_DEFINE([HAVE_CLOCK_GETTIME], 1,
334 [Define to 1 if you have the 'clock_gettime' function.])])
337 if test x$missing == xyes
339 AC_MSG_ERROR([please install missing dependencies (see messages above)])
344 # Find the data files to install.
345 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
347 DATA_FILES=$(echo $(cd data; \
348 find . -name "*.lua" \
352 AC_SUBST([DATA_FILES])
356 # Create the build files.
357 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
359 AC_CONFIG_FILES([Makefile
362 doc/Makefile doc/yoink.6
363 win32/Makefile win32/build-installer.sh])
365 AC_CONFIG_HEADERS([src/config.h])
371 # Print a friendly little message.
372 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
375 echo " Configuration complete! :-)"
377 echo " Target: $target"
378 echo " Prefix: $prefix"
379 echo " Data Directory: $DATADIR"
380 echo " Log Level: $log_level"
381 echo " Debug: $debug"
382 echo " Double Precision: $double_precision"
383 echo " Profile: $profile"
384 echo " Extra Warnings: $extra_warnings"
386 echo " To finish the installation, execute:"