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])
44 [build without support for xkb extension [default=enabled]]),
45 [USE=$enableval], [USE="yes"])
47 if test "$USE" = "yes"; then
52 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
55 AC_CHECK_LIB([X11], [XkbBell],
56 AC_MSG_CHECKING([for X11/XKBlib.h])
60 #include <X11/Xutil.h>
61 #include <X11/XKBlib.h>
71 AC_DEFINE([XKB], [1], [Found the XKB extension])
88 AC_MSG_CHECKING([for the Xkb extension])
89 if test "$XKB" = "yes"; then
98 # Check for the presence of the "XRandR" X Window System extension.
99 # Defines "XRANDR" and sets the $(XRANDR) variable to "yes" if the extension is
101 AC_DEFUN([X11_EXT_XRANDR],
103 AC_REQUIRE([X11_DEVEL])
105 AC_ARG_ENABLE([xrandr],
108 [build without support for xrandr extension [default=enabled]]),
109 [USE=$enableval], [USE="yes"])
111 if test "$USE" = "yes"; then
114 OLDCPPFLAGS=$CPPFLAGS
116 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
117 LIBS="$LIBS $X_LIBS -lXext -lXrender -lXrandr"
119 AC_CHECK_LIB([Xrandr], [XRRSelectInput],
120 AC_MSG_CHECKING([for X11/extensions/Xrandr.h])
123 #include <X11/Xlib.h>
124 #include <X11/extensions/Xrandr.h>
130 XRRQueryExtension(d, &i, &i);
131 XRRGetScreenInfo(d, r);
136 AC_DEFINE([XRANDR], [1], [Found the XRandR extension])
139 XRANDR_LIBS="-lXext -lXrender -lXrandr"
140 AC_SUBST(XRANDR_CFLAGS)
141 AC_SUBST(XRANDR_LIBS)
150 CPPFLAGS=$OLDCPPFLAGS
153 AC_MSG_CHECKING([for the XRandR extension])
154 if test "$XRANDR" = "yes"; then
163 # Check for the presence of the "Shape" X Window System extension.
164 # Defines "SHAPE", sets the $(SHAPE) variable to "yes", and sets the $(LIBS)
165 # appropriately if the extension is present.
166 AC_DEFUN([X11_EXT_SHAPE],
168 AC_REQUIRE([X11_DEVEL])
170 AC_ARG_ENABLE([xshape],
173 [build without support for xshape extension [default=enabled]]),
174 [USE=$enableval], [USE="yes"])
176 if test "$USE" = "yes"; then
179 OLDCPPFLAGS=$CPPFLAGS
181 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
184 AC_CHECK_LIB([Xext], [XShapeCombineShape],
185 AC_MSG_CHECKING([for X11/extensions/shape.h])
188 #include <X11/Xlib.h>
189 #include <X11/Xutil.h>
190 #include <X11/extensions/shape.h>
198 AC_DEFINE([SHAPE], [1], [Found the XShape extension])
202 AC_SUBST(XSHAPE_CFLAGS)
203 AC_SUBST(XSHAPE_LIBS)
212 CPPFLAGS=$OLDCPPFLAGS
215 AC_MSG_CHECKING([for the Shape extension])
216 if test "$SHAPE" = "yes"; then
226 # Check for the presence of the "Xinerama" X Window System extension.
227 # Defines "XINERAMA", sets the $(XINERAMA) variable to "yes", and sets the
228 # $(LIBS) appropriately if the extension is present.
229 AC_DEFUN([X11_EXT_XINERAMA],
231 AC_REQUIRE([X11_DEVEL])
233 AC_ARG_ENABLE([xinerama],
235 [--disable-xinerama],
236 [build without support for xinerama [default=enabled]]),
237 [USE=$enableval], [USE="yes"])
239 if test "$USE" = "yes"; then
242 OLDCPPFLAGS=$CPPFLAGS
244 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
245 LIBS="$LIBS $X_LIBS -lXext"
247 AC_CHECK_LIB([Xinerama], [XineramaQueryExtension],
249 AC_MSG_CHECKING([for X11/extensions/Xinerama.h])
252 #include <X11/Xlib.h>
253 #include <X11/extensions/Xinerama.h>
256 XineramaScreenInfo foo;
261 AC_DEFINE([XINERAMA], [1], [Enable support of the Xinerama extension])
262 XINERAMA_LIBS="-lXext -lXinerama"
263 AC_SUBST(XINERAMA_LIBS)
272 CPPFLAGS=$OLDCPPFLAGS
275 AC_MSG_CHECKING([for the Xinerama extension])
276 if test "$XINERAMA" = "yes"; then
285 # Check for the presence of the "Sync" X Window System extension.
286 # Defines "SYNC", sets the $(SYNC) variable to "yes", and sets the $(LIBS)
287 # appropriately if the extension is present.
288 AC_DEFUN([X11_EXT_SYNC],
290 AC_REQUIRE([X11_DEVEL])
292 AC_ARG_ENABLE([xsync],
295 [build without support for xsync extension [default=enabled]]),
296 [USE=$enableval], [USE="yes"])
298 if test "$USE" = "yes"; then
301 OLDCPPFLAGS=$CPPFLAGS
303 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
306 AC_CHECK_LIB([Xext], [XSyncInitialize],
307 AC_MSG_CHECKING([for X11/extensions/sync.h])
310 #include <X11/Xlib.h>
311 #include <X11/Xutil.h>
312 #include <X11/extensions/sync.h>
320 AC_DEFINE([SYNC], [1], [Found the XSync extension])
324 AC_SUBST(XSYNC_CFLAGS)
334 CPPFLAGS=$OLDCPPFLAGS
337 AC_MSG_CHECKING([for the Sync extension])
338 if test "$SYNC" = "yes"; then
347 # Check for the presence of the "Xau" X Window System extension.
348 # Defines "AUTH, sets the $(AUTH) variable to "yes", and sets the $(LIBS)
349 # appropriately if the extension is present.
350 AC_DEFUN([X11_EXT_AUTH],
352 AC_REQUIRE([X11_DEVEL])
356 OLDCPPFLAGS=$CPPFLAGS
358 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
361 AC_CHECK_LIB([Xau], [XauReadAuth],
362 AC_MSG_CHECKING([for X11/Xauth.h])
365 #include <X11/Xlib.h>
366 #include <X11/Xutil.h>
367 #include <X11/Xauth.h>
374 AC_DEFINE([AUTH], [1], [Found the Xauth extension])
378 AC_SUBST(XAUTH_CFLAGS)
388 CPPFLAGS=$OLDCPPFLAGS
390 AC_MSG_CHECKING([for the Xauth extension])
391 if test "$AUTH" = "yes"; then
400 # Check for the presence of SMlib for session management.
401 # Defines "USE_SM" if SMlib is present.
404 AC_REQUIRE([X11_DEVEL])
406 AC_ARG_ENABLE([session-management],
408 [--disable-session-management],
409 [build without support for session managers [default=enabled]]),
410 [SM=$enableval], [SM="yes"])
412 if test "$SM" = "yes"; then
415 OLDCPPFLAGS=$CPPFLAGS
417 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
422 AC_CHECK_LIB([SM], [SmcSaveYourselfDone], [
423 AC_CHECK_HEADERS([X11/SM/SMlib.h], [
424 SM_CFLAGS="$X_CFLAGS"
426 AC_DEFINE(USE_SM, 1, [Use session management])
434 CPPFLAGS=$OLDCPPFLAGS
437 AC_MSG_CHECKING([for session management support])
438 if test "$SM" = "yes"; then