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