remove automake from configure.ac
[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 dnl Checks for header files.
31 AC_HEADER_DIRENT
32 AC_HEADER_STDC
33 AC_CHECK_HEADERS(unistd.h)
34
35 dnl Checks for typedefs, structures, and compiler characteristics.
36 AC_C_CONST
37
38 dnl ===========================================================================
39 dnl Give advanced users some options to play with
40
41 VARIANT=optimize
42 AC_MSG_CHECKING(for gprof mode)
43 AC_ARG_ENABLE(gprof,
44               AC_HELP_STRING([--enable-gprof], [enable GNU profiling support]),
45               [enable_gprof=$enableval], [enable_gprof=no])
46 if test "$enable_gprof" = "yes"; then
47     #CXXFLAGS="$CXXFLAGS -pg"
48     VARIANT=profile
49     AC_MSG_RESULT([enabled])
50 else
51     AC_MSG_RESULT([disabled])
52 fi
53
54 AC_MSG_CHECKING(for debug mode)
55 AC_ARG_ENABLE(debug,
56               AC_HELP_STRING([--enable-debug], [enable debugging mode]),
57               [enable_debug=$enableval], [enable_debug=no])
58 if test "$enable_debug" = "yes"; then
59     AC_DEFINE([DEBUG], 1, [define to compile in debug checks])
60     #CXXFLAGS="$CXXFLAGS -Wall -Werror -O0 -g3"
61     VARIANT=debug
62     AC_MSG_RESULT([enabled])
63 else
64     #CXXFLAGS="$CXXFLAGS -O2 -g"
65     VARIANT=optimize
66     AC_MSG_RESULT([disabled])
67 fi
68 AC_SUBST([VARIANT])
69
70 AC_MSG_CHECKING(wether OpenGL should be used)
71 AC_ARG_ENABLE(opengl,
72               AC_HELP_STRING([--disable-opengl], [disable OpenGL support]),
73               [enable_opengl=$enableval], enable_opengl=yes)
74 if test "$enable_opengl" = "yes"; then
75     AC_MSG_RESULT([yes])
76 else
77     AC_MSG_RESULT([no])
78 fi
79
80 AC_CHECK_LIB([iconv], [iconv_open])
81 AC_TRY_LINK([#include <iconv.h>], [iconv_open(0, 0);],,
82     AC_MSG_ERROR([Couldn't find iconv library]))
83
84 dnl ===========================================================================
85 dnl Check for SDL
86 SDL_VERSION=1.2.4
87 AM_PATH_SDL($SDL_VERSION,
88             :,
89             AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]))
90
91 NP_FINDLIB([SDLMIXER], [SDL_mixer], [SDL_mixer >= 1.2],
92         NP_LANG_PROGRAM([#include <SDL_mixer.h>
93 #if MIX_MAJOR_VERSION < 1
94 # error SDLMix too old
95 #else
96 # if MIX_MAJOR_VERSION == 1
97 #  if MIX_MINOR_VERSION < 2
98 #   error SDLMix too old
99 #  endif
100 # endif
101 #endif], [Mix_OpenAudio(0, 0, 0, 0);]),
102         [], [-lSDL_mixer],
103         [],
104         [AC_MSG_ERROR([Please install SDLMixer >=1.2.2])],
105         [$SDL_CFLAGS], [$SDL_LIBS])
106
107 NP_FINDLIB([SDLIMAGE], [SDL_image], [SDL_image >= 1.2],
108         NP_LANG_PROGRAM([#include <SDL_image.h>], [IMG_Load("");]),
109         [], [-lSDL_image],
110         [],
111         [AC_MSG_ERROR([Please install SDLImage >= 1.2.1])],
112         [$SDL_CFLAGS], [$SDL_LIBS])
113
114 if test "$enable_opengl" = "yes"; then
115   AX_CHECK_GL
116 fi
117 if test "$no_gl" = "yes" -o "$enable_opengl" = "no"; then
118   GL_AVAILABLE="no"
119   AC_DEFINE([NOOPENGL],, [Define if opengl should not be used])
120 else
121   GL_AVAILABLE="yes"
122 fi
123 AC_SUBST([GL_AVAILABLE])
124
125 dnl Checks for library functions.
126 AC_CHECK_FUNCS(mkdir strdup strstr)
127
128 AC_INIT_JAM
129 AC_CONFIG_FILES([Jamconfig])
130
131 AC_OUTPUT
132
133 echo ""
134 echo "Features:"
135 echo "========="
136 echo " Profile Mode:   $enable_gprof"
137 echo " Debug Mode:     $enable_debug"
138 echo " OpenGL Support: $enable_opengl"
139 echo ""
140 echo ""
141 echo "       NOTE: This project uses jam (and not make) as build tool"
142 echo ""
143