]> icculus.org git repositories - dana/openbox.git/blob - configure.in
more verbose, and better checks for Xft version 2/1
[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.1,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 AC_MSG_CHECKING([whether to build support for the Xft extension])
147 AC_ARG_ENABLE(
148   xft, [  --enable-xft            enable support of the Xft extension @<:@default=yes@:>@])
149 : ${enableval="yes"}
150 if test "$enableval" = "yes"; then
151
152   if pkg-config xft; then
153     XFT2="yes"
154     AC_MSG_RESULT([version 2])
155     S_CXXFLAGS=${CXXFLAGS}
156     S_LIBS=${LIBS}
157     XFT_CFLAGS="`pkg-config --cflags xft`"
158     XFT_LIBS="`pkg-config --libs xft`"
159     CXXFLAGS="${XFT_CFLAGS} ${CXXFLAGS}"
160     LIBS="${LIBS} ${XFT_LIBS}"
161     AC_CHECK_LIB(Xft, XftFontOpenXlfd,
162       AC_MSG_CHECKING([for X11/Xft/Xft.h for Xft2])
163       AC_TRY_LINK(
164       [
165         #include <X11/Xlib.h>
166         #include <X11/Xft/Xft.h>
167       ],
168       [
169         int i = XFT_MAJOR;
170         XftFont foo;
171       ],
172       [
173         AC_MSG_RESULT([yes])
174         XFT="yes"
175       ],
176       [
177         AC_MSG_RESULT([no])
178         XFT2=""
179         AC_MSG_RESULT()
180         AC_MSG_RESULT([** WARNING: Xft support is disabled! **])
181         AC_MSG_RESULT()
182       ]
183       )
184     )
185   else 
186     AC_MSG_RESULT([version 1])
187     AC_CHECK_LIB(Xft, XftFontOpenXlfd,
188       AC_MSG_CHECKING([for X11/Xft/Xft.h for Xft1])
189       AC_TRY_LINK(
190       [
191         #include <X11/Xlib.h>
192         #include <X11/Xft/Xft.h>
193       ],
194       [
195         XftFont foo;
196       ],
197       [
198         AC_MSG_RESULT([yes])
199         XFT="yes"
200         XFT_LIBS="$LIBS -lXft"
201
202         dnl Check for utf8 support in the Xft library
203         dnl AC_CHECK_LIB(Xft, XftDrawStringUtf8,
204         dnl  XFT_UTF8="yes",
205         dnl),
206       ],
207       [
208         AC_MSG_RESULT([no])
209         AC_MSG_RESULT()
210         AC_MSG_RESULT([** WARNING: Xft support is disabled! **])
211         AC_MSG_RESULT()
212       ]
213       )
214     )
215   fi
216 else
217   AC_MSG_RESULT([no])
218 fi
219 if test "$XFT" = "yes"; then
220   AC_SUBST([XFT_CFLAGS])
221   AC_SUBST([XFT_LIBS])
222   AC_DEFINE(XFT,1,[Enable support of the Xft extension])
223   dnl if test "$XFT_UTF8" = "yes"; then
224     dnl AC_DEFINE(XFT_UTF8,1,[Support for Utf8 text in the Xft extension])
225   dnl fi
226 fi
227 AM_CONDITIONAL(XFT, test "$XFT" = "yes")
228 AM_CONDITIONAL(XFT2, test "$XFT2" = "yes")
229         
230 dnl Check for ordered 8bpp dithering
231 ORDEREDPSEUDO=""
232 AC_MSG_CHECKING([whether to include Pseudocolor ordered dithering code])
233 AC_ARG_ENABLE(ordered-pseudo,
234 [  --enable-ordered-pseudo include code for ordered pseudocolor (8bpp)
235                           dithering @<:@default=no@:>@],
236   if test "$enableval" = "yes"; then
237     AC_MSG_RESULT([yes])
238     ORDEREDPSEUDO="yes" 
239   else
240     AC_MSG_RESULT([no]) 
241   fi,
242   AC_MSG_RESULT([no])
243 )
244 if test "$ORDEREDPSEUDO" = "yes"; then
245   AC_DEFINE(ORDEREDPSEUDO,1,Enable pseudocolor ordered dithering)
246 fi
247
248 dnl Check whether to include debugging code
249 DEBUG=""
250 AC_MSG_CHECKING([whether to include verbose debugging code])
251 AC_ARG_ENABLE(debug,
252   [  --enable-debug          include verbose debugging code @<:@default=no@:>@],
253   if test "$enableval" = "yes"; then
254     AC_MSG_RESULT([yes])
255     if test "$GCC" = "yes"; then
256        DEBUG="-DDEBUG -fno-inline -g"
257     else
258        DEBUG="-DDEBUG"
259     fi
260   else
261     AC_MSG_RESULT([no])
262     DEBUG="-DNDEBUG"
263   fi,
264   AC_MSG_RESULT([no])
265   DEBUG="-DNDEBUG"
266 )
267 AC_SUBST(DEBUG)
268
269 dnl Check whether to include natural language support (i18n)
270 NLS=""
271 AC_MSG_CHECKING([whether to include NLS support])
272 AC_ARG_ENABLE(nls,
273   [  --enable-nls            include natural language support @<:@default=yes@:>@],
274   if test "$enableval" = "yes"; then
275     AC_MSG_RESULT([yes])
276     NLS="yes"
277   else
278     AC_MSG_RESULT([no])
279   fi,
280   AC_MSG_RESULT([yes])
281   NLS="yes"
282 )
283
284 AC_CHECK_LIB(xpg4, setlocale, LIBS="$LIBS -lxpg4")
285
286 AC_CHECK_PROGS(gencat_cmd, gencat)
287 if test x$gencat_cmd = "x"; then
288   NLS=""
289 fi
290
291 if test "$NLS" = "yes"; then
292   AC_DEFINE(NLS,1,Include natural language support)
293   AC_SUBST(NLS)
294 fi
295
296 dnl Check for new timed pixmap cache
297 TIMEDCACHE=""
298 AC_MSG_CHECKING([whether to use the timed pixmap cache])
299 AC_ARG_ENABLE(
300   timed-cache,
301 [  --enable-timed-cache    use timed pixmap cache @<:@default=yes@:>@],
302   if test "$enableval" = "yes"; then
303     AC_MSG_RESULT([yes])
304     TIMEDCACHE="yes"
305   else
306     AC_MSG_RESULT([no])
307   fi,
308   AC_MSG_RESULT([yes])
309   TIMEDCACHE="yes"
310 )
311 if test "$TIMEDCACHE" = "yes"; then
312   AC_DEFINE(TIMEDCACHE,1,Use timed pixmap cache)
313 fi
314
315 dnl Check for bitmapped buttons
316 BITMAPBUTTONS=""
317 AC_MSG_CHECKING([whether to include bitmappable buttons])
318 AC_ARG_ENABLE(
319   bitmap-buttons,
320 [  --enable-bitmap-buttons include bitmappable buttons @<:@default=yes@:>@],
321   if test x$enableval = "xyes"; then
322     AC_MSG_RESULT([yes])
323     BITMAPBUTTONS="yes"
324   else
325     AC_MSG_RESULT([no])
326   fi,
327   AC_MSG_RESULT([yes])
328   BITMAPBUTTONS="yes"
329 )
330 if test x$BITMAPBUTTONS = "xyes"; then
331   AC_DEFINE(BITMAPBUTTONS,1,Include bitmappable buttons)
332 fi
333
334 dnl Determine the return type of signal handlers
335 AC_TYPE_SIGNAL
336
337 dnl Print results
338 AC_MSG_RESULT([])
339 AC_MSG_RESULT([ $PACKAGE version $VERSION configured successfully.])
340 AC_MSG_RESULT([])
341 AC_MSG_RESULT([Using '$prefix' for installation.])
342 AC_MSG_RESULT([Using '$CXX' for C++ compiler.])
343 AC_MSG_RESULT([Building with '$CXXFLAGS' for C++ compiler flags.])
344 AC_MSG_RESULT([Building with '$LIBS' for linker flags.])
345 AC_MSG_RESULT([])
346
347 dnl Output files
348 AM_CONFIG_HEADER(config.h)
349 AC_OUTPUT(Makefile
350 src/Makefile
351 util/Makefile
352 util/epist/Makefile
353 data/Makefile
354 data/styles/Makefile
355 data/buttons/Makefile
356 doc/Makefile
357 nls/Makefile
358 nls/C/Makefile
359 nls/da_DK/Makefile
360 nls/de_DE/Makefile
361 nls/es_AR/Makefile
362 nls/es_ES/Makefile
363 nls/et_EE/Makefile
364 nls/fr_FR/Makefile
365 nls/hu_HU/Makefile
366 nls/it_IT/Makefile
367 nls/ja_JP/Makefile
368 nls/ko_KR/Makefile
369 nls/lv_LV/Makefile
370 nls/no_NO/Makefile
371 nls/pl_PL/Makefile
372 nls/nl_NL/Makefile
373 nls/pt_BR/Makefile
374 nls/ro_RO/Makefile
375 nls/ru_RU/Makefile
376 nls/sk_SK/Makefile
377 nls/sl_SI/Makefile
378 nls/sv_SE/Makefile
379 nls/tr_TR/Makefile
380 nls/uk_UA/Makefile
381 nls/zh_CN/Makefile
382 nls/zh_TW/Makefile
383 version.h)