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
88 if test x$WIN32 != xyes
94 if test x$debug = xyes
96 CFLAGS="$CFLAGS -Wall -O0 -gstabs -DDEBUG"
97 CXXFLAGS="$CXXFLAGS -Wall -O0 -gstabs -DDEBUG"
99 CFLAGS="$CFLAGS -O2 -DNDEBUG"
100 CXXFLAGS="$CXXFLAGS -O2 -DNDEBUG"
103 if test x$profile = xyes
106 CXXFLAGS="$CXXFLAGS -pg"
109 if test x$extra_warnings = xyes
111 CFLAGS="$CFLAGS -Wextra -Wno-unused-parameter"
112 CXXFLAGS="$CXXFLAGS -Wextra -Wno-unused-parameter"
115 AC_DEFINE_UNQUOTED([YOINK_LOGLEVEL], [$log_level],
116 [Define to detail level of logging.])
120 if test "x$prefix" = xNONE
122 prefix="$ac_default_prefix"
125 AC_ARG_WITH([assetdir],
126 [AS_HELP_STRING([--with-assetdir=DIR],
127 [real path to assets (default: $datarootdir/yoink)])],
128 [DATADIR="$withval"],
129 [eval DATADIR="$datarootdir/yoink"])
131 if test x$WIN32 = xyes
137 AC_DEFINE_UNQUOTED([YOINK_DATADIR], ["$DATADIR"],
138 [Define to path of game asset directory.])
141 CONFIGFILES="\$HOME/.yoinkrc:/etc/yoinkrc"
143 AC_DEFINE_UNQUOTED([YOINK_CONFIGFILES], ["$CONFIGFILES"],
144 [Define to colon-delimited configuration file paths.])
148 # Checks for typedefs, structures, and compiler characteristics.
149 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
162 # Checks for system functions.
163 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
165 AC_FUNC_ERROR_AT_LINE
167 AC_CHECK_FUNCS([nanosleep strchr strcspn strrchr strstr])
171 # Checks for header files.
172 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
176 AC_CHECK_HEADERS([stddef.h stdint.h stdlib.h string.h unistd.h])
183 AM_PATH_SDL([1.2.10],
184 [CFLAGS="$CFLAGS $SDL_CFLAGS"
185 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
186 LIBS="$LIBS $SDL_LIBS"])
188 AC_CHECK_HEADERS([GL/gl.h GL/glu.h],,
189 [missing="$missing OpenGL"])
191 AC_CHECK_HEADERS([AL/al.h AL/alut.h],,
192 [missing="$missing OpenAL"])
194 AC_CHECK_HEADERS([SDL/SDL_image.h],,
195 [missing="$missing SDL_image"])
197 AC_CHECK_HEADERS([SDL/SDL_sound.h],,
198 [missing="$missing SDL_sound"])
200 if test "x$missing" != x
202 echo "** Required header files from these libraries are missing:"
203 for header in $missing
207 AC_MSG_ERROR([please install missing dependencies])
212 # Checks for libraries.
213 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
215 AC_SEARCH_LIBS([IMG_Load], [SDL_image],,
216 [missing="$missing SDL_image"])
218 AC_SEARCH_LIBS([Sound_Init], [SDL_sound],,
219 [missing="$missing SDL_sound"])
221 if test x$WIN32 == xyes
223 # autoconf library search macro doesn't find opengl32 on windows because it uses
224 # different name hashing, but it links fine; assume it's there
225 LIBS="$LIBS -lglu32 -lopengl32"
227 AC_SEARCH_LIBS([gluPerspective], [GLU MesaGLU],,
228 [missing="$missing GLU"])
230 AC_SEARCH_LIBS([glBegin], [GL MesaGL],,
231 [missing="$missing OpenGL"])
234 AC_SEARCH_LIBS([alGenBuffers], [openal openal32],,
235 [missing="$missing OpenAL"])
237 AC_SEARCH_LIBS([alutInit], [alut],,
238 [missing="$missing ALUT"])
240 AC_SEARCH_LIBS([clock_gettime], [rt],
241 [AC_DEFINE([HAVE_CLOCK_GETTIME], 1,
242 [Define to 1 if you have the 'clock_gettime' function.])])
244 if test "x$missing" != x
246 echo "** One or more required libraries are missing:"
247 for library in $missing
251 AC_MSG_ERROR([please install missing dependencies])
256 # Find the data files to install.
257 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
259 DATA_FILES=$(echo $(cd data; \
260 find . -name "*.json" \
265 AC_SUBST([DATA_FILES])
269 # Create the build files.
270 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
272 AC_CONFIG_FILES([Makefile
279 src/Moof/yajl/Makefile])
281 AC_CONFIG_HEADERS([src/config.h])
287 # Print a friendly little message.
288 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
291 echo " Configuration complete! :-)"
293 echo " Target: $target"
294 echo " Prefix: $prefix"
295 echo " Data Directory: $DATADIR"
296 echo " Log Level: $log_level"
297 echo " Debug: $debug"
298 echo " Profile: $profile"
299 echo " Extra Warnings: $extra_warnings"
301 echo " To finish the installation, execute:"