Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: DEBUG implemented in the configure-files

File size: 9.2 KB
Line 
1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4#AC_PREREQ(2.56)
5AC_INIT(orxonox, 0.2.0_alpha-r1, orxonox-dev@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
47## GTK-disabled
48AC_MSG_CHECKING([if gtk should be enabled])
49AC_ARG_WITH([gtk],
50        AC_HELP_STRING( [--without-gtk],
51        [Prevents GTK from being loaded]), [def_gtk=no], [def_gtk=yes])
52if test "$def_gtk" = yes; then
53  echo "yes"
54fi
55if test "$def_gtk" = no; then
56  echo "no"
57fi
58### SDL_image-disable
59def_sdl_image=yes
60AC_MSG_CHECKING([if SDL_image should be enabled])
61AC_ARG_WITH([sdl_image],
62        AC_HELP_STRING( [--without-sdl-image],
63        [Prevents SDL_image from being loaded]), [def_sdl_image=no])
64if test "$def_sdl_image" = yes; then
65  echo "yes"
66fi
67if test "$def_sdl_image" = no; then
68  echo "no"
69fi
70
71### CHECKING FOR SYSTEM ###
72
73AC_MSG_CHECKING([for System])
74## checking for openGL-environment and other sys-specific parameters
75case "$target" in
76### WINDOWS ###
77  *-*-mingw32*)
78echo "mingw-WINDOWS detected"
79
80    mingw="yes"
81    MSBITFIELDS="-mms-bitfields"
82    MWINDOWS="-mwindows"
83
84# checking gl header
85        #done before loop
86
87# checking gl header
88   AC_CHECK_HEADERS(GL/gl.h ,,
89      [AC_MSG_ERROR([cannot find opengl headers]) ])
90#   checking for Windows openGl library
91    AC_CHECK_LIB([opengl32], [main], FOUND_opengl32=yes, "gl/gl.h")
92    if test "$FOUND_opengl32" = "yes" ; then
93        LIBS="$LIBS -lopengl32"
94    else
95         echo "------------------"
96         echo "opengl not found."
97         echo "please install the opengl package which can be found at http://www.opengl.org"
98         echo "------------------"
99         exit -1
100    fi
101
102# cheking for GLU-header
103    AC_CHECK_HEADERS(GL/glu.h ,,
104      [AC_MSG_ERROR([cannot find opengl headers]) ])
105
106# checking for libGLU
107    AC_CHECK_LIB([glu32], [main], FOUND_glu32=yes)
108    if test "$FOUND_glu32" = "yes" ; then
109        LIBS="$LIBS -lGLU32"
110    else
111         echo "------------------"
112         echo "GLU library not found."
113         echo "please install the GLU library, that should come with openGL, which can be found at http://www.opengl.org"
114         echo "------------------"
115         exit -1
116    fi
117
118# checking for mingw32
119    AC_CHECK_LIB([mingw32], [main], FOUND_mingw32=yes)
120    if test $FOUND_mingw32 = "yes"; then
121        LIBS="$LIBS -lmingw32"
122    fi
123# checking for SDL-headers
124    AC_CHECK_HEADERS(SDL/SDL.h ,,
125      [AC_MSG_ERROR([cannot find SDL headers]) ])
126
127#checking for libSDL
128    AC_CHECK_LIB([sdlmain], [main], FOUND_sdlmain=yes)
129    if test "$FOUND_sdlmain" = "yes" ; then
130       LIBS="$LIBS -lsdlmain"
131    else
132        echo "------------------"
133        echo "SDL library not found."
134        echo "please install the SDL library, which can be found at http://www.libsdl.org"
135        echo "------------------"
136        exit 1
137    fi
138    AC_CHECK_LIB([sdl], [main], FOUND_sdl=yes)
139    if test "$FOUND_sdl" = "yes" ; then
140       LIBS="$LIBS -lsdl"
141    else
142        echo "------------------"
143        echo "SDL library not found."
144        echo "please install the SDL library, which can be found at http://www.libsdl.org"
145        echo "------------------"
146        exit -1
147    fi
148
149    ;;
150
151### LINUX ###
152 *-*-linux*)
153echo "Linux detected"
154
155 Linux="yes"
156
157CPPFLAGS="-I/usr/X11R6/include"
158LDFLAGS="-L/usr/Mesa-6.0.1/lib -L/usr/X11R6/lib $LDFLAGS"
159# checking gl header
160   AC_CHECK_HEADERS(GL/gl.h ,,
161      [AC_MSG_ERROR([cannot find opengl headers]) ])
162
163#  checking for Unix GL
164   AC_CHECK_LIB([GL], [main], FOUND_GL=yes)
165   if test "$FOUND_GL" = "yes" ; then
166     LIBS="$LIBS -lGL"
167   else
168         echo "------------------"
169         echo "opengl not found."
170         echo "please install the opengl package which can be found at http://www.opengl.org"
171         echo "------------------"
172         exit -1
173   fi
174
175# cheking for GLU-header
176    AC_CHECK_HEADERS(GL/glu.h ,,
177      [AC_MSG_ERROR([cannot find opengl headers]) ])
178
179    AC_CHECK_LIB([GLU], [gluProject], FOUND_GLU=yes)
180    if test "$FOUND_GLU" = "yes" ; then
181      LIBS="$LIBS -lGLU"
182    else
183         echo "------------------"
184         echo "GLU library not found."
185         echo "please install the GLU library, that should come with openGL, which can be found at http://www.opengl.org"
186         echo "------------------"
187         exit -1
188    fi   
189
190# checking for SDL-headers
191    AC_CHECK_HEADERS(SDL/SDL.h ,,
192      [AC_MSG_ERROR([cannot find SDL headers]) ])
193
194# checking for SDL-lib
195    AC_CHECK_LIB([SDL], [main], FOUND_SDL=yes)
196     if test "$FOUND_SDL" = "yes" ; then
197       LIBS="$LIBS -lSDL"
198     else
199        echo "------------------"
200        echo "SDL library not found."
201        echo "please install the SDL library, which can be found at http://www.libsdl.org"
202        echo "------------------"
203        exit -1
204     fi   
205
206
207## checking for SDL
208#    SDL_VERSION=1.2.7
209#    AM_PATH_SDL($SDL_VERSION,
210#      :,
211#      AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
212#      )
213#    CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
214#    LIBS="$LIBS $SDL_LIBS"
215    ;;
216
217### OS X ###
218 *darwin*)
219echo "OS X detected"
220
221 osX="yes"
222
223 CPPFLAGS="-I/sw/include $CPPFLAGS"
224# checking gl header
225   AC_CHECK_HEADERS(OpenGL/gl.h ,,
226      [AC_MSG_ERROR([cannot find opengl headers]) ])
227# cheking for GLU-header
228    AC_CHECK_HEADERS(OpenGL/glu.h ,,
229      [AC_MSG_ERROR([cannot find opengl headers]) ])
230
231   LIBS="$LIBS -framework OpenGL"
232
233# checking for SDL-headers
234#    AC_CHECK_HEADERS(SDL/SDL.h ,,
235#      [AC_MSG_ERROR([cannot find SDL headers]) ])
236
237## checking for SDL
238#    SDL_VERSION=1.2.7
239#    AM_PATH_SDL($SDL_VERSION,
240#      :,
241#      AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
242#      )
243
244       SDL_CFLAGS=`sdl-config --cflags`
245       SDL_LIBS=`sdl-config --libs`
246       CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
247       LIBS="$LIBS $SDL_LIBS"
248
249    ;;
250
251  *)
252    ;;
253esac
254
255AC_SUBST(MSBITFIELDS)
256
257## check for SDL_Image
258if test "$def_sdl_image" = "yes"; then
259# checking for SDL_image-headers
260  AC_CHECK_HEADERS(SDL/SDL_image.h ,,
261      [echo "sdl_image not found. falling back to other options"; def_sdl_image=no ])
262fi
263if test "$def_sdl_image" = "yes"; then
264# checking for SDL_image-lib
265  AC_CHECK_LIB([SDL_image], [main], FOUND_SDL_image=yes)
266     if test "$FOUND_SDL_image" = "yes" ; then
267       LIBS="$LIBS -lSDL_image"
268     else
269        echo "------------------"
270        echo "SDL_image library not found."
271        echo "please install the SDL_image library, which can be found at http://www.libsdl.org/projects/SDL_image/"
272        echo "------------------"
273        exit -1
274     fi   
275fi
276
277
278if test "$def_sdl_image" = "no"; then
279 ## checking for libjpeg
280 AC_CHECK_HEADERS(jpeglib.h ,jpegHeader="yes",
281        jpegHeader="no")
282 if test $jpegHeader = "no"; then
283        echo " not including jpeg."
284 else
285  AC_CHECK_LIB([jpeg], [main], FOUND_jpeg=yes)
286    if test "$FOUND_jpeg" = "yes" ; then
287      LIBS="$LIBS -ljpeg"
288    else
289         echo "------------------"
290         echo "jpeg library not found."
291         echo "please install the jpeg library from the Independent JPEG Group, which can be found at http://www.ijg.org"
292         echo "------------------"
293         exit -1
294    fi   
295 fi
296
297 ## checking for libpng
298 AC_CHECK_HEADERS(png.h ,pngHeader="yes",
299        pngHeader="no")
300 if test $pngHeader = "no"; then
301        echo " not including png."
302 else
303  AC_CHECK_LIB([png], [main], FOUND_png=yes)
304    if test "$FOUND_png" = "yes" ; then
305      LIBS="$LIBS -lpng"
306    else
307         echo "------------------"
308         echo "png library not found."
309         echo "please install the png library, which can be found at http://libpng.org/pub/png/libpng.html"
310         echo "------------------"
311         exit -1
312    fi
313 fi   
314fi
315
316## checking for GTK
317if test "$def_gtk" = yes; then
318
319        #PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.0.3 gthread-2.0 >= 2.0.3, have_gtk2=yes, have_gtk2=no)
320        AC_MSG_CHECKING([for gtk2.0])
321        if `pkg-config --exists gtk+-2.0`; then
322                echo "yes"
323                have_gtk2=yes
324                GTK2_LIBS=`pkg-config --libs gtk+-2.0`
325                GTK2_CFLAGS=`pkg-config --cflags gtk+-2.0`
326                AC_DEFINE_UNQUOTED(HAVE_GTK2, 1, [if we have GTK2])
327        else
328                echo "no"
329        fi
330
331fi
332AC_SUBST(GTK2_LIBS)
333AC_SUBST(GTK2_CFLAGS)
334AM_CONDITIONAL(HAVE_GTK2, test x$have_gtk2 = xyes)
335
336
337
338#checking for pthread libs
339 AC_CHECK_LIB([pthread], [main], FOUND_pthread=yes)
340 if test "$FOUND_pthread" = "yes" ; then
341    LIBS="$LIBS -lpthread"
342 fi
343
344
345# FIXME: Replace `main' with a function in `-lm':
346 AC_CHECK_LIB([m], [main])
347
348 
349# Checks for header files.
350AC_HEADER_STDC
351AC_CHECK_HEADERS([stdlib.h string.h])
352
353# Checks for typedefs, structures, and compiler characteristics.
354AC_HEADER_STDBOOL
355
356# Checks for library functions.
357AC_FUNC_MALLOC
358AC_CHECK_FUNCS([bzero sqrt])
359
360AC_CONFIG_FILES([Makefile
361                 src/console/Makefile
362                 src/gui/Makefile
363                 src/Makefile
364                 src/importer/Makefile])
365AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.