updates
[blackbox.git] / configure.ac
blobb756bf05d99d435e915126c79d5cbccb59c5bd59
1 dnl configure.in for Blackbox - an X11 Window manager
2 dnl Initialize autoconf and automake
4 AC_INIT([blackbox], [0.70.0cvs], [http://blackboxwm.sourceforge.net])
5 AM_INIT_AUTOMAKE([blackbox], [0.70.0cvs])
6 AC_CONFIG_SRCDIR([src/blackbox.cc])
8 dnl Determine default prefix
9 test "x$prefix" = "xNONE" && prefix="$ac_default_prefix"
11 dnl Look in the most logical places for external libraries
12 CPPFLAGS="$CPPFLAGS -I$prefix/include"
13 LDFLAGS="$LDFLAGS -L$prefix/lib"
14 if test "x$prefix" != "x/usr/local"; then
15   CPPFLAGS="$CPPFLAGS -I/usr/local/include"
16   LDFLAGS="$LDFLAGS -L/usr/local/lib"
19 dnl Locate required external software
20 AC_PROG_CC
22 dnl Blackbox requires ANSI C headers
23 AC_HEADER_STDC
24 if test "$ac_cv_header_stdc" = "no"; then
25   AC_MSG_ERROR([Blackbox requires ANSI C headers.])
28 AC_PROG_CXX
29 AC_PROG_INSTALL
31 dnl libbt shouldn't be shared by default (yet)
32 AC_DISABLE_SHARED
33 AC_PROG_LIBTOOL
34 AC_SUBST(LIBTOOL_DEPS)
36 AC_CHECK_PROGS([regex_cmd], [sed])
37 if test "x$regex_cmd" = "x"; then
38   AC_MSG_ERROR([error. sed is required to build the default menu file.])
41 AC_CHECK_PROGS([gencat_cmd], [gencat])
42 if test "x$gencat_cmd" = "x"; then
43   NLS=
46 dnl Blackbox uses C++
47 AC_LANG([C++])
49 dnl Compiler specific options
50 if test "x$GXX" = "xyes"; then
51    CXXFLAGS="${CXXFLAGS} -Wall -W -pedantic"
52    gxx_ver=`$CXX -dumpversion|sed -e 's/\..*//'`
53    AC_MSG_CHECKING([GNU C++ major version])
54    AC_MSG_RESULT([$gxx_ver])
55    if test "$gxx_ver" -ge 3; then
56      CXXFLAGS="${CXXFLAGS} -Woverloaded-virtual -Wshadow"
57    fi
58 else
59    mips_pro_ver=`$CC -version 2>&1 | grep -i mipspro | cut -f4 -d ' '`
60    if test "x$mips_pro_ver" != "x"; then
61       AC_MSG_CHECKING([for MIPSpro version])
62       AC_MSG_RESULT([$mips_pro_ver.])
63       AC_MSG_CHECKING(for -LANG:std in CXXFLAGS)
64       lang_std_not_set=`echo $CXXFLAGS | grep "\-LANG:std"`
65       if test "x$lang_std_not_set" = "x"; then
66          AC_MSG_RESULT([not set, setting.])
67          CXXFLAGS="${CXXFLAGS} -LANG:std"
68       else
69          AC_MSG_RESULT([already set.])
70       fi
71    fi 
74 dnl Check if some required functions live in the C library, or in an
75 dnl external library
77 ICONV=
78 AC_CHECK_FUNCS([iconv_open],
79                [],
80                [AC_CHECK_LIB([iconv],
81                              [iconv_open],
82                              [ICONV="-liconv"],
83                              [AC_CHECK_LIB([iconv],
84                                            [libiconv_open],
85                                            [ICONV="-liconv"],
86                                            [AC_MSG_ERROR([Blackbox requires iconv(3) support.])])
87                              ])
88                ])
89 AC_SUBST(ICONV)
91 dnl check if we are using GNU libiconv
92 AC_MSG_CHECKING([for GNU libiconv])
93 AC_COMPILE_IFELSE([
94 #include <sys/types.h>
95 #include <iconv.h>
97 int main(int, char **) {
98     iconv_t cd;
99     const char *inp;
100     char *outp;
101     size_t inbytes, outbytes;
102     iconv(cd, &inp, &inbytes, &outp, &outbytes);
103     return 0;
106                   [AC_DEFINE([HAVE_GNU_LIBICONV], [1],
107                              [Define to 1 when using GNU libiconv])
108                    AC_MSG_RESULT([yes])],
109                   [AC_MSG_RESULT([no, assuming POSIX compliance])]
110                  )
112 LOCALE=
113 AC_CHECK_FUNCS([setlocale],
114                [],
115                [AC_CHECK_LIB([xpg4],
116                              [setlocale],
117                              [LOCALE="-lxpg4"],
118                              [AC_MSG_ERROR([Blackbox requires setlocale(3) support.])])
119                ])
120 AC_SUBST(LOCALE)
122 AC_CHECK_FUNCS([nl_langinfo])
124 dnl needed for some X11 libs
125 AC_CHECK_LIB([nsl],
126              [t_open],
127              [LIBS="$LIBS -lnsl"])
128 AC_CHECK_LIB([socket],
129              [socket],
130              [LIBS="$LIBS -lsocket"])
132 dnl Check for X headers and libraries
133 AC_PATH_X
135 if test "x$no_x" = "xyes"; then
136   AC_MSG_ERROR([Blackbox requires the X Window System libraries and headers.])
139 if test "x$x_includes" != "x"; then
140   CPPFLAGS="$CPPFLAGS -I$x_includes"
141   CXXFLAGS="$CXXFLAGS -I$x_includes"
143 if test "x$x_libraries" != "x"; then
144   LIBS="$LIBS -L$x_libraries"
147 dnl Check for required functions in -lX11
148 XLIB=
149 AC_CHECK_LIB([X11], [XOpenDisplay], [XLIB=yes], [XLIB=no])
150 test "x$XLIB" = "xno" && AC_MSG_ERROR([standard X11 libraries not found])
152 AC_CHECK_HEADERS([X11/Xlib.h], [XLIB=yes], [XLIB=no])
153 test "x$XLIB" = "xno" && AC_MSG_ERROR([standard X11 headers not found])
155 AC_CHECK_HEADERS([X11/Xatom.h X11/Xlocale.h X11/Xresource.h X11/Xutil.h X11/keysym.h], [XLIB=yes], [XLIB=no],
157 #include <X11/Xlib.h>
159 test "x$XLIB" = "xno" && AC_MSG_ERROR([standard X11 headers not found])
161 dnl Check for SHAPE extension support and proper library files.
162 AC_MSG_CHECKING([whether to build support for the SHAPE extension])
163 AC_ARG_ENABLE([shape],
164               AC_HELP_STRING([--enable-shape],
165                              [enable support of the SHAPE extension @<:@default=yes@:>@]),
166               [SHAPE="$enableval"],
167               [SHAPE=yes])
168 AC_MSG_RESULT([$SHAPE])
170 if test "x$SHAPE" = "xyes"; then
171   AC_CHECK_LIB([Xext], [XShapeCombineShape], [SHAPE=yes], [SHAPE=no])
172   
173   if test "x$SHAPE" = "xyes"; then
174     save_LIBS="$LIBS"
175       
176     if echo "$LIBS" | grep -q Xext 2>&1 >/dev/null; then
177       LIBS="$LIBS -lXext"
178     fi
179     AC_CHECK_HEADERS([X11/extensions/shape.h], [SHAPE=yes], [SHAPE=no],
181 #include <X11/Xlib.h>
183       
184     if test "x$SHAPE" = "xyes"; then
185       SHAPE="-DSHAPE"
186     else
187       SHAPE=
188       LIBS="$save_LIBS"
189     fi
190   else
191     SHAPE=
192   fi
193 else
194   SHAPE=
196 AC_SUBST([SHAPE])
198 dnl Check for MIT-SHM extension support and proper library files.
199 AC_MSG_CHECKING([whether to build support for the MIT-SHM extension])
200 AC_ARG_ENABLE([mitshm],
201               AC_HELP_STRING([--enable-mitshm],
202                              [enable support of the MIT-SHM extension @<:@default=yes@:>@]),
203               [MITSHM="$enableval"],
204               [MITSHM=yes])
205 AC_MSG_RESULT([$MITSHM])
207 if test "x$MITSHM" = "xyes"; then
208   AC_CHECK_LIB([Xext], [XShmPutImage], [MITSHM=yes], [MITSHM=no])
210   if test "x$MITSHM" = "xyes"; then
211     save_LIBS="$LIBS"
213     LIBS="$LIBS -lXext"
214     AC_CHECK_HEADERS([X11/extensions/XShm.h], [MITSHM=yes], [MITSHM=no],
216 #include <X11/Xlib.h>
219     if test "x$MITSHM" = "xyes"; then
220       MITSHM="-DMITSHM"
221     else
222       MITSHM=
223       LIBS="$save_LIBS"
224     fi
225   else
226     MITSHM=
227   fi
228 else
229   MITSHM=
231 AC_SUBST([MITSHM])
233 LIBS="$LIBS -lX11"
235 dnl Check for Xft libraries
236 AC_MSG_CHECKING([whether to build support for Xft])
237 AC_ARG_ENABLE([xft],
238               AC_HELP_STRING([--enable-xft],
239                              [enable support for the Xft library @<:@default=yes@:>@]),
240               [XFT="$enableval"],
241               [XFT=yes])
242 AC_MSG_RESULT([$XFT])
244 if test "x$XFT" = "xyes"; then
245   PKG_CHECK_MODULES([xft],
246                     [xft >= 2.0.0], 
247                     [XFT="-DXFT"
248                      XFT_PKGCONFIG="xft >= 2.0.0"
249                      CXXFLAGS="$CXXFLAGS $xft_CFLAGS"
250                      LIBS="$LIBS $xft_LIBS"],
251                     [XFT=
252                      XFT_PKGCONFIG=])
253 else
254   XFT=
255   XFT_PKGCONFIG=
257 AC_SUBST([XFT])
258 AC_SUBST([XFT_PKGCONFIG])
260 dnl Check whether to include debugging code
261 AC_MSG_CHECKING([whether to include verbose debugging code])
262 AC_ARG_ENABLE([debug],
263               AC_HELP_STRING([--enable-debug],
264                              [include verbose debugging code @<:@default=no@:>@]),
265               [DEBUG="$enableval"],
266               [DEBUG=no])
267 AC_MSG_RESULT([$DEBUG])
269 if test "x$DEBUG" = "xyes"; then
270     DEBUG="-DDEBUG -fno-inline -g"
271 else
272     DEBUG=
274 AC_SUBST(DEBUG)
276 dnl Check whether to include natural language support (i18n)
277 AC_MSG_CHECKING([whether to include NLS support])
278 AC_ARG_ENABLE([nls],
279               AC_HELP_STRING([--enable-nls],
280                              [include natural language support @<:@default=yes@:>@]),
281               [NLS="$enableval"],
282               [NLS=yes])
283 AC_MSG_RESULT([$NLS])
285 if test "x$NLS" = "xyes"; then
286   NLS="-DNLS"
287 else
288   NLS=
290 AC_SUBST(NLS)
292 dnl Determine if maintainer portions of the Makefiles should be included.
293 AM_MAINTAINER_MODE
295 dnl Output files
296 AM_CONFIG_HEADER(config.h)
297 AC_CONFIG_FILES([
298 version.h
299 Makefile
300 data/Makefile
301 data/styles/Makefile
302 doc/Makefile
303 doc/fr_FR/Makefile
304 doc/ja_JP/Makefile
305 doc/nl_NL/Makefile
306 doc/sl_SI/Makefile
307 lib/Makefile
308 lib/libbt.pc
309 src/Makefile
310 util/Makefile
312 AC_OUTPUT
314 dnl Print results
315 AC_MSG_RESULT([])
316 AC_MSG_RESULT([ $PACKAGE version $VERSION configured successfully.])
317 AC_MSG_RESULT([])
318 AC_MSG_RESULT([Using '$prefix' for installation.])
319 AC_MSG_RESULT([Using '$CXX' for C++ compiler.])
320 AC_MSG_RESULT([Building with '$CPPFLAGS $CXXFLAGS' for C++ compiler flags.])
321 AC_MSG_RESULT([Building with '$LDFLAGS $LIBS' libraries.])
322 AC_MSG_RESULT([])