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 | |
---|
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 | |
---|
40 | ### CHECKING FOR SYSTEM ### |
---|
41 | |
---|
42 | AC_MSG_CHECKING([for System]) |
---|
43 | ## checking for openGL-environment and other sys-specific parameters |
---|
44 | case "$target" in |
---|
45 | ### WINDOWS ### |
---|
46 | *-*-mingw32*) |
---|
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 | |
---|
56 | # checking gl header |
---|
57 | AC_CHECK_HEADERS(GL/gl.h ,, |
---|
58 | [AC_MSG_ERROR([cannot find opengl headers]) ]) |
---|
59 | # checking for Windows openGl library |
---|
60 | AC_CHECK_LIB([opengl32], [main], FOUND_opengl32=yes, "gl/gl.h") |
---|
61 | if test "$FOUND_opengl32" = "yes" ; then |
---|
62 | LIBS="$LIBS -lopengl32" |
---|
63 | else |
---|
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 | |
---|
71 | # cheking for GLU-header |
---|
72 | AC_CHECK_HEADERS(GL/glu.h ,, |
---|
73 | [AC_MSG_ERROR([cannot find opengl headers]) ]) |
---|
74 | |
---|
75 | # checking for libGLU |
---|
76 | AC_CHECK_LIB([glu32], [main], FOUND_glu32=yes) |
---|
77 | if test "$FOUND_glu32" = "yes" ; then |
---|
78 | LIBS="$LIBS -lGLU32" |
---|
79 | else |
---|
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 |
---|
86 | |
---|
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 |
---|
92 | # checking for SDL-headers |
---|
93 | AC_CHECK_HEADERS(SDL/SDL.h ,, |
---|
94 | [AC_MSG_ERROR([cannot find SDL headers]) ]) |
---|
95 | |
---|
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 | |
---|
119 | ;; |
---|
120 | |
---|
121 | ### LINUX ### |
---|
122 | *-*-linux*) |
---|
123 | echo "Linux detected" |
---|
124 | |
---|
125 | Linux="yes" |
---|
126 | |
---|
127 | # checking gl header |
---|
128 | AC_CHECK_HEADERS(GL/gl.h ,, |
---|
129 | [AC_MSG_ERROR([cannot find opengl headers]) ]) |
---|
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 |
---|
157 | |
---|
158 | # checking for SDL-headers |
---|
159 | AC_CHECK_HEADERS(SDL/SDL.h ,, |
---|
160 | [AC_MSG_ERROR([cannot find SDL headers]) ]) |
---|
161 | |
---|
162 | # checking for SDL-libs |
---|
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 | |
---|
174 | ## checking for SDL |
---|
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" |
---|
182 | ;; |
---|
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 |
---|
200 | # AC_CHECK_HEADERS(SDL/SDL.h ,, |
---|
201 | # [AC_MSG_ERROR([cannot find SDL headers]) ]) |
---|
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 | |
---|
216 | *) |
---|
217 | ;; |
---|
218 | esac |
---|
219 | |
---|
220 | AC_SUBST(MSBITFIELDS) |
---|
221 | |
---|
222 | |
---|
223 | |
---|
224 | |
---|
225 | ## checking for GTK |
---|
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` |
---|
235 | AC_DEFINE_UNQUOTED(HAVE_GTK2, 1, [if we have GTK2]) |
---|
236 | else |
---|
237 | echo "no" |
---|
238 | fi |
---|
239 | |
---|
240 | fi |
---|
241 | AC_SUBST(GTK2_LIBS) |
---|
242 | AC_SUBST(GTK2_CFLAGS) |
---|
243 | AM_CONDITIONAL(HAVE_GTK2, test x$have_gtk2 = xyes) |
---|
244 | |
---|
245 | |
---|
246 | |
---|
247 | #checking for pthread libs |
---|
248 | AC_CHECK_LIB([pthread], [main], FOUND_pthread=yes) |
---|
249 | if test "$FOUND_pthread" = "yes" ; then |
---|
250 | LIBS="$LIBS -lpthread" |
---|
251 | fi |
---|
252 | |
---|
253 | |
---|
254 | # FIXME: Replace `main' with a function in `-lm': |
---|
255 | AC_CHECK_LIB([m], [main]) |
---|
256 | |
---|
257 | |
---|
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 | |
---|
269 | AC_CONFIG_FILES([Makefile |
---|
270 | console/Makefile |
---|
271 | gui/Makefile |
---|
272 | src/Makefile |
---|
273 | importer/Makefile]) |
---|
274 | AC_OUTPUT |
---|