]> icculus.org git repositories - dana/openbox.git/blob - configure.in
include depcomp in make dist
[dana/openbox.git] / configure.in
1 dnl configure.in for Openbox
2 dnl Initialize autoconf and automake
3 AC_INIT(src/blackbox.cc)
4 AM_INIT_AUTOMAKE(openbox,2.2.2,no-define)
5
6 dnl Determine default prefix
7 test x$prefix = "xNONE" && prefix="$ac_default_prefix"
8
9 dnl Check for various flavors of UNIX(r)
10 dnl AC_AIX
11 dnl AC_ISC_POSIX
12
13 dnl Locate required external software
14 AC_PROG_CC
15 AC_PROG_CXX
16 AC_PROG_INSTALL
17
18 dnl Determine if maintainer portions of the Makefiles should be included.
19 AM_MAINTAINER_MODE
20
21 AC_LANG(C++)
22
23 AC_CHECK_PROGS(regex_cmd, sed)
24 if test x$regex_cmd = "x"; then
25   AC_MSG_ERROR([error. sed is required to build the default menu file.])
26 fi
27
28 dnl Check for system header files
29 AC_CHECK_HEADERS(ctype.h dirent.h fcntl.h libgen.h locale.h nl_types.h process.h signal.h stdarg.h stdio.h string.h stdlib.h time.h unistd.h sys/param.h sys/select.h sys/signal.h sys/stat.h sys/time.h sys/types.h sys/wait.h)
30 AC_HEADER_TIME
31
32 dnl Check for existance of basename(), setlocale() and strftime()
33 AC_CHECK_FUNCS(basename, , AC_CHECK_LIB(gen, basename,
34                           AC_DEFINE(HAVE_BASENAME) LIBS="$LIBS -lgen"))
35 AC_CHECK_FUNCS(getpid setlocale sigaction strftime strcasestr snprintf vsnprintf catopen catgets catclose)
36 AC_CHECK_LIB(nsl, t_open, LIBS="$LIBS -lnsl")
37 AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
38
39 dnl Check for X headers and libraries
40 AC_PATH_X
41 AC_PATH_XTRA
42
43 test "$no_x" = "yes" && AC_MSG_ERROR([Openbox requires the X Window System libraries and headers.])
44
45 test x$x_includes = "x" && x_includes="/usr/include"
46 test x$x_libraries = "x" && x_libraries="/usr/lib"
47
48 CFLAGS="$CFLAGS $X_CFLAGS"
49 CXXFLAGS="$CXXFLAGS $X_CFLAGS"
50 LIBS="$LIBS $X_LIBS"
51 LDFLAGS="$LDFLAGS $LIBS $X_PRE_LIBS"
52
53 AC_MSG_CHECKING(for GCC)
54 if test "$GCC" = "yes"; then
55   AC_MSG_RESULT([yes])
56   CXXFLAGS="${CXXFLAGS} -Wall -W"
57 else
58   AC_MSG_RESULT([no, trying other compilers])
59   AC_MSG_CHECKING(for MIPSpro)
60   mips_pro_ver=`$CC -version 2>&1 | grep -i mipspro | cut -f4 -d ' '`
61   if test "x$mips_pro_ver" = "x"; then
62     AC_MSG_RESULT([no])
63   else
64     AC_MSG_RESULT([yes, version $mips_pro_ver.])
65     AC_MSG_CHECKING(for -LANG:std in CXXFLAGS)
66     lang_std_not_set=`echo $CXXFLAGS | grep "\-LANG:std"`
67     if test "x$lang_std_not_set" = "x"; then
68       AC_MSG_RESULT([not set, setting.])
69       CXXFLAGS="${CXXFLAGS} -LANG:std"
70     else
71       AC_MSG_RESULT([already set.])
72     fi
73   fi
74 fi
75
76 dnl Check for required functions in -lX11
77 AC_CHECK_LIB(X11, XOpenDisplay,
78   LIBS="$LIBS -lX11",
79   AC_MSG_ERROR([Could not find XOpenDisplay in -lX11.])
80 )
81
82 LIBS="$LIBS $X_EXTRA_LIBS"
83
84 dnl Check for XShape extension support and proper library files.
85 SHAPE=""
86 AC_MSG_CHECKING([whether to build support for the XShape extension])
87 AC_ARG_ENABLE(
88   shape, [  --enable-shape          enable support of the XShape extension @<:@default=yes@:>@])
89
90 : ${enableval="yes"}
91 if test "$enableval" = "yes"; then
92   AC_MSG_RESULT([yes])
93   AC_CHECK_LIB(Xext, XShapeCombineShape,
94         AC_MSG_CHECKING([for X11/extensions/shape.h])
95         AC_TRY_LINK(
96 #include <X11/Xlib.h>
97 #include <X11/Xutil.h>
98 #include <X11/extensions/shape.h>
99 , long foo = ShapeSet,
100           AC_MSG_RESULT([yes])
101           SHAPE="yes",
102           AC_MSG_RESULT([no])
103         )
104   )
105 else
106   AC_MSG_RESULT([no])
107 fi
108 if test "$SHAPE" = "yes"; then
109   LIBS="$LIBS -lXext"
110   AC_DEFINE(SHAPE,1,Enable support of the XShape extension)
111 fi
112
113 dnl Check for Xinerama extension support and proper library files.
114 XINERAMA=""
115 AC_MSG_CHECKING([whether to build support for the Xinerama extension])
116 AC_ARG_ENABLE(
117   xinerama, [  --enable-xinerama       enable support of the Xinerama extension @<:@default=no@:>@],
118   if test "$enableval" = "yes"; then
119         AC_MSG_RESULT([yes])
120
121         AC_CHECK_LIB(Xinerama, XineramaQueryExtension,
122           AC_MSG_CHECKING([for X11/extensions/Xinerama.h])
123           AC_TRY_LINK(
124 #include <X11/Xlib.h>
125 #include <X11/extensions/Xinerama.h>
126 , XineramaScreenInfo foo,
127                 AC_MSG_RESULT([yes])
128                 XINERAMA="yes"
129                 LIBS="$LIBS -lXinerama",
130                 AC_MSG_RESULT([no])
131           )
132         )
133
134   else
135         AC_MSG_RESULT([no])
136   fi,
137   AC_MSG_RESULT([no])
138 )
139 if test "$XINERAMA" = "yes"; then
140   AC_DEFINE(XINERAMA,1,Enable support of the Xinerama extension)
141 fi
142
143 dnl Check for Xft extension support and proper library files.
144 XFT=""
145 XFT2=""
146 XFT_CFLAGS=""
147 XFT_LIBS=""
148 AC_MSG_CHECKING([whether to build support for the Xft extension])
149 AC_ARG_ENABLE(
150   xft, [  --enable-xft            enable support of the Xft extension @<:@default=yes@:>@])
151 : ${enableval="yes"}
152 if test "$enableval" = "yes"; then
153
154   if pkg-config xft; then
155     XFT2="yes"
156     AC_MSG_RESULT([version 2])
157     S_CXXFLAGS=${CXXFLAGS}
158     S_LIBS=${LIBS}
159     XFT_CFLAGS="`pkg-config --cflags xft`"
160     XFT_LIBS="`pkg-config --libs xft`"
161     CXXFLAGS="${XFT_CFLAGS} ${CXXFLAGS}"
162     LIBS="${LIBS} ${XFT_LIBS}"
163     AC_CHECK_LIB(Xft, XftFontOpenXlfd,
164       AC_MSG_CHECKING([for X11/Xft/Xft.h for Xft2])
165       AC_TRY_LINK(
166       [
167         #include <X11/Xlib.h>
168         #include <X11/Xft/Xft.h>
169       ],
170       [
171         int i = XFT_MAJOR;
172         XftFont foo;
173       ],
174       [
175         AC_MSG_RESULT([yes])
176         XFT="yes"
177       ],
178       [
179         AC_MSG_RESULT([no])
180         XFT2=""
181         XFT_CFLAGS=""
182         XFT_LIBS=""
183         AC_MSG_RESULT()
184         AC_MSG_RESULT([** WARNING: Xft support is disabled! **])
185         AC_MSG_RESULT()
186       ]
187       )
188     )
189     CXXFLAGS=${S_CXXFLAGS}
190     LIBS=${S_LIBS}
191   else 
192     AC_MSG_RESULT([version 1])
193     AC_CHECK_LIB(Xft, XftFontOpenXlfd,
194       AC_MSG_CHECKING([for X11/Xft/Xft.h for Xft1])
195       AC_TRY_LINK(
196       [
197         #include <X11/Xlib.h>
198         #include <X11/Xft/Xft.h>
199       ],
200       [
201         XftFont foo;
202       ],
203       [
204         AC_MSG_RESULT([yes])
205         XFT="yes"
206         XFT_LIBS="$LIBS -lXft"
207
208         dnl Check for utf8 support in the Xft library
209         dnl AC_CHECK_LIB(Xft, XftDrawStringUtf8,
210         dnl  XFT_UTF8="yes",
211         dnl),
212       ],
213       [
214         AC_MSG_RESULT([no])
215         AC_MSG_RESULT()
216         AC_MSG_RESULT([** WARNING: Xft support is disabled! **])
217         AC_MSG_RESULT()
218       ]
219       )
220     )
221   fi
222 else
223   AC_MSG_RESULT([no])
224 fi
225 if test "$XFT" = "yes"; then
226   AC_SUBST([XFT_CFLAGS])
227   AC_SUBST([XFT_LIBS])
228   AC_DEFINE(XFT,1,[Enable support of the Xft extension])
229   dnl if test "$XFT_UTF8" = "yes"; then
230     dnl AC_DEFINE(XFT_UTF8,1,[Support for Utf8 text in the Xft extension])
231   dnl fi
232 fi
233 AM_CONDITIONAL(XFT, test "$XFT" = "yes")
234 AM_CONDITIONAL(XFT2, test "$XFT2" = "yes")
235         
236 dnl Check for ordered 8bpp dithering
237 ORDEREDPSEUDO=""
238 AC_MSG_CHECKING([whether to include Pseudocolor ordered dithering code])
239 AC_ARG_ENABLE(ordered-pseudo,
240 [  --enable-ordered-pseudo include code for ordered pseudocolor (8bpp)
241                           dithering @<:@default=no@:>@],
242   if test "$enableval" = "yes"; then
243     AC_MSG_RESULT([yes])
244     ORDEREDPSEUDO="yes" 
245   else
246     AC_MSG_RESULT([no]) 
247   fi,
248   AC_MSG_RESULT([no])
249 )
250 if test "$ORDEREDPSEUDO" = "yes"; then
251   AC_DEFINE(ORDEREDPSEUDO,1,Enable pseudocolor ordered dithering)
252 fi
253
254 dnl Check whether to include debugging code
255 DEBUG=""
256 AC_MSG_CHECKING([whether to include verbose debugging code])
257 AC_ARG_ENABLE(debug,
258   [  --enable-debug          include verbose debugging code @<:@default=no@:>@],
259   if test "$enableval" = "yes"; then
260     AC_MSG_RESULT([yes])
261     if test "$GCC" = "yes"; then
262        DEBUG="-DDEBUG -fno-inline -g"
263     else
264        DEBUG="-DDEBUG"
265     fi
266   else
267     AC_MSG_RESULT([no])
268     DEBUG="-DNDEBUG"
269   fi,
270   AC_MSG_RESULT([no])
271   DEBUG="-DNDEBUG"
272 )
273 AC_SUBST(DEBUG)
274
275 dnl Check whether to include natural language support (i18n)
276 NLS=""
277 AC_MSG_CHECKING([whether to include NLS support])
278 AC_ARG_ENABLE(nls,
279   [  --enable-nls            include natural language support @<:@default=yes@:>@],
280   if test "$enableval" = "yes"; then
281     AC_MSG_RESULT([yes])
282     NLS="yes"
283   else
284     AC_MSG_RESULT([no])
285   fi,
286   AC_MSG_RESULT([yes])
287   NLS="yes"
288 )
289
290 AC_CHECK_LIB(xpg4, setlocale, LIBS="$LIBS -lxpg4")
291
292 AC_CHECK_PROGS(gencat_cmd, gencat)
293 if test x$gencat_cmd = "x"; then
294   NLS=""
295 fi
296
297 if test "$NLS" = "yes"; then
298   AC_DEFINE(NLS,1,Include natural language support)
299   AC_SUBST(NLS)
300 fi
301
302 dnl Check for new timed pixmap cache
303 TIMEDCACHE=""
304 AC_MSG_CHECKING([whether to use the timed pixmap cache])
305 AC_ARG_ENABLE(
306   timed-cache,
307 [  --enable-timed-cache    use timed pixmap cache @<:@default=yes@:>@],
308   if test "$enableval" = "yes"; then
309     AC_MSG_RESULT([yes])
310     TIMEDCACHE="yes"
311   else
312     AC_MSG_RESULT([no])
313   fi,
314   AC_MSG_RESULT([yes])
315   TIMEDCACHE="yes"
316 )
317 if test "$TIMEDCACHE" = "yes"; then
318   AC_DEFINE(TIMEDCACHE,1,Use timed pixmap cache)
319 fi
320
321 dnl Check for bitmapped buttons
322 BITMAPBUTTONS=""
323 AC_MSG_CHECKING([whether to include bitmappable buttons])
324 AC_ARG_ENABLE(
325   bitmap-buttons,
326 [  --enable-bitmap-buttons include bitmappable buttons @<:@default=yes@:>@],
327   if test x$enableval = "xyes"; then
328     AC_MSG_RESULT([yes])
329     BITMAPBUTTONS="yes"
330   else
331     AC_MSG_RESULT([no])
332   fi,
333   AC_MSG_RESULT([yes])
334   BITMAPBUTTONS="yes"
335 )
336 if test x$BITMAPBUTTONS = "xyes"; then
337   AC_DEFINE(BITMAPBUTTONS,1,Include bitmappable buttons)
338 fi
339
340 dnl Determine the return type of signal handlers
341 AC_TYPE_SIGNAL
342
343 dnl Print results
344 AC_MSG_RESULT([])
345 AC_MSG_RESULT([ $PACKAGE version $VERSION configured successfully.])
346 AC_MSG_RESULT([])
347 AC_MSG_RESULT([Using '$prefix' for installation.])
348 AC_MSG_RESULT([Using '$CXX' for C++ compiler.])
349 AC_MSG_RESULT([Building with '$CXXFLAGS' for C++ compiler flags.])
350 AC_MSG_RESULT([Building with '$LIBS' for linker flags.])
351 AC_MSG_RESULT([])
352
353 dnl Output files
354 AM_CONFIG_HEADER(config.h)
355 AC_OUTPUT(Makefile
356 src/Makefile
357 util/Makefile
358 util/epist/Makefile
359 data/Makefile
360 data/styles/Makefile
361 data/buttons/Makefile
362 doc/Makefile
363 nls/Makefile
364 nls/C/Makefile
365 nls/da_DK/Makefile
366 nls/de_DE/Makefile
367 nls/es_AR/Makefile
368 nls/es_ES/Makefile
369 nls/et_EE/Makefile
370 nls/fr_FR/Makefile
371 nls/hu_HU/Makefile
372 nls/it_IT/Makefile
373 nls/ja_JP/Makefile
374 nls/ko_KR/Makefile
375 nls/lv_LV/Makefile
376 nls/no_NO/Makefile
377 nls/pl_PL/Makefile
378 nls/nl_NL/Makefile
379 nls/pt_BR/Makefile
380 nls/ro_RO/Makefile
381 nls/ru_RU/Makefile
382 nls/sk_SK/Makefile
383 nls/sl_SI/Makefile
384 nls/sv_SE/Makefile
385 nls/tr_TR/Makefile
386 nls/uk_UA/Makefile
387 nls/zh_CN/Makefile
388 nls/zh_TW/Makefile
389 version.h)