Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: profiling support enabled

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