Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 3139 was 3110, checked in by bensch, 20 years ago

orxonox/branches/images: test for jpeg and png libs in configure.ac and material.cc/h

File size: 8.5 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    ;;
129
130### LINUX ###
131 *-*-linux*)
132echo "Linux detected"
133
134 Linux="yes"
135
136# checking gl header
137   AC_CHECK_HEADERS(GL/gl.h ,,
138      [AC_MSG_ERROR([cannot find opengl headers]) ])
139
140#  checking for Unix GL
141   AC_CHECK_LIB([GL], [main], FOUND_GL=yes)
142   if test "$FOUND_GL" = "yes" ; then
143     LIBS="$LIBS -lGL"
144   else
145         echo "------------------"
146         echo "opengl not found."
147         echo "please install the opengl package which can be found at http://www.opengl.org"
148         echo "------------------"
149         exit -1
150   fi
151
152# cheking for GLU-header
153    AC_CHECK_HEADERS(GL/glu.h ,,
154      [AC_MSG_ERROR([cannot find opengl headers]) ])
155
156    AC_CHECK_LIB([GLU], [gluProject], FOUND_GLU=yes)
157    if test "$FOUND_GLU" = "yes" ; then
158      LIBS="$LIBS -lGLU"
159    else
160         echo "------------------"
161         echo "GLU library not found."
162         echo "please install the GLU library, that should come with openGL, which can be found at http://www.opengl.org"
163         echo "------------------"
164         exit -1
165    fi   
166
167# checking for SDL-headers
168    AC_CHECK_HEADERS(SDL/SDL.h ,,
169      [AC_MSG_ERROR([cannot find SDL headers]) ])
170
171# checking for SDL-lib
172    AC_CHECK_LIB([SDL], [main], FOUND_SDL=yes)
173     if test "$FOUND_SDL" = "yes" ; then
174       LIBS="$LIBS -lSDL"
175     else
176        echo "------------------"
177        echo "SDL library not found."
178        echo "please install the SDL library, which can be found at http://www.libsdl.org"
179        echo "------------------"
180        exit -1
181     fi   
182
183
184## checking for SDL
185#    SDL_VERSION=1.2.7
186#    AM_PATH_SDL($SDL_VERSION,
187#      :,
188#      AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
189#      )
190#    CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
191#    LIBS="$LIBS $SDL_LIBS"
192    ;;
193
194### OS X ###
195 *darwin*)
196echo "OS X detected"
197
198 osX="yes"
199
200 CPPFLAGS="-I/sw/include $CPPFLAGS"
201# checking gl header
202   AC_CHECK_HEADERS(OpenGL/gl.h ,,
203      [AC_MSG_ERROR([cannot find opengl headers]) ])
204# cheking for GLU-header
205    AC_CHECK_HEADERS(OpenGL/glu.h ,,
206      [AC_MSG_ERROR([cannot find opengl headers]) ])
207
208   LIBS="$LIBS -framework OpenGL"
209
210# checking for SDL-headers
211#    AC_CHECK_HEADERS(SDL/SDL.h ,,
212#      [AC_MSG_ERROR([cannot find SDL headers]) ])
213
214## checking for SDL
215#    SDL_VERSION=1.2.7
216#    AM_PATH_SDL($SDL_VERSION,
217#      :,
218#      AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
219#      )
220
221       SDL_CFLAGS=`sdl-config --cflags`
222       SDL_LIBS=`sdl-config --libs`
223       CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
224       LIBS="$LIBS $SDL_LIBS"
225
226    ;;
227
228  *)
229    ;;
230esac
231
232AC_SUBST(MSBITFIELDS)
233
234## check for SDL_Image
235if test "$def_sdl_image" = "yes"; then
236# checking for SDL_image-headers
237  AC_CHECK_HEADERS(SDL/SDL_image.h ,,
238      [echo "sdl_image not found. falling back to other options"; def_sdl_image=no ])
239fi
240if test "$def_sdl_image" = "yes"; then
241# checking for SDL_image-lib
242  AC_CHECK_LIB([SDL_image], [main], FOUND_SDL_image=yes)
243     if test "$FOUND_SDL_image" = "yes" ; then
244       LIBS="$LIBS -lSDL_image"
245     else
246        echo "------------------"
247        echo "SDL_image library not found."
248        echo "please install the SDL_image library, which can be found at http://www.libsdl.org/projects/SDL_image/"
249        echo "------------------"
250        exit -1
251     fi   
252fi
253
254
255if test "$def_sdl_image" = "no"; then
256 ## checking for libjpeg
257 AC_CHECK_HEADERS(jpeglib.h ,jpegHeader="yes",
258        jpegHeader="no")
259 if test $jpegHeader = "no"; then
260        echo " not including jpeg."
261 else
262  AC_CHECK_LIB([jpeg], [main], FOUND_jpeg=yes)
263    if test "$FOUND_jpeg" = "yes" ; then
264      LIBS="$LIBS -ljpeg"
265    else
266         echo "------------------"
267         echo "jpeg library not found."
268         echo "please install the jpeg library from the Independent JPEG Group, which can be found at http://www.ijg.org"
269         echo "------------------"
270         exit -1
271    fi   
272 fi
273
274 ## checking for libpng
275 AC_CHECK_HEADERS(png.h ,pngHeader="yes",
276        pngHeader="no")
277 if test $pngHeader = "no"; then
278        echo " not including png."
279 else
280  AC_CHECK_LIB([png], [main], FOUND_png=yes)
281    if test "$FOUND_png" = "yes" ; then
282      LIBS="$LIBS -lpng"
283    else
284         echo "------------------"
285         echo "png library not found."
286         echo "please install the png library, which can be found at http://libpng.org/pub/png/libpng.html"
287         echo "------------------"
288         exit -1
289    fi
290 fi   
291fi
292
293## checking for GTK
294if test "$def_gtk" = yes; then
295
296        #PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.0.3 gthread-2.0 >= 2.0.3, have_gtk2=yes, have_gtk2=no)
297        AC_MSG_CHECKING([for gtk2.0])
298        if `pkg-config --exists gtk+-2.0`; then
299                echo "yes"
300                have_gtk2=yes
301                GTK2_LIBS=`pkg-config --libs gtk+-2.0`
302                GTK2_CFLAGS=`pkg-config --cflags gtk+-2.0`
303                AC_DEFINE_UNQUOTED(HAVE_GTK2, 1, [if we have GTK2])
304        else
305                echo "no"
306        fi
307
308fi
309AC_SUBST(GTK2_LIBS)
310AC_SUBST(GTK2_CFLAGS)
311AM_CONDITIONAL(HAVE_GTK2, test x$have_gtk2 = xyes)
312
313
314
315#checking for pthread libs
316 AC_CHECK_LIB([pthread], [main], FOUND_pthread=yes)
317 if test "$FOUND_pthread" = "yes" ; then
318    LIBS="$LIBS -lpthread"
319 fi
320
321
322# FIXME: Replace `main' with a function in `-lm':
323 AC_CHECK_LIB([m], [main])
324
325 
326# Checks for header files.
327AC_HEADER_STDC
328AC_CHECK_HEADERS([stdlib.h string.h])
329
330# Checks for typedefs, structures, and compiler characteristics.
331AC_HEADER_STDBOOL
332
333# Checks for library functions.
334AC_FUNC_MALLOC
335AC_CHECK_FUNCS([bzero sqrt])
336
337AC_CONFIG_FILES([Makefile
338                 console/Makefile
339                 gui/Makefile
340                 src/Makefile
341                 importer/Makefile])
342AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.