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])
16 AM_INIT_AUTOMAKE([subdir-objects])
17 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
21 # Checks for programs.
22 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33 AC_PATH_PROGS([DOXYGEN], [doxygen])
37 # Configure platform-specific stuff.
38 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
44 AC_PATH_PROGS([WINDRES], [windres $host_alias-windres $host_os-windres])
45 if test "x$WINDRES" = x
47 AC_MSG_ERROR([windres could not be found])
50 AC_PATH_PROGS([MAKENSIS], [makensis])
59 LIBS="$LIBS -Wl,-framework"
66 AM_CONDITIONAL([LINUX], test "$LINUX" = "yes")
67 AM_CONDITIONAL([WIN32], test "$WIN32" = "yes")
71 # Checks for configuration arguments.
72 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
74 AC_ARG_ENABLE([debug],
75 [ --enable-debug include debugging symbols and features],
79 AC_ARG_ENABLE([double-precision],
80 [ --enable-double-precision use double-precision numbers],
81 [double_precision=$enableval],
82 [double_precision=no])
84 AC_ARG_ENABLE([profile],
85 [ --enable-profile make a binary for use with gprof profiler],
89 AC_ARG_ENABLE([extra-warnings],
90 [ --enable-extra-warnings make the gcc compiler give more warnings],
91 [extra_warnings=$enableval],
94 AC_ARG_ENABLE([threads],
95 [ --enable-threads use threads for some parallel tasks],
100 [ --enable-gtk enable GTK+ info/warning dialogs],
105 [ --enable-qt4 enable QT info/warning dialogs],
109 AC_ARG_WITH([log-level],
110 [AS_HELP_STRING([--with-log-level=NUM],
111 [0, none... 1, errors... 4, everything (default: 3)])],
112 [log_level=$withval],
116 if test x$debug = xyes
118 CFLAGS="$CFLAGS -DDEBUG -Wall -Wno-uninitialized"
119 CXXFLAGS="$CXXFLAGS -DDEBUG -Wall -Wno-uninitialized"
121 CFLAGS="$CFLAGS -DNDEBUG"
122 CXXFLAGS="$CXXFLAGS -DNDEBUG"
125 if test x$double_precision = xyes
127 AC_DEFINE([USE_DOUBLE_PRECISION], 1,
128 [Define to 1 if you want to use doubles instead of floats.])
131 if test x$profile = xyes
134 CXXFLAGS="$CXXFLAGS -pg"
135 AC_DEFINE([PROFILING_ENABLED], 1,
136 [Define to 1 if profiling is built in.])
139 if test x$extra_warnings = xyes
141 CFLAGS="$CFLAGS -Wextra -Wno-unused-parameter"
142 CXXFLAGS="$CXXFLAGS -Wextra -Wno-unused-parameter"
145 if test x$threads = xyes
147 AC_DEFINE([USE_THREADS], 1,
148 [Define to 1 if you want to use threads for parallel tasks.])
153 AC_DEFINE([USE_GTK], 1,
154 [Define to 1 if you want to use GTK+ info/error dialogs.])
158 AC_DEFINE([USE_QT4], 1,
159 [Define to 1 if you want to use QT info/error dialogs.])
163 AC_DEFINE_UNQUOTED([YOINK_LOGLEVEL], [$log_level],
164 [Define to detail level of logging.])
167 if test "x$prefix" = xNONE
169 prefix="$ac_default_prefix"
172 if test x$WIN32 = xyes
176 eval eval DATADIR="${datadir}/$PACKAGE"
180 AC_DEFINE_UNQUOTED([YOINK_DATADIR], ["$DATADIR"],
181 [Define to path of game asset directory.])
185 # Split the version number into components.
186 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
188 VERSION_MAJOR=$(echo $VERSION | cut -d. -f1)
189 VERSION_MINOR=$(echo $VERSION | cut -d. -f2)
190 VERSION_REVISION=$(echo $VERSION | cut -d. -f3)
192 AC_DEFINE_UNQUOTED([VERSION_MAJOR], [${VERSION_MAJOR:-0}],
193 [Define to major version number component.])
195 AC_DEFINE_UNQUOTED([VERSION_MINOR], [${VERSION_MINOR:-0}],
196 [Define to minor version number component.])
198 AC_DEFINE_UNQUOTED([VERSION_REVISION], [${VERSION_REVISION:-0}],
199 [Define to revision version number component.])
201 if test x$WIN32 = xyes
203 PVERSION="${VERSION_MAJOR:-0}.${VERSION_MINOR:-0}.${VERSION_REVISION:-0}.0"
207 # these are used in src/yoink.rc
211 # Checks for system functions/headers and compiler characteristics.
212 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
223 AC_FUNC_ERROR_AT_LINE
225 AC_CHECK_FUNCS([nanosleep strchr strcspn strrchr strstr])
229 AC_CHECK_HEADERS([stddef.h stdint.h stdlib.h string.h unistd.h])
233 # Checks for build dependencies.
234 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
237 website="http://www.boost.org/"
244 website="http://www.libsdl.org/"
245 AM_PATH_SDL([1.2.10],
246 [CFLAGS="$CFLAGS $SDL_CFLAGS"
247 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
248 LIBS="$LIBS $SDL_LIBS"])
250 ##### opengl, glu #####
251 website="http://www.mesa3d.org/"
252 AC_CHECK_HEADERS([GL/gl.h GL/glu.h],,
254 echo "***** Missing GL headers ($website) *****"])
255 if test x$WIN32 == xyes
257 # autoconf library search macro doesn't find opengl32 on windows because it uses
258 # different name hashing, but it links fine; assume it's there
259 LIBS="$LIBS -lglu32 -lopengl32"
261 AC_SEARCH_LIBS([glEnable], [GL MesaGL],,
263 echo "***** Missing libGL ($website) *****"])
264 AC_SEARCH_LIBS([gluDisk], [GLU MesaGLU],,
266 echo "***** Missing libGLU ($website) *****"])
270 website="http://connect.creativelabs.com/openal/"
271 AC_CHECK_HEADERS([AL/al.h AL/alc.h],,
273 echo "***** Missing OpenAL headers ($website) *****"])
274 AC_SEARCH_LIBS([alEnable], [openal OpenAL32],,
276 echo "***** Missing libopenal ($website) *****"])
278 ##### SDL_image #####
279 website="http://www.libsdl.org/projects/SDL_image/"
280 AC_CHECK_HEADERS([SDL/SDL_image.h],,
282 echo "***** Missing SDL_image header ($website) *****"])
283 AC_SEARCH_LIBS([IMG_Load], [SDL_image],,
285 echo "***** Missing libSDL_image ($website) *****"])
287 ##### libvorbis #####
288 website="http://www.xiph.org/downloads/"
289 AC_CHECK_HEADERS([vorbis/codec.h vorbis/vorbisfile.h],,
291 echo "***** Missing vorbis headers ($website) *****"])
292 AC_SEARCH_LIBS([ov_open], [vorbisfile],,
294 echo "***** Missing libvorbisfile ($website) *****"])
297 website="http://www.lua.org/"
298 AC_CHECK_HEADERS([lua.h],,
300 echo "***** Missing lua headers ($website) *****"])
301 AC_SEARCH_LIBS([lua_load], [lua],,
303 echo "***** Missing liblua ($website) *****"])
308 website="http://www.gtk.org/"
309 PKG_CHECK_MODULES([GTK], [gtk+-2.0],
310 [LIBS="$LIBS $GTK_LIBS"
311 CFLAGS="$CFLAGS $GTK_CFLAGS"
312 CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"],
314 echo "***** Missing GTK+-2.0 ($website) *****"])
320 website="http://qt.nokia.com/"
321 PKG_CHECK_MODULES([QT], [QtGui],
322 [LIBS="$LIBS $QT_LIBS"
323 CFLAGS="$CFLAGS $QT_CFLAGS"
324 CXXFLAGS="$CXXFLAGS $QT_CFLAGS"],
326 echo "***** Missing QT ($website) *****"])
329 ##### librt (optional) #####
330 AC_SEARCH_LIBS([clock_gettime], [rt],
331 [AC_DEFINE([HAVE_CLOCK_GETTIME], 1,
332 [Define to 1 if you have the 'clock_gettime' function.])])
335 if test x$missing == xyes
337 AC_MSG_ERROR([please install missing dependencies (see messages above)])
342 # Find the data files to install.
343 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
345 DATA_FILES=$(echo $(cd data; \
346 find . -name "*.lua" \
350 AC_SUBST([DATA_FILES])
354 # Create the build files.
355 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
357 AC_CONFIG_FILES([Makefile
363 if test x$WIN32 = xyes
365 AC_CONFIG_FILES([win32/Makefile win32/build-installer.sh])
369 AC_CONFIG_HEADERS([src/config.h])
375 # Print a friendly little message.
376 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
379 echo " Configuration complete! :-)"
381 echo " Target: $target"
382 echo " Prefix: $prefix"
383 echo " Data Directory: $DATADIR"
384 echo " Log Level: $log_level"
385 echo " Debug: $debug"
386 echo " Double Precision: $double_precision"
387 echo " Profile: $profile"
388 echo " Extra Warnings: $extra_warnings"
390 echo " To finish the installation, execute:"