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