7b0c3da42ef92ca9dbf763625e9abad320b80ecb
[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(supertux2, 0.3.1-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 AC_C_BIGENDIAN
63 AC_CHECK_SIZEOF([void *])
64 AH_BOTTOM([
65 #if SIZEOF_VOID_P == 8
66 #define _SQ64
67 #endif
68 ])
69
70 dnl ===========================================================================
71 dnl Give advanced users some options to play with
72
73 VARIANT=optimize
74 AC_MSG_CHECKING([for build variant])
75
76 AC_ARG_ENABLE(gprof,
77               AC_HELP_STRING([--enable-gprof], [enable GNU profiling support]),
78               [enable_gprof=$enableval], [enable_gprof=no])
79 if test "$enable_gprof" = "yes"; then
80     VARIANT=profile
81 fi
82
83 AC_ARG_ENABLE(debug,
84               AC_HELP_STRING([--enable-debug], [enable debugging mode]),
85               [enable_debug=$enableval], [enable_debug=no])
86 if test "$enable_debug" = "yes"; then
87     AC_DEFINE([DEBUG], 1, [define to compile in debug checks])
88     VARIANT=debug
89 else
90     VARIANT=optimize
91 fi
92 AC_SUBST([VARIANT])
93 AC_MSG_RESULT([$VARIANT])
94
95 AC_ARG_ENABLE(sqdbg,
96               AC_HELP_STRING([--enable-sqdbg], [enable squirrel remote debugger]),
97               [enable_sqdbg=$enableval], [enable_sqdbg=no])
98 if test "$enable_sqdbg" = "yes"; then
99     AC_DEFINE([ENABLE_SQDBG], 1, [define if sqdbg should be enabled])
100     AC_SUBST([enable_sqdbg])
101 fi
102
103 dnl binreloc
104 AM_BINRELOC
105
106 AM_ICONV
107 AC_SUBST([ICONV_LIBS], [$LIBICONV])
108
109 dnl ===========================================================================
110 dnl Check for libcurl
111
112 LIBCURL_CHECK_CONFIG
113 AC_SUBST([LIBCURL_LIBS], [$LIBCURL])
114
115 dnl ===========================================================================
116 dnl Check for SDL
117 SDL_VERSION=1.2.4
118 AM_PATH_SDL($SDL_VERSION,
119             :,
120             AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]))
121
122 XIPH_PATH_OGG(, [AC_MSG_ERROR([Please install libogg])])
123 XIPH_PATH_VORBIS(, [AC_MSG_ERROR([Please install libvorbis])])
124
125 NP_FINDLIB([SDLIMAGE], [SDL_image], [SDL_image >= 1.2],
126         NP_LANG_PROGRAM([#include <SDL_image.h>], [IMG_Load("");]),
127         [], [-lSDL_image],
128         [],
129         [AC_MSG_ERROR([Please install SDLImage >= 1.2.1])],
130         [$SDL_CFLAGS], [$SDL_LIBS])
131
132 NP_FINDLIB([PHYSFS], [physfs], [physfs >= 1.0.0],
133         NP_LANG_PROGRAM([
134 #include <stdio.h>
135 #include <physfs.h>
136 #if PHYSFS_VER_MAJOR < 1
137 # error PHYSFS is too old
138 #endif]),
139         [], [-lphysfs],
140         [],
141         [AC_MSG_ERROR([Please install physfs >= 1.0])])
142
143 if test "x`uname -s`" = "xDarwin"; then
144   allib="-framework OpenAL"
145 else
146   allib="-lopenal"
147 fi
148
149 NP_FINDLIB([OPENAL], [OpenAL], [OpenAL],
150          NP_LANG_PROGRAM([#include <AL/al.h>],
151            [alcOpenDevice(0);]),
152          [], [$allib],
153          [],
154          [AC_MSG_ERROR([Please intall OpenAL])],
155          [], [])
156
157 AC_ARG_ENABLE(opengl,
158               AC_HELP_STRING([--enable-opengl], [enable opengl support]),
159               [enable_opengl=$enableval], [enable_opengl=yes])
160
161 if test "$enable_opengl" = "yes"; then
162   AX_CHECK_GL
163   if test "$no_gl" != "yes"; then
164     AC_DEFINE_UNQUOTED(HAVE_OPENGL, 1, Define if OpenGL is present on the system)
165   fi
166 fi
167
168 dnl Checks for library functions.
169 AC_CHECK_FUNCS(mkdir strdup strstr)
170
171 AC_INIT_JAM
172 AC_CONFIG_FILES([Jamconfig])
173
174 AC_OUTPUT
175
176 echo ""
177 echo "       NOTE: This project uses jam (and not make) as build tool"
178 echo ""
179