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 double-precision numbers],
74 [double_precision=$enableval],
75 [double_precision=no])
77 AC_ARG_ENABLE([profile],
78 [ --enable-profile make a binary for use with gprof profiler],
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([threads],
88 [ --enable-threads use threads for some parallel tasks],
93 [ --enable-gtk enable GTK+ info/warning dialogs],
98 [ --enable-qt4 enable QT info/warning dialogs],
102 AC_ARG_WITH([log-level],
103 [AS_HELP_STRING([--with-log-level=NUM],
104 [0, none... 1, errors... 4, everything (default: 3)])],
105 [log_level=$withval],
109 if test x$debug = xyes
111 CFLAGS="$CFLAGS -DDEBUG -Wall -Wno-uninitialized"
112 CXXFLAGS="$CXXFLAGS -DDEBUG -Wall -Wno-uninitialized"
114 CFLAGS="$CFLAGS -DNDEBUG"
115 CXXFLAGS="$CXXFLAGS -DNDEBUG"
118 if test x$double_precision = xyes
120 AC_DEFINE([USE_DOUBLE_PRECISION], 1,
121 [Define to 1 if you want to use doubles instead of floats.])
124 if test x$profile = xyes
127 CXXFLAGS="$CXXFLAGS -pg"
128 AC_DEFINE([PROFILING_ENABLED], 1,
129 [Define to 1 if profiling is built in.])
132 if test x$extra_warnings = xyes
134 CFLAGS="$CFLAGS -Wextra -Wno-unused-parameter"
135 CXXFLAGS="$CXXFLAGS -Wextra -Wno-unused-parameter"
138 if test x$threads = xyes
140 AC_DEFINE([USE_THREADS], 1,
141 [Define to 1 if you want to use threads when applicable.])
146 AC_DEFINE([USE_GTK], 1,
147 [Define to 1 if you want to use GTK+ info/error dialogs.])
148 elif test x$qt4 = xyes
150 AC_DEFINE([USE_QT4], 1,
151 [Define to 1 if you want to use QT4 info/error dialogs.])
154 AC_DEFINE_UNQUOTED([YOINK_LOGLEVEL], [$log_level],
155 [Define to detail level of logging.])
158 if test "x$prefix" = xNONE
160 prefix="$ac_default_prefix"
163 if test x$WIN32 = xyes
167 eval eval DATADIR="${datadir}/$PACKAGE"
171 AC_DEFINE_UNQUOTED([YOINK_DATADIR], ["$DATADIR"],
172 [Define to path of game asset directory.])
176 # Split the version number into components.
177 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
179 VERSION_MAJOR=$(echo $VERSION | cut -d. -f1)
180 VERSION_MINOR=$(echo $VERSION | cut -d. -f2)
181 VERSION_REVISION=$(echo $VERSION | cut -d. -f3)
183 AC_DEFINE_UNQUOTED([VERSION_MAJOR], [${VERSION_MAJOR:-0}],
184 [Define to major version number component.])
186 AC_DEFINE_UNQUOTED([VERSION_MINOR], [${VERSION_MINOR:-0}],
187 [Define to minor version number component.])
189 AC_DEFINE_UNQUOTED([VERSION_REVISION], [${VERSION_REVISION:-0}],
190 [Define to revision version number component.])
192 if test x$WIN32 = xyes
194 PVERSION="${VERSION_MAJOR:-0}.${VERSION_MINOR:-0}.${VERSION_REVISION:-0}.0"
198 # these are used in src/yoink.rc
202 # Checks for system functions/headers and compiler characteristics.
203 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
214 AC_FUNC_ERROR_AT_LINE
216 AC_CHECK_FUNCS([nanosleep strchr strcspn strrchr strstr])
220 AC_CHECK_HEADERS([stddef.h stdint.h stdlib.h string.h unistd.h])
224 # Checks for build dependencies.
225 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
228 website="http://www.boost.org/"
235 website="http://www.libsdl.org/"
236 AM_PATH_SDL([1.2.10],
237 [CFLAGS="$CFLAGS $SDL_CFLAGS"
238 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
239 LIBS="$LIBS $SDL_LIBS"])
241 ##### opengl, glu #####
242 website="http://www.mesa3d.org/"
243 AC_CHECK_HEADERS([GL/gl.h GL/glu.h],,
245 echo "***** Missing GL headers ($website) *****"])
246 if test x$WIN32 = xyes
248 # autoconf library search macro doesn't find opengl32 on windows because it uses
249 # different name hashing, but it links fine; assume it's there
250 LIBS="$LIBS -lglu32 -lopengl32"
252 AC_SEARCH_LIBS([glEnable], [GL MesaGL],,
254 echo "***** Missing libGL ($website) *****"])
255 AC_SEARCH_LIBS([gluDisk], [GLU MesaGLU],,
257 echo "***** Missing libGLU ($website) *****"])
261 website="http://connect.creativelabs.com/openal/"
262 AC_CHECK_HEADERS([AL/al.h AL/alc.h],,
264 echo "***** Missing OpenAL headers ($website) *****"])
265 AC_SEARCH_LIBS([alEnable], [openal OpenAL32],,
267 echo "***** Missing libopenal ($website) *****"])
270 website="http://www.libpng.org/pub/png/libpng.html"
271 AC_CHECK_HEADERS([png.h],,
273 echo "***** Missing libpng header ($website) *****"])
274 AC_SEARCH_LIBS([png_sig_cmp], [png],,
276 echo "***** Missing libpng ($website) *****"])
278 ##### libvorbis #####
279 website="http://www.xiph.org/downloads/"
280 AC_CHECK_HEADERS([vorbis/codec.h vorbis/vorbisfile.h],,
282 echo "***** Missing vorbis headers ($website) *****"])
283 AC_SEARCH_LIBS([ov_open], [vorbisfile],,
285 echo "***** Missing libvorbisfile ($website) *****"])
288 website="http://www.lua.org/"
289 AC_CHECK_HEADERS([lua.h],,
291 echo "***** Missing lua headers ($website) *****"])
292 AC_SEARCH_LIBS([lua_load], [lua],,
294 echo "***** Missing liblua ($website) *****"])
299 website="http://www.gtk.org/"
300 PKG_CHECK_MODULES([GTK], [gtk+-2.0],
301 [LIBS="$LIBS $GTK_LIBS"
302 CFLAGS="$CFLAGS $GTK_CFLAGS"
303 CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"],
305 echo "***** Missing GTK+-2.0 ($website) *****"])
311 website="http://qt.nokia.com/"
312 PKG_CHECK_MODULES([QT], [QtGui],
313 [LIBS="$LIBS $QT_LIBS"
314 CFLAGS="$CFLAGS $QT_CFLAGS"
315 CXXFLAGS="$CXXFLAGS $QT_CFLAGS"],
317 echo "***** Missing QT ($website) *****"])
320 ##### librt (optional) #####
321 AC_SEARCH_LIBS([clock_gettime], [rt],
322 [AC_DEFINE([HAVE_CLOCK_GETTIME], 1,
323 [Define to 1 if you have the 'clock_gettime' function.])])
326 if test x$missing == xyes
328 AC_MSG_WARN([You may be missing some dependencies--see messages above.])
333 # Find the game resources to install.
334 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
336 DATA_FILES=$(echo $(cd data && find . -name "*.lua" \
340 AC_SUBST([DATA_FILES])
344 # Create the build files.
345 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
347 AC_CONFIG_FILES([Makefile
353 if test x$WIN32 = xyes
355 AC_CONFIG_FILES([win32/Makefile win32/mkpackage.sh win32/yoink.nsi])
359 AC_CONFIG_HEADERS([src/config.h])
365 # Print a friendly little message.
366 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
369 echo " Configuration complete! :-)"
371 echo " Target: $target"
372 echo " Prefix: $prefix"
373 echo " Data Directory: $DATADIR"
374 echo " Log Level: $log_level"
375 echo " Debug: $debug"
376 echo " Double Precision: $double_precision"
377 echo " Profile: $profile"
378 echo " Extra Warnings: $extra_warnings"
380 echo " To finish the installation, execute:"