From: Cyril Brulebois <kibi@debian.org>
Date: Fri, 6 Apr 2018 09:22:20 +0100
Subject: Support disabling X11 extensions

We want this in Debian as we build GTK with extensions enabled for the
normal build, but disable them for the special build that will be used
in the graphical installer, because it needs to be as small as possible.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=612918
Applied-upstream: 2.99.1, commit:ec15c405cf6354e9267e7e6b7ce878c519bffe4c
---
 configure.ac | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index 44d3056..02db6e7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -240,6 +240,18 @@ AC_ARG_ENABLE(xinerama,
               [AC_HELP_STRING([--enable-xinerama],
 	                      [support xinerama extension if available [default=yes]])],,
               [enable_xinerama="yes"])
+AC_ARG_ENABLE(xrandr,
+	      [AC_HELP_STRING([--enable-xrandr],
+			      [support XRandR extension if available [default=yes]])])
+AC_ARG_ENABLE(xfixes,
+	      [AC_HELP_STRING([--enable-xfixes],
+			      [support XFixes extension if available [default=yes]])])
+AC_ARG_ENABLE(xcomposite,
+	      [AC_HELP_STRING([--enable-xcomposite],
+			      [support X Composite extension if available [default=yes]])])
+AC_ARG_ENABLE(xdamage,
+	      [AC_HELP_STRING([--enable-xdamage],
+			      [support X Damage extension if available [default=yes]])])
 AC_ARG_ENABLE(rebuilds,
               [AC_HELP_STRING([--disable-rebuilds],
                               [disable all source autogeneration rules])],,
@@ -1189,7 +1201,8 @@ if test "x$gdktarget" = "xx11"; then
   AM_CONDITIONAL(XINPUT_XFREE, test x$with_xinput = xxfree || test x$with_xinput = xyes)
 
   # Check for the RANDR extension
-  if $PKG_CONFIG --exists "xrandr >= 1.2.99" ; then
+  if test x"$enable_xrandr" != xno && \
+     $PKG_CONFIG --exists "xrandr >= 1.2.99" ; then
      AC_DEFINE(HAVE_RANDR, 1, [Have the Xrandr extension library])
 
      if $PKG_CONFIG --exists "xrandr >= 1.5.0" ; then
@@ -1208,7 +1221,8 @@ if test "x$gdktarget" = "xx11"; then
 
   # Checks for XFixes extension
   
-  if $PKG_CONFIG --exists xfixes ; then
+  if test x"$enable_xfixes" != xno && \
+     $PKG_CONFIG --exists xfixes ; then
     AC_DEFINE(HAVE_XFIXES, 1, [Have the XFIXES X extension])
     
     X_PACKAGES="$X_PACKAGES xfixes"
@@ -1217,7 +1231,8 @@ if test "x$gdktarget" = "xx11"; then
 
   # Checks for Xcomposite extension
 
-  if $PKG_CONFIG --exists xcomposite ; then
+  if test x"$enable_xcomposite" != xno && \
+     $PKG_CONFIG --exists xcomposite ; then
     AC_DEFINE(HAVE_XCOMPOSITE, 1, [Have the XCOMPOSITE X extension])
 
     X_PACKAGES="$X_PACKAGES xcomposite"
@@ -1226,7 +1241,7 @@ if test "x$gdktarget" = "xx11"; then
 
   # Checks for Xdamage extension
 
-  if $PKG_CONFIG --exists xdamage ; then
+  if test x"$enable_xdamage" != xno && $PKG_CONFIG --exists xdamage ; then
     AC_DEFINE(HAVE_XDAMAGE, 1, [Have the XDAMAGE X extension])
 
     X_PACKAGES="$X_PACKAGES xdamage"
