Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/branches/images: test also in configure.ac-script.

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