[cairo-commit] 2 commits - configure.in src/cairo-features.h.in src/Makefile.am test/.gitignore test/Makefile.am

Behdad Esfahbod behdad at kemper.freedesktop.org
Wed Jun 21 04:05:44 PDT 2006


 configure.in            |  291 ++++++++++++++++++++++++------------------------
 src/Makefile.am         |    2 
 src/cairo-features.h.in |   86 --------------
 test/.gitignore         |    1 
 test/Makefile.am        |    3 
 5 files changed, 151 insertions(+), 232 deletions(-)

New commits:
diff-tree f71313d427565cb37a25393ff8a5a2ffdcfb798b (from c88bab66ab258e0bbd2cb80eaf4edc9e5f1ad6f0)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Jun 21 07:00:34 2006 -0400

    Minor refinements, mostly to configure.in.

diff --git a/configure.in b/configure.in
index 9f06119..3feeca0 100644
--- a/configure.in
+++ b/configure.in
@@ -87,30 +87,41 @@ PKG_PROG_PKG_CONFIG
 dnl ===========================================================================
 dnl
 dnl Define a macro to enable backends.
-dnl  - Macro: CAIRO_BACKEND_ENABLE (ID, NAME, NAMESPACE, FEATURE, DEFAULT, REQUIRES, COMMANDS-TO-CHECK-IT)
+dnl  - Macro: CAIRO_BACKEND_ENABLE (NAMESPACE, NAME, ARG, FEATURE_NAME, DEFAULT, REQUIRES, COMMANDS)
 dnl
-dnl Where COMMANDS should set $use_ID to something other than yes if the
-dnl backend cannot be built.
+dnl where:
 dnl
-dnl Check the CAIRO_BACKEND_ENABLE line for fontconfig to understand each
-dnl parameter.
+dnl	NAMESPACE is the sub-namespace in function names, eg. "ft" for cairo_ft_...
+dnl	NAME is the human-readable name of the backend, eg. "FreeType font"
+dnl	ARG is what enables the backend, eg. "freetype" for --enable-freetype
+dnl	FEATURE_NAME is what's used in cairo-features.h, eg. FT_FONT for CAIRO_HAS_FT_FONT
+dnl	DEFAULT is the default state of the backend:
+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
+dnl		backend cannot be built, eg. "no (requires SomeThing)"
 dnl
 AC_DEFUN([CAIRO_BACKEND_ENABLE],
-         [AC_ARG_ENABLE([$1],
-                         AS_HELP_STRING([--enable-$1=@<:@no/auto/yes@:>@],
-                                        [Enable cairo's $2 backend @<:@default=$3@:>@]),
+         [AC_ARG_ENABLE([$3],
+                         AS_HELP_STRING([--enable-$3=@<:@no/auto/yes@:>@],
+                                        [Enable cairo's $2 backend @<:@default=$5@:>@]),
                          use_$1=$enableval, use_$1=$5)
 	  if test "x$use_$1" = xno; then
-	    use_$1="no (disabled, use --enable-$1 to enable)"
+	    use_$1="no (disabled, use --enable-$3 to enable)"
 	  else
-            AC_CACHE_CHECK([for cairo's $1 backend], cairo_cv_use_$1,
+            AC_CACHE_CHECK([for cairo's $2 backend], cairo_cv_use_$1,
 	    		   [echo
 			    saved_use_$1=$use_$1
 			    use_$1=yes
 			    $7
 			    cairo_cv_use_$1=$use_$1
 			    use_$1=$saved_use_$1
-			    AC_MSG_CHECKING([whether cairo's $1 backend could be enabled])])
+			    AC_MSG_CHECKING([whether cairo's $2 backend could be enabled])])
 	    case $use_$1 in
 	      yes)
 	        if test "x$cairo_cv_use_$1" = xyes; then
@@ -123,15 +134,16 @@ AC_DEFUN([CAIRO_BACKEND_ENABLE],
 	        use_$1=$cairo_cv_use_$1
 		;;
 	      *)
-	        AC_MSG_ERROR([invalid argument passed to --enable-$1: $use_$1, should be one of @<:@no/auto/yes@:>@])
+	        AC_MSG_ERROR([invalid argument passed to --enable-$3: $use_$1, should be one of @<:@no/auto/yes@:>@])
 		;;
 	    esac
 	    if test "x$use_$1" = xyes; then
 	      CAIRO_FEATURES="$CAIRO_FEATURES $4"
-	      AC_MSG_NOTICE([creating src/cairo-$3.pc])
+	      outfile=`echo src/cairo-$1.pc | sed -e s/_/-/g`
+	      AC_MSG_NOTICE([creating $outfile])
 	      mkdir -p src
 	      AS_IF([sed \
-			-e "s/@backend_name@/$3/g" \
+			-e "s/@backend_name@/$1/g" \
 			-e "s/@Backend_Name@/$2/g" \
 			-e "s/@BACKEND_REQUIRES@/$6/g" \
 			-e "s, at prefix@,$prefix,g" \
@@ -139,9 +151,9 @@ AC_DEFUN([CAIRO_BACKEND_ENABLE],
 			-e "s, at libdir@,$libdir,g" \
 			-e "s, at includedir@,$includedir,g" \
 			-e "s, at VERSION@,$VERSION,g" \
-	               $srcdir/src/cairo-backend.pc.in > src/cairo-$3.pc],,[
-		rm -f "src/cairo-$3.pc"
-		AC_MSG_ERROR([failed creating src/cairo-$3.pc])
+	               $srcdir/src/cairo-backend.pc.in > $outfile],,[
+		rm -f "$outfile"
+		AC_MSG_ERROR([failed creating $outfile])
 	      ])
 	    fi
 	  fi
@@ -172,7 +184,7 @@ dnl ====================================
 
 CAIRO_BACKEND_ENABLE(quartz, Quartz, quartz, QUARTZ_SURFACE, no, [], [
   dnl There is no pkgconfig for quartz; lets do a header check
-  AC_CHECK_HEADER(Carbon/Carbon.h, [use_quartz=yes], [use_quartz="no (Carbon headers not found)"])
+  AC_CHECK_HEADER(Carbon/Carbon.h, , [use_quartz="no (Carbon headers not found)"])
   QUARTZ_LIBS="-Xlinker -framework -Xlinker Carbon"
 ])
 
@@ -181,7 +193,7 @@ CAIRO_LIBS="$CAIRO_LIBS $QUARTZ_LIBS"
 dnl ===========================================================================
 
 CAIRO_BACKEND_ENABLE(xcb, XCB, xcb, XCB_SURFACE, no, [xcb xcb-render], [
-  PKG_CHECK_MODULES(XCB, xcb xcb-render, [use_xcb=yes], [
+  PKG_CHECK_MODULES(XCB, xcb xcb-render, , [
   use_xcb="no (requires XCB http://xcb.freedesktop.org)"])
 ])
 
@@ -203,10 +215,10 @@ esac
 CAIRO_BACKEND_ENABLE(win32, Microsoft Windows, win32, WIN32_SURFACE, auto, [], [
   case "$host" in
     *-*-mingw*|*-*-cygwin*)
-      use_win32=yes
+      :
       ;;
     *)
-      use_win32="no (the Microsoft Windows backend requires a Win32 platform)"
+      use_win32="no (requires a Win32 platform)"
       ;;
   esac
 ])
@@ -216,7 +228,7 @@ if test "x$use_win32" = "xyes"; then
    CAIRO_LIBS="$CAIRO_LIBS -lgdi32 -lmsimg32"
 fi
 
-CAIRO_BACKEND_ENABLE(win32_font, Microsoft Windows Fonts, win32-font, WIN32_FONT, auto, [], [
+CAIRO_BACKEND_ENABLE(win32_font, Microsoft Windows font, win32-font, WIN32_FONT, auto, [], [
       use_win32_font=$use_win32
 ])
 
@@ -227,10 +239,10 @@ dnl ====================================
 CAIRO_BACKEND_ENABLE(beos, BeOS/Zeta, beos, BEOS_SURFACE, no, [], [
   case "$host" in
     *-*-beos)
-      use_beos=yes
+      :
       ;;
     *)
-      use_beos="no (the BeOS backend requires a BeOS platform)"
+      use_beos="no (requires a BeOS platform)"
       ;;
   esac
 ])
@@ -277,21 +289,21 @@ AC_SUBST(PNG_REQUIRES)
 
 dnl ===========================================================================
 
+GLITZ_MIN_VERSION=0.5.1
 CAIRO_BACKEND_ENABLE(glitz, glitz, glitz, GLITZ_SURFACE, no, [glitz], [
-  PKG_CHECK_MODULES(GLITZ, glitz >= 0.5.1, [
-    GLITZ_REQUIRES=glitz
-    use_glitz=yes], [use_glitz="no (requires glitz http://freedesktop.org/Software/glitz)"])
+  PKG_CHECK_MODULES(GLITZ, glitz >= $GLITZ_MIN_VERSION, [
+    GLITZ_REQUIRES=glitz], [use_glitz="no (requires glitz http://freedesktop.org/Software/glitz)"])
 ])
 
 if test "x$use_glitz" = "xyes";then
-  PKG_CHECK_MODULES(GLITZ_AGL, glitz-agl >= 0.5.1,
-   [have_glitz_agl=yes], [have_glitz_agl=no])
-  PKG_CHECK_MODULES(GLITZ_EGL, glitz-egl >= 0.5.1,
-   [have_glitz_egl=yes], [have_glitz_egl=no])
-  PKG_CHECK_MODULES(GLITZ_GLX, glitz-glx >= 0.5.1,
-   [have_glitz_glx=yes], [have_glitz_glx=no])
-  PKG_CHECK_MODULES(GLITZ_WGL, glitz-wgl >= 0.5.1,
-   [have_glitz_wgl=yes], [have_glitz_wgl=no])
+  PKG_CHECK_MODULES(GLITZ_AGL, glitz-agl >= $GLITZ_MIN_VERSION,
+   [have_glitz_agl=yes], [have_glitz_agl=no; echo $MYSTUFF_PKG_ERRORS])
+  PKG_CHECK_MODULES(GLITZ_EGL, glitz-egl >= $GLITZ_MIN_VERSION,
+   [have_glitz_egl=yes], [have_glitz_egl=no; echo $MYSTUFF_PKG_ERRORS])
+  PKG_CHECK_MODULES(GLITZ_GLX, glitz-glx >= $GLITZ_MIN_VERSION,
+   [have_glitz_glx=yes], [have_glitz_glx=no; echo $MYSTUFF_PKG_ERRORS])
+  PKG_CHECK_MODULES(GLITZ_WGL, glitz-wgl >= $GLITZ_MIN_VERSION,
+   [have_glitz_wgl=yes], [have_glitz_wgl=no; echo $MYSTUFF_PKG_ERRORS])
 
   if test "x$have_glitz_agl" = "xyes";then
     AC_DEFINE(CAIRO_CAN_TEST_GLITZ_AGL_SURFACE, 1, [define if glitz backend can be tested against agl])
@@ -320,7 +332,7 @@ AC_SUBST(GLITZ_REQUIRES)
 dnl ===========================================================================
 
 CAIRO_BACKEND_ENABLE(directfb, directfb, directfb, DIRECTFB_SURFACE, no, [directfb], [
-  PKG_CHECK_MODULES(DIRECTFB, directfb, [use_directfb=yes], [
+  PKG_CHECK_MODULES(DIRECTFB, directfb, , [
   use_directfb="no (requires directfb http://www.directfb.org)"])
 ])
 
@@ -329,9 +341,8 @@ CAIRO_LIBS="$CAIRO_LIBS $DIRECTFB_LIBS"
 
 dnl ===========================================================================
 
-CAIRO_BACKEND_ENABLE(freetype, freetype font, ft, FT_FONT, auto, [freetype2 fontconfig], [
-  PKG_CHECK_MODULES(FONTCONFIG, fontconfig, 
-                    [use_freetype=yes], [use_freetype=no])
+CAIRO_BACKEND_ENABLE(ft, FreeType font, freetype, FT_FONT, auto, [freetype2 fontconfig], [
+  PKG_CHECK_MODULES(FONTCONFIG, fontconfig, , [use_ft=no])
   _CHECK_FUNCS_WITH_FLAGS(FcFini, $FONTCONFIG_CFLAGS, $FONTCONFIG_LIBS)
 ])
 
@@ -344,7 +355,7 @@ CAIRO_LIBS="$CAIRO_LIBS $FONTCONFIG_LIBS
 # Requires.private, but at least up to 2003-06-07, there was no
 # freetype2.pc in the release.
 #
-# Freetype versions come in three forms:
+# FreeType versions come in three forms:
 #   release (such as 2.1.5)
 #   libtool (such as 9.4.3) (returned by freetype-config and pkg-config)
 #   platform-specific/soname (such as 6.3.4)
@@ -358,7 +369,7 @@ FREETYPE_MIN_RELEASE=2.1.0
 # libtool-specific version - this is what is checked
 FREETYPE_MIN_VERSION=8.0.2
 
-if test "x$use_freetype" = "xyes"; then
+if test "x$use_ft" = "xyes"; then
 
   PKG_CHECK_MODULES(FREETYPE, freetype2 >= $FREETYPE_MIN_VERSION,
                     [freetype_pkgconfig=yes], [freetype_pkgconfig=no])
@@ -374,7 +385,7 @@ if test "x$use_freetype" = "xyes"; then
     fi
     if test "$FREETYPE_CONFIG" = "no" ; then
       AC_MSG_WARN([No freetype-config script found in path or FREETYPE_CONFIG])
-      use_freetype=no
+      use_ft=no
     else
       AC_MSG_CHECKING(freetype2 libtool version)
   
@@ -385,7 +396,7 @@ if test "x$use_freetype" = "xyes"; then
       if test $VERSION_DEC -lt $MIN_VERSION_DEC; then
         AC_MSG_RESULT($FREETYPE_VERSION - Too old)
         AC_MSG_WARN([$FREETYPE_VERSION - version $FREETYPE_MIN_VERSION from release $FREETYPE_MIN_RELEASE required])
-        use_freetype=no
+        use_ft=no
       else
         AC_MSG_RESULT($FREETYPE_VERSION - OK)
 	
@@ -401,7 +412,7 @@ fi
 
 have_ft_load_sfnt_table=no
 
-if test "x$use_freetype" = "xyes"; then
+if test "x$use_ft" = "xyes"; then
   AC_SUBST(FREETYPE_CFLAGS)
   AC_SUBST(FREETYPE_LIBS)
   AC_SUBST(FREETYPE_CONFIG_CFLAGS)
@@ -439,7 +450,7 @@ dnl ====================================
 
 CAIRO_BACKEND_ENABLE(ps, PostScript, ps, PS_SURFACE, auto, [], [
   if test x"$have_ft_load_sfnt_table" != "xyes" ; then
-    use_ps="no (PS backend requires FreeType 2.1.4 or newer)"
+    use_ps="no (requires FreeType 2.1.4 or newer)"
   fi
 ])
 
@@ -461,7 +472,7 @@ dnl ====================================
 
 CAIRO_BACKEND_ENABLE(pdf, PDF, pdf, PDF_SURFACE, auto, [], [
   if test x"$have_ft_load_sfnt_table" != "xyes" ; then
-    use_pdf="no (PDF backend requires FreeType 2.1.4 or newer)"
+    use_pdf="no (requires FreeType 2.1.4 or newer)"
   fi
 ])
 
@@ -490,7 +501,7 @@ dnl ====================================
 
 CAIRO_BACKEND_ENABLE(svg, SVG, svg, SVG_SURFACE, auto, [], [
   if test x"$have_ft_load_sfnt_table" != "xyes" ; then
-    use_svg="no (SVG backend requires FreeType 2.1.4 or newer)"
+    use_svg="no (requires FreeType 2.1.4 or newer)"
   fi
 ])
 
@@ -512,9 +523,9 @@ dnl ====================================
 dnl This check should default to 'auto' once we have code to actually
 dnl check for the atsui font backend.
 
-CAIRO_BACKEND_ENABLE(atsui, atsui font, atsui, ATSUI_FONT, no, [], [
+CAIRO_BACKEND_ENABLE(atsui, ATSUI font, atsui, ATSUI_FONT, no, [], [
   dnl There is no pkgconfig for atsui; lets do a header check
-  AC_CHECK_HEADER(Carbon/Carbon.h, [use_atsui=yes], [use_atsui=no])
+  AC_CHECK_HEADER(Carbon/Carbon.h, , [use_atsui=no])
 ])
 
 dnl ===========================================================================
@@ -747,7 +758,7 @@ echo "  BeOS:       $use_beos"
 echo "  DirectFB:   $use_directfb"
 echo ""
 echo "the following font backends:"
-echo "  FreeType:   $use_freetype"
+echo "  FreeType:   $use_ft"
 echo "  Win32:      $use_win32_font"
 echo "  ATSUI:      $use_atsui"
 echo ""
@@ -762,7 +773,7 @@ echo "using CFLAGS:"
 echo $CAIRO_CFLAGS
 echo ""
 
-if test x"$use_freetype"   != "xyes" && \
+if test x"$use_ft"         != "xyes" && \
    test x"$use_win32_font" != "xyes" && \
    test x"$use_atsui"      != "xyes" ; then
 
diff --git a/test/.gitignore b/test/.gitignore
index 08059b7..115762b 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -2,6 +2,7 @@
 .libs
 Makefile
 Makefile.in
+index.html
 a8-mask
 bitmap-font
 caps-joins
diff --git a/test/Makefile.am b/test/Makefile.am
index 374206a..a9d3c12 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -372,7 +372,8 @@ CLEANFILES =					\
 	pdf-features.pdf			\
 	ps-features.ps				\
 	svg-surface.svg				\
-	svg-clip.svg
+	svg-clip.svg				\
+	index.html
 
 check-valgrind:
 	TESTS_ENVIRONMENT="libtool --mode=execute valgrind --tool=memcheck --suppressions=./.valgrind-suppressions --leak-check=yes --show-reachable=yes" $(MAKE) check 2>&1 | tee valgrind.log
diff-tree c88bab66ab258e0bbd2cb80eaf4edc9e5f1ad6f0 (from c6c1da2a2346de6c1df82fab2e7bafec7f37db50)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Jun 21 06:25:01 2006 -0400

    Make configure generate cairo-features.h. Generate AC_DEFINE and AM_CONDITIONALS
    
    for all CAIRO_HAS_*  in CAIRO_BACKEND_ENABLE.

diff --git a/configure.in b/configure.in
index 2cf3622..9f06119 100644
--- a/configure.in
+++ b/configure.in
@@ -44,7 +44,6 @@ CAIRO_VERSION_MICRO=cairo_version_micro(
 AC_SUBST(CAIRO_VERSION_MAJOR)
 AC_SUBST(CAIRO_VERSION_MINOR)
 AC_SUBST(CAIRO_VERSION_MICRO)
-AC_SUBST(CAIRO_VERSION_OTHER)
 
 AM_MAINTAINER_MODE
 
@@ -88,7 +87,7 @@ PKG_PROG_PKG_CONFIG
 dnl ===========================================================================
 dnl
 dnl Define a macro to enable backends.
-dnl  - Macro: CAIRO_BACKEND_ENABLE (ID, NAME, DEFAULT, NAMESPACE, REQUIRES, COMMANDS-TO-CHECK-IT)
+dnl  - Macro: CAIRO_BACKEND_ENABLE (ID, NAME, NAMESPACE, FEATURE, DEFAULT, REQUIRES, COMMANDS-TO-CHECK-IT)
 dnl
 dnl Where COMMANDS should set $use_ID to something other than yes if the
 dnl backend cannot be built.
@@ -100,7 +99,7 @@ AC_DEFUN([CAIRO_BACKEND_ENABLE],
          [AC_ARG_ENABLE([$1],
                          AS_HELP_STRING([--enable-$1=@<:@no/auto/yes@:>@],
                                         [Enable cairo's $2 backend @<:@default=$3@:>@]),
-                         use_$1=$enableval, use_$1=$3)
+                         use_$1=$enableval, use_$1=$5)
 	  if test "x$use_$1" = xno; then
 	    use_$1="no (disabled, use --enable-$1 to enable)"
 	  else
@@ -108,7 +107,7 @@ AC_DEFUN([CAIRO_BACKEND_ENABLE],
 	    		   [echo
 			    saved_use_$1=$use_$1
 			    use_$1=yes
-			    $6
+			    $7
 			    cairo_cv_use_$1=$use_$1
 			    use_$1=$saved_use_$1
 			    AC_MSG_CHECKING([whether cairo's $1 backend could be enabled])])
@@ -128,27 +127,32 @@ AC_DEFUN([CAIRO_BACKEND_ENABLE],
 		;;
 	    esac
 	    if test "x$use_$1" = xyes; then
-	      AC_MSG_NOTICE([creating src/cairo-$4.pc])
-	      mkdir src
+	      CAIRO_FEATURES="$CAIRO_FEATURES $4"
+	      AC_MSG_NOTICE([creating src/cairo-$3.pc])
+	      mkdir -p src
 	      AS_IF([sed \
-			-e "s/@backend_name@/$4/g" \
+			-e "s/@backend_name@/$3/g" \
 			-e "s/@Backend_Name@/$2/g" \
-			-e "s/@BACKEND_REQUIRES@/$5/g" \
+			-e "s/@BACKEND_REQUIRES@/$6/g" \
 			-e "s, at prefix@,$prefix,g" \
 			-e "s, at exec_prefix@,$exec_prefix,g" \
 			-e "s, at libdir@,$libdir,g" \
 			-e "s, at includedir@,$includedir,g" \
 			-e "s, at VERSION@,$VERSION,g" \
-	               $srcdir/src/cairo-backend.pc.in > src/cairo-$4.pc],,[
-		rm -f "src/cairo-$4.pc"
-		AC_MSG_ERROR([failed creating src/cairo-$4.pc])
+	               $srcdir/src/cairo-backend.pc.in > src/cairo-$3.pc],,[
+		rm -f "src/cairo-$3.pc"
+		AC_MSG_ERROR([failed creating src/cairo-$3.pc])
 	      ])
 	    fi
-	  fi])
+	  fi
+	  AM_CONDITIONAL(CAIRO_HAS_$4, test "x$use_$1" = xyes)
+	])
+
+CAIRO_FEATURES=""
 
 dnl ===========================================================================
 
-CAIRO_BACKEND_ENABLE(xlib, Xlib, auto, xlib, [xrender], [
+CAIRO_BACKEND_ENABLE(xlib, Xlib, xlib, XLIB_SURFACE, auto, [xrender], [
   dnl Check for Xrender header files if the Xrender package is not installed:
   PKG_CHECK_MODULES(XRENDER, xrender >= 0.6, [
     XRENDER_REQUIRES=xrender], [
@@ -159,43 +163,28 @@ CAIRO_BACKEND_ENABLE(xlib, Xlib, auto, x
   _CHECK_FUNCS_WITH_FLAGS(XrmFinalize, $XRENDER_CFLAGS, $XRENDER_LIBS)
 ])
 
-AM_CONDITIONAL(CAIRO_HAS_XLIB_SURFACE, test "x$use_xlib" = "xyes")
-if test "x$use_xlib" = "xyes"; then
-  XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
-fi
-AC_SUBST(XLIB_SURFACE_FEATURE)
-
 AC_SUBST(XRENDER_REQUIRES)
 
 CAIRO_CFLAGS="$CAIRO_CFLAGS $XRENDER_CFLAGS"
 CAIRO_LIBS="$CAIRO_LIBS $XRENDER_LIBS"
 
-CAIRO_BACKEND_ENABLE(quartz, Quartz, no, quartz, [], [
+dnl ===========================================================================
+
+CAIRO_BACKEND_ENABLE(quartz, Quartz, quartz, QUARTZ_SURFACE, no, [], [
   dnl There is no pkgconfig for quartz; lets do a header check
   AC_CHECK_HEADER(Carbon/Carbon.h, [use_quartz=yes], [use_quartz="no (Carbon headers not found)"])
+  QUARTZ_LIBS="-Xlinker -framework -Xlinker Carbon"
 ])
 
-AM_CONDITIONAL(CAIRO_HAS_QUARTZ_SURFACE, test "x$use_quartz" = "xyes")
-if test "x$use_quartz" = "xyes"; then
-  QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
-  QUARTZ_LIBS="-Xlinker -framework -Xlinker Carbon"
-fi
-AC_SUBST(QUARTZ_SURFACE_FEATURE)
 CAIRO_LIBS="$CAIRO_LIBS $QUARTZ_LIBS"
 
 dnl ===========================================================================
 
-CAIRO_BACKEND_ENABLE(xcb, XCB, no, xcb, [xcb xcb-render], [
+CAIRO_BACKEND_ENABLE(xcb, XCB, xcb, XCB_SURFACE, no, [xcb xcb-render], [
   PKG_CHECK_MODULES(XCB, xcb xcb-render, [use_xcb=yes], [
   use_xcb="no (requires XCB http://xcb.freedesktop.org)"])
 ])
 
-AM_CONDITIONAL(CAIRO_HAS_XCB_SURFACE, test "x$use_xcb" = "xyes")
-if test "x$use_xcb" = "xyes"; then
-  XCB_SURFACE_FEATURE="#define CAIRO_HAS_XCB_SURFACE 1"
-fi
-AC_SUBST(XCB_SURFACE_FEATURE)
-
 CAIRO_CFLAGS="$CAIRO_CFLAGS $XCB_CFLAGS"
 CAIRO_LIBS="$CAIRO_LIBS $XCB_LIBS"
 
@@ -211,7 +200,7 @@ case "$host" in
     ;;
 esac
 
-CAIRO_BACKEND_ENABLE(win32, Microsoft Windows, auto, win32, [], [
+CAIRO_BACKEND_ENABLE(win32, Microsoft Windows, win32, WIN32_SURFACE, auto, [], [
   case "$host" in
     *-*-mingw*|*-*-cygwin*)
       use_win32=yes
@@ -227,23 +216,15 @@ if test "x$use_win32" = "xyes"; then
    CAIRO_LIBS="$CAIRO_LIBS -lgdi32 -lmsimg32"
 fi
 
-AM_CONDITIONAL(CAIRO_HAS_WIN32_SURFACE, test "x$use_win32" = "xyes")
-if test "x$use_win32" = "xyes"; then
-  WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
-fi
-AC_SUBST(WIN32_SURFACE_FEATURE)
-
-AM_CONDITIONAL(CAIRO_HAS_WIN32_FONT, test "x$use_win32" = "xyes")
-if test "x$use_win32" = "xyes"; then
-  WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
-fi
-AC_SUBST(WIN32_FONT_FEATURE)
+CAIRO_BACKEND_ENABLE(win32_font, Microsoft Windows Fonts, win32-font, WIN32_FONT, auto, [], [
+      use_win32_font=$use_win32
+])
 
 
 dnl ===========================================================================
 
 
-CAIRO_BACKEND_ENABLE(beos, BeOS/Zeta, no, beos, [], [
+CAIRO_BACKEND_ENABLE(beos, BeOS/Zeta, beos, BEOS_SURFACE, no, [], [
   case "$host" in
     *-*-beos)
       use_beos=yes
@@ -261,16 +242,10 @@ if test "x$use_beos" = "xyes"; then
   AC_CHECK_LIB(zeta,main,CAIRO_LIBS="$CAIRO_LIBS -lzeta")
 fi
 
-AM_CONDITIONAL(CAIRO_HAS_BEOS_SURFACE, test "x$use_beos" = "xyes")
-if test "x$use_beos" = "xyes"; then
-  BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
-fi
-AC_SUBST(BEOS_SURFACE_FEATURE)
-
 
 dnl ===========================================================================
 
-CAIRO_BACKEND_ENABLE(png, PNG, yes, png, [], [
+CAIRO_BACKEND_ENABLE(png, PNG, png, PNG_FUNCTIONS, yes, [], [
   use_png=no
   # libpng13 is GnuWin32's libpng-1.2.8 :-(
   for l in libpng12 libpng13 libpng10 ; do
@@ -289,13 +264,11 @@ CAIRO_BACKEND_ENABLE(png, PNG, yes, png,
   fi    
 ])
 
-AM_CONDITIONAL(CAIRO_HAS_PNG_FUNCTIONS, test "x$use_png" = "xyes")
 if test "x$use_png" = "xyes"; then
-  PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
+  :
 else
   AC_MSG_WARN([*** To run the tests, cairo must be built with png support ***])
 fi
-AC_SUBST(PNG_FUNCTIONS_FEATURE)
 
 CAIRO_CFLAGS="$CAIRO_CFLAGS $PNG_CFLAGS"
 CAIRO_LIBS="$CAIRO_LIBS $PNG_LIBS"
@@ -304,7 +277,7 @@ AC_SUBST(PNG_REQUIRES)
 
 dnl ===========================================================================
 
-CAIRO_BACKEND_ENABLE(glitz, glitz, no, glitz, [glitz], [
+CAIRO_BACKEND_ENABLE(glitz, glitz, glitz, GLITZ_SURFACE, no, [glitz], [
   PKG_CHECK_MODULES(GLITZ, glitz >= 0.5.1, [
     GLITZ_REQUIRES=glitz
     use_glitz=yes], [use_glitz="no (requires glitz http://freedesktop.org/Software/glitz)"])
@@ -339,12 +312,6 @@ AM_CONDITIONAL(CAIRO_CAN_TEST_GLITZ_EGL_
 AM_CONDITIONAL(CAIRO_CAN_TEST_GLITZ_GLX_SURFACE, test "x$have_glitz_glx" = "xyes")
 AM_CONDITIONAL(CAIRO_CAN_TEST_GLITZ_WGL_SURFACE, test "x$have_glitz_wgl" = "xyes")
 
-AM_CONDITIONAL(CAIRO_HAS_GLITZ_SURFACE, test "x$use_glitz" = "xyes")
-if test "x$use_glitz" = "xyes"; then
-  GLITZ_SURFACE_FEATURE="#define CAIRO_HAS_GLITZ_SURFACE 1"
-fi
-AC_SUBST(GLITZ_SURFACE_FEATURE)
-
 CAIRO_CFLAGS="$CAIRO_CFLAGS $GLITZ_CFLAGS"
 CAIRO_LIBS="$CAIRO_LIBS $GLITZ_LIBS"
 
@@ -352,23 +319,17 @@ AC_SUBST(GLITZ_REQUIRES)
 
 dnl ===========================================================================
 
-CAIRO_BACKEND_ENABLE(directfb, directfb, no, directfb, [directfb], [
+CAIRO_BACKEND_ENABLE(directfb, directfb, directfb, DIRECTFB_SURFACE, no, [directfb], [
   PKG_CHECK_MODULES(DIRECTFB, directfb, [use_directfb=yes], [
   use_directfb="no (requires directfb http://www.directfb.org)"])
 ])
 
-AM_CONDITIONAL(CAIRO_HAS_DIRECTFB_SURFACE, test "x$use_directfb" = "xyes")
-if test "x$use_directfb" = "xyes"; then
-  DIRECTFB_SURFACE_FEATURE="#define CAIRO_HAS_DIRECTFB_SURFACE 1"
-fi
-AC_SUBST(DIRECTFB_SURFACE_FEATURE)
-
 CAIRO_CFLAGS="$CAIRO_CFLAGS $DIRECTFB_CFLAGS"
 CAIRO_LIBS="$CAIRO_LIBS $DIRECTFB_LIBS"
 
 dnl ===========================================================================
 
-CAIRO_BACKEND_ENABLE(freetype, freetype font, auto, ft, [freetype2 fontconfig], [
+CAIRO_BACKEND_ENABLE(freetype, freetype font, ft, FT_FONT, auto, [freetype2 fontconfig], [
   PKG_CHECK_MODULES(FONTCONFIG, fontconfig, 
                     [use_freetype=yes], [use_freetype=no])
   _CHECK_FUNCS_WITH_FLAGS(FcFini, $FONTCONFIG_CFLAGS, $FONTCONFIG_LIBS)
@@ -469,12 +430,6 @@ fi
 CAIRO_CFLAGS="$CAIRO_CFLAGS $FREETYPE_CFLAGS"
 CAIRO_LIBS="$CAIRO_LIBS $FREETYPE_LIBS"
 
-AM_CONDITIONAL(CAIRO_HAS_FT_FONT, test "x$use_freetype" = "xyes")
-if test "x$use_freetype" = "xyes"; then
-  FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
-fi
-AC_SUBST(FT_FONT_FEATURE)
-
 dnl ===========================================================================
 
 AC_CHECK_HEADERS([pthread.h], have_pthread=yes, have_pthread=no)
@@ -482,7 +437,7 @@ AM_CONDITIONAL(HAVE_PTHREAD, test "x$hav
 
 dnl ===========================================================================
 
-CAIRO_BACKEND_ENABLE(ps, PostScript, auto, ps, [], [
+CAIRO_BACKEND_ENABLE(ps, PostScript, ps, PS_SURFACE, auto, [], [
   if test x"$have_ft_load_sfnt_table" != "xyes" ; then
     use_ps="no (PS backend requires FreeType 2.1.4 or newer)"
   fi
@@ -494,12 +449,9 @@ AC_CHECK_LIB(z, compress,
 	         [use_ps="no (requires zlib http://www.gzip.org/zlib/)"])],
 	     [use_ps="no (requires zlib http://www.gzip.org/zlib/)"])
 
-AM_CONDITIONAL(CAIRO_HAS_PS_SURFACE, test "x$use_ps" = "xyes")
 if test "x$use_ps" = "xyes"; then
-  PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
   PS_LIBS=-lz
 fi
-AC_SUBST(PS_SURFACE_FEATURE)
 
 CAIRO_LIBS="$CAIRO_LIBS $PS_LIBS"
 
@@ -507,16 +459,14 @@ AC_SUBST(PS_LIBS)
 
 dnl ===========================================================================
 
-CAIRO_BACKEND_ENABLE(pdf, PDF, auto, pdf, [], [
+CAIRO_BACKEND_ENABLE(pdf, PDF, pdf, PDF_SURFACE, auto, [], [
   if test x"$have_ft_load_sfnt_table" != "xyes" ; then
     use_pdf="no (PDF backend requires FreeType 2.1.4 or newer)"
   fi
 ])
 
 test_pdf=no
-AM_CONDITIONAL(CAIRO_HAS_PDF_SURFACE, test "x$use_pdf" = "xyes")
 if test "x$use_pdf" = "xyes"; then
-  PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
   PDF_LIBS=-lz
   PKG_CHECK_MODULES(POPPLER, poppler-glib >= 0.4.1 pango gtk+-2.0, [test_pdf=yes], [test_pdf=no])
   if test "x$test_pdf" = "xyes"; then
@@ -525,7 +475,6 @@ if test "x$use_pdf" = "xyes"; then
     AC_MSG_WARN([PDF backend will not be tested since poppler is not available])
   fi
 fi
-AC_SUBST(PDF_SURFACE_FEATURE)
 
 AM_CONDITIONAL(CAIRO_CAN_TEST_PDF_SURFACE, test "x$test_pdf" = "xyes")
 AC_SUBST(POPPLER_CFLAGS)
@@ -539,15 +488,13 @@ AC_SUBST(PDF_LIBS)
 
 dnl ===========================================================================
 
-CAIRO_BACKEND_ENABLE(svg, SVG, auto, svg, [], [
+CAIRO_BACKEND_ENABLE(svg, SVG, svg, SVG_SURFACE, auto, [], [
   if test x"$have_ft_load_sfnt_table" != "xyes" ; then
     use_svg="no (SVG backend requires FreeType 2.1.4 or newer)"
   fi
 ])
 
-AM_CONDITIONAL(CAIRO_HAS_SVG_SURFACE, test "x$use_svg" = "xyes")
 if test "x$use_svg" = "xyes"; then
-  SVG_SURFACE_FEATURE="#define CAIRO_HAS_SVG_SURFACE 1"
   PKG_CHECK_MODULES(LIBRSVG, librsvg-2.0 gdk-2.0, [test_svg=yes], [test_svg=no])
   if test "x$test_svg" = "xyes"; then
     AC_DEFINE([CAIRO_CAN_TEST_SVG_SURFACE], 1, [Define to 1 if the SVG backend can be tested (need librsvg)])
@@ -555,7 +502,6 @@ if test "x$use_svg" = "xyes"; then
     AC_MSG_WARN([SVG backend will not be tested since a librsvg is not available])
   fi
 fi
-AC_SUBST(SVG_SURFACE_FEATURE)
 
 AM_CONDITIONAL(CAIRO_CAN_TEST_SVG_SURFACE, test "x$test_svg" = "xyes")
 AC_SUBST(LIBRSVG_CFLAGS)
@@ -563,20 +509,14 @@ AC_SUBST(LIBRSVG_LIBS)
 
 dnl ===========================================================================
 
-dnl This check should default to 'yes' once we have code to actually
+dnl This check should default to 'auto' once we have code to actually
 dnl check for the atsui font backend.
 
-CAIRO_BACKEND_ENABLE(atsui, atsui font, no, atsui, [], [
+CAIRO_BACKEND_ENABLE(atsui, atsui font, atsui, ATSUI_FONT, no, [], [
   dnl There is no pkgconfig for atsui; lets do a header check
   AC_CHECK_HEADER(Carbon/Carbon.h, [use_atsui=yes], [use_atsui=no])
 ])
 
-AM_CONDITIONAL(CAIRO_HAS_ATSUI_FONT, test "x$use_atsui" = "xyes")
-if test "x$use_atsui" = "xyes"; then
-  ATSUI_FONT_FEATURE="#define CAIRO_HAS_ATSUI_FONT 1"
-fi
-AC_SUBST(ATSUI_FONT_FEATURE)
-
 dnl ===========================================================================
 dnl Checks for precise integer types
 AC_CHECK_HEADERS([stdint.h inttypes.h sys/int_types.h])
@@ -621,7 +561,7 @@ dnl Check for MMX
 MMX_CFLAGS="-mmmx -Winline --param inline-unit-growth=10000 --param large-function-growth=10000"
 
 have_mmx_intrinsics=no
-AC_MSG_CHECKING(For MMX/SSE intrinsics in the compiler)
+AC_MSG_CHECKING(for MMX/SSE intrinsics in the compiler)
 xserver_save_CFLAGS=$CFLAGS
 CFLAGS="$CFLAGS $MMX_CFLAGS"
 AC_COMPILE_IFELSE([
@@ -727,12 +667,60 @@ fi
 
 dnl ===========================================================================
 
-AC_OUTPUT([
+AC_CONFIG_COMMANDS([src/cairo-features.h],
+[
+	featuresfile=src/cairo-features.h
+	outfile=$featuresfile.tmp
+	AC_MSG_NOTICE([creating $featuresfile])
+	mkdir -p src
+	cat > $outfile <<_EOF
+/* Generated by configure.  Do not edit */
+#ifndef CAIRO_FEATURES_H
+#define CAIRO_FEATURES_H
+
+#ifdef  __cplusplus
+# define CAIRO_BEGIN_DECLS  extern "C" {
+# define CAIRO_END_DECLS    }
+#else
+# define CAIRO_BEGIN_DECLS
+# define CAIRO_END_DECLS
+#endif
+
+#ifndef cairo_public
+# define cairo_public
+#endif
+
+#define CAIRO_VERSION_MAJOR $CAIRO_VERSION_MAJOR
+#define CAIRO_VERSION_MINOR $CAIRO_VERSION_MINOR
+#define CAIRO_VERSION_MICRO $CAIRO_VERSION_MICRO
+
+#define CAIRO_VERSION_STRING "$CAIRO_VERSION_MAJOR.$CAIRO_VERSION_MINOR.$CAIRO_VERSION_MICRO"
+
+_EOF
+	for FEATURE in $CAIRO_FEATURES; do
+		echo "#define CAIRO_HAS_$FEATURE 1" >> $outfile
+	done
+
+	echo '' >> $outfile
+	echo '#endif' >> $outfile
+
+	if cmp -s $outfile $featuresfile; then
+	  AC_MSG_NOTICE([$featuresfile is unchanged])
+	  rm -f $outfile
+	else
+	  mv $outfile $featuresfile
+	fi
+],[
+	CAIRO_FEATURES='$CAIRO_FEATURES'
+	CAIRO_VERSION_MAJOR=$CAIRO_VERSION_MAJOR
+	CAIRO_VERSION_MINOR=$CAIRO_VERSION_MINOR
+	CAIRO_VERSION_MICRO=$CAIRO_VERSION_MICRO
+])
+AC_CONFIG_FILES([
 Makefile
 pixman/Makefile
 pixman/src/Makefile
 src/Makefile
-src/cairo-features.h
 test/Makefile
 doc/Makefile
 doc/public/Makefile
@@ -740,6 +728,8 @@ doc/public/version.xml
 src/cairo.pc
 ])
 
+AC_OUTPUT
+
 dnl ===========================================================================
 
 echo ""
@@ -758,7 +748,7 @@ echo "  DirectFB:   $use_directfb"
 echo ""
 echo "the following font backends:"
 echo "  FreeType:   $use_freetype"
-echo "  Win32:      $use_win32"
+echo "  Win32:      $use_win32_font"
 echo "  ATSUI:      $use_atsui"
 echo ""
 echo "the following features:"
@@ -772,9 +762,9 @@ echo "using CFLAGS:"
 echo $CAIRO_CFLAGS
 echo ""
 
-if test x"$use_freetype" != "xyes" && \
-   test x"$use_win32"    != "xyes" && \
-   test x"$use_atsui"    != "xyes" ; then
+if test x"$use_freetype"   != "xyes" && \
+   test x"$use_win32_font" != "xyes" && \
+   test x"$use_atsui"      != "xyes" ; then
 
    AC_MSG_ERROR([Cairo requires at least one font backend.
 		  Please install freetype and fontconfig, then try again:
diff --git a/src/Makefile.am b/src/Makefile.am
index f86937e..ab53aff 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -130,6 +130,8 @@ endif
 FONTCONFIG_LIBS=@FONTCONFIG_LIBS@
 XRENDER_LIBS=@XRENDER_LIBS@
 
+BUILT_SOURCES = cairo-features.h
+
 cairoincludedir = $(includedir)/cairo
 cairoinclude_HEADERS =			\
 	cairo.h				\
diff --git a/src/cairo-features.h.in b/src/cairo-features.h.in
deleted file mode 100644
index 4b845bf..0000000
--- a/src/cairo-features.h.in
+++ /dev/null
@@ -1,86 +0,0 @@
-/* cairo - a vector graphics library with display and print output
- *
- * Copyright © 2003 University of Southern California
- *
- * This library is free software; you can redistribute it and/or
- * modify it either under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation
- * (the "LGPL") or, at your option, under the terms of the Mozilla
- * Public License Version 1.1 (the "MPL"). If you do not alter this
- * notice, a recipient may use your version of this file under either
- * the MPL or the LGPL.
- *
- * You should have received a copy of the LGPL along with this library
- * in the file COPYING-LGPL-2.1; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * You should have received a copy of the MPL along with this library
- * in the file COPYING-MPL-1.1
- *
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
- * OF ANY KIND, either express or implied. See the LGPL or the MPL for
- * the specific language governing rights and limitations.
- *
- * The Original Code is the cairo graphics library.
- *
- * The Initial Developer of the Original Code is University of Southern
- * California.
- *
- * Contributor(s):
- *	Carl D. Worth <cworth at cworth.org>
- */
-
-#ifndef CAIRO_FEATURES_H
-#define CAIRO_FEATURES_H
-
-#ifdef  __cplusplus
-# define CAIRO_BEGIN_DECLS  extern "C" {
-# define CAIRO_END_DECLS    }
-#else
-# define CAIRO_BEGIN_DECLS
-# define CAIRO_END_DECLS
-#endif
-
-#ifndef cairo_public
-# define cairo_public
-#endif
-
-#define CAIRO_VERSION_MAJOR @CAIRO_VERSION_MAJOR@
-#define CAIRO_VERSION_MINOR @CAIRO_VERSION_MINOR@
-#define CAIRO_VERSION_MICRO @CAIRO_VERSION_MICRO@
-
-#define CAIRO_VERSION_STRING "@CAIRO_VERSION_MAJOR at .@CAIRO_VERSION_MINOR at .@CAIRO_VERSION_MICRO@"
-
- at PS_SURFACE_FEATURE@
-
- at PDF_SURFACE_FEATURE@
-
- at SVG_SURFACE_FEATURE@
-
- at XLIB_SURFACE_FEATURE@
-
- at QUARTZ_SURFACE_FEATURE@
-
- at XCB_SURFACE_FEATURE@
-
- at WIN32_SURFACE_FEATURE@
-
- at BEOS_SURFACE_FEATURE@
-
- at GLITZ_SURFACE_FEATURE@
-
- at DIRECTFB_SURFACE_FEATURE@
-
- at FT_FONT_FEATURE@
-
- at WIN32_FONT_FEATURE@
-
- at ATSUI_FONT_FEATURE@
-
- at PNG_FUNCTIONS_FEATURE@
-
-#endif


More information about the cairo-commit mailing list