little improvement
[supertux.git] / configure.ac
1 dnl ===========================================================================
2 dnl    "configure.in"
3 dnl
4 dnl author: Duong-Khang NGUYEN
5 dnl         neoneurone@users.sf.net
6 dnl ===========================================================================
7
8 dnl Process this file with autoconf to produce a configure script.
9
10 AC_PREREQ([2.54])
11 AC_INIT(SuperTux, 0.0.7-cvs)
12 AC_CONFIG_SRCDIR([src/supertux.cpp])
13 AC_CANONICAL_TARGET
14 AM_INIT_AUTOMAKE
15
16 SDL_VERSION=1.2.4
17
18 AC_PROG_CC
19 AC_PROG_CXX
20 AC_PROG_INSTALL
21
22 dnl Checks for header files.
23 AC_HEADER_DIRENT
24 AC_HEADER_STDC
25 AC_CHECK_HEADERS(unistd.h)
26
27 dnl Checks for typedefs, structures, and compiler characteristics.
28 AC_C_CONST
29
30 dnl ===========================================================================
31 dnl Give advanced users some options to play with
32
33 AC_MSG_CHECKING(for gprof mode)
34 AC_ARG_ENABLE(gprof,
35               AC_HELP_STRING([--enable-gprof], [enable GNU profiling support]),, enable_gprof="no")
36 if test "x${enable_gprof}" != "xno"; then
37     CXXFLAGS="$CXXFLAGS -pg"
38     AC_MSG_RESULT([enabled])
39 else
40     AC_MSG_RESULT([disabled])
41 fi
42
43 AC_MSG_CHECKING(for debug mode)
44 AC_ARG_ENABLE(debug,
45               AC_HELP_STRING([--enable-debug], [enable debugging mode]),, enable_debug="yes")
46 if test "x${enable_debug}" != "xno"; then
47     CXXFLAGS="$CXXFLAGS -Wall -W -DDEBUG"
48     AC_MSG_RESULT([enabled])
49 else
50     AC_MSG_RESULT([disabled])
51 fi
52
53 AC_MSG_CHECKING(wether OpenGL should be used)
54 AC_ARG_ENABLE(opengl,
55               AC_HELP_STRING([--disable-opengl], [disable OpenGL support]),, enable_opengl="yes")
56 if test "x${enable_opengl}" != "xno"; then
57     AC_MSG_RESULT([yes])
58 else
59     AC_MSG_RESULT([no])
60 fi
61
62 dnl ===========================================================================
63 dnl Check for SDL
64 AM_PATH_SDL($SDL_VERSION,
65             :,
66             AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]))
67 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
68 CFLAGS="$CFLAGS $SDL_CFLAGS"
69 LIBS="$LIBS $SDL_LIBS"
70
71 dnl Checks for additional libraries.
72 AC_CHECK_LIB(SDL_mixer, Mix_OpenAudio,,
73         AC_MSG_ERROR([SDL_mixer library required]))
74
75 AC_CHECK_LIB(SDL_image, IMG_Load,,
76         AC_MSG_ERROR([SDL_image library required]))
77
78 if test "x${enable_opengl}" != "xno"; then
79   AX_CHECK_GL
80 fi
81 if test "x$no_gl" = "xyes" -o "x$enable_opengl" = "xno"; then
82   CXXFLAGS="$CXXFLAGS -DNOOPENGL"
83   enable_opengl="no"
84 else
85   CFLAGS="$CFLAGS $GL_CFLAGS"
86   CXXFLAGS="$CXXFLAGS $GL_CFLAGS"
87   LIBS="$LIBS $GL_LIBS"
88 fi
89
90 AC_CHECK_LIB(z, gzopen,, AC_MSG_ERROR([*** zlib is missing]))
91
92 CXXFLAGS="$CXXFLAGS -DDATA_PREFIX='\"$datatdir/supertux\"'" 
93
94 dnl Checks for library functions.
95 AC_CHECK_FUNCS(mkdir strdup strstr)
96
97 AC_OUTPUT(Makefile src/Makefile data/Makefile)
98
99 echo ""
100 echo "Features:"
101 echo "========="
102 echo " Profile Mode:   $enable_gprof"
103 echo " Debug Mode:     $enable_debug"
104 echo " OpenGL Support: $enable_opengl"
105 echo ""
106
107 # EOF #