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
34 # Check for the presence of the "Xkb" X Window System extension.
35 # Defines "XKB" and sets the $(XKB) variable to "yes" if the extension is
37 AC_DEFUN([X11_EXT_XKB],
39 AC_REQUIRE([X11_DEVEL])
45 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
48 AC_CHECK_LIB([X11], [XkbBell],
49 AC_MSG_CHECKING([for X11/XKBlib.h])
53 #include <X11/Xutil.h>
54 #include <X11/XKBlib.h>
64 AC_DEFINE([XKB], [1], [Found the XKB extension])
80 AC_MSG_CHECKING([for the Xkb extension])
81 if test "$XKB" = "yes"; then
90 # Check for the presence of the "XRandR" X Window System extension.
91 # Defines "XRANDR" and sets the $(XRANDR) variable to "yes" if the extension is
93 AC_DEFUN([X11_EXT_XRANDR],
95 AC_REQUIRE([X11_DEVEL])
101 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
102 LIBS="$LIBS $X_LIBS -lXext -lXrender -lXrandr"
104 AC_CHECK_LIB([Xrandr], [XRRSelectInput],
105 AC_MSG_CHECKING([for X11/extensions/Xrandr.h])
108 #include <X11/Xlib.h>
109 #include <X11/extensions/Xrandr.h>
115 XRRQueryExtension(d, &i, &i);
116 XRRGetScreenInfo(d, r);
121 AC_DEFINE([XRANDR], [1], [Found the XRandR extension])
124 XRANDR_LIBS="-lXext -lXrender -lXrandr"
125 AC_SUBST(XRANDR_CFLAGS)
126 AC_SUBST(XRANDR_LIBS)
135 CPPFLAGS=$OLDCPPFLAGS
137 AC_MSG_CHECKING([for the XRandR extension])
138 if test "$XRANDR" = "yes"; then
147 # Check for the presence of the "Shape" X Window System extension.
148 # Defines "SHAPE", sets the $(SHAPE) variable to "yes", and sets the $(LIBS)
149 # appropriately if the extension is present.
150 AC_DEFUN([X11_EXT_SHAPE],
152 AC_REQUIRE([X11_DEVEL])
156 OLDCPPFLAGS=$CPPFLAGS
158 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
161 AC_CHECK_LIB([Xext], [XShapeCombineShape],
162 AC_MSG_CHECKING([for X11/extensions/shape.h])
165 #include <X11/Xlib.h>
166 #include <X11/Xutil.h>
167 #include <X11/extensions/shape.h>
175 AC_DEFINE([SHAPE], [1], [Found the XShape extension])
179 AC_SUBST(XSHAPE_CFLAGS)
180 AC_SUBST(XSHAPE_LIBS)
189 CPPFLAGS=$OLDCPPFLAGS
191 AC_MSG_CHECKING([for the Shape extension])
192 if test "$SHAPE" = "yes"; then
202 # Check for the presence of the "Xinerama" X Window System extension.
203 # Defines "XINERAMA", sets the $(XINERAMA) variable to "yes", and sets the
204 # $(LIBS) appropriately if the extension is present.
205 AC_DEFUN([X11_EXT_XINERAMA],
207 AC_REQUIRE([X11_DEVEL])
211 OLDCPPFLAGS=$CPPFLAGS
213 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
214 LIBS="$LIBS $X_LIBS -lXext"
216 AC_CHECK_LIB([Xinerama], [XineramaQueryExtension],
218 AC_MSG_CHECKING([for X11/extensions/Xinerama.h])
221 #include <X11/Xlib.h>
222 #include <X11/extensions/Xinerama.h>
225 XineramaScreenInfo foo;
230 AC_DEFINE([XINERAMA], [1], [Enable support of the Xinerama extension])
231 XINERAMA_LIBS="-lXext -lXinerama"
232 AC_SUBST(XINERAMA_LIBS)
241 CPPFLAGS=$OLDCPPFLAGS
243 AC_MSG_CHECKING([for the Xinerama extension])
244 if test "$XINERAMA" = "yes"; then
253 # Check for the presence of the "Sync" X Window System extension.
254 # Defines "SYNC", sets the $(SYNC) variable to "yes", and sets the $(LIBS)
255 # appropriately if the extension is present.
256 AC_DEFUN([X11_EXT_SYNC],
258 AC_REQUIRE([X11_DEVEL])
262 OLDCPPFLAGS=$CPPFLAGS
264 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
267 AC_CHECK_LIB([Xext], [XSyncInitialize],
268 AC_MSG_CHECKING([for X11/extensions/sync.h])
271 #include <X11/Xlib.h>
272 #include <X11/Xutil.h>
273 #include <X11/extensions/sync.h>
281 AC_DEFINE([SYNC], [1], [Found the XSync extension])
285 AC_SUBST(XSYNC_CFLAGS)
295 CPPFLAGS=$OLDCPPFLAGS
297 AC_MSG_CHECKING([for the Sync extension])
298 if test "$SYNC" = "yes"; then
307 # Check for the presence of SMlib for session management.
308 # Defines "USE_SM" if SMlib is present.
311 AC_REQUIRE([X11_DEVEL])
313 AC_ARG_ENABLE([session-management],
315 [--disable-session-management], [build without support for session managers [[default=enabled]]]),
316 [SM=$enableval], [SM="yes"])
318 if test "$SM" = "yes"; then
321 OLDCPPFLAGS=$CPPFLAGS
323 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
328 AC_CHECK_LIB([SM], [SmcSaveYourselfDone], [
329 AC_CHECK_HEADERS([X11/SM/SMlib.h], [
330 SM_CFLAGS="$X_CFLAGS"
332 AC_DEFINE(USE_SM, 1, [Use session management])
341 CPPFLAGS=$OLDCPPFLAGS
343 AC_MSG_CHECKING([for session management support])
344 if test "$SM" = "yes"; then