hopefully fixed the crash on exit, keep sectors script bundled in the sector and...
[supertux.git] / configure.ac
1 dnl ===========================================================================
2 dnl    "configure.in"
3 dnl
4 dnl current contact:
5 dnl          SuperTux development team
6 dnl
7 dnl original author:
8 dnl          Duong-Khang NGUYEN
9 dnl          neoneurone@users.sf.net
10 dnl ===========================================================================
11
12 dnl Process this file with autoconf to produce a configure script.
13 AC_PREREQ([2.54])
14 AC_INIT(supertux, 0.2-svn)
15 AC_CONFIG_SRCDIR([src/main.cpp])
16 AC_CONFIG_AUX_DIR([mk/autoconf])
17 AC_CANONICAL_TARGET
18
19 AC_CONFIG_HEADERS(config.h)
20
21 # we don't want the stupid autoconf default -g -O2
22 test ".$CXXFLAGS" = "." && CXXFLAGS=" "
23
24 CXXFLAGS="$CXXFLAGS -ffast-math"
25
26 AC_PROG_CC
27 AC_PROG_CXX
28 AC_PROG_INSTALL
29 AC_PATH_PROG(AR, ar)
30 if test "$AR" = "" ; then
31   AC_MSG_ERROR([Couldn't find ar])
32 fi
33 AR="$AR ru"
34
35 AC_C_BIGENDIAN
36
37 AC_CHECK_PROGS(XGETTEXT, [xgettext xgettext.exe])
38 if test -n "$XGETTEXT" ; then
39     AC_MSG_CHECKING([if xgettext supports lisp])
40     if echo '(gettext "test")' | xgettext -o - -L Lisp - >& /dev/null; then
41         AC_MSG_RESULT(yes)
42     else
43         AC_MSG_RESULT(no)
44         AC_MSG_WARN([It seems your gettext installation is too old, try updating it])
45         XGETTEXT=""
46     fi
47 fi
48
49 AC_PROG_LEX
50 LEX_LIBS=$LEXLIB
51 AC_SUBST([LEX_LIBS])
52 AC_CHECK_PROGS([BISON], [bison bison.exe])
53 AC_SUBST([BISON])
54
55 dnl Checks for header files.
56 AC_HEADER_DIRENT
57 AC_HEADER_STDC
58 AC_CHECK_HEADERS(unistd.h)
59
60 dnl Checks for typedefs, structures, and compiler characteristics.
61 AC_C_CONST
62
63 dnl ===========================================================================
64 dnl Give advanced users some options to play with
65
66 VARIANT=optimize
67 AC_MSG_CHECKING(for gprof mode)
68 AC_ARG_ENABLE(gprof,
69               AC_HELP_STRING([--enable-gprof], [enable GNU profiling support]),
70               [enable_gprof=$enableval], [enable_gprof=no])
71 if test "$enable_gprof" = "yes"; then
72     #CXXFLAGS="$CXXFLAGS -pg"
73     VARIANT=profile
74     AC_MSG_RESULT([enabled])
75 else
76     AC_MSG_RESULT([disabled])
77 fi
78
79 AC_MSG_CHECKING(for debug mode)
80 AC_ARG_ENABLE(debug,
81               AC_HELP_STRING([--enable-debug], [enable debugging mode]),
82               [enable_debug=$enableval], [enable_debug=no])
83 if test "$enable_debug" = "yes"; then
84     AC_DEFINE([DEBUG], 1, [define to compile in debug checks])
85     VARIANT=debug
86     AC_MSG_RESULT([enabled])
87 else
88     VARIANT=optimize
89     AC_MSG_RESULT([disabled])
90 fi
91 AC_SUBST([VARIANT])
92
93 AC_C_BIGENDIAN()
94
95 AM_ICONV
96 AC_SUBST([ICONV_LIBS], [$LIBICONV])
97
98 dnl ===========================================================================
99 dnl Check for SDL
100 SDL_VERSION=1.2.4
101 AM_PATH_SDL($SDL_VERSION,
102             :,
103             AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]))
104
105 XIPH_PATH_VORBIS(, [AC_MSG_ERROR([Please install libvorbis])])
106 XIPH_PATH_OGG(, [AC_MSG_ERROR([Please install libogg])])
107
108 NP_FINDLIB([SDLIMAGE], [SDL_image], [SDL_image >= 1.2],
109         NP_LANG_PROGRAM([#include <SDL_image.h>], [IMG_Load("");]),
110         [], [-lSDL_image],
111         [],
112         [AC_MSG_ERROR([Please install SDLImage >= 1.2.1])],
113         [$SDL_CFLAGS], [$SDL_LIBS])
114
115 NP_FINDLIB([PHYSFS], [physfs], [physfs >= 1.0.0],
116         NP_LANG_PROGRAM([
117 #include <stdio.h>
118 #include <physfs.h>
119 #if PHYSFS_VER_MAJOR < 1
120 # error PHYSFS is too old
121 #endif]),
122         [], [-lphysfs],
123         [],
124         [AC_MSG_ERROR([Please install physfs >= 1.0])])
125
126 NP_FINDLIB([OPENAL], [OpenAL], [OpenAL],
127          NP_LANG_PROGRAM([#include <AL/al.h>],
128            [alcOpenDevice(0);]),
129          [], [-lopenal],
130          [],
131          [AC_MSG_ERROR([Please intall OpenAL])],
132          [], [])
133
134 AX_CHECK_GL
135 if test "$no_gl" = "yes"; then
136   AC_MSG_ERROR([Please install opengl libraries and headers])
137 fi
138
139 dnl Checks for library functions.
140 AC_CHECK_FUNCS(mkdir strdup strstr)
141
142 AC_INIT_JAM
143 AC_CONFIG_FILES([Jamconfig])
144
145 AC_OUTPUT
146
147 echo ""
148 echo "Features:"
149 echo "========="
150 echo " Profile Mode:   $enable_gprof"
151 echo " Debug Mode:     $enable_debug"
152 echo ""
153 echo ""
154 echo "       NOTE: This project uses jam (and not make) as build tool"
155 echo ""
156