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])
20 # Checks for programs.
21 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32 # Configure platform-specific stuff.
33 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
39 AC_PATH_PROGS([WINDRES], [windres $host_alias-windres $host_os-windres])
40 if test "x$WINDRES" = x
42 AC_MSG_ERROR([windres could not be found])
45 AC_PATH_PROGS([MAKENSIS], [makensis])
54 LIBS="$LIBS -Wl,-framework"
58 AC_PATH_PROGS([RPMBUILD], [rpmbuild])
63 AM_CONDITIONAL([LINUX], test "$LINUX" = "yes")
64 AM_CONDITIONAL([WIN32], test "$WIN32" = "yes")
68 # Checks for configuration arguments.
69 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
71 AC_ARG_ENABLE([developer],
72 [ --enable-developer use all compiler flags developers need],
73 [developer=$enableval],
76 AC_ARG_ENABLE([debug],
77 [ --enable-debug include debugging symbols and features],
81 AC_ARG_ENABLE([profile],
82 [ --enable-profile make a binary for use with gprof profiler],
86 AC_ARG_ENABLE([extra-warnings],
87 [ --enable-extra-warnings make the gcc compiler give more warnings],
88 [extra_warnings=$enableval],
91 AC_ARG_WITH([log-level],
92 [AS_HELP_STRING([--with-log-level=NUM],
93 [0, none... 1, errors... 4, everything (default: 3)])],
97 AC_ARG_ENABLE([double],
98 [ --enable-double use double-precision numbers],
103 if test x$developer = xyes
108 if test x$WIN32 != xyes
110 # i haven't had much success with gprof profiling on win32
115 if test x$debug = xyes
117 CFLAGS="$CFLAGS -Wall -O0 -DDEBUG"
118 CXXFLAGS="$CXXFLAGS -Wall -O0 -DDEBUG"
120 CFLAGS="$CFLAGS -O2 -DNDEBUG"
121 CXXFLAGS="$CXXFLAGS -O2 -DNDEBUG"
124 if test x$profile = xyes
127 CXXFLAGS="$CXXFLAGS -pg"
130 if test x$extra_warnings = xyes
132 CFLAGS="$CFLAGS -Wextra -Wno-unused-parameter"
133 CXXFLAGS="$CXXFLAGS -Wextra -Wno-unused-parameter"
136 if test x$double = xyes
138 AC_DEFINE([USE_DOUBLE_PRECISION], 1,
139 [Define to 1 if you want to use double-precison numbers.])
143 AC_DEFINE_UNQUOTED([YOINK_LOGLEVEL], [$log_level],
144 [Define to detail level of logging.])
147 if test "x$prefix" = xNONE
149 prefix="$ac_default_prefix"
152 AC_ARG_WITH([assetdir],
153 [AS_HELP_STRING([--with-assetdir=DIR],
154 [real path to assets (default: $datarootdir/yoink)])],
155 [DATADIR="$withval"],
156 [eval DATADIR="$datarootdir/yoink"])
158 if test x$WIN32 = xyes
164 AC_DEFINE_UNQUOTED([YOINK_DATADIR], ["$DATADIR"],
165 [Define to path of game asset directory.])
169 # Split the version number into components.
170 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
172 VERSION_MAJOR=$(echo $VERSION | cut -d. -f1)
173 VERSION_MINOR=$(echo $VERSION | cut -d. -f2)
174 VERSION_REVISION=$(echo $VERSION | cut -d. -f3)
176 AC_DEFINE_UNQUOTED([VERSION_MAJOR], [${VERSION_MAJOR:-0}],
177 [Define to major version number component.])
179 AC_DEFINE_UNQUOTED([VERSION_MINOR], [${VERSION_MINOR:-0}],
180 [Define to minor version number component.])
182 AC_DEFINE_UNQUOTED([VERSION_REVISION], [${VERSION_REVISION:-0}],
183 [Define to revision version number component.])
185 if test x$WIN32 = xyes
187 PVERSION="${VERSION_MAJOR:-0}.${VERSION_MINOR:-0}.${VERSION_REVISION:-0}.0"
191 # these are used in src/yoink.rc
195 # Checks for system functions/headers and compiler characteristics.
196 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
207 AC_FUNC_ERROR_AT_LINE
209 AC_CHECK_FUNCS([nanosleep strchr strcspn strrchr strstr])
213 AC_CHECK_HEADERS([stddef.h stdint.h stdlib.h string.h unistd.h])
217 # Checks for build dependencies.
218 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
221 website="http://www.boost.org/"
228 website="http://www.libsdl.org/"
229 AM_PATH_SDL([1.2.10],
230 [CFLAGS="$CFLAGS $SDL_CFLAGS"
231 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
232 LIBS="$LIBS $SDL_LIBS"])
234 ##### opengl, glu #####
235 website="http://www.mesa3d.org/"
236 AC_CHECK_HEADERS([GL/gl.h GL/glu.h],,
238 echo "***** Missing GL headers ($website) *****"])
239 if test x$WIN32 == xyes
241 # autoconf library search macro doesn't find opengl32 on windows because it uses
242 # different name hashing, but it links fine; assume it's there
243 LIBS="$LIBS -lglu32 -lopengl32"
245 AC_SEARCH_LIBS([glEnable], [GL MesaGL],,
247 echo "***** Missing libGL ($website) *****"])
248 AC_SEARCH_LIBS([gluDisk], [GLU MesaGLU],,
250 echo "***** Missing libGLU ($website) *****"])
253 ##### openal, alut #####
254 website="http://connect.creativelabs.com/openal/"
255 AC_CHECK_HEADERS([AL/al.h AL/alut.h],,
257 echo "***** Missing OpenAL headers ($website) *****"])
258 AC_SEARCH_LIBS([alEnable], [openal openal32],,
260 echo "***** Missing libopenal ($website) *****"])
261 AC_SEARCH_LIBS([alutInit], [alut],,
263 echo "***** Missing libalut ($website) *****"])
265 ##### SDL_image #####
266 website="http://www.libsdl.org/projects/SDL_image/"
267 AC_CHECK_HEADERS([SDL/SDL_image.h],,
269 echo "***** Missing SDL_image header ($website) *****"])
270 AC_SEARCH_LIBS([IMG_Load], [SDL_image],,
272 echo "***** Missing libSDL_image ($website) *****"])
274 ##### libvorbis #####
275 website="http://www.xiph.org/downloads/"
276 AC_CHECK_HEADERS([vorbis/codec.h vorbis/vorbisfile.h],,
278 echo "***** Missing vorbis headers ($website) *****"])
279 AC_SEARCH_LIBS([ov_open], [vorbisfile],,
281 echo "***** Missing libvorbisfile ($website) *****"])
284 website="http://www.lua.org/"
285 AC_CHECK_HEADERS([lua.h],,
287 echo "***** Missing lua headers ($website) *****"])
288 AC_SEARCH_LIBS([lua_load], [lua],,
290 echo "***** Missing liblua ($website) *****"])
292 ##### librt (optional) #####
293 AC_SEARCH_LIBS([clock_gettime], [rt],
294 [AC_DEFINE([HAVE_CLOCK_GETTIME], 1,
295 [Define to 1 if you have the 'clock_gettime' function.])])
298 if test x$missing == xyes
300 AC_MSG_ERROR([please install missing dependencies (see messages above)])
305 # Find the data files to install.
306 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
308 DATA_FILES=$(echo $(cd data; \
309 find . -name "*.json" \
315 AC_SUBST([DATA_FILES])
319 # Create the build files.
320 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
322 AC_CONFIG_FILES([Makefile
328 make-win32-installer.sh
331 AC_CONFIG_HEADERS([src/config.h])
337 # Print a friendly little message.
338 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
341 echo " Configuration complete! :-)"
343 echo " Target: $target"
344 echo " Prefix: $prefix"
345 echo " Data Directory: $DATADIR"
346 echo " Log Level: $log_level"
347 echo " Debug: $debug"
348 echo " Profile: $profile"
349 echo " Extra Warnings: $extra_warnings"
351 echo " To finish the installation, execute:"