Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 3500 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
RevLine 
[1945]1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
[3218]4AC_PREREQ(2.56)
[3240]5AC_INIT(orxonox, 0.2.1-pre-alpha, [orxonox-dev at 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
[3100]23### CHECKING  OPTIONAT ARGUMENTS
[3173]24## DEBUG-statement
25DEBUG=no
26AC_MSG_CHECKING([if DEBUG-mode should be enabled])
[3181]27AC_ARG_ENABLE([debug],
[3205]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"
[3173]41fi
[3205]42        AC_DEFINE_UNQUOTED(DEBUG, $DEBUG, [in which debug mode we are])
43
[3173]44AC_SUBST(DEBUG)
45
[3100]46## GTK-disabled
47AC_MSG_CHECKING([if gtk should be enabled])
[3181]48AC_ARG_WITH([gtk],
49        AC_HELP_STRING( [--without-gtk],
[3205]50        [Prevents GTK from being loaded]), [def_gtk=no], [def_gtk=yes])
[3100]51if test "$def_gtk" = yes; then
52  echo "yes"
53fi
54if test "$def_gtk" = no; then
55  echo "no"
56fi
[3243]57
[3271]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
[3283]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
[3243]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
[3140]94### SDL_image-disable
95def_sdl_image=yes
96AC_MSG_CHECKING([if SDL_image should be enabled])
[3181]97AC_ARG_WITH([sdl_image],
98        AC_HELP_STRING( [--without-sdl-image],
[3140]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
[3100]106
[3219]107
108## PROGRAMM CHECKING
109# checking for Doxygen
110AC_PATH_PROG(DOXYGEN, doxygen)
111AM_CONDITIONAL(DOXYGEN, test $DOXYGEN)
112
[2701]113### CHECKING FOR SYSTEM ###
114
115AC_MSG_CHECKING([for System])
[2980]116## checking for openGL-environment and other sys-specific parameters
117case "$target" in
[2701]118### WINDOWS ###
[2980]119  *-*-mingw32*)
[2701]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
[2925]129# checking gl header
[2879]130   AC_CHECK_HEADERS(GL/gl.h ,,
131      [AC_MSG_ERROR([cannot find opengl headers]) ])
[2701]132#   checking for Windows openGl library
[1971]133    AC_CHECK_LIB([opengl32], [main], FOUND_opengl32=yes, "gl/gl.h")
134    if test "$FOUND_opengl32" = "yes" ; then
[1959]135        LIBS="$LIBS -lopengl32"
[1971]136    else
[1959]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
[2701]144# cheking for GLU-header
145    AC_CHECK_HEADERS(GL/glu.h ,,
[1971]146      [AC_MSG_ERROR([cannot find opengl headers]) ])
147
[2701]148# checking for libGLU
[1971]149    AC_CHECK_LIB([glu32], [main], FOUND_glu32=yes)
150    if test "$FOUND_glu32" = "yes" ; then
[1959]151        LIBS="$LIBS -lGLU32"
[2701]152    else
[1959]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
[1971]159
[2701]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
[2982]165# checking for SDL-headers
166    AC_CHECK_HEADERS(SDL/SDL.h ,,
167      [AC_MSG_ERROR([cannot find SDL headers]) ])
[2701]168
[2982]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
[2701]191    ;;
192
193### LINUX ###
[2980]194 *-*-linux*)
[2701]195echo "Linux detected"
196
197 Linux="yes"
198
[3180]199CPPFLAGS="-I/usr/X11R6/include"
200LDFLAGS="-L/usr/Mesa-6.0.1/lib -L/usr/X11R6/lib $LDFLAGS"
[2925]201# checking gl header
[2879]202   AC_CHECK_HEADERS(GL/gl.h ,,
203      [AC_MSG_ERROR([cannot find opengl headers]) ])
[2701]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   
[2995]231
[2991]232# checking for SDL-headers
233    AC_CHECK_HEADERS(SDL/SDL.h ,,
234      [AC_MSG_ERROR([cannot find SDL headers]) ])
[2982]235
[3140]236# checking for SDL-lib
[2991]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
[3140]248
[2982]249## checking for SDL
[2991]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"
[2701]257    ;;
[2995]258
259### OS X ###
260 *darwin*)
261echo "OS X detected"
262
263 osX="yes"
264
[3140]265 CPPFLAGS="-I/sw/include $CPPFLAGS"
[2995]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
[3001]276#    AC_CHECK_HEADERS(SDL/SDL.h ,,
277#      [AC_MSG_ERROR([cannot find SDL headers]) ])
[2995]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"
[3140]290
[2995]291    ;;
292
[2701]293  *)
294    ;;
295esac
[2968]296
[2701]297AC_SUBST(MSBITFIELDS)
298
[3140]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 ,,
[3178]303      [echo "sdl_image not found. falling back to other options"; def_sdl_image=no ])
[3140]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
[2701]318
[1959]319
[3140]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
[2980]338
[3140]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
[2980]358## checking for GTK
[3100]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`
[3101]368                AC_DEFINE_UNQUOTED(HAVE_GTK2, 1, [if we have GTK2])
[3100]369        else
370                echo "no"
371        fi
[3101]372
[3099]373fi
[2980]374AC_SUBST(GTK2_LIBS)
375AC_SUBST(GTK2_CFLAGS)
[3100]376AM_CONDITIONAL(HAVE_GTK2, test x$have_gtk2 = xyes)
[2980]377
[3271]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
[3243]397## checking for libcURL
398if test "$def_curl" = yes; then
[2980]399
[3243]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
[3100]410
[3243]411fi
412AC_SUBST(CURL_LIBS)
413AC_SUBST(CURL_CFLAGS)
414AM_CONDITIONAL(HAVE_CURL, test x$have_curl = xyes)
415
416
[3273]417##checking for pthread
[3283]418if test x$def_pthread = xyes ; then
419 if test x$have_gthread = xyes ; then
[3274]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
[3283]425 fi
[3274]426fi
[1945]427# FIXME: Replace `main' with a function in `-lm':
[2968]428 AC_CHECK_LIB([m], [main])
[1945]429
[3099]430 
[1945]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
[1946]442AC_CONFIG_FILES([Makefile
[3191]443                 src/console/Makefile
444                 src/gui/Makefile
[2819]445                 src/Makefile
[3196]446                 src/importer/Makefile])
[1945]447AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.