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