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