]> Dogcows Code - chaz/yoink/blob - configure.ac
sleep forever bug fixed
[chaz/yoink] / configure.ac
1
2 #
3 # Yoink
4 # Process this file with autoconf to produce a configure script.
5 #
6
7 AC_PREREQ([2.60])
8
9 AC_INIT([Yoink], [0.1], [chaz@dogcows.com], [yoink])
10
11 AC_CANONICAL_TARGET
12
13 AC_CONFIG_SRCDIR([src/GameLayer.cc])
14 AC_CONFIG_MACRO_DIR([m4])
15
16 AM_INIT_AUTOMAKE
17
18
19 #
20 # Checks for programs.
21 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22
23 AC_PROG_CXX
24 AC_PROG_CC
25 AC_PROG_CPP
26 AC_PROG_INSTALL
27 AC_PROG_RANLIB
28 AM_PROG_CC_C_O
29
30 PKG_PROG_PKG_CONFIG
31
32 AC_PATH_PROGS([DOXYGEN], [doxygen])
33 AC_SUBST(DOXYGEN)
34
35 #
36 # Configure platform-specific stuff.
37 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
38
39 case "${host}" in
40 *mingw32*)
41 MINGW32=yes
42 WIN32=yes
43 AC_PATH_PROGS([WINDRES], [windres $host_alias-windres $host_os-windres])
44 if test "x$WINDRES" = x
45 then
46 AC_MSG_ERROR([windres could not be found])
47 fi
48 AC_SUBST(WINDRES)
49 AC_PATH_PROGS([MAKENSIS], [makensis])
50 AC_SUBST(MAKENSIS)
51 ;;
52 *cygwin*)
53 CYGWIN=yes
54 WIN32=yes
55 ;;
56 *-apple-darwin*)
57 MACOSX=yes
58 LIBS="$LIBS -Wl,-framework"
59 ;;
60 *-linux-gnu*)
61 LINUX=yes
62 ;;
63 esac
64
65 AM_CONDITIONAL([LINUX], test "$LINUX" = "yes")
66 AM_CONDITIONAL([WIN32], test "$WIN32" = "yes")
67
68
69 #
70 # Checks for configuration arguments.
71 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72
73 AC_ARG_ENABLE([debug],
74 [ --enable-debug include debugging symbols and features],
75 [debug=$enableval],
76 [debug=no])
77
78 AC_ARG_ENABLE([double-precision],
79 [ --enable-double-precision use double-precision numbers],
80 [double_precision=$enableval],
81 [double_precision=no])
82
83 AC_ARG_ENABLE([profile],
84 [ --enable-profile make a binary for use with gprof profiler],
85 [profile=$enableval],
86 [profile=no])
87
88 AC_ARG_ENABLE([extra-warnings],
89 [ --enable-extra-warnings make the gcc compiler give more warnings],
90 [extra_warnings=$enableval],
91 [extra_warnings=no])
92
93 AC_ARG_ENABLE([threads],
94 [ --enable-threads use threads for some parallel tasks],
95 [threads=$enableval],
96 [threads=no])
97
98 AC_ARG_ENABLE([gtk],
99 [ --enable-gtk enable GTK+ info/warning dialogs],
100 [gtk=$enableval],
101 [gtk=no])
102
103 AC_ARG_ENABLE([qt4],
104 [ --enable-qt4 enable QT info/warning dialogs],
105 [qt4=$enableval],
106 [qt4=no])
107
108 AC_ARG_WITH([log-level],
109 [AS_HELP_STRING([--with-log-level=NUM],
110 [0, none... 1, errors... 4, everything (default: 3)])],
111 [log_level=$withval],
112 [log_level=3])
113
114
115 if test x$debug = xyes
116 then
117 CFLAGS="$CFLAGS -DDEBUG -Wall -Wno-uninitialized"
118 CXXFLAGS="$CXXFLAGS -DDEBUG -Wall -Wno-uninitialized"
119 else
120 CFLAGS="$CFLAGS -DNDEBUG"
121 CXXFLAGS="$CXXFLAGS -DNDEBUG"
122 fi
123
124 if test x$double_precision = xyes
125 then
126 AC_DEFINE([USE_DOUBLE_PRECISION], 1,
127 [Define to 1 if you want to use doubles instead of floats.])
128 fi
129
130 if test x$profile = xyes
131 then
132 CFLAGS="$CFLAGS -pg"
133 CXXFLAGS="$CXXFLAGS -pg"
134 AC_DEFINE([PROFILING_ENABLED], 1,
135 [Define to 1 if profiling is built in.])
136 fi
137
138 if test x$extra_warnings = xyes
139 then
140 CFLAGS="$CFLAGS -Wextra -Wno-unused-parameter"
141 CXXFLAGS="$CXXFLAGS -Wextra -Wno-unused-parameter"
142 fi
143
144 if test x$threads = xyes
145 then
146 AC_DEFINE([USE_THREADS], 1,
147 [Define to 1 if you want to use threads for parallel tasks.])
148 fi
149
150 if test x$gtk = xyes
151 then
152 AC_DEFINE([USE_GTK], 1,
153 [Define to 1 if you want to use GTK+ info/error dialogs.])
154 else
155 if test x$qt4 = xyes
156 then
157 AC_DEFINE([USE_QT4], 1,
158 [Define to 1 if you want to use QT info/error dialogs.])
159 fi
160 fi
161
162 AC_DEFINE_UNQUOTED([YOINK_LOGLEVEL], [$log_level],
163 [Define to detail level of logging.])
164
165
166 if test "x$prefix" = xNONE
167 then
168 prefix="$ac_default_prefix"
169 fi
170
171 if test x$WIN32 = xyes
172 then
173 DATADIR="data"
174 else
175 eval eval DATADIR="${datadir}/$PACKAGE"
176 fi
177
178 AC_SUBST([DATADIR])
179 AC_DEFINE_UNQUOTED([YOINK_DATADIR], ["$DATADIR"],
180 [Define to path of game asset directory.])
181
182
183 #
184 # Split the version number into components.
185 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
186
187 VERSION_MAJOR=$(echo $VERSION | cut -d. -f1)
188 VERSION_MINOR=$(echo $VERSION | cut -d. -f2)
189 VERSION_REVISION=$(echo $VERSION | cut -d. -f3)
190
191 AC_DEFINE_UNQUOTED([VERSION_MAJOR], [${VERSION_MAJOR:-0}],
192 [Define to major version number component.])
193
194 AC_DEFINE_UNQUOTED([VERSION_MINOR], [${VERSION_MINOR:-0}],
195 [Define to minor version number component.])
196
197 AC_DEFINE_UNQUOTED([VERSION_REVISION], [${VERSION_REVISION:-0}],
198 [Define to revision version number component.])
199
200 if test x$WIN32 = xyes
201 then
202 PVERSION="${VERSION_MAJOR:-0}.${VERSION_MINOR:-0}.${VERSION_REVISION:-0}.0"
203 AC_SUBST([PVERSION])
204 fi
205
206 # these are used in src/yoink.rc
207
208
209 #
210 # Checks for system functions/headers and compiler characteristics.
211 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
212
213 AC_C_STRINGIZE
214 AC_C_INLINE
215
216 AC_TYPE_UINT8_T
217 AC_TYPE_UINT16_T
218 AC_TYPE_UINT32_T
219 AC_TYPE_SIZE_T
220 AC_TYPE_SSIZE_T
221
222 AC_FUNC_ERROR_AT_LINE
223 AC_FUNC_STRTOD
224 AC_CHECK_FUNCS([nanosleep strchr strcspn strrchr strstr])
225
226 AC_HEADER_STDBOOL
227 AC_HEADER_STDC
228 AC_CHECK_HEADERS([stddef.h stdint.h stdlib.h string.h unistd.h])
229
230
231 #
232 # Checks for build dependencies.
233 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
234
235 ##### boost #####
236 website="http://www.boost.org/"
237 BOOST_SMART_PTR
238 BOOST_STRING_ALGO
239 BOOST_BIND
240 BOOST_FUNCTION
241
242 ##### SDL #####
243 website="http://www.libsdl.org/"
244 AM_PATH_SDL([1.2.10],
245 [CFLAGS="$CFLAGS $SDL_CFLAGS"
246 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
247 LIBS="$LIBS $SDL_LIBS"])
248
249 ##### opengl, glu #####
250 website="http://www.mesa3d.org/"
251 AC_CHECK_HEADERS([GL/gl.h GL/glu.h],,
252 [missing=yes
253 echo "***** Missing GL headers ($website) *****"])
254 if test x$WIN32 == xyes
255 then
256 # autoconf library search macro doesn't find opengl32 on windows because it uses
257 # different name hashing, but it links fine; assume it's there
258 LIBS="$LIBS -lglu32 -lopengl32"
259 else
260 AC_SEARCH_LIBS([glEnable], [GL MesaGL],,
261 [missing=yes
262 echo "***** Missing libGL ($website) *****"])
263 AC_SEARCH_LIBS([gluDisk], [GLU MesaGLU],,
264 [missing=yes
265 echo "***** Missing libGLU ($website) *****"])
266 fi
267
268 ##### openal, alut #####
269 website="http://connect.creativelabs.com/openal/"
270 AC_CHECK_HEADERS([AL/al.h AL/alut.h],,
271 [missing=yes
272 echo "***** Missing OpenAL headers ($website) *****"])
273 AC_SEARCH_LIBS([alEnable], [openal openal32],,
274 [missing=yes
275 echo "***** Missing libopenal ($website) *****"])
276 AC_SEARCH_LIBS([alutInit], [alut],,
277 [missing=yes
278 echo "***** Missing libalut ($website) *****"])
279
280 ##### SDL_image #####
281 website="http://www.libsdl.org/projects/SDL_image/"
282 AC_CHECK_HEADERS([SDL/SDL_image.h],,
283 [missing=yes
284 echo "***** Missing SDL_image header ($website) *****"])
285 AC_SEARCH_LIBS([IMG_Load], [SDL_image],,
286 [missing=yes
287 echo "***** Missing libSDL_image ($website) *****"])
288
289 ##### libvorbis #####
290 website="http://www.xiph.org/downloads/"
291 AC_CHECK_HEADERS([vorbis/codec.h vorbis/vorbisfile.h],,
292 [missing=yes
293 echo "***** Missing vorbis headers ($website) *****"])
294 AC_SEARCH_LIBS([ov_open], [vorbisfile],,
295 [missing=yes
296 echo "***** Missing libvorbisfile ($website) *****"])
297
298 ##### liblua #####
299 website="http://www.lua.org/"
300 AC_CHECK_HEADERS([lua.h],,
301 [missing=yes
302 echo "***** Missing lua headers ($website) *****"])
303 AC_SEARCH_LIBS([lua_load], [lua],,
304 [missing=yes
305 echo "***** Missing liblua ($website) *****"])
306
307 if test x$gtk = xyes
308 then
309 ##### GTK+ 2.0 #####
310 website="http://www.gtk.org/"
311 PKG_CHECK_MODULES([GTK], [gtk+-2.0],
312 [LIBS="$LIBS $GTK_LIBS"
313 CFLAGS="$CFLAGS $GTK_CFLAGS"
314 CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"],
315 [missing=yes
316 echo "***** Missing GTK+-2.0 ($website) *****"])
317 fi
318
319 if test x$qt4 = xyes
320 then
321 ##### QT4 #####
322 website="http://qt.nokia.com/"
323 PKG_CHECK_MODULES([QT], [QtGui],
324 [LIBS="$LIBS $QT_LIBS"
325 CFLAGS="$CFLAGS $QT_CFLAGS"
326 CXXFLAGS="$CXXFLAGS $QT_CFLAGS"],
327 [missing=yes
328 echo "***** Missing QT ($website) *****"])
329 fi
330
331 ##### librt (optional) #####
332 AC_SEARCH_LIBS([clock_gettime], [rt],
333 [AC_DEFINE([HAVE_CLOCK_GETTIME], 1,
334 [Define to 1 if you have the 'clock_gettime' function.])])
335
336
337 if test x$missing == xyes
338 then
339 AC_MSG_ERROR([please install missing dependencies (see messages above)])
340 fi
341
342
343 #
344 # Find the data files to install.
345 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
346
347 DATA_FILES=$(echo $(cd data; \
348 find . -name "*.lua" \
349 -o -name "*.ogg" \
350 -o -name "*.png" \
351 -o -name "yoinkrc"))
352 AC_SUBST([DATA_FILES])
353
354
355 #
356 # Create the build files.
357 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
358
359 AC_CONFIG_FILES([Makefile
360 data/Makefile
361 src/Makefile
362 doc/Makefile doc/yoink.6
363 win32/Makefile win32/build-installer.sh])
364
365 AC_CONFIG_HEADERS([src/config.h])
366
367 AC_OUTPUT
368
369
370 #
371 # Print a friendly little message.
372 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
373
374 echo ""
375 echo " Configuration complete! :-)"
376 echo ""
377 echo " Target: $target"
378 echo " Prefix: $prefix"
379 echo " Data Directory: $DATADIR"
380 echo " Log Level: $log_level"
381 echo " Debug: $debug"
382 echo " Double Precision: $double_precision"
383 echo " Profile: $profile"
384 echo " Extra Warnings: $extra_warnings"
385 echo ""
386 echo " To finish the installation, execute:"
387 echo " make"
388 echo " make install"
389 echo ""
390
This page took 0.053526 seconds and 4 git commands to generate.