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