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 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
34 # Configure platform-specific stuff.
35 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
48 LIBS="$LIBS -Wl,-framework"
53 # Checks for configuration arguments.
54 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
56 AC_ARG_ENABLE([developer],
57 [ --enable-developer use all compiler flags developers need],
58 [developer=$enableval],
61 AC_ARG_ENABLE([debug],
62 [ --enable-debug include debugging symbols and features],
66 AC_ARG_ENABLE([profile],
67 [ --enable-profile make a binary for use with gprof profiler],
71 AC_ARG_ENABLE([extra-warnings],
72 [ --enable-extra-warnings make the gcc compiler give more warnings],
73 [extra_warnings=$enableval],
76 AC_ARG_WITH([log-level],
77 [AS_HELP_STRING([--with-log-level=NUM],
78 [0, none... 1, errors... 4, everything (default: 3)])],
83 if test x$developer = xyes
91 if test x$debug = xyes
93 CFLAGS="$CFLAGS -Wall -O0 -g -DDEBUG"
94 CXXFLAGS="$CXXFLAGS -Wall -O0 -g -DDEBUG"
96 CFLAGS="$CFLAGS -O2 -DNDEBUG"
97 CXXFLAGS="$CXXFLAGS -O2 -DNDEBUG"
100 if test x$profile = xyes
103 CXXFLAGS="$CXXFLAGS -pg"
106 if test x$extra_warnings = xyes
108 CFLAGS="$CFLAGS -Wextra"
109 CXXFLAGS="$CXXFLAGS -Wextra"
112 AC_DEFINE_UNQUOTED([YOINK_LOGLEVEL], [$log_level],
113 [Define to detail level of logging.])
117 if test "x$prefix" = xNONE
119 prefix="$ac_default_prefix"
122 AC_ARG_WITH([assetdir],
123 [AS_HELP_STRING([--with-assetdir=DIR],
124 [real path to assets (default: $datarootdir/yoink)])],
125 [DATADIR="$withval"],
126 [eval DATADIR="$datarootdir/yoink"])
128 if test x$WIN32 = xyes
134 AC_DEFINE_UNQUOTED([YOINK_DATADIR], ["$DATADIR"],
135 [Define to path of game asset directory.])
138 CONFIGFILES="\$HOME/.yoinkrc:/etc/yoinkrc"
140 AC_DEFINE_UNQUOTED([YOINK_CONFIGFILES], ["$CONFIGFILES"],
141 [Define to colon-delimited configuration file paths.])
145 # Checks for typedefs, structures, and compiler characteristics.
146 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
159 # Checks for system functions.
160 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
162 AC_FUNC_ERROR_AT_LINE
164 AC_CHECK_FUNCS([nanosleep strchr strcspn strrchr strstr])
168 # Checks for header files.
169 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
173 AC_CHECK_HEADERS([stddef.h stdint.h stdlib.h string.h unistd.h])
180 AM_PATH_SDL([1.2.10],
181 [CFLAGS="$CFLAGS $SDL_CFLAGS"
182 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
183 LIBS="$LIBS $SDL_LIBS"])
185 AC_CHECK_HEADERS([GL/gl.h GL/glu.h],,
186 [missing="$missing OpenGL"])
188 AC_CHECK_HEADERS([AL/al.h AL/alut.h],,
189 [missing="$missing OpenAL"])
191 AC_CHECK_HEADERS([SDL/SDL_image.h],,
192 [missing="$missing SDL_image"])
194 AC_CHECK_HEADERS([SDL/SDL_sound.h],,
195 [missing="$missing SDL_sound"])
197 if test "x$missing" != x
199 echo "** Required header files from these libraries are missing:"
200 for header in $missing
204 AC_MSG_ERROR([please install missing dependencies])
209 # Checks for libraries.
210 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
212 AC_SEARCH_LIBS([IMG_Load], [SDL_image],,
213 [missing="$missing SDL_image"])
215 AC_SEARCH_LIBS([Sound_Init], [SDL_sound],,
216 [missing="$missing SDL_sound"])
218 if test x$WIN32 == xyes
220 # autoconf library search macro doesn't find opengl32 on windows because it uses
221 # different name hashing, but it links fine; assume it's there
222 LIBS="$LIBS -lglu32 -lopengl32"
224 AC_SEARCH_LIBS([gluPerspective], [GLU MesaGLU],,
225 [missing="$missing GLU"])
227 AC_SEARCH_LIBS([glBegin], [GL MesaGL],,
228 [missing="$missing OpenGL"])
231 AC_SEARCH_LIBS([alGenBuffers], [openal openal32],,
232 [missing="$missing OpenAL"])
234 AC_SEARCH_LIBS([alutInit], [alut],,
235 [missing="$missing ALUT"])
237 AC_SEARCH_LIBS([clock_gettime], [rt],
238 [AC_DEFINE([HAVE_CLOCK_GETTIME], 1,
239 [Define to 1 if you have the 'clock_gettime' function.])])
241 if test "x$missing" != x
243 echo "** One or more required libraries are missing:"
244 for library in $missing
248 AC_MSG_ERROR([please install missing dependencies])
253 # Find the data files to install.
254 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
256 DATA_FILES=$(echo $(cd data; \
257 find . -name "*.json" \
262 AC_SUBST([DATA_FILES])
266 # Create the build files.
267 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
269 AC_CONFIG_FILES([Makefile
278 AC_CONFIG_HEADERS([src/config.h])
284 # Print a friendly little message.
285 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
288 echo " Configuration complete! :-)"
290 echo " Target: $target"
291 echo " Prefix: $prefix"
292 echo " Data Directory: $DATADIR"
293 echo " Log Level: $log_level"
294 echo " Debug: $debug"
295 echo " Profile: $profile"
296 echo " Extra Warnings: $extra_warnings"
298 echo " To finish the installation, execute:"