1 | # -*- Autoconf -*- |
---|
2 | # Process this file with autoconf to produce a configure script. |
---|
3 | |
---|
4 | AC_PREREQ(2.56) |
---|
5 | AC_INIT(orxonox, 0.2.1-pre-alpha, [orxonox-dev at mail.datacore.ch]) |
---|
6 | |
---|
7 | # Detect the canonical host and target build environment. |
---|
8 | AC_CANONICAL_BUILD |
---|
9 | AC_CANONICAL_HOST |
---|
10 | AC_CANONICAL_TARGET |
---|
11 | |
---|
12 | |
---|
13 | AM_INIT_AUTOMAKE |
---|
14 | |
---|
15 | AC_CONFIG_SRCDIR([.]) |
---|
16 | AC_CONFIG_HEADER([config.h]) |
---|
17 | |
---|
18 | |
---|
19 | # Checks for programs. |
---|
20 | AC_PROG_CXX |
---|
21 | AC_HEADER_STDC |
---|
22 | |
---|
23 | ### CHECKING OPTIONAT ARGUMENTS |
---|
24 | ## DEBUG-statement |
---|
25 | DEBUG=no |
---|
26 | AC_MSG_CHECKING([if DEBUG-mode should be enabled]) |
---|
27 | AC_ARG_ENABLE([debug], |
---|
28 | AC_HELP_STRING( [--enable-debug], [compiles in debug mode. Lots of debug info about the game.]), |
---|
29 | DEBUG=$enableval) |
---|
30 | |
---|
31 | if test "$DEBUG" = "no"; then |
---|
32 | echo "no" |
---|
33 | echo " -> Setting debuglevel to 1. Like this you can still see errors." |
---|
34 | DEBUG=1 |
---|
35 | elif test "$DEBUG" = yes; then |
---|
36 | echo "yes" |
---|
37 | echo " -> Setting debuglevel to 3. HARD DEBUG MODE!!." |
---|
38 | DEBUG=3 |
---|
39 | else |
---|
40 | echo "yes set to $DEBUG" |
---|
41 | fi |
---|
42 | AC_DEFINE_UNQUOTED(DEBUG, $DEBUG, [in which debug mode we are]) |
---|
43 | |
---|
44 | AC_SUBST(DEBUG) |
---|
45 | |
---|
46 | ## GTK-disabled |
---|
47 | AC_MSG_CHECKING([if gtk should be enabled]) |
---|
48 | AC_ARG_WITH([gtk], |
---|
49 | AC_HELP_STRING( [--without-gtk], |
---|
50 | [Prevents GTK from being loaded]), [def_gtk=no], [def_gtk=yes]) |
---|
51 | if test "$def_gtk" = yes; then |
---|
52 | echo "yes" |
---|
53 | fi |
---|
54 | if test "$def_gtk" = no; then |
---|
55 | echo "no" |
---|
56 | fi |
---|
57 | |
---|
58 | ## libCurl disabled? |
---|
59 | AC_MSG_CHECKING([if libcURL should be enabled]) |
---|
60 | AC_ARG_WITH([curl], |
---|
61 | AC_HELP_STRING( [--without-curl], |
---|
62 | [Prevents libcURL from being loaded]), [def_curl=no], [def_curl=yes]) |
---|
63 | if test "$def_curl" = yes; then |
---|
64 | echo "yes" |
---|
65 | fi |
---|
66 | if test "$def_curl" = no; then |
---|
67 | echo "no" |
---|
68 | fi |
---|
69 | |
---|
70 | ### SDL_image-disable |
---|
71 | def_sdl_image=yes |
---|
72 | AC_MSG_CHECKING([if SDL_image should be enabled]) |
---|
73 | AC_ARG_WITH([sdl_image], |
---|
74 | AC_HELP_STRING( [--without-sdl-image], |
---|
75 | [Prevents SDL_image from being loaded]), [def_sdl_image=no]) |
---|
76 | if test "$def_sdl_image" = yes; then |
---|
77 | echo "yes" |
---|
78 | fi |
---|
79 | if test "$def_sdl_image" = no; then |
---|
80 | echo "no" |
---|
81 | fi |
---|
82 | |
---|
83 | |
---|
84 | ## PROGRAMM CHECKING |
---|
85 | # checking for Doxygen |
---|
86 | AC_PATH_PROG(DOXYGEN, doxygen) |
---|
87 | AM_CONDITIONAL(DOXYGEN, test $DOXYGEN) |
---|
88 | |
---|
89 | ### CHECKING FOR SYSTEM ### |
---|
90 | |
---|
91 | AC_MSG_CHECKING([for System]) |
---|
92 | ## checking for openGL-environment and other sys-specific parameters |
---|
93 | case "$target" in |
---|
94 | ### WINDOWS ### |
---|
95 | *-*-mingw32*) |
---|
96 | echo "mingw-WINDOWS detected" |
---|
97 | |
---|
98 | mingw="yes" |
---|
99 | MSBITFIELDS="-mms-bitfields" |
---|
100 | MWINDOWS="-mwindows" |
---|
101 | |
---|
102 | # checking gl header |
---|
103 | #done before loop |
---|
104 | |
---|
105 | # checking gl header |
---|
106 | AC_CHECK_HEADERS(GL/gl.h ,, |
---|
107 | [AC_MSG_ERROR([cannot find opengl headers]) ]) |
---|
108 | # checking for Windows openGl library |
---|
109 | AC_CHECK_LIB([opengl32], [main], FOUND_opengl32=yes, "gl/gl.h") |
---|
110 | if test "$FOUND_opengl32" = "yes" ; then |
---|
111 | LIBS="$LIBS -lopengl32" |
---|
112 | else |
---|
113 | echo "------------------" |
---|
114 | echo "opengl not found." |
---|
115 | echo "please install the opengl package which can be found at http://www.opengl.org" |
---|
116 | echo "------------------" |
---|
117 | exit -1 |
---|
118 | fi |
---|
119 | |
---|
120 | # cheking for GLU-header |
---|
121 | AC_CHECK_HEADERS(GL/glu.h ,, |
---|
122 | [AC_MSG_ERROR([cannot find opengl headers]) ]) |
---|
123 | |
---|
124 | # checking for libGLU |
---|
125 | AC_CHECK_LIB([glu32], [main], FOUND_glu32=yes) |
---|
126 | if test "$FOUND_glu32" = "yes" ; then |
---|
127 | LIBS="$LIBS -lGLU32" |
---|
128 | else |
---|
129 | echo "------------------" |
---|
130 | echo "GLU library not found." |
---|
131 | echo "please install the GLU library, that should come with openGL, which can be found at http://www.opengl.org" |
---|
132 | echo "------------------" |
---|
133 | exit -1 |
---|
134 | fi |
---|
135 | |
---|
136 | # checking for mingw32 |
---|
137 | AC_CHECK_LIB([mingw32], [main], FOUND_mingw32=yes) |
---|
138 | if test $FOUND_mingw32 = "yes"; then |
---|
139 | LIBS="$LIBS -lmingw32" |
---|
140 | fi |
---|
141 | # checking for SDL-headers |
---|
142 | AC_CHECK_HEADERS(SDL/SDL.h ,, |
---|
143 | [AC_MSG_ERROR([cannot find SDL headers]) ]) |
---|
144 | |
---|
145 | #checking for libSDL |
---|
146 | AC_CHECK_LIB([sdlmain], [main], FOUND_sdlmain=yes) |
---|
147 | if test "$FOUND_sdlmain" = "yes" ; then |
---|
148 | LIBS="$LIBS -lsdlmain" |
---|
149 | else |
---|
150 | echo "------------------" |
---|
151 | echo "SDL library not found." |
---|
152 | echo "please install the SDL library, which can be found at http://www.libsdl.org" |
---|
153 | echo "------------------" |
---|
154 | exit 1 |
---|
155 | fi |
---|
156 | AC_CHECK_LIB([sdl], [main], FOUND_sdl=yes) |
---|
157 | if test "$FOUND_sdl" = "yes" ; then |
---|
158 | LIBS="$LIBS -lsdl" |
---|
159 | else |
---|
160 | echo "------------------" |
---|
161 | echo "SDL library not found." |
---|
162 | echo "please install the SDL library, which can be found at http://www.libsdl.org" |
---|
163 | echo "------------------" |
---|
164 | exit -1 |
---|
165 | fi |
---|
166 | |
---|
167 | ;; |
---|
168 | |
---|
169 | ### LINUX ### |
---|
170 | *-*-linux*) |
---|
171 | echo "Linux detected" |
---|
172 | |
---|
173 | Linux="yes" |
---|
174 | |
---|
175 | CPPFLAGS="-I/usr/X11R6/include" |
---|
176 | LDFLAGS="-L/usr/Mesa-6.0.1/lib -L/usr/X11R6/lib $LDFLAGS" |
---|
177 | # checking gl header |
---|
178 | AC_CHECK_HEADERS(GL/gl.h ,, |
---|
179 | [AC_MSG_ERROR([cannot find opengl headers]) ]) |
---|
180 | |
---|
181 | # checking for Unix GL |
---|
182 | AC_CHECK_LIB([GL], [main], FOUND_GL=yes) |
---|
183 | if test "$FOUND_GL" = "yes" ; then |
---|
184 | LIBS="$LIBS -lGL" |
---|
185 | else |
---|
186 | echo "------------------" |
---|
187 | echo "opengl not found." |
---|
188 | echo "please install the opengl package which can be found at http://www.opengl.org" |
---|
189 | echo "------------------" |
---|
190 | exit -1 |
---|
191 | fi |
---|
192 | |
---|
193 | # cheking for GLU-header |
---|
194 | AC_CHECK_HEADERS(GL/glu.h ,, |
---|
195 | [AC_MSG_ERROR([cannot find opengl headers]) ]) |
---|
196 | |
---|
197 | AC_CHECK_LIB([GLU], [gluProject], FOUND_GLU=yes) |
---|
198 | if test "$FOUND_GLU" = "yes" ; then |
---|
199 | LIBS="$LIBS -lGLU" |
---|
200 | else |
---|
201 | echo "------------------" |
---|
202 | echo "GLU library not found." |
---|
203 | echo "please install the GLU library, that should come with openGL, which can be found at http://www.opengl.org" |
---|
204 | echo "------------------" |
---|
205 | exit -1 |
---|
206 | fi |
---|
207 | |
---|
208 | # checking for SDL-headers |
---|
209 | AC_CHECK_HEADERS(SDL/SDL.h ,, |
---|
210 | [AC_MSG_ERROR([cannot find SDL headers]) ]) |
---|
211 | |
---|
212 | # checking for SDL-lib |
---|
213 | AC_CHECK_LIB([SDL], [main], FOUND_SDL=yes) |
---|
214 | if test "$FOUND_SDL" = "yes" ; then |
---|
215 | LIBS="$LIBS -lSDL" |
---|
216 | else |
---|
217 | echo "------------------" |
---|
218 | echo "SDL library not found." |
---|
219 | echo "please install the SDL library, which can be found at http://www.libsdl.org" |
---|
220 | echo "------------------" |
---|
221 | exit -1 |
---|
222 | fi |
---|
223 | |
---|
224 | |
---|
225 | ## checking for SDL |
---|
226 | # SDL_VERSION=1.2.7 |
---|
227 | # AM_PATH_SDL($SDL_VERSION, |
---|
228 | # :, |
---|
229 | # AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]) |
---|
230 | # ) |
---|
231 | # CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" |
---|
232 | # LIBS="$LIBS $SDL_LIBS" |
---|
233 | ;; |
---|
234 | |
---|
235 | ### OS X ### |
---|
236 | *darwin*) |
---|
237 | echo "OS X detected" |
---|
238 | |
---|
239 | osX="yes" |
---|
240 | |
---|
241 | CPPFLAGS="-I/sw/include $CPPFLAGS" |
---|
242 | # checking gl header |
---|
243 | AC_CHECK_HEADERS(OpenGL/gl.h ,, |
---|
244 | [AC_MSG_ERROR([cannot find opengl headers]) ]) |
---|
245 | # cheking for GLU-header |
---|
246 | AC_CHECK_HEADERS(OpenGL/glu.h ,, |
---|
247 | [AC_MSG_ERROR([cannot find opengl headers]) ]) |
---|
248 | |
---|
249 | LIBS="$LIBS -framework OpenGL" |
---|
250 | |
---|
251 | # checking for SDL-headers |
---|
252 | # AC_CHECK_HEADERS(SDL/SDL.h ,, |
---|
253 | # [AC_MSG_ERROR([cannot find SDL headers]) ]) |
---|
254 | |
---|
255 | ## checking for SDL |
---|
256 | # SDL_VERSION=1.2.7 |
---|
257 | # AM_PATH_SDL($SDL_VERSION, |
---|
258 | # :, |
---|
259 | # AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]) |
---|
260 | # ) |
---|
261 | |
---|
262 | SDL_CFLAGS=`sdl-config --cflags` |
---|
263 | SDL_LIBS=`sdl-config --libs` |
---|
264 | CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" |
---|
265 | LIBS="$LIBS $SDL_LIBS" |
---|
266 | |
---|
267 | ;; |
---|
268 | |
---|
269 | *) |
---|
270 | ;; |
---|
271 | esac |
---|
272 | |
---|
273 | AC_SUBST(MSBITFIELDS) |
---|
274 | |
---|
275 | ## check for SDL_Image |
---|
276 | if test "$def_sdl_image" = "yes"; then |
---|
277 | # checking for SDL_image-headers |
---|
278 | AC_CHECK_HEADERS(SDL/SDL_image.h ,, |
---|
279 | [echo "sdl_image not found. falling back to other options"; def_sdl_image=no ]) |
---|
280 | fi |
---|
281 | if test "$def_sdl_image" = "yes"; then |
---|
282 | # checking for SDL_image-lib |
---|
283 | AC_CHECK_LIB([SDL_image], [main], FOUND_SDL_image=yes) |
---|
284 | if test "$FOUND_SDL_image" = "yes" ; then |
---|
285 | LIBS="$LIBS -lSDL_image" |
---|
286 | else |
---|
287 | echo "------------------" |
---|
288 | echo "SDL_image library not found." |
---|
289 | echo "please install the SDL_image library, which can be found at http://www.libsdl.org/projects/SDL_image/" |
---|
290 | echo "------------------" |
---|
291 | exit -1 |
---|
292 | fi |
---|
293 | fi |
---|
294 | |
---|
295 | |
---|
296 | if test "$def_sdl_image" = "no"; then |
---|
297 | ## checking for libjpeg |
---|
298 | AC_CHECK_HEADERS(jpeglib.h ,jpegHeader="yes", |
---|
299 | jpegHeader="no") |
---|
300 | if test $jpegHeader = "no"; then |
---|
301 | echo " not including jpeg." |
---|
302 | else |
---|
303 | AC_CHECK_LIB([jpeg], [main], FOUND_jpeg=yes) |
---|
304 | if test "$FOUND_jpeg" = "yes" ; then |
---|
305 | LIBS="$LIBS -ljpeg" |
---|
306 | else |
---|
307 | echo "------------------" |
---|
308 | echo "jpeg library not found." |
---|
309 | echo "please install the jpeg library from the Independent JPEG Group, which can be found at http://www.ijg.org" |
---|
310 | echo "------------------" |
---|
311 | exit -1 |
---|
312 | fi |
---|
313 | fi |
---|
314 | |
---|
315 | ## checking for libpng |
---|
316 | AC_CHECK_HEADERS(png.h ,pngHeader="yes", |
---|
317 | pngHeader="no") |
---|
318 | if test $pngHeader = "no"; then |
---|
319 | echo " not including png." |
---|
320 | else |
---|
321 | AC_CHECK_LIB([png], [main], FOUND_png=yes) |
---|
322 | if test "$FOUND_png" = "yes" ; then |
---|
323 | LIBS="$LIBS -lpng" |
---|
324 | else |
---|
325 | echo "------------------" |
---|
326 | echo "png library not found." |
---|
327 | echo "please install the png library, which can be found at http://libpng.org/pub/png/libpng.html" |
---|
328 | echo "------------------" |
---|
329 | exit -1 |
---|
330 | fi |
---|
331 | fi |
---|
332 | fi |
---|
333 | |
---|
334 | ## checking for GTK |
---|
335 | if test "$def_gtk" = yes; then |
---|
336 | |
---|
337 | #PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.0.3 gthread-2.0 >= 2.0.3, have_gtk2=yes, have_gtk2=no) |
---|
338 | AC_MSG_CHECKING([for gtk2.0]) |
---|
339 | if `pkg-config --exists gtk+-2.0`; then |
---|
340 | echo "yes" |
---|
341 | have_gtk2=yes |
---|
342 | GTK2_LIBS=`pkg-config --libs gtk+-2.0` |
---|
343 | GTK2_CFLAGS=`pkg-config --cflags gtk+-2.0` |
---|
344 | AC_DEFINE_UNQUOTED(HAVE_GTK2, 1, [if we have GTK2]) |
---|
345 | else |
---|
346 | echo "no" |
---|
347 | fi |
---|
348 | |
---|
349 | fi |
---|
350 | AC_SUBST(GTK2_LIBS) |
---|
351 | AC_SUBST(GTK2_CFLAGS) |
---|
352 | AM_CONDITIONAL(HAVE_GTK2, test x$have_gtk2 = xyes) |
---|
353 | |
---|
354 | ## checking for libcURL |
---|
355 | if test "$def_curl" = yes; then |
---|
356 | |
---|
357 | AC_CHECK_HEADERS([curl/curl.h], curlHeader="yes", curlHeader="no") |
---|
358 | AC_CHECK_LIB([curl], [main], [FOUND_curl=yes]) |
---|
359 | if test x$curlHeader = xyes & test x$FOUND_curl = xyes ; then |
---|
360 | have_curl=yes |
---|
361 | CURL_LIBS=`curl-config --libs` |
---|
362 | CURLCFLAGS=`curl-config --cflags` |
---|
363 | AC_DEFINE_UNQUOTED(HAVE_CURL, 1, [if we have CURL]) |
---|
364 | else |
---|
365 | have_curl=no |
---|
366 | fi |
---|
367 | |
---|
368 | fi |
---|
369 | AC_SUBST(CURL_LIBS) |
---|
370 | AC_SUBST(CURL_CFLAGS) |
---|
371 | AM_CONDITIONAL(HAVE_CURL, test x$have_curl = xyes) |
---|
372 | |
---|
373 | |
---|
374 | #checking for pthread libs |
---|
375 | # AC_CHECK_LIB([pthread], [main], FOUND_pthread=yes) |
---|
376 | # if test "$FOUND_pthread" = "yes" ; then |
---|
377 | # LIBS="$LIBS -lpthread" |
---|
378 | # fi |
---|
379 | |
---|
380 | |
---|
381 | # FIXME: Replace `main' with a function in `-lm': |
---|
382 | AC_CHECK_LIB([m], [main]) |
---|
383 | |
---|
384 | |
---|
385 | # Checks for header files. |
---|
386 | AC_HEADER_STDC |
---|
387 | AC_CHECK_HEADERS([stdlib.h string.h]) |
---|
388 | |
---|
389 | # Checks for typedefs, structures, and compiler characteristics. |
---|
390 | AC_HEADER_STDBOOL |
---|
391 | |
---|
392 | # Checks for library functions. |
---|
393 | AC_FUNC_MALLOC |
---|
394 | AC_CHECK_FUNCS([bzero sqrt]) |
---|
395 | |
---|
396 | AC_CONFIG_FILES([Makefile |
---|
397 | src/console/Makefile |
---|
398 | src/gui/Makefile |
---|
399 | src/Makefile |
---|
400 | src/importer/Makefile]) |
---|
401 | AC_OUTPUT |
---|