Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: better ebuild, and the default data-dir can now be specified through ./configure —datadir=bla

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