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