Added CUPS printing support.

diff --git a/configure b/configure
index 3455085..2222de9 100755
--- a/configure
+++ b/configure
@@ -4565,13 +4565,61 @@
     fi
 fi
 
+CUPSLIBS=""
+echo $ac_n "checking for cupsGetPPD in -lcups""... $ac_c" 1>&6
+echo "configure:4571: checking for cupsGetPPD in -lcups" >&5
+ac_lib_var=`echo cups'_'cupsGetPPD | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lcups  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 4579 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char cupsGetPPD();
+
+int main() {
+cupsGetPPD()
+; return 0; }
+EOF
+if { (eval echo configure:4590: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_CUPS 1
+EOF
+
+	CUPSLIBS="-lcups"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+
 echo $ac_n "checking "for GNU style IPX support"""... $ac_c" 1>&6
-echo "configure:4570: checking "for GNU style IPX support"" >&5
+echo "configure:4618: checking "for GNU style IPX support"" >&5
 if eval "test \"`echo '$''{'ac_cv_c_ipx_gnu'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4575 "configure"
+#line 4623 "configure"
 #include "confdefs.h"
 #include <sys/socket.h>
     #include <netipx/ipx.h>
@@ -4579,7 +4627,7 @@
 ((struct sockaddr_ipx *)0)->sipx_family == AF_IPX
 ; return 0; }
 EOF
-if { (eval echo configure:4583: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4631: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_ipx_gnu="yes"
 else
@@ -4604,12 +4652,12 @@
 if test "$ac_cv_c_ipx_gnu" = "no"
 then
  echo $ac_n "checking "for linux style IPX support"""... $ac_c" 1>&6
-echo "configure:4608: checking "for linux style IPX support"" >&5
+echo "configure:4656: checking "for linux style IPX support"" >&5
 if eval "test \"`echo '$''{'ac_cv_c_ipx_linux'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4613 "configure"
+#line 4661 "configure"
 #include "confdefs.h"
 #include <sys/socket.h>
      #include <asm/types.h>
@@ -4618,7 +4666,7 @@
 ((struct sockaddr_ipx *)0)->sipx_family == AF_IPX
 ; return 0; }
 EOF
-if { (eval echo configure:4622: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4670: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_ipx_linux="yes"
 else
@@ -4645,17 +4693,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4649: checking for $ac_hdr" >&5
+echo "configure:4697: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4654 "configure"
+#line 4702 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4659: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4707: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4683,12 +4731,12 @@
 
 
 echo $ac_n "checking "for Open Sound System"""... $ac_c" 1>&6
-echo "configure:4687: checking "for Open Sound System"" >&5
+echo "configure:4735: checking "for Open Sound System"" >&5
 if eval "test \"`echo '$''{'ac_cv_c_opensoundsystem'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4692 "configure"
+#line 4740 "configure"
 #include "confdefs.h"
 
 	#if defined(HAVE_SYS_SOUNDCARD_H)
@@ -4709,7 +4757,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:4713: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4761: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_opensoundsystem="yes"
 else
@@ -4732,12 +4780,12 @@
 fi
 
 echo $ac_n "checking "for Open Sound System/MIDI interface"""... $ac_c" 1>&6
-echo "configure:4736: checking "for Open Sound System/MIDI interface"" >&5
+echo "configure:4784: checking "for Open Sound System/MIDI interface"" >&5
 if eval "test \"`echo '$''{'ac_cv_c_opensoundsystem_midi'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4741 "configure"
+#line 4789 "configure"
 #include "confdefs.h"
 
 	#if defined(HAVE_SYS_SOUNDCARD_H)
@@ -4758,7 +4806,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:4762: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4810: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_opensoundsystem_midi="yes"
 else
@@ -4787,7 +4835,7 @@
 then
   CFLAGS="$CFLAGS -Wall"
   echo $ac_n "checking "for gcc strength-reduce bug"""... $ac_c" 1>&6
-echo "configure:4791: checking "for gcc strength-reduce bug"" >&5
+echo "configure:4839: checking "for gcc strength-reduce bug"" >&5
 if eval "test \"`echo '$''{'ac_cv_c_gcc_strength_bug'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4795,7 +4843,7 @@
   ac_cv_c_gcc_strength_bug="yes"
 else
   cat > conftest.$ac_ext <<EOF
-#line 4799 "configure"
+#line 4847 "configure"
 #include "confdefs.h"
 
 int	L[4] = {0,1,2,3};
@@ -4810,7 +4858,7 @@
   exit( Array[1] != -2 || L[2] != 3);
 }
 EOF
-if { (eval echo configure:4814: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4862: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_c_gcc_strength_bug="no"
 else
@@ -4831,21 +4879,21 @@
   fi
 
     echo $ac_n "checking "for gcc -mpreferred-stack-boundary=2 support"""... $ac_c" 1>&6
-echo "configure:4835: checking "for gcc -mpreferred-stack-boundary=2 support"" >&5
+echo "configure:4883: checking "for gcc -mpreferred-stack-boundary=2 support"" >&5
 if eval "test \"`echo '$''{'ac_cv_c_gcc_stack_boundary'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   saved_cflags=$CFLAGS
   CFLAGS="$CFLAGS -mpreferred-stack-boundary=2"
   cat > conftest.$ac_ext <<EOF
-#line 4842 "configure"
+#line 4890 "configure"
 #include "confdefs.h"
 
 int main() {
 return 0
 ; return 0; }
 EOF
-if { (eval echo configure:4849: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4897: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_gcc_stack_boundary="yes"
 else
@@ -4868,7 +4916,7 @@
 
 
 echo $ac_n "checking "whether .type must sit inside a .def directive"""... $ac_c" 1>&6
-echo "configure:4872: checking "whether .type must sit inside a .def directive"" >&5
+echo "configure:4920: checking "whether .type must sit inside a .def directive"" >&5
 if eval "test \"`echo '$''{'ac_cv_c_type_in_def'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4881,14 +4929,14 @@
 	.long 0
 EOF
 cat > conftest.$ac_ext <<EOF
-#line 4885 "configure"
+#line 4933 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:4892: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4940: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_c_type_in_def="yes"
 else
@@ -4912,7 +4960,7 @@
  
 
 echo $ac_n "checking "whether external symbols need an underscore prefix"""... $ac_c" 1>&6
-echo "configure:4916: checking "whether external symbols need an underscore prefix"" >&5
+echo "configure:4964: checking "whether external symbols need an underscore prefix"" >&5
 if eval "test \"`echo '$''{'ac_cv_c_extern_prefix'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4924,14 +4972,14 @@
 	.long 0
 EOF
 cat > conftest.$ac_ext <<EOF
-#line 4928 "configure"
+#line 4976 "configure"
 #include "confdefs.h"
 extern int ac_test;
 int main() {
 if (ac_test) return 1
 ; return 0; }
 EOF
-if { (eval echo configure:4935: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4983: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_c_extern_prefix="yes"
 else
@@ -4955,7 +5003,7 @@
 
 
 echo $ac_n "checking "whether assembler accepts .string"""... $ac_c" 1>&6
-echo "configure:4959: checking "whether assembler accepts .string"" >&5
+echo "configure:5007: checking "whether assembler accepts .string"" >&5
 if eval "test \"`echo '$''{'ac_cv_c_asm_string'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4965,14 +5013,14 @@
 	.string "test"
 EOF
 cat > conftest.$ac_ext <<EOF
-#line 4969 "configure"
+#line 5017 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:4976: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5024: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_c_asm_string="yes"
 else
@@ -5000,21 +5048,21 @@
 if test "$LIBEXT" = "so"
 then
   echo $ac_n "checking "whether we can build a Linux dll"""... $ac_c" 1>&6
-echo "configure:5004: checking "whether we can build a Linux dll"" >&5
+echo "configure:5052: checking "whether we can build a Linux dll"" >&5
 if eval "test \"`echo '$''{'ac_cv_c_dll_linux'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   saved_cflags=$CFLAGS
   CFLAGS="$CFLAGS -fPIC -shared -Wl,-soname,conftest.so.1.0,-Bsymbolic"
   cat > conftest.$ac_ext <<EOF
-#line 5011 "configure"
+#line 5059 "configure"
 #include "confdefs.h"
 
 int main() {
 return 1
 ; return 0; }
 EOF
-if { (eval echo configure:5018: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5066: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_c_dll_linux="yes"
 else
@@ -5035,21 +5083,21 @@
     LDDLLFLAGS="-Wl,-Bsymbolic"
   else
     echo $ac_n "checking whether we can build a UnixWare (Solaris) dll""... $ac_c" 1>&6
-echo "configure:5039: checking whether we can build a UnixWare (Solaris) dll" >&5
+echo "configure:5087: checking whether we can build a UnixWare (Solaris) dll" >&5
 if eval "test \"`echo '$''{'ac_cv_c_dll_unixware'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   saved_cflags=$CFLAGS
     CFLAGS="$CFLAGS -fPIC -Wl,-G,-h,conftest.so.1.0,-B,symbolic"
     cat > conftest.$ac_ext <<EOF
-#line 5046 "configure"
+#line 5094 "configure"
 #include "confdefs.h"
 
 int main() {
 return 1
 ; return 0; }
 EOF
-if { (eval echo configure:5053: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5101: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_c_dll_unixware="yes"
 else
@@ -5070,21 +5118,21 @@
       LDDLLFLAGS="-Wl,-B,symbolic"
     else
       echo $ac_n "checking "whether we can build a NetBSD dll"""... $ac_c" 1>&6
-echo "configure:5074: checking "whether we can build a NetBSD dll"" >&5
+echo "configure:5122: checking "whether we can build a NetBSD dll"" >&5
 if eval "test \"`echo '$''{'ac_cv_c_dll_netbsd'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   saved_cflags=$CFLAGS
       CFLAGS="$CFLAGS -fPIC -Wl,-Bshareable,-Bforcearchive"
       cat > conftest.$ac_ext <<EOF
-#line 5081 "configure"
+#line 5129 "configure"
 #include "confdefs.h"
 
 int main() {
 return 1
 ; return 0; }
 EOF
-if { (eval echo configure:5088: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5136: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_c_dll_netbsd="yes"
 else
@@ -5140,21 +5188,21 @@
 else
     DLL_LINK="-L\$(DLLDIR) \$(DLLS:%=-l%) \$(LIBWINE) \$(LIBUNICODE) \$(X_LIBS) \$(XLIB)"
     echo $ac_n "checking whether the linker supports --[no]-whole-archive (Linux)""... $ac_c" 1>&6
-echo "configure:5144: checking whether the linker supports --[no]-whole-archive (Linux)" >&5
+echo "configure:5192: checking whether the linker supports --[no]-whole-archive (Linux)" >&5
 if eval "test \"`echo '$''{'ac_cv_c_whole_archive'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   saved_cflags=$CFLAGS
             CFLAGS="$CFLAGS -Wl,--whole-archive -Wl,--no-whole-archive"
             cat > conftest.$ac_ext <<EOF
-#line 5151 "configure"
+#line 5199 "configure"
 #include "confdefs.h"
 
 int main() {
 return 1
 ; return 0; }
 EOF
-if { (eval echo configure:5158: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5206: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_c_whole_archive="yes"
 else
@@ -5174,21 +5222,21 @@
         DLL_LINK="-Wl,--whole-archive $DLL_LINK -Wl,--no-whole-archive"
     else
         echo $ac_n "checking whether the linker supports -z {all,default}extract (Linux)""... $ac_c" 1>&6
-echo "configure:5178: checking whether the linker supports -z {all,default}extract (Linux)" >&5
+echo "configure:5226: checking whether the linker supports -z {all,default}extract (Linux)" >&5
 if eval "test \"`echo '$''{'ac_cv_c_allextract'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   saved_cflags=$CFLAGS
 		CFLAGS="$CFLAGS -Wl,-z,allextract -Wl,-z,defaultextract"
 		cat > conftest.$ac_ext <<EOF
-#line 5185 "configure"
+#line 5233 "configure"
 #include "confdefs.h"
 
 int main() {
 return 1
 ; return 0; }
 EOF
-if { (eval echo configure:5192: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5240: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_c_allextract="yes"
 else
@@ -5223,7 +5271,7 @@
 wine_cv_libc_reentrant=no 
 
   echo $ac_n "checking for reentrant libc: __errno_location""... $ac_c" 1>&6
-echo "configure:5227: checking for reentrant libc: __errno_location" >&5
+echo "configure:5275: checking for reentrant libc: __errno_location" >&5
 if eval "test \"`echo '$''{'wine_cv_libc_r___errno_location'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5231,14 +5279,14 @@
   wine_cv_libc_r___errno_location=yes 
 else
   cat > conftest.$ac_ext <<EOF
-#line 5235 "configure"
+#line 5283 "configure"
 #include "confdefs.h"
 int myerrno = 0;
 char buf[256];
 int *__errno_location(){return &myerrno;}
 main(){connect(0,buf,255); exit(!myerrno);}
 EOF
-if { (eval echo configure:5242: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5290: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   wine_cv_libc_r___errno_location=yes
 else
@@ -5261,7 +5309,7 @@
 
 
   echo $ac_n "checking for reentrant libc: __error""... $ac_c" 1>&6
-echo "configure:5265: checking for reentrant libc: __error" >&5
+echo "configure:5313: checking for reentrant libc: __error" >&5
 if eval "test \"`echo '$''{'wine_cv_libc_r___error'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5269,14 +5317,14 @@
   wine_cv_libc_r___error=yes 
 else
   cat > conftest.$ac_ext <<EOF
-#line 5273 "configure"
+#line 5321 "configure"
 #include "confdefs.h"
 int myerrno = 0;
 char buf[256];
 int *__error(){return &myerrno;}
 main(){connect(0,buf,255); exit(!myerrno);}
 EOF
-if { (eval echo configure:5280: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5328: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   wine_cv_libc_r___error=yes
 else
@@ -5299,7 +5347,7 @@
 
 
   echo $ac_n "checking for reentrant libc: ___errno""... $ac_c" 1>&6
-echo "configure:5303: checking for reentrant libc: ___errno" >&5
+echo "configure:5351: checking for reentrant libc: ___errno" >&5
 if eval "test \"`echo '$''{'wine_cv_libc_r____errno'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5307,14 +5355,14 @@
   wine_cv_libc_r____errno=yes 
 else
   cat > conftest.$ac_ext <<EOF
-#line 5311 "configure"
+#line 5359 "configure"
 #include "confdefs.h"
 int myerrno = 0;
 char buf[256];
 int *___errno(){return &myerrno;}
 main(){connect(0,buf,255); exit(!myerrno);}
 EOF
-if { (eval echo configure:5318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5366: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   wine_cv_libc_r____errno=yes
 else
@@ -5337,7 +5385,7 @@
 
 
   echo $ac_n "checking for reentrant libc: __thr_errno""... $ac_c" 1>&6
-echo "configure:5341: checking for reentrant libc: __thr_errno" >&5
+echo "configure:5389: checking for reentrant libc: __thr_errno" >&5
 if eval "test \"`echo '$''{'wine_cv_libc_r___thr_errno'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5345,14 +5393,14 @@
   wine_cv_libc_r___thr_errno=yes 
 else
   cat > conftest.$ac_ext <<EOF
-#line 5349 "configure"
+#line 5397 "configure"
 #include "confdefs.h"
 int myerrno = 0;
 char buf[256];
 int *__thr_errno(){return &myerrno;}
 main(){connect(0,buf,255); exit(!myerrno);}
 EOF
-if { (eval echo configure:5356: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5404: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   wine_cv_libc_r___thr_errno=yes
 else
@@ -5386,7 +5434,7 @@
 if test "$have_x" = "yes" -a "$wine_cv_libc_reentrant" != "no"
 then
 echo $ac_n "checking "for reentrant X libraries"""... $ac_c" 1>&6
-echo "configure:5390: checking "for reentrant X libraries"" >&5
+echo "configure:5438: checking "for reentrant X libraries"" >&5
 if eval "test \"`echo '$''{'wine_cv_x_reentrant'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5435,19 +5483,19 @@
 # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
 # for constant arguments.  Useless!
 echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
-echo "configure:5439: checking for working alloca.h" >&5
+echo "configure:5487: checking for working alloca.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5444 "configure"
+#line 5492 "configure"
 #include "confdefs.h"
 #include <alloca.h>
 int main() {
 void *p = alloca(2 * sizeof(int));
 ; return 0; }
 EOF
-if { (eval echo configure:5451: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5499: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_header_alloca_h=yes
 else
@@ -5468,12 +5516,12 @@
 fi
 
 echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:5472: checking for alloca" >&5
+echo "configure:5520: checking for alloca" >&5
 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5477 "configure"
+#line 5525 "configure"
 #include "confdefs.h"
 
 #ifdef __GNUC__
@@ -5501,7 +5549,7 @@
 char *p = (char *) alloca(1);
 ; return 0; }
 EOF
-if { (eval echo configure:5505: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5553: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_func_alloca_works=yes
 else
@@ -5533,12 +5581,12 @@
 
 
 echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:5537: checking whether alloca needs Cray hooks" >&5
+echo "configure:5585: checking whether alloca needs Cray hooks" >&5
 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5542 "configure"
+#line 5590 "configure"
 #include "confdefs.h"
 #if defined(CRAY) && ! defined(CRAY2)
 webecray
@@ -5563,12 +5611,12 @@
 if test $ac_cv_os_cray = yes; then
 for ac_func in _getb67 GETB67 getb67; do
   echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5567: checking for $ac_func" >&5
+echo "configure:5615: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5572 "configure"
+#line 5620 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -5591,7 +5639,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:5595: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5643: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -5618,7 +5666,7 @@
 fi
 
 echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:5622: checking stack direction for C alloca" >&5
+echo "configure:5670: checking stack direction for C alloca" >&5
 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5626,7 +5674,7 @@
   ac_cv_c_stack_direction=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 5630 "configure"
+#line 5678 "configure"
 #include "confdefs.h"
 find_stack_direction ()
 {
@@ -5645,7 +5693,7 @@
   exit (find_stack_direction() < 0);
 }
 EOF
-if { (eval echo configure:5649: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5697: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_c_stack_direction=1
 else
@@ -5703,12 +5751,12 @@
 
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5707: checking for $ac_func" >&5
+echo "configure:5755: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5712 "configure"
+#line 5760 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -5731,7 +5779,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:5735: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5783: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -5813,17 +5861,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5817: checking for $ac_hdr" >&5
+echo "configure:5865: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5822 "configure"
+#line 5870 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5827: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5875: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5850,12 +5898,12 @@
 done
 
 echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6
-echo "configure:5854: checking whether stat file-mode macros are broken" >&5
+echo "configure:5902: checking whether stat file-mode macros are broken" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5859 "configure"
+#line 5907 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -5908,12 +5956,12 @@
 
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:5912: checking for working const" >&5
+echo "configure:5960: checking for working const" >&5
 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5917 "configure"
+#line 5965 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -5962,7 +6010,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:5966: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6014: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -5983,21 +6031,21 @@
 fi
 
 echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:5987: checking for inline" >&5
+echo "configure:6035: checking for inline" >&5
 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_cv_c_inline=no
 for ac_kw in inline __inline__ __inline; do
   cat > conftest.$ac_ext <<EOF
-#line 5994 "configure"
+#line 6042 "configure"
 #include "confdefs.h"
 
 int main() {
 } int $ac_kw foo() {
 ; return 0; }
 EOF
-if { (eval echo configure:6001: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6049: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_inline=$ac_kw; break
 else
@@ -6023,12 +6071,12 @@
 esac
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:6027: checking for ANSI C header files" >&5
+echo "configure:6075: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6032 "configure"
+#line 6080 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -6036,7 +6084,7 @@
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6040: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6088: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -6053,7 +6101,7 @@
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 6057 "configure"
+#line 6105 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -6071,7 +6119,7 @@
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 6075 "configure"
+#line 6123 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -6092,7 +6140,7 @@
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 6096 "configure"
+#line 6144 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -6103,7 +6151,7 @@
 exit (0); }
 
 EOF
-if { (eval echo configure:6107: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6155: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -6127,12 +6175,12 @@
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:6131: checking for size_t" >&5
+echo "configure:6179: checking for size_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6136 "configure"
+#line 6184 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -6160,7 +6208,7 @@
 fi
 
 echo $ac_n "checking size of long long""... $ac_c" 1>&6
-echo "configure:6164: checking size of long long" >&5
+echo "configure:6212: checking size of long long" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6168,7 +6216,7 @@
   ac_cv_sizeof_long_long=0
 else
   cat > conftest.$ac_ext <<EOF
-#line 6172 "configure"
+#line 6220 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -6179,7 +6227,7 @@
   exit(0);
 }
 EOF
-if { (eval echo configure:6183: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6231: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_long_long=`cat conftestval`
 else
@@ -6200,12 +6248,12 @@
 
 
 echo $ac_n "checking "whether linux/input.h is for real"""... $ac_c" 1>&6
-echo "configure:6204: checking "whether linux/input.h is for real"" >&5
+echo "configure:6252: checking "whether linux/input.h is for real"" >&5
 if eval "test \"`echo '$''{'wine_cv_linux_input_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6209 "configure"
+#line 6257 "configure"
 #include "confdefs.h"
 
 	    #include <linux/input.h>
@@ -6218,7 +6266,7 @@
 	
 ; return 0; }
 EOF
-if { (eval echo configure:6222: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6270: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   wine_cv_linux_input_h=yes
 else
@@ -6242,12 +6290,12 @@
 
    
 echo $ac_n "checking "whether we can use re-entrant gethostbyname_r Linux style"""... $ac_c" 1>&6
-echo "configure:6246: checking "whether we can use re-entrant gethostbyname_r Linux style"" >&5
+echo "configure:6294: checking "whether we can use re-entrant gethostbyname_r Linux style"" >&5
 if eval "test \"`echo '$''{'wine_cv_linux_gethostbyname_r_6'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6251 "configure"
+#line 6299 "configure"
 #include "confdefs.h"
 
 #include <netdb.h>
@@ -6268,7 +6316,7 @@
     
 ; return 0; }
 EOF
-if { (eval echo configure:6272: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6320: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   wine_cv_linux_gethostbyname_r_6=yes
 else
@@ -6294,12 +6342,12 @@
 if test "$ac_cv_header_linux_joystick_h" = "yes"
 then
    echo $ac_n "checking "whether linux/joystick.h uses the Linux 2.2+ API"""... $ac_c" 1>&6
-echo "configure:6298: checking "whether linux/joystick.h uses the Linux 2.2+ API"" >&5
+echo "configure:6346: checking "whether linux/joystick.h uses the Linux 2.2+ API"" >&5
 if eval "test \"`echo '$''{'wine_cv_linux_joystick_22_api'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6303 "configure"
+#line 6351 "configure"
 #include "confdefs.h"
 
 	#include <sys/ioctl.h>
@@ -6314,7 +6362,7 @@
 /*empty*/
 ; return 0; }
 EOF
-if { (eval echo configure:6318: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6366: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   wine_cv_linux_joystick_22_api=yes
 else
@@ -6341,12 +6389,12 @@
 if test "$ac_cv_header_sys_vfs_h" = "yes"
 then
     echo $ac_n "checking "whether sys/vfs.h defines statfs"""... $ac_c" 1>&6
-echo "configure:6345: checking "whether sys/vfs.h defines statfs"" >&5
+echo "configure:6393: checking "whether sys/vfs.h defines statfs"" >&5
 if eval "test \"`echo '$''{'wine_cv_sys_vfs_has_statfs'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6350 "configure"
+#line 6398 "configure"
 #include "confdefs.h"
 
 	#include <sys/types.h>
@@ -6363,7 +6411,7 @@
 	
 ; return 0; }
 EOF
-if { (eval echo configure:6367: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6415: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   wine_cv_sys_vfs_has_statfs=yes
 else
@@ -6390,12 +6438,12 @@
 if test "$ac_cv_header_sys_statfs_h" = "yes"
 then
     echo $ac_n "checking "whether sys/statfs.h defines statfs"""... $ac_c" 1>&6
-echo "configure:6394: checking "whether sys/statfs.h defines statfs"" >&5
+echo "configure:6442: checking "whether sys/statfs.h defines statfs"" >&5
 if eval "test \"`echo '$''{'wine_cv_sys_statfs_has_statfs'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6399 "configure"
+#line 6447 "configure"
 #include "confdefs.h"
 
 	#include <sys/types.h>
@@ -6410,7 +6458,7 @@
 	
 ; return 0; }
 EOF
-if { (eval echo configure:6414: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6462: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   wine_cv_sys_statfs_has_statfs=yes
 else
@@ -6437,12 +6485,12 @@
 if test "$ac_cv_header_sys_mount_h" = "yes"
 then
     echo $ac_n "checking "whether sys/mount.h defines statfs"""... $ac_c" 1>&6
-echo "configure:6441: checking "whether sys/mount.h defines statfs"" >&5
+echo "configure:6489: checking "whether sys/mount.h defines statfs"" >&5
 if eval "test \"`echo '$''{'wine_cv_sys_mount_has_statfs'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6446 "configure"
+#line 6494 "configure"
 #include "confdefs.h"
 
 	#include <sys/types.h>
@@ -6457,7 +6505,7 @@
 	
 ; return 0; }
 EOF
-if { (eval echo configure:6461: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6509: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   wine_cv_sys_mount_has_statfs=yes
 else
@@ -6483,7 +6531,7 @@
 
 
 echo $ac_n "checking "for statfs.f_bfree"""... $ac_c" 1>&6
-echo "configure:6487: checking "for statfs.f_bfree"" >&5
+echo "configure:6535: checking "for statfs.f_bfree"" >&5
 if eval "test \"`echo '$''{'wine_cv_statfs_bfree'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6492,7 +6540,7 @@
         wine_cv_statfs_bfree=no
     else
     	cat > conftest.$ac_ext <<EOF
-#line 6496 "configure"
+#line 6544 "configure"
 #include "confdefs.h"
 
 	#include <sys/types.h>
@@ -6519,7 +6567,7 @@
 	
 ; return 0; }
 EOF
-if { (eval echo configure:6523: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6571: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   wine_cv_statfs_bfree=yes
 else
@@ -6543,7 +6591,7 @@
 fi
 
 echo $ac_n "checking "for statfs.f_bavail"""... $ac_c" 1>&6
-echo "configure:6547: checking "for statfs.f_bavail"" >&5
+echo "configure:6595: checking "for statfs.f_bavail"" >&5
 if eval "test \"`echo '$''{'wine_cv_statfs_bavail'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6552,7 +6600,7 @@
         wine_cv_statfs_bavail=no
     else
     	cat > conftest.$ac_ext <<EOF
-#line 6556 "configure"
+#line 6604 "configure"
 #include "confdefs.h"
 
 	#include <sys/types.h>
@@ -6579,7 +6627,7 @@
 	
 ; return 0; }
 EOF
-if { (eval echo configure:6583: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6631: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   wine_cv_statfs_bavail=yes
 else
@@ -6604,12 +6652,12 @@
 
 
 echo $ac_n "checking "for msg_accrights in struct msghdr"""... $ac_c" 1>&6
-echo "configure:6608: checking "for msg_accrights in struct msghdr"" >&5
+echo "configure:6656: checking "for msg_accrights in struct msghdr"" >&5
 if eval "test \"`echo '$''{'ac_cv_c_msg_accrights'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6613 "configure"
+#line 6661 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -6617,7 +6665,7 @@
 struct msghdr hdr; hdr.msg_accrights=0
 ; return 0; }
 EOF
-if { (eval echo configure:6621: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6669: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_msg_accrights="yes"
 else
@@ -6640,12 +6688,12 @@
 
 
 echo $ac_n "checking "for sun_len in struct sockaddr_un"""... $ac_c" 1>&6
-echo "configure:6644: checking "for sun_len in struct sockaddr_un"" >&5
+echo "configure:6692: checking "for sun_len in struct sockaddr_un"" >&5
 if eval "test \"`echo '$''{'ac_cv_c_sun_len'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6649 "configure"
+#line 6697 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -6654,7 +6702,7 @@
 static struct sockaddr_un addr; addr.sun_len = 1
 ; return 0; }
 EOF
-if { (eval echo configure:6658: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6706: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_sun_len="yes"
 else
@@ -6677,12 +6725,12 @@
 
 
 echo $ac_n "checking "whether we need to define __i386__"""... $ac_c" 1>&6
-echo "configure:6681: checking "whether we need to define __i386__"" >&5
+echo "configure:6729: checking "whether we need to define __i386__"" >&5
 if eval "test \"`echo '$''{'ac_cv_cpp_def_i386'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6686 "configure"
+#line 6734 "configure"
 #include "confdefs.h"
 #if (defined(i386) || defined(__i386)) && !defined(__i386__)
 yes
@@ -7018,6 +7066,7 @@
 s%@XFILES@%$XFILES%g
 s%@OPENGLFILES@%$OPENGLFILES%g
 s%@OPENGL32_DLL@%$OPENGL32_DLL%g
+s%@CUPSLIBS@%$CUPSLIBS%g
 s%@DLL_LINK@%$DLL_LINK%g
 s%@DLLFLAGS@%$DLLFLAGS%g
 s%@LDSHARED@%$LDSHARED%g
diff --git a/configure.in b/configure.in
index f610c51..6a88a1a 100644
--- a/configure.in
+++ b/configure.in
@@ -368,6 +368,14 @@
     fi
 fi
 
+CUPSLIBS=""
+dnl **** Check for CUPS ****
+AC_CHECK_LIB(cups,cupsGetPPD,
+	AC_DEFINE(HAVE_CUPS)
+	CUPSLIBS="-lcups"
+)
+AC_SUBST(CUPSLIBS)
+
 dnl **** Check for IPX (currently Linux only) ****
 AC_CACHE_CHECK("for GNU style IPX support", ac_cv_c_ipx_gnu,
  AC_TRY_COMPILE(
diff --git a/dlls/commdlg/printdlg.c b/dlls/commdlg/printdlg.c
index db3c306..8ff6f01 100644
--- a/dlls/commdlg/printdlg.c
+++ b/dlls/commdlg/printdlg.c
@@ -1554,7 +1554,7 @@
  */
 BOOL WINAPI PageSetupDlgA(LPPAGESETUPDLGA setupdlg) {
 	FIXME("(%p), stub!\n",setupdlg);
-	return FALSE;
+	return TRUE;
 }
 /***********************************************************************
  *            PageSetupDlgW  (COMDLG32.16)
diff --git a/dlls/gdi/printdrv.c b/dlls/gdi/printdrv.c
index c8a33b7..db30e69 100644
--- a/dlls/gdi/printdrv.c
+++ b/dlls/gdi/printdrv.c
@@ -7,6 +7,9 @@
  * Copyright 1999 Klaas van Gend
  */
 
+#include "config.h"
+
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
@@ -453,7 +456,10 @@
     if (pszOutput == NULL || *pszOutput == '\0')
       return -1;
 
-    PROFILE_GetWineIniString( "spooler", pszOutput, "", psCmd, sizeof(psCmd) );
+    if (!strncmp("CUPS:",pszOutput,5))
+      sprintf(psCmd,"|lpr -P%s",pszOutput+5);
+    else
+      PROFILE_GetWineIniString("spooler",pszOutput,"",psCmd,sizeof(psCmd));
     TRACE("Got printerSpoolCommand '%s' for output device '%s'\n",
 	  psCmd, pszOutput);
     if (!*psCmd)
diff --git a/dlls/wineps/Makefile.in b/dlls/wineps/Makefile.in
index c73f588..6673ad6 100644
--- a/dlls/wineps/Makefile.in
+++ b/dlls/wineps/Makefile.in
@@ -6,6 +6,7 @@
 SOVERSION = 1.0
 ALTNAMES  = wineps16
 IMPORTS   = user32 gdi32 winspool.drv kernel32 ntdll
+EXTRALIBS = @CUPSLIBS@
 
 C_SRCS = \
 	afm.c \
diff --git a/dlls/wineps/init.c b/dlls/wineps/init.c
index 751b20b..f17a3bb 100644
--- a/dlls/wineps/init.c
+++ b/dlls/wineps/init.c
@@ -2,9 +2,12 @@
  *	PostScript driver initialization functions
  *
  *	Copyright 1998 Huw D M Davies
+ *	Copyright 2001 Marcus Meissner
  *
  */
+
 #include <string.h>
+#include <unistd.h>
 
 #include "gdi.h"
 #include "psdrv.h"
@@ -15,6 +18,10 @@
 #include "winerror.h"
 #include "options.h"
 
+#ifdef HAVE_CUPS
+# include <cups/cups.h>
+#endif
+
 DEFAULT_DEBUG_CHANNEL(psdrv);
 
 static BOOL PSDRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
@@ -187,7 +194,7 @@
 /* dmCopies */		1,
 /* dmDefaultSource */	DMBIN_AUTO,
 /* dmPrintQuality */	0,
-/* dmColor */		DMCOLOR_MONOCHROME,
+/* dmColor */		DMCOLOR_COLOR,
 /* dmDuplex */		0,
 /* dmYResolution */	0,
 /* dmTTOption */	DMTT_SUBDEV,
@@ -427,13 +434,13 @@
     FONTNAME *font;
     AFM *afm;
     HANDLE hPrinter;
+    const char *ppd = NULL;
 
     TRACE("'%s'\n", name);
     
-    for( ; pi; last = &pi->next, pi = pi->next) {
+    for( ; pi; last = &pi->next, pi = pi->next)
         if(!strcmp(pi->FriendlyName, name))
 	    return pi;
-    }
 
     pi = *last = HeapAlloc( PSDRV_Heap, 0, sizeof(*pi) );
     pi->FriendlyName = HEAP_strdupA( PSDRV_Heap, 0, name );
@@ -443,6 +450,7 @@
     if(res == ERROR_INVALID_PRINTER_NAME || needed != sizeof(DefaultDevmode)) {
         pi->Devmode = HeapAlloc( PSDRV_Heap, 0, sizeof(DefaultDevmode) );
 	memcpy(pi->Devmode, &DefaultDevmode, sizeof(DefaultDevmode) );
+	strcpy(pi->Devmode->dmPublic.dmDeviceName,name);
 	DrvSetPrinterData16((LPSTR)name, (LPSTR)INT_PD_DEFAULT_DEVMODE,
 		 REG_BINARY, (LPBYTE)&DefaultDevmode, sizeof(DefaultDevmode) );
 
@@ -453,34 +461,31 @@
 			  (LPBYTE)pi->Devmode, needed, &needed);
     }
 
-    if (OpenPrinterA (pi->FriendlyName, &hPrinter, NULL) == 0)
-    {
+    if (OpenPrinterA (pi->FriendlyName, &hPrinter, NULL) == 0) {
 	ERR ("OpenPrinterA failed with code %li\n", GetLastError ());
-	if (HeapFree (PSDRV_Heap, 0, pi->FriendlyName) == 0)
-	    WARN ("HeapFree failed with code %li\n", GetLastError ());
-	if (HeapFree (PSDRV_Heap, 0, pi->Devmode) == 0)
-	    WARN ("HeapFree failed with code %li\n", GetLastError ());
-	if (HeapFree (PSDRV_Heap, 0, pi) == 0)
-	    WARN ("HeapFree failed with code %li\n", GetLastError ());
-	*last = NULL;
-	return NULL;
+	goto cleanup;
     }
-
-    res = GetPrinterDataA (hPrinter, "PPD File", NULL,
-	    pi->Devmode->dmDrvPrivate.ppdFileName, 256, &needed);
-    if (res != ERROR_SUCCESS)
+    pi->Devmode->dmDrvPrivate.ppdFileName[0]='\0';
+#ifdef HAVE_CUPS
     {
+	ppd = cupsGetPPD(name);
+
+	if (ppd) {
+		strcpy(pi->Devmode->dmDrvPrivate.ppdFileName,ppd);
+		res = ERROR_SUCCESS;
+		/* we should unlink() that file later */
+	} else {
+		ERR("Did not find ppd for %s\n",name);
+	}
+    }
+#endif
+    if (!pi->Devmode->dmDrvPrivate.ppdFileName[0]) {
+        res = GetPrinterDataA (hPrinter, "PPD File", NULL,
+	    pi->Devmode->dmDrvPrivate.ppdFileName, 256, &needed);
+    }
+    if (res != ERROR_SUCCESS) {
 	ERR ("Error %li getting PPD file name for printer '%s'\n", res, name);
-	if (ClosePrinter (hPrinter) == 0)
-	    WARN ("ClosePrinter failed with code %li\n", GetLastError ());
-        if (HeapFree(PSDRV_Heap, 0, pi->FriendlyName) == 0)
-	    WARN ("HeapFree failed with code %li\n", GetLastError ());
-        if (HeapFree(PSDRV_Heap, 0, pi->Devmode) == 0)
-	    WARN ("HeapFree failed with code %li\n", GetLastError ());
-        if (HeapFree(PSDRV_Heap, 0, pi) == 0)
-	    WARN ("HeapFree failed with code %li\n", GetLastError ());
-	*last = NULL;
-	return NULL;
+	goto closeprinter;
     }
 
     res = GetPrinterDataA (hPrinter, "Paper Size", NULL, (LPBYTE) &dwPaperSize,
@@ -489,19 +494,9 @@
 	pi->Devmode->dmPublic.u1.s1.dmPaperSize = (SHORT) dwPaperSize;
     else if (res == ERROR_FILE_NOT_FOUND)
 	TRACE ("No 'Paper Size' for printer '%s'\n", name);
-    else
-    {
+    else {
 	ERR ("GetPrinterDataA returned %li\n", res);
-	if (ClosePrinter (hPrinter) == 0)
-	    WARN ("ClosePrinter failed with code %li\n", GetLastError ());
-        if (HeapFree(PSDRV_Heap, 0, pi->FriendlyName) == 0)
-	    WARN ("HeapFree failed with code %li\n", GetLastError ());
-        if (HeapFree(PSDRV_Heap, 0, pi->Devmode) == 0)
-	    WARN ("HeapFree failed with code %li\n", GetLastError ());
-        if (HeapFree(PSDRV_Heap, 0, pi) == 0)
-	    WARN ("HeapFree failed with code %li\n", GetLastError ());
-	*last = NULL;
-	return NULL;
+	goto closeprinter;
     }
 
     res = EnumPrinterDataExA (hPrinter, "PrinterDriverData\\FontSubTable", NULL,
@@ -511,83 +506,33 @@
     else if (res == ERROR_MORE_DATA)
     {
 	pi->FontSubTable = HeapAlloc (PSDRV_Heap, 0, needed);
-	if (pi->FontSubTable == NULL)
-	{
+	if (pi->FontSubTable == NULL) {
 	    ERR ("Failed to allocate %li bytes from heap\n", needed);
-	    if (ClosePrinter (hPrinter) == 0)
-		WARN ("ClosePrinter failed with code %li\n", GetLastError ());
-            if (HeapFree(PSDRV_Heap, 0, pi->FriendlyName) == 0)
-		WARN ("HeapFree failed with code %li\n", GetLastError ());
-            if (HeapFree(PSDRV_Heap, 0, pi->Devmode) == 0)
-		WARN ("HeapFree failed with code %li\n", GetLastError ());
-            if (HeapFree(PSDRV_Heap, 0, pi) == 0)
-		WARN ("HeapFree failed with code %li\n", GetLastError ());
-	    *last = NULL;
-	    return NULL;
+	    goto closeprinter;
 	}
 
 	res = EnumPrinterDataExA (hPrinter, "PrinterDriverData\\FontSubTable",
 		(LPBYTE) pi->FontSubTable, needed, &needed,
 		&pi->FontSubTableSize);
-	if (res != ERROR_SUCCESS)
-	{
+	if (res != ERROR_SUCCESS) {
 	    ERR ("EnumPrinterDataExA returned %li\n", res);
-	    if (ClosePrinter (hPrinter) == 0)
-		WARN ("ClosePrinter failed with code %li\n", GetLastError ());
-	    if (HeapFree (PSDRV_Heap, 0, pi->FontSubTable) == 0)
-		WARN ("HeapFree failed with code %li\n", GetLastError ());
-            if (HeapFree(PSDRV_Heap, 0, pi->FriendlyName) == 0)
-		WARN ("HeapFree failed with code %li\n", GetLastError ());
-            if (HeapFree(PSDRV_Heap, 0, pi->Devmode) == 0)
-		WARN ("HeapFree failed with code %li\n", GetLastError ());
-            if (HeapFree(PSDRV_Heap, 0, pi) == 0)
-		WARN ("HeapFree failed with code %li\n", GetLastError ());
-	    *last = NULL;
-	    return NULL;
+	    goto closeprinter;
 	}
-    }
-    else	/* error in 1st call to EnumPrinterDataExA */
-    {
-	ERR ("EnumPrinterDataExA returned %li\n", res);
-	if (ClosePrinter (hPrinter) == 0)
-	    WARN ("ClosePrinter failed with code %li\n", GetLastError ());
-        if (HeapFree(PSDRV_Heap, 0, pi->FriendlyName) == 0)
-	    WARN ("HeapFree failed with code %li\n", GetLastError ());
-        if (HeapFree(PSDRV_Heap, 0, pi->Devmode) == 0)
-	    WARN ("HeapFree failed with code %li\n", GetLastError ());
-        if (HeapFree(PSDRV_Heap, 0, pi) == 0)
-	    WARN ("HeapFree failed with code %li\n", GetLastError ());
-	*last = NULL;
-	return NULL;
+    } else {
+	FIXME ("EnumPrinterDataExA returned %li\n", res);
+	/* ignore error */
     }
 
-    if (ClosePrinter (hPrinter) == 0)
-    {
+    if (ClosePrinter (hPrinter) == 0) {
 	ERR ("ClosePrinter failed with code %li\n", GetLastError ());
-	if (ClosePrinter (hPrinter) == 0)
-	    WARN ("ClosePrinter failed with code %li\n", GetLastError ());
-	if (HeapFree (PSDRV_Heap, 0, pi->FontSubTable) == 0)
-	    WARN ("HeapFree failed with code %li\n", GetLastError ());
-        if (HeapFree(PSDRV_Heap, 0, pi->FriendlyName) == 0)
-	    WARN ("HeapFree failed with code %li\n", GetLastError ());
-        if (HeapFree(PSDRV_Heap, 0, pi->Devmode) == 0)
-	    WARN ("HeapFree failed with code %li\n", GetLastError ());
-        if (HeapFree(PSDRV_Heap, 0, pi) == 0)
-	    WARN ("HeapFree failed with code %li\n", GetLastError ());
-	*last = NULL;
-	return NULL;
+	goto cleanup;
     }
 
     pi->ppd = PSDRV_ParsePPD(pi->Devmode->dmDrvPrivate.ppdFileName);
     if(!pi->ppd) {
-	HeapFree(PSDRV_Heap, 0, pi->FontSubTable);
-        HeapFree(PSDRV_Heap, 0, pi->FriendlyName);
-        HeapFree(PSDRV_Heap, 0, pi->Devmode);
-        HeapFree(PSDRV_Heap, 0, pi);
-	*last = NULL;
 	MESSAGE("Couldn't find PPD file '%s', expect a crash now!\n",
 	    pi->Devmode->dmDrvPrivate.ppdFileName);
-	return NULL;
+	goto cleanup;
     }
 
     pi->next = NULL;
@@ -595,14 +540,23 @@
 
     for(font = pi->ppd->InstalledFonts; font; font = font->next) {
         afm = PSDRV_FindAFMinList(PSDRV_AFMFontList, font->Name);
-	if(!afm) {
-	    TRACE(
-	 "Couldn't find AFM file for installed printer font '%s' - ignoring\n",
-	 font->Name);
-	} else {
+	if(!afm)
+	    TRACE( "Couldn't find AFM file for installed printer font '%s' - ignoring\n", font->Name);
+	else
 	    PSDRV_AddAFMtoList(&pi->Fonts, afm);
-	}
-    }
 
+    }
+    if (ppd) unlink(ppd);
     return pi;
+
+closeprinter:
+    ClosePrinter(hPrinter);
+cleanup:
+    HeapFree (PSDRV_Heap, 0, pi->FontSubTable);
+    HeapFree(PSDRV_Heap, 0, pi->FriendlyName);
+    HeapFree(PSDRV_Heap, 0, pi->Devmode);
+    HeapFree(PSDRV_Heap, 0, pi);
+    if (ppd) unlink(ppd);
+    *last = NULL;
+    return NULL;
 }
diff --git a/dlls/winspool/Makefile.in b/dlls/winspool/Makefile.in
index 336fdb4..5eafda2 100644
--- a/dlls/winspool/Makefile.in
+++ b/dlls/winspool/Makefile.in
@@ -3,6 +3,7 @@
 SRCDIR    = @srcdir@
 VPATH     = @srcdir@
 MODULE    = winspool.drv
+EXTRALIBS = @CUPSLIBS@
 
 LDDLLFLAGS = @LDDLLFLAGS@
 SYMBOLFILE = $(MODULE).tmp.o
diff --git a/dlls/winspool/info.c b/dlls/winspool/info.c
index 73c2aa9..a0978db 100644
--- a/dlls/winspool/info.c
+++ b/dlls/winspool/info.c
@@ -5,13 +5,19 @@
  * Copyright 1998 Andreas Mohr
  * Copyright 1999 Klaas van Gend
  * Copyright 1999, 2000 Huw D M Davies
+ * Copyright 2001 Marcus Meissner
  */
 
+#include "config.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
 #include <stddef.h>
+#ifdef HAVE_CUPS
+# include <cups/cups.h>
+#endif
 #include "winspool.h"
 #include "winbase.h"
 #include "winerror.h"
@@ -69,6 +75,79 @@
 static WCHAR Share_NameW[] = {'S','h','a','r','e',' ','N','a','m','e',0};
 static WCHAR WinPrintW[] = {'W','i','n','P','r','i','n','t',0};
 
+static HKEY WINSPOOL_OpenDriverReg( LPVOID pEnvironment, BOOL unicode);
+
+#ifdef HAVE_CUPS
+void
+CUPS_LoadPrinters(void) {
+    cups_dest_t		*dests;
+    int			i,nrofdests;
+    PRINTER_INFO_2A	pinfo2a;
+    DRIVER_INFO_3A	di3a;
+    const char*		def = cupsGetDefault();
+
+    nrofdests = cupsGetDests(&dests);
+
+    di3a.cVersion = 0x400;
+    di3a.pName = "PS Driver";
+    di3a.pEnvironment = NULL;	/* NULL means auto */
+    di3a.pDriverPath = "wineps.drv";
+    di3a.pDataFile = "<datafile?>";
+    di3a.pConfigFile = "wineps.drv";
+    di3a.pHelpFile = "<helpfile?>";
+    di3a.pDependentFiles = "<dependend files?>";
+    di3a.pMonitorName = "<monitor name?>";
+    di3a.pDefaultDataType = "RAW";
+
+
+    if (!AddPrinterDriverA(NULL,3,(LPBYTE)&di3a)) {
+	ERR("Failed adding PS Driver (%ld)\n",GetLastError());
+        return;
+    }
+    for (i=0;i<nrofdests;i++) {
+	const char *ppd = cupsGetPPD(dests[i].name);
+	char	*port,*devline;
+
+	if (!ppd)
+		continue;
+	unlink(ppd);
+
+	if (!strcmp(def,dests[i].name)) {
+		char	*buf = HeapAlloc(GetProcessHeap(),0,2*strlen(dests[i].name)+strlen(",WINEPS,CUPS:")+1);
+
+		sprintf(buf,"%s,WINEPS,CUPS:%s",dests[i].name,dests[i].name);
+		WriteProfileStringA("windows","device",buf);
+		HeapFree(GetProcessHeap(),0,buf);
+	}
+	memset(&pinfo2a,0,sizeof(pinfo2a));
+	pinfo2a.pPrinterName	= dests[i].name;
+	pinfo2a.pDatatype	= "RAW";
+	pinfo2a.pPrintProcessor	= "WinPrint";
+	pinfo2a.pDriverName	= "PS Driver";
+	pinfo2a.pComment	= "WINEPS Printer using CUPS";
+	pinfo2a.pLocation	= "<physical location of printer>";
+	port = HeapAlloc(GetProcessHeap(),0,strlen("CUPS:")+strlen(dests[i].name)+1);
+	sprintf(port,"CUPS:%s",dests[i].name);
+	pinfo2a.pPortName	= port;
+	pinfo2a.pParameters	= "<parameters?>";
+	pinfo2a.pShareName	= "<share name?>";
+	pinfo2a.pSepFile	= "<sep file?>";
+
+	devline=HeapAlloc(GetProcessHeap(),0,strlen("WINEPS,")+strlen(port)+1);
+	sprintf(devline,"WINEPS,%s",port);
+	WriteProfileStringA("devices",dests[i].name,devline);
+	HeapFree(GetProcessHeap(),0,devline);
+
+	if (!AddPrinterA(NULL,2,(LPBYTE)&pinfo2a)) {
+	    if (GetLastError()!=ERROR_PRINTER_ALREADY_EXISTS)
+	        ERR("%s not added by AddPrinterA (%ld)\n",dests[i].name,GetLastError());
+	}
+	HeapFree(GetProcessHeap(),0,port);
+    }
+}
+#endif
+
+
 /******************************************************************
  *  WINSPOOL_GetOpenedPrinterEntry
  *  Get the first place empty in the opened printer table
@@ -374,7 +453,10 @@
 
     if(!pDeviceName) {
         LPCWSTR lpNameW = WINSPOOL_GetOpenedPrinter(hPrinter);
-        if(!lpNameW) return -1;
+        if(!lpNameW) {
+		ERR("no name from hPrinter?\n");
+		return -1;
+	}
 	lpName = HEAP_strdupWtoA(GetProcessHeap(),0,lpNameW);
     }
 
@@ -382,7 +464,10 @@
     {
         GDI_CallExtDeviceMode16 = (void*)GetProcAddress( GetModuleHandleA("gdi32"),
                                                          (LPCSTR)102 );
-        if (!GDI_CallExtDeviceMode16) return -1;
+        if (!GDI_CallExtDeviceMode16) {
+		ERR("No CallExtDeviceMode16?\n");
+		return -1;
+	}
     }
     ret = GDI_CallExtDeviceMode16(hWnd, pDevModeOutput, lpName, "LPT1:",
 				  pDevModeInput, NULL, fMode);
@@ -484,7 +569,7 @@
 
     if(RegOpenKeyW(hkeyPrinters, lpPrinterName, &hkeyPrinter)
        != ERROR_SUCCESS) {
-        WARN("Can't find printer %s in registry\n", debugstr_w(lpPrinterName));
+        ERR("Can't find printer %s in registry\n", debugstr_w(lpPrinterName));
 	RegCloseKey(hkeyPrinters);
         SetLastError(ERROR_INVALID_PARAMETER);
 	return FALSE;
@@ -698,12 +783,12 @@
     TRACE("(%s,%ld,%p)\n", debugstr_w(pName), Level, pPrinter);
     
     if(pName != NULL) {
-        FIXME("pName = %s - unsupported\n", debugstr_w(pName));
+        ERR("pName = %s - unsupported\n", debugstr_w(pName));
 	SetLastError(ERROR_INVALID_PARAMETER);
 	return 0;
     }
     if(Level != 2) {
-        WARN("Level = %ld\n", Level);
+        ERR("Level = %ld, unsupported!\n", Level);
 	SetLastError(ERROR_INVALID_LEVEL);
 	return 0;
     }
@@ -741,7 +826,7 @@
     RegCloseKey(hkeyDrivers);
 
     if(lstrcmpiW(pi->pPrintProcessor, WinPrintW)) {  /* FIXME */
-        WARN("Can't find processor %s\n", debugstr_w(pi->pPrintProcessor));
+        FIXME("Can't find processor %s\n", debugstr_w(pi->pPrintProcessor));
 	SetLastError(ERROR_UNKNOWN_PRINTPROCESSOR);
 	RegCloseKey(hkeyPrinters);
 	return 0;
@@ -751,20 +836,20 @@
      */
     size = DocumentPropertiesW(0, -1, pi->pPrinterName, NULL, NULL, 0);
     if(size < 0) {
-        WARN("DocumentProperties fails\n");
-	SetLastError(ERROR_UNKNOWN_PRINTER_DRIVER);
-	return 0;
+        FIXME("DocumentProperties fails\n");
+	size = sizeof(DEVMODEW);
     }
     if(pi->pDevMode) {
         dmW = pi->pDevMode;
     } else {
 	dmW = HeapAlloc(GetProcessHeap(), 0, size);
+	dmW->dmSize = size;
 	DocumentPropertiesW(0, -1, pi->pPrinterName, dmW, NULL, DM_OUT_BUFFER);
     }
 
     if(RegCreateKeyW(hkeyPrinters, pi->pPrinterName, &hkeyPrinter) !=
        ERROR_SUCCESS) {
-        WARN("Can't create printer %s\n", debugstr_w(pi->pPrinterName));
+        FIXME("Can't create printer %s\n", debugstr_w(pi->pPrinterName));
 	SetLastError(ERROR_INVALID_PRINTER_NAME);
 	RegCloseKey(hkeyPrinters);
 	if(!pi->pDevMode)
@@ -775,7 +860,6 @@
 		   (LPBYTE)&pi->Attributes, sizeof(DWORD));
     RegSetValueExW(hkeyPrinter, DatatypeW, 0, REG_SZ, (LPBYTE)pi->pDatatype,
 		   0);
-
     /* Write DEVMODEA not DEVMODEW into reg.  This is what win9x does
        and we support these drivers.  NT writes DEVMODEW so somehow
        we'll need to distinguish between these when we support NT
@@ -832,7 +916,7 @@
 
     TRACE("(%s,%ld,%p): stub\n", debugstr_a(pName), Level, pPrinter);
     if(Level != 2) {
-        WARN("Level = %ld\n", Level);
+        ERR("Level = %ld, unsupported!\n", Level);
 	SetLastError(ERROR_INVALID_LEVEL);
 	return 0;
     }
@@ -1080,7 +1164,7 @@
     if ((ret != ERROR_SUCCESS && ret != ERROR_MORE_DATA)) sz = 0;
     if (sz < sizeof(DEVMODEA))
     {
-        ERR("corrupted registry for %s\n", debugstr_w(ValueName));
+        ERR("corrupted registry for %s ( size %ld)\n",debugstr_w(ValueName),sz);
         sz = sizeof(DEVMODEA);
     }
     /* ensures that dmSize is not erratically bogus if registry is invalid */
diff --git a/dlls/winspool/wspool.c b/dlls/winspool/wspool.c
index 93b5b4f..992c474 100644
--- a/dlls/winspool/wspool.c
+++ b/dlls/winspool/wspool.c
@@ -5,6 +5,9 @@
  * Copyright 1999 Thuy Nguyen
  */
 
+
+#include "config.h"
+#include "winspool.h"
 #include "debugtools.h"
 
 DEFAULT_DEBUG_CHANNEL(winspool);
@@ -22,14 +25,16 @@
 {
   switch (reason)
   {
-    case DLL_PROCESS_ATTACH:
+    case DLL_PROCESS_ATTACH: {
+#ifdef HAVE_CUPS
+      extern void CUPS_LoadPrinters();
+      CUPS_LoadPrinters();
+#endif
       break;
-
+    }
     case DLL_PROCESS_DETACH:
       break;
   }
 
   return TRUE;
 }
-
-
diff --git a/include/acconfig.h b/include/acconfig.h
index 0ca86fb..1d4ae87 100644
--- a/include/acconfig.h
+++ b/include/acconfig.h
@@ -119,3 +119,6 @@
 
 /* Define if we have linux/input.h AND it contains the INPUT event API */
 #undef HAVE_CORRECT_LINUXINPUT_H
+
+/* Define if we have CUPS */
+#undef HAVE_CUPS
diff --git a/include/config.h.in b/include/config.h.in
index e5f91b8..44d6db2 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -151,6 +151,9 @@
 /* Define if we have linux/input.h AND it contains the INPUT event API */
 #undef HAVE_CORRECT_LINUXINPUT_H
 
+/* Define if we have CUPS */
+#undef HAVE_CUPS
+
 /* The number of bytes in a long long.  */
 #undef SIZEOF_LONG_LONG