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([debug],
72 [ --enable-debug include debugging symbols and features],
76 AC_ARG_ENABLE([double-precision],
77 [ --enable-double-precision use double-precision numbers],
78 [double_precision=$enableval],
79 [double_precision=no])
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_ENABLE([threads],
92 [ --enable-threads use threads for some parallel tasks],
96 AC_ARG_WITH([log-level],
97 [AS_HELP_STRING([--with-log-level=NUM],
98 [0, none... 1, errors... 4, everything (default: 3)])],
103 if test x$debug = xyes
105 CFLAGS="$CFLAGS -Wall -g -DDEBUG"
106 CXXFLAGS="$CXXFLAGS -Wall -g -DDEBUG"
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 for parallel tasks.])
138 AC_DEFINE_UNQUOTED([YOINK_LOGLEVEL], [$log_level],
139 [Define to detail level of logging.])
142 if test "x$prefix" = xNONE
144 prefix="$ac_default_prefix"
147 if test x$WIN32 = xyes
151 eval eval DATADIR="${datadir}/yoink"
155 AC_DEFINE_UNQUOTED([YOINK_DATADIR], ["$DATADIR"],
156 [Define to path of game asset directory.])
160 # Split the version number into components.
161 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
163 VERSION_MAJOR=$(echo $VERSION | cut -d. -f1)
164 VERSION_MINOR=$(echo $VERSION | cut -d. -f2)
165 VERSION_REVISION=$(echo $VERSION | cut -d. -f3)
167 AC_DEFINE_UNQUOTED([VERSION_MAJOR], [${VERSION_MAJOR:-0}],
168 [Define to major version number component.])
170 AC_DEFINE_UNQUOTED([VERSION_MINOR], [${VERSION_MINOR:-0}],
171 [Define to minor version number component.])
173 AC_DEFINE_UNQUOTED([VERSION_REVISION], [${VERSION_REVISION:-0}],
174 [Define to revision version number component.])
176 if test x$WIN32 = xyes
178 PVERSION="${VERSION_MAJOR:-0}.${VERSION_MINOR:-0}.${VERSION_REVISION:-0}.0"
182 # these are used in src/yoink.rc
186 # Checks for system functions/headers and compiler characteristics.
187 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
198 AC_FUNC_ERROR_AT_LINE
200 AC_CHECK_FUNCS([nanosleep strchr strcspn strrchr strstr])
204 AC_CHECK_HEADERS([stddef.h stdint.h stdlib.h string.h unistd.h])
208 # Checks for build dependencies.
209 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
212 website="http://www.boost.org/"
219 website="http://www.libsdl.org/"
220 AM_PATH_SDL([1.2.10],
221 [CFLAGS="$CFLAGS $SDL_CFLAGS"
222 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
223 LIBS="$LIBS $SDL_LIBS"])
225 ##### opengl, glu #####
226 website="http://www.mesa3d.org/"
227 AC_CHECK_HEADERS([GL/gl.h GL/glu.h],,
229 echo "***** Missing GL headers ($website) *****"])
230 if test x$WIN32 == xyes
232 # autoconf library search macro doesn't find opengl32 on windows because it uses
233 # different name hashing, but it links fine; assume it's there
234 LIBS="$LIBS -lglu32 -lopengl32"
236 AC_SEARCH_LIBS([glEnable], [GL MesaGL],,
238 echo "***** Missing libGL ($website) *****"])
239 AC_SEARCH_LIBS([gluDisk], [GLU MesaGLU],,
241 echo "***** Missing libGLU ($website) *****"])
244 ##### openal, alut #####
245 website="http://connect.creativelabs.com/openal/"
246 AC_CHECK_HEADERS([AL/al.h AL/alut.h],,
248 echo "***** Missing OpenAL headers ($website) *****"])
249 AC_SEARCH_LIBS([alEnable], [openal openal32],,
251 echo "***** Missing libopenal ($website) *****"])
252 AC_SEARCH_LIBS([alutInit], [alut],,
254 echo "***** Missing libalut ($website) *****"])
256 ##### SDL_image #####
257 website="http://www.libsdl.org/projects/SDL_image/"
258 AC_CHECK_HEADERS([SDL/SDL_image.h],,
260 echo "***** Missing SDL_image header ($website) *****"])
261 AC_SEARCH_LIBS([IMG_Load], [SDL_image],,
263 echo "***** Missing libSDL_image ($website) *****"])
265 ##### libvorbis #####
266 website="http://www.xiph.org/downloads/"
267 AC_CHECK_HEADERS([vorbis/codec.h vorbis/vorbisfile.h],,
269 echo "***** Missing vorbis headers ($website) *****"])
270 AC_SEARCH_LIBS([ov_open], [vorbisfile],,
272 echo "***** Missing libvorbisfile ($website) *****"])
275 website="http://www.lua.org/"
276 AC_CHECK_HEADERS([lua.h],,
278 echo "***** Missing lua headers ($website) *****"])
279 AC_SEARCH_LIBS([lua_load], [lua],,
281 echo "***** Missing liblua ($website) *****"])
283 ##### librt (optional) #####
284 AC_SEARCH_LIBS([clock_gettime], [rt],
285 [AC_DEFINE([HAVE_CLOCK_GETTIME], 1,
286 [Define to 1 if you have the 'clock_gettime' function.])])
289 if test x$missing == xyes
291 AC_MSG_ERROR([please install missing dependencies (see messages above)])
296 # Find the data files to install.
297 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
299 DATA_FILES=$(echo $(cd data; \
300 find . -name "*.lua" \
304 AC_SUBST([DATA_FILES])
308 # Create the build files.
309 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
311 AC_CONFIG_FILES([Makefile
317 make-win32-installer.sh
320 AC_CONFIG_HEADERS([src/config.h])
326 # Print a friendly little message.
327 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
330 echo " Configuration complete! :-)"
332 echo " Target: $target"
333 echo " Prefix: $prefix"
334 echo " Data Directory: $DATADIR"
335 echo " Log Level: $log_level"
336 echo " Debug: $debug"
337 echo " Double Precision: $double_precision"
338 echo " Profile: $profile"
339 echo " Extra Warnings: $extra_warnings"
341 echo " To finish the installation, execute:"