diff --git a/configure b/configure index 3455085211f..2222de97780 100755 --- a/configure +++ b/configure @@ -4565,13 +4565,61 @@ fi 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 <&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 < #include @@ -4579,7 +4627,7 @@ int main() { ((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 @@ fi 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 < #include @@ -4618,7 +4666,7 @@ int main() { ((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 @@ for ac_hdr in sys/soundcard.h machine/soundcard.h soundcard.h 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 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 @@ done 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 <&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 @@ EOF 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 <&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 @@ if test "x${GCC}" = "xyes" 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 @@ else ac_cv_c_gcc_strength_bug="yes" else cat > conftest.$ac_ext <&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 @@ echo "$ac_t""$ac_cv_c_gcc_strength_bug" 1>&6 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 <&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 @@ fi 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 @@ _ac_test: .long 0 EOF cat > conftest.$ac_ext <&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 @@ fi 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 @@ _ac_test: .long 0 EOF cat > conftest.$ac_ext <&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 @@ fi 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 @@ cat > conftest_asm.s < conftest.$ac_ext <&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 @@ LDDLLFLAGS="" 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 <&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 @@ echo "$ac_t""$ac_cv_c_dll_linux" 1>&6 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 <&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 @@ echo "$ac_t""$ac_cv_c_dll_unixware" 1>&6 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 <&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 @@ elif test "$LIBEXT" = "dll"; then 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 <&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 @@ echo "$ac_t""$ac_cv_c_whole_archive" 1>&6 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 <&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 @@ fi 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 @@ else wine_cv_libc_r___errno_location=yes else cat > conftest.$ac_ext <&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 @@ fi 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 @@ else wine_cv_libc_r___error=yes else cat > conftest.$ac_ext <&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 @@ fi 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 @@ else wine_cv_libc_r____errno=yes else cat > conftest.$ac_ext <&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 @@ fi 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 @@ else wine_cv_libc_r___thr_errno=yes else cat > conftest.$ac_ext <&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 @@ fi 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 @@ fi # 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 < 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 @@ EOF 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 <&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 @@ EOF 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 <&6 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 <&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 @@ done 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 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <&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 @@ for ac_func in \ 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 <&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 @@ for ac_hdr in \ 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 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 @@ fi 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 < #include @@ -5908,12 +5956,12 @@ fi 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 <&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 @@ EOF 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 <&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 @@ EOF 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 < #include @@ -6036,7 +6084,7 @@ else #include 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 @@ rm -f conftest* 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 @@ -6071,7 +6119,7 @@ fi 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 @@ -6092,7 +6140,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -6103,7 +6151,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); 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 @@ EOF 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 < #if STDC_HEADERS @@ -6160,7 +6208,7 @@ EOF 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 @@ else ac_cv_sizeof_long_long=0 else cat > conftest.$ac_ext < main() @@ -6179,7 +6227,7 @@ main() 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 @@ EOF 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 < @@ -6218,7 +6266,7 @@ int main() { ; 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 @@ EOF 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 < @@ -6268,7 +6316,7 @@ int main() { ; 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 @@ EOF 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 < @@ -6314,7 +6362,7 @@ int main() { /*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 @@ fi 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 < @@ -6363,7 +6411,7 @@ int main() { ; 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 @@ fi 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 < @@ -6410,7 +6458,7 @@ int main() { ; 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 @@ fi 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 < @@ -6457,7 +6505,7 @@ int main() { ; 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 @@ fi 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 @@ else wine_cv_statfs_bfree=no else cat > conftest.$ac_ext < @@ -6519,7 +6567,7 @@ int main() { ; 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 @@ EOF 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 @@ else wine_cv_statfs_bavail=no else cat > conftest.$ac_ext < @@ -6579,7 +6627,7 @@ int main() { ; 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 @@ fi 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 < #include @@ -6617,7 +6665,7 @@ int main() { 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 @@ fi 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 < #include @@ -6654,7 +6702,7 @@ int main() { 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 @@ fi 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 < #include #include #include @@ -453,7 +456,10 @@ static int CreateSpoolFile(LPCSTR pszOutput) 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 c73f58877f0..6673ad6b433 100644 --- a/dlls/wineps/Makefile.in +++ b/dlls/wineps/Makefile.in @@ -6,6 +6,7 @@ MODULE = wineps 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 751b20b29bc..f17a3bb5008 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 +#include #include "gdi.h" #include "psdrv.h" @@ -15,6 +18,10 @@ #include "winerror.h" #include "options.h" +#ifdef HAVE_CUPS +# include +#endif + DEFAULT_DEBUG_CHANNEL(psdrv); static BOOL PSDRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, @@ -187,7 +194,7 @@ static PSDRV_DEVMODEA DefaultDevmode = /* dmCopies */ 1, /* dmDefaultSource */ DMBIN_AUTO, /* dmPrintQuality */ 0, -/* dmColor */ DMCOLOR_MONOCHROME, +/* dmColor */ DMCOLOR_COLOR, /* dmDuplex */ 0, /* dmYResolution */ 0, /* dmTTOption */ DMTT_SUBDEV, @@ -427,13 +434,13 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name) 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 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name) 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 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name) (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 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name) 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 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name) 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 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name) 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 336fdb4baf4..5eafda264e1 100644 --- a/dlls/winspool/Makefile.in +++ b/dlls/winspool/Makefile.in @@ -3,6 +3,7 @@ TOPOBJDIR = ../.. 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 73c2aa9a0f0..a0978dbe451 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 #include #include #include #include +#ifdef HAVE_CUPS +# include +#endif #include "winspool.h" #include "winbase.h" #include "winerror.h" @@ -69,6 +75,79 @@ static WCHAR Separator_FileW[] = {'S','e','p','a','r','a','t','o','r',' ','F', 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 = ""; + di3a.pConfigFile = "wineps.drv"; + di3a.pHelpFile = ""; + di3a.pDependentFiles = ""; + di3a.pMonitorName = ""; + di3a.pDefaultDataType = "RAW"; + + + if (!AddPrinterDriverA(NULL,3,(LPBYTE)&di3a)) { + ERR("Failed adding PS Driver (%ld)\n",GetLastError()); + return; + } + for (i=0;ipPrintProcessor, 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 @@ HANDLE WINAPI AddPrinterW(LPWSTR pName, DWORD Level, LPBYTE pPrinter) */ 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 @@ HANDLE WINAPI AddPrinterW(LPWSTR pName, DWORD Level, LPBYTE pPrinter) (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 @@ HANDLE WINAPI AddPrinterA(LPSTR pName, DWORD Level, LPBYTE pPrinter) 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 @@ static BOOL WINSPOOL_GetDevModeFromReg(HKEY hkey, LPCWSTR ValueName, 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 93b5b4f1345..992c474afd1 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 @@ BOOL WINAPI WINSPOOL_EntryPoint(HINSTANCE hInstance, { 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 0ca86fb9124..1d4ae87728e 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 e5f91b84d02..44d6db260a8 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