Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/branches/updater: now also works, if no pthread is found, but gthread is.

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