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