[1945] | 1 | # -*- Autoconf -*- |
---|
| 2 | # Process this file with autoconf to produce a configure script. |
---|
| 3 | |
---|
[3238] | 4 | AC_PREREQ(2.56) |
---|
[3399] | 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 | |
---|
[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) |
---|
| 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" |
---|
| 41 | fi |
---|
| 42 | AC_DEFINE_UNQUOTED(DEBUG, $DEBUG, [in which debug mode we are]) |
---|
| 43 | |
---|
| 44 | AC_SUBST(DEBUG) |
---|
| 45 | |
---|
| 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 | |
---|
[3399] | 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 | |
---|
[3238] | 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 | |
---|
[3238] | 176 | CPPFLAGS="-I/usr/X11R6/include" |
---|
[3399] | 177 | LDFLAGS="-L/usr/lib/opengl/xorg-x11/lib -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 |
---|
[3399] | 183 | AC_CHECK_LIB([GL], [glLoadIdentity], FOUND_GL=yes) |
---|
[2701] | 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 | |
---|
[3238] | 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 | |
---|
[3238] | 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 | |
---|
[3238] | 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" |
---|
[3238] | 267 | |
---|
[2995] | 268 | ;; |
---|
| 269 | |
---|
[2701] | 270 | *) |
---|
| 271 | ;; |
---|
| 272 | esac |
---|
[2968] | 273 | |
---|
[2701] | 274 | AC_SUBST(MSBITFIELDS) |
---|
| 275 | |
---|
[3238] | 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 ,, |
---|
| 280 | [echo "sdl_image not found. falling back to other options"; def_sdl_image=no ]) |
---|
| 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 | |
---|
[3238] | 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 | |
---|
[3238] | 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 |
---|
[3238] | 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` |
---|
| 345 | AC_DEFINE_UNQUOTED(HAVE_GTK2, 1, [if we have GTK2]) |
---|
| 346 | else |
---|
| 347 | echo "no" |
---|
| 348 | fi |
---|
| 349 | |
---|
| 350 | fi |
---|
[2980] | 351 | AC_SUBST(GTK2_LIBS) |
---|
| 352 | AC_SUBST(GTK2_CFLAGS) |
---|
[3238] | 353 | AM_CONDITIONAL(HAVE_GTK2, test x$have_gtk2 = xyes) |
---|
[2980] | 354 | |
---|
| 355 | |
---|
[3238] | 356 | |
---|
[2190] | 357 | #checking for pthread libs |
---|
[3238] | 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 | |
---|
[3238] | 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 |
---|
[3399] | 380 | src/Makefile |
---|
| 381 | src/importer/Makefile |
---|
[3238] | 382 | src/console/Makefile |
---|
[3399] | 383 | src/gui/Makefile]) |
---|
| 384 | |
---|
[1945] | 385 | AC_OUTPUT |
---|