simplified win32 installer build script
[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/version.c])
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_PATH_PROGS([MAKENSIS], [makensis])
49 ;;
50 *cygwin*)
51 CYGWIN=yes
52 WIN32=yes
53 ;;
54 *-apple-darwin*)
55 MACOSX=yes
56 LIBS="$LIBS -Wl,-framework"
57 ;;
58 esac
59
60 AM_CONDITIONAL([WIN32], test "$WIN32" = "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 double-precision numbers],
74 [double_precision=$enableval],
75 [double_precision=no])
76
77 AC_ARG_ENABLE([profile],
78 [ --enable-profile make a binary for use with gprof profiler],
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([threads],
88 [ --enable-threads use threads for some parallel tasks],
89 [threads=$enableval],
90 [threads=no])
91
92 AC_ARG_ENABLE([gtk],
93 [ --enable-gtk enable GTK+ info/warning dialogs],
94 [gtk=$enableval],
95 [gtk=no])
96
97 AC_ARG_ENABLE([qt4],
98 [ --enable-qt4 enable QT info/warning dialogs],
99 [qt4=$enableval],
100 [qt4=no])
101
102 AC_ARG_WITH([log-level],
103 [AS_HELP_STRING([--with-log-level=NUM],
104 [0, none... 1, errors... 4, everything (default: 3)])],
105 [log_level=$withval],
106 [log_level=3])
107
108
109 if test x$debug = xyes
110 then
111 CFLAGS="$CFLAGS -DDEBUG -Wall -Wno-uninitialized"
112 CXXFLAGS="$CXXFLAGS -DDEBUG -Wall -Wno-uninitialized"
113 else
114 CFLAGS="$CFLAGS -DNDEBUG"
115 CXXFLAGS="$CXXFLAGS -DNDEBUG"
116 fi
117
118 if test x$double_precision = xyes
119 then
120 AC_DEFINE([USE_DOUBLE_PRECISION], 1,
121 [Define to 1 if you want to use doubles instead of floats.])
122 fi
123
124 if test x$profile = xyes
125 then
126 CFLAGS="$CFLAGS -pg"
127 CXXFLAGS="$CXXFLAGS -pg"
128 AC_DEFINE([PROFILING_ENABLED], 1,
129 [Define to 1 if profiling is built in.])
130 fi
131
132 if test x$extra_warnings = xyes
133 then
134 CFLAGS="$CFLAGS -Wextra -Wno-unused-parameter"
135 CXXFLAGS="$CXXFLAGS -Wextra -Wno-unused-parameter"
136 fi
137
138 if test x$threads = xyes
139 then
140 AC_DEFINE([USE_THREADS], 1,
141 [Define to 1 if you want to use threads when applicable.])
142 fi
143
144 if test x$gtk = xyes
145 then
146 AC_DEFINE([USE_GTK], 1,
147 [Define to 1 if you want to use GTK+ info/error dialogs.])
148 elif test x$qt4 = xyes
149 then
150 AC_DEFINE([USE_QT4], 1,
151 [Define to 1 if you want to use QT4 info/error dialogs.])
152 fi
153
154 AC_DEFINE_UNQUOTED([YOINK_LOGLEVEL], [$log_level],
155 [Define to detail level of logging.])
156
157
158 if test "x$prefix" = xNONE
159 then
160 prefix="$ac_default_prefix"
161 fi
162
163 if test x$WIN32 = xyes
164 then
165 DATADIR="data"
166 else
167 eval eval DATADIR="${datadir}/$PACKAGE"
168 fi
169
170 AC_SUBST([DATADIR])
171 AC_DEFINE_UNQUOTED([YOINK_DATADIR], ["$DATADIR"],
172 [Define to path of game asset directory.])
173
174
175 #
176 # Split the version number into components.
177 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
178
179 VERSION_MAJOR=$(echo $VERSION | cut -d. -f1)
180 VERSION_MINOR=$(echo $VERSION | cut -d. -f2)
181 VERSION_REVISION=$(echo $VERSION | cut -d. -f3)
182
183 AC_DEFINE_UNQUOTED([VERSION_MAJOR], [${VERSION_MAJOR:-0}],
184 [Define to major version number component.])
185
186 AC_DEFINE_UNQUOTED([VERSION_MINOR], [${VERSION_MINOR:-0}],
187 [Define to minor version number component.])
188
189 AC_DEFINE_UNQUOTED([VERSION_REVISION], [${VERSION_REVISION:-0}],
190 [Define to revision version number component.])
191
192 if test x$WIN32 = xyes
193 then
194 PVERSION="${VERSION_MAJOR:-0}.${VERSION_MINOR:-0}.${VERSION_REVISION:-0}.0"
195 AC_SUBST([PVERSION])
196 fi
197
198 # these are used in src/yoink.rc
199
200
201 #
202 # Checks for system functions/headers and compiler characteristics.
203 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
204
205 AC_C_STRINGIZE
206 AC_C_INLINE
207
208 AC_TYPE_UINT8_T
209 AC_TYPE_UINT16_T
210 AC_TYPE_UINT32_T
211 AC_TYPE_SIZE_T
212 AC_TYPE_SSIZE_T
213
214 AC_FUNC_ERROR_AT_LINE
215 AC_FUNC_STRTOD
216 AC_CHECK_FUNCS([nanosleep strchr strcspn strrchr strstr])
217
218 AC_HEADER_STDBOOL
219 AC_HEADER_STDC
220 AC_CHECK_HEADERS([stddef.h stdint.h stdlib.h string.h unistd.h])
221
222
223 #
224 # Checks for build dependencies.
225 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
226
227 ##### boost #####
228 website="http://www.boost.org/"
229 BOOST_SMART_PTR
230 BOOST_STRING_ALGO
231 BOOST_BIND
232 BOOST_FUNCTION
233
234 ##### SDL #####
235 website="http://www.libsdl.org/"
236 AM_PATH_SDL([1.2.10],
237 [CFLAGS="$CFLAGS $SDL_CFLAGS"
238 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
239 LIBS="$LIBS $SDL_LIBS"])
240
241 ##### opengl, glu #####
242 website="http://www.mesa3d.org/"
243 AC_CHECK_HEADERS([GL/gl.h GL/glu.h],,
244 [missing=yes
245 echo "***** Missing GL headers ($website) *****"])
246 if test x$WIN32 = xyes
247 then
248 # autoconf library search macro doesn't find opengl32 on windows because it uses
249 # different name hashing, but it links fine; assume it's there
250 LIBS="$LIBS -lglu32 -lopengl32"
251 else
252 AC_SEARCH_LIBS([glEnable], [GL MesaGL],,
253 [missing=yes
254 echo "***** Missing libGL ($website) *****"])
255 AC_SEARCH_LIBS([gluDisk], [GLU MesaGLU],,
256 [missing=yes
257 echo "***** Missing libGLU ($website) *****"])
258 fi
259
260 ##### openal #####
261 website="http://connect.creativelabs.com/openal/"
262 AC_CHECK_HEADERS([AL/al.h AL/alc.h],,
263 [missing=yes
264 echo "***** Missing OpenAL headers ($website) *****"])
265 AC_SEARCH_LIBS([alEnable], [openal OpenAL32],,
266 [missing=yes
267 echo "***** Missing libopenal ($website) *****"])
268
269 ##### libpng #####
270 website="http://www.libpng.org/pub/png/libpng.html"
271 AC_CHECK_HEADERS([png.h],,
272 [missing=yes
273 echo "***** Missing libpng header ($website) *****"])
274 AC_SEARCH_LIBS([png_sig_cmp], [png],,
275 [missing=yes
276 echo "***** Missing libpng ($website) *****"])
277
278 ##### libvorbis #####
279 website="http://www.xiph.org/downloads/"
280 AC_CHECK_HEADERS([vorbis/codec.h vorbis/vorbisfile.h],,
281 [missing=yes
282 echo "***** Missing vorbis headers ($website) *****"])
283 AC_SEARCH_LIBS([ov_open], [vorbisfile],,
284 [missing=yes
285 echo "***** Missing libvorbisfile ($website) *****"])
286
287 ##### liblua #####
288 website="http://www.lua.org/"
289 AC_CHECK_HEADERS([lua.h],,
290 [missing=yes
291 echo "***** Missing lua headers ($website) *****"])
292 AC_SEARCH_LIBS([lua_load], [lua],,
293 [missing=yes
294 echo "***** Missing liblua ($website) *****"])
295
296 if test x$gtk = xyes
297 then
298 ##### GTK+ 2.0 #####
299 website="http://www.gtk.org/"
300 PKG_CHECK_MODULES([GTK], [gtk+-2.0],
301 [LIBS="$LIBS $GTK_LIBS"
302 CFLAGS="$CFLAGS $GTK_CFLAGS"
303 CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"],
304 [missing=yes
305 echo "***** Missing GTK+-2.0 ($website) *****"])
306 fi
307
308 if test x$qt4 = xyes
309 then
310 ##### QT4 #####
311 website="http://qt.nokia.com/"
312 PKG_CHECK_MODULES([QT], [QtGui],
313 [LIBS="$LIBS $QT_LIBS"
314 CFLAGS="$CFLAGS $QT_CFLAGS"
315 CXXFLAGS="$CXXFLAGS $QT_CFLAGS"],
316 [missing=yes
317 echo "***** Missing QT ($website) *****"])
318 fi
319
320 ##### librt (optional) #####
321 AC_SEARCH_LIBS([clock_gettime], [rt],
322 [AC_DEFINE([HAVE_CLOCK_GETTIME], 1,
323 [Define to 1 if you have the 'clock_gettime' function.])])
324
325
326 if test x$missing == xyes
327 then
328 AC_MSG_WARN([You may be missing some dependencies--see messages above.])
329 fi
330
331
332 #
333 # Find the game resources to install.
334 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
335
336 DATA_FILES=$(echo $(cd data && find . -name "*.lua" \
337 -o -name "*.ogg" \
338 -o -name "*.png" \
339 -o -name "yoinkrc"))
340 AC_SUBST([DATA_FILES])
341
342
343 #
344 # Create the build files.
345 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
346
347 AC_CONFIG_FILES([Makefile
348 data/Makefile
349 doc/Makefile
350 doc/yoink.6
351 src/Makefile])
352
353 if test x$WIN32 = xyes
354 then
355 AC_CONFIG_FILES([win32/Makefile win32/mkpackage.sh win32/yoink.nsi])
356 fi
357
358
359 AC_CONFIG_HEADERS([src/config.h])
360
361 AC_OUTPUT
362
363
364 #
365 # Print a friendly little message.
366 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
367
368 echo ""
369 echo " Configuration complete! :-)"
370 echo ""
371 echo " Target: $target"
372 echo " Prefix: $prefix"
373 echo " Data Directory: $DATADIR"
374 echo " Log Level: $log_level"
375 echo " Debug: $debug"
376 echo " Double Precision: $double_precision"
377 echo " Profile: $profile"
378 echo " Extra Warnings: $extra_warnings"
379 echo ""
380 echo " To finish the installation, execute:"
381 echo " make"
382 echo " make install"
383 echo ""
384
This page took 0.046267 seconds and 4 git commands to generate.