[cairo-commit] 6 commits - configure.in src/cairo-ft-font.c

Behdad Esfahbod behdad at kemper.freedesktop.org
Thu Aug 10 10:11:10 PDT 2006


 configure.in        |   60 +++++++++++++++++++++++++---------------------------
 src/cairo-ft-font.c |    3 ++
 2 files changed, 32 insertions(+), 31 deletions(-)

New commits:
diff-tree 1af80b70c08654faeb9c6d041d37ca10d6008fe5 (from d1520a99d4f9be9206cfcb5febb606eaeb4ccaa9)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Aug 10 13:10:24 2006 -0400

    Test for libz only once and reuse result for PS and PDF
    This causes configure to check for libz even if PS/PDF are disabled
    or their results is already cached.  But that's not much of a problem
    as if the cache is enabled, libz results are cached too.

diff --git a/configure.in b/configure.in
index 7383f69..c6b6f31 100644
--- a/configure.in
+++ b/configure.in
@@ -77,9 +77,13 @@ dnl ====================================
 AC_CHECK_FUNCS(vasnprintf)
 	
 AC_CHECK_LIBM
-
 LIBS="$LIBS $LIBM"
 
+AC_CHECK_LIB(z, compress,
+	 [AC_CHECK_HEADER(zlib.h, [have_libz=yes],
+	 [have_libz="no (requires zlib http://www.gzip.org/zlib/)"])],
+	 [have_libz="no (requires zlib http://www.gzip.org/zlib/)"])
+
 dnl ===========================================================================
 
 PKG_PROG_PKG_CONFIG
@@ -460,10 +464,7 @@ dnl ====================================
 
 CAIRO_BACKEND_ENABLE(ps, PostScript, ps, PS_SURFACE, auto, [
     # The postscript backend requires zlib.
-    AC_CHECK_LIB(z, compress,
-                 [AC_CHECK_HEADER(zlib.h, [],
-		 [use_ps="no (requires zlib http://www.gzip.org/zlib/)"])],
-		 [use_ps="no (requires zlib http://www.gzip.org/zlib/)"])
+    use_ps=$have_libz
     ps_NONPKGCONFIG_LIBS=-lz
 ])
 
@@ -471,10 +472,7 @@ dnl ====================================
 
 CAIRO_BACKEND_ENABLE(pdf, PDF, pdf, PDF_SURFACE, auto, [
     # The pdf backend requires zlib.
-    AC_CHECK_LIB(z, compress,
-                 [AC_CHECK_HEADER(zlib.h, [],
-		 [use_pdf="no (requires zlib http://www.gzip.org/zlib/)"])],
-		 [use_pdf="no (requires zlib http://www.gzip.org/zlib/)"])
+    use_pdf=$have_libz
     pdf_NONPKGCONFIG_LIBS=-lz
 ])
 
diff-tree d1520a99d4f9be9206cfcb5febb606eaeb4ccaa9 (from aea83b908d020e26732753830bb3056e6702a774)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Aug 10 13:05:26 2006 -0400

    Remove the ft_load_sfnt_table check from PS/PDF/SVG backends
    and make sure that _cairo_ft_load_truetype_table returns UNSUPPORTED
    if the version of FreeType used doesn't support FT_Load_Sfnt_Table.

diff --git a/configure.in b/configure.in
index 2b8f22e..7383f69 100644
--- a/configure.in
+++ b/configure.in
@@ -432,8 +432,6 @@ CAIRO_BACKEND_ENABLE(ft, FreeType font, 
   ft_LIBS="$FREETYPE_LIBS $FONTCONFIG_LIBS"
 ])
 
-have_ft_load_sfnt_table=no
-
 if test "x$use_ft" = "xyes"; then
   temp_save_libs="$LIBS"
   temp_save_cflags="$CFLAGS"
@@ -447,8 +445,7 @@ if test "x$use_ft" = "xyes"; then
   AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,$HAVE_FT_BITMAP_SIZE_Y_PPEM,
                      [FT_Bitmap_Size structure includes y_ppem field])
 
-  AC_CHECK_FUNC(FT_Load_Sfnt_Table, have_ft_load_sfnt_table=yes)
-  AC_CHECK_FUNCS(FT_GlyphSlot_Embolden)
+  AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
 
   LIBS="$temp_save_libs"
   CFLAGS="$temp_save_cflags"
@@ -462,31 +459,23 @@ AM_CONDITIONAL(HAVE_PTHREAD, test "x$hav
 dnl ===========================================================================
 
 CAIRO_BACKEND_ENABLE(ps, PostScript, ps, PS_SURFACE, auto, [
-  if test x"$have_ft_load_sfnt_table" != "xyes" ; then
-    use_ps="no (requires FreeType 2.1.4 or newer)"
-  else
     # The postscript backend requires zlib.
     AC_CHECK_LIB(z, compress,
                  [AC_CHECK_HEADER(zlib.h, [],
 		 [use_ps="no (requires zlib http://www.gzip.org/zlib/)"])],
 		 [use_ps="no (requires zlib http://www.gzip.org/zlib/)"])
     ps_NONPKGCONFIG_LIBS=-lz
-  fi
 ])
 
 dnl ===========================================================================
 
 CAIRO_BACKEND_ENABLE(pdf, PDF, pdf, PDF_SURFACE, auto, [
-  if test x"$have_ft_load_sfnt_table" != "xyes" ; then
-    use_pdf="no (requires FreeType 2.1.4 or newer)"
-  else
     # The pdf backend requires zlib.
     AC_CHECK_LIB(z, compress,
                  [AC_CHECK_HEADER(zlib.h, [],
 		 [use_pdf="no (requires zlib http://www.gzip.org/zlib/)"])],
 		 [use_pdf="no (requires zlib http://www.gzip.org/zlib/)"])
     pdf_NONPKGCONFIG_LIBS=-lz
-  fi
 ])
 
 test_pdf=no
@@ -508,9 +497,6 @@ AM_CONDITIONAL(CAIRO_HAS_MULTI_PAGE_SURF
 dnl ===========================================================================
 
 CAIRO_BACKEND_ENABLE(svg, SVG, svg, SVG_SURFACE, auto, [
-  if test x"$have_ft_load_sfnt_table" != "xyes" ; then
-    use_svg="no (requires FreeType 2.1.4 or newer)"
-  fi
 ])
 
 if test "x$use_svg" = "xyes"; then
diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index 3091767..be9db5b 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -2012,6 +2012,7 @@ _cairo_ft_load_truetype_table (void	    
     if (_cairo_ft_scaled_font_is_vertical (&scaled_font->base))
         return CAIRO_INT_STATUS_UNSUPPORTED;
 
+#if HAVE_FT_LOAD_SFNT_TABLE
     face = _cairo_ft_unscaled_font_lock_face (unscaled);
     if (!face)
 	return CAIRO_STATUS_NO_MEMORY;
@@ -2021,6 +2022,8 @@ _cairo_ft_load_truetype_table (void	    
         status = CAIRO_STATUS_SUCCESS;
 
     _cairo_ft_unscaled_font_unlock_face (unscaled);
+#endif
+
     return status;
 }
 
diff-tree aea83b908d020e26732753830bb3056e6702a774 (from dc8da1ca06971677e203718db1429f82fe3f05bd)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Aug 10 12:47:47 2006 -0400

    Fix typos in configure.in for PS/PDF/SVG backends

diff --git a/configure.in b/configure.in
index 014683a..2b8f22e 100644
--- a/configure.in
+++ b/configure.in
@@ -461,7 +461,7 @@ AM_CONDITIONAL(HAVE_PTHREAD, test "x$hav
 
 dnl ===========================================================================
 
-CAIRO_BACKEND_ENABLE(ps, PostScript, ps, PS_SURFACE, auto, [], [
+CAIRO_BACKEND_ENABLE(ps, PostScript, ps, PS_SURFACE, auto, [
   if test x"$have_ft_load_sfnt_table" != "xyes" ; then
     use_ps="no (requires FreeType 2.1.4 or newer)"
   else
@@ -476,15 +476,15 @@ CAIRO_BACKEND_ENABLE(ps, PostScript, ps,
 
 dnl ===========================================================================
 
-CAIRO_BACKEND_ENABLE(pdf, PDF, pdf, PDF_SURFACE, auto, [], [
+CAIRO_BACKEND_ENABLE(pdf, PDF, pdf, PDF_SURFACE, auto, [
   if test x"$have_ft_load_sfnt_table" != "xyes" ; then
     use_pdf="no (requires FreeType 2.1.4 or newer)"
   else
     # The pdf backend requires zlib.
     AC_CHECK_LIB(z, compress,
                  [AC_CHECK_HEADER(zlib.h, [],
-		 [use_ps="no (requires zlib http://www.gzip.org/zlib/)"])],
-		 [use_ps="no (requires zlib http://www.gzip.org/zlib/)"])
+		 [use_pdf="no (requires zlib http://www.gzip.org/zlib/)"])],
+		 [use_pdf="no (requires zlib http://www.gzip.org/zlib/)"])
     pdf_NONPKGCONFIG_LIBS=-lz
   fi
 ])
@@ -507,7 +507,7 @@ AM_CONDITIONAL(CAIRO_HAS_MULTI_PAGE_SURF
 
 dnl ===========================================================================
 
-CAIRO_BACKEND_ENABLE(svg, SVG, svg, SVG_SURFACE, auto, [], [
+CAIRO_BACKEND_ENABLE(svg, SVG, svg, SVG_SURFACE, auto, [
   if test x"$have_ft_load_sfnt_table" != "xyes" ; then
     use_svg="no (requires FreeType 2.1.4 or newer)"
   fi
diff-tree dc8da1ca06971677e203718db1429f82fe3f05bd (from 6d0e3260444a2d5b6fb0cb223ac79f1c0e7b3a6e)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Aug 10 12:47:11 2006 -0400

    Save configure cache after checking all backends
    This makes sure that backend enabling results are cached even
    if a later test in configure fails.

diff --git a/configure.in b/configure.in
index 5cb0c67..014683a 100644
--- a/configure.in
+++ b/configure.in
@@ -537,6 +537,10 @@ CAIRO_BACKEND_ENABLE(atsui, ATSUI font, 
 ])
 
 dnl ===========================================================================
+dnl dump backend checking results
+AC_CACHE_SAVE
+
+dnl ===========================================================================
 dnl Checks for precise integer types
 AC_CHECK_HEADERS([stdint.h inttypes.h sys/int_types.h])
 AC_CHECK_TYPES([uint64_t, uint128_t])
diff-tree 6d0e3260444a2d5b6fb0cb223ac79f1c0e7b3a6e (from 24374ad61379273945cda913884b562513d86ed2)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Aug 10 12:45:35 2006 -0400

    Don't link to -lm unconditionally in cairo.pc
    Reuse $LIBM results.

diff --git a/configure.in b/configure.in
index 740384b..5cb0c67 100644
--- a/configure.in
+++ b/configure.in
@@ -209,7 +209,7 @@ AC_DEFUN([CAIRO_BACKEND_ENABLE],
 CAIRO_FEATURES=""
 CAIRO_REQUIRES=""
 CAIRO_NONPKGCONFIG_CFLAGS=""
-CAIRO_NONPKGCONFIG_LIBS="-lm"
+CAIRO_NONPKGCONFIG_LIBS="$LIBM"
 CAIRO_CFLAGS=$CAIRO_NONPKGCONFIG_CFLAGS
 CAIRO_LIBS=$CAIRO_NONPKGCONFIG_LIBS
 
diff-tree 24374ad61379273945cda913884b562513d86ed2 (from c3c706873ef6a0e1318b1d4b4d4b6841758ea18d)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Aug 10 12:44:35 2006 -0400

    Implement configure cache versioning for backend enabling results
    such that removing config.cache is not needed as frequently as it
    is currently.  We just detect and stale the cache results for our
    own backends.  If the user installs missing libraries, they still
    need to remove the cache manually.
    
    Note that everytime a change is made to configure.in and may change
    the results of at least one CAIRO_BACKEND_ENABLE call, the
    cairo_cache_version number should be increased.

diff --git a/configure.in b/configure.in
index 9adcef6..740384b 100644
--- a/configure.in
+++ b/configure.in
@@ -86,6 +86,14 @@ PKG_PROG_PKG_CONFIG
 
 dnl ===========================================================================
 dnl
+dnl cairo_cache_version should be increased every time that the backend
+dnl detection stuff changes in a way that removing the config.cache file may be
+dnl needed for correct operation.
+dnl
+m4_define(cairo_cache_version, 1)
+
+dnl ===========================================================================
+dnl
 dnl Define a macro to enable backends.
 dnl  - Macro: CAIRO_BACKEND_ENABLE (NAMESPACE, NAME, ARG, FEATURE_NAME, DEFAULT, COMMANDS)
 dnl
@@ -99,8 +107,6 @@ dnl	DEFAULT is the default state of the 
 dnl		"no" for experimental backends, eg. your favorite new backend
 dnl		"yes" for mandatory backends, eg. png
 dnl		"auto" for other supported backends, eg. xlib
-dnl	REQUIRES is the list of pkg-config modules that should be Require'd in the
-dnl		backend-specific .pc file.
 dnl	COMMANDS are run to check whether the backend can be enabled.  Their
 dnl		result may be cached, so user should not count on them being run.
 dnl		They should set use_$(NAMESPACE) to something other than yes if the
@@ -117,6 +123,10 @@ AC_DEFUN([CAIRO_BACKEND_ENABLE],
 	  if test "x$enable_$1" = xno; then
 	    use_$1="no (disabled, use --enable-$3 to enable)"
 	  else
+	    if test "x$cairo_cv_backend_[]$1[]_cache_version" != "x[]cairo_cache_version"; then
+	      # cached results for this backend (if any) are stale.  force rechecking.
+	      unset cairo_cv_backend_[]$1[]_use
+	    fi
             AC_CACHE_CHECK([for cairo's $2 backend], cairo_cv_backend_[]$1[]_use,
 	    		   [echo
 			    use_[]$1=yes
@@ -128,6 +138,7 @@ AC_DEFUN([CAIRO_BACKEND_ENABLE],
 			    $1[]_BASE=cairo
 			    $6
 			    cairo_cv_backend_[]$1[]_use=$use_[]$1
+			    cairo_cv_backend_[]$1[]_cache_version=cairo_cache_version
 			    cairo_cv_backend_[]$1[]_requires=$[]$1[]_REQUIRES
 			    cairo_cv_backend_[]$1[]_cflags=$[]$1[]_CFLAGS
 			    cairo_cv_backend_[]$1[]_libs=$[]$1[]_LIBS
@@ -136,7 +147,6 @@ AC_DEFUN([CAIRO_BACKEND_ENABLE],
 			    cairo_cv_backend_[]$1[]_base=$[]$1[]_BASE
 			    AC_MSG_CHECKING([whether cairo's $2 backend could be enabled])])
 
-	    # split the backend spec into its components
 	    use_[]$1=$cairo_cv_backend_[]$1[]_use
 	    $1[]_BASE=$cairo_cv_backend_[]$1[]_base
 


More information about the cairo-commit mailing list