Added reload of levels on F7 (Update levelpack) to ease the test of changes.
[enigmagame.git] / configure.ac
blob0a81c7bcbd68925e65e8ff57e14bd89c0b50abcd
1 # Process this file with autoconf to produce a configure script.
2 AC_INIT([enigma],[1.01])
3 AC_PREREQ(2.59)
4 AC_CANONICAL_BUILD
5 AC_CANONICAL_TARGET
6 AC_CONFIG_SRCDIR([src/enigma.cc])
7 AC_CONFIG_MACRO_DIR([m4])
9 AM_INIT_AUTOMAKE(AC_PACKAGE_TARNAME, AC_PACKAGE_VERSION, -)
10 AC_CONFIG_HEADERS([src/config.h])
11 AC_GNU_SOURCE
13 ALL_LINGUAS="de fr nl it es sv ru hu pt fi uk be el pl"
14 AC_SUBST(ALL_LINGUAS)
15 AM_GNU_GETTEXT
17 case $host_os in
18   *mingw32* ) MINGW32=yes;;
19           * ) MINGW32=no;;
20 esac
22 case $host_os in
23   *cygwin* ) CYGWIN=yes;;
24          * ) CYGWIN=no;;
25 esac
26 case $host_os in
27   *linux* ) LINUX=yes;;
28         * ) LINUX=no;;
29 esac
31 case $host_os in
32  *darwin* ) MACOSX=yes;;
33        * ) MACOSX=no;;
34 esac
36 AM_CONDITIONAL(MINGW32, test x$MINGW32 = xyes)
37 AM_CONDITIONAL(LINUX, test x$LINUX = xyes)
39 dnl ======================================================================
40 dnl Check for programs
41 dnl ======================================================================
42 CXXTMPFLAGS="$CXXFLAGS"
43 AC_PROG_CC
44 AM_PROG_CC_C_O
45 AC_PROG_CXX
46 AC_PROG_CPP
47 AC_PROG_RANLIB
48 dnl do not add the AC_PROG_CXX default CXXFLAGS
49 CXXFLAGS="$CXXTMPFLAGS"
51 dnl Add -mno-cygwin to CXXFLAGS and CFLAGS if working under cygwin
52 if test "x$CYGWIN" = xyes; then
53   CXXFLAGS="$CXXFLAGS -mno-cygwin"
54   CFLAGS="$CFLAGS -mno-cygwin"
55   CPPFLAGS="$CXXFLAGS -mno-cygwin"
56   WINDRES="${WINDRES-windres}"
58 if test "x$WINDRES" = x; then
59   WINDRES="windres"
61 AC_SUBST(WINDRES)
63 dnl Add -DMACOSX to CXXFLAGS and CFLAGS if working under darwin
64 if test "x$MACOSX" = xyes; then
65  CPPFLAGS="$CPPFLAGS -DMACOSX"
68 dnl ---------- Texi2html ----------
69 AC_PATH_PROG([TEXI2HTML], [texi2html], [""])
71 dnl ---------- PdfLatex ----------
72 AC_PATH_PROG([PDFLATEX], [pdflatex], [""])
74 dnl ---------- ImageMagick ----------
75 AC_PATH_PROG([CONVERT], [convert], [""])
77 dnl ---------- Use the included tolua ----------
78 AC_SUBST([TOLUA])
79 TOLUA=["\$(top_builddir)/tools/tolua"]
80 dnl AC_PATH_PROG(TOLUA, tolua, "", ["\$(top_builddir)/tools/tolua"])
83 dnl ======================================================================
84 dnl Check for system headers
85 dnl ======================================================================
86 AC_CHECK_HEADERS([dirent.h])
88 dnl ======================================================================
89 dnl Check for libraries
90 dnl ======================================================================
91 AC_SEARCH_LIBS([dlopen], [dl])
93 dnl When using the included gettext package from the /intl subdir
94 dnl /intl needs to be added to the list of include folders
95 if test "$BUILD_INCLUDED_LIBINTL" = yes; then
96    CXXFLAGS="$CXXFLAGS -I\$(top_srcdir)/intl"
99 dnl This is to check for winmm which must be included to satisfy enet
100 dnl when compiling under mingw32
101 if test "$MINGW32" = yes; then
102    AC_CHECK_LIB(winmm,main)
105 dnl Save a _NOSDL state set of flags for compilation of tools
106 CFLAGS_NOSDL="$CFLAGS"
107 CXXFLAGS_NOSDL="$CXXFLAGS"
108 LIBS_NOSDL="$LIBS"
110 AM_PATH_SDL(1.2.0)
111 AC_SUBST(SDL_LIBS)
112 AC_SUBST(SDL_CFLAGS)
113 dnl The flags are now substituted inside the Makefile, but not used for the
114 dnl rest of the script. So we manually put them in. This is necessary if
115 dnl SDL has not been installed in the canonical locations.
117 CFLAGS="$CFLAGS $SDL_CFLAGS"
118 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
119 LIBS="$LIBS $SDL_LIBS"
121 dnl ----------------------------------------
122 dnl Check for SDL image library
123 dnl ----------------------------------------
124 AC_CHECK_LIB(SDL_image,main,,[AC_MSG_ERROR([SDL_image is required to compile Enigma])])
126 SDL_LIBS="$SDL_LIBS -lSDL_image"
128 AC_CHECK_LIB(SDL_image, IMG_Init, have_img_init="yes", have_img_init="no")
129 if test "$have_img_init" = yes; then
130   AC_DEFINE(SDL_IMG_INIT, , [Whether SDL_image library provides init])
133 dnl ----------------------------------------
134 dnl Check for SDL mixer library
135 dnl ----------------------------------------
136 AC_CHECK_LIB(SDL_mixer,main,,[AC_MSG_ERROR([SDL_mixer is required to compile Enigma])])
138 SDL_LIBS="$SDL_LIBS -lSDL_mixer"
140 AC_CHECK_LIB(SDL_mixer, Mix_QuickLoad_RAW, have_mix_quickload="yes", have_mix_quickload="no")
141 if test "$have_mix_quickload" = no; then
142   AC_MSG_ERROR([SDL_mixer >= 1.2.5 is required to compile Enigma])
145 AC_CHECK_LIB(SDL_mixer, Mix_Init, have_mix_init="yes", have_mix_init="no")
146 if test "$have_mix_init" = yes; then
147   AC_DEFINE(SDL_MIX_INIT, , [Whether SDL_mixer library provides init])
150 dnl ----------------------------------------
151 dnl Check for SDL_ttf library
152 dnl ---------------------------------------
153 AC_MSG_CHECKING([for SDL_ttf >=2.0.6])
154 AC_RUN_IFELSE([AC_LANG_SOURCE(
155     [[#include <SDL_ttf.h>
156       int main(int argc, char *argv[]) {
157       if (TTF_MAJOR_VERSION < 2)
158         return 1;
159       else if (TTF_MAJOR_VERSION == 2 && TTF_MINOR_VERSION == 0 && TTF_PATCHLEVEL < 6) 
160         return 1;
161       return 0;}]])],
162   [AC_MSG_RESULT([found])],
163   [AC_MSG_ERROR([SDL_ttf >= 2.0.6 not found.])])
164 AC_CHECK_LIB(SDL_ttf, main,,[AC_MSG_ERROR([SDL_ttf is required to compile Enigma])])
166 SDL_LIBS="$SDL_LIBS -lSDL_ttf"
168 dnl ---------------------------------------
169 dnl Restoring variables to _NOSDL State
170 dnl ---------------------------------------
172 CFLAGS="$CFLAGS_NOSDL"
173 CXXFLAGS="$CXXFLAGS_NOSDL"
174 LIBS="$LIBS_NOSDL"
176 dnl ----------------------------------------
177 dnl Check for libpng
178 dnl ---------------------------------------
179 if test "$MINGW32" = yes; then
180   AC_CHECK_LIB(png12,png_create_write_struct,,[AC_MSG_ERROR([libpng is required to compile Enigma])])
181 else
182   AC_CHECK_LIB(png,png_create_write_struct,,[AC_MSG_ERROR([libpng is required to compile Enigma])])
185 dnl ----------------------------------------
186 dnl Check for xerces
187 dnl ----------------------------------------
188 if test "$MINGW32" = yes; then
189   AC_MSG_CHECKING([for Xerces release 3.0])
190   AC_EGREP_HEADER([gXercesMajVersion = 3],[xercesc/util/XercesVersion.hpp],
191       [AC_MSG_RESULT([found])],
192       [AC_MSG_ERROR([not found])])      
193    AC_CHECK_LIB(xerces-c, main,,[AC_MSG_ERROR([xerces is required to compile Enigma])])
194 else
195   AC_MSG_CHECKING([for current Xerces release 3.0])
196   AC_EGREP_HEADER([gXercesMajVersion = 3],[xercesc/util/XercesVersion.hpp],
197       xerces3exp="yes",
198       xerces3exp="no")      
199   if test "x$xerces3exp" = xyes; then
200     AC_MSG_RESULT([found])
201     AC_CHECK_LIB(xerces-c, main,,[AC_MSG_ERROR([xerces is required to compile Enigma])])
202   else
203     AC_MSG_RESULT([not found])
204     AC_MSG_CHECKING([for old Xerces release >=2.4])
205     AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <xercesc/util/XercesVersion.hpp>]],
206           [[if (XERCES_VERSION_MAJOR < 2)
207               return 1;
208             else if (XERCES_VERSION_MAJOR == 2 && XERCES_VERSION_MINOR < 4) 
209               return 1;
210             return 0;]])],
211         [AC_MSG_RESULT([found])],
212         [AC_MSG_ERROR([Xerces >= 2.4 not found.])])
213     AC_CHECK_LIB(xerces-c, main,,[AC_MSG_ERROR([xerces is required to compile Enigma])])
214   fi
217 dnl ----------------------------------------
218 dnl Check for libcurl
219 dnl ---------------------------------------
220 AC_CHECK_LIB(curl,curl_global_init,,[AC_MSG_ERROR([libcurl is required to compile Enigma])])
222 dnl ----------------------------------------
223 dnl Activate optimizations when profiling, to get rid of
224 dnl inlineable functions.
225 dnl ----------------------------------------
226 AC_MSG_CHECKING(whether to include profiling information)
227 AC_ARG_ENABLE(profile,
228   AS_HELP_STRING(--enable-profile,Compile with profiling information), ,
229   enable_profile=no
231 if test "x$enable_profile" = xyes; then
232   CXXFLAGS="$CXXFLAGS -pg -O2"
233   AC_MSG_RESULT(yes)
234 else
235   AC_MSG_RESULT(no)
238 dnl ----------------------------------------
239 dnl Build the developer tools?
240 dnl ----------------------------------------
242 AC_ARG_ENABLE(tools,
243   AS_HELP_STRING(--enable-tools,Build developer tools [default=no]), ,
244   enable_tools=no
247 AM_CONDITIONAL(BUILDTOOLS, [test "$enable_tools" = yes])
248 AM_CONDITIONAL(BUILDTTF2BMF, [test "$have_sdlttf" = yes -a "$enable_tools" = yes])
250 dnl ----------------------------------------
251 dnl Include experimental features?
252 dnl ----------------------------------------
253 AC_ARG_ENABLE(experimental,
254   AS_HELP_STRING(--enable-experimental,Include experimental features [default=no]), 
255   , enable_experimental=no)
256 if test "x$enable_experimental" = xyes; then
257   AC_DEFINE(ENABLE_EXPERIMENTAL, , [Include experimental features])
260 dnl ----------------------------------------
261 dnl Include asserts ?
262 dnl ----------------------------------------
263 AC_MSG_CHECKING(whether to include assert statements)
264 AC_ARG_ENABLE(assert,
265   AS_HELP_STRING(--enable-assert,Include assert statements [default=yes]), 
266   , enable_assert=yes)
267 if test "x$enable_assert" = xyes; then
268   CXXFLAGS="$CXXFLAGS -DENABLE_ASSERT"
269   AC_MSG_RESULT(yes)
270 else
271   AC_MSG_RESULT(no)
274 dnl ----------------------------------------
275 dnl Optimize?
276 dnl ----------------------------------------
278 AC_MSG_CHECKING(whether to optimize)
279 AC_ARG_ENABLE(optimize,
280   AS_HELP_STRING(--enable-optimize,Compile with optimizations [default=no]), ,
281   enable_optimize=no
283 if test "x$enable_optimize" = xyes; then
284         CXXFLAGS="$CXXFLAGS -O2 -ffast-math -fomit-frame-pointer"
285         AC_MSG_RESULT(yes)
286 else
287         CXXFLAGS="$CXXFLAGS -g"
288         AC_MSG_RESULT(no)
291 dnl ----------------------------------------
292 dnl Check for gdb debugging
293 dnl ----------------------------------------
295 AC_MSG_CHECKING(whether to debug the game with gdb)
296 AC_ARG_ENABLE(debug-gdb,
297   AS_HELP_STRING(--enable-debug-gdb,Compile with special debugging options for gdb), ,
298   enable_debug_gdb=no
300 if test "x$enable_debug_gdb" = xyes; then
301         CXXFLAGS="$CXXFLAGS -ggdb3 -fno-inline -fno-default-inline -fno-omit-frame-pointer -fno-optimize-sibling-calls"
302         AC_MSG_RESULT(yes)
303 else
304         CXXFLAGS="$CXXFLAGS"
305         AC_MSG_RESULT(no)
308 dnl ----------------------------------------
309 dnl Check for profiling
310 dnl ----------------------------------------
312 AC_MSG_CHECKING(whether to profile the game)
313 AC_ARG_ENABLE(profile,
314   AS_HELP_STRING(--enable-profile,Compile with profiling option for gdb), ,
315   enable_profile=no
317 if test "x$enable_profile" = xyes; then
318         CXXFLAGS="$CXXFLAGS -pg"
319         AC_MSG_RESULT(yes)
320 else
321         CXXFLAGS="$CXXFLAGS"
322         AC_MSG_RESULT(no)
325 dnl ----------------------------------------
326 dnl Check for C++ Lua
327 dnl ----------------------------------------
329 AC_MSG_CHECKING(whether to build lua using c++)
330 AC_ARG_ENABLE(cxxlua,
331   AS_HELP_STRING(--enable-cxxlua, Build Lua with C++ [default=yes]),,enable_cxxlua=yes)
332 if test "x$enable_cxxlua" = xyes; then
333   CXXFLAGS="$CXXFLAGS -DCXXLUA"
334   AC_MSG_RESULT(yes)
335 else
336   AC_MSG_RESULT(no)
339 AM_CONDITIONAL(CXXLUA, test x$enable_cxxlua = xyes)
341 dnl ----------------------------------------------------------
342 dnl Check whether compiler warnings should be emitted
343 dnl ----------------------------------------------------------
345 AC_MSG_CHECKING(whether to enable warnings)
346 AC_ARG_ENABLE(warnings,
347   AS_HELP_STRING(--enable-warnings,Enable additional compiler warnings), ,
348   enable_warnings=no
350 if test "x$enable_warnings" = xyes; then
351         CXXFLAGS="$CXXFLAGS -O2 -Wall -W"
352         CXXFLAGS="$CXXFLAGS -Wundef -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align"
353         CXXFLAGS="$CXXFLAGS -Wwrite-strings -Wconversion -Wsign-compare -Wformat"
354         CXXFLAGS="$CXXFLAGS -Wdisabled-optimization -Wno-system-headers"
355         AC_MSG_RESULT(yes)
356 else
357         CXXFLAGS="$CXXFLAGS"
358         AC_MSG_RESULT(no)
361 dnl ----------------------------------------------------------
362 dnl Configure libraries
363 dnl ----------------------------------------------------------
364 AC_CONFIG_SUBDIRS(lib-src/zipios++)
365 AC_CONFIG_SUBDIRS(lib-src/enet)
367 AC_CONFIG_FILES([Makefile m4/Makefile  intl/Makefile 
368            data/Makefile
369            data/gfx/Makefile
370            data/gfx/flags25x15/Makefile
371            data/gfx16/Makefile
372            data/gfx32/Makefile
373            data/gfx40/Makefile
374            data/gfx48/Makefile
375            data/gfx64/Makefile
376            data/levels/Makefile
377            data/levels/enigma_tutorial/Makefile
378            data/levels/enigma_i/Makefile
379            data/levels/enigma_ii/Makefile
380            data/levels/enigma_iii/Makefile
381            data/levels/enigma_iv/Makefile
382            data/levels/enigma_v/Makefile
383            data/levels/enigma_vi/Makefile
384            data/levels/enigma_vii/Makefile
385            data/levels/enigma_viii/Makefile
386            data/levels/enigma_ix/Makefile
387            data/levels/enigma_cross/Makefile
388            data/levels/enigma_esprit/Makefile
389            data/levels/enigma_oxyd/Makefile
390            data/levels/enigma_peroxyd/Makefile
391            data/levels/enigma_oxydmagnum/Makefile
392            data/levels/enigma_oxydextra/Makefile
393            data/levels/enigma_experimental/Makefile
394            data/levels/enigma_demolevels/Makefile
395            data/levels/pentomino_i/Makefile
396            data/levels/soko/Makefile
397            data/levels/soko/skinner_microban01/Makefile
398            data/levels/soko/skinner_microban02/Makefile
399            data/levels/soko/skinner_microban03/Makefile
400            data/levels/soko/skinner_microban04/Makefile
401            data/levels/soko/skinner_microban05/Makefile
402            data/levels/soko/skinner_sasquatch01/Makefile
403            data/levels/soko/skinner_sasquatch02/Makefile
404            data/levels/soko/skinner_sasquatch03/Makefile
405            data/levels/soko/skinner_sasquatch04/Makefile
406            data/levels/soko/skinner_sasquatch05/Makefile
407            data/levels/soko/skinner_sasquatch06/Makefile
408            data/levels/soko/skinner_sasquatch07/Makefile
409            data/levels/soko/skinner_sasquatch08/Makefile
410            data/levels/soko/skinner_sasquatch09/Makefile
411            data/levels/soko/skinner_sasquatch10/Makefile
412            data/levels/soko/skinner_sasquatch11/Makefile
413            data/levels/soko/skinner_sasquatch12/Makefile
414            data/levels/lib/Makefile
415            data/levels/patches/Makefile
416            data/fonts/Makefile
417            data/music/Makefile
418            data/music/menu/Makefile
419            data/soundsets/Makefile
420            data/soundsets/enigma/Makefile
421            data/schemas/Makefile
422            doc/Makefile
423            doc/images/Makefile
424            doc/images/flags25x15/Makefile
425            doc/manual/Makefile
426            doc/manual/images/Makefile
427            doc/reference/Makefile
428            doc/reference/images/Makefile
429            etc/Makefile
430            lib-src/Makefile
431            lib-src/oxydlib/Makefile
432            lib-src/lua/Makefile
433            lib-src/enigma-core/Makefile
434            src/Makefile
435            tools/Makefile
436            etc/enigma.spec
437            etc/enigma.nsi
438            etc/Info.plist
439            po/Makefile.in
442 AC_CONFIG_FILES([etc/mingw32-dist.sh],[chmod +x etc/mingw32-dist.sh])
444 AC_OUTPUT
446 AC_MSG_RESULT([
448 Enigma is now configured
450    Source directory:    $srcdir
451    Installation prefix: $prefix
452    C++ compiler:        $CXX $CXXFLAGS
453    Libraries:           $LIBS
454    Linker options:      $LDFLAGS
455    Languages:           $ALL_LINGUAS
457 If these values seem to make sense, you can now run make.