Fixed case on file. Please try to keep things lowercase.. remember that most
[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-cvs)
15 AC_CONFIG_SRCDIR([src/supertux.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)
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 dnl Checks for header files.
43 AC_HEADER_DIRENT
44 AC_HEADER_STDC
45 AC_CHECK_HEADERS(unistd.h)
46
47 dnl Checks for typedefs, structures, and compiler characteristics.
48 AC_C_CONST
49
50 dnl ===========================================================================
51 dnl Give advanced users some options to play with
52
53 VARIANT=optimize
54 AC_MSG_CHECKING(for gprof mode)
55 AC_ARG_ENABLE(gprof,
56               AC_HELP_STRING([--enable-gprof], [enable GNU profiling support]),
57               [enable_gprof=$enableval], [enable_gprof=no])
58 if test "$enable_gprof" = "yes"; then
59     #CXXFLAGS="$CXXFLAGS -pg"
60     VARIANT=profile
61     AC_MSG_RESULT([enabled])
62 else
63     AC_MSG_RESULT([disabled])
64 fi
65
66 AC_MSG_CHECKING(for debug mode)
67 AC_ARG_ENABLE(debug,
68               AC_HELP_STRING([--enable-debug], [enable debugging mode]),
69               [enable_debug=$enableval], [enable_debug=no])
70 if test "$enable_debug" = "yes"; then
71     AC_DEFINE([DEBUG], 1, [define to compile in debug checks])
72     #CXXFLAGS="$CXXFLAGS -Wall -Werror -O0 -g3"
73     VARIANT=debug
74     AC_MSG_RESULT([enabled])
75 else
76     #CXXFLAGS="$CXXFLAGS -O2 -g"
77     VARIANT=optimize
78     AC_MSG_RESULT([disabled])
79 fi
80 AC_SUBST([VARIANT])
81
82 AC_MSG_CHECKING(wether OpenGL should be used)
83 AC_ARG_ENABLE(opengl,
84               AC_HELP_STRING([--disable-opengl], [disable OpenGL support]),
85               [enable_opengl=$enableval], enable_opengl=yes)
86 if test "$enable_opengl" = "yes"; then
87     AC_MSG_RESULT([yes])
88 else
89     AC_MSG_RESULT([no])
90 fi
91
92 iconv_found=no
93 AC_MSG_CHECKING([for iconv])
94 AC_TRY_LINK([#include <iconv.h>], [iconv_open(0, 0);], [iconv_found="yes"])
95 AS_IF([test "$iconv_found" = no],
96     LIBS="$LIBS -liconv"
97     AC_TRY_LINK([#include <iconv.h>], [iconv_open(0, 0);], [iconv_found="yes"]))
98 AS_IF([test "$iconv_found" = no],
99     AC_MSG_ERROR([Couldn't find iconv library]),
100     AC_MSG_RESULT([found]))
101
102 dnl ===========================================================================
103 dnl Check for SDL
104 SDL_VERSION=1.2.4
105 AM_PATH_SDL($SDL_VERSION,
106             :,
107             AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]))
108
109 NP_FINDLIB([SDLMIXER], [SDL_mixer], [SDL_mixer >= 1.2],
110         NP_LANG_PROGRAM([#include <SDL_mixer.h>
111 #if MIX_MAJOR_VERSION < 1
112 # error SDLMix too old
113 #else
114 # if MIX_MAJOR_VERSION == 1
115 #  if MIX_MINOR_VERSION < 2
116 #   error SDLMix too old
117 #  endif
118 # endif
119 #endif], [Mix_OpenAudio(0, 0, 0, 0);]),
120         [], [-lSDL_mixer],
121         [],
122         [AC_MSG_ERROR([Please install SDLMixer >=1.2.2])],
123         [$SDL_CFLAGS], [$SDL_LIBS])
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 if test "$enable_opengl" = "yes"; then
133   AX_CHECK_GL
134 fi
135 if test "$no_gl" = "yes" -o "$enable_opengl" = "no"; then
136   GL_AVAILABLE="no"
137   AC_DEFINE([NOOPENGL],, [Define if opengl should not be used])
138 else
139   GL_AVAILABLE="yes"
140 fi
141 AC_SUBST([GL_AVAILABLE])
142
143 dnl Checks for library functions.
144 AC_CHECK_FUNCS(mkdir strdup strstr)
145
146 AC_INIT_JAM
147 AC_CONFIG_FILES([Jamconfig])
148
149 AC_OUTPUT
150
151 echo ""
152 echo "Features:"
153 echo "========="
154 echo " Profile Mode:   $enable_gprof"
155 echo " Debug Mode:     $enable_debug"
156 echo " OpenGL Support: $enable_opengl"
157 echo ""
158 echo ""
159 echo "       NOTE: This project uses jam (and not make) as build tool"
160 echo ""
161