[PATCH 09/21] Simplify the conditional inclusion of the contrib directory.

2014-01-12 Thread John Darrington
* Makefile.in, configure.ac: Ensure that CONTRIB is correctly
  included (or not) when building outside the source tree.
---
 Makefile.in  |4 ++--
 configure.ac |   10 ++
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index d6bad91..637141d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -620,13 +620,13 @@ include $(GLSRCDIR)/ijs.mak
 @LCUPSINCLUDE@
 @LCUPSIINCLUDE@
 include $(GLSRCDIR)/devs.mak
-include $(GLSRCDIR)/contrib.mak
+@CONTRIBINCLUDE@ $(GLSRCDIR)/contrib.mak
+@CONTRIBINCLUDE@ $(CONTRIBDIR)/contrib.mak
 include $(GLSRCDIR)/unix-aux.mak
 include $(GLSRCDIR)/unixlink.mak
 include $(GLSRCDIR)/unix-dll.mak
 include $(GLSRCDIR)/unix-end.mak
 include $(GLSRCDIR)/unixinst.mak
-@CONTRIBINCLUDE@
 @CUPSINCLUDE@
 
 # Clean up after the autotools scripts
diff --git a/configure.ac b/configure.ac
index e351afd..4b89c19 100644
--- a/configure.ac
+++ b/configure.ac
@@ -142,7 +142,7 @@ dnl --
 
 AC_ARG_ENABLE([contrib], AC_HELP_STRING([--disable-contrib],
 [Do not include contributed drivers]))
-CONTRIBINCLUDE="include contrib/contrib.mak"
+CONTRIBINCLUDE="include"
 INSTALL_CONTRIB="install-contrib-extras"
 
 case `uname` in
@@ -150,16 +150,10 @@ case `uname` in
   AC_MSG_WARN([disabling contrib devices])
   enable_contrib=no
 ;;
-*)
-# This is just an arbitrary file in contrib to check
-  if !(test -f contrib/gdevbjc_.c); then
-enable_contrib=no
-  fi
-;;
 esac
 
 if test x$enable_contrib = xno; then
-CONTRIBINCLUDE=""
+CONTRIBINCLUDE="#"
 INSTALL_CONTRIB=""
 CFLAGS="$CFLAGS -DNOCONTRIB"
 fi
-- 
1.7.10.4




[PATCH 05/21] base/lib.mak: Fix broken build dependency

2014-01-12 Thread John Darrington
* base/lib.mak (LIB1s): add dependency gdevppla
---
 base/lib.mak |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/base/lib.mak b/base/lib.mak
index de11d5f..e0f1114 100644
--- a/base/lib.mak
+++ b/base/lib.mak
@@ -1225,7 +1225,7 @@ $(GLOBJ)gxdownscale.$(OBJ) : $(GLSRC)gxdownscale.c $(AK) \
 ## Create a pseudo-"feature" for the entire graphics library.
 
 LIB0s=$(GLOBJ)gpmisc.$(OBJ) $(GLOBJ)stream.$(OBJ) $(GLOBJ)strmio.$(OBJ)
-LIB1s=$(GLOBJ)gsalloc.$(OBJ) $(GLOBJ)gsalpha.$(OBJ) $(GLOBJ)gxdownscale.$(OBJ) 
$(downscale_) $(GLOBJ)gdevprn.$(OBJ)
+LIB1s=$(GLOBJ)gsalloc.$(OBJ) $(GLOBJ)gsalpha.$(OBJ) $(GLOBJ)gxdownscale.$(OBJ) 
$(downscale_) $(GLOBJ)gdevprn.$(OBJ) $(GLOBJ)gdevppla.$(OBJ)
 LIB2s=$(GLOBJ)gsbitcom.$(OBJ) $(GLOBJ)gsbitops.$(OBJ) $(GLOBJ)gsbittab.$(OBJ)
 # Note: gschar.c is no longer required for a standard build;
 # we include it only for backward compatibility for library clients.
-- 
1.7.10.4




[PATCH 14/21] Remove broken test for OpenJpeg library.

2014-01-12 Thread John Darrington
The test for the openjpeg code was both broken and unnecessary. Broken
because it would fail when running from outside the source tree;
unnecessary because the condition it was intended to test (viz the
existence of a file) must be true, because that file is shipped with
the tarball.

Therefore, this change simply removes the test.
---
 Makefile.in  |2 +-
 configure.ac |6 --
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index 637141d..758a866 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -264,7 +264,7 @@ JBIG2_CFLAGS=@JBIG2_AUTOCONF_CFLAGS@
 # and source location and configuration flags for compiling in
 JPX_LIB=@JPX_DECODER@
 SHARE_JPX=@SHARE_JPX@
-JPXSRCDIR=@JPXDIR@
+JPXSRCDIR=$(top_srcdir)/@JPXDIR@
 JPX_CFLAGS=@JPX_AUTOCONF_CFLAGS@
 
 # uncomment the following three lines and one of the last two to
diff --git a/configure.ac b/configure.ac
index 2c1435a..d6e2be0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1089,17 +1089,11 @@ AC_ARG_ENABLE([openjpeg], 
AC_HELP_STRING([--disable-openjpeg],
 
 if test "x$JPX_DECODER" = "x"; then
   if test "x$enable_openjpeg" != "xno"; then
-AC_MSG_CHECKING([for local OpenJPEG library source])
-if test -e $OPENJPEGDIR/libopenjpeg/openjpeg.h; then
-  AC_MSG_RESULT([yes])
   JPXDIR="$OPENJPEGDIR"
   JPX_DECODER=openjpeg
   SHARE_JPX=0
   JPX_AUTOCONF_CFLAGS="-DUSE_OPENJPEG_JP2"
   JPXDEVS='$(PSD)jpx.dev'
-else
-  AC_MSG_RESULT([no])
-fi
   fi
 fi
 
-- 
1.7.10.4




[PATCH 19/21] Remove duplicate assignment to EXTRALIBS

2014-01-12 Thread John Darrington
Not only was this redundant, but it also overwrote some (potentially important)
libraries assigned from other modules.

* base/unix-gcc.mak: Remove assignment to EXTRALIBS
---
 base/unix-gcc.mak |9 -
 1 file changed, 9 deletions(-)

diff --git a/base/unix-gcc.mak b/base/unix-gcc.mak
index dc1d4c8..355aed9 100644
--- a/base/unix-gcc.mak
+++ b/base/unix-gcc.mak
@@ -270,15 +270,6 @@ XLDFLAGS=
 
 LDFLAGS=$(XLDFLAGS)
 
-# Define any extra libraries to link into the executable.
-# ISC Unix 2.2 wants -linet.
-# SCO Unix needs -lsocket if you aren't including the X11 driver.
-# SVR4 may need -lnsl.
-# Solaris may need -lnsl -lsocket -lposix4.
-# (Libraries required by individual drivers are handled automatically.)
-
-EXTRALIBS=-rdynamic -ldl
-
 # Define the standard libraries to search at the end of linking.
 # Most platforms require -lpthread for the POSIX threads library;
 # on FreeBSD, change -lpthread to -lc_r; BSDI and perhaps some others
-- 
1.7.10.4




[PATCH 12/21] Minor re-ordering of configure.ac

2014-01-12 Thread John Darrington
* configure.ac: Move the test for enable_freetype closer to where
  it is used.
---
 configure.ac |   17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac
index 1a98f07..e22b86a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -518,14 +518,6 @@ AC_SUBST(HAVE_DBUS)
 
 AC_CHECK_LIB(dl, dlopen)
 
-AC_ARG_ENABLE([freetype], AC_HELP_STRING([--disable-freetype],
-[Disable freetype for font rasterization]))
-FT_BRIDGE=0
-SHARE_FT=0
-FTSRCDIR=
-FT_CFLAGS=
-FT_LIBS=
-
 dnl UFST detection
 AC_ARG_WITH([ufst], AC_HELP_STRING([--with-ufst=UFST_ROOT_DIR],
[Use UFST]),
@@ -545,6 +537,15 @@ AC_SUBST(UFST_ROOT)
 AC_SUBST(UFST_CFLAGS)
 AC_SUBST(UFST_LIB_EXT)
 
+
+AC_ARG_ENABLE([freetype], AC_HELP_STRING([--disable-freetype],
+[Disable freetype for font rasterization]))
+FT_BRIDGE=0
+SHARE_FT=0
+FTSRCDIR=
+FT_CFLAGS=
+FT_LIBS=
+
 if test x"$enable_freetype" != xno; then
   AC_MSG_CHECKING([for local freetype library source])
   dnl We prefer freetype2 over freetype, so it is easy to override
-- 
1.7.10.4




[PATCH 08/21] configure.ac, Makefile.in: Use CC_FOR_BUILD for native compilation.

2014-01-12 Thread John Darrington
* Makefile.in: Use the variable CC_FOR_BUILD as the native compiler
  configure.ac: Set a reasonable default for CC_FOR_BUILD if unset.
---
 Makefile.in  |2 +-
 configure.ac |   11 +++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/Makefile.in b/Makefile.in
index 692ccc1..d6bad91 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -331,7 +331,7 @@ RANLIB=@RANLIB@
 # Define the name of the C compiler (target and host (AUX))
 
 CC=@CC@
-CCAUX=@CC@
+CCAUX=@CC_FOR_BUILD@
 
 # Define the name of the linker for the final link step.
 # Normally this is the same as the C compiler.
diff --git a/configure.ac b/configure.ac
index d66f06a..e351afd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -107,6 +107,17 @@ AC_PROG_CC
 AC_PROG_CPP
 CFLAGS=$save_cflags
 
+dnl Put a plausible default for CC_FOR_BUILD in Makefile.in
+if test -z "$CC_FOR_BUILD"; then
+  if test "x$cross_compiling" = "xno"; then
+CC_FOR_BUILD='$(CC)'
+  else
+CC_FOR_BUILD=cc
+  fi
+fi
+AC_SUBST(CC_FOR_BUILD)
+
+
 AC_PROG_SED
 dnl See if it is GNU sed or else.
 dnl - need more work to tell SED features.
-- 
1.7.10.4




[PATCH 10/21] Fix test for dbus when cross building

2014-01-12 Thread John Darrington
* configure.ac: Replace ad hoc test for dbus with one using PKG_CHECK_MODULES
---
 configure.ac |   26 ++
 1 file changed, 2 insertions(+), 24 deletions(-)

diff --git a/configure.ac b/configure.ac
index 4b89c19..5889603 100644
--- a/configure.ac
+++ b/configure.ac
@@ -508,35 +508,13 @@ PKG_CHECK_MODULES([FONTCONFIG], [fontconfig],
 AC_SUBST(HAVE_FONTCONFIG)
 
 dnl DBus support
-HAVE_DBUS=""
-DBUS_CFLAGS=""
-DBUS_LIBS=""
 AC_ARG_ENABLE([dbus], AC_HELP_STRING([--disable-dbus],
 [Do not use dbus to communicate with external services]))
 if test "$enable_dbus" != "no"; then
-if test "x$PKGCONFIG" != x; then
-AC_MSG_CHECKING(for dbus with pkg-config)
-if $PKGCONFIG --exists dbus-1; then
-AC_MSG_RESULT(yes)
-DBUS_CFLAGS="$CFLAGS `$PKGCONFIG --cflags dbus-1`"
-DBUS_LIBS="`$PKGCONFIG --libs dbus-1`"
-HAVE_DBUS=-DHAVE_DBUS
-else
-AC_MSG_RESULT(no)
-fi
-fi
-if test -z "$HAVE_DBUS"; then
-AC_CHECK_LIB([dbus], [dbus_message_iter_get_basic], [
-  AC_CHECK_HEADER([dbus-1.0/dbus/dbus.h], [
-DBUS_LIBS="-ldbus-1 -lpthread -lrt"
-HAVE_DBUS="-DHAVE_DBUS"
-  ])
-])
-fi
+   PKG_CHECK_MODULES([DBUS], [dbus-1], 
+   [HAVE_DBUS="-DHAVE_DBUS"],[true])
 fi
 AC_SUBST(HAVE_DBUS)
-AC_SUBST(DBUS_CFLAGS)
-AC_SUBST(DBUS_LIBS)
 
 AC_CHECK_LIB(dl, dlopen)
 
-- 
1.7.10.4




[PATCH 11/21] Fix incorrect determination of host/build OS

2014-01-12 Thread John Darrington
* configure.ac: use $host_os or $build_os as appropriate, instead of `uname`
  (the latter incorrectly gives the build OS regardless of what is needed).
---
 configure.ac |   18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5889603..1a98f07 100644
--- a/configure.ac
+++ b/configure.ac
@@ -145,8 +145,8 @@ AC_ARG_ENABLE([contrib], AC_HELP_STRING([--disable-contrib],
 CONTRIBINCLUDE="include"
 INSTALL_CONTRIB="install-contrib-extras"
 
-case `uname` in
-MINGW*)
+case $host_os in
+mingw*)
   AC_MSG_WARN([disabling contrib devices])
   enable_contrib=no
 ;;
@@ -389,8 +389,8 @@ AC_CHECK_LIB(m, cos)
 SYNC="nosync"
 PTHREAD_LIBS=""
 
-case `uname` in
-MINGW*)
+case $host_os in
+mingw*)
   AC_MSG_WARN([disabling support for pthreads..])
 ;;
 *)
@@ -996,8 +996,8 @@ dnl look for IJS implementation
 AC_ARG_WITH([ijs], AC_HELP_STRING([--without-ijs],
 [disable IJS driver support]))
 
-case `uname` in
-MINGW*)
+case $host_os in
+mingw*)
   AC_MSG_WARN([disabling the ijs device])
   with_ijs=no
 ;;
@@ -1647,7 +1647,7 @@ DYNAMIC_LIBS=""
 INSTALL_SHARED=""
 DYNANIC_LIB_EXT="so"
 
-case `uname` in
+case $host_os in
 Linux*|GNU*)
 DYNAMIC_CFLAGS="-fPIC"
 DYNAMIC_LDFLAGS="-fPIC -shared"
@@ -1931,8 +1931,8 @@ AC_SUBST(HAVE_BYTESWAP_H)
 # mingw, add the same prefix as the VS build uses
 # --
 AUXDIRPOSTFIX=""
-case `uname` in
-MINGW*)
+case $build_os in
+mingw*)
 AUXDIRPOSTFIX="_"
 ;;
 esac
-- 
1.7.10.4




[PATCH 16/21] Remove the code running ./configure from autogen.sh - I am of the opinion, that the bootstrap process and the configuration should be kept seperate. It should be possible to bootstrap wi

2014-01-12 Thread John Darrington
* autogen.sh: Remove code which runs ./configure
---
 autogen.sh |9 -
 1 file changed, 9 deletions(-)

diff --git a/autogen.sh b/autogen.sh
index 0dad6bd..67660d5 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -34,12 +34,3 @@ aclocal || exit 1
 
 echo "  running autoconf"
 autoconf || exit 1
-
-if test -z "$*"; then
-echo "I am going to run ./configure with no arguments - if you wish "
-echo "to pass any to it, please specify them on the $0 command line."
-else
-   echo "running ./configure $@"
-fi
-
-$srcdir/configure "$@" && echo
-- 
1.7.10.4




[PATCH 04/21] Fix crash on startup if the configuration file is missing.

2014-01-12 Thread John Darrington
* base/gmisc.c (emprintf_program_ident): Add missing parameter.
---
 base/gsmisc.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/base/gsmisc.c b/base/gsmisc.c
index 96bd8b0..d5b375c 100644
--- a/base/gsmisc.c
+++ b/base/gsmisc.c
@@ -215,7 +215,7 @@ emprintf_program_ident(const gs_memory_t *mem,
 if (revision_number) {
 int fpart = revision_number % 100;
 
-epfm("%d.%02d.%d", (int)(revision_number / 1 % 100),
+epfm(mem, "%d.%02d.%d", (int)(revision_number / 1 % 100),
(int)(revision_number / 100 % 100), fpart);
 }
 epfm(mem, ": ");
-- 
1.7.10.4




[PATCH 17/21] Avoid redundancy in package version number/string

2014-01-12 Thread John Darrington
* configure.ac: Extract the GS_ symbols from the version number
  provided to AC_INIT instead of duplicating it.
---
 configure.ac |   19 ---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index d6e2be0..dcce828 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,10 +38,23 @@ CPPFLAGS="${CPPFLAGS:=}"
 CXXFLAGS="${CXXFLAGS:=}"
 LDFLAGS="${LDFLAGS:=}"
 
-GS_VERSION_MAJOR=9
-GS_VERSION_MINOR=6
-GS_VERSION_PATCH=0
 GS_REVISIONDATE=20130101
+# Extract major.minor.micro from the version number provided to AC_INIT above
+majmin=${PACKAGE_VERSION%\.*}
+
+major=${PACKAGE_VERSION/%\.*\.*/}
+minor=${majmin/#*\./}
+micro=${PACKAGE_VERSION/#*\.*\./}
+
+# Strip any leading zeros
+GS_VERSION_MAJOR=${major#"${major%%[!0]*}"}
+GS_VERSION_MINOR=${minor#"${minor%%[!0]*}"}
+GS_VERSION_PATCH=${micro#"${micro%%[!0]*}"}
+
+# If any component is now "" replace it with "0"
+GS_VERSION_MAJOR=${GS_VERSION_MAJOR:-0}
+GS_VERSION_MINOR=${GS_VERSION_MINOR:-0}
+GS_VERSION_PATCH=${GS_VERSION_PATCH:-0}
 
 GS_VERSION=`expr $GS_VERSION_MAJOR \* 1 + $GS_VERSION_MINOR \* 100 + 
$GS_VERSION_PATCH`
 
-- 
1.7.10.4




[PATCH 20/21] Remove 'exe' suffix from GS variable.

2014-01-12 Thread John Darrington
This had the effect of creating libraries called libgsexe.a etc.

* Makefile.in: Remove 'exe' suffix from GS variable.
---
 Makefile.in |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Makefile.in b/Makefile.in
index 758a866..2214d73 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -166,7 +166,8 @@ CAPOPT= @HAVE_MKSTEMP@ @HAVE_FILE64@ @HAVE_MKSTEMP64@ 
@HAVE_FONTCONFIG@ @HAVE_LI
 
 # Define the name of the executable file.
 
-GS=@GS@@EXEEXT@
+GS=@GS@
+GSEXE=@GS@@EXEEXT@
 
 # Define the directories for debugging and profiling binaries, relative to
 # the standard binaries.
-- 
1.7.10.4




[PATCH 15/21] Correct bad directories for ROMFS_OBJS

2014-01-12 Thread John Darrington
---
 base/unix-aux.mak |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/base/unix-aux.mak b/base/unix-aux.mak
index 5226a29..2ba84c4 100644
--- a/base/unix-aux.mak
+++ b/base/unix-aux.mak
@@ -97,10 +97,10 @@ $(MKROMFS_XE)_0: $(GLSRC)mkromfs.c $(MKROMFS_COMMON_DEPS) 
$(MKROMFS_OBJS_0)
$(CCAUX_) $(GENOPT) $(CFLAGS) $(I_)$(GLSRCDIR)$(_I) $(I_)$(GLOBJ)$(_I) 
$(I_)$(ZSRCDIR)$(_I) $(GLSRC)mkromfs.c $(O_)$(MKROMFS_XE)_0 $(MKROMFS_OBJS_0) 
-lm $(EXTRALIBS)
 
 #  and one using the zlib library linked via the command line
-MKROMFS_OBJS_1=$(GLOBJ)gscdefs.$(OBJ) $(GLOBJ)gsmisc.$(OBJ) \
- $(GLOBJ)gpmisc.$(OBJ) $(GLOBJ)gslibctx.$(OBJ) $(GLOBJ)gp_getnv.$(OBJ) \
- $(GLOBJ)gp_unix.$(OBJ) $(GLOBJ)gp_unifs.$(OBJ) $(GLOBJ)gp_unifn.$(OBJ) \
- $(GLOBJ)gp_stdia.$(OBJ) $(GLOBJ)gsutil.$(OBJ)
+MKROMFS_OBJS_1=$(AUXDIR)/gscdefs.$(OBJ) $(AUXDIR)/gsmisc.$(OBJ) \
+ $(AUXDIR)/gpmisc.$(OBJ) $(AUXDIR)/gslibctx.$(OBJ) $(AUXDIR)/gp_getnv.$(OBJ) \
+ $(AUXDIR)/gp_unix.$(OBJ) $(AUXDIR)/gp_unifs.$(OBJ) $(AUXDIR)/gp_unifn.$(OBJ) \
+ $(AUXDIR)/gp_stdia.$(OBJ) $(AUXDIR)/gsutil.$(OBJ)
 
 $(MKROMFS_XE)_1: $(GLSRC)mkromfs.c $(MKROMFS_COMMON_DEPS) $(MKROMFS_OBJS_1)
$(CCAUX_) $(GENOPT) $(CFLAGS) $(I_)$(GLSRCDIR)$(_I) $(I_)$(GLOBJ)$(_I) 
$(I_)$(ZSRCDIR)$(_I) $(GLSRC)mkromfs.c $(O_)$(MKROMFS_XE)_1 $(MKROMFS_OBJS_1) 
-lm $(EXTRALIBS)
-- 
1.7.10.4




[PATCH 13/21] Improve reliability of freetype library (esp. wrt cross-building)

2014-01-12 Thread John Darrington
* configure.ac: Use PKG_CHECK_MODULE instead of ad hoc code
---
 configure.ac |   70 --
 1 file changed, 4 insertions(+), 66 deletions(-)

diff --git a/configure.ac b/configure.ac
index e22b86a..2c1435a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -537,76 +537,14 @@ AC_SUBST(UFST_ROOT)
 AC_SUBST(UFST_CFLAGS)
 AC_SUBST(UFST_LIB_EXT)
 
-
+AFS=1
+FT_BRIDGE=0
 AC_ARG_ENABLE([freetype], AC_HELP_STRING([--disable-freetype],
 [Disable freetype for font rasterization]))
-FT_BRIDGE=0
-SHARE_FT=0
-FTSRCDIR=
-FT_CFLAGS=
-FT_LIBS=
 
 if test x"$enable_freetype" != xno; then
-  AC_MSG_CHECKING([for local freetype library source])
-  dnl We prefer freetype2 over freetype, so it is easy to override
-  dnl the included freetype source with a checkout from upstream.
-  
-  for dir in freetype2 freetype; do
-if test -f $dir/src/base/ftbbox.c; then
-AC_MSG_RESULT(yes)
-SHARE_FT=0
-FTSRCDIR="$dir"
-FT_CFLAGS="-I$dir/include"
-FT_BRIDGE=1
-break;
-fi
-  done
-  if test -z $FTSRCDIR; then
-AC_MSG_RESULT([no])
-if test "x$PKGCONFIG" != x; then
-AC_MSG_CHECKING(for system freetype2 >= 2.4.2 with pkg-config)
-# pkg-config needs the libtool version, which != the freetype2 
version 
-# There is a table of corresponding ft2<->libtool numbers in 
freetype/docs/VERSION.DLL
-if $PKGCONFIG --atleast-version=12.0.6 freetype2; then
-AC_MSG_RESULT(yes)
-FT_CFLAGS="$CFLAGS `$PKGCONFIG --cflags freetype2`"
-FT_LIBS="`$PKGCONFIG --libs freetype2`"
-FT_BRIDGE=1
-SHARE_FT=1
-else
-AC_MSG_RESULT(no)
-AC_MSG_WARN([freetype library source not found...using native 
rasterizer])
-AFS=1
-fi
-else
-AC_CHECK_HEADER([ft2build.h], [FT_BRIDGE=1], [AFS=1])
-
-if test "x$FT_BRIDGE" = x1; then
-  AC_CHECK_LIB(freetype, FT_Init_FreeType,
-[FT_BRIDGE=1], [FT_BRIDGE=0; AFS=1])
-  
-  if test "x$FT_BRIDGE" = x1; then
-AC_MSG_CHECKING(for system freetype2 library >= 2.4.2)
-AC_COMPILE_IFELSE(
-  [AC_LANG_PROGRAM([#include "ft2build.h"
-  #include FT_FREETYPE_H], [
- #if FREETYPE_MAJOR < 2
-   FAIL
- #endif
- #if FREETYPE_MINOR < 4
-   FAIL
- #endif
- #if FREETYPE_PATCH < 2
-   FAIL
- #endif
- return(0);
-  ])],
-  [FT_BRIDGE=1;AC_MSG_RESULT(yes)], [FT_BRIDGE=0; 
AFS=1;AC_MSG_RESULT(no)])
-  fi
-fi
-
-fi
-  fi
+  PKG_CHECK_MODULES([FT], [freetype2 >= 2.4.2], 
+ [FT_BRIDGE=1; SHARE_FT=1; AFS=0], [true])
 fi
 AC_SUBST(FT_BRIDGE)
 AC_SUBST(SHARE_FT)
-- 
1.7.10.4




[PATCH 02/21] Makefile.in (top_srcdir): New variable

2014-01-12 Thread John Darrington
* Allow builds outside the source tree to succeed.
---
 Makefile.in|   12 +++-
 base/macos-mcp.mak |8 
 base/macosx.mak|8 
 base/ugcclib.mak   |4 ++--
 base/unix-gcc.mak  |8 
 base/unixansi.mak  |8 
 base/unixinst.mak  |   10 +-
 7 files changed, 30 insertions(+), 28 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index e5036ee..692ccc1 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -23,17 +23,19 @@
 # source, generated intermediate file, and object directories
 # for the graphics library (GL) and the PostScript/PDF interpreter (PS).
 
+top_srcdir=@top_srcdir@
+
 BINDIR=./$(BUILDDIRPREFIX)bin
-GLSRCDIR=./base
+GLSRCDIR=$(top_srcdir)/base
 GLGENDIR=./$(BUILDDIRPREFIX)@OBJDIR_BSDMAKE_WORKAROUND@
 GLOBJDIR=./$(BUILDDIRPREFIX)@OBJDIR_BSDMAKE_WORKAROUND@
 AUXDIR=$(GLGENDIR)/aux@AUXDIRPOSTFIX@
-PSSRCDIR=./psi
-PSLIBDIR=./lib
-PSRESDIR=./Resource
+PSSRCDIR=$(top_srcdir)/psi
+PSLIBDIR=$(top_srcdir)/lib
+PSRESDIR=$(top_srcdir)/Resource
 PSGENDIR=./$(BUILDDIRPREFIX)@OBJDIR_BSDMAKE_WORKAROUND@
 PSOBJDIR=./$(BUILDDIRPREFIX)@OBJDIR_BSDMAKE_WORKAROUND@
-CONTRIBDIR=./contrib
+CONTRIBDIR=$(top_srcdir)/contrib
 
 # Do not edit the next group of lines.
 
diff --git a/base/macos-mcp.mak b/base/macos-mcp.mak
index c9ecdb2..144db09 100644
--- a/base/macos-mcp.mak
+++ b/base/macos-mcp.mak
@@ -27,12 +27,12 @@
 # for the graphics library (GL) and the PostScript/PDF interpreter (PS).
 
 BINDIR=./bin
-GLSRCDIR=./base
+GLSRCDIR=$(top_srcdir)/base
 GLGENDIR=./obj
 GLOBJDIR=./obj
-PSSRCDIR=./psi
-PSLIBDIR=./lib
-PSRESDIR=./Resource
+PSSRCDIR=$(top_srcdir)/psi
+PSLIBDIR=$(top_srcdir)/lib
+PSRESDIR=$(top_srcdir)/Resource
 PSGENDIR=./obj
 PSOBJDIR=./obj
 
diff --git a/base/macosx.mak b/base/macosx.mak
index 88b0e6f..33bada5 100644
--- a/base/macosx.mak
+++ b/base/macosx.mak
@@ -23,13 +23,13 @@
 # for the graphics library (GL) and the PostScript/PDF interpreter (PS).
 
 BINDIR=./$(BUILDDIRPREFIX)bin
-GLSRCDIR=./base
+GLSRCDIR=$(top_srcdir)/base
 GLGENDIR=./$(BUILDDIRPREFIX)obj
 GLOBJDIR=./$(BUILDDIRPREFIX)obj
 AUXDIR=$(GLGENDIR)/aux
-PSSRCDIR=./psi
-PSLIBDIR=./lib
-PSRESDIR=./Resource
+PSSRCDIR=$(top_srcdir)/psi
+PSLIBDIR=$(top_srcdir)/lib
+PSRESDIR=$(top_srcdir)/Resource
 PSGENDIR=./$(BUILDDIRPREFIX)obj
 PSOBJDIR=./$(BUILDDIRPREFIX)obj
 
diff --git a/base/ugcclib.mak b/base/ugcclib.mak
index e18debf..f76f8ff 100644
--- a/base/ugcclib.mak
+++ b/base/ugcclib.mak
@@ -15,10 +15,10 @@
 # makefile for Unix / gcc library testing.
 
 BINDIR=./libobj
-GLSRCDIR=./base
+GLSRCDIR=$(top_srcdir)/base
 GLGENDIR=./libobj
 GLOBJDIR=./libobj
-PSRESDIR=./Resource
+PSRESDIR=$(top_srcdir)/Resource
 DD=$(GLGENDIR)/
 GLD=$(GLGENDIR)/
 
diff --git a/base/unix-gcc.mak b/base/unix-gcc.mak
index d31affb..dc1d4c8 100644
--- a/base/unix-gcc.mak
+++ b/base/unix-gcc.mak
@@ -23,13 +23,13 @@
 # for the graphics library (GL) and the PostScript/PDF interpreter (PS).
 
 BINDIR=./$(BUILDDIRPREFIX)bin
-GLSRCDIR=./base
+GLSRCDIR=$(top_srcdir)/base
 GLGENDIR=./$(BUILDDIRPREFIX)obj
 GLOBJDIR=./$(BUILDDIRPREFIX)obj
 AUXDIR=$(GLGENDIR)/aux
-PSSRCDIR=./psi
-PSLIBDIR=./lib
-PSRESDIR=./Resource
+PSSRCDIR=$(top_srcdir)/psi
+PSLIBDIR=$(top_srcdir)/lib
+PSRESDIR=$(top_srcdir)/Resource
 PSGENDIR=./$(BUILDDIRPREFIX)obj
 PSOBJDIR=./$(BUILDDIRPREFIX)obj
 
diff --git a/base/unixansi.mak b/base/unixansi.mak
index 41bd1ae..147db31 100644
--- a/base/unixansi.mak
+++ b/base/unixansi.mak
@@ -23,13 +23,13 @@
 # for the graphics library (GL) and the PostScript/PDF interpreter (PS).
 
 BINDIR=./$(BUILDDIRPREFIX)bin
-GLSRCDIR=./base
+GLSRCDIR=$(top_srcdir)/base
 GLGENDIR=./$(BUILDDIRPREFIX)obj
 GLOBJDIR=./$(BUILDDIRPREFIX)obj
 AUXDIR=$(GLGENDIR)/aux
-PSSRCDIR=./psi
-PSLIBDIR=./lib
-PSRESDIR=./Resource
+PSSRCDIR=$(top_srcdir)/psi
+PSLIBDIR=$(top_srcdir)/lib
+PSRESDIR=$(top_srcdir)/Resource
 PSGENDIR=./$(BUILDDIRPREFIX)obj
 PSOBJDIR=./$(BUILDDIRPREFIX)obj
 
diff --git a/base/unixinst.mak b/base/unixinst.mak
index f8cf1b7..29c8dc7 100644
--- a/base/unixinst.mak
+++ b/base/unixinst.mak
@@ -49,11 +49,11 @@ wftopfa fixmswrd.pl lprsetup.sh pj-gs.sh pv.sh sysvlp.sh 
unix-lpr.sh ;\
fi;\
done'
 
-PSRESDIR=$(PSLIBDIR)/../Resource
-ICCRESDIR=$(PSLIBDIR)/../iccprofiles
-PSDOCDIR=$(PSLIBDIR)/../doc
-PSEXDIR=$(PSLIBDIR)/../examples
-PSMANDIR=$(PSLIBDIR)/../man
+PSRESDIR=$(top_srcdir)/Resource
+ICCRESDIR=$(top_srcdir)/iccprofiles
+PSDOCDIR=$(top_srcdir)/doc
+PSEXDIR=$(top_srcdir)/examples
+PSMANDIR=$(top_srcdir)/man
 
 install-data: install-libdata install-resdata$(COMPILE_INITS) 
install-iccdata$(COMPILE_INITS) install-doc install-man install-examples
 
-- 
1.7.10.4




[PATCH 21/21] Do install contrib drivers if the --disable-contrib option was chosen.

2014-01-12 Thread John Darrington
* configure.ac: Conditionally install contrib drivers.
---
 configure.ac |   33 +
 1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/configure.ac b/configure.ac
index dcce828..0091457 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1365,18 +1365,8 @@ X11_DEVS0=""
 
 
 dnl Known printers
-HP_DEVS='cdj500 djet500 djet500c dnj650c cljet5pr deskjet laserjet ljetplus 
ljet2p ljet3 ljet3d ljet4 ljet4d lj4dith lj5mono lj5gray cdeskjet cdjcolor 
cdjmono cdj550 pj pjxl pjxl300 lp2563 paintjet pjetxl cljet5 cljet5c pxlmono 
pxlcolor cdj670 cdj850 cdj880 cdj890 cdj970 cdj1600 cdnj500 chp2200 pcl3 
hpdjplus hpdjportable hpdj310 hpdj320 hpdj340 hpdj400 hpdj500 hpdj500c hpdj510 
hpdj520 hpdj540 hpdj550c hpdj560c hpdj600 hpdj660c hpdj670c hpdj680c hpdj690c 
hpdj850c hpdj855c hpdj870c hpdj890c hpdj1120c lj3100sw'
+HP_DEVS='deskjet laserjet ljetplus ljet2p ljet3 ljet3d ljet4 ljet4d lj5mono 
lj5gray'
 PCLXL_DEVS='pxlmono pxlcolor'
-EPSON_DEVS='eps9high eps9mid epson epsonc escp lp8000 lq850 photoex st800 
stcolor alc1900 alc2000 alc4000 alc4100 alc8500 alc8600 alc9100 lp3000c lp8000c 
lp8200c lp8300c lp8500c lp8800c lp9000c lp9200c lp9500c lp9800c lps6500 epl2050 
epl2050p epl2120 epl2500 epl2750 epl5800 epl5900 epl6100 epl6200 lp1800 lp1900 
lp2200 lp2400 lp2500 lp7500 lp7700 lp7900 lp8100 lp8300f lp8400f lp8600 lp8600f 
lp8700 lp8900 lp9000b lp9100 lp9200b lp9300 lp9400 lp9600 lp9600s lps4500 
eplcolor eplmono'
-CANON_DEVS='bj10e bj200 bjc600 bjc800 lbp8 lips3 bjcmono bjcgray bjccmyk 
bjccolor'
-LEXMARK_DEVS='lxm5700m lxm3200 lex2050 lex3200 lex5700 lex7000'
-BROTHER_DEVS='hl7x0 hl1240 hl1250'
-APPLE_DEVS='appledmp iwhi iwlo iwlq'
-IBM_DEVS='ibmpro jetp3852'
-OKI_DEVS='oki182 okiibm oki4w'
-JAPAN_DEVS='lips4 lips4v ljet4pjl lj4dithp dj505j picty180 lips2p bjc880j 
pr201 pr150 pr1000 pr1000_4 jj100 bj10v bj10vh mj700v2c mj500c mj6000c mj8000c 
fmpr fmlbp ml600 lbp310 lbp320 md50Mono md50Eco md1xMono escpage lp2000 npdl 
rpdl'
-MISC_PDEVS='uniprint ap3250 atx23 atx24 atx38 coslw2p coslwxl cp50 declj250 
fs600 imagen lj250 m8510 necp6 oce9050 r4081 sj48 tek4696 t4693d2 t4693d4 
t4693d8 dl2100 la50 la70 la75 la75plus ln03 xes md2k md5k gdi samsunggdi'
-OPVP_DEVS='opvp oprp'
 
 ETS_HALFTONING_DEVS='rinkj'
 
@@ -1389,7 +1379,26 @@ JPEG_DEVS='jpeg jpeggray jpegcmyk'
 PCX_DEVS='pcxmono pcxgray pcx16 pcx256 pcx24b pcxcmyk pcx2up'
 PBM_DEVS='pbm pbmraw pgm pgmraw pgnm pgnmraw pnm pnmraw ppm ppmraw pkm pkmraw 
pksm pksmraw pam pamcmyk4 pamcmyk32 plan plang planm planc plank'
 PS_DEVS='psdf psdcmyk psdrgb pdfwrite pswrite ps2write epswrite psgray psmono 
psrgb bbox txtwrite inkcov'
-MISC_FDEVS='ccr cif inferno mag16 mag256 mgr4 mgr8 mgrgray2 mgrgray4 mgrgray8 
mgrmono miff24 plan9bm sgirgb sunhmono bit bitrgb bitrgbtags bitcmyk devicen 
spotcmyk xcf'
+MISC_FDEVS='miff24 plan9bm bit bitrgb bitrgbtags bitcmyk devicen spotcmyk xcf'
+
+
+
+if test x$enable_contrib != xno; then
+HP_DEVS+=' cdj500 cljet5pr deskjet cdjcolor cdjmono cdj550 pj pjxl pjxl300 
lp2563 paintjet pjetxl cljet5 cljet5c pxlmono pxlcolor cdj670 cdj850 cdj880 
cdj890 cdj970 cdj1600 cdnj500 chp2200 pcl3 hpdjplus hpdjportable hpdj310 
hpdj320 hpdj340 hpdj400 hpdj500 hpdj500c hpdj510 hpdj520 hpdj540 hpdj550c 
hpdj560c hpdj600 hpdj660c hpdj670c hpdj680c hpdj690c hpdj850c hpdj855c hpdj870c 
hpdj890c hpdj1120c lj3100sw djet500 djet500c dnj650c'
+EPSON_DEVS+=' eps9high eps9mid epson epsonc escp lp8000 lq850 photoex 
st800 stcolor'
+CANON_DEVS+=' bj10e bj200 bjc600 bjc800 lbp8 lips3 bjcmono bjcgray bjccmyk 
bjccolor'
+LEXMARK_DEVS+=' lxm5700m lxm3200 lex2050 lex3200 lex5700 lex7000'
+BROTHER_DEVS+=' hl7x0 hl1240 hl1250'
+APPLE_DEVS+=' appledmp iwhi iwlo iwlq'
+IBM_DEVS+=' ibmpro jetp3852'
+OKI_DEVS+=' oki182 okiibm oki4w'
+OPVP_DEVS+=' opvp oprp'
+JAPAN_DEVS+=' ljet4pjl lj4dithp lips2p lips4 lips4v bj10v bj10vh mj700v2c 
mj500c mj6000c mj8000c fmpr fmlbp ml600 lbp310 lbp320 md50Mono md50Eco md1xMono 
escpage lp2000 npdl rpdl bjc880j pr201 pr150 pr1000 pr1000_4 jj100 dj505j 
picty180' 
+MISC_PDEVS+=' uniprint ap3250 atx23 atx24 atx38 coslw2p coslwxl cp50 
declj250 fs600 imagen lj250 m8510 necp6 oce9050 r4081 sj48 tek4696 t4693d2 
t4693d4 t4693d8 dl2100 la50 la70 la75 la75plus ln03 xes md2k md5k gdi 
samsunggdi'
+EPSON_DEVS+=' alc1900 alc2000 alc4000 alc4100 alc8500 alc8600 alc9100 
lp3000c lp8000c lp8200c lp8300c lp8500c lp8800c lp9000c lp9200c lp9500c lp9800c 
lps6500 epl2050 epl2050p epl2120 epl2500 epl2750 epl5800 epl5900 epl6100 
epl6200 lp1800 lp1900 lp2200 lp2400 lp2500 lp7500 lp7700 lp7900 lp8100 lp8300f 
lp8400f lp8600 lp8600f lp8700 lp8900 lp9000b lp9100 lp9200b lp9300 lp9400 
lp9600 lp9600s lps4500 eplcolor eplmono'
+MISC_FDEVS+=' ccr cif inferno mag16 mag256 mgr4 mgr8 mgrgray2 mgrgray4 
mgrgray8 mgrmono sgirgb sunhmono'
+fi
+
 SVGDEV='svgwrite'
 
 while test -n "$drivers"; do
-- 
1.7.10.4




[no subject]

2014-01-12 Thread John Darrington
I've started work on this.  There is more work to be done, but I
have got to the stage where I get a clean build out of source (and
within it).  I've also done the groundwork necessary to get cross
build working, but that is not yet complete.

I'll continue to work on that.  In the meantime, here are the 
patches I've done so far.  Feel free to commit them or not as
you think appropriate, and to discuss any for which you are unsure.

Regards,

J'




[PATCH 03/21] doc/gs-vms.htp: Gnu policy is not to acknowledge trademarks.

2014-01-12 Thread John Darrington
* doc/gs-vms.htp: Remove trademark acknowledgement.
---
 doc/gs-vms.hlp |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/gs-vms.hlp b/doc/gs-vms.hlp
index 235f0b8..d1f6e3c 100644
--- a/doc/gs-vms.hlp
+++ b/doc/gs-vms.hlp
@@ -4,7 +4,7 @@
   Usage:
$ gs [options] [file ...]
 
- Ghostscript is an implementation of Adobe Systems' PostScript (tm)
+ Ghostscript is an implementation of Adobe Systems' PostScript 
  and Portable Document Format (PDF) languages. Gs reads files in sequence
  and executes them as Ghostscript programs. After doing this, it reads
  further input from the standard input stream (normally the keyboard).
-- 
1.7.10.4




[PATCH 06/21] configure: Fix endianess test while cross-compiling

2014-01-12 Thread John Darrington
* configure.ac: Replace ad hoc endianness test with the standard autoconf one
---
 configure.ac |   21 ++---
 1 file changed, 6 insertions(+), 15 deletions(-)

diff --git a/configure.ac b/configure.ac
index 150523e..fe7f6b9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1862,25 +1862,16 @@ AC_CHECK_FUNCS([bzero dup2 floor gettimeofday memchr 
memmove memset mkdir mkfifo
 dnl --
 dnl check for big/little endian for LCMS
 dnl --
+AC_C_BIGENDIAN([BIGENDIAN=1],[BIGENDIAN=0],
+   [AC_MSG_ERROR([Cannot determine endianess])],
+   [AC_MSG_ERROR([Endianess is ambiguous])])
 
-AC_MSG_CHECKING([for big endian])
-
-AC_RUN_IFELSE(
-  [AC_LANG_PROGRAM([#include ], [
-   static const int one = 1;
-   return (*(char*)&one == 0 ? 0 : 1);
-  ])],
-  [LCMS_BIGENDIAN=1],
-  [LCMS_BIGENDIAN=0])
-
-if test "x$LCMS_BIGENDIAN" != "x0"; then
-  LCMS_ENDIAN="-DUSE_BIG_ENDIAN=$LCMS_BIGENDIAN"
-  LCMS2_ENDIAN="-DCMS_USE_BIG_ENDIAN=$LCMS_BIGENDIAN"
-  AC_MSG_RESULT(yes)
+if test "x$BIGENDIAN" != "x0"; then
+  LCMS_ENDIAN="-DUSE_BIG_ENDIAN=$BIGENDIAN"
+  LCMS2_ENDIAN="-DCMS_USE_BIG_ENDIAN=$BIGENDIAN"
 else
   LCMS_ENDIAN=
   LCMS2_ENDIAN=
-  AC_MSG_RESULT(no)
 fi
 
 
-- 
1.7.10.4




[PATCH 18/21] Remove hard coded variables for tools (eg: SHELL).

2014-01-12 Thread John Darrington
These served no purpose except to frustrate users on systems where the
tools are in unusual places.

* base/all-arch.mak base/unixhead.mak: Remove assignments to utility variables.
---
 base/all-arch.mak |   22 --
 base/unixhead.mak |2 --
 2 files changed, 24 deletions(-)

diff --git a/base/all-arch.mak b/base/all-arch.mak
index b44d6a5..f19756a 100644
--- a/base/all-arch.mak
+++ b/base/all-arch.mak
@@ -248,28 +248,6 @@ JSRCDIR= $(SRCDIR)/jpeg
 PNGSRCDIR  = $(SRCDIR)/libpng
 ZSRCDIR= $(SRCDIR)/zlib
 
-# Use this to provide alternate targets to make, instead of the default
-# all.  It can also be used to pass additional arguments to child makes,
-# e.g., -j12 for 12 parallel jobs with GNU make.
-TARGETS=
-
-#===
-
-BINDIR = /usr/local/bin
-
-CHMOD  = chmod
-
-CP = /bin/cp -p
-CP = rcp -p
-
-MV = /bin/mv
-
-RM = /bin/rm -f
-
-SHELL  = /bin/sh
-
-#===
-
 all:
$(MAKE) $(ARGS)
 
diff --git a/base/unixhead.mak b/base/unixhead.mak
index 67b5434..16b31ab 100644
--- a/base/unixhead.mak
+++ b/base/unixhead.mak
@@ -47,10 +47,8 @@ XEAUX=
 
 # Define the current directory prefix and command invocations.
 
-CAT=cat
 D=/
 EXP=
-SHELL=/bin/sh
 SH=$(SHELL)
 
 # Define generic commands.
-- 
1.7.10.4




[PATCH 07/21] Fix test for fontconfig when cross building

2014-01-12 Thread John Darrington
* configure.ac: Replace ad hoc test for fontconfig with one using 
PKG_CHECK_MODULES
---
 configure.ac |   39 +++
 1 file changed, 7 insertions(+), 32 deletions(-)

diff --git a/configure.ac b/configure.ac
index fe7f6b9..d66f06a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,6 +29,9 @@ AC_INIT([gnu-ghostscript], [9.06.0], 
[gnu-ghostscript-...@gnu.org])
 AC_CONFIG_SRCDIR(psi/gs.c)
 AM_INIT_AUTOMAKE([-Wall])
 
+PKG_PROG_PKG_CONFIG
+m4_pattern_forbid([PKG_CHECK_MODULES])
+
 dnl Inherit compiler flags from the environment...
 CFLAGS="${CFLAGS:=}"
 CPPFLAGS="${CPPFLAGS:=}"
@@ -493,39 +496,11 @@ if test x$with_libpaper != xno; then
 CFLAGS="$CFLAGS -DUSE_LIBPAPER"
 fi
 
-dnl Fontconfig support
-HAVE_FONTCONFIG=""
-FONTCONFIG_CFLAGS=""
-FONTCONFIG_LIBS=""
-AC_ARG_ENABLE([fontconfig], AC_HELP_STRING([--disable-fontconfig],
-[Do not use fontconfig to list system fonts]))
-if test "$enable_fontconfig" != "no"; then
-# We MUST NOT use PKG_CHECK_MODULES since it is a) not a standard
-# autoconf macro and b) requires pkg-config on the system, which is
-# NOT standard on ANY OS, including Linux!
-if test "x$PKGCONFIG" != x; then
-AC_MSG_CHECKING(for fontconfig with pkg-config)
-if $PKGCONFIG --exists fontconfig; then
-AC_MSG_RESULT(yes)
-FONTCONFIG_CFLAGS="$CFLAGS `$PKGCONFIG --cflags 
fontconfig`"
-FONTCONFIG_LIBS="`$PKGCONFIG --libs fontconfig`"
-HAVE_FONTCONFIG=-DHAVE_FONTCONFIG
-else
-AC_MSG_RESULT(no)
-fi
-fi
-if test -z "$HAVE_FONTCONFIG"; then
-AC_CHECK_LIB([fontconfig], [FcInitLoadConfigAndFonts], [
-  AC_CHECK_HEADER([fontconfig/fontconfig.h], [
-FONTCONFIG_LIBS="-lfontconfig"
-HAVE_FONTCONFIG="-DHAVE_FONTCONFIG"
-  ])
-])
-fi
-fi
+PKG_CHECK_MODULES([FONTCONFIG], [fontconfig], 
+   [HAVE_FONTCONFIG="-DHAVE_FONTCONFIG"],
+   [AC_MSG_ERROR([fontconfig must be installed])])
+
 AC_SUBST(HAVE_FONTCONFIG)
-AC_SUBST(FONTCONFIG_CFLAGS)
-AC_SUBST(FONTCONFIG_LIBS)
 
 dnl DBus support
 HAVE_DBUS=""
-- 
1.7.10.4