Alexandre Julliard : configure: Make the libcups soname check depend on the header check.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jul 3 08:01:21 CDT 2007


Module: wine
Branch: master
Commit: 702d35560b8b5dcccf7d0f34019b28d74a548a98
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=702d35560b8b5dcccf7d0f34019b28d74a548a98

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Jul  2 17:30:44 2007 +0200

configure: Make the libcups soname check depend on the header check.

---

 configure                |  160 +++++++++++++++++++++++----------------------
 configure.ac             |    7 ++-
 dlls/wineps.drv/init.c   |   12 +--
 dlls/winspool.drv/info.c |    9 +--
 4 files changed, 95 insertions(+), 93 deletions(-)

diff --git a/configure b/configure
index f109e73..13e7847 100755
--- a/configure
+++ b/configure
@@ -13582,6 +13582,88 @@ fi
 
 fi
 
+if test "$ac_cv_header_cups_cups_h" = "yes"
+then
+    { echo "$as_me:$LINENO: checking for -lcups" >&5
+echo $ECHO_N "checking for -lcups... $ECHO_C" >&6; }
+if test "${ac_cv_lib_soname_cups+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_soname_save_LIBS=$LIBS
+LIBS="-lcups  $LIBS"
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char cupsGetDefault ();
+int
+main ()
+{
+return cupsGetDefault ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  case "$LIBEXT" in
+    dll) ;;
+    dylib) ac_cv_lib_soname_cups=`otool -L conftest$ac_exeext | grep "libcups\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libcups\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;;
+    *) ac_cv_lib_soname_cups=`$ac_cv_path_LDD conftest$ac_exeext | grep "libcups\\.$LIBEXT" | sed -e "s/^.*\(libcups\.$LIBEXT[^	 ]*\).*$/\1/"';2,$d'` ;;
+  esac
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+  LIBS=$ac_check_soname_save_LIBS
+fi
+if test "x$ac_cv_lib_soname_cups" = "x"; then
+  { echo "$as_me:$LINENO: result: not found" >&5
+echo "${ECHO_T}not found" >&6; }
+
+else
+  { echo "$as_me:$LINENO: result: $ac_cv_lib_soname_cups" >&5
+echo "${ECHO_T}$ac_cv_lib_soname_cups" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define SONAME_LIBCUPS "$ac_cv_lib_soname_cups"
+_ACEOF
+
+
+fi
+
+fi
+
 
 EXTRACFLAGS=""
 
@@ -15072,84 +15154,6 @@ _ACEOF
 
 fi
 
-{ echo "$as_me:$LINENO: checking for -lcups" >&5
-echo $ECHO_N "checking for -lcups... $ECHO_C" >&6; }
-if test "${ac_cv_lib_soname_cups+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_soname_save_LIBS=$LIBS
-LIBS="-lcups  $LIBS"
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char cupsGetDefault ();
-int
-main ()
-{
-return cupsGetDefault ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  case "$LIBEXT" in
-    dll) ;;
-    dylib) ac_cv_lib_soname_cups=`otool -L conftest$ac_exeext | grep "libcups\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libcups\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;;
-    *) ac_cv_lib_soname_cups=`$ac_cv_path_LDD conftest$ac_exeext | grep "libcups\\.$LIBEXT" | sed -e "s/^.*\(libcups\.$LIBEXT[^	 ]*\).*$/\1/"';2,$d'` ;;
-  esac
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-  LIBS=$ac_check_soname_save_LIBS
-fi
-if test "x$ac_cv_lib_soname_cups" = "x"; then
-  { echo "$as_me:$LINENO: result: not found" >&5
-echo "${ECHO_T}not found" >&6; }
-
-else
-  { echo "$as_me:$LINENO: result: $ac_cv_lib_soname_cups" >&5
-echo "${ECHO_T}$ac_cv_lib_soname_cups" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define SONAME_LIBCUPS "$ac_cv_lib_soname_cups"
-_ACEOF
-
-
-fi
-
 { echo "$as_me:$LINENO: checking for -ljack" >&5
 echo $ECHO_N "checking for -ljack... $ECHO_C" >&6; }
 if test "${ac_cv_lib_soname_jack+set}" = set; then
diff --git a/configure.ac b/configure.ac
index 0c5b1a4..7deadf5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -967,6 +967,12 @@ then
     WINE_CHECK_SONAME(capi20,capi20_register)
 fi
 
+dnl **** Check for cups ****
+if test "$ac_cv_header_cups_cups_h" = "yes"
+then
+    WINE_CHECK_SONAME(cups,cupsGetDefault)
+fi
+
 dnl **** Check for gcc specific options ****
 
 AC_SUBST(EXTRACFLAGS,"")
@@ -1115,7 +1121,6 @@ WINE_CHECK_SONAME(Xcursor,XcursorImageLoadCursor,,,[$X_LIBS -lX11 $X_EXTRA_LIBS]
 WINE_CHECK_SONAME(freetype,FT_Init_FreeType,,,[$X_LIBS])
 WINE_CHECK_SONAME(GL,glXQueryExtension,,,[$X_LIBS $X_EXTRA_LIBS])
 WINE_CHECK_SONAME(txc_dxtn,fetch_2d_texel_rgba_dxt1)
-WINE_CHECK_SONAME(cups,cupsGetDefault)
 WINE_CHECK_SONAME(jack,jack_client_new)
 WINE_CHECK_SONAME(fontconfig,FcInit)
 WINE_CHECK_SONAME(ssl,SSL_library_init)
diff --git a/dlls/wineps.drv/init.c b/dlls/wineps.drv/init.c
index cf3b8a5..a794bec 100644
--- a/dlls/wineps.drv/init.c
+++ b/dlls/wineps.drv/init.c
@@ -45,11 +45,7 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
 
-#ifndef SONAME_LIBCUPS
-#define SONAME_LIBCUPS "libcups" SONAME_EXT
-#endif
-
-#ifdef HAVE_CUPS_CUPS_H
+#ifdef SONAME_LIBCUPS
 static void *cupshandle = NULL;
 #endif
 
@@ -144,7 +140,7 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
 		HeapDestroy(PSDRV_Heap);
 		return FALSE;
 	    }
-#ifdef HAVE_CUPS_CUPS_H
+#ifdef SONAME_LIBCUPS
 	    /* dynamically load CUPS if not yet loaded */
 	    if (!cupshandle) {
 		cupshandle = wine_dlopen(SONAME_LIBCUPS, RTLD_NOW, NULL, 0);
@@ -157,7 +153,7 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
 
 	    DeleteObject( PSDRV_DefaultFont );
 	    HeapDestroy( PSDRV_Heap );
-#ifdef HAVE_CUPS_CUPS_H
+#ifdef SONAME_LIBCUPS
 	    if (cupshandle && (cupshandle != (void*)-1)) {
 		wine_dlclose(cupshandle, NULL, 0);
 		cupshandle = NULL;
@@ -580,7 +576,7 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name)
 	goto cleanup;
     }
 
-#ifdef HAVE_CUPS_CUPS_H
+#ifdef SONAME_LIBCUPS
     if (cupshandle != (void*)-1) {
 	typeof(cupsGetPPD) * pcupsGetPPD = NULL;
 
diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c
index d379df6..19b70be 100644
--- a/dlls/winspool.drv/info.c
+++ b/dlls/winspool.drv/info.c
@@ -38,9 +38,6 @@
 #include <signal.h>
 #ifdef HAVE_CUPS_CUPS_H
 # include <cups/cups.h>
-# ifndef SONAME_LIBCUPS
-#  define SONAME_LIBCUPS "libcups" SONAME_EXT
-# endif
 #endif
 
 #define NONAMELESSUNION
@@ -410,7 +407,7 @@ static BOOL add_printer_driver(const char *name)
     return TRUE;
 }
 
-#ifdef HAVE_CUPS_CUPS_H
+#ifdef SONAME_LIBCUPS
 static typeof(cupsGetDests)  *pcupsGetDests;
 static typeof(cupsGetPPD)    *pcupsGetPPD;
 static typeof(cupsPrintFile) *pcupsPrintFile;
@@ -1567,7 +1564,7 @@ void WINSPOOL_LoadSystemPrinters(void)
     }
 
 
-#ifdef HAVE_CUPS_CUPS_H
+#ifdef SONAME_LIBCUPS
     done = CUPS_LoadPrinters();
 #endif
 
@@ -7129,7 +7126,7 @@ static BOOL schedule_lpr(LPCWSTR printer_name, LPCWSTR filename)
  */
 static BOOL schedule_cups(LPCWSTR printer_name, LPCWSTR filename, LPCWSTR document_title)
 {
-#if HAVE_CUPS_CUPS_H
+#ifdef SONAME_LIBCUPS
     if(pcupsPrintFile)
     {
         char *unixname, *queue, *doc_titleA;




More information about the wine-cvs mailing list