Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/configure.ac @ 3423

Last change on this file since 3423 was 3423, checked in by bensch, 19 years ago

orxonox/trunk: merged branches/updater back into the trunk
merged with command: svn merge branches/updater trunk -r 3241:HEAD
resolved conflicts in debug.h in favor of the trunk.

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