Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/branches/images: configure.ac: made SDL_image check global

File size: 8.4 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# checking gl header
201   AC_CHECK_HEADERS(OpenGL/gl.h ,,
202      [AC_MSG_ERROR([cannot find opengl headers]) ])
203# cheking for GLU-header
204    AC_CHECK_HEADERS(OpenGL/glu.h ,,
205      [AC_MSG_ERROR([cannot find opengl headers]) ])
206
207   LIBS="$LIBS -framework OpenGL"
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
214#    SDL_VERSION=1.2.7
215#    AM_PATH_SDL($SDL_VERSION,
216#      :,
217#      AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
218#      )
219
220       SDL_CFLAGS=`sdl-config --cflags`
221       SDL_LIBS=`sdl-config --libs`
222       CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
223       LIBS="$LIBS $SDL_LIBS"
224
225       def_sdl_image=no;
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 ,,
258        [AC_MSG_ERROR([cannot find jpeg headers]) ])
259
260 AC_CHECK_LIB([jpeg], [main], FOUND_jpeg=yes)
261    if test "$FOUND_jpeg" = "yes" ; then
262      LIBS="$LIBS -ljpeg"
263    else
264         echo "------------------"
265         echo "jpeg library not found."
266         echo "please install the jpeg library from the Independent JPEG Group, which can be found at http://www.ijg.org"
267         echo "------------------"
268         exit -1
269    fi   
270
271
272 ## checking for libpng
273 AC_CHECK_HEADERS(png.h ,,
274        [AC_MSG_ERROR([cannot find jpeg headers]) ])
275
276 AC_CHECK_LIB([png], [main], FOUND_png=yes)
277    if test "$FOUND_png" = "yes" ; then
278      LIBS="$LIBS -lpng"
279    else
280         echo "------------------"
281         echo "png library not found."
282         echo "please install the png library, which can be found at http://libpng.org/pub/png/libpng.html"
283         echo "------------------"
284         exit -1
285    fi   
286fi
287
288## checking for GTK
289if test "$def_gtk" = yes; then
290
291        #PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.0.3 gthread-2.0 >= 2.0.3, have_gtk2=yes, have_gtk2=no)
292        AC_MSG_CHECKING([for gtk2.0])
293        if `pkg-config --exists gtk+-2.0`; then
294                echo "yes"
295                have_gtk2=yes
296                GTK2_LIBS=`pkg-config --libs gtk+-2.0`
297                GTK2_CFLAGS=`pkg-config --cflags gtk+-2.0`
298                AC_DEFINE_UNQUOTED(HAVE_GTK2, 1, [if we have GTK2])
299        else
300                echo "no"
301        fi
302
303fi
304AC_SUBST(GTK2_LIBS)
305AC_SUBST(GTK2_CFLAGS)
306AM_CONDITIONAL(HAVE_GTK2, test x$have_gtk2 = xyes)
307
308
309
310#checking for pthread libs
311 AC_CHECK_LIB([pthread], [main], FOUND_pthread=yes)
312 if test "$FOUND_pthread" = "yes" ; then
313    LIBS="$LIBS -lpthread"
314 fi
315
316
317# FIXME: Replace `main' with a function in `-lm':
318 AC_CHECK_LIB([m], [main])
319
320 
321# Checks for header files.
322AC_HEADER_STDC
323AC_CHECK_HEADERS([stdlib.h string.h])
324
325# Checks for typedefs, structures, and compiler characteristics.
326AC_HEADER_STDBOOL
327
328# Checks for library functions.
329AC_FUNC_MALLOC
330AC_CHECK_FUNCS([bzero sqrt])
331
332AC_CONFIG_FILES([Makefile
333                 console/Makefile
334                 gui/Makefile
335                 src/Makefile
336                 importer/Makefile])
337AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.