Use cups-config to probe for cups support.

Francois Gouget fgouget at codeweavers.com
Thu Jul 24 09:09:07 CDT 2008


---

On Solaris, the SFWcups package installs in /opt/sfw/cups. Fortunately 
there is /opt/sfw/cups/bin/cups-config which seems like the best way to 
locate the headers and libraries.

 configure                     |  165 +++++++++++++++++++++++++++++++++++++++--
 configure.ac                  |   17 +++-
 dlls/wineps.drv/Makefile.in   |    2 +-
 dlls/winspool.drv/Makefile.in |    1 +
 4 files changed, 172 insertions(+), 13 deletions(-)

diff --git a/configure b/configure
index 746e742..b5c34de 100755
--- a/configure
+++ b/configure
@@ -763,6 +763,7 @@ ESDINCL
 ESDLIBS
 ALSALIBS
 AUDIOIOLIBS
+CUPSINCL
 FONTCONFIGINCL
 EXTRACFLAGS
 BUILTINFLAG
@@ -1950,7 +1951,7 @@ fi
 
 # Check whether --with-cups was given.
 if test "${with_cups+set}" = set; then
-  withval=$with_cups; if test "x$withval" = "xno"; then ac_cv_header_cups_cups_h=no; fi
+  withval=$with_cups;
 fi
 
 
@@ -7209,7 +7210,6 @@ done
 
 
 
-
 for ac_header in \
 	AudioUnit/AudioUnit.h \
 	Carbon/Carbon.h \
@@ -7222,7 +7222,6 @@ for ac_header in \
 	arpa/nameser.h \
 	asm/types.h \
 	capi20.h \
-	cups/cups.h \
 	curses.h \
 	direct.h \
 	dlfcn.h \
@@ -15010,15 +15009,161 @@ esac
 fi
 
 
-if test "$ac_cv_header_cups_cups_h" = "yes"
+CUPSINCL=""
+
+if test "x$with_cups" != "xno"
 then
-    { echo "$as_me:$LINENO: checking for -lcups" >&5
+    ac_save_CPPFLAGS="$CPPFLAGS"
+    ac_cups_cflags=`cups-config --cflags 2>/dev/null`
+    ac_cups_libs="`cups-config --ldflags 2>/dev/null` `cups-config --libs 2>/dev/null`"
+    CPPFLAGS="$CPPFLAGS $ac_cups_cflags"
+
+for ac_header in cups/cups.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+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_compile") 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_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+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_cpp conftest.$ac_ext") 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); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    ( cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to wine-devel at winehq.org ##
+## ------------------------------------ ##
+_ASBOX
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+ { 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"
+LIBS="-lcups $ac_cups_libs $LIBS"
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -15087,9 +15232,14 @@ cat >>confdefs.h <<_ACEOF
 #define SONAME_LIBCUPS "$ac_cv_lib_soname_cups"
 _ACEOF
 
+       CUPSINCL="$ac_cups_cflags"
+fi
 
 fi
 
+done
+
+    CPPFLAGS="$ac_save_CPPFLAGS"
 fi
 if test "x$ac_cv_lib_soname_cups" = "x"; then
   case "x$with_cups" in
@@ -23848,6 +23998,7 @@ ESDINCL!$ESDINCL$ac_delim
 ESDLIBS!$ESDLIBS$ac_delim
 ALSALIBS!$ALSALIBS$ac_delim
 AUDIOIOLIBS!$AUDIOIOLIBS$ac_delim
+CUPSINCL!$CUPSINCL$ac_delim
 FONTCONFIGINCL!$FONTCONFIGINCL$ac_delim
 EXTRACFLAGS!$EXTRACFLAGS$ac_delim
 BUILTINFLAG!$BUILTINFLAG$ac_delim
@@ -23864,7 +24015,7 @@ LIBOBJS!$LIBOBJS$ac_delim
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 80; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 81; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
diff --git a/configure.ac b/configure.ac
index 57abe38..457f32e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -27,8 +27,7 @@ AC_ARG_WITH(cms,       AS_HELP_STRING([--without-cms],[do not use CMS (color man
             [if test "x$withval" = "xno"; then ac_cv_header_lcms_h=no; ac_cv_header_lcms_lcms_h=no; fi])
 AC_ARG_WITH(coreaudio, AS_HELP_STRING([--without-coreaudio],[do not use the CoreAudio sound support]),
             [if test "x$withval" = "xno"; then ac_cv_header_CoreAudio_CoreAudio_h=no; fi])
-AC_ARG_WITH(cups,      AS_HELP_STRING([--without-cups],[do not use CUPS]),
-            [if test "x$withval" = "xno"; then ac_cv_header_cups_cups_h=no; fi])
+AC_ARG_WITH(cups,      AS_HELP_STRING([--without-cups],[do not use CUPS]))
 AC_ARG_WITH(curses,    AS_HELP_STRING([--without-curses],[do not use (n)curses]),
             [if test "x$withval" = "xno"; then ac_cv_header_ncurses_h=no; ac_cv_header_curses_h=no; fi])
 AC_ARG_WITH(esd,       AS_HELP_STRING([--without-esd],[do not use the EsounD sound support]))
@@ -238,7 +237,6 @@ AC_CHECK_HEADERS(\
 	arpa/nameser.h \
 	asm/types.h \
 	capi20.h \
-	cups/cups.h \
 	curses.h \
 	direct.h \
 	dlfcn.h \
@@ -1121,9 +1119,18 @@ WINE_NOTICE_WITH(capi,[test "x$ac_cv_lib_soname_capi20" = "x"],
                  [libcapi20 development files not found, ISDN won't be supported.])
 
 dnl **** Check for cups ****
-if test "$ac_cv_header_cups_cups_h" = "yes"
+AC_SUBST(CUPSINCL,"")
+if test "x$with_cups" != "xno"
 then
-    WINE_CHECK_SONAME(cups,cupsGetDefault)
+    ac_save_CPPFLAGS="$CPPFLAGS"
+    ac_cups_cflags=`cups-config --cflags 2>/dev/null`
+    ac_cups_libs="`cups-config --ldflags 2>/dev/null` `cups-config --libs 2>/dev/null`"
+    CPPFLAGS="$CPPFLAGS $ac_cups_cflags"
+    AC_CHECK_HEADERS(cups/cups.h,
+            [WINE_CHECK_SONAME(cups,cupsGetDefault,
+                       [CUPSINCL="$ac_cups_cflags"],,
+                       [$ac_cups_libs])])
+    CPPFLAGS="$ac_save_CPPFLAGS"
 fi
 WINE_NOTICE_WITH(cups,[test "x$ac_cv_lib_soname_cups" = "x"],
                  [libcups development files not found, CUPS won't be supported.])
diff --git a/dlls/wineps.drv/Makefile.in b/dlls/wineps.drv/Makefile.in
index ed8282b..fef94ae 100644
--- a/dlls/wineps.drv/Makefile.in
+++ b/dlls/wineps.drv/Makefile.in
@@ -4,7 +4,7 @@ SRCDIR    = @srcdir@
 VPATH     = @srcdir@
 MODULE    = wineps.drv
 IMPORTS   = user32 gdi32 winspool advapi32 kernel32
-EXTRAINCL = @FREETYPEINCL@
+EXTRAINCL = @FREETYPEINCL@ @CUPSINCL@
 
 SPEC_SRCS16 = wineps16.drv.spec
 
diff --git a/dlls/winspool.drv/Makefile.in b/dlls/winspool.drv/Makefile.in
index bd87824..7e670db 100644
--- a/dlls/winspool.drv/Makefile.in
+++ b/dlls/winspool.drv/Makefile.in
@@ -6,6 +6,7 @@ VPATH     = @srcdir@
 MODULE    = winspool.drv
 IMPORTLIB = winspool
 IMPORTS   = user32 gdi32 advapi32 kernel32 ntdll
+EXTRAINCL = @CUPSINCL@
 
 C_SRCS = \
 	info.c \
-- 
1.5.6.2



More information about the wine-patches mailing list