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