[gs-cvs] rev 8315 - in trunk/gs: cups src

giles at ghostscript.com giles at ghostscript.com
Wed Oct 24 11:39:56 PDT 2007


Author: giles
Date: 2007-10-24 11:39:55 -0700 (Wed, 24 Oct 2007)
New Revision: 8315

Modified:
   trunk/gs/cups/cups.mak
   trunk/gs/src/Makefile.in
   trunk/gs/src/configure.ac
Log:
Use the proper build machinery to link to cups.

DETAILS:

Previously, the configure script just appended the output of cups-config
to CFLAGS and LIBS which could confuse other parts of the build. The
LIBS setting was actually ignored by cups.mak which hard coded liking
to cups and cupsimage through the genconf -lib option, although it
depended on it for the search patch if cups was in a non-standard
location.

Instead, we parse the output of cups-config to separate the dependent
libraries and additional search paths if any, and pass those through
to genconf in the intended way. This destroys the order of the link
line, but GNU ld, at least, applies all -L paths to all -l libraries,
so that should not distrurb the build. We pass any extra include paths
in a special variable and use it directly when compiling gdevcups.c to
avoid confusing the search path for other components.

Configure also used to ignore cups-config if it found cups/raster.h in
the current search path. We now prefer cups-config.


Modified: trunk/gs/cups/cups.mak
===================================================================
--- trunk/gs/cups/cups.mak	2007-10-24 18:39:51 UTC (rev 8314)
+++ trunk/gs/cups/cups.mak	2007-10-24 18:39:55 UTC (rev 8315)
@@ -4,6 +4,7 @@
 # CUPS driver makefile for Ghostscript.
 #
 # Copyright 2001-2005 by Easy Software Products.
+# Copyright 2007 Artifex Software, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -20,21 +21,26 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 #
 
+# define the name of this makefile
+CUPS_MAK=cups/cups.mak
+
 ### ----------------- CUPS Ghostscript Driver ---------------------- ###
 
 cups_=	$(GLOBJ)gdevcups.$(OBJ)
 
 # These are set in the toplevel Makefile via autoconf(1)
+# CUPSCFLAGS=`cups-config --cflags`
 # CUPSSERVERBIN=`cups-config --serverbin`
 # CUPSSERVERROOT=`cups-config --serverroot`
 # CUPSDATA=`cups-config --datadir`
 
-$(DD)cups.dev:	$(cups_) $(GLD)page.dev
-	$(ADDMOD) $(DD)cups -lib cupsimage -lib cups
+$(DD)cups.dev : $(CUPS_MAK) $(cups_) $(GLD)page.dev
 	$(SETPDEV2) $(DD)cups $(cups_)
+	$(ADDMOD) $(DD)cups -libpath $(CUPSLIBDIRS)
+	$(ADDMOD) $(DD)cups -lib $(CUPSLIBS)
 
-$(GLOBJ)gdevcups.$(OBJ): cups/gdevcups.c $(PDEVH)
-	$(GLCC) $(GLO_)gdevcups.$(OBJ) $(C_) cups/gdevcups.c
+$(GLOBJ)gdevcups.$(OBJ) : cups/gdevcups.c $(PDEVH)
+	$(GLCC) $(CUPSCFLAGS) $(GLO_)gdevcups.$(OBJ) $(C_) cups/gdevcups.c
 
 install:	install-cups
 

Modified: trunk/gs/src/Makefile.in
===================================================================
--- trunk/gs/src/Makefile.in	2007-10-24 18:39:51 UTC (rev 8314)
+++ trunk/gs/src/Makefile.in	2007-10-24 18:39:55 UTC (rev 8315)
@@ -75,6 +75,9 @@
 GS_DOCDIR=$(docdir)
 
 # Define install location for 'cups' device/filter support
+CUPSCFLAGS=@CUPSCFLAGS@
+CUPSLIBS=@CUPSLIBS@
+CUPSLIBDIRS=@CUPSLIBDIRS@
 CUPSSERVERBIN=@CUPSSERVERBIN@
 CUPSSERVERROOT=@CUPSSERVERROOT@
 CUPSDATA=@CUPSDATA@

Modified: trunk/gs/src/configure.ac
===================================================================
--- trunk/gs/src/configure.ac	2007-10-24 18:39:51 UTC (rev 8314)
+++ trunk/gs/src/configure.ac	2007-10-24 18:39:55 UTC (rev 8315)
@@ -392,6 +392,9 @@
 
 CUPSDEV=""
 CUPSINCLUDE=""
+CUPSCFLAGS=""
+CUPSLIBS=""
+CUPSLIBDIRS=""
 CUPSCONFIG="${CUPSCONFIG:=}"
 CUPSSERVERBIN=""
 CUPSSERVERROOT=""
@@ -400,12 +403,14 @@
 if ( test -d cups ); then
     if test x$enable_cups != xno; then
 	AC_PATH_PROG(CUPSCONFIG,cups-config)
-	AC_CHECK_HEADER([cups/raster.h],[],[CUPSCONFIG=""])
+	dnl AC_CHECK_HEADER([cups/raster.h],[],[CUPSCONFIG=""])
 	if test "x$CUPSCONFIG" != x; then
 	    dnl Use values from CUPS config...
-#	    LIBS="`$CUPSCONFIG --ldflags` `$CUPSCONFIG --static --image --libs | sed -e '1,$s/-lssl//'` $LIBS"
-	    LIBS="`$CUPSCONFIG --ldflags` `$CUPSCONFIG --image --libs` $LIBS"
-	    CFLAGS="`$CUPSCONFIG --cflags` $CFLAGS"
+	    CUPSCFLAGS="`$CUPSCONFIG --cflags` $CFLAGS"
+#	    CUPSLINK="`$CUPSCONFIG --ldflags` `$CUPSCONFIG --static --image --libs | sed -e '1,$s/-lssl//'` $LIBS"
+	    CUPSLINK="`$CUPSCONFIG --ldflags` `$CUPSCONFIG --image --libs`"
+	    GS_SPLIT_LIBS([CUPSLIBS], [$CUPSLINK])
+	    GS_SPLIT_LIBPATHS([CUPSLIBDIRS],[$CUPSLINK])
 	    CUPSSERVERROOT="`$CUPSCONFIG --serverroot`"
 	    CUPSSERVERBIN="`$CUPSCONFIG --serverbin`"
 	    CUPSDATA="`$CUPSCONFIG --datadir`"
@@ -416,6 +421,9 @@
 fi
 
 AC_SUBST(CUPSDEV)
+AC_SUBST(CUPSCFLAGS)
+AC_SUBST(CUPSLIBS)
+AC_SUBST(CUPSLIBDIRS)
 AC_SUBST(CUPSINCLUDE)
 AC_SUBST(CUPSSERVERBIN)
 AC_SUBST(CUPSSERVERROOT)



More information about the gs-cvs mailing list