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])
16 AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip])
20 # Determine the target platform.
24 *mingw32*) WIN32=yes ;;
25 *-apple-darwin*) MACOSX=yes ;;
26 *netbsd*) NETBSD=yes ;;
29 AM_CONDITIONAL([WIN32], [test x$WIN32 = xyes])
30 AM_CONDITIONAL([MACOSX], [test x$MACOSX = xyes])
31 AM_CONDITIONAL([NETBSD], [test x$NETBSD = xyes])
35 # Checks for configuration arguments.
38 AC_ARG_ENABLE([debug],
39 [ --enable-debug include debugging symbols and features],
43 AC_ARG_ENABLE([double-precision],
44 [ --enable-double-precision use doubles instead of floats],
45 [double_precision=$enableval],
46 [double_precision=no])
48 AC_ARG_ENABLE([profile],
49 [ --enable-profile make a binary with code profiling instructions],
53 AC_ARG_ENABLE([extra-warnings],
54 [ --enable-extra-warnings make the gcc compiler give more warnings],
55 [extra_warnings=$enableval],
58 AC_ARG_ENABLE([clock_gettime],
59 [ --enable-clock_gettime use clock_gettime() instead of SDL_GetTicks()],
60 [clock_gettime=$enableval],
63 AC_ARG_ENABLE([threads],
64 [ --enable-threads use threads for concurrency where appropriate],
69 [ --enable-gtk enable GTK+ modal dialogs],
74 [ --enable-qt4 enable QT modal dialogs],
79 if test x$debug = xyes
81 CFLAGS="$CFLAGS -DDEBUG -ggdb -O0 -Wall -Wno-uninitialized"
82 CXXFLAGS="$CXXFLAGS -DDEBUG -ggdb -O0 -Wall -Wno-uninitialized"
84 CFLAGS="$CFLAGS -DNDEBUG"
85 CXXFLAGS="$CXXFLAGS -DNDEBUG"
88 if test x$double_precision = xyes
90 AC_DEFINE([USE_DOUBLE_PRECISION], 1,
91 [Define to 1 if you want to use doubles instead of floats.])
94 if test x$profile = xyes
97 CXXFLAGS="$CXXFLAGS -pg"
98 AC_DEFINE([PROFILING_ENABLED], 1,
99 [Define to 1 if profiling is built in.])
102 if test x$extra_warnings = xyes
104 CFLAGS="$CFLAGS -Wextra -Wno-unused-parameter"
105 CXXFLAGS="$CXXFLAGS -Wextra -Wno-unused-parameter"
108 if test x$threads = xyes
110 AC_DEFINE([USE_THREADS], 1,
111 [Define to 1 if you want to use threads when applicable.])
116 AC_DEFINE([USE_GTK], 1,
117 [Define to 1 if you want to use GTK+ modal dialogs.])
118 elif test x$qt4 = xyes
120 AC_DEFINE([USE_QT4], 1,
121 [Define to 1 if you want to use QT4 modal dialogs.])
125 if test "x$prefix" = xNONE
127 prefix="$ac_default_prefix"
130 if test x$WIN32 = xyes
134 eval eval DATADIR="${datadir}/$PACKAGE"
138 AC_DEFINE_UNQUOTED([YOINK_DATADIR], ["$DATADIR"],
139 [Define to the path of the game asset directory.])
143 AC_MSG_NOTICE([Checks for programs.])
154 AC_PATH_PROGS([CUT], [cut])
157 AC_MSG_ERROR([The cut program is required.])
160 AC_PATH_PROGS([FIND], [find])
163 AC_MSG_ERROR([The find program is required.])
166 if test x$WIN32 = xyes
168 AC_PATH_PROGS([WINDRES],
169 [windres $host_alias-windres $host_os-windres])
170 if test x$WINDRES = x
172 AC_MSG_ERROR([The windres program is required.])
175 AC_PATH_PROGS([ZIP], [zip])
178 AC_MSG_WARN([The zip program is needed to build a portable package.])
181 AC_PATH_PROGS([MAKENSIS], [makensis])
182 if test x$MAKENSIS = x
184 AC_MSG_WARN([The makensis program is needed to build an installer.])
187 AC_PATH_PROGS([GROFF], [groff])
190 AC_MSG_WARN([The groff program is needed to create the manual page.])
192 elif test x$NETBSD = xyes
194 AC_PATH_PROGS([PKGLINT], [pkglint])
197 AM_CONDITIONAL([HAVE_MAKENSIS], [test x$MAKENSIS != x])
200 AC_MSG_NOTICE([Checks for libraries.])
204 website="http://www.libsdl.org/"
205 PKG_CHECK_MODULES([SDL], [sdl],
206 [LIBS="$LIBS $SDL_LIBS"
207 CFLAGS="$CFLAGS $SDL_CFLAGS"
208 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"],
210 AC_MSG_WARN([Missing SDL ($website)])])
212 ##### opengl, glu #####
213 website="http://www.mesa3d.org/"
214 PKG_CHECK_MODULES([OPENGL], [gl glu],
215 [LIBS="$LIBS $OPENGL_LIBS"
216 CFLAGS="$CFLAGS $OPENGL_CFLAGS"
217 CXXFLAGS="$CXXFLAGS $OPENGL_CFLAGS"],
219 AC_MSG_WARN([Missing OpenGL ($website)])])
222 website="http://www.libpng.org/pub/png/libpng.html"
223 PKG_CHECK_MODULES([PNG], [libpng],
224 [LIBS="$LIBS $PNG_LIBS"
225 CFLAGS="$CFLAGS $PNG_CFLAGS"
226 CXXFLAGS="$CXXFLAGS $PNG_CFLAGS"],
228 AC_MSG_WARN([Missing libpng ($website)])])
231 website="http://connect.creativelabs.com/openal/"
232 PKG_CHECK_MODULES([OPENAL], [openal],
233 [LIBS="$LIBS $OPENAL_LIBS"
234 CFLAGS="$CFLAGS $OPENAL_CFLAGS"
235 CXXFLAGS="$CXXFLAGS $OPENAL_CFLAGS"],
237 AC_MSG_WARN([Missing OpenAL ($website)])])
239 ##### libvorbis #####
240 website="http://www.xiph.org/downloads/"
241 PKG_CHECK_MODULES([VORBIS], [vorbisfile],
242 [LIBS="$LIBS $VORBIS_LIBS"
243 CFLAGS="$CFLAGS $VORBIS_CFLAGS"
244 CXXFLAGS="$CXXFLAGS $VORBIS_CFLAGS"],
246 AC_MSG_WARN([Missing libvorbisfile ($website)])])
249 website="http://www.lua.org/"
250 PKG_CHECK_MODULES([LUA], [lua],
251 [LIBS="$LIBS $LUA_LIBS"
252 CFLAGS="$CFLAGS $LUA_CFLAGS"
253 CXXFLAGS="$CXXFLAGS $LUA_CFLAGS"],
255 AC_MSG_WARN([Missing liblua ($website)])])
260 website="http://www.gtk.org/"
261 PKG_CHECK_MODULES([GTK], [gtk+-2.0],
262 [LIBS="$LIBS $GTK_LIBS"
263 CFLAGS="$CFLAGS $GTK_CFLAGS"
264 CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"],
266 AC_MSG_WARN([Missing GTK+-2.0 ($website)])])
272 website="http://qt.nokia.com/"
273 PKG_CHECK_MODULES([QT], [QtGui],
274 [LIBS="$LIBS $QT_LIBS"
275 CFLAGS="$CFLAGS $QT_CFLAGS"
276 CXXFLAGS="$CXXFLAGS $QT_CFLAGS"],
278 AC_MSG_WARN([Missing QT ($website)])])
281 if test x$missing = xyes
283 AC_MSG_ERROR([You are missing some required libraries.])
288 AC_MSG_NOTICE([Checks for header files.])
293 AC_CHECK_HEADERS([stddef.h stdint.h stdlib.h string.h unistd.h])
302 AC_MSG_NOTICE([Checks for types.])
313 AC_MSG_NOTICE([Checks for compiler characteristics.])
321 AC_MSG_NOTICE([Checks for library functions.])
324 AC_FUNC_ERROR_AT_LINE
326 AC_CHECK_FUNCS([nanosleep strchr strcspn strrchr strstr])
328 if test x$clock_gettime = xyes
330 AC_SEARCH_LIBS([clock_gettime], [rt],
333 if test x$clock_gettime = xyes
335 AC_DEFINE([HAVE_CLOCK_GETTIME], 1,
336 [Define to 1 if you have the 'clock_gettime' function.])
338 AC_MSG_WARN([Falling back to SDL_GetTicks().])
344 # Find the game resources to install.
347 DATA_FILES=$(echo $(cd data && find . -name "*.lua" \
351 AC_SUBST([DATA_FILES])
355 # Split the version number into components.
356 # These definitions are used in the win32 resource file, src/yoink.rc.
359 VERSION_MAJOR=$(echo $VERSION | cut -d. -f1)
360 VERSION_MINOR=$(echo $VERSION | cut -d. -f2)
361 VERSION_REVISION=$(echo $VERSION | cut -d. -f3)
363 AC_DEFINE_UNQUOTED([VERSION_MAJOR], [${VERSION_MAJOR:-0}],
364 [Define to major version number component.])
366 AC_DEFINE_UNQUOTED([VERSION_MINOR], [${VERSION_MINOR:-0}],
367 [Define to minor version number component.])
369 AC_DEFINE_UNQUOTED([VERSION_REVISION], [${VERSION_REVISION:-0}],
370 [Define to revision version number component.])
372 PVERSION="${VERSION_MAJOR:-0}.${VERSION_MINOR:-0}.${VERSION_REVISION:-0}.0"
377 # Create the build files.
380 AC_CONFIG_FILES([Makefile
385 AC_CONFIG_HEADERS([src/config.h])
391 # Print a friendly little message.
395 echo " Configuration complete! :-)"
397 echo " Host: $target"
398 echo " Prefix: $prefix"
399 echo " Data: $DATADIR"
402 echo " CXXFLAGS: $(echo $CXXFLAGS)"
403 echo " LIBS: $(echo $LIBS)"
405 echo " To finish the installation, execute:"