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
RevLine 
[1945]1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
[2980]4#AC_PREREQ(2.56)
[1950]5AC_INIT(orxonox, 0.1-pre-alpha, orxonox-dev@mail.datacore.ch)
[2980]6
7# Detect the canonical host and target build environment.
8AC_CANONICAL_BUILD
9AC_CANONICAL_HOST
10AC_CANONICAL_TARGET
11
12
[1959]13AM_INIT_AUTOMAKE
[2618]14
[1951]15AC_CONFIG_SRCDIR([.])
[1945]16AC_CONFIG_HEADER([config.h])
17
[2018]18
[1945]19# Checks for programs.
20AC_PROG_CXX
[2925]21AC_HEADER_STDC
[2701]22
[3105]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
[2701]50### CHECKING FOR SYSTEM ###
51
52AC_MSG_CHECKING([for System])
[2980]53## checking for openGL-environment and other sys-specific parameters
54case "$target" in
[2701]55### WINDOWS ###
[2980]56  *-*-mingw32*)
[2701]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
[2925]66# checking gl header
[2879]67   AC_CHECK_HEADERS(GL/gl.h ,,
68      [AC_MSG_ERROR([cannot find opengl headers]) ])
[2701]69#   checking for Windows openGl library
[1971]70    AC_CHECK_LIB([opengl32], [main], FOUND_opengl32=yes, "gl/gl.h")
71    if test "$FOUND_opengl32" = "yes" ; then
[1959]72        LIBS="$LIBS -lopengl32"
[1971]73    else
[1959]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
[2701]81# cheking for GLU-header
82    AC_CHECK_HEADERS(GL/glu.h ,,
[1971]83      [AC_MSG_ERROR([cannot find opengl headers]) ])
84
[2701]85# checking for libGLU
[1971]86    AC_CHECK_LIB([glu32], [main], FOUND_glu32=yes)
87    if test "$FOUND_glu32" = "yes" ; then
[1959]88        LIBS="$LIBS -lGLU32"
[2701]89    else
[1959]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
[1971]96
[2701]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
[2982]102# checking for SDL-headers
103    AC_CHECK_HEADERS(SDL/SDL.h ,,
104      [AC_MSG_ERROR([cannot find SDL headers]) ])
[2701]105
[2982]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
[2701]128    ;;
129
130### LINUX ###
[2980]131 *-*-linux*)
[2701]132echo "Linux detected"
133
134 Linux="yes"
135
[2925]136# checking gl header
[2879]137   AC_CHECK_HEADERS(GL/gl.h ,,
138      [AC_MSG_ERROR([cannot find opengl headers]) ])
[2701]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   
[2995]166
[2991]167# checking for SDL-headers
168    AC_CHECK_HEADERS(SDL/SDL.h ,,
169      [AC_MSG_ERROR([cannot find SDL headers]) ])
[2982]170
[3104]171# checking for SDL-lib
[2991]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
[3103]183
[2982]184## checking for SDL
[2991]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"
[2701]192    ;;
[2995]193
194### OS X ###
195 *darwin*)
196echo "OS X detected"
197
198 osX="yes"
199
[3109]200 CPPFLAGS="-I/sw/include $CPPFLAGS"
[2995]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
[3001]211#    AC_CHECK_HEADERS(SDL/SDL.h ,,
212#      [AC_MSG_ERROR([cannot find SDL headers]) ])
[2995]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"
[3105]225
[2995]226    ;;
227
[2701]228  *)
229    ;;
230esac
[2968]231
[2701]232AC_SUBST(MSBITFIELDS)
233
[3108]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
[3105]255if test "$def_sdl_image" = "no"; then
256 ## checking for libjpeg
[3110]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)
[3086]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   
[3110]272 fi
[1959]273
[3105]274 ## checking for libpng
[3110]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)
[3098]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
[3110]289    fi
290 fi   
[3105]291fi
[3098]292
[3105]293## checking for GTK
294if test "$def_gtk" = yes; then
[3098]295
[3105]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
[2980]309AC_SUBST(GTK2_LIBS)
310AC_SUBST(GTK2_CFLAGS)
[3105]311AM_CONDITIONAL(HAVE_GTK2, test x$have_gtk2 = xyes)
[2980]312
313
[3105]314
[2190]315#checking for pthread libs
[2968]316 AC_CHECK_LIB([pthread], [main], FOUND_pthread=yes)
317 if test "$FOUND_pthread" = "yes" ; then
[2190]318    LIBS="$LIBS -lpthread"
[2968]319 fi
[2190]320
321
[1945]322# FIXME: Replace `main' with a function in `-lm':
[2968]323 AC_CHECK_LIB([m], [main])
[1945]324
[3105]325 
[1945]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
[1946]337AC_CONFIG_FILES([Makefile
338                 console/Makefile
[1945]339                 gui/Makefile
[2819]340                 src/Makefile
341                 importer/Makefile])
[1945]342AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.