Do not link against -lcups directly, but dynamically load it if

present (just like freetype etc.)
This commit is contained in:
Marcus Meissner 2002-11-12 02:22:24 +00:00 committed by Alexandre Julliard
parent bd4a385c7e
commit f061f76704
7 changed files with 150 additions and 231 deletions

243
configure vendored
View File

@ -305,7 +305,7 @@ ac_includes_default="\
# include <unistd.h> # include <unistd.h>
#endif" #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' ac_subst_files='MAKE_RULES MAKE_DLL_RULES MAKE_TEST_RULES MAKE_PROG_RULES'
# Initialize some variables set by options. # Initialize some variables set by options.
@ -7855,176 +7855,6 @@ done
fi 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. # Extract the first word of "sane-config", so it can be a program name with args.
set dummy sane-config; ac_word=$2 set dummy sane-config; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5 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" #define SONAME_LIBFREETYPE "$ac_cv_lib_soname_freetype"
_ACEOF _ACEOF
fi 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 fi
@ -11649,11 +11539,13 @@ done
for ac_header in \ for ac_header in \
arpa/inet.h \ arpa/inet.h \
arpa/nameser.h \ arpa/nameser.h \
cups/cups.h \
direct.h \ direct.h \
elf.h \ elf.h \
float.h \ float.h \
@ -14496,7 +14388,6 @@ s,@OPENGLFILES@,$OPENGLFILES,;t t
s,@GLU32FILES@,$GLU32FILES,;t t s,@GLU32FILES@,$GLU32FILES,;t t
s,@NASLIBS@,$NASLIBS,;t t s,@NASLIBS@,$NASLIBS,;t t
s,@CURSESLIBS@,$CURSESLIBS,;t t s,@CURSESLIBS@,$CURSESLIBS,;t t
s,@CUPSLIBS@,$CUPSLIBS,;t t
s,@sane_devel@,$sane_devel,;t t s,@sane_devel@,$sane_devel,;t t
s,@SANELIBS@,$SANELIBS,;t t s,@SANELIBS@,$SANELIBS,;t t
s,@SANEINCL@,$SANEINCL,;t t s,@SANEINCL@,$SANEINCL,;t t
@ -15169,14 +15060,6 @@ then
echo "*** support before reporting bugs." echo "*** support before reporting bugs."
fi 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" if test "$wine_cv_msg_freetype" = "yes"
then then
echo echo

View File

@ -362,17 +362,6 @@ then
fi fi
AC_SUBST(CURSESLIBS) 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 **** dnl **** Check for SANE ****
AC_CHECK_PROG(sane_devel,sane-config,sane-config,no) AC_CHECK_PROG(sane_devel,sane-config,sane-config,no)
if test "$sane_devel" = "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(Xext,XextCreateExtension,[$X_LIBS -lX11 $X_EXTRA_LIBS])
WINE_GET_SONAME(Xrender,XRenderQueryExtension,[$X_LIBS -lXext -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(freetype,FT_Init_FreeType,[$X_LIBS])
WINE_GET_SONAME(cups,cupsGetDefault)
fi fi
@ -969,6 +959,7 @@ dnl **** Check for header files ****
AC_CHECK_HEADERS(\ AC_CHECK_HEADERS(\
arpa/inet.h \ arpa/inet.h \
arpa/nameser.h \ arpa/nameser.h \
cups/cups.h \
direct.h \ direct.h \
elf.h \ elf.h \
float.h \ float.h \
@ -1597,14 +1588,6 @@ then
echo "*** support before reporting bugs." echo "*** support before reporting bugs."
fi 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" if test "$wine_cv_msg_freetype" = "yes"
then then
echo echo

View File

@ -5,7 +5,6 @@ VPATH = @srcdir@
MODULE = wineps.dll MODULE = wineps.dll
IMPORTS = user32 gdi32 winspool.drv advapi32 kernel32 IMPORTS = user32 gdi32 winspool.drv advapi32 kernel32
ALTNAMES = wineps16.dll ALTNAMES = wineps16.dll
EXTRALIBS = @CUPSLIBS@
EXTRAINCL = @FREETYPEINCL@ EXTRAINCL = @FREETYPEINCL@
LDDLLFLAGS = @LDDLLFLAGS@ LDDLLFLAGS = @LDDLLFLAGS@

View File

@ -20,6 +20,7 @@
*/ */
#include "config.h" #include "config.h"
#include "wine/port.h"
#include <string.h> #include <string.h>
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
@ -33,11 +34,17 @@
#include "winspool.h" #include "winspool.h"
#include "winerror.h" #include "winerror.h"
#ifdef HAVE_CUPS WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
# include <cups/cups.h>
#ifdef HAVE_CUPS_CUPS_H
#include <cups/cups.h>
#ifndef CUPS_SONAME
#define CUPS_SONAME "libcups.so"
#endif #endif
WINE_DEFAULT_DEBUG_CHANNEL(psdrv); static void *cupshandle = NULL;
#endif
static PSDRV_DEVMODEA DefaultDevmode = static PSDRV_DEVMODEA DefaultDevmode =
{ {
@ -127,12 +134,25 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
HeapDestroy(PSDRV_Heap); HeapDestroy(PSDRV_Heap);
return FALSE; 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; break;
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
DeleteObject( PSDRV_DefaultFont ); DeleteObject( PSDRV_DefaultFont );
HeapDestroy( PSDRV_Heap ); HeapDestroy( PSDRV_Heap );
#ifdef HAVE_CUPS_CUPS_H
if (cupshandle && (cupshandle != (void*)-1)) {
wine_dlclose(cupshandle, NULL, 0);
cupshandle = NULL;
}
#endif
break; break;
} }
@ -491,24 +511,28 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name)
goto cleanup; goto cleanup;
} }
#ifdef HAVE_CUPS #ifdef HAVE_CUPS_CUPS_H
{ if (cupshandle != (void*)-1) {
ppd = cupsGetPPD(name); typeof(cupsGetPPD) * pcupsGetPPD = NULL;
if (ppd) { pcupsGetPPD = wine_dlsym(cupshandle, "cupsGetPPD", NULL, 0);
needed=strlen(ppd)+1; if (pcupsGetPPD) {
ppdFileName=HeapAlloc(PSDRV_Heap, 0, needed); ppd = pcupsGetPPD(name);
memcpy(ppdFileName, ppd, needed);
ppdType=REG_SZ; if (ppd) {
res = ERROR_SUCCESS; needed=strlen(ppd)+1;
/* we should unlink() that file later */ ppdFileName=HeapAlloc(PSDRV_Heap, 0, needed);
} else { memcpy(ppdFileName, ppd, needed);
res = ERROR_FILE_NOT_FOUND; ppdType=REG_SZ;
WARN("Did not find ppd for %s\n",name); 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 #endif
if (!ppdFileName) { if (!ppdFileName) {
res = GetPrinterDataA(hPrinter, "PPD File", NULL, NULL, 0, &needed); res = GetPrinterDataA(hPrinter, "PPD File", NULL, NULL, 0, &needed);
if ((res==ERROR_SUCCESS) || (res==ERROR_MORE_DATA)) { if ((res==ERROR_SUCCESS) || (res==ERROR_MORE_DATA)) {

View File

@ -5,7 +5,6 @@ SRCDIR = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
MODULE = winspool.drv MODULE = winspool.drv
IMPORTS = advapi32 kernel32 IMPORTS = advapi32 kernel32
EXTRALIBS = @CUPSLIBS@
LDDLLFLAGS = @LDDLLFLAGS@ LDDLLFLAGS = @LDDLLFLAGS@
SYMBOLFILE = $(MODULE).tmp.o SYMBOLFILE = $(MODULE).tmp.o

View File

@ -23,14 +23,19 @@
*/ */
#include "config.h" #include "config.h"
#include "wine/port.h"
#include "wine/library.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include <stddef.h> #include <stddef.h>
#ifdef HAVE_CUPS #ifdef HAVE_CUPS_CUPS_H
# include <cups/cups.h> # include <cups/cups.h>
# ifndef CUPS_SONAME
# define CUPS_SONAME "libcups.so"
# endif
#endif #endif
#include "winspool.h" #include "winspool.h"
#include "winbase.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 BOOL
CUPS_LoadPrinters(void) { CUPS_LoadPrinters(void) {
typeof(cupsGetPrinters) *pcupsGetPrinters = NULL;
typeof(cupsGetDefault) *pcupsGetDefault = NULL;
typeof(cupsGetPPD) *pcupsGetPPD = NULL;
char **printers; char **printers;
int i,nrofdests,hadprinter = FALSE; int i,nrofdests,hadprinter = FALSE;
PRINTER_INFO_2A pinfo2a; 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 */ if (def && !strcmp(def,"none")) /* CUPS has "none" for no default printer */
def = NULL; def = NULL;
nrofdests = pcupsGetPrinters(&printers);
for (i=0;i<nrofdests;i++) { for (i=0;i<nrofdests;i++) {
const char *ppd = cupsGetPPD(printers[i]); const char *ppd = pcupsGetPPD(printers[i]);
char *port,*devline; char *port,*devline;
if (!ppd) { if (!ppd) {
@ -180,6 +203,7 @@ CUPS_LoadPrinters(void) {
} }
HeapFree(GetProcessHeap(),0,port); HeapFree(GetProcessHeap(),0,port);
} }
wine_dlclose(cupshandle, NULL, 0);
return hadprinter; return hadprinter;
} }
#endif #endif
@ -341,7 +365,7 @@ WINSPOOL_LoadSystemPrinters() {
ERR("Failed adding PS Driver (%ld)\n",GetLastError()); ERR("Failed adding PS Driver (%ld)\n",GetLastError());
return; return;
} }
#ifdef HAVE_CUPS #ifdef HAVE_CUPS_CUPS_H
/* If we have any CUPS based printers, skip looking for printcap printers */ /* If we have any CUPS based printers, skip looking for printcap printers */
if (CUPS_LoadPrinters()) if (CUPS_LoadPrinters())
return; return;
@ -1827,7 +1851,7 @@ static BOOL WINSPOOL_GetPrinter(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter,
RegCloseKey(hkeyPrinter); RegCloseKey(hkeyPrinter);
RegCloseKey(hkeyPrinters); RegCloseKey(hkeyPrinters);
TRACE("returing %d needed = %ld\n", ret, needed); TRACE("returning %d needed = %ld\n", ret, needed);
if(pcbNeeded) *pcbNeeded = needed; if(pcbNeeded) *pcbNeeded = needed;
if(!ret) if(!ret)
SetLastError(ERROR_INSUFFICIENT_BUFFER); 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, DWORD Level, LPBYTE pJob, DWORD cbBuf, LPDWORD pcbNeeded,
LPDWORD pcReturned) 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(pcbNeeded) *pcbNeeded = 0;
if(pcReturned) *pcReturned = 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, DWORD Level, LPBYTE pJob, DWORD cbBuf, LPDWORD pcbNeeded,
LPDWORD pcReturned) 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(pcbNeeded) *pcbNeeded = 0;
if(pcReturned) *pcReturned = 0; if(pcReturned) *pcReturned = 0;
return TRUE; return FALSE;
} }
/***************************************************************************** /*****************************************************************************

View File

@ -56,8 +56,8 @@
/* Define if we have linux/input.h AND it contains the INPUT event API */ /* Define if we have linux/input.h AND it contains the INPUT event API */
#undef HAVE_CORRECT_LINUXINPUT_H #undef HAVE_CORRECT_LINUXINPUT_H
/* Define if we have CUPS */ /* Define to 1 if you have the <cups/cups.h> header file. */
#undef HAVE_CUPS #undef HAVE_CUPS_CUPS_H
/* Define to 1 if you have the <curses.h> header file. */ /* Define to 1 if you have the <curses.h> header file. */
#undef HAVE_CURSES_H #undef HAVE_CURSES_H
@ -686,6 +686,9 @@
/* The size of a `long long', as computed by sizeof. */ /* The size of a `long long', as computed by sizeof. */
#undef SIZEOF_LONG_LONG #undef SIZEOF_LONG_LONG
/* Define to the soname of the libcups library. */
#undef SONAME_LIBCUPS
/* Define to the soname of the libfreetype library. */ /* Define to the soname of the libfreetype library. */
#undef SONAME_LIBFREETYPE #undef SONAME_LIBFREETYPE