| 1 | #                                               -*- Autoconf -*- | 
|---|
| 2 | # Process this file with autoconf to produce a configure script. | 
|---|
| 3 |  | 
|---|
| 4 | #AC_PREREQ(2.56) | 
|---|
| 5 | AC_INIT(orxonox, 0.1-pre-alpha, orxonox-dev@mail.datacore.ch) | 
|---|
| 6 |  | 
|---|
| 7 | # Detect the canonical host and target build environment. | 
|---|
| 8 | AC_CANONICAL_BUILD | 
|---|
| 9 | AC_CANONICAL_HOST | 
|---|
| 10 | AC_CANONICAL_TARGET | 
|---|
| 11 |  | 
|---|
| 12 |  | 
|---|
| 13 | AM_INIT_AUTOMAKE | 
|---|
| 14 |  | 
|---|
| 15 | AC_CONFIG_SRCDIR([.]) | 
|---|
| 16 | AC_CONFIG_HEADER([config.h]) | 
|---|
| 17 |  | 
|---|
| 18 |  | 
|---|
| 19 | # Checks for programs. | 
|---|
| 20 | AC_PROG_CXX | 
|---|
| 21 | AC_HEADER_STDC | 
|---|
| 22 |  | 
|---|
| 23 | ### CHECKING FOR SYSTEM ### | 
|---|
| 24 |  | 
|---|
| 25 | AC_MSG_CHECKING([for System]) | 
|---|
| 26 | ## checking for openGL-environment and other sys-specific parameters | 
|---|
| 27 | case "$target" in | 
|---|
| 28 | ### WINDOWS ### | 
|---|
| 29 |   *-*-mingw32*) | 
|---|
| 30 | echo "mingw-WINDOWS detected" | 
|---|
| 31 |  | 
|---|
| 32 |     mingw="yes" | 
|---|
| 33 |     MSBITFIELDS="-mms-bitfields" | 
|---|
| 34 |     MWINDOWS="-mwindows" | 
|---|
| 35 |  | 
|---|
| 36 | # checking gl header | 
|---|
| 37 |         #done before loop | 
|---|
| 38 |  | 
|---|
| 39 | # checking gl header | 
|---|
| 40 |    AC_CHECK_HEADERS(GL/gl.h ,, | 
|---|
| 41 |       [AC_MSG_ERROR([cannot find opengl headers]) ]) | 
|---|
| 42 | #   checking for Windows openGl library | 
|---|
| 43 |     AC_CHECK_LIB([opengl32], [main], FOUND_opengl32=yes, "gl/gl.h") | 
|---|
| 44 |     if test "$FOUND_opengl32" = "yes" ; then | 
|---|
| 45 |         LIBS="$LIBS -lopengl32" | 
|---|
| 46 |     else | 
|---|
| 47 |          echo "------------------" | 
|---|
| 48 |          echo "opengl not found." | 
|---|
| 49 |          echo "please install the opengl package which can be found at http://www.opengl.org" | 
|---|
| 50 |          echo "------------------" | 
|---|
| 51 |          exit -1 | 
|---|
| 52 |     fi | 
|---|
| 53 |  | 
|---|
| 54 | # cheking for GLU-header | 
|---|
| 55 |     AC_CHECK_HEADERS(GL/glu.h ,, | 
|---|
| 56 |       [AC_MSG_ERROR([cannot find opengl headers]) ]) | 
|---|
| 57 |  | 
|---|
| 58 | # checking for libGLU | 
|---|
| 59 |     AC_CHECK_LIB([glu32], [main], FOUND_glu32=yes) | 
|---|
| 60 |     if test "$FOUND_glu32" = "yes" ; then | 
|---|
| 61 |         LIBS="$LIBS -lGLU32" | 
|---|
| 62 |     else | 
|---|
| 63 |          echo "------------------" | 
|---|
| 64 |          echo "GLU library not found." | 
|---|
| 65 |          echo "please install the GLU library, that should come with openGL, which can be found at http://www.opengl.org" | 
|---|
| 66 |          echo "------------------" | 
|---|
| 67 |          exit -1 | 
|---|
| 68 |     fi | 
|---|
| 69 |  | 
|---|
| 70 | # checking for mingw32 | 
|---|
| 71 |     AC_CHECK_LIB([mingw32], [main], FOUND_mingw32=yes) | 
|---|
| 72 |     if test $FOUND_mingw32 = "yes"; then  | 
|---|
| 73 |         LIBS="$LIBS -lmingw32" | 
|---|
| 74 |     fi | 
|---|
| 75 | # checking for SDL-headers | 
|---|
| 76 |     AC_CHECK_HEADERS(SDL/SDL.h ,, | 
|---|
| 77 |       [AC_MSG_ERROR([cannot find SDL headers]) ]) | 
|---|
| 78 |  | 
|---|
| 79 | #checking for libSDL | 
|---|
| 80 |     AC_CHECK_LIB([sdlmain], [main], FOUND_sdlmain=yes) | 
|---|
| 81 |     if test "$FOUND_sdlmain" = "yes" ; then | 
|---|
| 82 |        LIBS="$LIBS -lsdlmain" | 
|---|
| 83 |     else | 
|---|
| 84 |         echo "------------------" | 
|---|
| 85 |         echo "SDL library not found." | 
|---|
| 86 |         echo "please install the SDL library, which can be found at http://www.libsdl.org" | 
|---|
| 87 |         echo "------------------" | 
|---|
| 88 |         exit 1 | 
|---|
| 89 |     fi | 
|---|
| 90 |     AC_CHECK_LIB([sdl], [main], FOUND_sdl=yes) | 
|---|
| 91 |     if test "$FOUND_sdl" = "yes" ; then | 
|---|
| 92 |        LIBS="$LIBS -lsdl" | 
|---|
| 93 |     else | 
|---|
| 94 |         echo "------------------" | 
|---|
| 95 |         echo "SDL library not found." | 
|---|
| 96 |         echo "please install the SDL library, which can be found at http://www.libsdl.org" | 
|---|
| 97 |         echo "------------------" | 
|---|
| 98 |         exit -1 | 
|---|
| 99 |     fi | 
|---|
| 100 |  | 
|---|
| 101 |  | 
|---|
| 102 |     ;; | 
|---|
| 103 |  | 
|---|
| 104 | ### LINUX ### | 
|---|
| 105 |  *-*-linux*) | 
|---|
| 106 | echo "Linux detected" | 
|---|
| 107 |  | 
|---|
| 108 |  Linux="yes" | 
|---|
| 109 |  | 
|---|
| 110 | # checking gl header | 
|---|
| 111 |    AC_CHECK_HEADERS(GL/gl.h ,, | 
|---|
| 112 |       [AC_MSG_ERROR([cannot find opengl headers]) ]) | 
|---|
| 113 |  | 
|---|
| 114 | #  checking for Unix GL | 
|---|
| 115 |    AC_CHECK_LIB([GL], [main], FOUND_GL=yes) | 
|---|
| 116 |    if test "$FOUND_GL" = "yes" ; then | 
|---|
| 117 |      LIBS="$LIBS -lGL" | 
|---|
| 118 |    else | 
|---|
| 119 |          echo "------------------" | 
|---|
| 120 |          echo "opengl not found." | 
|---|
| 121 |          echo "please install the opengl package which can be found at http://www.opengl.org" | 
|---|
| 122 |          echo "------------------" | 
|---|
| 123 |          exit -1 | 
|---|
| 124 |    fi | 
|---|
| 125 |  | 
|---|
| 126 | # cheking for GLU-header | 
|---|
| 127 |     AC_CHECK_HEADERS(GL/glu.h ,, | 
|---|
| 128 |       [AC_MSG_ERROR([cannot find opengl headers]) ]) | 
|---|
| 129 |  | 
|---|
| 130 |     AC_CHECK_LIB([GLU], [gluProject], FOUND_GLU=yes) | 
|---|
| 131 |     if test "$FOUND_GLU" = "yes" ; then | 
|---|
| 132 |       LIBS="$LIBS -lGLU" | 
|---|
| 133 |     else | 
|---|
| 134 |          echo "------------------" | 
|---|
| 135 |          echo "GLU library not found." | 
|---|
| 136 |          echo "please install the GLU library, that should come with openGL, which can be found at http://www.opengl.org" | 
|---|
| 137 |          echo "------------------" | 
|---|
| 138 |          exit -1 | 
|---|
| 139 |     fi    | 
|---|
| 140 |  | 
|---|
| 141 | # checking for SDL-headers | 
|---|
| 142 |     AC_CHECK_HEADERS(SDL/SDL.h ,, | 
|---|
| 143 |       [AC_MSG_ERROR([cannot find SDL headers]) ]) | 
|---|
| 144 |  | 
|---|
| 145 | # checking for SDL-libs | 
|---|
| 146 |     AC_CHECK_LIB([SDL], [main], FOUND_SDL=yes) | 
|---|
| 147 |      if test "$FOUND_SDL" = "yes" ; then | 
|---|
| 148 |        LIBS="$LIBS -lSDL" | 
|---|
| 149 |      else | 
|---|
| 150 |         echo "------------------" | 
|---|
| 151 |         echo "SDL library not found." | 
|---|
| 152 |         echo "please install the SDL library, which can be found at http://www.libsdl.org" | 
|---|
| 153 |         echo "------------------" | 
|---|
| 154 |         exit -1 | 
|---|
| 155 |      fi    | 
|---|
| 156 |  | 
|---|
| 157 | ## checking for SDL | 
|---|
| 158 | #    SDL_VERSION=1.2.7 | 
|---|
| 159 | #    AM_PATH_SDL($SDL_VERSION, | 
|---|
| 160 | #      :, | 
|---|
| 161 | #      AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]) | 
|---|
| 162 | #      ) | 
|---|
| 163 | #    CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" | 
|---|
| 164 | #    LIBS="$LIBS $SDL_LIBS" | 
|---|
| 165 |     ;; | 
|---|
| 166 |  | 
|---|
| 167 | ### OS X ### | 
|---|
| 168 |  *darwin*) | 
|---|
| 169 | echo "OS X detected" | 
|---|
| 170 |  | 
|---|
| 171 |  osX="yes" | 
|---|
| 172 |  | 
|---|
| 173 | # checking gl header | 
|---|
| 174 |    AC_CHECK_HEADERS(OpenGL/gl.h ,, | 
|---|
| 175 |       [AC_MSG_ERROR([cannot find opengl headers]) ]) | 
|---|
| 176 | # cheking for GLU-header | 
|---|
| 177 |     AC_CHECK_HEADERS(OpenGL/glu.h ,, | 
|---|
| 178 |       [AC_MSG_ERROR([cannot find opengl headers]) ]) | 
|---|
| 179 |  | 
|---|
| 180 |    LIBS="$LIBS -framework OpenGL" | 
|---|
| 181 |  | 
|---|
| 182 | # checking for SDL-headers | 
|---|
| 183 | #    AC_CHECK_HEADERS(SDL/SDL.h ,, | 
|---|
| 184 | #      [AC_MSG_ERROR([cannot find SDL headers]) ]) | 
|---|
| 185 |  | 
|---|
| 186 | ## checking for SDL | 
|---|
| 187 | #    SDL_VERSION=1.2.7 | 
|---|
| 188 | #    AM_PATH_SDL($SDL_VERSION, | 
|---|
| 189 | #      :, | 
|---|
| 190 | #      AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]) | 
|---|
| 191 | #      ) | 
|---|
| 192 |  | 
|---|
| 193 |        SDL_CFLAGS=`sdl-config --cflags` | 
|---|
| 194 |        SDL_LIBS=`sdl-config --libs` | 
|---|
| 195 |        CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" | 
|---|
| 196 |        LIBS="$LIBS $SDL_LIBS" | 
|---|
| 197 |     ;; | 
|---|
| 198 |  | 
|---|
| 199 |   *) | 
|---|
| 200 |     ;; | 
|---|
| 201 | esac | 
|---|
| 202 |  | 
|---|
| 203 | AC_SUBST(MSBITFIELDS) | 
|---|
| 204 |  | 
|---|
| 205 |  | 
|---|
| 206 |  | 
|---|
| 207 |  | 
|---|
| 208 | ## checking for GTK | 
|---|
| 209 | PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.0.3 gthread-2.0 >= 2.0.3, have_gtk2=yes, have_gtk2=no) | 
|---|
| 210 | AC_SUBST(GTK2_LIBS) | 
|---|
| 211 | AC_SUBST(GTK2_CFLAGS) | 
|---|
| 212 | AM_CONDITIONAL(HAVE_GTK2, test "x$have_gtk2" = xyes) | 
|---|
| 213 |  | 
|---|
| 214 |  | 
|---|
| 215 | #checking for pthread libs | 
|---|
| 216 |  AC_CHECK_LIB([pthread], [main], FOUND_pthread=yes) | 
|---|
| 217 |  if test "$FOUND_pthread" = "yes" ; then | 
|---|
| 218 |     LIBS="$LIBS -lpthread" | 
|---|
| 219 |  fi | 
|---|
| 220 |  | 
|---|
| 221 |  | 
|---|
| 222 | # FIXME: Replace `main' with a function in `-lm': | 
|---|
| 223 |  AC_CHECK_LIB([m], [main]) | 
|---|
| 224 |  | 
|---|
| 225 |  | 
|---|
| 226 | # Checks for header files. | 
|---|
| 227 | AC_HEADER_STDC | 
|---|
| 228 | AC_CHECK_HEADERS([stdlib.h string.h]) | 
|---|
| 229 |  | 
|---|
| 230 | # Checks for typedefs, structures, and compiler characteristics. | 
|---|
| 231 | AC_HEADER_STDBOOL | 
|---|
| 232 |  | 
|---|
| 233 | # Checks for library functions. | 
|---|
| 234 | AC_FUNC_MALLOC | 
|---|
| 235 | AC_CHECK_FUNCS([bzero sqrt]) | 
|---|
| 236 |  | 
|---|
| 237 | AC_CONFIG_FILES([Makefile | 
|---|
| 238 |                  console/Makefile | 
|---|
| 239 |                  gui/Makefile | 
|---|
| 240 |                  src/Makefile | 
|---|
| 241 |                  importer/Makefile]) | 
|---|
| 242 | AC_OUTPUT | 
|---|