From a97acf75dc4c780879d03ab520b22a2b526fb9e0 Mon Sep 17 00:00:00 2001 From: Kevin Walzer Date: Thu, 30 May 2024 06:43:30 +0000 Subject: Additional build support for linking to libcups --- unix/Makefile.in | 7 +++++++ unix/configure | 19 ++++++++++--------- unix/configure.ac | 21 +++++++++++---------- unix/tkUnixPrint.c | 6 +++--- 4 files changed, 31 insertions(+), 22 deletions(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index 806a770..ffd57cd 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -299,6 +299,10 @@ REZ_SWITCHES = @REZ_FLAGS@ -i $(GENERIC_DIR) -i $(TCL_GENERIC_DIR) XFT_CFLAGS = @XFT_CFLAGS@ XFT_LIBS = @XFT_LIBS@ +# support for libcups +CUPS_CFLAGS = @CUPS_CFLAGS@ +CUPS_LIBS = @CUPS_LIBS@ + #---------------------------------------------------------------- # The information below is modified by the configure script when # Makefile is generated from Makefile.in. You shouldn't normally @@ -1332,6 +1336,9 @@ tkUnixMenu.o: $(UNIX_DIR)/tkUnixMenu.c tkUnixMenubu.o: $(UNIX_DIR)/tkUnixMenubu.c $(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkUnixMenubu.c +tkUnixPrint.o: $(UNIX_DIR)/tkUnixPrint.c + $(CC) -c $(CC_SWITCHES) $(CUPS_CFLAGS) $(UNIX_DIR)/tkUnixPrint.c + tkUnixScale.o: $(UNIX_DIR)/tkUnixScale.c $(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tkUnixScale.c diff --git a/unix/configure b/unix/configure index 5b00509..94f9309 100755 --- a/unix/configure +++ b/unix/configure @@ -8405,16 +8405,16 @@ fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_cups" >&5 printf "%s\n" "$enable_cups" >&6; } else - found_cups="yes" - CUPS_CFLAGS=`cups-config --cflags 2>/dev/null` || found_cups="no" - CUPS_LIBS=`cups-config --libs 2>/dev/null` || found_cups="no" - if test "$found_cups" = "no" ; then + found_cups=`cups-config 2>/dev/null` + if test "$found_cups" = ""; then + found_cups=no + else found_cups=yes - CUPS_CFLAGS=`pkg-config --cflags cups 2>/dev/null` || found_cups="no" - XFT_LIBS=`pkg-config --libs cups 2>/dev/null` || found_cups="no" + CUPS_CFLAGS="-DHAVE_CUPS" + CUPS_LIBS="-lcups" fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $found_xft" >&5 -printf "%s\n" "$found_xft" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $found_cups" >&5 +printf "%s\n" "$found_cups" >&6; } if test "$found_cups" = "yes" ; then tk_oldCFlags=$CFLAGS CFLAGS="$CFLAGS $XINCLUDES $CUPS_CFLAGS" @@ -8434,11 +8434,12 @@ fi CFLAGS=$tk_oldCFlags LIBS=$tk_oldLibs fi -fi + fi fi + #-------------------------------------------------------------------- # XXX Do this last. # It might modify XLIBSW which could affect other tests. diff --git a/unix/configure.ac b/unix/configure.ac index ef6d8df..8e73c01 100644 --- a/unix/configure.ac +++ b/unix/configure.ac @@ -481,17 +481,17 @@ if test $tk_aqua = no; then if test "$enable_cups" = "no" ; then AC_MSG_RESULT([$enable_cups]) else - found_cups="yes" - dnl make sure package configurator (cups-config or pkg-config + found_cups=`cups-config 2>/dev/null` + dnl make sure package configurator (cups-config) dnl says that libcups is present. - CUPS_CFLAGS=`cups-config --cflags 2>/dev/null` || found_cups="no" - CUPS_LIBS=`cups-config --libs 2>/dev/null` || found_cups="no" - if test "$found_cups" = "no" ; then + if test "$found_cups" = ""; then + found_cups=no + else found_cups=yes - CUPS_CFLAGS=`pkg-config --cflags cups 2>/dev/null` || found_cups="no" - XFT_LIBS=`pkg-config --libs cups 2>/dev/null` || found_cups="no" + CUPS_CFLAGS="-DHAVE_CUPS" + CUPS_LIBS="-lcups" fi - AC_MSG_RESULT([$found_xft]) + AC_MSG_RESULT([$found_cups]) dnl make sure that compiling against CUPS header file doesn't bomb if test "$found_cups" = "yes" ; then tk_oldCFlags=$CFLAGS @@ -504,11 +504,12 @@ if test $tk_aqua = no; then CFLAGS=$tk_oldCFlags LIBS=$tk_oldLibs fi -fi + fi AC_SUBST(CUPS_CFLAGS) - AC_SUBST(CUPS_LIBS) + AC_SUBST(CUPS_LIBS) fi + #-------------------------------------------------------------------- # XXX Do this last. # It might modify XLIBSW which could affect other tests. diff --git a/unix/tkUnixPrint.c b/unix/tkUnixPrint.c index f8640ea..bb0dc5e 100644 --- a/unix/tkUnixPrint.c +++ b/unix/tkUnixPrint.c @@ -31,7 +31,7 @@ static cups_dest_t * GetPrinterFromObj(Tcl_Obj *nameObj) { cups_dest_t *printer; - int len; + Tcl_Size len; const char *nameStr = Tcl_GetStringFromObj(nameObj, &len); char *p; char *name, *instance = NULL; @@ -224,7 +224,7 @@ PrintOp( * USE [encoding convertto] with a proper encoding when passing * text data to print. */ - const unsigned char *buffer; int buflen; + const unsigned char *buffer; Tcl_Size buflen; const Tcl_ArgvInfo argTable[] = { {TCL_ARGV_GENFUNC, "-colormode", ParseEnumOptions, &color, @@ -315,7 +315,7 @@ PrintOp( num_options, &options); } if (marginsObj) { - int n; + Tcl_Size n; Tcl_Obj **listArr; Tcl_ListObjGetElements(interp, marginsObj, &n, &listArr); -- cgit v0.12