Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/images/configure.ac @ 3106

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

orxonox/branches/images: windows now runs too

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