use C for SDL_mixer/image test
[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_INIT(SuperTux, 0.0.7-cvs)
11 AC_CONFIG_SRCDIR([src/supertux.cpp])
12 AC_CANONICAL_TARGET
13 AM_INIT_AUTOMAKE
14
15 SDL_VERSION=1.2.4
16
17 AC_PROG_CC
18 AC_PROG_CXX
19 AC_PROG_INSTALL
20 AC_LANG(C++)
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 -DDEBUG"
48     AC_MSG_RESULT([enabled])
49 else
50     AC_MSG_RESULT([disabled])
51 fi
52
53 AC_MSG_CHECKING(weather 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     CXXFLAGS="$CXXFLAGS -D__OPENGL"
58     AC_MSG_RESULT([yes])
59 else
60     CXXFLAGS="$CXXFLAGS -DNOOPENGL"
61     AC_MSG_RESULT([no])
62 fi
63
64 AC_MSG_CHECKING(weather Sound should be supported)
65 AC_ARG_ENABLE(sound,
66               AC_HELP_STRING([--disable-sound], [disable sound support]),, enable_sound="yes")
67 if test "x${enable_sound}" != "xno"; then
68     CXXFLAGS="$CXXFLAGS -D__SOUND"
69     AC_MSG_RESULT([yes])
70 else
71     CXXFLAGS="$CXXFLAGS -DNOSOUND"
72     AC_MSG_RESULT([no])
73 fi
74
75 dnl ===========================================================================
76 dnl Check for SDL
77 AC_LANG_PUSH(C)
78 AM_PATH_SDL($SDL_VERSION,
79             :,
80             AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]))
81 CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
82 LDFLAGS="$LDFLAGS $SDL_LIBS"
83
84 dnl Checks for additional libraries.
85 if test "x${enable_sound}" != "xno"; then
86   AC_CHECK_LIB(SDL_mixer, SDL_OpenAudio,, 
87   [CXXFLAGS="$CXXFLAGS -DNOSOUND"
88    enable_sound="no"])
89 fi
90
91 AC_CHECK_LIB(SDL_image, IMG_Load, ,AC_MSG_ERROR(SDL_image library required))
92
93 if test "x${enable_opengl}" != "xno"; then
94   # grumbel: xlib path is needed on my system to get OpenGL right,
95   # else I end up with a black screen, might be a debian issue or a
96   # local issue on my system, not sure
97   AC_PATH_XTRA
98   CXXFLAGS="$CXXFLAGS $X_CFLAGS"
99   LDFLAGS="$LDFLAGS $X_LIBS"
100
101   AC_CHECK_LIB(GL, glBegin,, 
102   [CXXFLAGS="$CXXFLAGS -DNOOPENGL"
103    enable_opengl="no"])
104 fi
105 AC_LANG_POP()
106
107 AC_CHECK_LIB(z, gzopen,, AC_MSG_ERROR([*** zlib is missing]))
108
109 # FIXME: Evil
110 CXXFLAGS="$CXXFLAGS -DDATA_PREFIX='\"$datadir/supertux/\"' -DLINUX"
111
112 dnl Checks for library functions.
113 AC_CHECK_FUNCS(mkdir strdup strstr)
114
115 AC_OUTPUT(Makefile src/Makefile data/Makefile)
116
117 echo ""
118 echo "Features:"
119 echo "========="
120 echo " Profile Mode:   $enable_gprof"
121 echo " Debug Mode:     $enable_debug"
122 echo " OpenGL Support: $enable_opengl"
123 echo " Sound Support:  $enable_sound"
124 echo ""
125
126 # EOF #