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