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