3 # Check for the presence of the X Window System headers and libraries.
4 # Sets the CPPFLAGS and LIBS variables as appropriate.
8 test "$no_x" = "yes" && \
9 AC_MSG_ERROR([The X Window System could not be found.])
15 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
16 X_LIBS="$X_PRE_LIBS $X_LIBS -lX11"
19 # Check for required functions in -lX11
21 [X11], [XOpenDisplay],
23 AC_MSG_ERROR([Could not find XOpenDisplay in -lX11.])
26 # Restore the old values. Use X_CFLAGS and X_LIBS in
35 if test "$XFT_MIN"; then
36 AC_MSG_ERROR([$PACKAGE requires the Xft font library >= $XFT_MIN.
37 See http://www.fontconfig.org/
40 AC_MSG_ERROR([$PACKAGE requires the Xft font library.
41 See http://www.fontconfig.org/
46 # XFT_DEVEL([required-version])
48 # Check for the XFT development package.
49 # You can use the optional argument to check for a library of at least the
51 # It provides the $(PYTHON_CFLAGS) $(PYTHON_LIBS) output variables.
54 AC_REQUIRE([X11_DEVEL])
58 XFT_MIN_MAJOR=${XFT_MIN%.*.*}
59 XFT_MIN_MINOR=${XFT_MIN%.*}
60 XFT_MIN_MINOR=${XFT_MIN_MINOR#*.}
61 XFT_MIN_REVISION=${XFT_MIN#*.*.}
62 XFT_MIN="$XFT_MIN_MAJOR.$XFT_MIN_MINOR.$XFT_MIN_REVISION"
67 if test -z "$XFT_MIN"; then
68 AC_MSG_CHECKING([for Xft])
69 if ! pkg-config xft; then
74 AC_MSG_CHECKING([for Xft version >= $XFT_MIN])
75 if ! pkg-config --atleast-version $XFT_MIN xft; then
87 XFT_CFLAGS="`pkg-config --cflags xft`"
88 XFT_LIBS="`pkg-config --libs xft`"
90 # Set these for checking with the tests below. They'll be restored after
91 LIBS="$LIBS $XFT_LIBS"
92 CPPFLAGS="$XFT_CFLAGS $CPPFLAGS"
94 AC_CHECK_LIB([Xft], [XftGetVersion], # this was not defined in < 2.0
95 if test "$XFT_MIN"; then
96 AC_MSG_CHECKING([for X11/Xft/Xft.h for Xft >= $XFT_MIN])
100 #include <X11/Xft/Xft.h>
103 #if !defined(XFT_MAJOR)
104 # error Xft.h is too old
106 #if XFT_MAJOR < $XFT_MIN_MAJOR
107 # error Xft.h is too old
109 #if XFT_MAJOR == $XFT_MIN_MAJOR
110 # if XFT_MINOR < $XFT_MIN_MINOR
111 # error Xft.h is too old
114 #if XFT_MAJOR == $XFT_MIN_MAJOR
115 # if XFT_MAJOR == $XFT_MIN_MINOR
116 # if XFT_REVISION < $XFT_MIN_REVISION
117 # error Xft.h is too old
133 AC_MSG_CHECKING([for X11/Xft/Xft.h])
136 #include <X11/Xlib.h>
137 #include <X11/Xft/Xft.h>
140 int i = XFT_MAJOR; /* make sure were using Xft 2, not 1 */
152 AC_MSG_CHECKING([if we can compile with Xft])
155 #include <X11/Xlib.h>
156 #include <X11/Xft/Xft.h>
167 AC_MSG_ERROR([Unable to compile with the Xft font library.
172 # Restore the old values. Use XFT_CFLAGS and XFT_LIBS in the Makefiles
174 CPPFLAGS=$OLDCPPFLAGS
176 AC_SUBST([XFT_CFLAGS])
183 # Check for the presence of the "Xkb" X Window System extension.
184 # Defines "XKB" and sets the $(XKB) variable to "yes" if the extension is
186 AC_DEFUN([X11_EXT_XKB],
188 AC_REQUIRE([X11_DEVEL])
192 OLDCPPFLAGS=$CPPFLAGS
194 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
197 AC_CHECK_LIB([X11], [XkbBell],
198 AC_MSG_CHECKING([for X11/XKBlib.h])
201 #include <X11/Xlib.h>
202 #include <X11/Xutil.h>
203 #include <X11/XKBlib.h>
213 AC_DEFINE([XKB], [1], [Found the XKB extension])
227 CPPFLAGS=$OLDCPPFLAGS
229 AC_MSG_CHECKING([for the Xkb extension])
230 if test "$XKB" = "yes"; then
239 # Check for the presence of the "XRandR" X Window System extension.
240 # Defines "XRANDR" and sets the $(XRANDR) variable to "yes" if the extension is
242 AC_DEFUN([X11_EXT_XRANDR],
244 AC_REQUIRE([X11_DEVEL])
248 OLDCPPFLAGS=$CPPFLAGS
250 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
251 LIBS="$LIBS $X_LIBS -lXext -lXrender -lXrandr"
253 AC_CHECK_LIB([Xrandr], [XRRSelectInput],
254 AC_MSG_CHECKING([for X11/extensions/Xrandr.h])
257 #include <X11/Xlib.h>
258 #include <X11/extensions/Xrandr.h>
264 XRRQueryExtension(d, &i, &i);
265 XRRGetScreenInfo(d, r);
270 AC_DEFINE([XRANDR], [1], [Found the XRandR extension])
273 XRANDR_LIBS="-lXext -lXrender -lXrandr"
274 AC_SUBST(XRANDR_CFLAGS)
275 AC_SUBST(XRANDR_LIBS)
284 CPPFLAGS=$OLDCPPFLAGS
286 AC_MSG_CHECKING([for the XRandR extension])
287 if test "$XRANDR" = "yes"; then
296 # Check for the presence of the "Shape" X Window System extension.
297 # Defines "SHAPE", sets the $(SHAPE) variable to "yes", and sets the $(LIBS)
298 # appropriately if the extension is present.
299 AC_DEFUN([X11_EXT_SHAPE],
301 AC_REQUIRE([X11_DEVEL])
305 OLDCPPFLAGS=$CPPFLAGS
307 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
310 AC_CHECK_LIB([Xext], [XShapeCombineShape],
311 AC_MSG_CHECKING([for X11/extensions/shape.h])
314 #include <X11/Xlib.h>
315 #include <X11/Xutil.h>
316 #include <X11/extensions/shape.h>
324 AC_DEFINE([SHAPE], [1], [Found the XShape extension])
328 AC_SUBST(XSHAPE_CFLAGS)
329 AC_SUBST(XSHAPE_LIBS)
338 CPPFLAGS=$OLDCPPFLAGS
340 AC_MSG_CHECKING([for the Shape extension])
341 if test "$SHAPE" = "yes"; then
351 # Check for the presence of the "Xinerama" X Window System extension.
352 # Defines "XINERAMA", sets the $(XINERAMA) variable to "yes", and sets the
353 # $(LIBS) appropriately if the extension is present.
354 AC_DEFUN([X11_EXT_XINERAMA],
356 AC_REQUIRE([X11_DEVEL])
360 OLDCPPFLAGS=$CPPFLAGS
362 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
363 LIBS="$LIBS $X_LIBS -lXext"
365 AC_CHECK_LIB([Xinerama], [XineramaQueryExtension],
367 AC_MSG_CHECKING([for X11/extensions/Xinerama.h])
370 #include <X11/Xlib.h>
371 #include <X11/extensions/Xinerama.h>
374 XineramaScreenInfo foo;
379 AC_DEFINE([XINERAMA], [1], [Enable support of the Xinerama extension])
380 XINERAMA_LIBS="-lXext -lXinerama"
381 AC_SUBST(XINERAMA_LIBS)
390 CPPFLAGS=$OLDCPPFLAGS
392 AC_MSG_CHECKING([for the Xinerama extension])
393 if test "$XINERAMA" = "yes"; then
402 # Check for the presence of SMlib for session management.
403 # Defines "USE_SM" if SMlib is present.
406 AC_REQUIRE([X11_DEVEL])
408 AC_ARG_ENABLE([session-management],
410 [--disable-session-management], [build without support for session managers [[default=yes]]]),
411 [SM=$enableval], [SM="yes"])
413 if test "$SM" = "yes"; then
416 OLDCPPFLAGS=$CPPFLAGS
418 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
423 AC_CHECK_LIB([SM], [SmcSaveYourselfDone], [
424 AC_CHECK_HEADERS([X11/SM/SMlib.h], [
425 SM_CFLAGS="$X_CFLAGS"
427 AC_DEFINE(USE_SM, 1, [Use session management])
436 CPPFLAGS=$OLDCPPFLAGS
438 AC_MSG_CHECKING([for session management support])
439 if test "$SM" = "yes"; then