Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/shadows/configure.ac @ 4363

Last change on this file since 4363 was 3385, checked in by bensch, 20 years ago

orxonox/trunk: added new include directory for openGL. now it works with the new xorg.

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