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],
103 if test x$debug = xyes
105 CFLAGS="$CFLAGS -DDEBUG -ggdb -O0 -Wall -Wno-uninitialized"
106 CXXFLAGS="$CXXFLAGS -DDEBUG -ggdb -O0 -Wall -Wno-uninitialized"
108 CFLAGS="$CFLAGS -DNDEBUG"
109 CXXFLAGS="$CXXFLAGS -DNDEBUG"
112 if test x$double_precision = xyes
114 AC_DEFINE([USE_DOUBLE_PRECISION], 1,
115 [Define to 1 if you want to use doubles instead of floats.])
118 if test x$profile = xyes
121 CXXFLAGS="$CXXFLAGS -pg"
122 AC_DEFINE([PROFILING_ENABLED], 1,
123 [Define to 1 if profiling is built in.])
126 if test x$extra_warnings = xyes
128 CFLAGS="$CFLAGS -Wextra -Wno-unused-parameter"
129 CXXFLAGS="$CXXFLAGS -Wextra -Wno-unused-parameter"
132 if test x$threads = xyes
134 AC_DEFINE([USE_THREADS], 1,
135 [Define to 1 if you want to use threads when applicable.])
140 AC_DEFINE([USE_GTK], 1,
141 [Define to 1 if you want to use GTK+ info/error dialogs.])
142 elif test x$qt4 = xyes
144 AC_DEFINE([USE_QT4], 1,
145 [Define to 1 if you want to use QT4 info/error dialogs.])
149 if test "x$prefix" = xNONE
151 prefix="$ac_default_prefix"
154 if test x$WIN32 = xyes
158 eval eval DATADIR="${datadir}/$PACKAGE"
162 AC_DEFINE_UNQUOTED([YOINK_DATADIR], ["$DATADIR"],
163 [Define to path of game asset directory.])
167 # Split the version number into components.
168 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
170 VERSION_MAJOR=$(echo $VERSION | cut -d. -f1)
171 VERSION_MINOR=$(echo $VERSION | cut -d. -f2)
172 VERSION_REVISION=$(echo $VERSION | cut -d. -f3)
174 AC_DEFINE_UNQUOTED([VERSION_MAJOR], [${VERSION_MAJOR:-0}],
175 [Define to major version number component.])
177 AC_DEFINE_UNQUOTED([VERSION_MINOR], [${VERSION_MINOR:-0}],
178 [Define to minor version number component.])
180 AC_DEFINE_UNQUOTED([VERSION_REVISION], [${VERSION_REVISION:-0}],
181 [Define to revision version number component.])
183 if test x$WIN32 = xyes
185 PVERSION="${VERSION_MAJOR:-0}.${VERSION_MINOR:-0}.${VERSION_REVISION:-0}.0"
189 # these are used in src/yoink.rc
193 # Checks for system functions/headers and compiler characteristics.
194 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
205 AC_FUNC_ERROR_AT_LINE
207 AC_CHECK_FUNCS([nanosleep strchr strcspn strrchr strstr])
211 AC_CHECK_HEADERS([stddef.h stdint.h stdlib.h string.h unistd.h])
213 ##### clock_gettime #####
214 AC_SEARCH_LIBS([clock_gettime], [rt],
215 [AC_DEFINE([HAVE_CLOCK_GETTIME], 1,
216 [Define to 1 if you have the 'clock_gettime' function.])])
220 # Checks for build dependencies.
221 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
224 website="http://www.boost.org/"
231 website="http://www.libsdl.org/"
232 AM_PATH_SDL([1.2.10],
233 [CFLAGS="$CFLAGS $SDL_CFLAGS"
234 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
235 LIBS="$LIBS $SDL_LIBS"])
237 ##### opengl, glu #####
238 website="http://www.mesa3d.org/"
239 AC_CHECK_HEADERS([GL/gl.h GL/glu.h],,
241 echo "***** Missing GL headers ($website) *****"])
242 if test x$WIN32 = xyes
244 # autoconf library search macro doesn't find opengl32 on windows because it uses
245 # different name hashing or something, but it links fine; assume it's there
246 LIBS="$LIBS -lglu32 -lopengl32"
248 AC_SEARCH_LIBS([glEnable], [GL MesaGL],,
250 echo "***** Missing libGL ($website) *****"])
251 AC_SEARCH_LIBS([gluDisk], [GLU MesaGLU],,
253 echo "***** Missing libGLU ($website) *****"])
257 website="http://connect.creativelabs.com/openal/"
258 AC_CHECK_HEADERS([AL/al.h AL/alc.h],,
260 echo "***** Missing OpenAL headers ($website) *****"])
261 AC_SEARCH_LIBS([alEnable], [openal OpenAL32],,
263 echo "***** Missing libopenal ($website) *****"])
266 website="http://www.lua.org/"
267 PKG_CHECK_MODULES([LUA], [lua],
268 [LIBS="$LIBS $LUA_LIBS"
269 CFLAGS="$CFLAGS $LUA_CFLAGS"
270 CXXFLAGS="$CXXFLAGS $LUA_CFLAGS"],
272 echo "***** Missing liblua ($website) *****"])
275 website="http://www.libpng.org/pub/png/libpng.html"
276 PKG_CHECK_MODULES([PNG], [libpng],
277 [LIBS="$LIBS $PNG_LIBS"
278 CFLAGS="$CFLAGS $PNG_CFLAGS"
279 CXXFLAGS="$CXXFLAGS $PNG_CFLAGS"],
281 echo "***** Missing libpng ($website) *****"])
283 ##### libvorbis #####
284 website="http://www.xiph.org/downloads/"
285 PKG_CHECK_MODULES([VORBIS], [vorbisfile],
286 [LIBS="$LIBS $VORBIS_LIBS"
287 CFLAGS="$CFLAGS $VORBIS_CFLAGS"
288 CXXFLAGS="$CXXFLAGS $VORBIS_CFLAGS"],
290 echo "***** Missing libvorbisfile ($website) *****"])
295 website="http://www.gtk.org/"
296 PKG_CHECK_MODULES([GTK], [gtk+-2.0],
297 [LIBS="$LIBS $GTK_LIBS"
298 CFLAGS="$CFLAGS $GTK_CFLAGS"
299 CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"],
301 echo "***** Missing GTK+-2.0 ($website) *****"])
307 website="http://qt.nokia.com/"
308 PKG_CHECK_MODULES([QT], [QtGui],
309 [LIBS="$LIBS $QT_LIBS"
310 CFLAGS="$CFLAGS $QT_CFLAGS"
311 CXXFLAGS="$CXXFLAGS $QT_CFLAGS"],
313 echo "***** Missing QT ($website) *****"])
317 if test x$missing == xyes
319 AC_MSG_WARN([It looks like you're missing some dependencies--building may fail.])
324 # Find the game resources to install.
325 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
327 DATA_FILES=$(echo $(cd data && find . -name "*.lua" \
331 AC_SUBST([DATA_FILES])
335 # Create the build files.
336 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
338 AC_CONFIG_FILES([Makefile
344 if test x$WIN32 = xyes
346 AC_CONFIG_FILES([win32/Makefile win32/mkpackage.sh win32/yoink.nsi])
350 AC_CONFIG_HEADERS([src/config.h])
356 # Print a friendly little message.
357 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
360 echo " Configuration complete! :-)"
362 echo " Target: $target"
363 echo " Prefix: $prefix"
364 echo " Data Directory: $DATADIR"
365 echo " Debug: $debug"
366 echo " Double Precision: $double_precision"
367 echo " Profile: $profile"
368 echo " Extra Warnings: $extra_warnings"
370 echo " To finish the installation, execute:"