f591dee3fd438a6000d58f31e96b19fc1379628c
[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
30 AC_C_BIGENDIAN
31
32 AC_CHECK_PROGS(XGETTEXT, [xgettext xgettext.exe])
33 if test -n "$XGETTEXT" ; then
34     AC_MSG_CHECKING([if xgettext supports lisp])
35     if echo '(gettext "test")' | xgettext -o - -L Lisp - >& /dev/null; then
36         AC_MSG_RESULT(yes)
37     else
38         AC_MSG_RESULT(no)
39         AC_MSG_WARN([It seems your gettext installation is too old, try updating it])
40         XGETTEXT=""
41     fi
42 fi
43
44 AC_PROG_LEX
45 LEX_LIBS=$LEXLIB
46 AC_SUBST([LEX_LIBS])
47 AC_CHECK_PROGS([BISON], [bison bison.exe])
48 AC_SUBST([BISON])
49
50 dnl Checks for header files.
51 AC_HEADER_DIRENT
52 AC_HEADER_STDC
53 AC_CHECK_HEADERS(unistd.h)
54
55 dnl Checks for typedefs, structures, and compiler characteristics.
56 AC_C_CONST
57
58 dnl ===========================================================================
59 dnl Give advanced users some options to play with
60
61 VARIANT=optimize
62 AC_MSG_CHECKING(for gprof mode)
63 AC_ARG_ENABLE(gprof,
64               AC_HELP_STRING([--enable-gprof], [enable GNU profiling support]),
65               [enable_gprof=$enableval], [enable_gprof=no])
66 if test "$enable_gprof" = "yes"; then
67     #CXXFLAGS="$CXXFLAGS -pg"
68     VARIANT=profile
69     AC_MSG_RESULT([enabled])
70 else
71     AC_MSG_RESULT([disabled])
72 fi
73
74 AC_MSG_CHECKING(for debug mode)
75 AC_ARG_ENABLE(debug,
76               AC_HELP_STRING([--enable-debug], [enable debugging mode]),
77               [enable_debug=$enableval], [enable_debug=no])
78 if test "$enable_debug" = "yes"; then
79     AC_DEFINE([DEBUG], 1, [define to compile in debug checks])
80     VARIANT=debug
81     AC_MSG_RESULT([enabled])
82 else
83     VARIANT=optimize
84     AC_MSG_RESULT([disabled])
85 fi
86 AC_SUBST([VARIANT])
87
88 AC_C_BIGENDIAN()
89
90 AM_ICONV
91 AC_SUBST([ICONV_LIBS], [$LIBICONV])
92
93 dnl ===========================================================================
94 dnl Check for SDL
95 SDL_VERSION=1.2.4
96 AM_PATH_SDL($SDL_VERSION,
97             :,
98             AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]))
99
100 XIPH_PATH_VORBIS(, [AC_MSG_ERROR([Please install libvorbis])])
101 XIPH_PATH_OGG(, [AC_MSG_ERROR([Please install libogg])])
102
103 NP_FINDLIB([SDLIMAGE], [SDL_image], [SDL_image >= 1.2],
104         NP_LANG_PROGRAM([#include <SDL_image.h>], [IMG_Load("");]),
105         [], [-lSDL_image],
106         [],
107         [AC_MSG_ERROR([Please install SDLImage >= 1.2.1])],
108         [$SDL_CFLAGS], [$SDL_LIBS])
109
110 NP_FINDLIB([PHYSFS], [physfs], [physfs >= 1.0.0],
111         NP_LANG_PROGRAM([
112 #include <stdio.h>
113 #include <physfs.h>
114 #if PHYSFS_VER_MAJOR < 1
115 # error PHYSFS is too old
116 #endif]),
117         [], [-lphysfs],
118         [],
119         [AC_MSG_ERROR([Please install physfs >= 1.0])])
120
121 NP_FINDLIB([OPENAL], [OpenAL], [OpenAL],
122          NP_LANG_PROGRAM([#include <AL/al.h>],
123            [alcOpenDevice(0);]),
124          [], [-lopenal],
125          [],
126          [AC_MSG_ERROR([Please intall OpenAL])],
127          [], [])
128
129 AX_CHECK_GL
130 if test "$no_gl" = "yes"; then
131   AC_MSG_ERROR([Please install opengl libraries and headers])
132 fi
133
134 dnl Checks for library functions.
135 AC_CHECK_FUNCS(mkdir strdup strstr)
136
137 AC_INIT_JAM
138 AC_CONFIG_FILES([Jamconfig])
139
140 AC_OUTPUT
141
142 echo ""
143 echo "Features:"
144 echo "========="
145 echo " Profile Mode:   $enable_gprof"
146 echo " Debug Mode:     $enable_debug"
147 echo ""
148 echo ""
149 echo "       NOTE: This project uses jam (and not make) as build tool"
150 echo ""
151