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