Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: safer compile support

File size: 17.2 KB
Line 
1##########################################################################
2#   orxonox - the future of 3D-vertical-scrollers                        #
3#                                                                        #
4#   Copyright (C) 2004 orx                                               #
5#                                                                        #
6#   This program is free software; you can redistribute it and/or modify #
7#   it under the terms of the GNU General Public License as published by #
8#   the Free Software Foundation; either version 2, or (at your option)  #
9#   any later version.                                                   #
10#                                                                        #
11#   ### File Specific:                                                   #
12#   main-programmer: Benjamin Grauer                                     #
13#   co-programmer: ...                                                   #
14#                                                                        #
15#   This is the main configuration File of autoconf.                     #
16#   Please edit this file only, if you exactly know what you are doing.  #
17#   It is quite fragile, and compiling orxonox on different Platforms    #
18#   is only guarantied, if build with the right config.                  #
19##########################################################################
20
21#########################
22## AUTOCONF INIT PHASE ##
23#########################
24AC_PREREQ(2.56)
25AC_INIT(orxonox, 0.2.3-pre-alpha, [orxonox-dev at mail.datacore.ch])
26
27## Detect the canonical host and target build environment.
28AC_CANONICAL_BUILD
29AC_CANONICAL_HOST
30AC_CANONICAL_TARGET
31
32AM_INIT_AUTOMAKE
33
34AC_CONFIG_SRCDIR([.])
35AC_CONFIG_HEADER([config.h])
36
37#########################
38## Checks for programs ##
39#########################
40AC_PROG_CXX
41AC_PROG_RANLIB
42AC_HEADER_STDC
43
44##################################
45## CHECKING  OPTIONAL ARGUMENTS ##
46##################################
47
48#-----------------#
49# DEBUG-statement #
50#-----------------#
51DEBUG=no
52AC_MSG_CHECKING([if DEBUG-mode should be enabled])
53AC_ARG_ENABLE([debug],
54        AC_HELP_STRING( [--enable-debug], [compiles in debug mode. Lots of debug info about the game.]),
55         DEBUG=$enableval)
56
57if test x$DEBUG = xno; then
58        echo "no"
59        echo " -> Setting debuglevel to 4. (orxonox is still in Development. It really is needed."
60        DEBUG=4
61elif test x$DEBUG = xyes; then
62        echo "yes"
63        echo " -> Setting debuglevel to 4. HARD DEBUG MODE!!."
64        DEBUG=4
65else
66        echo "yes: setting debuglevel to to $DEBUG"
67fi
68        AC_DEFINE_UNQUOTED(DEBUG, $DEBUG, [in which debug mode we are])
69
70AC_SUBST(DEBUG)
71
72#---------------#
73# Modular Debug #
74#---------------#
75MODULAR_DEBUG=yes
76AC_MSG_CHECKING([if Modular-DEBUG-mode should be ebabled])
77AC_ARG_ENABLE([modular-debug],
78        AC_HELP_STRING( [--disable-modular-debug], [compiles in modular-debug mode, that logs differently on the many modules of orxonox.]),
79         MODULAR_DEBUG=$enableval)
80
81if test x$MODULAR_DEBUG = xno; then
82        echo "no"
83elif test x$MODULAR_DEBUG = xyes; then
84        echo "yes"
85        AC_DEFINE_UNQUOTED(MODULAR_DEBUG, 1, [if Modular-DUBUG mode is enabled])
86fi
87
88#--------------#
89# GTK-disabled #
90#--------------#
91AC_MSG_CHECKING([if gtk should be enabled])
92AC_ARG_WITH([gtk],
93        AC_HELP_STRING( [--without-gtk],
94        [Prevents GTK from being loaded]), [def_gtk=no], [def_gtk=yes])
95if test x$def_gtk = xyes; then
96  echo "yes"
97fi
98if test x$def_gtk = xno; then
99  echo "no"
100fi
101
102#------------------#
103# libCurl-disabled #
104#------------------#
105AC_MSG_CHECKING([if libcURL should be enabled])
106AC_ARG_WITH([curl],
107        AC_HELP_STRING( [--without-curl],
108        [Prevents libcURL from being loaded]), [def_curl=no], [def_curl=yes])
109if test x$def_curl = xyes; then
110  echo "yes"
111fi
112if test x$def_curl = xno; then
113  echo "no"
114fi
115
116#-------------------#
117# SubProject-enable #
118#-------------------#
119def_sub_projects=no
120AC_MSG_CHECKING([if the SubProjects should be built])
121AC_ARG_ENABLE([sub-projects],
122        AC_HELP_STRING( [--enable-sub-projects],
123        [also builds the subProjects while make from srcdir]), [def_sub_projects=yes])
124if test x$def_sub_projects = xyes; then
125  echo "yes"
126fi
127if test x$def_sub_projects = xno; then
128  echo "no"
129fi
130AM_CONDITIONAL(SUB_PROJECTS, test x$def_sub_projects = xyes)
131
132#-------------------#
133# Profiling Enabled #
134#-------------------#
135def_profiling=no
136AC_MSG_CHECKING([if Profiling should be enabled])
137AC_ARG_ENABLE([profile],
138        AC_HELP_STRING( [--enable-profile],
139        [builds orxonox with profiling support]), [def_profiling=yes])
140if test x$def_profiling = xyes; then
141  echo "yes"
142  CXXFLAGS="$CXXFLAGS -pg"
143fi
144if test x$def_profiling = xno; then
145  echo "no"
146fi
147
148#----------------#
149# efence Enabled #
150#----------------#
151def_efence=no
152AC_MSG_CHECKING([if efence should be enabled])
153AC_ARG_ENABLE([efence],
154        AC_HELP_STRING( [--enable-efence],
155        [builds orxonox with efence support]), [def_efence=yes])
156if test x$def_efence = xyes; then
157  echo "yes"
158fi
159if test x$def_efence = xno; then
160  echo "no"
161fi
162
163#----------------------#
164# Documentation-enable #
165#----------------------#
166def_documentation=no
167AC_MSG_CHECKING([if the Documentation should be build by default])
168AC_ARG_ENABLE([documentation],
169        AC_HELP_STRING( [--enable-documentation],
170        [also builds the sDocumentation while make from srcdir]), [def_documentation=yes])
171if test x$def_documentation = xyes; then
172  echo "yes"
173fi
174if test x$def_documentation = xno; then
175  echo "no"
176fi
177AM_CONDITIONAL(DOCUMENTATION, test x$def_documentation = xyes)
178#######################
179## PROGRAMM CHECKING ##
180## 3. party Programs ##
181#######################
182
183#----------------------#
184# checking for Doxygen #
185#----------------------#
186AC_PATH_PROG(DOXYGEN, doxygen)
187AM_CONDITIONAL(DOXYGEN, test $DOXYGEN)
188
189#--------------------#
190# checking for gprof #
191#--------------------#
192AC_PATH_PROG(GPROF, gprof)
193
194#-------------------------#
195# checking for pkg-config #
196#-------------------------#
197if test x$def_gtk = xyes; then
198 AC_PATH_PROG(PKG_CONFIG, pkg-config)
199fi
200
201
202#########################
203## CHECKING FOR SYSTEM ##
204#########################
205## here the system is checked, and openGL is included
206## also checking for SDL on differen Systems
207
208AC_MSG_CHECKING([for System])
209## checking for openGL-environment and other sys-specific parameters
210case "$target" in
211#---------#
212# WINDOWS #
213#---------#
214  *-*-mingw32*)
215echo "mingw-WINDOWS detected"
216
217CPPFLAGS="-I/usr/include -I/mingw/include"
218
219    mingw="yes"
220    MSBITFIELDS="-mms-bitfields"
221    MWINDOWS="-mwindows"
222
223# checking gl header
224        #done before loop
225
226# checking gl header
227   AC_CHECK_HEADERS(GL/gl.h ,,
228      [AC_MSG_ERROR([cannot find opengl headers]) ])
229#   checking for Windows openGl library
230    AC_CHECK_LIB([opengl32], [main], FOUND_opengl32=yes, "gl/gl.h")
231    if test x$FOUND_opengl32 = xyes ; then
232        LIBS="$LIBS -lopengl32"
233    else
234         echo "------------------"
235         echo "opengl not found."
236         echo "please install the opengl package which can be found at http://www.opengl.org"
237         echo "------------------"
238         exit -1
239    fi
240
241# cheking for GLU-header
242    AC_CHECK_HEADERS([GL/glu.h] ,,
243      [AC_MSG_ERROR([cannot find opengl headers]) ])
244
245# checking for libGLU
246    AC_CHECK_LIB([glu32], [main], FOUND_glu32=yes)
247    if test x$FOUND_glu32 = xyes ; then
248        LIBS="$LIBS -lGLU32"
249    else
250         echo "------------------"
251         echo "GLU library not found."
252         echo "please install the GLU library, that should come with openGL, which can be found at http://www.opengl.org"
253         echo "------------------"
254         exit -1
255    fi
256
257# checking for mingw32
258    AC_CHECK_LIB([mingw32], [main], FOUND_mingw32=yes)
259    if test x$FOUND_mingw32 = xyes; then
260        LIBS="$LIBS -lmingw32"
261    fi
262# checking for SDL-headers
263    AC_CHECK_HEADERS([SDL/SDL.h] ,,
264      [AC_MSG_ERROR([cannot find SDL headers]) ])
265
266#checking for libSDL
267    AC_CHECK_LIB([sdlmain], [main], FOUND_sdlmain=yes)
268    if test x$FOUND_sdlmain = xyes ; then
269       LIBS="$LIBS -lsdlmain"
270    else
271        echo "------------------"
272        echo "SDL library not found."
273        echo "please install the SDL library, which can be found at http://www.libsdl.org"
274        echo "------------------"
275        exit 1
276    fi
277    AC_CHECK_LIB([sdl], [main], FOUND_sdl=yes)
278    if test x$FOUND_sdl = xyes ; then
279       LIBS="$LIBS -lsdl"
280    else
281        echo "------------------"
282        echo "SDL library not found."
283        echo "please install the SDL library, which can be found at http://www.libsdl.org"
284        echo "------------------"
285        exit -1
286    fi
287
288    ;;
289#-------#
290# LINUX #
291#-------#
292 *-*-linux*)
293echo "Linux detected"
294
295 Linux="yes"
296
297CPPFLAGS="-I/usr/X11R6/include -I/usr/include"
298LDFLAGS="-L/usr/lib/opengl/xorg-x11/lib -L/usr/Mesa-6.0.1/lib -L/usr/X11R6/lib $LDFLAGS"
299# checking gl header
300   AC_CHECK_HEADERS([GL/gl.h] ,,
301      [AC_MSG_ERROR([cannot find opengl headers]) ])
302
303#  checking for Unix GL
304   AC_CHECK_LIB([GL], [glLoadIdentity], FOUND_GL=yes)
305   if test x$FOUND_GL = xyes ; then
306     LIBS="$LIBS -lGL"
307   else
308         echo "------------------"
309         echo "opengl not found."
310         echo "please install the opengl package which can be found at http://www.opengl.org"
311         echo "------------------"
312         exit -1
313   fi
314
315# cheking for GLU-header
316    AC_CHECK_HEADERS([GL/glu.h] ,,
317      [AC_MSG_ERROR([cannot find opengl headers]) ])
318
319    AC_CHECK_LIB([GLU], [gluProject], FOUND_GLU=yes)
320    if test x$FOUND_GLU = xyes ; then
321      LIBS="$LIBS -lGLU"
322    else
323         echo "------------------"
324         echo "GLU library not found."
325         echo "please install the GLU library, that should come with openGL, which can be found at http://www.opengl.org"
326         echo "------------------"
327         exit -1
328    fi
329
330# checking for SDL-headers
331    AC_CHECK_HEADERS([SDL/SDL.h] ,,
332      [AC_MSG_ERROR([cannot find SDL headers]) ])
333
334# checking for SDL-lib
335    AC_CHECK_LIB([SDL], [main], FOUND_SDL=yes)
336     if test x$FOUND_SDL = xyes ; then
337       LIBS="$LIBS -lSDL"
338     else
339        echo "------------------"
340        echo "SDL library not found."
341        echo "please install the SDL library, which can be found at http://www.libsdl.org"
342        echo "------------------"
343        exit -1
344     fi
345
346
347## checking for SDL
348#    SDL_VERSION=1.2.7
349#    AM_PATH_SDL($SDL_VERSION,
350#      :,
351#      AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
352#      )
353#    CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
354#    LIBS="$LIBS $SDL_LIBS"
355    ;;
356#-----------#
357# MAC -OS X #
358#-----------#
359 *darwin*)
360 echo "OS X detected"
361
362 osX="yes"
363
364 CPPFLAGS="-I/sw/include -I/sw/include $CPPFLAGS"
365# checking gl header
366   AC_CHECK_HEADERS([OpenGL/gl.h] ,,
367      [AC_MSG_ERROR([cannot find opengl headers]) ])
368# cheking for GLU-header
369    AC_CHECK_HEADERS([OpenGL/glu.h] ,,
370      [AC_MSG_ERROR([cannot find opengl headers]) ])
371
372   LIBS="$LIBS -framework OpenGL"
373
374
375## SDL-check
376       SDL_CFLAGS=`sdl-config --cflags`
377       SDL_LIBS=`sdl-config --libs`
378       CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
379       LIBS="$LIBS $SDL_LIBS"
380
381
382# checking for SDL-headers
383#    AC_CHECK_HEADERS(SDL/SDL.h ,,
384#      [AC_MSG_ERROR([cannot find SDL headers]) ])
385
386## checking for SDL
387#    SDL_VERSION=1.2.7
388#    AM_PATH_SDL($SDL_VERSION,
389#      :,
390#      AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
391#      )
392
393
394    ;;
395
396  *)
397    ;;
398esac
399
400AC_SUBST(MSBITFIELDS)
401
402###################################
403## CHECKING FOR HEADERS AND LIBS ##
404###################################
405
406#--------#
407# openAL #
408#--------#
409# checking for openAL-headers
410  AC_CHECK_HEADERS([AL/al.h] ,,
411      [AC_MSG_ERROR([cannot find openAL header.])])
412# checking for openAL-lib
413  AC_CHECK_LIB([openal], [main], [FOUND_openal=yes])
414     if test x$FOUND_openal = xyes ; then
415       LIBS="$LIBS -lopenal"
416     else
417        echo "------------------"
418        echo "openal library not found."
419        echo "please install the openal library, which can be found at http://www.openal.org"
420        echo "------------------"
421        exit -1
422     fi
423
424#-----#
425# ogg #
426#-----#
427# checking for ogg-headers
428  AC_CHECK_HEADERS([ogg/ogg.h] ,,
429      [AC_MSG_ERROR([cannot find ogg header.])])
430# checking for ogg-lib
431  AC_CHECK_LIB([ogg], [main], [FOUND_ogg=yes])
432     if test x$FOUND_ogg = xyes ; then
433       LIBS="$LIBS -logg"
434     else
435        echo "------------------"
436        echo "ogg library not found."
437        echo "please install the ogg library, which can be found at http://www.xiph.org/ogg/vorbis/index.html"
438        echo "------------------"
439        exit -1
440     fi
441
442#--------#
443# vorbis #
444#--------#
445# checking for vorbis-lib
446  AC_CHECK_LIB([vorbis], [main], [FOUND_vorbis=yes])
447     if test x$FOUND_vorbis = xyes ; then
448       LIBS="$LIBS -lvorbis"
449     else
450        echo "------------------"
451        echo "vorbis library not found."
452        echo "please install the vorbis library, which can be found at http://www.xiph.org/ogg/vorbis/index.html"
453        echo "------------------"
454        exit -1
455     fi
456
457#------------#
458# vorbisfile #
459#------------#
460# checking for vorbis-headers
461  AC_CHECK_HEADERS([vorbis/vorbisfile.h] ,,
462      [AC_MSG_ERROR([cannot find vorbisfile header.])])
463# checking for vorbisfile-lib
464  AC_CHECK_LIB([vorbisfile], [main], [FOUND_vorbisfile=yes])
465     if test x$FOUND_vorbisfile = xyes ; then
466       LIBS="$LIBS -lvorbisfile"
467     else
468        echo "------------------"
469        echo "vorbisfile library not found."
470        echo "please install the vorbisfile library, which can be found at http://www.xiph.org/ogg/vorbis/index.html"
471        echo "------------------"
472        exit -1
473     fi
474
475#---------#
476# SDL_ttf #
477#---------#
478# checking for SDL_ttf-headers
479  AC_CHECK_HEADERS([SDL/SDL_ttf.h] ,,
480      [AC_CHECK_HEADERS([SDL_ttf.h] ,,AC_MSG_ERROR([cannot find SDL_ttf header.])]))
481#fi
482# checking for SDL_ttf-lib
483  AC_CHECK_LIB([SDL_ttf], [main], [FOUND_SDL_ttf=yes])
484     if test x$FOUND_SDL_ttf = xyes ; then
485       LIBS="$LIBS -lSDL_ttf"
486     else
487        echo "------------------"
488        echo "SDL_ttf library not found."
489        echo "please install the SDL_ttf library, which can be found at http://www.libsdl.org/projects/SDL_ttf/"
490        echo "------------------"
491        exit -1
492     fi
493
494
495#-----------#
496# SDL_Image #
497#-----------#
498# checking for SDL_image-headers
499AC_CHECK_HEADERS([SDL_image.h] ,,
500    [AC_CHECK_HEADERS([SDL/SDL_image.h],, AC_MSG_ERROR([sdl_image header not found.]))])
501# checking for SDL_image-lib
502AC_CHECK_LIB([SDL_image], [main], [FOUND_SDL_image=yes])
503   if test x$FOUND_SDL_image = xyes ; then
504     LIBS="$LIBS -lSDL_image"
505   else
506      echo "------------------"
507      echo "SDL_image library not found."
508      echo "please install the SDL_image library, which can be found at http://www.libsdl.org/projects/SDL_image/"
509      echo "------------------"
510      exit -1
511   fi
512
513#-----#
514# GTK #
515#-----#
516if test x$def_gtk = xyes; then
517        #PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.0.3 gthread-2.0 >= 2.0.3, have_gtk2=yes, have_gtk2=no)
518        AC_MSG_CHECKING([for gtk2.0])
519        if `$PKG_CONFIG --exists gtk+-2.0`; then
520                echo "yes"
521                have_gtk2=yes
522                GTK2_LIBS=`$PKG_CONFIG --libs gtk+-2.0`
523                GTK2_CFLAGS=`$PKG_CONFIG --cflags gtk+-2.0`
524                AC_DEFINE_UNQUOTED(HAVE_GTK2, 1, [if we have GTK2])
525                if test $DEBUG -ge 3; then
526                 echo "cflags: $GTK2_CFLAGS"
527                 echo "libs: $GTK2_LIBS"
528                fi
529        else
530                echo "no"
531        fi
532
533fi
534AC_SUBST(GTK2_LIBS)
535AC_SUBST(GTK2_CFLAGS)
536AM_CONDITIONAL(HAVE_GTK2, test x$have_gtk2 = xyes)
537
538#---------#
539# libcURL #
540#---------#
541if test x$def_curl = xyes; then
542
543 AC_CHECK_HEADERS([curl/curl.h], [curlHeader="yes"], [curlHeader="no"])
544 AC_CHECK_LIB([curl], [main], [FOUND_curl=yes])
545 if test x$curlHeader = xyes & test x$FOUND_curl = xyes ; then
546  have_curl=yes
547  CURL_LIBS=`curl-config --libs`
548  CURLCFLAGS=`curl-config --cflags`
549  AC_DEFINE_UNQUOTED(HAVE_CURL, 1, [if we have CURL])
550 else
551  have_curl=no
552 fi
553
554fi
555AC_SUBST(CURL_LIBS)
556AC_SUBST(CURL_CFLAGS)
557AM_CONDITIONAL(HAVE_CURL, test x$have_curl = xyes)
558
559#--------#
560# efence #
561#--------#
562if test x$def_efence = xyes ; then
563  AC_CHECK_LIB([efence], [main], [FOUND_efence=yes])
564   if test x$FOUND_efence = xyes ; then
565      LIBS="$LIBS -lefence"
566   fi
567
568fi
569
570# FIXME: Replace `main' with a function in `-lm':
571 AC_CHECK_LIB([m], [main])
572
573
574# Checks for header files.
575AC_HEADER_STDC
576AC_CHECK_HEADERS([stdlib.h string.h])
577
578# Checks for typedefs, structures, and compiler characteristics.
579AC_HEADER_STDBOOL
580
581# Checks for library functions.
582AC_FUNC_MALLOC
583AC_CHECK_FUNCS([bzero sqrt])
584
585######################
586## OUTPUT CONFIGURE ##
587######################
588AC_CONFIG_FILES([Makefile
589                 src/Makefile
590                 src/lib/Makefile
591                 src/lib/graphics/Makefile
592                 src/lib/graphics/importer/Makefile
593                 src/lib/sound/Makefile
594                 src/lib/event/Makefile
595                 src/lib/physics/Makefile
596                 src/lib/particles/Makefile
597                 src/lib/collision_detection/Makefile
598                 src/lib/gui/Makefile
599                 src/lib/tinyxml/Makefile
600                 src/subprojects/Makefile
601                 src/subprojects/testmain/Makefile
602                 src/subprojects/importer/Makefile
603                 src/subprojects/particles/Makefile
604                 src/subprojects/collision_detection/Makefile
605                 src/subprojects/gui/Makefile
606                 ])
607
608AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.