Do not link against -lcups directly, but dynamically load it if
present (just like freetype etc.)
This commit is contained in:
parent
bd4a385c7e
commit
f061f76704
|
@ -305,7 +305,7 @@ ac_includes_default="\
|
|||
# include <unistd.h>
|
||||
#endif"
|
||||
|
||||
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS LIBEXT OPTIONS WIN16_FILES WIN16_INSTALL build build_cpu build_vendor build_os host host_cpu host_vendor host_os SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP TOOLSDIR X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS YACC LEX LEXLIB LEX_OUTPUT_ROOT XYACC XLEX LD ac_ct_LD AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP WINDRES ac_ct_WINDRES INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S LN C2MAN LDCONFIG LINT LINTFLAGS JPEGLIB EGREP XLIB XFILES OPENGLFILES GLU32FILES NASLIBS CURSESLIBS CUPSLIBS sane_devel SANELIBS SANEINCL ft_devel ft_devel2 FREETYPEINCL ARTSCCONFIG ARTSLIBS ARTSINCL ALSALIBS AUDIOIOLIBS DLLEXT DLLFLAGS DLLIBS LDDLLFLAGS LDSHARED DLLWRAP ac_ct_DLLWRAP CROSSTEST CROSSCC DLLTOOL LDPATH CRTLIBS LDD ALLOCA LIBOBJS LTLIBOBJS'
|
||||
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS LIBEXT OPTIONS WIN16_FILES WIN16_INSTALL build build_cpu build_vendor build_os host host_cpu host_vendor host_os SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP TOOLSDIR X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS YACC LEX LEXLIB LEX_OUTPUT_ROOT XYACC XLEX LD ac_ct_LD AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP WINDRES ac_ct_WINDRES INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S LN C2MAN LDCONFIG LINT LINTFLAGS JPEGLIB EGREP XLIB XFILES OPENGLFILES GLU32FILES NASLIBS CURSESLIBS sane_devel SANELIBS SANEINCL ft_devel ft_devel2 FREETYPEINCL ARTSCCONFIG ARTSLIBS ARTSINCL ALSALIBS AUDIOIOLIBS DLLEXT DLLFLAGS DLLIBS LDDLLFLAGS LDSHARED DLLWRAP ac_ct_DLLWRAP CROSSTEST CROSSCC DLLTOOL LDPATH CRTLIBS LDD ALLOCA LIBOBJS LTLIBOBJS'
|
||||
ac_subst_files='MAKE_RULES MAKE_DLL_RULES MAKE_TEST_RULES MAKE_PROG_RULES'
|
||||
|
||||
# Initialize some variables set by options.
|
||||
|
@ -7855,176 +7855,6 @@ done
|
|||
fi
|
||||
|
||||
|
||||
CUPSLIBS=""
|
||||
wine_cv_warn_cups_h=no
|
||||
echo "$as_me:$LINENO: checking for cupsGetPPD in -lcups" >&5
|
||||
echo $ECHO_N "checking for cupsGetPPD in -lcups... $ECHO_C" >&6
|
||||
if test "${ac_cv_lib_cups_cupsGetPPD+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lcups $LIBS"
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#line $LINENO "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
/* 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;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
(eval $ac_link) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -s conftest$ac_exeext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_cv_lib_cups_cupsGetPPD=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
ac_cv_lib_cups_cupsGetPPD=no
|
||||
fi
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $ac_cv_lib_cups_cupsGetPPD" >&5
|
||||
echo "${ECHO_T}$ac_cv_lib_cups_cupsGetPPD" >&6
|
||||
if test $ac_cv_lib_cups_cupsGetPPD = yes; then
|
||||
if test "${ac_cv_header_cups_cups_h+set}" = set; then
|
||||
echo "$as_me:$LINENO: checking for cups/cups.h" >&5
|
||||
echo $ECHO_N "checking for cups/cups.h... $ECHO_C" >&6
|
||||
if test "${ac_cv_header_cups_cups_h+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $ac_cv_header_cups_cups_h" >&5
|
||||
echo "${ECHO_T}$ac_cv_header_cups_cups_h" >&6
|
||||
else
|
||||
# Is the header compilable?
|
||||
echo "$as_me:$LINENO: checking cups/cups.h usability" >&5
|
||||
echo $ECHO_N "checking cups/cups.h usability... $ECHO_C" >&6
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#line $LINENO "configure"
|
||||
#include "confdefs.h"
|
||||
$ac_includes_default
|
||||
#include <cups/cups.h>
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
(eval $ac_compile) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -s conftest.$ac_objext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_header_compiler=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
ac_header_compiler=no
|
||||
fi
|
||||
rm -f conftest.$ac_objext conftest.$ac_ext
|
||||
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
|
||||
echo "${ECHO_T}$ac_header_compiler" >&6
|
||||
|
||||
# Is the header present?
|
||||
echo "$as_me:$LINENO: checking cups/cups.h presence" >&5
|
||||
echo $ECHO_N "checking cups/cups.h presence... $ECHO_C" >&6
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#line $LINENO "configure"
|
||||
#include "confdefs.h"
|
||||
#include <cups/cups.h>
|
||||
_ACEOF
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
|
||||
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } >/dev/null; then
|
||||
if test -s conftest.err; then
|
||||
ac_cpp_err=$ac_c_preproc_warn_flag
|
||||
else
|
||||
ac_cpp_err=
|
||||
fi
|
||||
else
|
||||
ac_cpp_err=yes
|
||||
fi
|
||||
if test -z "$ac_cpp_err"; then
|
||||
ac_header_preproc=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
ac_header_preproc=no
|
||||
fi
|
||||
rm -f conftest.err conftest.$ac_ext
|
||||
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
|
||||
echo "${ECHO_T}$ac_header_preproc" >&6
|
||||
|
||||
# So? What about this header?
|
||||
case $ac_header_compiler:$ac_header_preproc in
|
||||
yes:no )
|
||||
{ echo "$as_me:$LINENO: WARNING: cups/cups.h: accepted by the compiler, rejected by the preprocessor!" >&5
|
||||
echo "$as_me: WARNING: cups/cups.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: cups/cups.h: proceeding with the preprocessor's result" >&5
|
||||
echo "$as_me: WARNING: cups/cups.h: proceeding with the preprocessor's result" >&2;};;
|
||||
no:yes )
|
||||
{ echo "$as_me:$LINENO: WARNING: cups/cups.h: present but cannot be compiled" >&5
|
||||
echo "$as_me: WARNING: cups/cups.h: present but cannot be compiled" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: cups/cups.h: check for missing prerequisite headers?" >&5
|
||||
echo "$as_me: WARNING: cups/cups.h: check for missing prerequisite headers?" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: cups/cups.h: proceeding with the preprocessor's result" >&5
|
||||
echo "$as_me: WARNING: cups/cups.h: proceeding with the preprocessor's result" >&2;};;
|
||||
esac
|
||||
echo "$as_me:$LINENO: checking for cups/cups.h" >&5
|
||||
echo $ECHO_N "checking for cups/cups.h... $ECHO_C" >&6
|
||||
if test "${ac_cv_header_cups_cups_h+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_cv_header_cups_cups_h=$ac_header_preproc
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $ac_cv_header_cups_cups_h" >&5
|
||||
echo "${ECHO_T}$ac_cv_header_cups_cups_h" >&6
|
||||
|
||||
fi
|
||||
if test $ac_cv_header_cups_cups_h = yes; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define HAVE_CUPS 1
|
||||
_ACEOF
|
||||
|
||||
CUPSLIBS="-lcups"
|
||||
else
|
||||
wine_cv_warn_cups_h=yes
|
||||
fi
|
||||
|
||||
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# Extract the first word of "sane-config", so it can be a program name with args.
|
||||
set dummy sane-config; ac_word=$2
|
||||
echo "$as_me:$LINENO: checking for $ac_word" >&5
|
||||
|
@ -10858,6 +10688,66 @@ cat >>confdefs.h <<_ACEOF
|
|||
#define SONAME_LIBFREETYPE "$ac_cv_lib_soname_freetype"
|
||||
_ACEOF
|
||||
fi
|
||||
|
||||
echo "$as_me:$LINENO: checking for -lcups soname" >&5
|
||||
echo $ECHO_N "checking for -lcups soname... $ECHO_C" >&6
|
||||
if test "${ac_cv_lib_soname_cups+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_get_soname_save_LIBS=$LIBS
|
||||
LIBS="-lcups $LIBS"
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#line $LINENO "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
builtin and then its argument prototype would still apply. */
|
||||
char cupsGetDefault ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
cupsGetDefault ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
(eval $ac_link) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -s conftest$ac_exeext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_cv_lib_soname_cups=`$ac_cv_path_LDD conftest$ac_exeext | grep libcups\\.so | sed 's/^[ ]*\([^ ]*\)[ ]*=>.*$/\1/'`
|
||||
if test "x$ac_cv_lib_soname_cups" = "x"
|
||||
then
|
||||
ac_cv_lib_soname_cups="libcups.so"
|
||||
fi
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
ac_cv_lib_soname_cups="libcups.so"
|
||||
fi
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_get_soname_save_LIBS
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $ac_cv_lib_soname_cups" >&5
|
||||
echo "${ECHO_T}$ac_cv_lib_soname_cups" >&6
|
||||
if test "x$ac_cv_lib_soname_cups" != xNONE
|
||||
then
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define SONAME_LIBCUPS "$ac_cv_lib_soname_cups"
|
||||
_ACEOF
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
@ -11649,11 +11539,13 @@ done
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
for ac_header in \
|
||||
arpa/inet.h \
|
||||
arpa/nameser.h \
|
||||
cups/cups.h \
|
||||
direct.h \
|
||||
elf.h \
|
||||
float.h \
|
||||
|
@ -14496,7 +14388,6 @@ s,@OPENGLFILES@,$OPENGLFILES,;t t
|
|||
s,@GLU32FILES@,$GLU32FILES,;t t
|
||||
s,@NASLIBS@,$NASLIBS,;t t
|
||||
s,@CURSESLIBS@,$CURSESLIBS,;t t
|
||||
s,@CUPSLIBS@,$CUPSLIBS,;t t
|
||||
s,@sane_devel@,$sane_devel,;t t
|
||||
s,@SANELIBS@,$SANELIBS,;t t
|
||||
s,@SANEINCL@,$SANEINCL,;t t
|
||||
|
@ -15169,14 +15060,6 @@ then
|
|||
echo "*** support before reporting bugs."
|
||||
fi
|
||||
|
||||
if test "$wine_cv_warn_cups_h" = "yes"
|
||||
then
|
||||
echo
|
||||
echo "*** Note: You have cups runtime libraries, but no development"
|
||||
echo "*** libraries. Install the cups-devel package or whichever package"
|
||||
echo "*** contains cups.h to enable CUPS support in Wine."
|
||||
fi
|
||||
|
||||
if test "$wine_cv_msg_freetype" = "yes"
|
||||
then
|
||||
echo
|
||||
|
|
21
configure.ac
21
configure.ac
|
@ -362,17 +362,6 @@ then
|
|||
fi
|
||||
AC_SUBST(CURSESLIBS)
|
||||
|
||||
CUPSLIBS=""
|
||||
dnl **** Check for CUPS ****
|
||||
wine_cv_warn_cups_h=no
|
||||
AC_CHECK_LIB(cups,cupsGetPPD,
|
||||
[AC_CHECK_HEADER(cups/cups.h,
|
||||
[AC_DEFINE(HAVE_CUPS, 1, [Define if we have CUPS])
|
||||
CUPSLIBS="-lcups"],
|
||||
wine_cv_warn_cups_h=yes)]
|
||||
)
|
||||
AC_SUBST(CUPSLIBS)
|
||||
|
||||
dnl **** Check for SANE ****
|
||||
AC_CHECK_PROG(sane_devel,sane-config,sane-config,no)
|
||||
if test "$sane_devel" = "no"
|
||||
|
@ -856,6 +845,7 @@ then
|
|||
WINE_GET_SONAME(Xext,XextCreateExtension,[$X_LIBS -lX11 $X_EXTRA_LIBS])
|
||||
WINE_GET_SONAME(Xrender,XRenderQueryExtension,[$X_LIBS -lXext -lX11 $X_EXTRA_LIBS])
|
||||
WINE_GET_SONAME(freetype,FT_Init_FreeType,[$X_LIBS])
|
||||
WINE_GET_SONAME(cups,cupsGetDefault)
|
||||
fi
|
||||
|
||||
|
||||
|
@ -969,6 +959,7 @@ dnl **** Check for header files ****
|
|||
AC_CHECK_HEADERS(\
|
||||
arpa/inet.h \
|
||||
arpa/nameser.h \
|
||||
cups/cups.h \
|
||||
direct.h \
|
||||
elf.h \
|
||||
float.h \
|
||||
|
@ -1597,14 +1588,6 @@ then
|
|||
echo "*** support before reporting bugs."
|
||||
fi
|
||||
|
||||
if test "$wine_cv_warn_cups_h" = "yes"
|
||||
then
|
||||
echo
|
||||
echo "*** Note: You have cups runtime libraries, but no development"
|
||||
echo "*** libraries. Install the cups-devel package or whichever package"
|
||||
echo "*** contains cups.h to enable CUPS support in Wine."
|
||||
fi
|
||||
|
||||
if test "$wine_cv_msg_freetype" = "yes"
|
||||
then
|
||||
echo
|
||||
|
|
|
@ -5,7 +5,6 @@ VPATH = @srcdir@
|
|||
MODULE = wineps.dll
|
||||
IMPORTS = user32 gdi32 winspool.drv advapi32 kernel32
|
||||
ALTNAMES = wineps16.dll
|
||||
EXTRALIBS = @CUPSLIBS@
|
||||
EXTRAINCL = @FREETYPEINCL@
|
||||
|
||||
LDDLLFLAGS = @LDDLLFLAGS@
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#include <string.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
|
@ -33,11 +34,17 @@
|
|||
#include "winspool.h"
|
||||
#include "winerror.h"
|
||||
|
||||
#ifdef HAVE_CUPS
|
||||
# include <cups/cups.h>
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
|
||||
|
||||
#ifdef HAVE_CUPS_CUPS_H
|
||||
#include <cups/cups.h>
|
||||
|
||||
#ifndef CUPS_SONAME
|
||||
#define CUPS_SONAME "libcups.so"
|
||||
#endif
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
|
||||
static void *cupshandle = NULL;
|
||||
#endif
|
||||
|
||||
static PSDRV_DEVMODEA DefaultDevmode =
|
||||
{
|
||||
|
@ -127,12 +134,25 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
|
|||
HeapDestroy(PSDRV_Heap);
|
||||
return FALSE;
|
||||
}
|
||||
#ifdef HAVE_CUPS_CUPS_H
|
||||
/* dynamically load CUPS if not yet loaded */
|
||||
if (!cupshandle) {
|
||||
cupshandle = wine_dlopen(CUPS_SONAME, RTLD_NOW, NULL, 0);
|
||||
if (!cupshandle) cupshandle = (void*)-1;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
|
||||
DeleteObject( PSDRV_DefaultFont );
|
||||
HeapDestroy( PSDRV_Heap );
|
||||
#ifdef HAVE_CUPS_CUPS_H
|
||||
if (cupshandle && (cupshandle != (void*)-1)) {
|
||||
wine_dlclose(cupshandle, NULL, 0);
|
||||
cupshandle = NULL;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -491,24 +511,28 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name)
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
#ifdef HAVE_CUPS
|
||||
{
|
||||
ppd = cupsGetPPD(name);
|
||||
#ifdef HAVE_CUPS_CUPS_H
|
||||
if (cupshandle != (void*)-1) {
|
||||
typeof(cupsGetPPD) * pcupsGetPPD = NULL;
|
||||
|
||||
if (ppd) {
|
||||
needed=strlen(ppd)+1;
|
||||
ppdFileName=HeapAlloc(PSDRV_Heap, 0, needed);
|
||||
memcpy(ppdFileName, ppd, needed);
|
||||
ppdType=REG_SZ;
|
||||
res = ERROR_SUCCESS;
|
||||
/* we should unlink() that file later */
|
||||
} else {
|
||||
res = ERROR_FILE_NOT_FOUND;
|
||||
WARN("Did not find ppd for %s\n",name);
|
||||
pcupsGetPPD = wine_dlsym(cupshandle, "cupsGetPPD", NULL, 0);
|
||||
if (pcupsGetPPD) {
|
||||
ppd = pcupsGetPPD(name);
|
||||
|
||||
if (ppd) {
|
||||
needed=strlen(ppd)+1;
|
||||
ppdFileName=HeapAlloc(PSDRV_Heap, 0, needed);
|
||||
memcpy(ppdFileName, ppd, needed);
|
||||
ppdType=REG_SZ;
|
||||
res = ERROR_SUCCESS;
|
||||
/* we should unlink() that file later */
|
||||
} else {
|
||||
res = ERROR_FILE_NOT_FOUND;
|
||||
WARN("Did not find ppd for %s\n",name);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!ppdFileName) {
|
||||
res = GetPrinterDataA(hPrinter, "PPD File", NULL, NULL, 0, &needed);
|
||||
if ((res==ERROR_SUCCESS) || (res==ERROR_MORE_DATA)) {
|
||||
|
|
|
@ -5,7 +5,6 @@ SRCDIR = @srcdir@
|
|||
VPATH = @srcdir@
|
||||
MODULE = winspool.drv
|
||||
IMPORTS = advapi32 kernel32
|
||||
EXTRALIBS = @CUPSLIBS@
|
||||
|
||||
LDDLLFLAGS = @LDDLLFLAGS@
|
||||
SYMBOLFILE = $(MODULE).tmp.o
|
||||
|
|
|
@ -23,14 +23,19 @@
|
|||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
#include "wine/library.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stddef.h>
|
||||
#ifdef HAVE_CUPS
|
||||
#ifdef HAVE_CUPS_CUPS_H
|
||||
# include <cups/cups.h>
|
||||
# ifndef CUPS_SONAME
|
||||
# define CUPS_SONAME "libcups.so"
|
||||
# endif
|
||||
#endif
|
||||
#include "winspool.h"
|
||||
#include "winbase.h"
|
||||
|
@ -115,21 +120,39 @@ WINSPOOL_SetDefaultPrinter(const char *devname, const char *name,BOOL force) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_CUPS
|
||||
#ifdef HAVE_CUPS_CUPS_H
|
||||
BOOL
|
||||
CUPS_LoadPrinters(void) {
|
||||
typeof(cupsGetPrinters) *pcupsGetPrinters = NULL;
|
||||
typeof(cupsGetDefault) *pcupsGetDefault = NULL;
|
||||
typeof(cupsGetPPD) *pcupsGetPPD = NULL;
|
||||
char **printers;
|
||||
int i,nrofdests,hadprinter = FALSE;
|
||||
PRINTER_INFO_2A pinfo2a;
|
||||
const char* def = cupsGetDefault();
|
||||
const char* def;
|
||||
void *cupshandle = NULL;
|
||||
|
||||
nrofdests = cupsGetPrinters(&printers);
|
||||
cupshandle = wine_dlopen(CUPS_SONAME, RTLD_NOW, NULL, 0);
|
||||
if (!cupshandle)
|
||||
return FALSE;
|
||||
|
||||
#define DYNCUPS(x) \
|
||||
p##x = wine_dlsym(cupshandle, #x, NULL,0); \
|
||||
if (!p##x) return FALSE;
|
||||
|
||||
DYNCUPS(cupsGetDefault);
|
||||
DYNCUPS(cupsGetPPD);
|
||||
DYNCUPS(cupsGetPrinters);
|
||||
#undef DYNCUPS
|
||||
|
||||
def = pcupsGetDefault();
|
||||
|
||||
if (def && !strcmp(def,"none")) /* CUPS has "none" for no default printer */
|
||||
def = NULL;
|
||||
|
||||
nrofdests = pcupsGetPrinters(&printers);
|
||||
for (i=0;i<nrofdests;i++) {
|
||||
const char *ppd = cupsGetPPD(printers[i]);
|
||||
const char *ppd = pcupsGetPPD(printers[i]);
|
||||
char *port,*devline;
|
||||
|
||||
if (!ppd) {
|
||||
|
@ -180,6 +203,7 @@ CUPS_LoadPrinters(void) {
|
|||
}
|
||||
HeapFree(GetProcessHeap(),0,port);
|
||||
}
|
||||
wine_dlclose(cupshandle, NULL, 0);
|
||||
return hadprinter;
|
||||
}
|
||||
#endif
|
||||
|
@ -341,7 +365,7 @@ WINSPOOL_LoadSystemPrinters() {
|
|||
ERR("Failed adding PS Driver (%ld)\n",GetLastError());
|
||||
return;
|
||||
}
|
||||
#ifdef HAVE_CUPS
|
||||
#ifdef HAVE_CUPS_CUPS_H
|
||||
/* If we have any CUPS based printers, skip looking for printcap printers */
|
||||
if (CUPS_LoadPrinters())
|
||||
return;
|
||||
|
@ -1827,7 +1851,7 @@ static BOOL WINSPOOL_GetPrinter(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter,
|
|||
RegCloseKey(hkeyPrinter);
|
||||
RegCloseKey(hkeyPrinters);
|
||||
|
||||
TRACE("returing %d needed = %ld\n", ret, needed);
|
||||
TRACE("returning %d needed = %ld\n", ret, needed);
|
||||
if(pcbNeeded) *pcbNeeded = needed;
|
||||
if(!ret)
|
||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||
|
@ -2544,10 +2568,12 @@ BOOL WINAPI EnumJobsA(HANDLE hPrinter, DWORD FirstJob, DWORD NoJobs,
|
|||
DWORD Level, LPBYTE pJob, DWORD cbBuf, LPDWORD pcbNeeded,
|
||||
LPDWORD pcReturned)
|
||||
{
|
||||
FIXME("stub\n");
|
||||
FIXME("(%p,first=%ld,no=%ld,level=%ld,job=%p,cb=%ld,%p,%p), stub!\n",
|
||||
hPrinter, FirstJob, NoJobs, Level, pJob, cbBuf, pcbNeeded, pcReturned
|
||||
);
|
||||
if(pcbNeeded) *pcbNeeded = 0;
|
||||
if(pcReturned) *pcReturned = 0;
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2559,10 +2585,12 @@ BOOL WINAPI EnumJobsW(HANDLE hPrinter, DWORD FirstJob, DWORD NoJobs,
|
|||
DWORD Level, LPBYTE pJob, DWORD cbBuf, LPDWORD pcbNeeded,
|
||||
LPDWORD pcReturned)
|
||||
{
|
||||
FIXME("stub\n");
|
||||
FIXME("(%p,first=%ld,no=%ld,level=%ld,job=%p,cb=%ld,%p,%p), stub!\n",
|
||||
hPrinter, FirstJob, NoJobs, Level, pJob, cbBuf, pcbNeeded, pcReturned
|
||||
);
|
||||
if(pcbNeeded) *pcbNeeded = 0;
|
||||
if(pcReturned) *pcReturned = 0;
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
|
|
@ -56,8 +56,8 @@
|
|||
/* 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
|
||||
/* Define to 1 if you have the <cups/cups.h> header file. */
|
||||
#undef HAVE_CUPS_CUPS_H
|
||||
|
||||
/* Define to 1 if you have the <curses.h> header file. */
|
||||
#undef HAVE_CURSES_H
|
||||
|
@ -686,6 +686,9 @@
|
|||
/* The size of a `long long', as computed by sizeof. */
|
||||
#undef SIZEOF_LONG_LONG
|
||||
|
||||
/* Define to the soname of the libcups library. */
|
||||
#undef SONAME_LIBCUPS
|
||||
|
||||
/* Define to the soname of the libfreetype library. */
|
||||
#undef SONAME_LIBFREETYPE
|
||||
|
||||
|
|
Loading…
Reference in New Issue