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/YoinkApp.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])
52 LIBS="$LIBS -Wl,-framework"
56 AM_CONDITIONAL([WIN32], test "$WIN32" = "yes")
60 # Checks for configuration arguments.
61 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
63 AC_ARG_ENABLE([developer],
64 [ --enable-developer use all compiler flags developers need],
65 [developer=$enableval],
68 AC_ARG_ENABLE([debug],
69 [ --enable-debug include debugging symbols and features],
73 AC_ARG_ENABLE([profile],
74 [ --enable-profile make a binary for use with gprof profiler],
78 AC_ARG_ENABLE([extra-warnings],
79 [ --enable-extra-warnings make the gcc compiler give more warnings],
80 [extra_warnings=$enableval],
83 AC_ARG_WITH([log-level],
84 [AS_HELP_STRING([--with-log-level=NUM],
85 [0, none... 1, errors... 4, everything (default: 3)])],
90 if test x$developer = xyes
95 if test x$WIN32 != xyes
97 # i haven't had much success with gprof profiling on win32
102 if test x$debug = xyes
104 CFLAGS="$CFLAGS -Wall -O0 -DDEBUG"
105 CXXFLAGS="$CXXFLAGS -Wall -O0 -DDEBUG"
107 CFLAGS="$CFLAGS -O2 -DNDEBUG"
108 CXXFLAGS="$CXXFLAGS -O2 -DNDEBUG"
111 if test x$profile = xyes
114 CXXFLAGS="$CXXFLAGS -pg"
117 if test x$extra_warnings = xyes
119 CFLAGS="$CFLAGS -Wextra -Wno-unused-parameter"
120 CXXFLAGS="$CXXFLAGS -Wextra -Wno-unused-parameter"
123 AC_DEFINE_UNQUOTED([YOINK_LOGLEVEL], [$log_level],
124 [Define to detail level of logging.])
127 if test "x$prefix" = xNONE
129 prefix="$ac_default_prefix"
132 AC_ARG_WITH([assetdir],
133 [AS_HELP_STRING([--with-assetdir=DIR],
134 [real path to assets (default: $datarootdir/yoink)])],
135 [DATADIR="$withval"],
136 [eval DATADIR="$datarootdir/yoink"])
138 if test x$WIN32 = xyes
144 AC_DEFINE_UNQUOTED([YOINK_DATADIR], ["$DATADIR"],
145 [Define to path of game asset directory.])
148 CONFIGFILES="\$HOME/.yoinkrc:/etc/yoinkrc"
150 AC_DEFINE_UNQUOTED([YOINK_CONFIGFILES], ["$CONFIGFILES"],
151 [Define to colon-delimited configuration file paths.])
155 # Split the version number into components.
156 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
158 VERSION_MAJOR=$(echo $VERSION | cut -d. -f1)
159 VERSION_MINOR=$(echo $VERSION | cut -d. -f2)
160 VERSION_REVISION=$(echo $VERSION | cut -d. -f3)
162 AC_DEFINE_UNQUOTED([VERSION_MAJOR], [${VERSION_MAJOR:-0}],
163 [Define to major version number component.])
165 AC_DEFINE_UNQUOTED([VERSION_MINOR], [${VERSION_MINOR:-0}],
166 [Define to minor version number component.])
168 AC_DEFINE_UNQUOTED([VERSION_REVISION], [${VERSION_REVISION:-0}],
169 [Define to revision version number component.])
171 # these are used in src/yoink.rc
175 # Checks for system functions/headers and compiler characteristics.
176 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
187 AC_FUNC_ERROR_AT_LINE
189 AC_CHECK_FUNCS([nanosleep strchr strcspn strrchr strstr])
193 AC_CHECK_HEADERS([stddef.h stdint.h stdlib.h string.h unistd.h])
197 # Checks for build dependencies.
198 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
201 website="http://www.boost.org/"
208 website="http://www.libsdl.org/"
209 AM_PATH_SDL([1.2.10],
210 [CFLAGS="$CFLAGS $SDL_CFLAGS"
211 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
212 LIBS="$LIBS $SDL_LIBS"])
214 ##### opengl, glu #####
215 website="http://www.mesa3d.org/"
216 AC_CHECK_HEADERS([GL/gl.h GL/glu.h],,
218 echo "***** Missing GL headers ($website) *****"])
219 if test x$WIN32 == xyes
221 # autoconf library search macro doesn't find opengl32 on windows because it uses
222 # different name hashing, but it links fine; assume it's there
223 LIBS="$LIBS -lglu32 -lopengl32"
225 AC_SEARCH_LIBS([glEnable], [GL MesaGL],,
227 echo "***** Missing libGL ($website) *****"])
228 AC_SEARCH_LIBS([gluDisk], [GLU MesaGLU],,
230 echo "***** Missing libGLU ($website) *****"])
233 ##### openal, alut #####
234 website="http://connect.creativelabs.com/openal/"
235 AC_CHECK_HEADERS([AL/al.h AL/alut.h],,
237 echo "***** Missing OpenAL headers ($website) *****"])
238 AC_SEARCH_LIBS([alEnable], [openal openal32],,
240 echo "***** Missing libopenal ($website) *****"])
241 AC_SEARCH_LIBS([alutInit], [alut],,
243 echo "***** Missing libalut ($website) *****"])
245 ##### SDL_image #####
246 website="http://www.libsdl.org/projects/SDL_image/"
247 AC_CHECK_HEADERS([SDL/SDL_image.h],,
249 echo "***** Missing SDL_image header ($website) *****"])
250 AC_SEARCH_LIBS([IMG_Load], [SDL_image],,
252 echo "***** Missing libSDL_image ($website) *****"])
254 ##### libvorbis #####
255 website="http://www.xiph.org/downloads/"
256 AC_CHECK_HEADERS([vorbis/codec.h vorbis/vorbisfile.h],,
258 echo "***** Missing vorbis headers ($website) *****"])
259 AC_SEARCH_LIBS([ov_open], [vorbisfile],,
261 echo "***** Missing libvorbisfile ($website) *****"])
263 ##### librt (optional) #####
264 AC_SEARCH_LIBS([clock_gettime], [rt],
265 [AC_DEFINE([HAVE_CLOCK_GETTIME], 1,
266 [Define to 1 if you have the 'clock_gettime' function.])])
269 if test x$missing == xyes
271 AC_MSG_ERROR([please install missing dependencies (see messages above)])
276 # Find the data files to install.
277 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
279 DATA_FILES=$(echo $(cd data; \
280 find . -name "*.json" \
285 AC_SUBST([DATA_FILES])
289 # Create the build files.
290 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
292 AC_CONFIG_FILES([Makefile
300 AC_CONFIG_HEADERS([src/config.h])
306 # Print a friendly little message.
307 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
310 echo " Configuration complete! :-)"
312 echo " Target: $target"
313 echo " Prefix: $prefix"
314 echo " Data Directory: $DATADIR"
315 echo " Log Level: $log_level"
316 echo " Debug: $debug"
317 echo " Profile: $profile"
318 echo " Extra Warnings: $extra_warnings"
320 echo " To finish the installation, execute:"