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