Merge branch 'savegame'
[gemrb.git] / configure.in
blob37cd0235d81d2a92bafe9e1d279cd26a60b79870
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.0)
32 AC_CONFIG_AUX_DIR([admin])
33 AC_CONFIG_SRCDIR([gemrb/])
34 AC_CANONICAL_SYSTEM
35 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME,AC_PACKAGE_VERSION)
36 AM_CONFIG_HEADER(config.h)
37 AC_USE_SYSTEM_EXTENSIONS
39 for top_builddir in . .. ../.. $ac_auxdir $ac_auxdir/..; do
40   test -f $top_builddir/configure && break
41 done
43 dnl Check for required software.
44 AC_DISABLE_STATIC
45 AC_PROG_MAKE_SET
46 AC_PROG_CC
47 AC_PROG_CXX
48 AC_PROG_INSTALL
49 AC_PROG_LIBTOOL
51 AC_LANG([C++])
53 if test "x$docdir" = "x" ; then
54   docdir=$datadir/doc
57 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)
58 if test "x$gemrb_use_subdirs" = "xno" ; then
59   plugindir=$libdir/plugins
60   moddir=$datadir
61 else
62   plugindir=$libdir/gemrb/plugins
63   moddir=$datadir/gemrb
66 AC_ARG_ENABLE(debug, AS_HELP_STRING(--enable-debug,Build in debug mode), gemrb_use_debug=$enableval, gemrb_use_debug=no)
67 if test "x$gemrb_use_debug" = "xyes" ; then
68   CFLAGS="$CFLAGS -O0 -g"
69   CXXFLAGS="$CXXFLAGS -O0 -g"
72 AC_SUBST(plugindir)
73 AC_SUBST(moddir)
74 AC_SUBST(docdir)
77 dnl Check for recent STL with <vector>::at()
78 AC_CHECK_STL_CONTAINER_AT([], [AC_MSG_ERROR([
80 *** Your STL library does not define method container::at().
81 *** It probably means that its version is too old.
82 *** Please upgrade your standard C++ library to version 3.x.
83 ])])
85 dnl Determine prefix.
86 if test "x$prefix" = "xNONE"; then
87   prefix=$ac_default_prefix
88   ac_configure_args="$ac_configure_args --prefix $prefix"
91 dnl Check various functions.
92 AC_CHECK_SIZEOF([char])
93 AC_CHECK_SIZEOF([short int])
94 AC_CHECK_SIZEOF([int])
95 AC_CHECK_SIZEOF([long int])
96 AC_CHECK_SIZEOF([long long int])
97 AC_CHECK_FUNCS([getcwd])
98 AC_CHECK_FUNCS([gettimeofday])
99 AC_CHECK_FUNCS([memchr])
100 AC_CHECK_FUNCS([memmove])
101 AC_CHECK_FUNCS([memset])
102 AC_CHECK_FUNCS([mkdir])
103 AC_CHECK_FUNCS([rmdir])
104 AC_CHECK_FUNCS([sqrt])
105 AC_CHECK_FUNCS([strcasecmp])
106 AC_CHECK_FUNCS([strchr])
107 AC_CHECK_FUNCS([strdup])
108 AC_CHECK_FUNCS([strrchr])
109 AC_CHECK_FUNCS([strstr])
110 AC_CHECK_FUNCS([strtol])
111 AC_CHECK_FUNCS([strtoul])
112 AC_CHECK_FUNCS([strndup])
113 AC_CHECK_FUNCS([strnlen])
114 AC_CHECK_FUNCS([snprintf])
115 AC_CHECK_HEADERS([fcntl.h])
116 AC_CHECK_HEADERS([stddef.h])
117 AC_CHECK_HEADERS([sys/time.h])
118 AC_CHECK_HEADERS([sys/stat.h])
119 AC_CHECK_LIB(dl, dlopen, [LIBDL="-ldl"], [LIBDL=""])
120 AC_SUBST(LIBDL)
122 AC_CHECK_PTHREADS
124 dnl Check for zlib.
125 CHECK_ZLIB()
127 dnl Check for libSDL Version 1.2 or greater, fail if not found.
128 AM_PATH_SDL(1.2.0, [], [AC_MSG_ERROR([
130 *** You need LibSDL (www.libsdl.org) version 1.2.0 or greater to compile GemRB
131 ])])
133 dnl Check for OpenAL, fail if not found.
134 AM_PATH_OPENAL([], [AC_MSG_ERROR([
136 *** You need OpenAL (www.openal.org) to compile GemRB
137 ])])
139 #AC_CHECK_LIB([openal], [alGetError], [ $(which true) ], [AC_MSG_ERROR([
140 #*** You need OpenAL (www.openal.org) to compile GemRB
141 #])])
142 ##AC_CHECK_LIB([alut], [alutInit], [ $(which true) ], [AC_MSG_ERROR([
143 ##*** You need OpenAL (www.openal.org) to compile GemRB
144 ##])])
145 #OPENAL_LIBS="`openal-config --libs`"
147 ##GEMRB_CHECK_ALUT()
149 dnl Check for Python version >= 2.3.0, fail if not found.
150 AM_PATH_PYTHON(2.3.0, [], [AC_MSG_ERROR([
152 *** You need Python (www.python.org) version 2.3.0 or greater to compile GemRB
153 ])])
155 dnl Check for Python headers and libraries, fail if not found.
156 AM_CHECK_PYTHON_HEADERS([], [AC_MSG_ERROR([
158 *** You need Python >=2.3.0 headers installed to compile GemRB
159 *** See if your distribution offers -dev packages!
160 ])])
162 dnl Check for Python libraries, fail if not found.
163 AM_CHECK_PYTHON_LIBS([], [AC_MSG_ERROR([
165 *** You need Python >=2.3.0 shared libraries installed to compile GemRB
166 *** Maybe you need to recompile python with --shared-libs
167 ])])
170 AC_CHECK_HEADER([vorbis/vorbisfile.h],
171         [AC_CHECK_LIB(vorbisfile, ov_info,
172                 [AC_DEFINE( HAS_VORBIS_SUPPORT, 1, [Handling of .ogg soundfiles])
173                 vorbis_ok=yes],[vorbis_ok=no], -lvorbis )],
174         [vorbis_ok=no])
175 AM_CONDITIONAL([VORBIS], [test x$vorbis_ok = xyes])
177 dnl FIXME: check for libpng properly, using libpng(12)-config
178 AC_CHECK_HEADER(png.h,,AC_MSG_ERROR([*** libpng not found!]))
179 AC_CHECK_LIB(png,png_create_read_struct,,AC_MSG_ERROR([*** libpng not found!]))
180 AC_SUBST(LIBPNG,-lpng)
182 AC_C_CONST
183 AC_C_INLINE
184 AC_C_RESTRICT
185 AC_C_VOLATILE
186 AC_FUNC_CLOSEDIR_VOID
187 AC_FUNC_MALLOC
188 AC_FUNC_MEMCMP
189 AC_FUNC_REALLOC
190 AC_FUNC_STAT
191 AC_FUNC_STRFTIME
192 AC_FUNC_STRNLEN
193 AC_HEADER_DIRENT
194 AC_HEADER_STDBOOL
195 AC_HEADER_STAT
196 AC_HEADER_TIME
197 AC_REPLACE_FNMATCH
198 AC_STRUCT_TM
199 AC_TYPE_SIZE_T
201 CPPFLAGS="$CPPFLAGS -DSYSCONFDIR=\\\"\$(sysconfdir)\\\" -DDATADIR=\\\"\$(moddir)\\\" -DPLUGINDIR=\\\"\$(plugindir)\\\""
202 CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/gemrb/includes -I\$(top_srcdir)/gemrb/core"
203 CXXFLAGS="$CXXFLAGS -Werror -Wall -W -Wpointer-arith -Wcast-align -pedantic -Wno-format-y2k -Wno-long-long -fno-strict-aliasing"
205 # only export symbols explicitly marked to be exported
206 CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
208 dnl Check for "ISO C++ forbids casting between pointer-to-function and pointer-to-object" as in GCC4
209 AC_CHECK_OBJECT_TO_FUNCTION_CAST
212 AC_SUBST(LIBS)
213 AC_SUBST(OPENAL_LIBS)
215 AC_CONFIG_FILES([
216 Makefile
217 gemrb/Makefile 
218 gemrb/core/Makefile
219 gemrb/includes/Makefile 
220 gemrb/override/Makefile
221 gemrb/override/bg1/Makefile
222 gemrb/override/bg2/Makefile
223 gemrb/override/how/Makefile
224 gemrb/override/iwd/Makefile
225 gemrb/override/iwd2/Makefile
226 gemrb/override/pst/Makefile
227 gemrb/override/shared/Makefile
228 gemrb/override/test1/Makefile
229 gemrb/GUIScripts/Makefile
230 gemrb/GUIScripts/bg1/Makefile
231 gemrb/GUIScripts/bg2/Makefile
232 gemrb/GUIScripts/iwd/Makefile
233 gemrb/GUIScripts/iwd2/Makefile
234 gemrb/GUIScripts/pst/Makefile
235 gemrb/GUIScripts/test1/Makefile
236 gemrb/plugins/Makefile 
237 gemrb/plugins/2DAImporter/Makefile 
238 gemrb/plugins/ACMReader/Makefile
239 gemrb/plugins/OGGReader/Makefile
240 gemrb/plugins/WAVReader/Makefile
241 gemrb/plugins/AREImporter/Makefile 
242 gemrb/plugins/BAMImporter/Makefile 
243 gemrb/plugins/BIFImporter/Makefile 
244 gemrb/plugins/BIKPlayer/Makefile
245 gemrb/plugins/BMPImporter/Makefile 
246 gemrb/plugins/BMPWriter/Makefile
247 gemrb/plugins/PNGImporter/Makefile 
248 gemrb/plugins/CHUImporter/Makefile 
249 gemrb/plugins/CREImporter/Makefile 
250 gemrb/plugins/DLGImporter/Makefile 
251 gemrb/plugins/EFFImporter/Makefile 
252 gemrb/plugins/FXOpcodes/Makefile 
253 gemrb/plugins/IWDOpcodes/Makefile 
254 gemrb/plugins/PSTOpcodes/Makefile 
255 gemrb/plugins/GAMImporter/Makefile 
256 gemrb/plugins/GUIScript/Makefile 
257 gemrb/plugins/IDSImporter/Makefile 
258 gemrb/plugins/INIImporter/Makefile 
259 gemrb/plugins/ITMImporter/Makefile 
260 gemrb/plugins/KEYImporter/Makefile 
261 gemrb/plugins/DirectoryImporter/Makefile
262 gemrb/plugins/MOSImporter/Makefile 
263 gemrb/plugins/MUSImporter/Makefile 
264 gemrb/plugins/MVEPlayer/Makefile
265 gemrb/plugins/NullSound/Makefile 
266 gemrb/plugins/OpenALAudio/Makefile 
267 gemrb/plugins/PLTImporter/Makefile 
268 gemrb/plugins/PROImporter/Makefile 
269 gemrb/plugins/SDLVideo/Makefile 
270 gemrb/plugins/SPLImporter/Makefile 
271 gemrb/plugins/STOImporter/Makefile 
272 gemrb/plugins/TISImporter/Makefile 
273 gemrb/plugins/TLKImporter/Makefile 
274 gemrb/plugins/WEDImporter/Makefile 
275 gemrb/plugins/WMPImporter/Makefile 
276 gemrb/plugins/ZLibManager/Makefile
277 gemrb/docs/Makefile 
278 gemrb/docs/en/Makefile 
279 gemrb/docs/en/GUIScript/Makefile 
280 gemrb/docs/en/Tables/Makefile 
281 gemrb/docs/en/Engine/Makefile 
283 AC_CONFIG_FILES([gemrb.spec])
284 AC_OUTPUT