]> Dogcows Code - chaz/yoink/blob - configure.ac
better build system support for win32
[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 profile=yes
87 extra_warnings=yes
88 log_level=4
89 fi
90
91 if test x$debug = xyes
92 then
93 CFLAGS="$CFLAGS -Wall -O0 -g -DDEBUG"
94 CXXFLAGS="$CXXFLAGS -Wall -O0 -g -DDEBUG"
95 else
96 CFLAGS="$CFLAGS -O2 -DNDEBUG"
97 CXXFLAGS="$CXXFLAGS -O2 -DNDEBUG"
98 fi
99
100 if test x$profile = xyes
101 then
102 CFLAGS="$CFLAGS -pg"
103 CXXFLAGS="$CXXFLAGS -pg"
104 fi
105
106 if test x$extra_warnings = xyes
107 then
108 CFLAGS="$CFLAGS -Wextra"
109 CXXFLAGS="$CXXFLAGS -Wextra"
110 fi
111
112 AC_DEFINE_UNQUOTED([YOINK_LOGLEVEL], [$log_level],
113 [Define to detail level of logging.])
114
115
116
117 if test "x$prefix" = xNONE
118 then
119 prefix="$ac_default_prefix"
120 fi
121
122 AC_ARG_WITH([assetdir],
123 [AS_HELP_STRING([--with-assetdir=DIR],
124 [real path to assets (default: $datarootdir/yoink)])],
125 [DATADIR="$withval"],
126 [eval DATADIR="$datarootdir/yoink"])
127
128 if test x$WIN32 = xyes
129 then
130 DATADIR="data"
131 fi
132
133 AC_SUBST([DATADIR])
134 AC_DEFINE_UNQUOTED([YOINK_DATADIR], ["$DATADIR"],
135 [Define to path of game asset directory.])
136
137
138 CONFIGFILES="\$HOME/.yoinkrc:/etc/yoinkrc"
139
140 AC_DEFINE_UNQUOTED([YOINK_CONFIGFILES], ["$CONFIGFILES"],
141 [Define to colon-delimited configuration file paths.])
142
143
144 #
145 # Checks for typedefs, structures, and compiler characteristics.
146 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
147
148 AC_C_STRINGIZE
149 AC_C_INLINE
150
151 AC_TYPE_UINT8_T
152 AC_TYPE_UINT16_T
153 AC_TYPE_UINT32_T
154 AC_TYPE_SIZE_T
155 AC_TYPE_SSIZE_T
156
157
158 #
159 # Checks for system functions.
160 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
161
162 AC_FUNC_ERROR_AT_LINE
163 AC_FUNC_STRTOD
164 AC_CHECK_FUNCS([nanosleep strchr strcspn strrchr strstr])
165
166
167 #
168 # Checks for header files.
169 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
170
171 AC_HEADER_STDBOOL
172 AC_HEADER_STDC
173 AC_CHECK_HEADERS([stddef.h stdint.h stdlib.h string.h unistd.h])
174
175 BOOST_SMART_PTR
176 BOOST_STRING_ALGO
177 BOOST_BIND
178 BOOST_FUNCTION
179
180 AM_PATH_SDL([1.2.10],
181 [CFLAGS="$CFLAGS $SDL_CFLAGS"
182 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
183 LIBS="$LIBS $SDL_LIBS"])
184
185 AC_CHECK_HEADERS([GL/gl.h GL/glu.h],,
186 [missing="$missing OpenGL"])
187
188 AC_CHECK_HEADERS([AL/al.h AL/alut.h],,
189 [missing="$missing OpenAL"])
190
191 AC_CHECK_HEADERS([SDL/SDL_image.h],,
192 [missing="$missing SDL_image"])
193
194 AC_CHECK_HEADERS([SDL/SDL_sound.h],,
195 [missing="$missing SDL_sound"])
196
197 if test "x$missing" != x
198 then
199 echo "** Required header files from these libraries are missing:"
200 for header in $missing
201 do
202 echo "** $header"
203 done
204 AC_MSG_ERROR([please install missing dependencies])
205 fi
206
207
208 #
209 # Checks for libraries.
210 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
211
212 AC_SEARCH_LIBS([IMG_Load], [SDL_image],,
213 [missing="$missing SDL_image"])
214
215 AC_SEARCH_LIBS([Sound_Init], [SDL_sound],,
216 [missing="$missing SDL_sound"])
217
218 if test x$WIN32 == xyes
219 then
220 # autoconf library search macro doesn't find opengl32 on windows because it uses
221 # different name hashing, but it links fine; assume it's there
222 LIBS="$LIBS -lglu32 -lopengl32"
223 else
224 AC_SEARCH_LIBS([gluPerspective], [GLU MesaGLU],,
225 [missing="$missing GLU"])
226
227 AC_SEARCH_LIBS([glBegin], [GL MesaGL],,
228 [missing="$missing OpenGL"])
229 fi
230
231 AC_SEARCH_LIBS([alGenBuffers], [openal openal32],,
232 [missing="$missing OpenAL"])
233
234 AC_SEARCH_LIBS([alutInit], [alut],,
235 [missing="$missing ALUT"])
236
237 AC_SEARCH_LIBS([clock_gettime], [rt],
238 [AC_DEFINE([HAVE_CLOCK_GETTIME], 1,
239 [Define to 1 if you have the 'clock_gettime' function.])])
240
241 if test "x$missing" != x
242 then
243 echo "** One or more required libraries are missing:"
244 for library in $missing
245 do
246 echo "** $library"
247 done
248 AC_MSG_ERROR([please install missing dependencies])
249 fi
250
251
252 #
253 # Find the data files to install.
254 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
255
256 DATA_FILES=$(echo $(cd data; \
257 find . -name "*.json" \
258 -o -name "*.ogg" \
259 -o -name "*.png" \
260 -o -name "*.xm" \
261 -o -name "yoinkrc"))
262 AC_SUBST([DATA_FILES])
263
264
265 #
266 # Create the build files.
267 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
268
269 AC_CONFIG_FILES([Makefile
270 data/Makefile
271 doc/Makefile
272 doc/yoink.6
273 extra/Makefile
274 extra/yoink.spec
275 src/Makefile
276 yajl/Makefile])
277
278 AC_CONFIG_HEADERS([src/config.h])
279
280 AC_OUTPUT
281
282
283 #
284 # Print a friendly little message.
285 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
286
287 echo ""
288 echo " Configuration complete! :-)"
289 echo ""
290 echo " Target: $target"
291 echo " Prefix: $prefix"
292 echo " Data Directory: $DATADIR"
293 echo " Log Level: $log_level"
294 echo " Debug: $debug"
295 echo " Profile: $profile"
296 echo " Extra Warnings: $extra_warnings"
297 echo ""
298 echo " To finish the installation, execute:"
299 echo " make"
300 echo " make install"
301 echo ""
302
This page took 0.047317 seconds and 4 git commands to generate.