[cairo-commit] 9 commits - autogen.sh boilerplate/.gitignore boilerplate/Makefile.am boilerplate/Makefile.sources boilerplate/Makefile.win32 build/aclocal.enable.m4 build/aclocal.makefile.m4 build/configure.ac.enable build/configure.ac.features configure.ac Makefile.win32 src/cairo-features-win32.h src/.gitignore src/Makefile.am src/Makefile.am.analysis src/Makefile.sources src/Makefile.win32

Behdad Esfahbod behdad at kemper.freedesktop.org
Tue Sep 16 01:00:16 PDT 2008


 Makefile.win32               |    2 
 autogen.sh                   |    6 
 boilerplate/.gitignore       |    4 
 boilerplate/Makefile.am      |   89 ++-------
 boilerplate/Makefile.sources |   56 +++++
 boilerplate/Makefile.win32   |   12 -
 build/aclocal.enable.m4      |   29 ++-
 build/aclocal.makefile.m4    |  170 ++++++++++++++++++
 build/configure.ac.enable    |  404 -------------------------------------------
 build/configure.ac.features  |  377 ++++++++++++++++++++++++++++++++++++++++
 configure.ac                 |    2 
 src/.gitignore               |    1 
 src/Makefile.am              |   24 --
 src/Makefile.am.analysis     |   19 ++
 src/Makefile.sources         |    5 
 src/Makefile.win32           |   77 --------
 src/cairo-features-win32.h   |   14 -
 17 files changed, 687 insertions(+), 604 deletions(-)

New commits:
commit 840218e0a0747ae741258fad12d420ae59e59d1c
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Sep 16 03:55:12 2008 -0400

    [src/Makefile.am.analysis] Fix typos and improve scripts

diff --git a/src/Makefile.am.analysis b/src/Makefile.am.analysis
index dad6c36..800935a 100644
--- a/src/Makefile.am.analysis
+++ b/src/Makefile.am.analysis
@@ -2,20 +2,18 @@
 SPARSE = sparse
 sparse:
 	@status=true; for f in $(enabled_cairo_sources); do \
-		echo sparse $$f; \
+		echo $(SPARSE) $$f; \
 		$(SPARSE) -I$(top_builddir) $(AM_CPPFLAGS) -DHAVE_CONFIG_H $$f || status=false; \
 	done; $$status
 
 SPLINT = splint -badflag
 splint:
 	@status=true; for f in $(enabled_cairo_sources); do \
-		test "$$f" = "`echo "$$f" | sed 's/[.]h$$//'`" || continue; \
-		echo sparse $$f; \
+		echo $(SPLINT) $$f; \
 		$(SPLINT) -I$(top_builddir) $(AM_CPPFLAGS) -DHAVE_CONFIG_H $$f || status=false; \
 	done; $$status
 
 UNO = uno
 uno:
 	@cpp_flags=`echo $(AM_CPPFLAGS) | sed 's/\(-I.*\) /\1 /g'`; \
-	files=`echo $(enabled_cairo_sources) | sed 's/[^ ]*\.h//g'`; \
-	$(UNO) -I$(top_builddir) $$cpp_flags -DHAVE_CONFIG_H -U__GNUC__ $$files
+	$(UNO) -I$(top_builddir) $$cpp_flags -DHAVE_CONFIG_H -U__GNUC__ $(enabled_cairo_sources)
commit 49c8c62040cdeb6b280392da9355593e1e8292fe
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Sep 16 03:10:53 2008 -0400

    [src/Makefile.am.analysis] Split off from src/Makefile.am

diff --git a/src/Makefile.am b/src/Makefile.am
index 88d40a5..60a5520 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -85,23 +85,4 @@ check_link_LDADD = libcairo.la
 .c.i: $(cairoinclude_HEADERS) $(nodist_cairoinclude_HEADERS) cairoint.h $(top_builddir)/config.h
 	$(CPP) -DHAVE_CONFIG_H -I$(top_builddir) -I. $(AM_CPPFLAGS) $< -o $@
 
-SPARSE = sparse
-sparse:
-	@status=true; for f in $(enabled_cairo_sources); do \
-		echo sparse $$f; \
-		$(SPARSE) -I$(top_builddir) $(AM_CPPFLAGS) -DHAVE_CONFIG_H $$f || status=false; \
-	done; $$status
-
-SPLINT = splint -badflag
-splint:
-	@status=true; for f in $(enabled_cairo_sources); do \
-		test "$$f" = "`echo "$$f" | sed 's/[.]h$$//'`" || continue; \
-		echo sparse $$f; \
-		$(SPLINT) -I$(top_builddir) $(AM_CPPFLAGS) -DHAVE_CONFIG_H $$f || status=false; \
-	done; $$status
-
-UNO = uno
-uno:
-	@cpp_flags=`echo $(AM_CPPFLAGS) | sed 's/\(-I.*\) /\1 /g'`; \
-	files=`echo $(enabled_cairo_sources) | sed 's/[^ ]*\.h//g'`; \
-	$(UNO) -I$(top_builddir) $$cpp_flags -DHAVE_CONFIG_H -U__GNUC__ $$files
+include $(srcdir)/Makefile.am.analysis
diff --git a/src/Makefile.am.analysis b/src/Makefile.am.analysis
new file mode 100644
index 0000000..dad6c36
--- /dev/null
+++ b/src/Makefile.am.analysis
@@ -0,0 +1,21 @@
+
+SPARSE = sparse
+sparse:
+	@status=true; for f in $(enabled_cairo_sources); do \
+		echo sparse $$f; \
+		$(SPARSE) -I$(top_builddir) $(AM_CPPFLAGS) -DHAVE_CONFIG_H $$f || status=false; \
+	done; $$status
+
+SPLINT = splint -badflag
+splint:
+	@status=true; for f in $(enabled_cairo_sources); do \
+		test "$$f" = "`echo "$$f" | sed 's/[.]h$$//'`" || continue; \
+		echo sparse $$f; \
+		$(SPLINT) -I$(top_builddir) $(AM_CPPFLAGS) -DHAVE_CONFIG_H $$f || status=false; \
+	done; $$status
+
+UNO = uno
+uno:
+	@cpp_flags=`echo $(AM_CPPFLAGS) | sed 's/\(-I.*\) /\1 /g'`; \
+	files=`echo $(enabled_cairo_sources) | sed 's/[^ ]*\.h//g'`; \
+	$(UNO) -I$(top_builddir) $$cpp_flags -DHAVE_CONFIG_H -U__GNUC__ $$files
commit eb749d75632cfce6dfc56e6e28dac1cfcd8a66f9
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Sep 16 03:05:26 2008 -0400

    [.gitignore] Update

diff --git a/boilerplate/.gitignore b/boilerplate/.gitignore
index befd40a..3164656 100644
--- a/boilerplate/.gitignore
+++ b/boilerplate/.gitignore
@@ -1,5 +1,9 @@
 TAGS
 tags
+Makefile
+Makefile.in
+Makefile.am.config
+Makefile.win32.config
 *.lo
 *.la
 *.exe
diff --git a/src/.gitignore b/src/.gitignore
index e03cc64..a1f26f2 100644
--- a/src/.gitignore
+++ b/src/.gitignore
@@ -11,6 +11,7 @@ Makefile.win32.config
 *.loT
 *.pc
 cairo-features.h
+cairo-features-win32.h
 cairo-supported-features.h
 cairo.def
 *.i
commit a908fc04a7bd536edfcd0e620f0f70cb5655085f
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Sep 16 03:03:43 2008 -0400

    [boilerplate/Makefile.am] Distribute Makefile.win32.config

diff --git a/boilerplate/Makefile.am b/boilerplate/Makefile.am
index 5a5168c..22f66a8 100644
--- a/boilerplate/Makefile.am
+++ b/boilerplate/Makefile.am
@@ -11,6 +11,8 @@ AM_CPPFLAGS = \
 	$(NULL)
 
 EXTRA_DIST += Makefile.win32
+EXTRA_DIST           += Makefile.win32.config
+MAINTAINERCLEANFILES += $(srcdir)/Makefile.win32.config
 
 EXTRA_LTLIBRARIES += libcairoboilerplate.la
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 4bebd7d..88d40a5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -10,6 +10,7 @@ export_symbols = -export-symbols cairo.def
 cairo_def_dependency = cairo.def
 endif
 
+EXTRA_DIST += Makefile.win32
 EXTRA_DIST           += cairo-supported-features.h cairo-features-win32.h Makefile.win32.config
 MAINTAINERCLEANFILES += cairo-supported-features.h $(srcdir)/cairo-features-win32.h $(srcdir)/Makefile.win32.config
 
@@ -104,5 +105,3 @@ uno:
 	@cpp_flags=`echo $(AM_CPPFLAGS) | sed 's/\(-I.*\) /\1 /g'`; \
 	files=`echo $(enabled_cairo_sources) | sed 's/[^ ]*\.h//g'`; \
 	$(UNO) -I$(top_builddir) $$cpp_flags -DHAVE_CONFIG_H -U__GNUC__ $$files
-
-EXTRA_DIST += Makefile.win32
commit 88a3998a1d7e251e77ca9f39071866142cb50aa9
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Sep 16 02:45:00 2008 -0400

    [aclocal] Fix pkgconfig file collection

diff --git a/build/aclocal.makefile.m4 b/build/aclocal.makefile.m4
index 88d679f..b526b85 100644
--- a/build/aclocal.makefile.m4
+++ b/build/aclocal.makefile.m4
@@ -146,12 +146,13 @@ dnl
 AC_DEFUN([CAIRO_MAKEFILE_ACCUMULATE_FEATURE],
 [dnl
 	m4_if([$1],[*],,[_CAIRO_MAKEFILE_CHECK([$1])])dnl
-	m4_pushdef([cr_make_acc_contents],[$5])dnl
+	m4_append([cr_make_acc_counter],[1],[])dnl
+	m4_define([cr_make_acc_contents]m4_len(cr_make_acc_counter), [$5])dnl
 	CAIRO_FEATURE_HOOK_REGISTER(*,[$3],[$4],
 	[dnl
 		m4_foreach_w([cr_makefile], m4_if([$1],[*],_CAIRO_MAKEFILES,[$1]),
 		[dnl
-			cr_make_tmp=_CAIRO_SH_ESCAPE(]]cr_make_acc_contents([[[[]]]]cr_makefile(),[$][1],[$][2],[$][3],[$][4])[[)
+			cr_make_tmp=_CAIRO_SH_ESCAPE(cr_make_acc_contents]]m4_len(cr_make_acc_counter)([[cr_makefile,]][$][1],[$][2],[$][3],[$][4])[[)
 			_CAIRO_MAKEFILE_ACCUMULATE_FEATURE(
 				[MAKEFILE_]cr_makefile[_AMAKE],
 				[$2],
@@ -164,6 +165,6 @@ AC_DEFUN([CAIRO_MAKEFILE_ACCUMULATE_FEATURE],
 				[$cr_make_tmp])dnl
 		])dnl
 	])dnl
-	m4_popdef([cr_make_acc_contents])dnl
 ])dnl
 
+m4_define([cr_make_acc_counter])dnl
diff --git a/build/configure.ac.features b/build/configure.ac.features
index 3061f85..cf9f2f8 100644
--- a/build/configure.ac.features
+++ b/build/configure.ac.features
@@ -200,13 +200,13 @@ CAIRO_FEATURE_HOOK_REGISTER(yes,!always,!,
 dnl Collect list of .pc files for all non-builtin public features
 CAIRO_MAKEFILE_ACCUMULATE(cairo,
 [all_$1_pkgconf = cairo.pc])dnl
-CAIRO_MAKEFILE_ACCUMULATE_FEATURE(cairo,*,*,!,
+CAIRO_MAKEFILE_ACCUMULATE_FEATURE(cairo,*,!always,!,
 [all_$1_pkgconf += cr_feature_pc])dnl
 
 dnl Collect list of .pc files for enabled non-builtin public features
 CAIRO_MAKEFILE_ACCUMULATE(cairo,
 [enabled_$1_pkgconf = cairo.pc])dnl
-CAIRO_MAKEFILE_ACCUMULATE_FEATURE(cairo,yes,*,!,
+CAIRO_MAKEFILE_ACCUMULATE_FEATURE(cairo,yes,!always,!,
 [enabled_$1_pkgconf += cr_feature_pc])dnl
 
 
commit 8151c506700ad286f683797c6c0767f35edaa2de
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Sep 16 01:33:07 2008 -0400

    [*/Makefile.win32] Use Makefile.win32.config

diff --git a/boilerplate/Makefile.win32 b/boilerplate/Makefile.win32
index a8d39b2..b1fcf36 100644
--- a/boilerplate/Makefile.win32
+++ b/boilerplate/Makefile.win32
@@ -1,18 +1,14 @@
-
 SUBMAKEFILE = 1
 
 include ../Makefile.win32
+include Makefile.win32.config
 
 CFLAGS += -I../src
 
 SOURCES = \
-	cairo-boilerplate.c \
-	cairo-boilerplate-win32.c \
-	cairo-boilerplate-ps.c \
-	cairo-boilerplate-svg.c \
-	cairo-boilerplate-pdf.c \
-	cairo-boilerplate-getopt.c \
-	xmalloc.c \
+	$(enabled_cairo_boilerplate_headers) \
+	$(enabled_cairo_boilerplate_private) \
+	$(enabled_cairo_boilerplate_sources) \
 	$(NULL)
 
 OBJECTS = $(patsubst %.c, $(CFG)/%.obj, $(SOURCES))
diff --git a/src/Makefile.win32 b/src/Makefile.win32
index fadb32f..967d94c 100644
--- a/src/Makefile.win32
+++ b/src/Makefile.win32
@@ -1,87 +1,18 @@
 SUBMAKEFILE = 1
 
 include ../Makefile.win32
-
 include Makefile.win32.config
 
-srcdir = `pwd`
-
 SOURCES = \
-	cairo-analysis-surface.c \
-	cairo-arc.c \
-	cairo-array.c \
-	cairo-atomic.c \
-	cairo-base85-stream.c \
-	cairo-bentley-ottmann.c \
-	cairo.c \
-	cairo-cache.c \
-	cairo-cff-subset.c \
-	cairo-clip.c \
-	cairo-color.c \
-	cairo-debug.c \
-	cairo-deflate-stream.c \
-	cairo-fixed.c \
-	cairo-font-face.c \
-	cairo-font-options.c \
-	cairo-freelist.c \
-	cairo-gstate.c \
-	cairo-hash.c \
-	cairo-hull.c \
-	cairo-image-surface.c \
-	cairo-lzw.c \
-	cairo-matrix.c \
-	cairo-meta-surface.c \
-	cairo-misc.c \
-	cairo-mutex.c \
-	cairo-output-stream.c \
-	cairo-paginated-surface.c \
-	cairo-path-bounds.c \
-	cairo-path.c \
-	cairo-path-fill.c \
-	cairo-path-fixed.c \
-	cairo-path-stroke.c \
-	cairo-pattern.c \
-	cairo-pdf-operators.c \
-	cairo-pdf-surface.c \
-	cairo-pen.c \
-	cairo-png.c \
-	cairo-polygon.c \
-	cairo-ps-surface.c \
-	cairo-rectangle.c \
-	cairo-region.c \
-	cairo-scaled-font.c \
-	cairo-scaled-font-subsets.c \
-	cairo-skiplist.c \
-	cairo-slope.c \
-	cairo-spline.c \
-	cairo-stroke-style.c \
-	cairo-surface.c \
-	cairo-surface-fallback.c \
-	cairo-svg-surface.c \
-	cairo-traps.c \
-	cairo-truetype-subset.c \
-	cairo-type1-fallback.c \
-	cairo-type3-glyph-surface.c \
-	cairo-unicode.c \
-	cairo-user-font.c \
-	cairo-wideint.c \
-	cairo-win32.c \
-	cairo-win32-font.c \
-	cairo-win32-printing-surface.c \
+	$(enabled_cairo_headers) \
+	$(enabled_cairo_private) \
+	$(enabled_cairo_sources) \
 	$(NULL)
 
 STATIC_SOURCES = cairo-win32-surface.c 
 
 cairo_headers = \
-	cairo.h \
-	cairo-pdf.h \
-	cairo-ps.h \
-	cairo-svg.h \
-	cairo-win32.h \
-	cairo-pdf-test.h \
-	cairo-ps-test.h \
-	cairo-scaled-font-test.h \
-	cairo-svg-test.h \
+	$(enabled_cairo_headers) \
 	$(NULL)
 
 OBJECTS = $(patsubst %.c, $(CFG)/%.obj, $(SOURCES))
commit 310908ce2d2e35ca332c0f16c466ee652bb1b5a6
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Sep 16 01:32:55 2008 -0400

    [Makefile.win32] Don't declare CAIRO_NO_MUTEX

diff --git a/Makefile.win32 b/Makefile.win32
index a00ff34..54bf89a 100644
--- a/Makefile.win32
+++ b/Makefile.win32
@@ -21,7 +21,7 @@ DEFAULT_CFLAGS += -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
 DEFAULT_CFLAGS += -DPACKAGE_BUGREPORT="" -DCAIRO_BUILD
 DEFAULT_CFLAGS += -I. 
 DEFAULT_CFLAGS += $(PIXMAN_CFLAGS)
-DEFAULT_CFLAGS += -DCAIRO_NO_MUTEX=1  -DLIBCAIRO_EXPORTS
+DEFAULT_CFLAGS += -DLIBCAIRO_EXPORTS
 
 CFLAGS := $(DEFAULT_CFLAGS)
 
commit 6892daf77cd44dca988c7305d430659d08813beb
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Sep 16 01:29:47 2008 -0400

    Create cairo-features-win32.h

diff --git a/build/aclocal.makefile.m4 b/build/aclocal.makefile.m4
index e7a19c1..88d679f 100644
--- a/build/aclocal.makefile.m4
+++ b/build/aclocal.makefile.m4
@@ -3,6 +3,22 @@ dnl These are the facilities for generating Makefile.am.config and
 dnl Makefile.win32.config files.
 dnl
 
+dnl
+dnl CAIRO_FEATURE_HOOK_REGISTER_WIN32(WHAT, COMMANDS)
+dnl
+dnl Like CAIRO_FEATURE_HOOK_REGISTER but only applies to features that
+dnl are by default enabled on win32 build system and match WHAT.
+dnl
+AC_DEFUN([CAIRO_FEATURE_HOOK_REGISTER_WIN32],
+[dnl
+	dnl builtin features
+	CAIRO_FEATURE_HOOK_REGISTER([*], always, [$1], [$2])dnl
+	dnl recommended features
+	CAIRO_FEATURE_HOOK_REGISTER([*], yes, [$1], [$2])dnl
+	dnl native win32 features
+	CAIRO_FEATURE_HOOK_REGISTER([*], auto, [$1], [m4_bmatch(cr_feature, [win32], [$2])])dnl
+])dnl
+
 dnl ===========================================================================
 
 dnl
@@ -21,7 +37,7 @@ dnl ===========================================================================
 dnl
 dnl CAIRO_INIT_MAKEFILES()
 dnl
-dnl Sets up automake conditionals for all features
+dnl Sets up automake and win32 conditionals for all features
 dnl
 AC_DEFUN([CAIRO_INIT_MAKEFILES],
 [dnl
@@ -31,7 +47,18 @@ AC_DEFUN([CAIRO_INIT_MAKEFILES],
 	dnl Automake conditionals for all features
 	CAIRO_FEATURE_HOOK_REGISTER(*,*,*,
 	[dnl
-		AM_CONDITIONAL(cr_feature_tag, test "x$use_$1" = xyes)dnl
+		AM_CONDITIONAL(cr_feature_tag, [test "x$use_]cr_feature[" = xyes])dnl
+	])dnl
+
+	dnl Turn win32 features on
+	CAIRO_FEATURE_HOOK_REGISTER_WIN32(*, [_CAIRO_MAKEFILES_WIN32_DEFINE_FEATURE])dnl
+])dnl
+
+m4_define([_CAIRO_MAKEFILES_WIN32_DEFINE_FEATURE],
+[
+	m4_foreach_w([cr_makefile], _CAIRO_MAKEFILES,
+	[dnl
+		CAIRO_ACCUMULATE_UNQUOTED_UNCHECKED([MAKEFILE_]cr_makefile[_WIN32], [cr_feature_tag = 1])dnl
 	])dnl
 ])dnl
 
@@ -56,7 +83,7 @@ AC_DEFUN([CAIRO_CONFIG_MAKEFILE],
 
 	dnl Accumulators
 	CAIRO_ACCUMULATORS_REGISTER(MAKEFILE_$1_AMAKE, m4_newline, [# Generated by configure.  Do not edit.]m4_newline[include $(top_srcdir)/$2/Makefile.sources]m4_newline)dnl
-	CAIRO_ACCUMULATORS_REGISTER_UNQUOTED(MAKEFILE_$1_WIN32, m4_newline, [$CAIRO_MAKEFILE_$1_AMAKE])dnl
+	CAIRO_ACCUMULATORS_REGISTER(MAKEFILE_$1_WIN32, m4_newline, [# Generated by configure.  Do not edit.]m4_newline[include Makefile.sources]m4_newline)dnl
 
 	dnl Generate
 	CAIRO_CONFIG_COMMANDS([$srcdir/$2/Makefile.am.config],
@@ -124,7 +151,6 @@ AC_DEFUN([CAIRO_MAKEFILE_ACCUMULATE_FEATURE],
 	[dnl
 		m4_foreach_w([cr_makefile], m4_if([$1],[*],_CAIRO_MAKEFILES,[$1]),
 		[dnl
-			m4_pushdef([cr_make_acc_contents],[$5])dnl
 			cr_make_tmp=_CAIRO_SH_ESCAPE(]]cr_make_acc_contents([[[[]]]]cr_makefile(),[$][1],[$][2],[$][3],[$][4])[[)
 			_CAIRO_MAKEFILE_ACCUMULATE_FEATURE(
 				[MAKEFILE_]cr_makefile[_AMAKE],
diff --git a/build/configure.ac.features b/build/configure.ac.features
index bb143cc..3061f85 100644
--- a/build/configure.ac.features
+++ b/build/configure.ac.features
@@ -212,7 +212,8 @@ CAIRO_MAKEFILE_ACCUMULATE_FEATURE(cairo,yes,*,!,
 
 dnl ===========================================================================
 dnl
-dnl Generate src/cairo-features.h src/cairo-supported-features.h
+dnl Generate src/cairo-features.h, src/cairo-supported-features.h, and
+dnl src/cairo-features-win32.h
 dnl
 
 dnl Collect list of enabled public features
@@ -233,8 +234,14 @@ CAIRO_FEATURE_HOOK_REGISTER(no,!no,!,
 [dnl
 	CAIRO_ACCUMULATE(NO_FEATURES, cr_feature_tag)
 ])dnl
+dnl Collect list of public features to enable on win32 build system
+CAIRO_ACCUMULATORS_REGISTER(WIN32_FEATURES,[ ])dnl
+CAIRO_FEATURE_HOOK_REGISTER_WIN32(!,
+[dnl
+	CAIRO_ACCUMULATE(WIN32_FEATURES, cr_feature_tag)
+])dnl
 
-dnl Generate src/cairo-features.h and src/cairo-supported-features.h
+dnl Generate src/cairo-features.h
 CAIRO_CONFIG_COMMANDS([src/cairo-features.h],
 [dnl
 	echo '/* Generated by configure.  Do not edit. */'
@@ -254,6 +261,7 @@ CAIRO_CONFIG_COMMANDS([src/cairo-features.h],
 	CAIRO_FEATURES='$CAIRO_FEATURES'
 	CAIRO_NO_FEATURES='$CAIRO_NO_FEATURES'
 ])dnl
+dnl Generate src/cairo-supported-features.h
 CAIRO_CONFIG_COMMANDS([$srcdir/src/cairo-supported-features.h],
 [dnl
 	echo '/* Generated by configure.  Do not edit. */'
@@ -277,6 +285,24 @@ CAIRO_FEATURE_HOOK_REGISTER(yes,*,,
 	AC_DEFINE(cr_feature_tag, 1, [Define to 1 to enable cairo's ]cr_feature_name[ feature])
 ])dnl
 
+dnl Generate src/cairo-features-win32.h
+CAIRO_CONFIG_COMMANDS([$srcdir/src/cairo-features-win32.h],
+[dnl
+	echo '/* Generated by configure.  Do not edit. */'
+	echo '#ifndef CAIRO_FEATURES_H'
+	echo '#define CAIRO_FEATURES_H'
+	echo ''
+	echo '#define HAVE_WINDOWS_H 1'
+	echo ''
+	for FEATURE in $CAIRO_WIN32_FEATURES; do
+		echo "#define $FEATURE 1"
+	done
+	echo ''
+	echo '#endif'
+],[dnl
+	CAIRO_WIN32_FEATURES='$CAIRO_WIN32_FEATURES'
+])dnl
+
 dnl ===========================================================================
 dnl
 dnl Report
diff --git a/src/Makefile.sources b/src/Makefile.sources
index 2ce7746..ba74702 100644
--- a/src/Makefile.sources
+++ b/src/Makefile.sources
@@ -28,9 +28,8 @@
 #     distribution.
 #
 #   * cairo-features-win32.h:
-#     This is a dummy file for use as cairo-featurs.h when building on
-#     win32.  This file is not used during the build and should NOT be
-#     installed.
+#     This file is generated by configure and includes features used
+#     when building using the win32 build system.
 #
 #   * cairo-version.h:
 #     This is a dummy header file used during the build, but it should
diff --git a/src/cairo-features-win32.h b/src/cairo-features-win32.h
deleted file mode 100644
index 754b98a..0000000
--- a/src/cairo-features-win32.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef CAIRO_FEATURES_H
-#define CAIRO_FEATURES_H
-
-#define HAVE_WINDOWS_H 1
-
-#define CAIRO_HAS_SVG_SURFACE 1
-#define CAIRO_HAS_PDF_SURFACE 1
-#define CAIRO_HAS_PS_SURFACE 1
-#define CAIRO_HAS_WIN32_SURFACE 1
-#define CAIRO_HAS_WIN32_FONT 1
-#define CAIRO_HAS_PNG_FUNCTIONS 1
-
-#endif
-
commit 20daa425d8c46b6885653d2433f6027e4990d618
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon Sep 15 23:42:51 2008 -0400

    [configure.ac] Generate boilerplate/Makefile.am.config
    
    Same scheme as in src/

diff --git a/autogen.sh b/autogen.sh
index 99dd84a..ed9ece8 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -169,9 +169,9 @@ do_cmd $ACLOCAL $ACLOCAL_FLAGS
 
 do_cmd $AUTOHEADER
 
-# create dummy src/Makefile.am.config and ChangeLog to make automake happy
-rm -f src/Makefile.am.config
-touch src/Makefile.am.config
+# create dummy */Makefile.am.config and ChangeLog to make automake happy
+> boilerplate/Makefile.am.config
+> src/Makefile.am.config
 touch ChangeLog
 
 # We don't call gtkdocize right now.  When we do, we should then modify
diff --git a/boilerplate/Makefile.am b/boilerplate/Makefile.am
index a24a6d0..5a5168c 100644
--- a/boilerplate/Makefile.am
+++ b/boilerplate/Makefile.am
@@ -1,35 +1,31 @@
+# Note: All source files are listed in Makefile.sources.
+
 include $(top_srcdir)/build/Makefile.am.common
+include $(srcdir)/Makefile.am.config
+
+AM_CPPFLAGS = \
+	-I$(srcdir) \
+	-I$(top_builddir)/src \
+	-I$(top_srcdir)/src \
+	$(CAIRO_CFLAGS) \
+	$(NULL)
 
 EXTRA_DIST += Makefile.win32
 
 EXTRA_LTLIBRARIES += libcairoboilerplate.la
 
-libcairoboilerplate_la_SOURCES =	\
-	cairo-boilerplate.c		\
-	cairo-boilerplate.h		\
-	cairo-boilerplate-getopt.c	\
-	cairo-boilerplate-getopt.h	\
-	cairo-boilerplate-scaled-font.h	\
-	cairo-boilerplate-system.c	\
-	cairo-boilerplate-system.h	\
+libcairoboilerplate_la_SOURCES = \
+	$(enabled_cairo_boilerplate_headers) \
+	$(enabled_cairo_boilerplate_private) \
+	$(enabled_cairo_boilerplate_sources) \
 	$(NULL)
-libcairoboilerplate_la_LIBADD = $(top_builddir)/src/libcairo.la $(CAIRO_LDADD)
+libcairoboilerplate_la_LIBADD = $(top_builddir)/src/libcairo.la
 
 if CAIRO_HAS_BEOS_SURFACE
-#libcairoboilerplate_la_SOURCES += cairo-boilerplate-beos.cpp
-libcairoboilerplate_la_SOURCES += cairo-boilerplate-beos-private.h
 # BeOS system headers trigger this warning
-libcairoboilerplate_la_CXXFLAGS = -Wno-multichar
+AM_CPPFLAGS += -Wno-multichar
 endif
 
-if CAIRO_HAS_DIRECTFB_SURFACE
-libcairoboilerplate_la_SOURCES += cairo-boilerplate-directfb.c
-libcairoboilerplate_la_SOURCES += cairo-boilerplate-directfb-private.h
-endif
-
-if CAIRO_HAS_GLITZ_SURFACE
-libcairoboilerplate_la_SOURCES += cairo-boilerplate-glitz.c
-libcairoboilerplate_la_SOURCES += cairo-boilerplate-glitz-private.h
 if CAIRO_CAN_TEST_GLITZ_AGL_SURFACE
 libcairoboilerplate_la_LIBADD += $(GLITZ_AGL_LIBS)
 endif
@@ -42,65 +38,16 @@ endif
 if CAIRO_CAN_TEST_GLITZ_WGL_SURFACE
 libcairoboilerplate_la_LIBADD += $(GLITZ_WGL_LIBS)
 endif
-endif
-
-if CAIRO_HAS_PDF_SURFACE
-libcairoboilerplate_la_SOURCES += cairo-boilerplate-pdf.c
-libcairoboilerplate_la_SOURCES += cairo-boilerplate-pdf.h
-libcairoboilerplate_la_SOURCES += cairo-boilerplate-pdf-private.h
-endif
-
-if CAIRO_HAS_PS_SURFACE
-libcairoboilerplate_la_SOURCES += cairo-boilerplate-ps.c
-libcairoboilerplate_la_SOURCES += cairo-boilerplate-ps.h
-libcairoboilerplate_la_SOURCES += cairo-boilerplate-ps-private.h
-endif
-
-if CAIRO_HAS_QUARTZ_SURFACE
-libcairoboilerplate_la_SOURCES += cairo-boilerplate-quartz.c
-libcairoboilerplate_la_SOURCES += cairo-boilerplate-quartz-private.h
-endif
-
-if CAIRO_HAS_SVG_SURFACE
-libcairoboilerplate_la_SOURCES += cairo-boilerplate-svg.c
-libcairoboilerplate_la_SOURCES += cairo-boilerplate-svg.h
-libcairoboilerplate_la_SOURCES += cairo-boilerplate-svg-private.h
-endif
-
-if CAIRO_HAS_TEST_SURFACES
-libcairoboilerplate_la_SOURCES += cairo-boilerplate-test-surfaces.c
-libcairoboilerplate_la_SOURCES += cairo-boilerplate-test-surfaces-private.h
-endif
 
 if CAIRO_HAS_WIN32_SURFACE
-libcairoboilerplate_la_SOURCES += cairo-boilerplate-win32.c
-libcairoboilerplate_la_SOURCES += cairo-boilerplate-win32-printing.c
-libcairoboilerplate_la_SOURCES += cairo-boilerplate-win32-private.h
 libcairoboilerplate_la_LIBADD += -lwinspool
 endif
 
-if CAIRO_HAS_XCB_SURFACE
-libcairoboilerplate_la_SOURCES += cairo-boilerplate-xcb.c
-libcairoboilerplate_la_SOURCES += cairo-boilerplate-xcb-private.h
-endif
-
-if CAIRO_HAS_XLIB_SURFACE
-libcairoboilerplate_la_SOURCES += cairo-boilerplate-xlib.c
-libcairoboilerplate_la_SOURCES += cairo-boilerplate-xlib.h
-libcairoboilerplate_la_SOURCES += cairo-boilerplate-xlib-private.h
-endif
-
-AM_CPPFLAGS =					\
-	-I$(srcdir)				\
-	-I$(top_builddir)/src			\
-	-I$(top_srcdir)/src			\
-	$(CAIRO_CFLAGS)
-
 test: check
 
 if CROSS_COMPILING
 else
-TESTS += check-link
+TESTS += check-link$(EXEEXT)
 endif
 
 check_PROGRAMS += check-link
diff --git a/boilerplate/Makefile.sources b/boilerplate/Makefile.sources
new file mode 100644
index 0000000..eaf9040
--- /dev/null
+++ b/boilerplate/Makefile.sources
@@ -0,0 +1,56 @@
+# Makefile.sources
+#
+# This file is pretty similar to $(top_srcdir)/src/Makefile.sources,
+# but for boilerplate.  Unlike that file, there are no special headers.
+#
+
+cairo_boilerplate_headers = \
+	cairo-boilerplate-getopt.h \
+	cairo-boilerplate-scaled-font.h \
+	cairo-boilerplate-system.h \
+	cairo-boilerplate.h \
+	$(NULL)
+cairo_boilerplate_sources = \
+	cairo-boilerplate-getopt.c \
+	cairo-boilerplate-system.c \
+	cairo-boilerplate.c \
+	$(NULL)
+
+# automake is stupid enough to always use c++ linker if we enable the
+# following lines, even if beos surface is not enabled.  Disable it for now.
+cairo_boilerplate_beos_private = cairo-boilerplate-beos-private.h
+#libcairoboilerplate_la_SOURCES += cairo-boilerplate-beos.cpp
+
+cairo_boilerplate_directfb_private = cairo-boilerplate-directfb-private.h
+cairo_boilerplate_directfb_sources = cairo-boilerplate-directfb.c
+
+cairo_boilerplate_glitz_private = cairo-boilerplate-glitz-private.h
+cairo_boilerplate_glitz_sources = cairo-boilerplate-glitz.c
+
+cairo_boilerplate_pdf_headers = cairo-boilerplate-pdf.h
+cairo_boilerplate_pdf_private = cairo-boilerplate-pdf-private.h
+cairo_boilerplate_pdf_sources = cairo-boilerplate-pdf.c
+
+cairo_boilerplate_ps_headers = cairo-boilerplate-ps.h
+cairo_boilerplate_ps_private = cairo-boilerplate-ps-private.h
+cairo_boilerplate_ps_sources = cairo-boilerplate-ps.c
+
+cairo_boilerplate_quartz_private = cairo-boilerplate-quartz-private.h
+cairo_boilerplate_quartz_sources = cairo-boilerplate-quartz.c
+
+cairo_boilerplate_svg_headers = cairo-boilerplate-svg.h
+cairo_boilerplate_svg_private = cairo-boilerplate-svg-private.h
+cairo_boilerplate_svg_sources = cairo-boilerplate-svg.c
+
+cairo_boilerplate_test_surfaces_private = cairo-boilerplate-test-surfaces-private.h
+cairo_boilerplate_test_surfaces_sources = cairo-boilerplate-test-surfaces.c
+
+cairo_boilerplate_win32_private = cairo-boilerplate-win32-private.h
+cairo_boilerplate_win32_sources = cairo-boilerplate-win32.c cairo-boilerplate-win32-printing.c
+
+cairo_boilerplate_xcb_private = cairo-boilerplate-xcb-private.h
+cairo_boilerplate_xcb_sources = cairo-boilerplate-xcb.c
+
+cairo_boilerplate_xlib_headers = cairo-boilerplate-xlib.h
+cairo_boilerplate_xlib_private = cairo-boilerplate-xlib-private.h
+cairo_boilerplate_xlib_sources = cairo-boilerplate-xlib.c
diff --git a/build/aclocal.enable.m4 b/build/aclocal.enable.m4
index 31432a4..f7a660f 100644
--- a/build/aclocal.enable.m4
+++ b/build/aclocal.enable.m4
@@ -222,8 +222,8 @@ m4_define([_CAIRO_ACCUMULATORS_REGISTER],
 	m4_foreach_w([cr_var], [$1], [m4_pattern_allow([CAIRO_]cr_var)])dnl
 ])dnl
 
-m4_define([_CAIRO_SH_ESCAPE],['m4_bpatsubst([$1],['],[\'])'])dnl
-m4_define([_CAIRO_SH_ESCAPE_UNQUOTED],["m4_bpatsubst([$1],["],[\"])"])dnl
+m4_define([_CAIRO_SH_ESCAPE],['m4_bpatsubst([$1],['],[\\'])'])dnl
+m4_define([_CAIRO_SH_ESCAPE_UNQUOTED],["m4_bpatsubst([$1],["],[\\"])"])dnl
 
 dnl
 dnl CAIRO_ACCUMULATORS_REGISTER(VARS, SEPARATOR=[], INITIAL-VALUE=[])
@@ -246,12 +246,12 @@ dnl so it can reference other shell variables for example.
 dnl
 AC_DEFUN([CAIRO_ACCUMULATORS_REGISTER_UNQUOTED],
 [dnl
-	_CAIRO_ACCUMULATORS_REGISTER([$1],[$2],_CAIRO_SH_ESCAPE_UNQUOTED[$3])dnl
+	_CAIRO_ACCUMULATORS_REGISTER([$1],[$2],_CAIRO_SH_ESCAPE_UNQUOTED([$3]))dnl
 ])dnl
 
 m4_define([_CAIRO_ACCUMULATOR_CHECK],
 [dnl
-        m4_ifdef([cr_acc_$1_sep],,[m4_fatal([Accumulator ]$1[ not defined.])])dnl
+        m4_ifdef([cr_acc_$1_sep],,[m4_fatal([Accumulator `]$1[' not defined.])])dnl
 ])dnl
 
 m4_define([_CAIRO_ACCUMULATE],
@@ -309,6 +309,26 @@ AC_DEFUN([CAIRO_ACCUMULATE_UNQUOTED_BEFORE],
 ])dnl
 
 dnl
+dnl CAIRO_ACCUMULATE_UNQUOTED_UNCHECKED(VAR, VALUE)
+dnl
+dnl Like CAIRO_ACCUMULATE_UNQUOTED but VALUE is not tested for emptiness.
+dnl
+AC_DEFUN([CAIRO_ACCUMULATE_UNQUOTED_UNCHECKED],
+[dnl
+	_CAIRO_ACCUMULATE([$1], [$2], [CAIRO_$1="${CAIRO_$1}]m4_do([cr_acc_$1_sep])["]_CAIRO_SH_ESCAPE_UNQUOTED([$2]))dnl
+])dnl
+
+dnl
+dnl CAIRO_ACCUMULATE_UNQUOTED_UNCHECKED_BEFORE(VAR, VALUE)
+dnl
+dnl Like CAIRO_ACCUMULATE_UNQUOTED_BEFORE but VALUE is not tested for emptiness.
+dnl
+AC_DEFUN([CAIRO_ACCUMULATE_UNQUOTED_BEFORE],
+[dnl
+	_CAIRO_ACCUMULATE([$1], [$2], [CAIRO_$1=]_CAIRO_SH_ESCAPE_UNQUOTED([$2])["]m4_do([cr_acc_$1_sep])[${CAIRO_$1}"])dnl
+])dnl
+
+dnl
 dnl CAIRO_ACCUMULATORS_FOREACH(VAR, COMMANDS)
 dnl 
 dnl Run COMMANDS for each registered accumulator.
@@ -439,4 +459,3 @@ AC_DEFUN([CAIRO_FEATURE_HOOK_REGISTER],
 	], m4_newline)dnl
 ])dnl
 
-
diff --git a/build/aclocal.makefile.m4 b/build/aclocal.makefile.m4
new file mode 100644
index 0000000..e7a19c1
--- /dev/null
+++ b/build/aclocal.makefile.m4
@@ -0,0 +1,143 @@
+dnl
+dnl These are the facilities for generating Makefile.am.config and
+dnl Makefile.win32.config files.
+dnl
+
+dnl ===========================================================================
+
+dnl
+dnl Define cr_feature_tag ala other cr_feature_* macros
+dnl Expands to CAIRO_HAS_FEATURE_ID
+dnl
+m4_define([_CAIRO_BUILD_FEATURE_TAG_NORMALIZED],
+	[CAIRO_HAS_[$1]m4_bmatch([$1],[$2$],,[$2])])dnl
+m4_define([_CAIRO_BUILD_FEATURE_TAG],
+	[_CAIRO_BUILD_FEATURE_TAG_NORMALIZED(AS_TR_CPP([$1]),AS_TR_CPP(m4_ifval([$2],[ $2])))])dnl
+m4_define([cr_feature_tag],
+	[_CAIRO_BUILD_FEATURE_TAG(cr_feature,cr_feature_what)])dnl
+
+
+dnl ===========================================================================
+dnl
+dnl CAIRO_INIT_MAKEFILES()
+dnl
+dnl Sets up automake conditionals for all features
+dnl
+AC_DEFUN([CAIRO_INIT_MAKEFILES],
+[dnl
+	dnl Allow feature tags in the output
+	m4_pattern_allow(^CAIRO_HAS_)dnl
+
+	dnl Automake conditionals for all features
+	CAIRO_FEATURE_HOOK_REGISTER(*,*,*,
+	[dnl
+		AM_CONDITIONAL(cr_feature_tag, test "x$use_$1" = xyes)dnl
+	])dnl
+])dnl
+
+dnl ===========================================================================
+
+m4_define([_CAIRO_MAKEFILES])dnl
+
+dnl
+dnl CAIRO_CONFIG_MAKEFILE(TAG, DIR)
+dnl
+dnl Create DIR/Makefile.*.config files
+dnl TAG is a TAG used by other CAIRO_MAKEFILE_* macros to append to these
+dnl Makefile's.
+dnl
+AC_DEFUN([CAIRO_CONFIG_MAKEFILE],
+[dnl
+	m4_append_uniq([_CAIRO_MAKEFILES], [$1], [ ],,
+		     [m4_fatal([Makefile `$1' already registered])])dnl
+
+	dnl Remember directory for this makefile tag
+        m4_define([cr_make_$1_dir],[$2])dnl
+
+	dnl Accumulators
+	CAIRO_ACCUMULATORS_REGISTER(MAKEFILE_$1_AMAKE, m4_newline, [# Generated by configure.  Do not edit.]m4_newline[include $(top_srcdir)/$2/Makefile.sources]m4_newline)dnl
+	CAIRO_ACCUMULATORS_REGISTER_UNQUOTED(MAKEFILE_$1_WIN32, m4_newline, [$CAIRO_MAKEFILE_$1_AMAKE])dnl
+
+	dnl Generate
+	CAIRO_CONFIG_COMMANDS([$srcdir/$2/Makefile.am.config],
+			      [echo "$CAIRO_MAKEFILE_$1_AMAKE"],
+			      [CAIRO_MAKEFILE_$1_AMAKE='$CAIRO_MAKEFILE_$1_AMAKE'])dnl
+	CAIRO_CONFIG_COMMANDS([$srcdir/$2/Makefile.win32.config],
+			      [echo "$CAIRO_MAKEFILE_$1_WIN32"],
+			      [CAIRO_MAKEFILE_$1_WIN32='$CAIRO_MAKEFILE_$1_WIN32'])dnl
+])dnl
+
+m4_define([_CAIRO_MAKEFILE_CHECK],
+[dnl
+        m4_ifdef([cr_make_$1_dir],,[m4_fatal([Makefile `]$1[' not defined.])])dnl
+])dnl
+
+m4_pattern_allow([cr_make_tmp])
+
+dnl
+dnl CAIRO_MAKEFILE_ACCUMULATE(TAG, CONTENT)
+dnl
+dnl Accumulates CONTENT to Makefile's for TAG.  If TAG is *,
+dnl CONTENT is added to all Makefile's.
+dnl
+AC_DEFUN([CAIRO_MAKEFILE_ACCUMULATE],
+[dnl
+	m4_if([$1],[*],,[_CAIRO_MAKEFILE_CHECK([$1])])dnl
+	m4_foreach_w([cr_makefile], m4_if([$1],[*],_CAIRO_MAKEFILES,[$1]),
+	[dnl
+		m4_pushdef([cr_make_acc_contents],[$2])dnl
+		cr_make_tmp=_CAIRO_SH_ESCAPE(cr_make_acc_contents(cr_makefile))
+		m4_popdef([cr_make_acc_contents])dnl
+		CAIRO_ACCUMULATE_UNQUOTED_UNCHECKED([MAKEFILE_]cr_makefile[_AMAKE], [$cr_make_tmp])dnl
+		CAIRO_ACCUMULATE_UNQUOTED_UNCHECKED([MAKEFILE_]cr_makefile[_WIN32], [$cr_make_tmp])dnl
+	])dnl
+])dnl
+
+m4_define([_CAIRO_MAKEFILE_ACCUMULATE_FEATURE],
+[dnl
+	m4_case([$2],
+		[*],,
+		[yes],	[CAIRO_ACCUMULATE([$1], [$3])],
+		[no],	[CAIRO_ACCUMULATE([$1], [$3]m4_newline[$4])],
+			[m4_fatal([Invalid ENABLED value `]$2['])])dnl
+	CAIRO_ACCUMULATE_UNQUOTED_UNCHECKED([$1], [$6])dnl
+	m4_case([$2],
+		[*],,
+		[yes],	[CAIRO_ACCUMULATE([$1], [$5])],
+		[no],	[CAIRO_ACCUMULATE([$1], [$5])],
+			[m4_fatal([Invalid ENABLED value `]$2['])])dnl
+])dnl
+
+dnl
+dnl CAIRO_MAKEFILE_ACCUMULATE_FEATURE(TAG, ENABLED, DEFAULT, WHAT, CONTENT)
+dnl
+dnl Accumulates CONTENT to Makefile's for TAG for each feature matching
+dnl ENABLED, DEFAULT, and WHAT.  Those parameters are similar to those
+dnl passed to CAIRO_FEATURE_HOOK_REGISTER.
+dnl If TAG is *, CONTENT is added to all Makefile's.
+dnl
+AC_DEFUN([CAIRO_MAKEFILE_ACCUMULATE_FEATURE],
+[dnl
+	m4_if([$1],[*],,[_CAIRO_MAKEFILE_CHECK([$1])])dnl
+	m4_pushdef([cr_make_acc_contents],[$5])dnl
+	CAIRO_FEATURE_HOOK_REGISTER(*,[$3],[$4],
+	[dnl
+		m4_foreach_w([cr_makefile], m4_if([$1],[*],_CAIRO_MAKEFILES,[$1]),
+		[dnl
+			m4_pushdef([cr_make_acc_contents],[$5])dnl
+			cr_make_tmp=_CAIRO_SH_ESCAPE(]]cr_make_acc_contents([[[[]]]]cr_makefile(),[$][1],[$][2],[$][3],[$][4])[[)
+			_CAIRO_MAKEFILE_ACCUMULATE_FEATURE(
+				[MAKEFILE_]cr_makefile[_AMAKE],
+				[$2],
+				[if ]cr_feature_tag, [else], [endif],
+				[$cr_make_tmp])dnl
+			_CAIRO_MAKEFILE_ACCUMULATE_FEATURE(
+				[MAKEFILE_]cr_makefile[_WIN32],
+				[$2],
+				[ifeq ($(]cr_feature_tag[),1)], [else], [endif],
+				[$cr_make_tmp])dnl
+		])dnl
+	])dnl
+	m4_popdef([cr_make_acc_contents])dnl
+])dnl
+
diff --git a/build/configure.ac.enable b/build/configure.ac.enable
deleted file mode 100644
index 1e757fb..0000000
--- a/build/configure.ac.enable
+++ /dev/null
@@ -1,404 +0,0 @@
-
-dnl
-dnl Define macros to enable various features.
-dnl  - Macro: CAIRO_ENABLE_* (ID, NAME, DEFAULT, COMMANDS)
-dnl
-dnl where:
-dnl
-dnl	ID is the feature id, eg. "ft" for cairo_ft_...
-dnl	NAME is the human-readable name of the feature, eg. "FreeType"
-dnl	DEFAULT is the default state of the feature:
-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	COMMANDS are run to check whether the feature can be enabled.  Their
-dnl		result may be cached, so user should not count on them being run.
-dnl		They should set use_$(ID) to something other than yes if the
-dnl		feature cannot be built, eg. "no (requires SomeThing)".  It then
-dnl		should also set $(ID)_REQUIRES/CFLAGS/LIBS/...
-dnl		appropriately.  Look at the macro definition for more details,
-dnl		or ask if in doubt.
-dnl
-
-AC_DEFUN([CAIRO_ENABLE],
-	[_CAIRO_ENABLE([$1],	[$2],			,		[$3],[$4])])dnl
-
-AC_DEFUN([CAIRO_ENABLE_SURFACE_BACKEND],
-	[_CAIRO_ENABLE([$1],	[$2 surface backend],	surface,	[$3],[$4])])dnl
-
-AC_DEFUN([CAIRO_ENABLE_FONT_BACKEND],
-	[_CAIRO_ENABLE([$1],	[$2 font backend],	font,	  	[$3],[$4])])dnl
-
-AC_DEFUN([CAIRO_ENABLE_FUNCTIONS],
-	[_CAIRO_ENABLE([$1],	[$2 functions],		functions,	[$3],[$4])])dnl
-
-
-dnl
-dnl Define cr_feature_tag ala other cr_feature_* macros
-dnl Expands to CAIRO_HAS_FEATURE_ID
-dnl
-m4_define([_CAIRO_BUILD_FEATURE_TAG_NORMALIZED],
-	[CAIRO_HAS_[$1]m4_bmatch([$1],[$2$],,[$2])])dnl
-m4_define([_CAIRO_BUILD_FEATURE_TAG],
-	[_CAIRO_BUILD_FEATURE_TAG_NORMALIZED(AS_TR_CPP([$1]),AS_TR_CPP(m4_ifval([$2],[ $2])))])dnl
-m4_define([cr_feature_tag],
-	[_CAIRO_BUILD_FEATURE_TAG(cr_feature,cr_feature_what)])dnl
-
-dnl Allow feature tags in the output
-m4_pattern_allow(^CAIRO_HAS_)dnl
-
-
-dnl
-dnl Define cr_feature_pc and friends ala other cr_feature_* macros
-dnl
-m4_define([cr_pc_modname],
-	[[cairo-]m4_translit([$1],_,-)])dnl
-m4_define([cr_feature_pc],
-	[cr_pc_modname(cr_feature)[.pc]])dnl
-m4_define([cr_feature_uninstalled_pc],
-	[cr_pc_modname(cr_feature)[-uninstalled.pc]])dnl
-
-
-dnl ===========================================================================
-dnl
-dnl Hooks
-dnl
-dnl ===========================================================================
-
-
-dnl ===========================================================================
-dnl
-dnl Automake conditionals for all features
-dnl
-CAIRO_FEATURE_HOOK_REGISTER(*,*,*,
-[dnl
-	AM_CONDITIONAL(cr_feature_tag, test "x$use_$1" = xyes)dnl
-])dnl
-
-
-dnl ===========================================================================
-dnl
-dnl Generate {src,boilerplate}/Makefile.{am,win32}.config
-dnl
-
-dnl Accumulators
-dnl	CAIRO_ACCUMULATE(FEATURES, cr_feature_tag)
-CAIRO_ACCUMULATORS_REGISTER(CONFIG_AMAKE,m4_newline,[# Generated by configure.  Do not edit.
-include $(top_srcdir)/src/Makefile.sources
-
-all_cairo_files = $(all_cairo_headers) $(all_cairo_private) $(all_cairo_sources)
-enabled_cairo_files = $(enabled_cairo_headers) $(enabled_cairo_private) $(enabled_cairo_sources)
-
-all_cairo_headers = $(cairo_headers)
-all_cairo_private = $(cairo_private)
-all_cairo_sources = $(cairo_sources)
-enabled_cairo_headers = $(cairo_headers)
-enabled_cairo_private = $(cairo_private)
-enabled_cairo_sources = $(cairo_sources)
-
-supported_cairo_headers = $(cairo_headers)
-unsupported_cairo_headers =
-])dnl
-
-CAIRO_ACCUMULATORS_REGISTER_UNQUOTED(CONFIG_WIN32,m4_newline,[$CAIRO_CONFIG_AMAKE])dnl
-
-dnl Generate
-CAIRO_CONFIG_COMMANDS([$srcdir/src/Makefile.am.config],
-		      [echo "$CAIRO_CONFIG_AMAKE"],
-		      [CAIRO_CONFIG_AMAKE='$CAIRO_CONFIG_AMAKE'])dnl
-CAIRO_CONFIG_COMMANDS([$srcdir/src/Makefile.win32.config],
-		      [echo "$CAIRO_CONFIG_WIN32"],
-		      [CAIRO_CONFIG_WIN32='$CAIRO_CONFIG_WIN32'])dnl
-
-dnl Collect list of all supported public cairo headers
-CAIRO_FEATURE_HOOK_REGISTER(*,!no,!,
-[dnl
-	CAIRO_ACCUMULATE(CONFIG_AMAKE, [supported_cairo_headers += $(cairo_$1_headers)])dnl
-	CAIRO_ACCUMULATE(CONFIG_WIN32, [supported_cairo_headers += $(cairo_$1_headers)])dnl
-])dnl
-
-dnl Collect list of all unsupported public cairo headers
-CAIRO_FEATURE_HOOK_REGISTER(*,no,!,
-[dnl
-	CAIRO_ACCUMULATE(CONFIG_AMAKE, [unsupported_cairo_headers += $(cairo_$1_headers)])dnl
-	CAIRO_ACCUMULATE(CONFIG_WIN32, [unsupported_cairo_headers += $(cairo_$1_headers)])dnl
-])dnl
-
-dnl Collect list of source files for all/enabled public features
-CAIRO_FEATURE_HOOK_REGISTER(*,*,!,
-[dnl
-	CAIRO_ACCUMULATE(CONFIG_AMAKE, [dnl
-all_cairo_headers += $(cairo_$1_headers)
-all_cairo_private += $(cairo_$1_private)
-all_cairo_sources += $(cairo_$1_sources)
-if cr_feature_tag
-enabled_cairo_headers += $(cairo_$1_headers)
-enabled_cairo_private += $(cairo_$1_private)
-enabled_cairo_sources += $(cairo_$1_sources)
-endif
-])dnl
-	CAIRO_ACCUMULATE(CONFIG_WIN32, [dnl
-all_cairo_headers += $(cairo_$1_headers)
-all_cairo_private += $(cairo_$1_private)
-all_cairo_sources += $(cairo_$1_sources)
-ifeq ($(cr_feature_tag),1)
-enabled_cairo_headers += $(cairo_$1_headers)
-enabled_cairo_private += $(cairo_$1_private)
-enabled_cairo_sources += $(cairo_$1_sources)
-endif
-])dnl
-])dnl
-
-dnl Collect list of source files for all/enabled private features
-CAIRO_FEATURE_HOOK_REGISTER(*,*,,
-[dnl
-	dnl No public headers for private features
-	CAIRO_ACCUMULATE(CONFIG_AMAKE, [dnl
-all_cairo_private += $(cairo_$1_private) $(cairo_$1_headers)
-all_cairo_sources += $(cairo_$1_sources)
-if cr_feature_tag
-enabled_cairo_private += $(cairo_$1_private) $(cairo_$1_headers)
-enabled_cairo_sources += $(cairo_$1_sources)
-endif
-])dnl
-	CAIRO_ACCUMULATE(CONFIG_WIN32, [dnl
-all_cairo_private += $(cairo_$1_private) $(cairo_$1_headers)
-all_cairo_sources += $(cairo_$1_sources)
-ifeq ($(cr_feature_tag),1)
-enabled_cairo_private += $(cairo_$1_private) $(cairo_$1_headers)
-enabled_cairo_sources += $(cairo_$1_sources)
-endif
-])dnl
-])dnl
-
-
-dnl ===========================================================================
-dnl
-dnl Generate .pc files
-dnl
-
-dnl All .pc files are generated automatically except for this one
-AC_CONFIG_FILES([src/cairo.pc])dnl
-AC_CONFIG_FILES([cairo-uninstalled.pc:src/cairo-uninstalled.pc.in])dnl
-
-dnl pkg-config requires, non-pkgconfig cflags and libs, and total cflags and libs
-CAIRO_FEATURE_VARS_REGISTER([BASE],[cairo])dnl
-CAIRO_ACCUMULATED_FEATURE_VARS_REGISTER([REQUIRES],,[ ])dnl
-CAIRO_ACCUMULATED_FEATURE_VARS_REGISTER([CFLAGS NONPKGCONFIG_CFLAGS],,[ ])dnl
-CAIRO_ACCUMULATED_FEATURE_VARS_REGISTER([LIBS NONPKGCONFIG_LIBS],,[ ],[$LIBS])dnl
-AC_SUBST(CAIRO_REQUIRES)dnl
-AC_SUBST(CAIRO_CFLAGS)dnl
-AC_SUBST(CAIRO_NONPKGCONFIG_CFLAGS)dnl
-AC_SUBST(CAIRO_LIBS)dnl
-AC_SUBST(CAIRO_NONPKGCONFIG_LIBS)dnl
-
-dnl add non-pkgconfig values
-AC_CONFIG_COMMANDS_PRE(
-[dnl
-CAIRO_CFLAGS="$CAIRO_CFLAGS $CAIRO_NONPKGCONFIG_CFLAGS"
-CAIRO_LIBS="$CAIRO_LIBS $CAIRO_NONPKGCONFIG_LIBS"
-])dnl
-
-m4_define([_CAIRO_FEATURE_CONFIG_PKGCONFIG_FILE],
-[dnl
-	AC_CONFIG_FILES([$3:$4],
-	[dnl
-		mv "$3" "$3.tmp" &&
-		$SED "dnl
-		s%@FEATURE_PC@%]cr_pc_modname([$1])[%g;dnl
-		s%@FEATURE_NAME@%$2%g;dnl
-		s%@FEATURE_BASE@%$$1_BASE%g;dnl
-		s%@FEATURE_REQUIRES@%$$1_REQUIRES%g;dnl
-		s%@FEATURE_NONPKGCONFIG_LIBS@%$$1_NONPKGCONFIG_LIBS%g;dnl
-		s%@FEATURE_NONPKGCONFIG_CFLAGS@%$$1_NONPKGCONFIG_CFLAGS%g;dnl
-		" < "$3.tmp" > "$3" && rm -f "$3.tmp" ||
-		AC_MSG_ERROR(failed to update $3)
-	],[dnl
-		SED='$SED'
-		$1_BASE='$$1_BASE'
-		$1_REQUIRES='$$1_REQUIRES'
-		$1_NONPKGCONFIG_LIBS='$$1_NONPKGCONFIG_LIBS'
-		$1_NONPKGCONFIG_CFLAGS='$$1_NONPKGCONFIG_CFLAGS'
-	])dnl
-])dnl
-
-dnl Generate .pc files for enabled non-builtin public features
-CAIRO_FEATURE_HOOK_REGISTER(yes,!always,!,
-[dnl
-	_CAIRO_FEATURE_CONFIG_PKGCONFIG_FILE(
-		[$1],
-		cr_feature_name,
-		[src/]cr_feature_pc,
-		[src/cairo-features.pc.in]
-	)dnl
-])dnl
-
-dnl Generate -uninstalled.pc files for enabled non-builtin public features
-CAIRO_FEATURE_HOOK_REGISTER(yes,!always,!,
-[dnl
-	_CAIRO_FEATURE_CONFIG_PKGCONFIG_FILE(
-		[$1],
-		cr_feature_name,
-		cr_feature_uninstalled_pc,
-		[src/cairo-features-uninstalled.pc.in]
-	)dnl
-])dnl
-
-
-dnl Collect list of .pc files for all/enabled non-builtin public features
-
-CAIRO_ACCUMULATE(CONFIG_AMAKE, [dnl
-all_cairo_pkgconf = cairo.pc
-enabled_cairo_pkgconf = cairo.pc
-])dnl
-
-CAIRO_FEATURE_HOOK_REGISTER(*,!always,!,
-[dnl
-	CAIRO_ACCUMULATE(CONFIG_AMAKE, [dnl
-all_cairo_pkgconf += cr_feature_pc
-if cr_feature_tag
-enabled_cairo_pkgconf += cr_feature_pc
-endif
-])dnl
-])dnl
-
-
-dnl ===========================================================================
-dnl
-dnl Generate src/cairo-features.h src/cairo-supported-features.h
-dnl
-
-dnl Collect list of enabled public features
-CAIRO_ACCUMULATORS_REGISTER(FEATURES,[ ])dnl
-CAIRO_FEATURE_HOOK_REGISTER(yes,*,!,dnl
-[dnl
-	CAIRO_ACCUMULATE(FEATURES, cr_feature_tag)dnl
-])dnl
-dnl Collect list of all supported public features
-CAIRO_ACCUMULATORS_REGISTER(SUPPORTED_FEATURES,[ ])dnl
-CAIRO_FEATURE_HOOK_REGISTER(*,!no,!,dnl
-[dnl
-	CAIRO_ACCUMULATE(SUPPORTED_FEATURES, cr_feature_tag)
-])dnl
-dnl Collect list of all supported disabled public features
-CAIRO_ACCUMULATORS_REGISTER(NO_FEATURES,[ ])dnl
-CAIRO_FEATURE_HOOK_REGISTER(no,!no,!,
-[dnl
-	CAIRO_ACCUMULATE(NO_FEATURES, cr_feature_tag)
-])dnl
-
-dnl Generate src/cairo-features.h and src/cairo-supported-features.h
-CAIRO_CONFIG_COMMANDS([src/cairo-features.h],
-[dnl
-	echo '/* Generated by configure.  Do not edit. */'
-	echo '#ifndef CAIRO_FEATURES_H'
-	echo '#define CAIRO_FEATURES_H'
-	echo ''
-	for FEATURE in $CAIRO_FEATURES; do
-		echo "#define $FEATURE 1"
-	done | LANG=C sort
-	echo ''
-	for FEATURE in $CAIRO_NO_FEATURES; do
-		echo "/*#undef $FEATURE */"
-	done | LANG=C sort
-	echo ''
-	echo '#endif'
-],[dnl
-	CAIRO_FEATURES='$CAIRO_FEATURES'
-	CAIRO_NO_FEATURES='$CAIRO_NO_FEATURES'
-])dnl
-CAIRO_CONFIG_COMMANDS([$srcdir/src/cairo-supported-features.h],
-[dnl
-	echo '/* Generated by configure.  Do not edit. */'
-	echo '#ifndef CAIRO_SUPPORTED_FEATURES_H'
-	echo '#define CAIRO_SUPPORTED_FEATURES_H'
-	echo ''
-	echo '/* This is a dummy header, to trick gtk-doc only */'
-	echo ''
-	for FEATURE in $CAIRO_SUPPORTED_FEATURES; do
-		echo "#define $FEATURE 1"
-	done
-	echo ''
-	echo '#endif'
-],[dnl
-	CAIRO_SUPPORTED_FEATURES='$CAIRO_SUPPORTED_FEATURES'
-])dnl
-
-dnl For enabled private features just define them in config.h.  No fanfare!
-CAIRO_FEATURE_HOOK_REGISTER(yes,*,,
-[dnl
-	AC_DEFINE(cr_feature_tag, 1, [Define to 1 to enable cairo's ]cr_feature_name[ feature])
-])dnl
-
-dnl ===========================================================================
-dnl
-dnl Report
-dnl
-
-CAIRO_ACCUMULATORS_REGISTER([WARNING_MESSAGE],m4_newline()m4_newline)dnl
-
-dnl Collect warning message for enabled unsupported public features
-CAIRO_FEATURE_HOOK_REGISTER(yes,no,!,
-[dnl
-	CAIRO_ACCUMULATE([WARNING_MESSAGE], m4_text_wrap([The ]cr_feature_name[ feature is still under active development and is included in this release only as a preview. It does NOT fully work yet and incompatible changes may yet be made to ]cr_feature_name[ specific API.], [--- ],, 78))
-])dnl
-
-dnl Collect warning message for disabled recommended features
-CAIRO_FEATURE_HOOK_REGISTER(no,yes,*,
-[dnl
-	CAIRO_ACCUMULATE([WARNING_MESSAGE], m4_text_wrap([It is strictly recommended that you do NOT disable the ]cr_feature_name[ feature.], [+++ ],, 78))
-])dnl
-
-
-AC_DEFUN([CAIRO_REPORT],
-[dnl
-	V="$CAIRO_VERSION_MAJOR.$CAIRO_VERSION_MINOR.$CAIRO_VERSION_MICRO"
-	echo ""
-	echo "cairo (version $V [[$CAIRO_RELEASE_STATUS]]) will be compiled with the following surface backends:"
-	echo "  Image:         yes (always builtin)"
-	echo "  Xlib:          $use_xlib"
-	echo "  Xlib Xrender:  $use_xlib_xrender"
-	echo "  Quartz:        $use_quartz"
-	echo "  Quartz-image:  $use_quartz_image"
-	echo "  XCB:           $use_xcb"
-	echo "  Win32:         $use_win32"
-	echo "  OS2:           $use_os2"
-	echo "  PostScript:    $use_ps"
-	echo "  PDF:           $use_pdf"
-	echo "  SVG:           $use_svg"
-	echo "  glitz:         $use_glitz"
-	echo "  BeOS:          $use_beos"
-	echo "  DirectFB:      $use_directfb"
-	echo ""
-	echo "the following font backends:"
-	echo "  User:          yes (always builtin)"
-	echo "  FreeType:      $use_ft"
-	echo "  Win32:         $use_win32_font"
-	echo "  Quartz:        $use_quartz_font"
-	echo ""
-	echo "the following features:"
-	echo "  PNG functions: $use_png"
-	echo ""
-	echo "and the following debug options:"
-	echo "  gcov support:  $use_gcov"
-	echo "  test surfaces: $use_test_surfaces"
-	echo "  ps testing:    $test_ps"
-	echo "  pdf testing:   $test_pdf"
-	echo "  svg testing:   $test_svg"
-	if test x"$use_win32" = "xyes"; then
-		echo "  win32 printing testing:    $test_win32_printing"
-	fi
-	echo ""
-
-	if test x"$use_ft"          != "xyes" && \
-	   test x"$use_win32_font"  != "xyes" && \
-	   test x"$use_quartz_font" != "xyes" ; then
-
-	   AC_MSG_ERROR([Cairo requires at least one font backend.
-			  Please install freetype and fontconfig, then try again:
-			  http://freetype.org/	http://fontconfig.org/
-			])
-	fi
-	echo "$CAIRO_WARNING_MESSAGE"
-])dnl
-
diff --git a/build/configure.ac.features b/build/configure.ac.features
new file mode 100644
index 0000000..bb143cc
--- /dev/null
+++ b/build/configure.ac.features
@@ -0,0 +1,351 @@
+
+dnl
+dnl Define macros to enable various features.
+dnl  - Macro: CAIRO_ENABLE_* (ID, NAME, DEFAULT, COMMANDS)
+dnl
+dnl where:
+dnl
+dnl	ID is the feature id, eg. "ft" for cairo_ft_...
+dnl	NAME is the human-readable name of the feature, eg. "FreeType"
+dnl	DEFAULT is the default state of the feature:
+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	COMMANDS are run to check whether the feature can be enabled.  Their
+dnl		result may be cached, so user should not count on them being run.
+dnl		They should set use_$(ID) to something other than yes if the
+dnl		feature cannot be built, eg. "no (requires SomeThing)".  It then
+dnl		should also set $(ID)_REQUIRES/CFLAGS/LIBS/...
+dnl		appropriately.  Look at the macro definition for more details,
+dnl		or ask if in doubt.
+dnl
+
+AC_DEFUN([CAIRO_ENABLE],
+	[_CAIRO_ENABLE([$1],	[$2],			,		[$3],[$4])])dnl
+
+AC_DEFUN([CAIRO_ENABLE_SURFACE_BACKEND],
+	[_CAIRO_ENABLE([$1],	[$2 surface backend],	surface,	[$3],[$4])])dnl
+
+AC_DEFUN([CAIRO_ENABLE_FONT_BACKEND],
+	[_CAIRO_ENABLE([$1],	[$2 font backend],	font,	  	[$3],[$4])])dnl
+
+AC_DEFUN([CAIRO_ENABLE_FUNCTIONS],
+	[_CAIRO_ENABLE([$1],	[$2 functions],		functions,	[$3],[$4])])dnl
+
+
+dnl
+dnl Define cr_feature_pc and friends ala other cr_feature_* macros
+dnl
+m4_define([cr_pc_modname],
+	[[cairo-]m4_translit([$1],_,-)])dnl
+m4_define([cr_feature_pc],
+	[cr_pc_modname(cr_feature)[.pc]])dnl
+m4_define([cr_feature_uninstalled_pc],
+	[cr_pc_modname(cr_feature)[-uninstalled.pc]])dnl
+
+
+dnl ===========================================================================
+dnl
+dnl Hooks
+dnl
+dnl ===========================================================================
+
+
+dnl ===========================================================================
+dnl
+dnl Generate {src,boilerplate}/Makefile.{am,win32}.config
+dnl
+
+CAIRO_INIT_MAKEFILES()
+CAIRO_CONFIG_MAKEFILE([cairo], [src])dnl
+CAIRO_CONFIG_MAKEFILE([cairo_boilerplate], [boilerplate])dnl
+
+
+dnl Collect list of all supported public headers
+CAIRO_MAKEFILE_ACCUMULATE(*,
+[supported_$1_headers = $($1_headers)]dnl
+)dnl
+CAIRO_MAKEFILE_ACCUMULATE_FEATURE(*,*,!no,!,
+[supported_$1_headers += $($1_$2_headers)]dnl
+)dnl
+
+dnl Collect list of all unsupported public headers
+CAIRO_MAKEFILE_ACCUMULATE(*,
+[unsupported_$1_headers =]dnl
+)dnl
+CAIRO_MAKEFILE_ACCUMULATE_FEATURE(*,*,no,!,
+[unsupported_$1_headers += $($1_$2_headers)]dnl
+)dnl
+
+dnl Collect list of source files for all public features
+CAIRO_MAKEFILE_ACCUMULATE(*,
+[dnl
+all_$1_files = $(all_$1_headers) $(all_$1_private) $(all_$1_sources)
+all_$1_headers = $($1_headers)
+all_$1_private = $($1_private)
+all_$1_sources = $($1_sources)
+])dnl
+CAIRO_MAKEFILE_ACCUMULATE_FEATURE(*,*,*,!,
+[dnl
+all_$1_headers += $($1_$2_headers)
+all_$1_private += $($1_$2_private)
+all_$1_sources += $($1_$2_sources)
+])dnl
+
+dnl Collect list of source files for enabled public features
+CAIRO_MAKEFILE_ACCUMULATE(*,
+[dnl
+enabled_$1_files = $(enabled_$1_headers) $(enabled_$1_private) $(enabled_$1_sources)
+enabled_$1_headers = $($1_headers)
+enabled_$1_private = $($1_private)
+enabled_$1_sources = $($1_sources)
+])dnl
+CAIRO_MAKEFILE_ACCUMULATE_FEATURE(*,yes,*,!,
+[dnl
+enabled_$1_headers += $($1_$2_headers)
+enabled_$1_private += $($1_$2_private)
+enabled_$1_sources += $($1_$2_sources)
+])dnl
+
+dnl No public headers for private features
+
+dnl Collect list of source files for all private features
+CAIRO_MAKEFILE_ACCUMULATE_FEATURE(*,*,*,,
+[dnl
+all_$1_private += $($1_$2_private) $($1_$2_headers)
+all_$1_sources += $($1_$2_sources)
+])dnl
+
+dnl Collect list of source files for enabled private features
+CAIRO_MAKEFILE_ACCUMULATE_FEATURE(*,yes,*,,
+[dnl
+enabled_$1_private += $($1_$2_private) $($1_$2_headers)
+enabled_$1_sources += $($1_$2_sources)
+])dnl
+
+
+dnl ===========================================================================
+dnl
+dnl Generate .pc files
+dnl
+
+dnl All .pc files are generated automatically except for this one
+AC_CONFIG_FILES([src/cairo.pc])dnl
+AC_CONFIG_FILES([cairo-uninstalled.pc:src/cairo-uninstalled.pc.in])dnl
+
+dnl pkg-config requires, non-pkgconfig cflags and libs, and total cflags and libs
+CAIRO_FEATURE_VARS_REGISTER([BASE],[cairo])dnl
+CAIRO_ACCUMULATED_FEATURE_VARS_REGISTER([REQUIRES],,[ ])dnl
+CAIRO_ACCUMULATED_FEATURE_VARS_REGISTER([CFLAGS NONPKGCONFIG_CFLAGS],,[ ])dnl
+CAIRO_ACCUMULATED_FEATURE_VARS_REGISTER([LIBS NONPKGCONFIG_LIBS],,[ ],[$LIBS])dnl
+AC_SUBST(CAIRO_REQUIRES)dnl
+AC_SUBST(CAIRO_CFLAGS)dnl
+AC_SUBST(CAIRO_NONPKGCONFIG_CFLAGS)dnl
+AC_SUBST(CAIRO_LIBS)dnl
+AC_SUBST(CAIRO_NONPKGCONFIG_LIBS)dnl
+
+dnl add non-pkgconfig values
+AC_CONFIG_COMMANDS_PRE(
+[dnl
+CAIRO_CFLAGS="$CAIRO_CFLAGS $CAIRO_NONPKGCONFIG_CFLAGS"
+CAIRO_LIBS="$CAIRO_LIBS $CAIRO_NONPKGCONFIG_LIBS"
+])dnl
+
+m4_define([_CAIRO_FEATURE_CONFIG_PKGCONFIG_FILE],
+[dnl
+	AC_CONFIG_FILES([$3:$4],
+	[dnl
+		mv "$3" "$3.tmp" &&
+		$SED "dnl
+		s%@FEATURE_PC@%]cr_pc_modname([$1])[%g;dnl
+		s%@FEATURE_NAME@%$2%g;dnl
+		s%@FEATURE_BASE@%$$1_BASE%g;dnl
+		s%@FEATURE_REQUIRES@%$$1_REQUIRES%g;dnl
+		s%@FEATURE_NONPKGCONFIG_LIBS@%$$1_NONPKGCONFIG_LIBS%g;dnl
+		s%@FEATURE_NONPKGCONFIG_CFLAGS@%$$1_NONPKGCONFIG_CFLAGS%g;dnl
+		" < "$3.tmp" > "$3" && rm -f "$3.tmp" ||
+		AC_MSG_ERROR(failed to update $3)
+	],[dnl
+		SED='$SED'
+		$1_BASE='$$1_BASE'
+		$1_REQUIRES='$$1_REQUIRES'
+		$1_NONPKGCONFIG_LIBS='$$1_NONPKGCONFIG_LIBS'
+		$1_NONPKGCONFIG_CFLAGS='$$1_NONPKGCONFIG_CFLAGS'
+	])dnl
+])dnl
+
+dnl Generate .pc files for enabled non-builtin public features
+CAIRO_FEATURE_HOOK_REGISTER(yes,!always,!,
+[dnl
+	_CAIRO_FEATURE_CONFIG_PKGCONFIG_FILE(
+		[$1],
+		cr_feature_name,
+		[src/]cr_feature_pc,
+		[src/cairo-features.pc.in]
+	)dnl
+])dnl
+
+dnl Generate -uninstalled.pc files for enabled non-builtin public features
+CAIRO_FEATURE_HOOK_REGISTER(yes,!always,!,
+[dnl
+	_CAIRO_FEATURE_CONFIG_PKGCONFIG_FILE(
+		[$1],
+		cr_feature_name,
+		cr_feature_uninstalled_pc,
+		[src/cairo-features-uninstalled.pc.in]
+	)dnl
+])dnl
+
+
+dnl Collect list of .pc files for all non-builtin public features
+CAIRO_MAKEFILE_ACCUMULATE(cairo,
+[all_$1_pkgconf = cairo.pc])dnl
+CAIRO_MAKEFILE_ACCUMULATE_FEATURE(cairo,*,*,!,
+[all_$1_pkgconf += cr_feature_pc])dnl
+
+dnl Collect list of .pc files for enabled non-builtin public features
+CAIRO_MAKEFILE_ACCUMULATE(cairo,
+[enabled_$1_pkgconf = cairo.pc])dnl
+CAIRO_MAKEFILE_ACCUMULATE_FEATURE(cairo,yes,*,!,
+[enabled_$1_pkgconf += cr_feature_pc])dnl
+
+
+dnl ===========================================================================
+dnl
+dnl Generate src/cairo-features.h src/cairo-supported-features.h
+dnl
+
+dnl Collect list of enabled public features
+CAIRO_ACCUMULATORS_REGISTER(FEATURES,[ ])dnl
+CAIRO_FEATURE_HOOK_REGISTER(yes,*,!,dnl
+[dnl
+	CAIRO_ACCUMULATE(FEATURES, cr_feature_tag)dnl
+])dnl
+dnl Collect list of all supported public features
+CAIRO_ACCUMULATORS_REGISTER(SUPPORTED_FEATURES,[ ])dnl
+CAIRO_FEATURE_HOOK_REGISTER(*,!no,!,dnl
+[dnl
+	CAIRO_ACCUMULATE(SUPPORTED_FEATURES, cr_feature_tag)
+])dnl
+dnl Collect list of all supported disabled public features
+CAIRO_ACCUMULATORS_REGISTER(NO_FEATURES,[ ])dnl
+CAIRO_FEATURE_HOOK_REGISTER(no,!no,!,
+[dnl
+	CAIRO_ACCUMULATE(NO_FEATURES, cr_feature_tag)
+])dnl
+
+dnl Generate src/cairo-features.h and src/cairo-supported-features.h
+CAIRO_CONFIG_COMMANDS([src/cairo-features.h],
+[dnl
+	echo '/* Generated by configure.  Do not edit. */'
+	echo '#ifndef CAIRO_FEATURES_H'
+	echo '#define CAIRO_FEATURES_H'
+	echo ''
+	for FEATURE in $CAIRO_FEATURES; do
+		echo "#define $FEATURE 1"
+	done | LANG=C sort
+	echo ''
+	for FEATURE in $CAIRO_NO_FEATURES; do
+		echo "/*#undef $FEATURE */"
+	done | LANG=C sort
+	echo ''
+	echo '#endif'
+],[dnl
+	CAIRO_FEATURES='$CAIRO_FEATURES'
+	CAIRO_NO_FEATURES='$CAIRO_NO_FEATURES'
+])dnl
+CAIRO_CONFIG_COMMANDS([$srcdir/src/cairo-supported-features.h],
+[dnl
+	echo '/* Generated by configure.  Do not edit. */'
+	echo '#ifndef CAIRO_SUPPORTED_FEATURES_H'
+	echo '#define CAIRO_SUPPORTED_FEATURES_H'
+	echo ''
+	echo '/* This is a dummy header, to trick gtk-doc only */'
+	echo ''
+	for FEATURE in $CAIRO_SUPPORTED_FEATURES; do
+		echo "#define $FEATURE 1"
+	done
+	echo ''
+	echo '#endif'
+],[dnl
+	CAIRO_SUPPORTED_FEATURES='$CAIRO_SUPPORTED_FEATURES'
+])dnl
+
+dnl For enabled private features just define them in config.h.  No fanfare!
+CAIRO_FEATURE_HOOK_REGISTER(yes,*,,
+[dnl
+	AC_DEFINE(cr_feature_tag, 1, [Define to 1 to enable cairo's ]cr_feature_name[ feature])
+])dnl
+
+dnl ===========================================================================
+dnl
+dnl Report
+dnl
+
+CAIRO_ACCUMULATORS_REGISTER([WARNING_MESSAGE],m4_newline()m4_newline)dnl
+
+dnl Collect warning message for enabled unsupported public features
+CAIRO_FEATURE_HOOK_REGISTER(yes,no,!,
+[dnl
+	CAIRO_ACCUMULATE([WARNING_MESSAGE], m4_text_wrap([The ]cr_feature_name[ feature is still under active development and is included in this release only as a preview. It does NOT fully work yet and incompatible changes may yet be made to ]cr_feature_name[ specific API.], [--- ],, 78))
+])dnl
+
+dnl Collect warning message for disabled recommended features
+CAIRO_FEATURE_HOOK_REGISTER(no,yes,*,
+[dnl
+	CAIRO_ACCUMULATE([WARNING_MESSAGE], m4_text_wrap([It is strictly recommended that you do NOT disable the ]cr_feature_name[ feature.], [+++ ],, 78))
+])dnl
+
+
+AC_DEFUN([CAIRO_REPORT],
+[dnl
+	V="$CAIRO_VERSION_MAJOR.$CAIRO_VERSION_MINOR.$CAIRO_VERSION_MICRO"
+	echo ""
+	echo "cairo (version $V [[$CAIRO_RELEASE_STATUS]]) will be compiled with the following surface backends:"
+	echo "  Image:         yes (always builtin)"
+	echo "  Xlib:          $use_xlib"
+	echo "  Xlib Xrender:  $use_xlib_xrender"
+	echo "  Quartz:        $use_quartz"
+	echo "  Quartz-image:  $use_quartz_image"
+	echo "  XCB:           $use_xcb"
+	echo "  Win32:         $use_win32"
+	echo "  OS2:           $use_os2"
+	echo "  PostScript:    $use_ps"
+	echo "  PDF:           $use_pdf"
+	echo "  SVG:           $use_svg"
+	echo "  glitz:         $use_glitz"
+	echo "  BeOS:          $use_beos"
+	echo "  DirectFB:      $use_directfb"
+	echo ""
+	echo "the following font backends:"
+	echo "  User:          yes (always builtin)"
+	echo "  FreeType:      $use_ft"
+	echo "  Win32:         $use_win32_font"
+	echo "  Quartz:        $use_quartz_font"
+	echo ""
+	echo "the following features:"
+	echo "  PNG functions: $use_png"
+	echo ""
+	echo "and the following debug options:"
+	echo "  gcov support:  $use_gcov"
+	echo "  test surfaces: $use_test_surfaces"
+	echo "  ps testing:    $test_ps"
+	echo "  pdf testing:   $test_pdf"
+	echo "  svg testing:   $test_svg"
+	if test x"$use_win32" = "xyes"; then
+		echo "  win32 printing testing:    $test_win32_printing"
+	fi
+	echo ""
+
+	if test x"$use_ft"          != "xyes" && \
+	   test x"$use_win32_font"  != "xyes" && \
+	   test x"$use_quartz_font" != "xyes" ; then
+
+	   AC_MSG_ERROR([Cairo requires at least one font backend.
+			  Please install freetype and fontconfig, then try again:
+			  http://freetype.org/	http://fontconfig.org/
+			])
+	fi
+	echo "$CAIRO_WARNING_MESSAGE"
+])dnl
+
diff --git a/configure.ac b/configure.ac
index c48a5df..2ffb7b0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,7 +19,7 @@ dnl
 m4_include(build/configure.ac.version)	dnl macros setting up various version declares
 m4_include(build/configure.ac.tools)	dnl checks for tools we use
 m4_include(build/configure.ac.system)	dnl checks for system functions, headers, libs
-m4_include(build/configure.ac.enable)	dnl macros for backend/feature enablement
+m4_include(build/configure.ac.features)	dnl macros for backend/feature handling
 m4_include(build/configure.ac.warnings)	dnl checks for compiler warning
 m4_include(build/configure.ac.analysis)	dnl checks for analysis tools (lcov, etc)
 AC_CACHE_SAVE


More information about the cairo-commit mailing list