Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: configure.ac path, so now one can append a path for the shared-lib's dir

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