- if test -z "$XFT_MIN"; then
- AC_MSG_CHECKING([for Xft])
- if ! pkg-config xft; then
- AC_MSG_RESULT([no])
- XFT_ERROR
- fi
+# X11_EXT_SHAPE()
+#
+# Check for the presence of the "Shape" X Window System extension.
+# Defines "SHAPE", sets the $(SHAPE) variable to "yes", and sets the $(LIBS)
+# appropriately if the extension is present.
+AC_DEFUN([X11_EXT_SHAPE],
+[
+ AC_REQUIRE([X11_DEVEL])
+
+ AC_ARG_ENABLE([xshape],
+ AC_HELP_STRING(
+ [--disable-xshape],
+ [build without support for xshape extension [default=enabled]]),
+ [USE=$enableval], [USE="yes"])
+
+ if test "$USE" = "yes"; then
+ # Store these
+ OLDLIBS=$LIBS
+ OLDCPPFLAGS=$CPPFLAGS
+
+ CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+ LIBS="$LIBS $X_LIBS"
+
+ AC_CHECK_LIB([Xext], [XShapeCombineShape],
+ AC_MSG_CHECKING([for X11/extensions/shape.h])
+ AC_TRY_LINK(
+ [
+ #include <X11/Xlib.h>
+ #include <X11/Xutil.h>
+ #include <X11/extensions/shape.h>
+ ],
+ [
+ long foo = ShapeSet;
+ ],
+ [
+ AC_MSG_RESULT([yes])
+ SHAPE="yes"
+ AC_DEFINE([SHAPE], [1], [Found the XShape extension])
+
+ XSHAPE_CFLAGS=""
+ XSHAPE_LIBS="-lXext"
+ AC_SUBST(XSHAPE_CFLAGS)
+ AC_SUBST(XSHAPE_LIBS)
+ ],
+ [
+ AC_MSG_RESULT([no])
+ SHAPE="no"
+ ])
+ )
+
+ LIBS=$OLDLIBS
+ CPPFLAGS=$OLDCPPFLAGS
+ fi
+
+ AC_MSG_CHECKING([for the Shape extension])
+ if test "$SHAPE" = "yes"; then
+ AC_MSG_RESULT([yes])