[PATCH] Enable CUPS unconditionally

François Tigeot ftigeot at wolfpond.org
Sun Aug 21 11:36:09 PDT 2011


It doesn't make sense to try to use anything else to print on *nix
systems these days
---
 configure.in                           |   30 ------------------------
 distro-configs/LibreOfficeAndroid.conf |    1 -
 distro-configs/LibreOfficeiOS.conf     |    1 -
 distro-configs/OxygenOfficeLinux.conf  |    1 -
 set_soenv.in                           |    1 -
 vcl/Library_vcl.mk                     |    3 --
 vcl/unx/generic/printer/cupsmgr.cxx    |   40 +-------------------------------
 7 files changed, 1 insertions(+), 76 deletions(-)

diff --git a/configure.in b/configure.in
index 536ca8b..ced6db1 100755
--- a/configure.in
+++ b/configure.in
@@ -180,10 +180,6 @@ AC_ARG_ENABLE(evolution2,
         [Allows the built-in evolution 2 addressbook connectivity build to be
          enabled.]))
 
-AC_ARG_ENABLE(cups,
-    AS_HELP_STRING([--disable-cups],
-        [Disable cups support in the psprint project.]))
-
 AC_ARG_ENABLE(directx,
     AS_HELP_STRING([--disable-directx],
         [Remove DirectX implementation for the new XCanvas interface.
@@ -1454,7 +1450,6 @@ dnl These values may be checked and reset later.
 dnl ===================================================================
 #defaults unless the os test overrides this:
 test_randr=yes
-test_cups=yes
 test_fontconfig=yes
 
 case "$host_os" in
@@ -1504,7 +1499,6 @@ linux-gnu*|k*bsd*-gnu*)
 
 gnu)
     test_randr=no
-    test_cups=no
     _os=GNU
      ;;
 
@@ -1525,7 +1519,6 @@ cygwin*|interix*|mingw32*)
     # is "mingw32" (because in that case it is the MinGW
     # tool-chain that is used).
 
-    test_cups=no
     test_randr=no
     test_freetype=no
     test_fontconfig=no
@@ -1601,7 +1594,6 @@ freebsd*)
     ;;
 
 aix*)
-    test_cups=no
     test_randr=no
     test_freetype=yes
     PTHREAD_LIBS=-pthread
@@ -1629,7 +1621,6 @@ dragonfly*)
 
 androideabi*)
     build_gstreamer=no
-    test_cups=no
     test_fontconfig=no
     test_freetype=no
     test_gtk=no
@@ -2258,24 +2249,6 @@ else
 fi
 AC_SUBST(DISABLE_STRIP)
 
-dnl check for cups support
-dnl ===================================================================
-AC_MSG_CHECKING([whether to enable native cups support])
-if test "$test_cups" = "yes" -a "z$enable_cups" != "zno"; then
-    ENABLE_CUPS="TRUE"
-    AC_MSG_RESULT([yes])
-    AC_CHECK_LIB(cups, cupsPrintFiles)
-    AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
-    if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -a "$ac_cv_header_cups_cups_h" != "yes"; then
-        AC_MSG_ERROR([Could not find CUPS. Install libcupsys2-dev or cups???-devel.])
-    fi
-else
-    ENABLE_CUPS=""
-    AC_MSG_RESULT([no])
-fi
-AC_SUBST(ENABLE_CUPS)
-
-
 # check for fontconfig support
 AC_MSG_CHECKING([whether we need fontconfig])
 if test "z$test_fontconfig" = "zyes"; then
@@ -5920,9 +5893,6 @@ if test  "$_os" = "Darwin"; then
             x_libraries="no_x_libraries"
             dnl disable some things used on other Unix versions but not on the aqua build
             enable_gtk=no
-            enable_cups=no
-            ENABLE_CUPS=""
-            AC_SUBST(ENABLE_CUPS)
         else
             AC_MSG_ERROR([No AppKit.framewrok found])
         fi
diff --git a/distro-configs/LibreOfficeAndroid.conf b/distro-configs/LibreOfficeAndroid.conf
index 90d710b..e8d9da4 100644
--- a/distro-configs/LibreOfficeAndroid.conf
+++ b/distro-configs/LibreOfficeAndroid.conf
@@ -1,5 +1,4 @@
 --host=arm-linux-androideabi
---disable-cups
 --disable-gconf
 --disable-gnome-vfs
 --disable-gstreamer
diff --git a/distro-configs/LibreOfficeiOS.conf b/distro-configs/LibreOfficeiOS.conf
index bd2b60c..fbc60f9 100644
--- a/distro-configs/LibreOfficeiOS.conf
+++ b/distro-configs/LibreOfficeiOS.conf
@@ -1,7 +1,6 @@
 --build=i386-apple-darwin10.7.0
 --host=arm-apple-darwin10
 --disable-cairo
---disable-cups
 --disable-fontconfig
 --disable-gconf
 --disable-gnome-vfs
diff --git a/distro-configs/OxygenOfficeLinux.conf b/distro-configs/OxygenOfficeLinux.conf
index 7cb36c9..73c1d76 100644
--- a/distro-configs/OxygenOfficeLinux.conf
+++ b/distro-configs/OxygenOfficeLinux.conf
@@ -8,7 +8,6 @@
 --without-system-mozilla
 --with-package-format=rpm deb
 --enable-epm
---enable-cups
 --disable-symbols
 --enable-systray
 --with-epm=internal
diff --git a/set_soenv.in b/set_soenv.in
index 76681f3..0618410 100755
--- a/set_soenv.in
+++ b/set_soenv.in
@@ -1846,7 +1846,6 @@ ToFile( "ENABLE_SYMBOLS",    "@ENABLE_SYMBOLS@",    "e" );
 ToFile( "DISABLE_STRIP",     "@DISABLE_STRIP@",     "e" );
 ToFile( "LFS_CFLAGS",        "@LFS_CFLAGS@",     "e" );
 ToFile( "ENABLE_CRASHDUMP",  "@ENABLE_CRASHDUMP@",  "e" );
-ToFile( "ENABLE_CUPS",       "@ENABLE_CUPS@",       "e" );
 ToFile( "ENABLE_RANDR",      "@ENABLE_RANDR@",      "e" );
 ToFile( "ENABLE_FONTCONFIG", "@ENABLE_FONTCONFIG@", "e" );
 ToFile( "FONTCONFIG_LIBS",   "@FONTCONFIG_LIBS@",   "e");
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index c69e143..c3b3ad1 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -398,9 +398,6 @@ $(eval $(call gb_Library_add_defs,vcl,\
     -DSAL_DLLPOSTFIX=\"$(gb_Library_OOOEXT)\" \
     -D_XSALSET_LIBNAME=\"$(call gb_Library_get_runtime_filename,spa)\" \
 ))
-$(eval $(call gb_Library_add_defs,vcl,\
-    $(if $(ENABLE_CUPS),-DENABLE_CUPS) \
-))
 $(eval $(call gb_Library_add_exception_objects,vcl,\
     vcl/unx/generic/glyphs/gcach_ftyp \
     vcl/unx/generic/glyphs/gcach_layout \
diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx
index 1e8c378..62d6288 100644
--- a/vcl/unx/generic/printer/cupsmgr.cxx
+++ b/vcl/unx/generic/printer/cupsmgr.cxx
@@ -29,16 +29,9 @@
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_vcl.hxx"
 
-#ifdef ENABLE_CUPS
 #include <cups/cups.h>
 #include <cups/ppd.h>
 
-#else // !ENABLE_CUPS
-typedef void ppd_file_t;
-typedef void cups_dest_t;
-typedef void cups_option_t;
-#endif
-
 #include <unistd.h>
 
 #include "cupsmgr.hxx"
@@ -165,7 +158,6 @@ CUPSWrapper::CUPSWrapper()
         : m_pLib( NULL ),
           m_bPPDThreadRunning( false )
 {
-#ifdef ENABLE_CUPS
     OUString aLib( RTL_CONSTASCII_USTRINGPARAM( CUPS_LIB_NAME ) );
     m_pLib = osl_loadModule( aLib.pData, SAL_LOADMODULE_LAZY );
     if( ! m_pLib )
@@ -173,7 +165,6 @@ CUPSWrapper::CUPSWrapper()
         aLib = OUString( RTL_CONSTASCII_USTRINGPARAM( SAL_MODULENAME( "cups" ) ) );
         m_pLib = osl_loadModule( aLib.pData, SAL_LOADMODULE_LAZY );
     }
-#endif
 
     if( ! m_pLib )
     {
@@ -357,7 +348,6 @@ OString CUPSWrapper::cupsGetPPD( const char* pPrinter )
     return aResult;
 }
 
-#ifdef ENABLE_CUPS
 static const char* setPasswordCallback( const char* pIn )
 {
     const char* pRet = NULL;
@@ -367,7 +357,6 @@ static const char* setPasswordCallback( const char* pIn )
         pRet = static_cast<CUPSManager&>(rMgr).authenticateUser( pIn );
     return pRet;
 }
-#endif
 
 /*
  *  CUPSManager class
@@ -376,7 +365,6 @@ static const char* setPasswordCallback( const char* pIn )
 CUPSManager* CUPSManager::tryLoadCUPS()
 {
     CUPSManager* pManager = NULL;
-#ifdef ENABLE_CUPS
     static const char* pEnv = getenv( "SAL_DISABLE_CUPS" );
 
     if( ! pEnv || ! *pEnv )
@@ -388,7 +376,6 @@ CUPSManager* CUPSManager::tryLoadCUPS()
         else
             delete pWrapper;
     }
-#endif
     return pManager;
 }
 
@@ -499,7 +486,6 @@ void CUPSManager::initialize()
     // get normal printers, clear printer list
     PrinterInfoManager::initialize();
 
-#ifdef ENABLE_CUPS
     // check whether thread has completed
     // if not behave like old printing system
     osl::MutexGuard aGuard( m_aCUPSMutex );
@@ -634,10 +620,8 @@ void CUPSManager::initialize()
     }
 
     m_pCUPSWrapper->cupsSetPasswordCB( setPasswordCallback );
-#endif // ENABLE_CUPS
 }
 
-#ifdef ENABLE_CUPS
 static void updatePrinterContextInfo( ppd_group_t* pPPDGroup, PPDContext& rContext )
 {
     rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
@@ -687,7 +671,6 @@ static void updatePrinterContextInfo( ppd_group_t* pPPDGroup, PPDContext& rConte
         updatePrinterContextInfo( pPPDGroup->subgroups + g, rContext );
     }
 }
-#endif // ENABLE_CUPS
 
 const PPDParser* CUPSManager::createCUPSParser( const OUString& rPrinter )
 {
@@ -699,7 +682,6 @@ const PPDParser* CUPSManager::createCUPSParser( const OUString& rPrinter )
     else
         aPrinter = rPrinter;
 
-#ifdef ENABLE_CUPS
     if( m_aCUPSMutex.tryToAcquire() )
     {
         if( m_nDests && m_pDests && ! isCUPSDisabled() )
@@ -776,7 +758,6 @@ const PPDParser* CUPSManager::createCUPSParser( const OUString& rPrinter )
     else
         fprintf( stderr, "could not acquire CUPS mutex !!!\n" );
     #endif
-    #endif // ENABLE_CUPS
 
     if( ! pNewParser )
     {
@@ -792,14 +773,8 @@ const PPDParser* CUPSManager::createCUPSParser( const OUString& rPrinter )
     return pNewParser;
 }
 
-void CUPSManager::setupJobContextData(
-    JobData&
-#ifdef ENABLE_CUPS
-    rData
-#endif
-)
+void CUPSManager::setupJobContextData( JobData& rData )
 {
-#ifdef ENABLE_CUPS
     boost::unordered_map< OUString, int, OUStringHash >::iterator dest_it =
         m_aCUPSDestMap.find( rData.m_aPrinterName );
 
@@ -835,7 +810,6 @@ void CUPSManager::setupJobContextData(
 
     rData.m_pParser     = p_it->second.m_aInfo.m_pParser;
     rData.m_aContext    = p_it->second.m_aInfo.m_aContext;
-#endif
 }
 
 FILE* CUPSManager::startSpool( const OUString& rPrintername, bool bQuickCommand )
@@ -850,7 +824,6 @@ FILE* CUPSManager::startSpool( const OUString& rPrintername, bool bQuickCommand
         return PrinterInfoManager::startSpool( rPrintername, bQuickCommand );
     }
 
-#ifdef ENABLE_CUPS
     OUString aTmpURL, aTmpFile;
     osl_createTempFile( NULL, NULL, &aTmpURL.pData );
     osl_getSystemPathFromFileURL( aTmpURL.pData, &aTmpFile.pData );
@@ -860,9 +833,6 @@ FILE* CUPSManager::startSpool( const OUString& rPrintername, bool bQuickCommand
         m_aSpoolFiles[fp] = aSysFile;
 
     return fp;
-#else
-    return NULL;
-#endif
 }
 
 struct less_ppd_key : public ::std::binary_function<double, double, bool>
@@ -933,7 +903,6 @@ int CUPSManager::endSpool( const OUString& rPrintername, const OUString& rJobTit
         return PrinterInfoManager::endSpool( rPrintername, rJobTitle, pFile, rDocumentJobData, bBanner );
     }
 
-    #ifdef ENABLE_CUPS
     boost::unordered_map< FILE*, OString, FPtrHash >::const_iterator it = m_aSpoolFiles.find( pFile );
     if( it != m_aSpoolFiles.end() )
     {
@@ -972,7 +941,6 @@ int CUPSManager::endSpool( const OUString& rPrintername, const OUString& rJobTit
         if( pOptions )
             m_pCUPSWrapper->cupsFreeOptions( nNumOptions, pOptions );
     }
-#endif // ENABLE_CUPS
 
     return nJobID;
 }
@@ -1060,7 +1028,6 @@ bool CUPSManager::removePrinter( const OUString& rName, bool bCheck )
 bool CUPSManager::setDefaultPrinter( const OUString& rName )
 {
     bool bSuccess = false;
-#ifdef ENABLE_CUPS
     boost::unordered_map< OUString, int, OUStringHash >::iterator nit =
         m_aCUPSDestMap.find( rName );
     if( nit != m_aCUPSDestMap.end() && m_aCUPSMutex.tryToAcquire() )
@@ -1075,7 +1042,6 @@ bool CUPSManager::setDefaultPrinter( const OUString& rName )
         bSuccess = true;
     }
     else
-#endif
         bSuccess = PrinterInfoManager::setDefaultPrinter( rName );
 
     return bSuccess;
@@ -1083,7 +1049,6 @@ bool CUPSManager::setDefaultPrinter( const OUString& rName )
 
 bool CUPSManager::writePrinterConfig()
 {
-#ifdef ENABLE_CUPS
     bool bDestModified = false;
     rtl_TextEncoding aEncoding = osl_getThreadTextEncoding();
 
@@ -1131,7 +1096,6 @@ bool CUPSManager::writePrinterConfig()
         m_pCUPSWrapper->cupsSetDests( m_nDests, (cups_dest_t*)m_pDests );
         m_aCUPSMutex.release();
     }
-#endif // ENABLE_CUPS
 
     return PrinterInfoManager::writePrinterConfig();
 }
@@ -1145,7 +1109,6 @@ const char* CUPSManager::authenticateUser( const char* /*pIn*/ )
 {
     const char* pRet = NULL;
 
-#ifdef ENABLE_CUPS
     OUString aLib(RTL_CONSTASCII_USTRINGPARAM( _XSALSET_LIBNAME ));
     oslModule pLib = osl_loadModule( aLib.pData, SAL_LOADMODULE_LAZY );
     if( pLib )
@@ -1173,7 +1136,6 @@ const char* CUPSManager::authenticateUser( const char* /*pIn*/ )
 #if OSL_DEBUG_LEVEL > 1
     else fprintf( stderr, "loading of module %s failed\n", OUStringToOString( aLib, osl_getThreadTextEncoding() ).getStr() );
 #endif
-#endif // ENABLE_CUPS
 
     return pRet;
 }
-- 
1.7.5.4


--17pEHd4RhPHOinZp--


More information about the LibreOffice mailing list