]> Dogcows Code - chaz/yoink/blob - configure.ac
03df88747f03e7b96e9daf9e32ea71e275993b57
[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.63)
8
9 AC_INIT([Yoink],[0.1],[chaz@dogcows.com],[yoink])
10
11 AC_CANONICAL_TARGET
12
13 AC_CONFIG_SRCDIR([src/version.c])
14 AC_CONFIG_MACRO_DIR([m4])
15
16 AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip])
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 WIN32=yes
42 AC_PATH_PROGS([MAKENSIS], [makensis])
43 AC_PATH_PROGS([WINDRES],
44 [windres $host_alias-windres $host_os-windres])
45 if test "x$WINDRES" = x
46 then
47 AC_MSG_ERROR([windres could not be found])
48 fi
49 ;;
50 *-apple-darwin*)
51 MACOSX=yes
52 ;;
53 *netbsd*)
54 NETBSD=yes
55 AC_PATH_PROGS([PKGLINT], [pkglint])
56 ;;
57 esac
58
59 AM_CONDITIONAL([WIN32], test "$WIN32" = "yes")
60 AM_CONDITIONAL([NETBSD], test "$NETBSD" = "yes")
61
62
63 #
64 # Checks for configuration arguments.
65 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
66
67 AC_ARG_ENABLE([debug],
68 [ --enable-debug include debugging symbols and features],
69 [debug=$enableval],
70 [debug=no])
71
72 AC_ARG_ENABLE([double-precision],
73 [ --enable-double-precision use doubles instead of floats],
74 [double_precision=$enableval],
75 [double_precision=no])
76
77 AC_ARG_ENABLE([profile],
78 [ --enable-profile make a binary with code profiling instructions],
79 [profile=$enableval],
80 [profile=no])
81
82 AC_ARG_ENABLE([extra-warnings],
83 [ --enable-extra-warnings make the gcc compiler give more warnings],
84 [extra_warnings=$enableval],
85 [extra_warnings=no])
86
87 AC_ARG_ENABLE([clock_gettime],
88 [ --enable-clock_gettime use clock_gettime() instead of SDL_GetTicks()],
89 [clock_gettime=$enableval],
90 [clock_gettime=no])
91
92 AC_ARG_ENABLE([threads],
93 [ --enable-threads use threads for concurrency where appropriate],
94 [threads=$enableval],
95 [threads=no])
96
97 AC_ARG_ENABLE([gtk],
98 [ --enable-gtk enable GTK+ modal dialogs],
99 [gtk=$enableval],
100 [gtk=no])
101
102 AC_ARG_ENABLE([qt4],
103 [ --enable-qt4 enable QT modal dialogs],
104 [qt4=$enableval],
105 [qt4=no])
106
107
108 if test x$debug = xyes
109 then
110 CFLAGS="$CFLAGS -DDEBUG -ggdb -O0 -Wall -Wno-uninitialized"
111 CXXFLAGS="$CXXFLAGS -DDEBUG -ggdb -O0 -Wall -Wno-uninitialized"
112 else
113 CFLAGS="$CFLAGS -DNDEBUG"
114 CXXFLAGS="$CXXFLAGS -DNDEBUG"
115 fi
116
117 if test x$double_precision = xyes
118 then
119 AC_DEFINE([USE_DOUBLE_PRECISION], 1,
120 [Define to 1 if you want to use doubles instead of floats.])
121 fi
122
123 if test x$profile = xyes
124 then
125 CFLAGS="$CFLAGS -pg"
126 CXXFLAGS="$CXXFLAGS -pg"
127 AC_DEFINE([PROFILING_ENABLED], 1,
128 [Define to 1 if profiling is built in.])
129 fi
130
131 if test x$extra_warnings = xyes
132 then
133 CFLAGS="$CFLAGS -Wextra -Wno-unused-parameter"
134 CXXFLAGS="$CXXFLAGS -Wextra -Wno-unused-parameter"
135 fi
136
137 if test x$threads = xyes
138 then
139 AC_DEFINE([USE_THREADS], 1,
140 [Define to 1 if you want to use threads when applicable.])
141 fi
142
143 if test x$gtk = xyes
144 then
145 AC_DEFINE([USE_GTK], 1,
146 [Define to 1 if you want to use GTK+ modal dialogs.])
147 elif test x$qt4 = xyes
148 then
149 AC_DEFINE([USE_QT4], 1,
150 [Define to 1 if you want to use QT4 modal dialogs.])
151 fi
152
153
154 if test "x$prefix" = xNONE
155 then
156 prefix="$ac_default_prefix"
157 fi
158
159 if test x$WIN32 = xyes
160 then
161 DATADIR="data"
162 else
163 eval eval DATADIR="${datadir}/$PACKAGE"
164 fi
165
166 AC_SUBST([DATADIR])
167 AC_DEFINE_UNQUOTED([YOINK_DATADIR], ["$DATADIR"],
168 [Define to path of game asset directory.])
169
170
171 #
172 # Split the version number into components.
173 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
174
175 VERSION_MAJOR=$(echo $VERSION | cut -d. -f1)
176 VERSION_MINOR=$(echo $VERSION | cut -d. -f2)
177 VERSION_REVISION=$(echo $VERSION | cut -d. -f3)
178
179 AC_DEFINE_UNQUOTED([VERSION_MAJOR], [${VERSION_MAJOR:-0}],
180 [Define to major version number component.])
181
182 AC_DEFINE_UNQUOTED([VERSION_MINOR], [${VERSION_MINOR:-0}],
183 [Define to minor version number component.])
184
185 AC_DEFINE_UNQUOTED([VERSION_REVISION], [${VERSION_REVISION:-0}],
186 [Define to revision version number component.])
187
188 if test x$WIN32 = xyes
189 then
190 PVERSION="${VERSION_MAJOR:-0}.${VERSION_MINOR:-0}.${VERSION_REVISION:-0}.0"
191 AC_SUBST([PVERSION])
192 fi
193
194 # these are used in src/yoink.rc
195
196
197 #
198 # Checks for system functions/headers and compiler characteristics.
199 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
200
201 AC_C_STRINGIZE
202 AC_C_INLINE
203
204 AC_TYPE_UINT8_T
205 AC_TYPE_UINT16_T
206 AC_TYPE_UINT32_T
207 AC_TYPE_SIZE_T
208 AC_TYPE_SSIZE_T
209
210 AC_FUNC_ERROR_AT_LINE
211 AC_FUNC_STRTOD
212 AC_CHECK_FUNCS([nanosleep strchr strcspn strrchr strstr])
213
214 AC_HEADER_STDBOOL
215 AC_HEADER_STDC
216 AC_CHECK_HEADERS([stddef.h stdint.h stdlib.h string.h unistd.h])
217
218 ##### clock_gettime #####
219 if test x$clock_gettime = xyes
220 then
221 AC_SEARCH_LIBS([clock_gettime], [rt],
222 [AC_DEFINE([HAVE_CLOCK_GETTIME], 1,
223 [Define to 1 if you have the 'clock_gettime' function.])])
224 fi
225
226
227 #
228 # Checks for build dependencies.
229 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
230
231 echo "checking for dependencies..."
232
233 ##### boost #####
234 website="http://www.boost.org/"
235 BOOST_SMART_PTR
236 BOOST_STRING_ALGO
237 BOOST_BIND
238 BOOST_FUNCTION
239
240 ##### SDL #####
241 website="http://www.libsdl.org/"
242 PKG_CHECK_MODULES([SDL], [sdl],
243 [LIBS="$LIBS $SDL_LIBS"
244 CFLAGS="$CFLAGS $SDL_CFLAGS"
245 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"],
246 [missing=yes
247 echo "***** Missing SDL ($website) *****"])
248
249 ##### opengl, glu #####
250 website="http://www.mesa3d.org/"
251 PKG_CHECK_MODULES([OPENGL], [gl glu],
252 [LIBS="$LIBS $OPENGL_LIBS"
253 CFLAGS="$CFLAGS $OPENGL_CFLAGS"
254 CXXFLAGS="$CXXFLAGS $GLU_CFLAGS"],
255 [missing=yes
256 echo "***** Missing OpenGL ($website) *****"])
257
258 ##### liblua #####
259 website="http://www.lua.org/"
260 PKG_CHECK_MODULES([LUA], [lua],
261 [LIBS="$LIBS $LUA_LIBS"
262 CFLAGS="$CFLAGS $LUA_CFLAGS"
263 CXXFLAGS="$CXXFLAGS $LUA_CFLAGS"],
264 [missing=yes
265 echo "***** Missing liblua ($website) *****"])
266
267 ##### libpng #####
268 website="http://www.libpng.org/pub/png/libpng.html"
269 PKG_CHECK_MODULES([PNG], [libpng],
270 [LIBS="$LIBS $PNG_LIBS"
271 CFLAGS="$CFLAGS $PNG_CFLAGS"
272 CXXFLAGS="$CXXFLAGS $PNG_CFLAGS"],
273 [missing=yes
274 echo "***** Missing libpng ($website) *****"])
275
276 ##### openal #####
277 website="http://connect.creativelabs.com/openal/"
278 PKG_CHECK_MODULES([OPENAL], [openal],
279 [LIBS="$LIBS $OPENAL_LIBS"
280 CFLAGS="$CFLAGS $OPENAL_CFLAGS"
281 CXXFLAGS="$CXXFLAGS $OPENAL_CFLAGS"],
282 [missing=yes
283 echo "***** Missing OpenAL ($website) *****"])
284
285 ##### libvorbis #####
286 website="http://www.xiph.org/downloads/"
287 PKG_CHECK_MODULES([VORBIS], [vorbisfile],
288 [LIBS="$LIBS $VORBIS_LIBS"
289 CFLAGS="$CFLAGS $VORBIS_CFLAGS"
290 CXXFLAGS="$CXXFLAGS $VORBIS_CFLAGS"],
291 [missing=yes
292 echo "***** Missing libvorbisfile ($website) *****"])
293
294 ##### GTK+ 2.0 #####
295 if test x$gtk = xyes
296 then
297 website="http://www.gtk.org/"
298 PKG_CHECK_MODULES([GTK], [gtk+-2.0],
299 [LIBS="$LIBS $GTK_LIBS"
300 CFLAGS="$CFLAGS $GTK_CFLAGS"
301 CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"],
302 [missing=yes
303 echo "***** Missing GTK+-2.0 ($website) *****"])
304 fi
305
306 ##### QT4 #####
307 if test x$qt4 = xyes
308 then
309 website="http://qt.nokia.com/"
310 PKG_CHECK_MODULES([QT], [QtGui],
311 [LIBS="$LIBS $QT_LIBS"
312 CFLAGS="$CFLAGS $QT_CFLAGS"
313 CXXFLAGS="$CXXFLAGS $QT_CFLAGS"],
314 [missing=yes
315 echo "***** Missing QT ($website) *****"])
316 fi
317
318
319 if test x$missing = xyes
320 then
321 AC_MSG_ERROR([Please resolve the missing dependencies, and try again.])
322 fi
323
324
325 #
326 # Find the game resources to install.
327 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
328
329 DATA_FILES=$(echo $(cd data && find . -name "*.lua" \
330 -o -name "*.ogg" \
331 -o -name "*.png" \
332 -o -name "yoinkrc"))
333 AC_SUBST([DATA_FILES])
334
335
336 #
337 # Create the build files.
338 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
339
340 AC_CONFIG_FILES([Makefile
341 data/Makefile
342 doc/Makefile
343 doc/yoink.6
344 src/Makefile])
345
346 AC_CONFIG_HEADERS([src/config.h])
347
348 AC_OUTPUT
349
350
351 #
352 # Print a friendly little message.
353 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
354
355 echo ""
356 echo " Configuration complete! :-)"
357 echo ""
358 echo " Host: $target"
359 echo " Prefix: $prefix"
360 echo " Data: $DATADIR"
361 echo ""
362 echo " CXX: $CXX"
363 echo " CXXFLAGS: $(echo $CXXFLAGS)"
364 echo " LIBS: $(echo $LIBS)"
365 echo ""
366 echo " To finish the installation, execute:"
367 echo " make"
368 echo " make install"
369 echo ""
370
This page took 0.056954 seconds and 4 git commands to generate.