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