incorporated vim's link.sh; -i arg reports commit
[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.61)
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 # Determine the target platform.
21 #
22
23 case "${host}" in
24 *mingw32*) WIN32=yes ;;
25 *-apple-darwin*) MACOSX=yes ;;
26 *netbsd*) NETBSD=yes ;;
27 esac
28
29 AM_CONDITIONAL([WIN32], [test x$WIN32 = xyes])
30 AM_CONDITIONAL([MACOSX], [test x$MACOSX = xyes])
31 AM_CONDITIONAL([NETBSD], [test x$NETBSD = xyes])
32
33
34 #
35 # Checks for configuration arguments.
36 #
37
38 AC_ARG_ENABLE([debug],
39 [AS_HELP_STRING([--enable-debug],
40 [include debugging symbols and code paths])],
41 [debug=$enableval],
42 [debug=no])
43
44 AC_ARG_ENABLE([double-precision],
45 [AS_HELP_STRING([--enable-double-precision],
46 [use doubles instead of floats])],
47 [double_precision=$enableval],
48 [double_precision=no])
49
50 AC_ARG_ENABLE([profile],
51 [AS_HELP_STRING([--enable-profile],
52 [make a binary with code profiling instructions])],
53 [profile=$enableval],
54 [profile=no])
55
56 AC_ARG_ENABLE([extra-warnings],
57 [AS_HELP_STRING([--enable-extra-warnings],
58 [make the gcc compiler give more warnings])],
59 [extra_warnings=$enableval],
60 [extra_warnings=no])
61
62 AC_ARG_ENABLE([link-sh],
63 [AS_HELP_STRING([--enable-link-sh],
64 [give the executable fewer direct dependencies])],
65 [link_sh=$enableval],
66 [link_sh=no])
67
68 AC_ARG_ENABLE([clock_gettime],
69 [AS_HELP_STRING([--enable-clock_gettime],
70 [use clock_gettime() instead of SDL_GetTicks()])],
71 [clock_gettime=$enableval],
72 [clock_gettime=no])
73
74 AC_ARG_ENABLE([threads],
75 [AS_HELP_STRING([--enable-threads],
76 [use threads for concurrency where appropriate])],
77 [threads=$enableval],
78 [threads=no])
79
80 AC_ARG_WITH([gui-toolkit],
81 [AS_HELP_STRING([--with-gui-toolkit=ARG],
82 [possible values: none (default), gtk, qt4])],
83 [gui_toolkit=$withval],
84 [gui_toolkit=none])
85
86
87 if test x$debug = xyes
88 then
89 CFLAGS="$CFLAGS -DDEBUG -ggdb -O0 -Wall -Wno-uninitialized"
90 CXXFLAGS="$CXXFLAGS -DDEBUG -ggdb -O0 -Wall -Wno-uninitialized"
91 else
92 CFLAGS="$CFLAGS -DNDEBUG"
93 CXXFLAGS="$CXXFLAGS -DNDEBUG"
94 fi
95
96 if test x$double_precision = xyes
97 then
98 AC_DEFINE([USE_DOUBLE_PRECISION], 1,
99 [Define to 1 if you want to use doubles instead of floats.])
100 fi
101
102 if test x$profile = xyes
103 then
104 CFLAGS="$CFLAGS -pg"
105 CXXFLAGS="$CXXFLAGS -pg"
106 AC_DEFINE([PROFILING_ENABLED], 1,
107 [Define to 1 if profiling is built in.])
108 fi
109
110 if test x$extra_warnings = xyes
111 then
112 CFLAGS="$CFLAGS -Wextra -Wno-unused-parameter"
113 CXXFLAGS="$CXXFLAGS -Wextra -Wno-unused-parameter"
114 fi
115
116 AM_CONDITIONAL([LINK_SH], [test x$link_sh = xyes])
117
118 if test x$threads = xyes
119 then
120 AC_DEFINE([USE_THREADS], 1,
121 [Define to 1 if you want to use threads when applicable.])
122 fi
123
124 if test x$gui_toolkit = xgtk
125 then
126 AC_DEFINE([USE_GTK], 1,
127 [Define to 1 if you want to use GTK+ modal dialogs.])
128 elif test x$gui_toolkit = xqt4
129 then
130 AC_DEFINE([USE_QT4], 1,
131 [Define to 1 if you want to use QT4 modal dialogs.])
132 fi
133
134
135 if test "x$prefix" = xNONE
136 then
137 prefix="$ac_default_prefix"
138 fi
139
140 if test x$WIN32 = xyes
141 then
142 DATADIR="data"
143 else
144 eval eval DATADIR="${datadir}/$PACKAGE"
145 fi
146
147 AC_SUBST([DATADIR])
148 AC_DEFINE_UNQUOTED([YOINK_DATADIR], ["$DATADIR"],
149 [Define to the path of the game asset directory.])
150
151
152 ####
153 AC_MSG_NOTICE([Checks for programs.])
154 ####
155
156 AC_PROG_CXX
157 AC_PROG_CC
158 AC_PROG_INSTALL
159 AC_PROG_RANLIB
160 AM_PROG_CC_C_O
161
162 PKG_PROG_PKG_CONFIG
163
164 AC_PATH_PROGS([CUT], [cut])
165 if test x$CUT = x
166 then
167 AC_MSG_ERROR([The cut program is required.])
168 fi
169
170 AC_PATH_PROGS([FIND], [find])
171 if test x$FIND = x
172 then
173 AC_MSG_ERROR([The find program is required.])
174 fi
175
176 if test x$WIN32 = xyes
177 then
178 AC_PATH_PROGS([WINDRES],
179 [windres $host_alias-windres $host_os-windres])
180 if test x$WINDRES = x
181 then
182 AC_MSG_ERROR([The windres program is required.])
183 fi
184
185 AC_PATH_PROGS([ZIP], [zip])
186 if test x$ZIP = x
187 then
188 AC_MSG_WARN([The zip program is needed to build a portable package.])
189 fi
190
191 AC_PATH_PROGS([MAKENSIS], [makensis])
192 if test x$MAKENSIS = x
193 then
194 AC_MSG_WARN([The makensis program is needed to build an installer.])
195 fi
196
197 AC_PATH_PROGS([GROFF], [groff])
198 if test x$GROFF = x
199 then
200 AC_MSG_WARN([The groff program is needed to create the manual page.])
201 fi
202 elif test x$NETBSD = xyes
203 then
204 AC_PATH_PROGS([PKGLINT], [pkglint])
205 fi
206
207 AM_CONDITIONAL([HAVE_MAKENSIS], [test x$MAKENSIS != x])
208
209 ####
210 AC_MSG_NOTICE([Checks for libraries.])
211 ####
212
213 ##### SDL #####
214 website="http://www.libsdl.org/"
215 PKG_CHECK_MODULES([SDL], [sdl],
216 [LIBS="$LIBS $SDL_LIBS"
217 CFLAGS="$CFLAGS $SDL_CFLAGS"
218 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"],
219 [missing=yes
220 AC_MSG_WARN([Missing SDL ($website)])])
221
222 ##### opengl, glu #####
223 website="http://www.mesa3d.org/"
224 PKG_CHECK_MODULES([OPENGL], [gl glu],
225 [LIBS="$LIBS $OPENGL_LIBS"
226 CFLAGS="$CFLAGS $OPENGL_CFLAGS"
227 CXXFLAGS="$CXXFLAGS $OPENGL_CFLAGS"],
228 [missing=yes
229 AC_MSG_WARN([Missing OpenGL ($website)])])
230
231 ##### libpng #####
232 website="http://www.libpng.org/pub/png/libpng.html"
233 PKG_CHECK_MODULES([PNG], [libpng],
234 [LIBS="$LIBS $PNG_LIBS"
235 CFLAGS="$CFLAGS $PNG_CFLAGS"
236 CXXFLAGS="$CXXFLAGS $PNG_CFLAGS"],
237 [missing=yes
238 AC_MSG_WARN([Missing libpng ($website)])])
239
240 ##### openal #####
241 website="http://connect.creativelabs.com/openal/"
242 PKG_CHECK_MODULES([OPENAL], [openal],
243 [LIBS="$LIBS $OPENAL_LIBS"
244 CFLAGS="$CFLAGS $OPENAL_CFLAGS"
245 CXXFLAGS="$CXXFLAGS $OPENAL_CFLAGS"],
246 [missing=yes
247 AC_MSG_WARN([Missing OpenAL ($website)])])
248
249 ##### libvorbis #####
250 website="http://www.xiph.org/downloads/"
251 PKG_CHECK_MODULES([VORBIS], [vorbisfile],
252 [LIBS="$LIBS $VORBIS_LIBS"
253 CFLAGS="$CFLAGS $VORBIS_CFLAGS"
254 CXXFLAGS="$CXXFLAGS $VORBIS_CFLAGS"],
255 [missing=yes
256 AC_MSG_WARN([Missing libvorbisfile ($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 AC_MSG_WARN([Missing liblua ($website)])])
266
267 ##### GTK+ 2.0 #####
268 if test x$gui_toolkit = xgtk
269 then
270 website="http://www.gtk.org/"
271 PKG_CHECK_MODULES([GTK], [gtk+-2.0],
272 [LIBS="$LIBS $GTK_LIBS"
273 CFLAGS="$CFLAGS $GTK_CFLAGS"
274 CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"],
275 [missing=yes
276 AC_MSG_WARN([Missing GTK+-2.0 ($website)])])
277 fi
278
279 ##### QT4 #####
280 if test x$gui_toolkit = xqt4
281 then
282 website="http://qt.nokia.com/"
283 PKG_CHECK_MODULES([QT4], [QtGui],
284 [LIBS="$LIBS $QT4_LIBS"
285 CFLAGS="$CFLAGS $QT4_CFLAGS"
286 CXXFLAGS="$CXXFLAGS $QT4_CFLAGS"],
287 [missing=yes
288 AC_MSG_WARN([Missing QT4 ($website)])])
289 fi
290
291 if test x$missing = xyes
292 then
293 AC_MSG_ERROR([You are missing some required libraries.])
294 fi
295
296
297 ####
298 AC_MSG_NOTICE([Checks for header files.])
299 ####
300
301 AC_HEADER_STDBOOL
302 AC_HEADER_STDC
303 AC_CHECK_HEADERS([stddef.h stdint.h stdlib.h string.h unistd.h])
304
305 BOOST_SMART_PTR
306 BOOST_STRING_ALGO
307 BOOST_BIND
308 BOOST_FUNCTION
309
310
311 ####
312 AC_MSG_NOTICE([Checks for types.])
313 ####
314
315 AC_TYPE_UINT8_T
316 AC_TYPE_UINT16_T
317 AC_TYPE_UINT32_T
318 AC_TYPE_SIZE_T
319 AC_TYPE_SSIZE_T
320
321
322 ####
323 AC_MSG_NOTICE([Checks for compiler characteristics.])
324 ####
325
326 AC_C_STRINGIZE
327 AC_C_INLINE
328
329
330 ####
331 AC_MSG_NOTICE([Checks for library functions.])
332 ####
333
334 AC_FUNC_ERROR_AT_LINE
335 AC_FUNC_STRTOD
336 AC_CHECK_FUNCS([nanosleep strchr strcspn strrchr strstr])
337
338 if test x$clock_gettime = xyes
339 then
340 AC_SEARCH_LIBS([clock_gettime], [rt],
341 [clock_gettime=yes],
342 [clock_gettime=no])
343 if test x$clock_gettime = xyes
344 then
345 AC_DEFINE([HAVE_CLOCK_GETTIME], 1,
346 [Define to 1 if you have the 'clock_gettime' function.])
347 else
348 AC_MSG_WARN([Falling back to SDL_GetTicks().])
349 fi
350 fi
351
352
353 #
354 # Find the game resources to install.
355 #
356
357 DATA_FILES=$(echo $(cd data && find . -name "*.lua" \
358 -o -name "*.ogg" \
359 -o -name "*.png" \
360 -o -name "yoinkrc"))
361 AC_SUBST([DATA_FILES])
362
363
364 #
365 # Split the version number into components.
366 # These definitions are used in the win32 resource file, src/yoink.rc.
367 #
368
369 VERSION_MAJOR=$(echo $VERSION | cut -d. -f1)
370 VERSION_MINOR=$(echo $VERSION | cut -d. -f2)
371 VERSION_REVISION=$(echo $VERSION | cut -d. -f3)
372
373 AC_DEFINE_UNQUOTED([VERSION_MAJOR], [${VERSION_MAJOR:-0}],
374 [Define to major version number component.])
375
376 AC_DEFINE_UNQUOTED([VERSION_MINOR], [${VERSION_MINOR:-0}],
377 [Define to minor version number component.])
378
379 AC_DEFINE_UNQUOTED([VERSION_REVISION], [${VERSION_REVISION:-0}],
380 [Define to revision version number component.])
381
382 PVERSION="${VERSION_MAJOR:-0}.${VERSION_MINOR:-0}.${VERSION_REVISION:-0}.0"
383 AC_SUBST([PVERSION])
384
385 if githead=$(git log -n1 --date=short --pretty=format:"%h (%ad)")
386 then
387 AC_DEFINE_UNQUOTED([YOINK_GITHEAD], ["$githead"],
388 [Define to the git commit currently checked out.])
389 fi
390
391
392 #
393 # Create the build files.
394 #
395
396 AC_CONFIG_FILES([Makefile
397 data/Makefile
398 doc/yoink.6
399 src/Makefile])
400
401 AC_CONFIG_HEADERS([src/config.h])
402
403 AC_OUTPUT
404
405
406 #
407 # Print a friendly little message.
408 #
409
410 echo ""
411 echo " Configuration complete! :-)"
412 echo ""
413 echo " Host: $target"
414 echo " Prefix: $prefix"
415 echo " Data: $DATADIR"
416 echo ""
417 echo " CXX: $CXX"
418 echo " CXXFLAGS: $(echo $CXXFLAGS)"
419 echo " LIBS: $(echo $LIBS)"
420 echo ""
421 echo " To finish the installation, execute:"
422 echo " make"
423 echo " make install"
424 echo ""
425
This page took 0.045656 seconds and 4 git commands to generate.