4 # Process this file with autoconf to produce a configure script.
9 AC_INIT([Yoink], [0.1], [onefriedrice@brokenzipper.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 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
46 LIBS="$LIBS -Wl,-framework"
51 # Checks for configuration arguments.
52 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
54 AC_ARG_ENABLE([developer],
55 [ --enable-developer use all compiler flags developers need],
56 [developer=$enableval],
59 AC_ARG_ENABLE([debug],
60 [ --enable-debug include debugging symbols and features],
64 AC_ARG_ENABLE([profile],
65 [ --enable-profile make a binary for use with gprof profiler],
69 AC_ARG_ENABLE([extra-warnings],
70 [ --enable-extra-warnings make the gcc compiler give more warnings],
71 [extra_warnings=$enableval],
74 AC_ARG_WITH([log-level],
75 [AS_HELP_STRING([--with-log-level=NUM],
76 [0, none... 1, errors... 4, everything (default: 3)])],
81 if test x$developer = xyes
86 if test x$WIN32 != xyes
92 if test x$debug = xyes
94 CFLAGS="$CFLAGS -Wall -O0 -gstabs -DDEBUG"
95 CXXFLAGS="$CXXFLAGS -Wall -O0 -gstabs -DDEBUG"
97 CFLAGS="$CFLAGS -O2 -DNDEBUG"
98 CXXFLAGS="$CXXFLAGS -O2 -DNDEBUG"
101 if test x$profile = xyes
104 CXXFLAGS="$CXXFLAGS -pg"
107 if test x$extra_warnings = xyes
109 CFLAGS="$CFLAGS -Wextra -Wno-unused-parameter"
110 CXXFLAGS="$CXXFLAGS -Wextra -Wno-unused-parameter"
113 AC_DEFINE_UNQUOTED([YOINK_LOGLEVEL], [$log_level],
114 [Define to detail level of logging.])
118 if test "x$prefix" = xNONE
120 prefix="$ac_default_prefix"
123 AC_ARG_WITH([assetdir],
124 [AS_HELP_STRING([--with-assetdir=DIR],
125 [real path to assets (default: $datarootdir/yoink)])],
126 [DATADIR="$withval"],
127 [eval DATADIR="$datarootdir/yoink"])
129 if test x$WIN32 = xyes
135 AC_DEFINE_UNQUOTED([YOINK_DATADIR], ["$DATADIR"],
136 [Define to path of game asset directory.])
139 CONFIGFILES="\$HOME/.yoinkrc:/etc/yoinkrc"
141 AC_DEFINE_UNQUOTED([YOINK_CONFIGFILES], ["$CONFIGFILES"],
142 [Define to colon-delimited configuration file paths.])
146 # Checks for typedefs, structures, and compiler characteristics.
147 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
160 # Checks for system functions.
161 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
163 AC_FUNC_ERROR_AT_LINE
165 AC_CHECK_FUNCS([nanosleep strchr strcspn strrchr strstr])
169 # Checks for header files.
170 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
174 AC_CHECK_HEADERS([stddef.h stdint.h stdlib.h string.h unistd.h])
181 AM_PATH_SDL([1.2.10],
182 [CFLAGS="$CFLAGS $SDL_CFLAGS"
183 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
184 LIBS="$LIBS $SDL_LIBS"])
186 AC_CHECK_HEADERS([GL/gl.h GL/glu.h],,
187 [missing="$missing OpenGL"])
189 AC_CHECK_HEADERS([AL/al.h AL/alut.h],,
190 [missing="$missing OpenAL"])
192 AC_CHECK_HEADERS([SDL/SDL_image.h],,
193 [missing="$missing SDL_image"])
195 AC_CHECK_HEADERS([vorbis/codec.h vorbis/vorbisfile.h],,
196 [missing="$missing libvorbis"])
198 if test "x$missing" != x
200 echo "** Required header files from these libraries are missing:"
201 for header in $missing
205 AC_MSG_ERROR([please install missing dependencies])
210 # Checks for libraries.
211 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
213 if test x$WIN32 == xyes
215 # autoconf library search macro doesn't find opengl32 on windows because it uses
216 # different name hashing, but it links fine; assume it's there
217 LIBS="$LIBS -lglu32 -lopengl32"
219 AC_SEARCH_LIBS([gluDisk], [GLU MesaGLU],,
220 [missing="$missing GLU"])
222 AC_SEARCH_LIBS([glEnable], [GL MesaGL],,
223 [missing="$missing OpenGL"])
226 AC_SEARCH_LIBS([alEnable], [openal openal32],,
227 [missing="$missing OpenAL"])
229 AC_SEARCH_LIBS([alutInit], [alut],,
230 [missing="$missing ALUT"])
232 AC_SEARCH_LIBS([IMG_Load], [SDL_image],,
233 [missing="$missing SDL_image"])
235 AC_SEARCH_LIBS([ov_open], [vorbisfile],,
236 [missing="$missing libvorbis"])
238 AC_SEARCH_LIBS([clock_gettime], [rt],
239 [AC_DEFINE([HAVE_CLOCK_GETTIME], 1,
240 [Define to 1 if you have the 'clock_gettime' function.])])
242 if test "x$missing" != x
244 echo "** One or more required libraries are missing:"
245 for library in $missing
249 AC_MSG_ERROR([please install missing dependencies])
254 # Find the data files to install.
255 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
257 DATA_FILES=$(echo $(cd data; \
258 find . -name "*.json" \
263 AC_SUBST([DATA_FILES])
267 # Create the build files.
268 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
270 AC_CONFIG_FILES([Makefile
277 #src/Moof/yajl/Makefile])
279 AC_CONFIG_HEADERS([src/config.h])
285 # Print a friendly little message.
286 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
289 echo " Configuration complete! :-)"
291 echo " Target: $target"
292 echo " Prefix: $prefix"
293 echo " Data Directory: $DATADIR"
294 echo " Log Level: $log_level"
295 echo " Debug: $debug"
296 echo " Profile: $profile"
297 echo " Extra Warnings: $extra_warnings"
299 echo " To finish the installation, execute:"