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)])],
98 if test x$developer = xyes
103 if test x$WIN32 != xyes
105 # i haven't had much success with gprof profiling on win32
110 if test x$debug = xyes
112 CFLAGS="$CFLAGS -Wall -O0 -DDEBUG"
113 CXXFLAGS="$CXXFLAGS -Wall -O0 -DDEBUG"
115 CFLAGS="$CFLAGS -O2 -DNDEBUG"
116 CXXFLAGS="$CXXFLAGS -O2 -DNDEBUG"
119 if test x$profile = xyes
122 CXXFLAGS="$CXXFLAGS -pg"
125 if test x$extra_warnings = xyes
127 CFLAGS="$CFLAGS -Wextra -Wno-unused-parameter"
128 CXXFLAGS="$CXXFLAGS -Wextra -Wno-unused-parameter"
131 AC_DEFINE_UNQUOTED([YOINK_LOGLEVEL], [$log_level],
132 [Define to detail level of logging.])
135 if test "x$prefix" = xNONE
137 prefix="$ac_default_prefix"
140 AC_ARG_WITH([assetdir],
141 [AS_HELP_STRING([--with-assetdir=DIR],
142 [real path to assets (default: $datarootdir/yoink)])],
143 [DATADIR="$withval"],
144 [eval DATADIR="$datarootdir/yoink"])
146 if test x$WIN32 = xyes
152 AC_DEFINE_UNQUOTED([YOINK_DATADIR], ["$DATADIR"],
153 [Define to path of game asset directory.])
157 # Split the version number into components.
158 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
160 VERSION_MAJOR=$(echo $VERSION | cut -d. -f1)
161 VERSION_MINOR=$(echo $VERSION | cut -d. -f2)
162 VERSION_REVISION=$(echo $VERSION | cut -d. -f3)
164 AC_DEFINE_UNQUOTED([VERSION_MAJOR], [${VERSION_MAJOR:-0}],
165 [Define to major version number component.])
167 AC_DEFINE_UNQUOTED([VERSION_MINOR], [${VERSION_MINOR:-0}],
168 [Define to minor version number component.])
170 AC_DEFINE_UNQUOTED([VERSION_REVISION], [${VERSION_REVISION:-0}],
171 [Define to revision version number component.])
173 if test x$WIN32 = xyes
175 PVERSION="${VERSION_MAJOR:-0}.${VERSION_MINOR:-0}.${VERSION_REVISION:-0}.0"
179 # these are used in src/yoink.rc
183 # Checks for system functions/headers and compiler characteristics.
184 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
195 AC_FUNC_ERROR_AT_LINE
197 AC_CHECK_FUNCS([nanosleep strchr strcspn strrchr strstr])
201 AC_CHECK_HEADERS([stddef.h stdint.h stdlib.h string.h unistd.h])
205 # Checks for build dependencies.
206 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
209 website="http://www.boost.org/"
216 website="http://www.libsdl.org/"
217 AM_PATH_SDL([1.2.10],
218 [CFLAGS="$CFLAGS $SDL_CFLAGS"
219 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
220 LIBS="$LIBS $SDL_LIBS"])
222 ##### opengl, glu #####
223 website="http://www.mesa3d.org/"
224 AC_CHECK_HEADERS([GL/gl.h GL/glu.h],,
226 echo "***** Missing GL headers ($website) *****"])
227 if test x$WIN32 == xyes
229 # autoconf library search macro doesn't find opengl32 on windows because it uses
230 # different name hashing, but it links fine; assume it's there
231 LIBS="$LIBS -lglu32 -lopengl32"
233 AC_SEARCH_LIBS([glEnable], [GL MesaGL],,
235 echo "***** Missing libGL ($website) *****"])
236 AC_SEARCH_LIBS([gluDisk], [GLU MesaGLU],,
238 echo "***** Missing libGLU ($website) *****"])
241 ##### openal, alut #####
242 website="http://connect.creativelabs.com/openal/"
243 AC_CHECK_HEADERS([AL/al.h AL/alut.h],,
245 echo "***** Missing OpenAL headers ($website) *****"])
246 AC_SEARCH_LIBS([alEnable], [openal openal32],,
248 echo "***** Missing libopenal ($website) *****"])
249 AC_SEARCH_LIBS([alutInit], [alut],,
251 echo "***** Missing libalut ($website) *****"])
253 ##### SDL_image #####
254 website="http://www.libsdl.org/projects/SDL_image/"
255 AC_CHECK_HEADERS([SDL/SDL_image.h],,
257 echo "***** Missing SDL_image header ($website) *****"])
258 AC_SEARCH_LIBS([IMG_Load], [SDL_image],,
260 echo "***** Missing libSDL_image ($website) *****"])
262 ##### libvorbis #####
263 website="http://www.xiph.org/downloads/"
264 AC_CHECK_HEADERS([vorbis/codec.h vorbis/vorbisfile.h],,
266 echo "***** Missing vorbis headers ($website) *****"])
267 AC_SEARCH_LIBS([ov_open], [vorbisfile],,
269 echo "***** Missing libvorbisfile ($website) *****"])
272 website="http://www.lua.org/"
273 AC_CHECK_HEADERS([lua.h],,
275 echo "***** Missing lua headers ($website) *****"])
276 AC_SEARCH_LIBS([lua_load], [lua],,
278 echo "***** Missing liblua ($website) *****"])
280 ##### librt (optional) #####
281 AC_SEARCH_LIBS([clock_gettime], [rt],
282 [AC_DEFINE([HAVE_CLOCK_GETTIME], 1,
283 [Define to 1 if you have the 'clock_gettime' function.])])
286 if test x$missing == xyes
288 AC_MSG_ERROR([please install missing dependencies (see messages above)])
293 # Find the data files to install.
294 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
296 DATA_FILES=$(echo $(cd data; \
297 find . -name "*.json" \
303 AC_SUBST([DATA_FILES])
307 # Create the build files.
308 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
310 AC_CONFIG_FILES([Makefile
316 make-win32-installer.sh
319 AC_CONFIG_HEADERS([src/config.h])
325 # Print a friendly little message.
326 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
329 echo " Configuration complete! :-)"
331 echo " Target: $target"
332 echo " Prefix: $prefix"
333 echo " Data Directory: $DATADIR"
334 echo " Log Level: $log_level"
335 echo " Debug: $debug"
336 echo " Profile: $profile"
337 echo " Extra Warnings: $extra_warnings"
339 echo " To finish the installation, execute:"