Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 3194 was 3191, checked in by bensch, 20 years ago

orxonox/trunk: Changed filestructure:
moved gui, console to src/gui, src/console
fixed Makefiles.

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