fixed some more buggy AC_ENABLE usage
[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]),
42               [enable_gprof=$enableval], [enable_gprof=no])
43 if test "$enable_gprof" = "no"; then
44     CXXFLAGS="$CXXFLAGS -pg"
45     AC_MSG_RESULT([enabled])
46 else
47     AC_MSG_RESULT([disabled])
48 fi
49
50 AC_MSG_CHECKING(for debug mode)
51 AC_ARG_ENABLE(debug,
52               AC_HELP_STRING([--enable-debug], [enable debugging mode]),
53               [enable_debug=$enableval], [enable_debug=no])
54 if test "$enable_debug" = "yes"; then
55     CXXFLAGS="$CXXFLAGS -Wall -Werror -DDEBUG -O0 -g3"
56     AC_MSG_RESULT([enabled])
57 else
58     AC_MSG_RESULT([disabled])
59 fi
60
61 AC_MSG_CHECKING(wether OpenGL should be used)
62 AC_ARG_ENABLE(opengl,
63               AC_HELP_STRING([--disable-opengl], [disable OpenGL support]),
64               [enable_opengl=$enableval], enable_opengl=yes)
65 if test "$enable_opengl" = "yes"; then
66     AC_MSG_RESULT([yes])
67 else
68     AC_MSG_RESULT([no])
69 fi
70
71 AM_GNU_GETTEXT
72
73 dnl ===========================================================================
74 dnl Check for SDL
75 AM_PATH_SDL($SDL_VERSION,
76             :,
77             AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]))
78 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
79 CFLAGS="$CFLAGS $SDL_CFLAGS"
80 LIBS="$LIBS $SDL_LIBS"
81 GL_LIBS="-lGL"
82
83 dnl Checks for additional libraries.
84 AC_CHECK_LIB(SDL_mixer, Mix_OpenAudio,,
85         AC_MSG_ERROR([SDL_mixer library required]))
86
87 AC_CHECK_LIB(SDL_image, IMG_Load,,
88         AC_MSG_ERROR([SDL_image library required]))
89
90 if test "$enable_opengl" = "yes"; then
91   AX_CHECK_GL
92 fi
93 if test "$no_gl" = "yes" -o "$enable_opengl" = "no"; then
94   CXXFLAGS="$CXXFLAGS -DNOOPENGL"
95   enable_opengl=no
96 else
97   CFLAGS="$CFLAGS $GL_CFLAGS"
98   CXXFLAGS="$CXXFLAGS $GL_CFLAGS"
99   LIBS="$LIBS $GL_LIBS"
100 fi
101
102 AC_CHECK_LIB(z, gzopen,, AC_MSG_ERROR([*** zlib is missing]))
103
104 CXXFLAGS="$CXXFLAGS -DDATA_PREFIX='\"$datadir/supertux\"'" 
105
106 dnl Checks for library functions.
107 AC_CHECK_FUNCS(mkdir strdup strstr)
108
109 AC_OUTPUT(Makefile m4/Makefile intl/Makefile
110           src/Makefile
111           data/Makefile
112           po/Makefile.in
113           lib/Makefile)
114
115 echo ""
116 echo "Features:"
117 echo "========="
118 echo " Profile Mode:   $enable_gprof"
119 echo " Debug Mode:     $enable_debug"
120 echo " OpenGL Support: $enable_opengl"
121 echo ""
122
123 # EOF #