Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/updater/configure.ac @ 3278

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

orxonox/branches/updater: better check if pthread is not enabled

File size: 10.9 KB
Line 
1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ(2.56)
5AC_INIT(orxonox, 0.2.1-pre-alpha, [orxonox-dev at 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### CHECKING  OPTIONAT ARGUMENTS
24## DEBUG-statement
25DEBUG=no
26AC_MSG_CHECKING([if DEBUG-mode should be enabled])
27AC_ARG_ENABLE([debug],
28        AC_HELP_STRING( [--enable-debug], [compiles in debug mode. Lots of debug info about the game.]),
29         DEBUG=$enableval)
30
31if test "$DEBUG" = "no"; then
32        echo "no"
33        echo " -> Setting debuglevel to 1. Like this you can still see errors."
34        DEBUG=1
35elif test "$DEBUG" = yes; then
36        echo "yes"
37        echo " -> Setting debuglevel to 3. HARD DEBUG MODE!!."
38        DEBUG=3
39else       
40        echo "yes set to $DEBUG"
41fi
42        AC_DEFINE_UNQUOTED(DEBUG, $DEBUG, [in which debug mode we are])
43
44AC_SUBST(DEBUG)
45
46## GTK-disabled
47AC_MSG_CHECKING([if gtk should be enabled])
48AC_ARG_WITH([gtk],
49        AC_HELP_STRING( [--without-gtk],
50        [Prevents GTK from being loaded]), [def_gtk=no], [def_gtk=yes])
51if test "$def_gtk" = yes; then
52  echo "yes"
53fi
54if test "$def_gtk" = no; then
55  echo "no"
56fi
57
58## gThread-disabled
59AC_MSG_CHECKING([if gThread should be enabled])
60AC_ARG_WITH([gthread],
61        AC_HELP_STRING( [--without-gthread],
62        [Prevents gThread from being loaded]), [def_gthread=no], [def_gthread=yes])
63if test "$def_gthread" = yes; then
64  echo "yes"
65fi
66if test "$def_gthread" = no; then
67  echo "no"
68fi
69
70## libCurl disabled?
71AC_MSG_CHECKING([if libcURL should be enabled])
72AC_ARG_WITH([curl],
73        AC_HELP_STRING( [--without-curl],
74        [Prevents libcURL from being loaded]), [def_curl=no], [def_curl=yes])
75if test "$def_curl" = yes; then
76  echo "yes"
77fi
78if test "$def_curl" = no; then
79  echo "no"
80fi
81
82### SDL_image-disable
83def_sdl_image=yes
84AC_MSG_CHECKING([if SDL_image should be enabled])
85AC_ARG_WITH([sdl_image],
86        AC_HELP_STRING( [--without-sdl-image],
87        [Prevents SDL_image from being loaded]), [def_sdl_image=no])
88if test "$def_sdl_image" = yes; then
89  echo "yes"
90fi
91if test "$def_sdl_image" = no; then
92  echo "no"
93fi
94
95
96## PROGRAMM CHECKING
97# checking for Doxygen
98AC_PATH_PROG(DOXYGEN, doxygen)
99AM_CONDITIONAL(DOXYGEN, test $DOXYGEN)
100
101### CHECKING FOR SYSTEM ###
102
103AC_MSG_CHECKING([for System])
104## checking for openGL-environment and other sys-specific parameters
105case "$target" in
106### WINDOWS ###
107  *-*-mingw32*)
108echo "mingw-WINDOWS detected"
109
110    mingw="yes"
111    MSBITFIELDS="-mms-bitfields"
112    MWINDOWS="-mwindows"
113
114# checking gl header
115        #done before loop
116
117# checking gl header
118   AC_CHECK_HEADERS(GL/gl.h ,,
119      [AC_MSG_ERROR([cannot find opengl headers]) ])
120#   checking for Windows openGl library
121    AC_CHECK_LIB([opengl32], [main], FOUND_opengl32=yes, "gl/gl.h")
122    if test "$FOUND_opengl32" = "yes" ; then
123        LIBS="$LIBS -lopengl32"
124    else
125         echo "------------------"
126         echo "opengl not found."
127         echo "please install the opengl package which can be found at http://www.opengl.org"
128         echo "------------------"
129         exit -1
130    fi
131
132# cheking for GLU-header
133    AC_CHECK_HEADERS(GL/glu.h ,,
134      [AC_MSG_ERROR([cannot find opengl headers]) ])
135
136# checking for libGLU
137    AC_CHECK_LIB([glu32], [main], FOUND_glu32=yes)
138    if test "$FOUND_glu32" = "yes" ; then
139        LIBS="$LIBS -lGLU32"
140    else
141         echo "------------------"
142         echo "GLU library not found."
143         echo "please install the GLU library, that should come with openGL, which can be found at http://www.opengl.org"
144         echo "------------------"
145         exit -1
146    fi
147
148# checking for mingw32
149    AC_CHECK_LIB([mingw32], [main], FOUND_mingw32=yes)
150    if test $FOUND_mingw32 = "yes"; then
151        LIBS="$LIBS -lmingw32"
152    fi
153# checking for SDL-headers
154    AC_CHECK_HEADERS(SDL/SDL.h ,,
155      [AC_MSG_ERROR([cannot find SDL headers]) ])
156
157#checking for libSDL
158    AC_CHECK_LIB([sdlmain], [main], FOUND_sdlmain=yes)
159    if test "$FOUND_sdlmain" = "yes" ; then
160       LIBS="$LIBS -lsdlmain"
161    else
162        echo "------------------"
163        echo "SDL library not found."
164        echo "please install the SDL library, which can be found at http://www.libsdl.org"
165        echo "------------------"
166        exit 1
167    fi
168    AC_CHECK_LIB([sdl], [main], FOUND_sdl=yes)
169    if test "$FOUND_sdl" = "yes" ; then
170       LIBS="$LIBS -lsdl"
171    else
172        echo "------------------"
173        echo "SDL library not found."
174        echo "please install the SDL library, which can be found at http://www.libsdl.org"
175        echo "------------------"
176        exit -1
177    fi
178
179    ;;
180
181### LINUX ###
182 *-*-linux*)
183echo "Linux detected"
184
185 Linux="yes"
186
187CPPFLAGS="-I/usr/X11R6/include"
188LDFLAGS="-L/usr/Mesa-6.0.1/lib -L/usr/X11R6/lib $LDFLAGS"
189# checking gl header
190   AC_CHECK_HEADERS(GL/gl.h ,,
191      [AC_MSG_ERROR([cannot find opengl headers]) ])
192
193#  checking for Unix GL
194   AC_CHECK_LIB([GL], [main], FOUND_GL=yes)
195   if test "$FOUND_GL" = "yes" ; then
196     LIBS="$LIBS -lGL"
197   else
198         echo "------------------"
199         echo "opengl not found."
200         echo "please install the opengl package which can be found at http://www.opengl.org"
201         echo "------------------"
202         exit -1
203   fi
204
205# cheking for GLU-header
206    AC_CHECK_HEADERS(GL/glu.h ,,
207      [AC_MSG_ERROR([cannot find opengl headers]) ])
208
209    AC_CHECK_LIB([GLU], [gluProject], FOUND_GLU=yes)
210    if test "$FOUND_GLU" = "yes" ; then
211      LIBS="$LIBS -lGLU"
212    else
213         echo "------------------"
214         echo "GLU library not found."
215         echo "please install the GLU library, that should come with openGL, which can be found at http://www.opengl.org"
216         echo "------------------"
217         exit -1
218    fi   
219
220# checking for SDL-headers
221    AC_CHECK_HEADERS(SDL/SDL.h ,,
222      [AC_MSG_ERROR([cannot find SDL headers]) ])
223
224# checking for SDL-lib
225    AC_CHECK_LIB([SDL], [main], FOUND_SDL=yes)
226     if test "$FOUND_SDL" = "yes" ; then
227       LIBS="$LIBS -lSDL"
228     else
229        echo "------------------"
230        echo "SDL library not found."
231        echo "please install the SDL library, which can be found at http://www.libsdl.org"
232        echo "------------------"
233        exit -1
234     fi   
235
236
237## checking for SDL
238#    SDL_VERSION=1.2.7
239#    AM_PATH_SDL($SDL_VERSION,
240#      :,
241#      AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
242#      )
243#    CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
244#    LIBS="$LIBS $SDL_LIBS"
245    ;;
246
247### OS X ###
248 *darwin*)
249echo "OS X detected"
250
251 osX="yes"
252
253 CPPFLAGS="-I/sw/include $CPPFLAGS"
254# checking gl header
255   AC_CHECK_HEADERS(OpenGL/gl.h ,,
256      [AC_MSG_ERROR([cannot find opengl headers]) ])
257# cheking for GLU-header
258    AC_CHECK_HEADERS(OpenGL/glu.h ,,
259      [AC_MSG_ERROR([cannot find opengl headers]) ])
260
261   LIBS="$LIBS -framework OpenGL"
262
263# checking for SDL-headers
264#    AC_CHECK_HEADERS(SDL/SDL.h ,,
265#      [AC_MSG_ERROR([cannot find SDL headers]) ])
266
267## checking for SDL
268#    SDL_VERSION=1.2.7
269#    AM_PATH_SDL($SDL_VERSION,
270#      :,
271#      AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
272#      )
273
274       SDL_CFLAGS=`sdl-config --cflags`
275       SDL_LIBS=`sdl-config --libs`
276       CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
277       LIBS="$LIBS $SDL_LIBS"
278
279    ;;
280
281  *)
282    ;;
283esac
284
285AC_SUBST(MSBITFIELDS)
286
287## check for SDL_Image
288if test "$def_sdl_image" = "yes"; then
289# checking for SDL_image-headers
290  AC_CHECK_HEADERS(SDL/SDL_image.h ,,
291      [echo "sdl_image not found. falling back to other options"; def_sdl_image=no ])
292fi
293if test "$def_sdl_image" = "yes"; then
294# checking for SDL_image-lib
295  AC_CHECK_LIB([SDL_image], [main], FOUND_SDL_image=yes)
296     if test "$FOUND_SDL_image" = "yes" ; then
297       LIBS="$LIBS -lSDL_image"
298     else
299        echo "------------------"
300        echo "SDL_image library not found."
301        echo "please install the SDL_image library, which can be found at http://www.libsdl.org/projects/SDL_image/"
302        echo "------------------"
303        exit -1
304     fi   
305fi
306
307
308if test "$def_sdl_image" = "no"; then
309 ## checking for libjpeg
310 AC_CHECK_HEADERS(jpeglib.h ,jpegHeader="yes",
311        jpegHeader="no")
312 if test $jpegHeader = "no"; then
313        echo " not including jpeg."
314 else
315  AC_CHECK_LIB([jpeg], [main], FOUND_jpeg=yes)
316    if test "$FOUND_jpeg" = "yes" ; then
317      LIBS="$LIBS -ljpeg"
318    else
319         echo "------------------"
320         echo "jpeg library not found."
321         echo "please install the jpeg library from the Independent JPEG Group, which can be found at http://www.ijg.org"
322         echo "------------------"
323         exit -1
324    fi   
325 fi
326
327 ## checking for libpng
328 AC_CHECK_HEADERS(png.h ,pngHeader="yes",
329        pngHeader="no")
330 if test $pngHeader = "no"; then
331        echo " not including png."
332 else
333  AC_CHECK_LIB([png], [main], FOUND_png=yes)
334    if test "$FOUND_png" = "yes" ; then
335      LIBS="$LIBS -lpng"
336    else
337         echo "------------------"
338         echo "png library not found."
339         echo "please install the png library, which can be found at http://libpng.org/pub/png/libpng.html"
340         echo "------------------"
341         exit -1
342    fi
343 fi   
344fi
345
346## checking for GTK
347if test "$def_gtk" = yes; then
348
349        #PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.0.3 gthread-2.0 >= 2.0.3, have_gtk2=yes, have_gtk2=no)
350        AC_MSG_CHECKING([for gtk2.0])
351        if `pkg-config --exists gtk+-2.0`; then
352                echo "yes"
353                have_gtk2=yes
354                GTK2_LIBS=`pkg-config --libs gtk+-2.0`
355                GTK2_CFLAGS=`pkg-config --cflags gtk+-2.0`
356                AC_DEFINE_UNQUOTED(HAVE_GTK2, 1, [if we have GTK2])
357        else
358                echo "no"
359        fi
360
361fi
362AC_SUBST(GTK2_LIBS)
363AC_SUBST(GTK2_CFLAGS)
364AM_CONDITIONAL(HAVE_GTK2, test x$have_gtk2 = xyes)
365
366## checking for gThread
367if test "$def_gthread" = yes; then
368
369        AC_MSG_CHECKING([for gthread])
370        if `pkg-config --exists gthread-2.0`; then
371                echo "yes"
372                have_gthread=yes
373                GTHREAD_LIBS=`pkg-config --libs gthread-2.0`
374                GTHREAD_CFLAGS=`pkg-config --cflags gthread-2.0`
375                AC_DEFINE_UNQUOTED(HAVE_GTHREAD, 1, [if we have gThread])
376        else
377                echo "no"
378        fi
379
380fi
381AC_SUBST(GTHREAD_LIBS)
382AC_SUBST(GTHREAD_CFLAGS)
383AM_CONDITIONAL(HAVE_GTHREAD, test x$have_gthread = xyes)
384
385## checking for libcURL
386if test "$def_curl" = yes; then
387
388 AC_CHECK_HEADERS([curl/curl.h], curlHeader="yes", curlHeader="no")
389 AC_CHECK_LIB([curl], [main], [FOUND_curl=yes])
390 if test x$curlHeader = xyes & test x$FOUND_curl = xyes ; then
391  have_curl=yes
392  CURL_LIBS=`curl-config --libs`
393  CURLCFLAGS=`curl-config --cflags`
394  AC_DEFINE_UNQUOTED(HAVE_CURL, 1, [if we have CURL])
395 else
396  have_curl=no
397 fi
398
399fi
400AC_SUBST(CURL_LIBS)
401AC_SUBST(CURL_CFLAGS)
402AM_CONDITIONAL(HAVE_CURL, test x$have_curl = xyes)
403
404
405##checking for pthread
406if test x$have_gthread = xyes ; then
407  AC_CHECK_HEADERS([pthread.h], pthreadHeader="yes", pthreadHeader="no")
408  AC_CHECK_LIB([pthread], [main], FOUND_pthread=yes)
409   if test "$FOUND_pthread" = "yes" ; then
410      LIBS="$LIBS -lpthread"
411   fi
412fi
413
414# FIXME: Replace `main' with a function in `-lm':
415 AC_CHECK_LIB([m], [main])
416
417 
418# Checks for header files.
419AC_HEADER_STDC
420AC_CHECK_HEADERS([stdlib.h string.h])
421
422# Checks for typedefs, structures, and compiler characteristics.
423AC_HEADER_STDBOOL
424
425# Checks for library functions.
426AC_FUNC_MALLOC
427AC_CHECK_FUNCS([bzero sqrt])
428
429AC_CONFIG_FILES([Makefile
430                 src/console/Makefile
431                 src/gui/Makefile
432                 src/Makefile
433                 src/importer/Makefile])
434AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.