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_LIBS -lX11"
17 LIBS="$LIBS $X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS"
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_PRE_LIBS X_LIBS X_EXTRA_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"
195 LIBS="$LIBS $X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS"
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])
222 CPPFLAGS=$OLDCPPFLAGS
224 AC_MSG_CHECKING([for the Xkb extension])
225 if test "$XKB" = "yes"; then
234 # Check for the presence of the "Shape" X Window System extension.
235 # Defines "SHAPE", sets the $(SHAPE) variable to "yes", and sets the $(LIBS)
236 # appropriately if the extension is present.
237 AC_DEFUN([X11_EXT_SHAPE],
239 AC_REQUIRE([X11_DEVEL])
243 OLDCPPFLAGS=$CPPFLAGS
245 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
246 LIBS="$LIBS $X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS"
248 AC_CHECK_LIB([Xext], [XShapeCombineShape],
249 AC_MSG_CHECKING([for X11/extensions/shape.h])
252 #include <X11/Xlib.h>
253 #include <X11/Xutil.h>
254 #include <X11/extensions/shape.h>
262 AC_DEFINE([SHAPE], [1], [Found the XShape extension])
272 CPPFLAGS=$OLDCPPFLAGS
274 AC_MSG_CHECKING([for the Shape extension])
275 if test "$SHAPE" = "yes"; then
285 # Check for the presence of the "Xinerama" X Window System extension.
286 # Defines "XINERAMA", sets the $(XINERAMA) variable to "yes", and sets the
287 # $(LIBS) appropriately if the extension is present.
288 AC_DEFUN([X11_EXT_XINERAMA],
290 AC_REQUIRE([X11_DEVEL])
294 OLDCPPFLAGS=$CPPFLAGS
296 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
297 LIBS="$LIBS $X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS -lXext"
299 AC_CHECK_LIB([Xinerama], [XineramaQueryExtension],
301 AC_MSG_CHECKING([for X11/extensions/Xinerama.h])
304 #include <X11/Xlib.h>
305 #include <X11/extensions/Xinerama.h>
308 XineramaScreenInfo foo;
313 AC_DEFINE([XINERAMA], [1], [Enable support of the Xinerama extension])
314 XINERAMA_LIBS="-lXext -lXinerama"
315 AC_SUBST(XINERAMA_LIBS)
324 CPPFLAGS=$OLDCPPFLAGS
326 AC_MSG_CHECKING([for the Xinerama extension])
327 if test "$XINERAMA" = "yes"; then