]> Dogcows Code - chaz/yoink/blob - configure.ac
new lua scripting for scene loading
[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/YoinkApp.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([developer],
72 [ --enable-developer use all compiler flags developers need],
73 [developer=$enableval],
74 [developer=no])
75
76 AC_ARG_ENABLE([debug],
77 [ --enable-debug include debugging symbols and features],
78 [debug=$enableval],
79 [debug=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_WITH([log-level],
92 [AS_HELP_STRING([--with-log-level=NUM],
93 [0, none... 1, errors... 4, everything (default: 3)])],
94 [log_level=$withval],
95 [log_level=3])
96
97
98 if test x$developer = xyes
99 then
100 debug=yes
101 log_level=4
102
103 if test x$WIN32 != xyes
104 then
105 # i haven't had much success with gprof profiling on win32
106 profile=yes
107 fi
108 fi
109
110 if test x$debug = xyes
111 then
112 CFLAGS="$CFLAGS -Wall -O0 -DDEBUG"
113 CXXFLAGS="$CXXFLAGS -Wall -O0 -DDEBUG"
114 else
115 CFLAGS="$CFLAGS -O2 -DNDEBUG"
116 CXXFLAGS="$CXXFLAGS -O2 -DNDEBUG"
117 fi
118
119 if test x$profile = xyes
120 then
121 CFLAGS="$CFLAGS -pg"
122 CXXFLAGS="$CXXFLAGS -pg"
123 fi
124
125 if test x$extra_warnings = xyes
126 then
127 CFLAGS="$CFLAGS -Wextra -Wno-unused-parameter"
128 CXXFLAGS="$CXXFLAGS -Wextra -Wno-unused-parameter"
129 fi
130
131 AC_DEFINE_UNQUOTED([YOINK_LOGLEVEL], [$log_level],
132 [Define to detail level of logging.])
133
134
135 if test "x$prefix" = xNONE
136 then
137 prefix="$ac_default_prefix"
138 fi
139
140 AC_ARG_WITH([assetdir],
141 [AS_HELP_STRING([--with-assetdir=DIR],
142 [real path to assets (default: $datarootdir/yoink)])],
143 [DATADIR="$withval"],
144 [eval DATADIR="$datarootdir/yoink"])
145
146 if test x$WIN32 = xyes
147 then
148 DATADIR="data"
149 fi
150
151 AC_SUBST([DATADIR])
152 AC_DEFINE_UNQUOTED([YOINK_DATADIR], ["$DATADIR"],
153 [Define to path of game asset directory.])
154
155
156 CONFIGFILES="\$HOME/.yoinkrc:/etc/yoinkrc"
157
158 AC_DEFINE_UNQUOTED([YOINK_CONFIGFILES], ["$CONFIGFILES"],
159 [Define to colon-delimited configuration file paths.])
160
161
162 #
163 # Split the version number into components.
164 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
165
166 VERSION_MAJOR=$(echo $VERSION | cut -d. -f1)
167 VERSION_MINOR=$(echo $VERSION | cut -d. -f2)
168 VERSION_REVISION=$(echo $VERSION | cut -d. -f3)
169
170 AC_DEFINE_UNQUOTED([VERSION_MAJOR], [${VERSION_MAJOR:-0}],
171 [Define to major version number component.])
172
173 AC_DEFINE_UNQUOTED([VERSION_MINOR], [${VERSION_MINOR:-0}],
174 [Define to minor version number component.])
175
176 AC_DEFINE_UNQUOTED([VERSION_REVISION], [${VERSION_REVISION:-0}],
177 [Define to revision version number component.])
178
179 if test x$WIN32 = xyes
180 then
181 PVERSION="${VERSION_MAJOR:-0}.${VERSION_MINOR:-0}.${VERSION_REVISION:-0}.0"
182 AC_SUBST([PVERSION])
183 fi
184
185 # these are used in src/yoink.rc
186
187
188 #
189 # Checks for system functions/headers and compiler characteristics.
190 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
191
192 AC_C_STRINGIZE
193 AC_C_INLINE
194
195 AC_TYPE_UINT8_T
196 AC_TYPE_UINT16_T
197 AC_TYPE_UINT32_T
198 AC_TYPE_SIZE_T
199 AC_TYPE_SSIZE_T
200
201 AC_FUNC_ERROR_AT_LINE
202 AC_FUNC_STRTOD
203 AC_CHECK_FUNCS([nanosleep strchr strcspn strrchr strstr])
204
205 AC_HEADER_STDBOOL
206 AC_HEADER_STDC
207 AC_CHECK_HEADERS([stddef.h stdint.h stdlib.h string.h unistd.h])
208
209
210 #
211 # Checks for build dependencies.
212 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
213
214 ##### boost #####
215 website="http://www.boost.org/"
216 BOOST_SMART_PTR
217 BOOST_STRING_ALGO
218 BOOST_BIND
219 BOOST_FUNCTION
220
221 ##### SDL #####
222 website="http://www.libsdl.org/"
223 AM_PATH_SDL([1.2.10],
224 [CFLAGS="$CFLAGS $SDL_CFLAGS"
225 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
226 LIBS="$LIBS $SDL_LIBS"])
227
228 ##### opengl, glu #####
229 website="http://www.mesa3d.org/"
230 AC_CHECK_HEADERS([GL/gl.h GL/glu.h],,
231 [missing=yes
232 echo "***** Missing GL headers ($website) *****"])
233 if test x$WIN32 == xyes
234 then
235 # autoconf library search macro doesn't find opengl32 on windows because it uses
236 # different name hashing, but it links fine; assume it's there
237 LIBS="$LIBS -lglu32 -lopengl32"
238 else
239 AC_SEARCH_LIBS([glEnable], [GL MesaGL],,
240 [missing=yes
241 echo "***** Missing libGL ($website) *****"])
242 AC_SEARCH_LIBS([gluDisk], [GLU MesaGLU],,
243 [missing=yes
244 echo "***** Missing libGLU ($website) *****"])
245 fi
246
247 ##### openal, alut #####
248 website="http://connect.creativelabs.com/openal/"
249 AC_CHECK_HEADERS([AL/al.h AL/alut.h],,
250 [missing=yes
251 echo "***** Missing OpenAL headers ($website) *****"])
252 AC_SEARCH_LIBS([alEnable], [openal openal32],,
253 [missing=yes
254 echo "***** Missing libopenal ($website) *****"])
255 AC_SEARCH_LIBS([alutInit], [alut],,
256 [missing=yes
257 echo "***** Missing libalut ($website) *****"])
258
259 ##### SDL_image #####
260 website="http://www.libsdl.org/projects/SDL_image/"
261 AC_CHECK_HEADERS([SDL/SDL_image.h],,
262 [missing=yes
263 echo "***** Missing SDL_image header ($website) *****"])
264 AC_SEARCH_LIBS([IMG_Load], [SDL_image],,
265 [missing=yes
266 echo "***** Missing libSDL_image ($website) *****"])
267
268 ##### libvorbis #####
269 website="http://www.xiph.org/downloads/"
270 AC_CHECK_HEADERS([vorbis/codec.h vorbis/vorbisfile.h],,
271 [missing=yes
272 echo "***** Missing vorbis headers ($website) *****"])
273 AC_SEARCH_LIBS([ov_open], [vorbisfile],,
274 [missing=yes
275 echo "***** Missing libvorbisfile ($website) *****"])
276
277 ##### liblua #####
278 website="http://www.lua.org/"
279 AC_CHECK_HEADERS([lua.h],,
280 [missing=yes
281 echo "***** Missing lua headers ($website) *****"])
282 AC_SEARCH_LIBS([lua_load], [lua],,
283 [missing=yes
284 echo "***** Missing liblua ($website) *****"])
285
286 ##### librt (optional) #####
287 AC_SEARCH_LIBS([clock_gettime], [rt],
288 [AC_DEFINE([HAVE_CLOCK_GETTIME], 1,
289 [Define to 1 if you have the 'clock_gettime' function.])])
290
291
292 if test x$missing == xyes
293 then
294 AC_MSG_ERROR([please install missing dependencies (see messages above)])
295 fi
296
297
298 #
299 # Find the data files to install.
300 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
301
302 DATA_FILES=$(echo $(cd data; \
303 find . -name "*.json" \
304 -o -name "*.lua" \
305 -o -name "*.ogg" \
306 -o -name "*.png" \
307 -o -name "*.xm" \
308 -o -name "yoinkrc"))
309 AC_SUBST([DATA_FILES])
310
311
312 #
313 # Create the build files.
314 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
315
316 AC_CONFIG_FILES([Makefile
317 data/Makefile
318 doc/Makefile
319 doc/yoink.6
320 extra/Makefile
321 extra/yoink.spec
322 make-win32-installer.sh
323 src/Makefile])
324
325 AC_CONFIG_HEADERS([src/config.h])
326
327 AC_OUTPUT
328
329
330 #
331 # Print a friendly little message.
332 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
333
334 echo ""
335 echo " Configuration complete! :-)"
336 echo ""
337 echo " Target: $target"
338 echo " Prefix: $prefix"
339 echo " Data Directory: $DATADIR"
340 echo " Log Level: $log_level"
341 echo " Debug: $debug"
342 echo " Profile: $profile"
343 echo " Extra Warnings: $extra_warnings"
344 echo ""
345 echo " To finish the installation, execute:"
346 echo " make"
347 echo " make install"
348 echo ""
349
This page took 0.04543 seconds and 4 git commands to generate.