fix check for debug flag
[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 SDL_VERSION=1.2.4
22
23 AC_PROG_CC
24 AC_PROG_CXX
25 AC_PROG_INSTALL
26 AC_PROG_LIBTOOL
27
28 dnl Checks for header files.
29 AC_HEADER_DIRENT
30 AC_HEADER_STDC
31 AC_CHECK_HEADERS(unistd.h)
32
33 dnl Checks for typedefs, structures, and compiler characteristics.
34 AC_C_CONST
35
36 dnl ===========================================================================
37 dnl Give advanced users some options to play with
38
39 AC_MSG_CHECKING(for gprof mode)
40 AC_ARG_ENABLE(gprof,
41               AC_HELP_STRING([--enable-gprof], [enable GNU profiling support]),, enable_gprof="no")
42 if test "x${enable_gprof}" != "xno"; then
43     CXXFLAGS="$CXXFLAGS -pg"
44     AC_MSG_RESULT([enabled])
45 else
46     AC_MSG_RESULT([disabled])
47 fi
48
49 AC_MSG_CHECKING(for debug mode)
50 AC_ARG_ENABLE(debug,
51               AC_HELP_STRING([--enable-debug], [enable debugging mode]),
52               [enable_debug=$enableval], [enable_debug=no])
53 if test "$enable_debug" = "yes"; then
54     CXXFLAGS="$CXXFLAGS -Wall -Werror -DDEBUG -O0 -g3"
55     AC_MSG_RESULT([enabled])
56 else
57     AC_MSG_RESULT([disabled])
58 fi
59
60 AC_MSG_CHECKING(wether OpenGL should be used)
61 AC_ARG_ENABLE(opengl,
62               AC_HELP_STRING([--disable-opengl], [disable OpenGL support]),, enable_opengl="yes")
63 if test "x${enable_opengl}" != "xno"; then
64     AC_MSG_RESULT([yes])
65 else
66     AC_MSG_RESULT([no])
67 fi
68
69 AM_GNU_GETTEXT
70
71 dnl ===========================================================================
72 dnl Check for SDL
73 AM_PATH_SDL($SDL_VERSION,
74             :,
75             AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]))
76 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
77 CFLAGS="$CFLAGS $SDL_CFLAGS"
78 LIBS="$LIBS $SDL_LIBS"
79 GL_LIBS="-lGL"
80
81 dnl Checks for additional libraries.
82 AC_CHECK_LIB(SDL_mixer, Mix_OpenAudio,,
83         AC_MSG_ERROR([SDL_mixer library required]))
84
85 AC_CHECK_LIB(SDL_image, IMG_Load,,
86         AC_MSG_ERROR([SDL_image library required]))
87
88 if test "x${enable_opengl}" != "xno"; then
89   AX_CHECK_GL
90 fi
91 if test "x$no_gl" = "xyes" -o "x$enable_opengl" = "xno"; then
92   CXXFLAGS="$CXXFLAGS -DNOOPENGL"
93   enable_opengl="no"
94 else
95   CFLAGS="$CFLAGS $GL_CFLAGS"
96   CXXFLAGS="$CXXFLAGS $GL_CFLAGS"
97   LIBS="$LIBS $GL_LIBS"
98 fi
99
100 AC_CHECK_LIB(z, gzopen,, AC_MSG_ERROR([*** zlib is missing]))
101
102 CXXFLAGS="$CXXFLAGS -DDATA_PREFIX='\"$datadir/supertux\"'" 
103
104 dnl Checks for library functions.
105 AC_CHECK_FUNCS(mkdir strdup strstr)
106
107 AC_OUTPUT(Makefile m4/Makefile intl/Makefile
108           src/Makefile
109           data/Makefile
110           po/Makefile.in
111           lib/Makefile)
112
113 echo ""
114 echo "Features:"
115 echo "========="
116 echo " Profile Mode:   $enable_gprof"
117 echo " Debug Mode:     $enable_debug"
118 echo " OpenGL Support: $enable_opengl"
119 echo ""
120
121 # EOF #