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])
49 AC_PATH_PROGS([MAKENSIS], [makensis])
57 LIBS="$LIBS -Wl,-framework"
61 AM_CONDITIONAL([WIN32], test "$WIN32" = "yes")
65 # Checks for configuration arguments.
66 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
68 AC_ARG_ENABLE([debug],
69 [ --enable-debug include debugging symbols and features],
73 AC_ARG_ENABLE([double-precision],
74 [ --enable-double-precision use double-precision numbers],
75 [double_precision=$enableval],
76 [double_precision=no])
78 AC_ARG_ENABLE([profile],
79 [ --enable-profile make a binary for use with gprof profiler],
83 AC_ARG_ENABLE([extra-warnings],
84 [ --enable-extra-warnings make the gcc compiler give more warnings],
85 [extra_warnings=$enableval],
88 AC_ARG_ENABLE([threads],
89 [ --enable-threads use threads for some parallel tasks],
94 [ --enable-gtk enable GTK+ info/warning dialogs],
99 [ --enable-qt4 enable QT info/warning dialogs],
103 AC_ARG_WITH([log-level],
104 [AS_HELP_STRING([--with-log-level=NUM],
105 [0, none... 1, errors... 4, everything (default: 3)])],
106 [log_level=$withval],
110 if test x$debug = xyes
112 CFLAGS="$CFLAGS -DDEBUG -Wall -Wno-uninitialized"
113 CXXFLAGS="$CXXFLAGS -DDEBUG -Wall -Wno-uninitialized"
115 CFLAGS="$CFLAGS -DNDEBUG"
116 CXXFLAGS="$CXXFLAGS -DNDEBUG"
119 if test x$double_precision = xyes
121 AC_DEFINE([USE_DOUBLE_PRECISION], 1,
122 [Define to 1 if you want to use doubles instead of floats.])
125 if test x$profile = xyes
128 CXXFLAGS="$CXXFLAGS -pg"
129 AC_DEFINE([PROFILING_ENABLED], 1,
130 [Define to 1 if profiling is built in.])
133 if test x$extra_warnings = xyes
135 CFLAGS="$CFLAGS -Wextra -Wno-unused-parameter"
136 CXXFLAGS="$CXXFLAGS -Wextra -Wno-unused-parameter"
139 if test x$threads = xyes
141 AC_DEFINE([USE_THREADS], 1,
142 [Define to 1 if you want to use threads for parallel tasks.])
147 AC_DEFINE([USE_GTK], 1,
148 [Define to 1 if you want to use GTK+ info/error dialogs.])
149 elif test x$qt4 = xyes
151 AC_DEFINE([USE_QT4], 1,
152 [Define to 1 if you want to use QT info/error dialogs.])
155 AC_DEFINE_UNQUOTED([YOINK_LOGLEVEL], [$log_level],
156 [Define to detail level of logging.])
159 if test "x$prefix" = xNONE
161 prefix="$ac_default_prefix"
164 if test x$WIN32 = xyes
168 eval eval DATADIR="${datadir}/$PACKAGE"
172 AC_DEFINE_UNQUOTED([YOINK_DATADIR], ["$DATADIR"],
173 [Define to path of game asset directory.])
177 # Split the version number into components.
178 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
180 VERSION_MAJOR=$(echo $VERSION | cut -d. -f1)
181 VERSION_MINOR=$(echo $VERSION | cut -d. -f2)
182 VERSION_REVISION=$(echo $VERSION | cut -d. -f3)
184 AC_DEFINE_UNQUOTED([VERSION_MAJOR], [${VERSION_MAJOR:-0}],
185 [Define to major version number component.])
187 AC_DEFINE_UNQUOTED([VERSION_MINOR], [${VERSION_MINOR:-0}],
188 [Define to minor version number component.])
190 AC_DEFINE_UNQUOTED([VERSION_REVISION], [${VERSION_REVISION:-0}],
191 [Define to revision version number component.])
193 if test x$WIN32 = xyes
195 PVERSION="${VERSION_MAJOR:-0}.${VERSION_MINOR:-0}.${VERSION_REVISION:-0}.0"
199 # these are used in src/yoink.rc
203 # Checks for system functions/headers and compiler characteristics.
204 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
215 AC_FUNC_ERROR_AT_LINE
217 AC_CHECK_FUNCS([nanosleep strchr strcspn strrchr strstr])
221 AC_CHECK_HEADERS([stddef.h stdint.h stdlib.h string.h unistd.h])
225 # Checks for build dependencies.
226 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
229 website="http://www.boost.org/"
236 website="http://www.libsdl.org/"
237 AM_PATH_SDL([1.2.10],
238 [CFLAGS="$CFLAGS $SDL_CFLAGS"
239 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
240 LIBS="$LIBS $SDL_LIBS"])
242 ##### opengl, glu #####
243 website="http://www.mesa3d.org/"
244 AC_CHECK_HEADERS([GL/gl.h GL/glu.h],,
246 echo "***** Missing GL headers ($website) *****"])
247 if test x$WIN32 = xyes
249 # autoconf library search macro doesn't find opengl32 on windows because it uses
250 # different name hashing, but it links fine; assume it's there
251 LIBS="$LIBS -lglu32 -lopengl32"
253 AC_SEARCH_LIBS([glEnable], [GL MesaGL],,
255 echo "***** Missing libGL ($website) *****"])
256 AC_SEARCH_LIBS([gluDisk], [GLU MesaGLU],,
258 echo "***** Missing libGLU ($website) *****"])
262 website="http://connect.creativelabs.com/openal/"
263 AC_CHECK_HEADERS([AL/al.h AL/alc.h],,
265 echo "***** Missing OpenAL headers ($website) *****"])
266 AC_SEARCH_LIBS([alEnable], [openal OpenAL32],,
268 echo "***** Missing libopenal ($website) *****"])
270 ##### SDL_image #####
271 website="http://www.libsdl.org/projects/SDL_image/"
272 AC_CHECK_HEADERS([SDL/SDL_image.h],,
274 echo "***** Missing SDL_image header ($website) *****"])
275 AC_SEARCH_LIBS([IMG_Load], [SDL_image],,
277 echo "***** Missing libSDL_image ($website) *****"])
279 ##### libvorbis #####
280 website="http://www.xiph.org/downloads/"
281 AC_CHECK_HEADERS([vorbis/codec.h vorbis/vorbisfile.h],,
283 echo "***** Missing vorbis headers ($website) *****"])
284 AC_SEARCH_LIBS([ov_open], [vorbisfile],,
286 echo "***** Missing libvorbisfile ($website) *****"])
289 website="http://www.lua.org/"
290 AC_CHECK_HEADERS([lua.h],,
292 echo "***** Missing lua headers ($website) *****"])
293 AC_SEARCH_LIBS([lua_load], [lua],,
295 echo "***** Missing liblua ($website) *****"])
300 website="http://www.gtk.org/"
301 PKG_CHECK_MODULES([GTK], [gtk+-2.0],
302 [LIBS="$LIBS $GTK_LIBS"
303 CFLAGS="$CFLAGS $GTK_CFLAGS"
304 CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"],
306 echo "***** Missing GTK+-2.0 ($website) *****"])
312 website="http://qt.nokia.com/"
313 PKG_CHECK_MODULES([QT], [QtGui],
314 [LIBS="$LIBS $QT_LIBS"
315 CFLAGS="$CFLAGS $QT_CFLAGS"
316 CXXFLAGS="$CXXFLAGS $QT_CFLAGS"],
318 echo "***** Missing QT ($website) *****"])
321 ##### librt (optional) #####
322 AC_SEARCH_LIBS([clock_gettime], [rt],
323 [AC_DEFINE([HAVE_CLOCK_GETTIME], 1,
324 [Define to 1 if you have the 'clock_gettime' function.])])
327 if test x$missing == xyes
329 AC_MSG_WARN([You may be missing some dependencies--see messages above.])
334 # Find the data files to install.
335 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
337 DATA_FILES=$(echo $(cd data; \
338 find . -name "*.lua" \
342 AC_SUBST([DATA_FILES])
346 # Create the build files.
347 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
349 AC_CONFIG_FILES([Makefile
355 if test x$WIN32 = xyes
357 AC_CONFIG_FILES([win32/Makefile win32/mkpackage.sh])
361 AC_CONFIG_HEADERS([src/config.h])
367 # Print a friendly little message.
368 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
371 echo " Configuration complete! :-)"
373 echo " Target: $target"
374 echo " Prefix: $prefix"
375 echo " Data Directory: $DATADIR"
376 echo " Log Level: $log_level"
377 echo " Debug: $debug"
378 echo " Double Precision: $double_precision"
379 echo " Profile: $profile"
380 echo " Extra Warnings: $extra_warnings"
382 echo " To finish the installation, execute:"