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