improved turning/panic
[gemrb.git] / configure.in
blobfeaaa1c85456bb16b383328a6c16776dc955317e
1 # -*-autoconf-*-
2 # GemRB - Infinity Engine Emulator
3 # Copyright (C) 2003-2005 The GemRB Project
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 ###################################################
22 # I used fluxbox's configure.in as a template of sorts, and 
23 # Redhat's autotools book. Thanks to everyone involved with 
24 # both of these projects!
25 # The build system was mostly done by edheldil & subvertir
27 dnl Initialize autoconf and automake
29 AC_PREREQ([2.57])
30 AC_INIT(gemrb, 0.6.2-git)
32 AC_MSG_WARN([
35 The autotools build system is NO LONGER MAINTAINED and may be dropped in
36 future versions! Please switch to using cmake instead.
40 AC_CONFIG_AUX_DIR([admin])
41 AC_CONFIG_SRCDIR([gemrb/])
42 AC_CANONICAL_SYSTEM
43 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME,AC_PACKAGE_VERSION)
44 AM_CONFIG_HEADER(config.h)
45 AC_USE_SYSTEM_EXTENSIONS
47 for top_builddir in . .. ../.. $ac_auxdir $ac_auxdir/..; do
48   test -f $top_builddir/configure && break
49 done
51 dnl Check for required software.
52 AC_DISABLE_STATIC
53 AC_PROG_MAKE_SET
54 AC_PROG_CC
55 AC_PROG_CXX
56 AC_PROG_INSTALL
57 AC_PROG_LIBTOOL
59 AC_LANG([C++])
61 if test "x$docdir" = "x" ; then
62   docdir=$datadir/doc
65 AC_ARG_ENABLE(subdirs, AS_HELP_STRING(--disable-subdirs,Install plugins and data directly to LIBDIR and DATADIR), gemrb_use_subdirs=$enableval, gemrb_use_subdirs=yes)
66 if test "x$gemrb_use_subdirs" = "xno" ; then
67   plugindir=$libdir/plugins
68   moddir=$datadir
69 else
70   plugindir=$libdir/gemrb/plugins
71   moddir=$datadir/gemrb
74 AC_ARG_ENABLE(debug, AS_HELP_STRING(--enable-debug,Build in debug mode), gemrb_use_debug=$enableval, gemrb_use_debug=no)
75 if test "x$gemrb_use_debug" = "xyes" ; then
76   CFLAGS="$CFLAGS -O0 -g"
77   CXXFLAGS="$CXXFLAGS -O0 -g"
80 AC_SUBST(plugindir)
81 AC_SUBST(moddir)
82 AC_SUBST(docdir)
85 dnl Check for recent STL with <vector>::at()
86 AC_CHECK_STL_CONTAINER_AT([], [AC_MSG_ERROR([
88 *** Your STL library does not define method container::at().
89 *** It probably means that its version is too old.
90 *** Please upgrade your standard C++ library to version 3.x.
91 ])])
93 dnl Determine prefix.
94 if test "x$prefix" = "xNONE"; then
95   prefix=$ac_default_prefix
96   ac_configure_args="$ac_configure_args --prefix $prefix"
99 dnl Check various functions.
100 AC_CHECK_SIZEOF([char])
101 AC_CHECK_SIZEOF([short int])
102 AC_CHECK_SIZEOF([int])
103 AC_CHECK_SIZEOF([long int])
104 AC_CHECK_SIZEOF([long long int])
105 AC_CHECK_FUNCS([getcwd])
106 AC_CHECK_FUNCS([gettimeofday])
107 AC_CHECK_FUNCS([memchr])
108 AC_CHECK_FUNCS([memmove])
109 AC_CHECK_FUNCS([memset])
110 AC_CHECK_FUNCS([mkdir])
111 AC_CHECK_FUNCS([rmdir])
112 AC_CHECK_FUNCS([sqrt])
113 AC_CHECK_FUNCS([strcasecmp])
114 AC_CHECK_FUNCS([strchr])
115 AC_CHECK_FUNCS([strdup])
116 AC_CHECK_FUNCS([strrchr])
117 AC_CHECK_FUNCS([strstr])
118 AC_CHECK_FUNCS([strtol])
119 AC_CHECK_FUNCS([strtoul])
120 AC_CHECK_FUNCS([strndup])
121 AC_CHECK_FUNCS([strnlen])
122 AC_CHECK_FUNCS([snprintf])
123 AC_CHECK_HEADERS([fcntl.h])
124 AC_CHECK_HEADERS([stddef.h])
125 AC_CHECK_HEADERS([sys/time.h])
126 AC_CHECK_HEADERS([sys/stat.h])
127 AC_CHECK_LIB(dl, dlopen, [LIBDL="-ldl"], [LIBDL=""])
128 AC_SUBST(LIBDL)
130 AC_CHECK_PTHREADS
132 dnl Check for zlib.
133 CHECK_ZLIB()
135 dnl Check for libSDL Version 1.2 or greater, fail if not found.
136 AM_PATH_SDL(1.2.0, [], [AC_MSG_ERROR([
138 *** You need LibSDL (www.libsdl.org) version 1.2.0 or greater to compile GemRB
139 ])])
141 dnl Check for OpenAL, fail if not found.
142 AM_PATH_OPENAL([], [AC_MSG_ERROR([
144 *** You need OpenAL (www.openal.org) to compile GemRB
145 ])])
147 #AC_CHECK_LIB([openal], [alGetError], [ $(which true) ], [AC_MSG_ERROR([
148 #*** You need OpenAL (www.openal.org) to compile GemRB
149 #])])
150 ##AC_CHECK_LIB([alut], [alutInit], [ $(which true) ], [AC_MSG_ERROR([
151 ##*** You need OpenAL (www.openal.org) to compile GemRB
152 ##])])
153 #OPENAL_LIBS="`openal-config --libs`"
155 ##GEMRB_CHECK_ALUT()
157 dnl Check for Python version >= 2.3.0, fail if not found.
158 AM_PATH_PYTHON(2.3.0, [], [AC_MSG_ERROR([
160 *** You need Python (www.python.org) version 2.3.0 or greater to compile GemRB
161 ])])
163 dnl Check for Python headers and libraries, fail if not found.
164 AM_CHECK_PYTHON_HEADERS([], [AC_MSG_ERROR([
166 *** You need Python >=2.3.0 headers installed to compile GemRB
167 *** See if your distribution offers -dev packages!
168 ])])
170 dnl Check for Python libraries, fail if not found.
171 AM_CHECK_PYTHON_LIBS([], [AC_MSG_ERROR([
173 *** You need Python >=2.3.0 shared libraries installed to compile GemRB
174 *** Maybe you need to recompile python with --shared-libs
175 ])])
178 AC_CHECK_HEADER([vorbis/vorbisfile.h],
179         [AC_CHECK_LIB(vorbisfile, ov_info,
180                 [AC_DEFINE( HAS_VORBIS_SUPPORT, 1, [Handling of .ogg soundfiles])
181                 vorbis_ok=yes],[vorbis_ok=no], -lvorbis )],
182         [vorbis_ok=no])
183 AM_CONDITIONAL([VORBIS], [test x$vorbis_ok = xyes])
185 dnl FIXME: check for libpng properly, using libpng(12)-config
186 AC_CHECK_HEADER(png.h,,AC_MSG_ERROR([*** libpng not found!]))
187 AC_CHECK_LIB(png,png_create_read_struct,,AC_MSG_ERROR([*** libpng not found!]))
188 AC_SUBST(LIBPNG,-lpng)
190 AC_C_CONST
191 AC_C_INLINE
192 AC_C_RESTRICT
193 AC_C_VOLATILE
194 AC_FUNC_CLOSEDIR_VOID
195 AC_FUNC_MALLOC
196 AC_FUNC_MEMCMP
197 AC_FUNC_REALLOC
198 AC_FUNC_STAT
199 AC_FUNC_STRFTIME
200 AC_FUNC_STRNLEN
201 AC_HEADER_DIRENT
202 AC_HEADER_STDBOOL
203 AC_HEADER_STAT
204 AC_HEADER_TIME
205 AC_REPLACE_FNMATCH
206 AC_STRUCT_TM
207 AC_TYPE_SIZE_T
209 CPPFLAGS="$CPPFLAGS -DSYSCONFDIR=\\\"\$(sysconfdir)\\\" -DDATADIR=\\\"\$(moddir)\\\" -DPLUGINDIR=\\\"\$(plugindir)\\\""
210 CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/gemrb/includes -I\$(top_srcdir)/gemrb/core"
211 CXXFLAGS="$CXXFLAGS -Wall -W -Wpointer-arith -Wcast-align -pedantic -Wno-format-y2k -Wno-long-long -fno-strict-aliasing"
213 AC_ARG_ENABLE(werror, AS_HELP_STRING(--disable-werror,Make compiler warning non-fatal.), enable_werror=$enableval, enable_werror=yes)
214 if test "x$enable_werror" = "xyes" ; then
215   CXXFLAGS="$CXXFLAGS -Werror"
218 # only export symbols explicitly marked to be exported
219 CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
221 dnl Check for "ISO C++ forbids casting between pointer-to-function and pointer-to-object" as in GCC4
222 AC_CHECK_OBJECT_TO_FUNCTION_CAST
225 AC_SUBST(LIBS)
226 AC_SUBST(OPENAL_LIBS)
228 AC_CONFIG_FILES([
229 Makefile
230 gemrb/Makefile 
231 gemrb/core/Makefile
232 gemrb/includes/Makefile 
233 gemrb/override/Makefile
234 gemrb/override/bg1/Makefile
235 gemrb/override/bg2/Makefile
236 gemrb/override/how/Makefile
237 gemrb/override/iwd/Makefile
238 gemrb/override/iwd2/Makefile
239 gemrb/override/pst/Makefile
240 gemrb/override/shared/Makefile
241 gemrb/GUIScripts/Makefile
242 gemrb/GUIScripts/bg1/Makefile
243 gemrb/GUIScripts/bg2/Makefile
244 gemrb/GUIScripts/iwd/Makefile
245 gemrb/GUIScripts/iwd2/Makefile
246 gemrb/GUIScripts/pst/Makefile
247 gemrb/plugins/Makefile 
248 gemrb/plugins/2DAImporter/Makefile 
249 gemrb/plugins/ACMReader/Makefile
250 gemrb/plugins/OGGReader/Makefile
251 gemrb/plugins/WAVReader/Makefile
252 gemrb/plugins/AREImporter/Makefile 
253 gemrb/plugins/BAMImporter/Makefile 
254 gemrb/plugins/BIFImporter/Makefile 
255 gemrb/plugins/BIKPlayer/Makefile
256 gemrb/plugins/BMPImporter/Makefile 
257 gemrb/plugins/BMPWriter/Makefile
258 gemrb/plugins/PNGImporter/Makefile 
259 gemrb/plugins/CHUImporter/Makefile 
260 gemrb/plugins/CREImporter/Makefile 
261 gemrb/plugins/DLGImporter/Makefile 
262 gemrb/plugins/EFFImporter/Makefile 
263 gemrb/plugins/FXOpcodes/Makefile 
264 gemrb/plugins/IWDOpcodes/Makefile 
265 gemrb/plugins/PSTOpcodes/Makefile 
266 gemrb/plugins/GAMImporter/Makefile 
267 gemrb/plugins/GUIScript/Makefile 
268 gemrb/plugins/IDSImporter/Makefile 
269 gemrb/plugins/INIImporter/Makefile 
270 gemrb/plugins/ITMImporter/Makefile 
271 gemrb/plugins/KEYImporter/Makefile 
272 gemrb/plugins/DirectoryImporter/Makefile
273 gemrb/plugins/MOSImporter/Makefile 
274 gemrb/plugins/MUSImporter/Makefile 
275 gemrb/plugins/MVEPlayer/Makefile
276 gemrb/plugins/NullSound/Makefile 
277 gemrb/plugins/OpenALAudio/Makefile 
278 gemrb/plugins/PLTImporter/Makefile 
279 gemrb/plugins/PROImporter/Makefile 
280 gemrb/plugins/SDLVideo/Makefile 
281 gemrb/plugins/SPLImporter/Makefile 
282 gemrb/plugins/STOImporter/Makefile 
283 gemrb/plugins/TISImporter/Makefile 
284 gemrb/plugins/TLKImporter/Makefile 
285 gemrb/plugins/WEDImporter/Makefile 
286 gemrb/plugins/WMPImporter/Makefile 
287 gemrb/plugins/ZLibManager/Makefile
288 gemrb/docs/Makefile 
289 gemrb/docs/en/Makefile 
290 gemrb/docs/en/GUIScript/Makefile 
291 gemrb/docs/en/Tables/Makefile 
292 gemrb/docs/en/Engine/Makefile 
294 AC_CONFIG_FILES([gemrb.spec])
295 AC_OUTPUT