[gnome-settings-daemon] printing: Check that cups is recent enough



commit 19a31b64b05a534aa28d7a5b25487c35ba8bcc25
Author: Marek Kasik <mkasik redhat com>
Date:   Mon Feb 7 14:52:17 2011 +0100

    printing: Check that cups is recent enough
    
    Check that cups version is greater than 1.4 or equal to 1.4.

 configure.ac |   28 +++++++++++++++++++++++-----
 1 files changed, 23 insertions(+), 5 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index b3a4f92..6c2c227 100644
--- a/configure.ac
+++ b/configure.ac
@@ -354,12 +354,30 @@ AC_SUBST(POLKIT_LIBS)
 # CUPS
 # ---------------------------------------------------------------------------
 
-AC_CHECK_HEADERS([cups/cups.h cups/http.h cups/ipp.h], have_cups=yes, have_cups=no)
-if test x$have_cups = xyes ; then
-  CUPS_LIBS=-lcups
-  AC_SUBST(CUPS_LIBS)
+AC_PATH_PROG(CUPS_CONFIG, cups-config, no)
+if test "x$CUPS_CONFIG" != "xno"; then
+  CUPS_API_VERSION=`$CUPS_CONFIG --api-version`
+  CUPS_API_MAJOR=`echo $ECHO_N $CUPS_API_VERSION | sed -e "s/\./\n/g" | sed -n "1p"`
+  CUPS_API_MINOR=`echo $ECHO_N $CUPS_API_VERSION | sed -e "s/\./\n/g" | sed -n "2p"`
+
+  AC_CHECK_HEADERS([cups/cups.h cups/http.h cups/ipp.h], have_cups_headers=yes, have_cups_headers=no)
+  if test x$have_cups_headers = xyes ; then
+    if test $CUPS_API_MAJOR -gt 1 -o \
+            $CUPS_API_MAJOR -eq 1 -a $CUPS_API_MINOR -ge 4; then
+      have_cups=yes
+      CUPS_LIBS=-lcups
+      AC_SUBST(CUPS_LIBS)
+    else
+      have_cups=no
+      AC_MSG_WARN(*** Print-notifications plugin will not be built (CUPS 1.4 or newer not found) ***)
+    fi
+  else
+    have_cups=no
+    AC_MSG_WARN(*** Print-notifications plugin will not be built (CUPS header files not found) ***)
+  fi
 else
-  AC_MSG_WARN(*** Print-notifications plugin will not be built (CUPS header files not found) ***)
+  have_cups=no
+  AC_MSG_WARN(*** Print-notifications plugin will not be built (cups-config not found) ***)
 fi
 AM_CONDITIONAL(BUILD_PRINT_NOTIFICATIONS, [test x$have_cups = xyes])
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]