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