changeset 2856:1f1d05d55b81

PR2803: Make system CUPS optional 2016-03-24 Andrew John Hughes <gnu.andrew@member.fsf.org> PR2803: Make system CUPS optional * INSTALL: Document --enable-system-cups. * Makefile.am: (ICEDTEA_ENV): Set SYSTEM_CUPS to the value of ENABLE_SYSTEM_CUPS rather than 'true'. * NEWS: Updated. * acinclude.m4: (IT_CHECK_FOR_CUPS): Only check for the library if --enable-system-cups is on.
author Andrew John Hughes <gnu_andrew@member.fsf.org>
date Fri, 25 Mar 2016 02:51:29 +0000
parents dd3689584733
children 86faa1802483
files ChangeLog INSTALL Makefile.am NEWS acinclude.m4
diffstat 5 files changed, 37 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Mar 25 00:37:24 2016 +0000
+++ b/ChangeLog	Fri Mar 25 02:51:29 2016 +0000
@@ -1,3 +1,15 @@
+2016-03-24  Andrew John Hughes  <gnu.andrew@member.fsf.org>
+
+	PR2803: Make system CUPS optional
+	* INSTALL: Document --enable-system-cups.
+	* Makefile.am:
+	(ICEDTEA_ENV): Set SYSTEM_CUPS to the
+	value of ENABLE_SYSTEM_CUPS rather than 'true'.
+	* NEWS: Updated.
+	* acinclude.m4:
+	(IT_CHECK_FOR_CUPS): Only check for the library
+	if --enable-system-cups is on.
+
 2016-03-24  Andrew John Hughes  <gnu.andrew@member.fsf.org>
 
 	PR2781, CA195: typeinfo.cpp: typeinfo_merge_nonarrays:
--- a/INSTALL	Fri Mar 25 00:37:24 2016 +0000
+++ b/INSTALL	Fri Mar 25 02:51:29 2016 +0000
@@ -126,6 +126,8 @@
 * --enable-system-kerberos: Link against the system Kerberos library and
   query it at runtime to obtain the cache location, rather than using a
   hardcoded value.
+* --enable-system-cups: Build and link against the system installation of
+  CUPS instead of trying to dynamically open it at runtime.
 * --enable-compile-against-syscalls: Check for syscalls at compile-time not runtime.
 * --with-gcj: Compile ecj to native code with gcj prior to building.
 * --with-parallel-jobs: Run the specified number of parallel jobs when
--- a/Makefile.am	Fri Mar 25 00:37:24 2016 +0000
+++ b/Makefile.am	Fri Mar 25 02:51:29 2016 +0000
@@ -616,7 +616,7 @@
 	STATIC_CXX="false" \
 	BUILD_GCC="$(CC)" \
 	BUILD_CXX="$(CXX)" \
-	SYSTEM_CUPS="true" \
+	SYSTEM_CUPS="${ENABLE_SYSTEM_CUPS}" \
 	CUPS_LIBS="${CUPS_LIBS}" \
 	CUPS_CFLAGS="${CUPS_CFLAGS}" \
 	STRIP_POLICY=no_strip \
--- a/NEWS	Fri Mar 25 00:37:24 2016 +0000
+++ b/NEWS	Fri Mar 25 02:51:29 2016 +0000
@@ -14,6 +14,8 @@
 
 New in release 2.7.0 (201X-XX-XX):
 
+* Bug fixes
+  - PR2803: Make system CUPS optional
 * CACAO
   - PR2781, CA195: typeinfo.cpp: typeinfo_merge_nonarrays: Assertion `dest && result && x.any && y.any' failed
 
--- a/acinclude.m4	Fri Mar 25 00:37:24 2016 +0000
+++ b/acinclude.m4	Fri Mar 25 02:51:29 2016 +0000
@@ -2178,13 +2178,28 @@
 
 AC_DEFUN_ONCE([IT_CHECK_FOR_CUPS],
 [
-  dnl Check for CUPS headers and libraries.
-  AC_CHECK_LIB([cups], [cupsServer],
-      , [AC_MSG_ERROR([Could not find CUPS library; install CUPS.])])
+  dnl The CUPS headers are always required
   AC_CHECK_HEADERS([cups/cups.h cups/ppd.h],
       , [AC_MSG_ERROR([Could not find CUPS headers; install CUPS (including cups-devel on binary distros).])])
-  CUPS_LIBS="-lcups"
-  AC_SUBST(CUPS_LIBS)
+  AC_MSG_CHECKING([whether to use the system CUPS install])
+  AC_ARG_ENABLE([system-cups],
+	      [AS_HELP_STRING(--enable-system-cups,use the system CUPS [[default=yes]])],
+  [
+    ENABLE_SYSTEM_CUPS="${enableval}"
+  ],
+  [
+    ENABLE_SYSTEM_CUPS="yes"
+  ])
+  AC_MSG_RESULT(${ENABLE_SYSTEM_CUPS})
+  if test x"${ENABLE_SYSTEM_CUPS}" = "xyes"; then
+    dnl Check for CUPS libraries
+    AC_CHECK_LIB([cups], [cupsServer],
+        , [AC_MSG_ERROR([Could not find CUPS library; install CUPS.])])
+    CUPS_LIBS="-lcups"
+    AC_SUBST(CUPS_LIBS)
+  fi
+  AM_CONDITIONAL(USE_SYSTEM_CUPS, test x"${ENABLE_SYSTEM_CUPS}" = "xyes")
+  AC_SUBST(ENABLE_SYSTEM_CUPS)
 ])
 
 AC_DEFUN_ONCE([IT_CHECK_FOR_SYSCALLS],