Add the ability to explicitly enable/disable GUI support

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Upstream-Status: Pending

--- git.orig/configure.ac
+++ git/configure.ac
@@ -62,12 +62,24 @@ KMICRO=`uname -r | cut -d"." -f 3 | cut
 # Pkgconfig dependencies
 
 core_dep="glib-2.0 >= 2.6.0"
-gui_dep="gtk+-2.0 > 2.6.0 gdk-pixbuf-2.0 pangoft2 libglade-2.0"
 
 PKG_CHECK_MODULES(CORE_DEP, $core_dep, [], AC_MSG_ERROR([sysprof dependencies not satisfied]))
 
-build_gui=yes
-PKG_CHECK_MODULES(GUI_DEP, $gui_dep, [], build_gui=no)
+gui_dep="gtk+-2.0 > 2.6.0 gdk-pixbuf-2.0 pangoft2 libglade-2.0"
+
+AC_ARG_ENABLE([gui],
+  [AS_HELP_STRING([--disable-gui],
+    [Disable GUI functionality (requires gtk+, gdk-pixbuf, pangoft2, libglade) @<:@default=auto@:>@])],
+  [],
+  [enable_gui=auto])
+
+build_gui=no
+AS_IF([test "x$enable_gui" != xno],
+  [PKG_CHECK_MODULES(GUI_DEP, $gui_dep, build_gui=yes,
+    [if test "x$enable_gui" != xauto; then
+       AC_MSG_FAILURE(
+         [--enable-gui was given, but gui dependencies were not satisfied])
+     fi])])
 
 AM_CONDITIONAL([BUILD_GUI], [test "$build_gui" = yes])
 
