only run xgettext when it is installed
[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_SRCDIR([src/supertux.cpp])
16 AC_CONFIG_AUX_DIR([mk/autoconf])
17 AC_CANONICAL_TARGET
18
19 AC_CONFIG_HEADERS(config.h)
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
30 AC_CHECK_PROGS(XGETTEXT, xgettext)
31
32 dnl Checks for header files.
33 AC_HEADER_DIRENT
34 AC_HEADER_STDC
35 AC_CHECK_HEADERS(unistd.h)
36
37 dnl Checks for typedefs, structures, and compiler characteristics.
38 AC_C_CONST
39
40 dnl ===========================================================================
41 dnl Give advanced users some options to play with
42
43 VARIANT=optimize
44 AC_MSG_CHECKING(for gprof mode)
45 AC_ARG_ENABLE(gprof,
46               AC_HELP_STRING([--enable-gprof], [enable GNU profiling support]),
47               [enable_gprof=$enableval], [enable_gprof=no])
48 if test "$enable_gprof" = "yes"; then
49     #CXXFLAGS="$CXXFLAGS -pg"
50     VARIANT=profile
51     AC_MSG_RESULT([enabled])
52 else
53     AC_MSG_RESULT([disabled])
54 fi
55
56 AC_MSG_CHECKING(for debug mode)
57 AC_ARG_ENABLE(debug,
58               AC_HELP_STRING([--enable-debug], [enable debugging mode]),
59               [enable_debug=$enableval], [enable_debug=no])
60 if test "$enable_debug" = "yes"; then
61     AC_DEFINE([DEBUG], 1, [define to compile in debug checks])
62     #CXXFLAGS="$CXXFLAGS -Wall -Werror -O0 -g3"
63     VARIANT=debug
64     AC_MSG_RESULT([enabled])
65 else
66     #CXXFLAGS="$CXXFLAGS -O2 -g"
67     VARIANT=optimize
68     AC_MSG_RESULT([disabled])
69 fi
70 AC_SUBST([VARIANT])
71
72 AC_MSG_CHECKING(wether OpenGL should be used)
73 AC_ARG_ENABLE(opengl,
74               AC_HELP_STRING([--disable-opengl], [disable OpenGL support]),
75               [enable_opengl=$enableval], enable_opengl=yes)
76 if test "$enable_opengl" = "yes"; then
77     AC_MSG_RESULT([yes])
78 else
79     AC_MSG_RESULT([no])
80 fi
81
82 AC_CHECK_LIB([iconv], [iconv_open])
83 AC_TRY_LINK([#include <iconv.h>], [iconv_open(0, 0);],,
84     AC_MSG_ERROR([Couldn't find iconv library]))
85
86 dnl ===========================================================================
87 dnl Check for SDL
88 SDL_VERSION=1.2.4
89 AM_PATH_SDL($SDL_VERSION,
90             :,
91             AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]))
92
93 NP_FINDLIB([SDLMIXER], [SDL_mixer], [SDL_mixer >= 1.2],
94         NP_LANG_PROGRAM([#include <SDL_mixer.h>
95 #if MIX_MAJOR_VERSION < 1
96 # error SDLMix too old
97 #else
98 # if MIX_MAJOR_VERSION == 1
99 #  if MIX_MINOR_VERSION < 2
100 #   error SDLMix too old
101 #  endif
102 # endif
103 #endif], [Mix_OpenAudio(0, 0, 0, 0);]),
104         [], [-lSDL_mixer],
105         [],
106         [AC_MSG_ERROR([Please install SDLMixer >=1.2.2])],
107         [$SDL_CFLAGS], [$SDL_LIBS])
108
109 NP_FINDLIB([SDLIMAGE], [SDL_image], [SDL_image >= 1.2],
110         NP_LANG_PROGRAM([#include <SDL_image.h>], [IMG_Load("");]),
111         [], [-lSDL_image],
112         [],
113         [AC_MSG_ERROR([Please install SDLImage >= 1.2.1])],
114         [$SDL_CFLAGS], [$SDL_LIBS])
115
116 if test "$enable_opengl" = "yes"; then
117   AX_CHECK_GL
118 fi
119 if test "$no_gl" = "yes" -o "$enable_opengl" = "no"; then
120   GL_AVAILABLE="no"
121   AC_DEFINE([NOOPENGL],, [Define if opengl should not be used])
122 else
123   GL_AVAILABLE="yes"
124 fi
125 AC_SUBST([GL_AVAILABLE])
126
127 dnl Checks for library functions.
128 AC_CHECK_FUNCS(mkdir strdup strstr)
129
130 AC_INIT_JAM
131 AC_CONFIG_FILES([Jamconfig])
132
133 AC_OUTPUT
134
135 echo ""
136 echo "Features:"
137 echo "========="
138 echo " Profile Mode:   $enable_gprof"
139 echo " Debug Mode:     $enable_debug"
140 echo " OpenGL Support: $enable_opengl"
141 echo ""
142 echo ""
143 echo "       NOTE: This project uses jam (and not make) as build tool"
144 echo ""
145