[cairo-commit] 2 commits - build/configure.ac.enable

Behdad Esfahbod behdad at kemper.freedesktop.org
Thu Sep 11 00:33:08 PDT 2008


 build/configure.ac.enable |  526 ++++++++++++++++++++++++++++------------------
 1 file changed, 330 insertions(+), 196 deletions(-)

New commits:
commit 7c4fdafc8cb9f80e338df7581af1a8f40771dc67
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Sep 11 03:30:25 2008 -0400

    [configure.ac.enable] Add some dnl's

diff --git a/build/configure.ac.enable b/build/configure.ac.enable
index dea7409..0803819 100644
--- a/build/configure.ac.enable
+++ b/build/configure.ac.enable
@@ -39,23 +39,23 @@ dnl		appropriately.  Look at the macro definition for more details,
 dnl		or ask if in doubt.
 dnl
 AC_DEFUN([_CAIRO_ENABLE],
-[
+[dnl
 	dnl Sanity check ID
 	m4_if(
 		[$1],
 		m4_tolower(AS_TR_SH([$1])),
 		,
 		[m4_fatal([invalid feature name `$1'])]
-	)
+	)dnl
 	m4_pushdef([cr_feature], [$1])dnl
 	m4_pushdef([cr_feature_name], m4_normalize([$2]))dnl
 	m4_pushdef([cr_feature_what], m4_normalize([$3]))dnl
 	m4_pushdef([cr_feature_default], m4_normalize([$4]))dnl
 	m4_pushdef([cr_feature_commands], [$5])dnl
 	m4_pushdef([cr_feature_commands_len], m4_len([$5]))dnl
-
+	dnl
 	m4_pushdef([cr_feature_arg], m4_translit([$1],_,-))dnl
-
+	dnl
 	dnl Sanity check default
 	m4_case(
 		cr_feature_default,
@@ -64,17 +64,17 @@ AC_DEFUN([_CAIRO_ENABLE],
 		[auto],,
 		[always],,
 		[m4_fatal([Invalid default value `]cr_feature_default[' for feature `]cr_feature['])]
-	)
-
+	)dnl
+	dnl
 	m4_if(cr_feature_default, [always],
-	[
+	[dnl
 		enable_$1=yes
-	],[
+	],[dnl
 		AC_ARG_ENABLE(cr_feature_arg,
 			      AS_HELP_STRING([--enable-]cr_feature_arg[=@<:@no/auto/yes@:>@],
 					     [Enable cairo's ]cr_feature_name[ feature @<:@default=]cr_feature_default[@:>@]),
 			      enable_$1=$enableval, enable_$1=cr_feature_default)
-	])
+	])dnl
 	case $enable_$1 in
 	no)
 		use_$1="no (disabled, use --enable-cr_feature_arg to enable)"
@@ -119,7 +119,7 @@ AC_DEFUN([_CAIRO_ENABLE],
 		      [unset cairo_cv_[]$1[]_use])
 
 		AC_CACHE_CHECK([for cairo's ]cr_feature_name[ feature], cairo_cv_[]$1[]_use,
-		[
+		[dnl
 			echo
 			use_[]$1=yes
 			CAIRO_FEATURE_VARS_FOREACH(cr_var, [cr_feature[_]cr_var[=]m4_do([cr_var_default_]cr_var[_value])]m4_newline)
@@ -130,19 +130,19 @@ AC_DEFUN([_CAIRO_ENABLE],
 			cairo_cv_[]$1[]_cache_version="cr_cache_version"
 			CAIRO_FEATURE_VARS_FOREACH([cr_var], [[cairo_cv_]cr_feature[_]cr_var[=$]cr_feature[_]cr_var]m4_newline)
 			AC_MSG_CHECKING([whether cairo's ]cr_feature_name[ feature could be enabled])
-		])
+		])dnl
 
 		use_[]$1=$cairo_cv_[]$1[]_use
 
 		AS_IF([test "x$enable_$1" = "xyes" -a "x$use_$1" != xyes],
-		[
+		[dnl
 			AC_MSG_ERROR(
 				m4_case(cr_feature_default,
 					[always],	[mandatory],
 					[yes],		[recommended],
 					,		[requested]
 				) cr_feature_name[ feature could not be enabled])
-		])
+		])dnl
 	;;
 	*)
 		AC_MSG_ERROR([invalid argument passed to --enable-]cr_feature_arg[: `$use_$1', should be one of @<:@no/auto/yes@:>@])
@@ -150,20 +150,18 @@ AC_DEFUN([_CAIRO_ENABLE],
 	esac
 
 	AS_IF([test "x$use_$1" = "xyes"],
-	[
+	[dnl
 		CAIRO_FEATURE_VARS_FOREACH([cr_var], [cr_feature[_]cr_var[=$cairo_cv_]cr_feature[_]cr_var]m4_newline)
 		CAIRO_ACCUMULATED_FEATURE_VARS_FOREACH([cr_var],
-		[
+		[dnl
 			CAIRO_ACCUMULATE_UNQUOTED_BEFORE(cr_var, [$]cr_feature[_]cr_var)
-		])
-	],[
+		])dnl
+	],[dnl
 		dnl If not enabled, empty the vars so no one accidentally uses them.
 		CAIRO_FEATURE_VARS_FOREACH([cr_var], [cr_feature[_]cr_var[=$cairo_cv_]cr_feature[_]cr_var]m4_newline)
-	])
-
-
-	_CAIRO_FEATURE_HOOKS(cr_feature, cr_feature_name, cr_feature_default, cr_feature_what)
+	])dnl
 
+	_CAIRO_FEATURE_HOOKS(cr_feature, cr_feature_name, cr_feature_default, cr_feature_what)dnl
 
 	m4_popdef([cr_feature])dnl
 	m4_popdef([cr_feature_name])dnl
@@ -188,14 +186,14 @@ dnl
 dnl DEFAULT-VALUE is m4 macros to set default value of VARS
 dnl
 AC_DEFUN([CAIRO_FEATURE_VARS_REGISTER],
-[
+[dnl
 	m4_foreach_w([cr_var], [$1],
 		     [m4_append_uniq([_CAIRO_FEATURE_VARS], cr_var, [ ],,
-				     [m4_fatal([Feature variable `]cr_var[' already registered])])])
+				     [m4_fatal([Feature variable `]cr_var[' already registered])])])dnl
 	m4_foreach_w([cr_var], [$1],
-	[
-		m4_define([cr_var_default_]cr_var[_value], m4_default([$2],[[$ac_env_[]]cr_feature[[]_]]cr_var[[_value]]))
-	])
+	[dnl
+		m4_define([cr_var_default_]cr_var[_value], m4_default([$2],[[$ac_env_[]]cr_feature[[]_]]cr_var[[_value]]))dnl
+	])dnl
 ])
 
 dnl
@@ -205,24 +203,24 @@ dnl Run COMMANDS for each registered feature variable.
 dnl Defines VAR to the variable being processed.
 dnl
 AC_DEFUN([CAIRO_FEATURE_VARS_FOREACH],
-[
-	m4_foreach_w([$1], m4_defn([_CAIRO_FEATURE_VARS]), [$2])
+[dnl
+	m4_foreach_w([$1], m4_defn([_CAIRO_FEATURE_VARS]), [$2])dnl
 ])
 
 
 dnl ===========================================================================
 
-m4_define([_CAIRO_ACCUMULATORS])
+m4_define([_CAIRO_ACCUMULATORS])dnl
 
 m4_define([_CAIRO_ACCUMULATORS_REGISTER],
-[
+[dnl
 	m4_foreach_w([cr_var], [$1],
 		     [m4_append_uniq([_CAIRO_ACCUMULATORS], cr_var, [ ],,
 				     [m4_fatal([Accumulator `]cr_var[' already registered])])])dnl
 	m4_foreach_w([cr_var], [$1], [m4_define([cr_acc_]cr_var[_sep], [$2])])dnl
 	m4_foreach_w([cr_var], [$1], [[CAIRO_]cr_var[=$3]]m4_newline)dnl
 	m4_foreach_w([cr_var], [$1], [m4_pattern_allow([CAIRO_]cr_var)])dnl
-])
+])dnl
 
 dnl
 dnl CAIRO_ACCUMULATORS_REGISTER(VARS, SEPARATOR=[], INITIAL-VALUE=[])
@@ -235,29 +233,29 @@ dnl VARS should be a whitespace-separate list of variable names.  The actual
 dnl shell variable resulting for each variable is prefixed with CAIRO_.
 dnl
 AC_DEFUN([CAIRO_ACCUMULATORS_REGISTER],
-[
-	_CAIRO_ACCUMULATORS_REGISTER([$1],[$2],['$3'])
-])
+[dnl
+	_CAIRO_ACCUMULATORS_REGISTER([$1],[$2],['$3'])dnl
+])dnl
 
 dnl
 dnl Like CAIRO_ACCUMULATORS_REGISTER but INITIAL-VALUE is left unquoted,
 dnl so it can reference other shell variables for example.
 dnl
 AC_DEFUN([CAIRO_ACCUMULATORS_REGISTER_UNQUOTED],
-[
-	_CAIRO_ACCUMULATORS_REGISTER([$1],[$2],["$3"])
-])
+[dnl
+	_CAIRO_ACCUMULATORS_REGISTER([$1],[$2],["$3"])dnl
+])dnl
 
 m4_define([_CAIRO_ACCUMULATOR_CHECK],
-[
-        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],
-[
-	_CAIRO_ACCUMULATOR_CHECK([$1])
-	m4_ifval([$2], [$3])
-])
+[dnl
+	_CAIRO_ACCUMULATOR_CHECK([$1])dnl
+	m4_ifval([$2], [$3]m4_newline)dnl
+])dnl
 
 dnl
 dnl CAIRO_ACCUMULATE(VAR, VALUE)
@@ -265,9 +263,9 @@ dnl
 dnl Appends VALUE to accumulator VAR
 dnl
 AC_DEFUN([CAIRO_ACCUMULATE],
-[
-	_CAIRO_ACCUMULATE([$1], [$2], [CAIRO_$1="${CAIRO_$1}]m4_do([cr_acc_$1_sep])["'$2'])
-])
+[dnl
+	_CAIRO_ACCUMULATE([$1], [$2], [CAIRO_$1="${CAIRO_$1}]m4_do([cr_acc_$1_sep])["'$2'])dnl
+])dnl
 
 dnl
 dnl CAIRO_ACCUMULATE(VAR, VALUE)
@@ -275,15 +273,15 @@ dnl
 dnl Prepends VALUE to accumulator VAR
 dnl
 AC_DEFUN([CAIRO_ACCUMULATE_BEFORE],
-[
-	_CAIRO_ACCUMULATE([$1], [$2], [CAIRO_$1='$2'"]m4_do([cr_acc_$1_sep])[${CAIRO_$1}"])
-])
+[dnl
+	_CAIRO_ACCUMULATE([$1], [$2], [CAIRO_$1='$2'"]m4_do([cr_acc_$1_sep])[${CAIRO_$1}"])dnl
+])dnl
 
 m4_define([_CAIRO_ACCUMULATE_UNQUOTED],
-[
-	_CAIRO_ACCUMULATOR_CHECK([$1])
-	m4_ifval([$2], [m4_bmatch([$2],[[$]],[test -n "$2" &&]) $3])
-])
+[dnl
+	_CAIRO_ACCUMULATOR_CHECK([$1])dnl
+	m4_ifval([$2], [m4_bmatch([$2],[[$]],[test -n "$2" &&]) $3]m4_newline)dnl
+])dnl
 
 dnl
 dnl CAIRO_ACCUMULATE_UNQUOTED(VAR, VALUE)
@@ -292,9 +290,9 @@ dnl Like CAIRO_ACCUMULATE but VALUE is left unquoted,
 dnl so it can reference other shell variables for example.
 dnl
 AC_DEFUN([CAIRO_ACCUMULATE_UNQUOTED],
-[
-	_CAIRO_ACCUMULATE_UNQUOTED([$1], [$2], [CAIRO_$1="${CAIRO_$1}]m4_do([cr_acc_$1_sep])[$2"])
-])
+[dnl
+	_CAIRO_ACCUMULATE_UNQUOTED([$1], [$2], [CAIRO_$1="${CAIRO_$1}]m4_do([cr_acc_$1_sep])[$2"])dnl
+])dnl
 
 dnl
 dnl CAIRO_ACCUMULATE_UNQUOTED_BEFORE(VAR, VALUE)
@@ -303,9 +301,9 @@ dnl Like CAIRO_ACCUMULATE_BEFORE but VALUE is left unquoted,
 dnl so it can reference other shell variables for example.
 dnl
 AC_DEFUN([CAIRO_ACCUMULATE_UNQUOTED_BEFORE],
-[
-	_CAIRO_ACCUMULATE_UNQUOTED([$1], [$2], [CAIRO_$1="$2]m4_do([cr_acc_$1_sep])[${CAIRO_$1}"])
-])
+[dnl
+	_CAIRO_ACCUMULATE_UNQUOTED([$1], [$2], [CAIRO_$1="$2]m4_do([cr_acc_$1_sep])[${CAIRO_$1}"])dnl
+])dnl
 
 dnl
 dnl CAIRO_ACCUMULATORS_FOREACH(VAR, COMMANDS)
@@ -314,14 +312,14 @@ dnl Run COMMANDS for each registered accumulator.
 dnl Defines VAR to the accumulator being processed.
 dnl
 AC_DEFUN([CAIRO_ACCUMULATORS_FOREACH],
-[
-	m4_foreach_w([$1], m4_defn([_CAIRO_ACCUMULATORS]), [$2])
-])
+[dnl
+	m4_foreach_w([$1], m4_defn([_CAIRO_ACCUMULATORS]), [$2])dnl
+])dnl
 
 
 dnl ===========================================================================
 
-m4_define([_CAIRO_ACCUMULATED_FEATURE_VARS])
+m4_define([_CAIRO_ACCUMULATED_FEATURE_VARS])dnl
 
 dnl
 dnl CAIRO_ACCUMULATED_FEATURE_VARS_REGISTER(VARS, DEFAULT-VALUE=[], SEPARATOR=[], INITIAL-VALUE=[])
@@ -330,13 +328,13 @@ dnl Defines VARS as feature variables and accumulators.  Also accumulates
 dnl (prepending, not appending) feature values for VARS.
 dnl
 AC_DEFUN([CAIRO_ACCUMULATED_FEATURE_VARS_REGISTER],
-[
+[dnl
 	m4_foreach_w([cr_var], [$1],
 		     [m4_append_uniq([_CAIRO_ACCUMULATED_FEATURE_VARS], cr_var, [ ],,
 				     [m4_fatal([Accumulated feature variable `]cr_var[' already registered])])])dnl
 	CAIRO_FEATURE_VARS_REGISTER([$1],[$2])dnl
 	CAIRO_ACCUMULATORS_REGISTER_UNQUOTED([$1],[$3],[$4])dnl
-])
+])dnl
 
 dnl
 dnl CAIRO_ACCUMULATED_FEATURE_VARS_FOREACH(VAR, COMMANDS)
@@ -345,9 +343,9 @@ dnl Run COMMANDS for each registered accumulated feature variable.
 dnl Defines VAR to the variable being processed.
 dnl
 AC_DEFUN([CAIRO_ACCUMULATED_FEATURE_VARS_FOREACH],
-[
-	m4_foreach_w([$1], m4_defn([_CAIRO_ACCUMULATED_FEATURE_VARS]), [$2])
-])
+[dnl
+	m4_foreach_w([$1], m4_defn([_CAIRO_ACCUMULATED_FEATURE_VARS]), [$2])dnl
+])dnl
 
 dnl ===========================================================================
 
@@ -357,29 +355,29 @@ dnl
 dnl Run COMMANDS if FEATURE is enabled.
 dnl
 AC_DEFUN([CAIRO_FEATURE_IF_ENABLED],
-[
-	AS_IF([test "x$use_]m4_default([$1], cr_feature)[" = xyes], [$2], [$3])
-])
+[dnl
+	AS_IF([test "x$use_]m4_default([$1], cr_feature)[" = xyes], [$2], [$3])dnl
+])dnl
 
 m4_define([_CAIRO_FEATURE_HOOK_MATCH_SH_BOOL],
-[
+[dnl
 	m4_case([$1],
 		[*],	[$3],
-		[no],	[AS_IF([test "x$2" != xyes], [:m4_newline$3])],
-		[yes],	[AS_IF([test "x$2" = xyes], [:m4_newline$3])],
-			[m4_fatal([Invalid ENABLED value `]$1['])])
-])
+		[no],	[AS_IF([test "x$2" != xyes], [:m4_newline()$3])],
+		[yes],	[AS_IF([test "x$2" = xyes], [:m4_newline()$3])],
+			[m4_fatal([Invalid ENABLED value `]$1['])])dnl
+])dnl
 
 m4_define([_CAIRO_FEATURE_HOOK_MATCH_M4],
-[
+[dnl
 	m4_case([$1],
 		[*],	[$3],
 		[$2],	[$3],
 		[!$2],	,
-			[m4_bmatch([$1], [^!], [$3])])
-])
+			[m4_bmatch([$1], [^!], [$3])])dnl
+])dnl
 
-m4_define([_CAIRO_FEATURE_HOOKS])
+m4_define([_CAIRO_FEATURE_HOOKS])dnl
 
 dnl
 dnl CAIRO_FEATURE_HOOK_REGISTER(ENABLED, DEFAULT, WHAT, COMMANDS)
@@ -427,16 +425,16 @@ dnl
 dnl	AS_IF([test "x$use_$1" = "xyes"], [IF-ENABLED], [IF-DISABLED])
 dnl
 AC_DEFUN([CAIRO_FEATURE_HOOK_REGISTER],
-[
+[dnl
 	m4_append([_CAIRO_FEATURE_HOOKS],
-	[
+	[dnl
 		_CAIRO_FEATURE_HOOK_MATCH_M4([$2], cr_feature_default,
 		[_CAIRO_FEATURE_HOOK_MATCH_M4([$3], cr_feature_what,
 		 [_CAIRO_FEATURE_HOOK_MATCH_SH_BOOL([$1], [$use_]cr_feature,
 		  [$4]
-		)])])
-	], m4_newline)
-])
+		)])])dnl
+	], m4_newline)dnl
+])dnl
 
 
 
@@ -470,16 +468,16 @@ dnl		or ask if in doubt.
 dnl
 
 AC_DEFUN([CAIRO_ENABLE],
-	[_CAIRO_ENABLE([$1],	[$2],			,		[$3],[$4])])
+	[_CAIRO_ENABLE([$1],	[$2],			,		[$3],[$4])])dnl
 
 AC_DEFUN([CAIRO_ENABLE_SURFACE_BACKEND],
-	[_CAIRO_ENABLE([$1],	[$2 surface backend],	surface,	[$3],[$4])])
+	[_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])])
+	[_CAIRO_ENABLE([$1],	[$2 font backend],	font,	  	[$3],[$4])])dnl
 
 AC_DEFUN([CAIRO_ENABLE_FUNCTIONS],
-	[_CAIRO_ENABLE([$1],	[$2 functions],		functions,	[$3],[$4])])
+	[_CAIRO_ENABLE([$1],	[$2 functions],		functions,	[$3],[$4])])dnl
 
 
 dnl
@@ -487,25 +485,25 @@ 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])])
+	[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])))])
+	[_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)])
+	[_CAIRO_BUILD_FEATURE_TAG(cr_feature,cr_feature_what)])dnl
 
 dnl Allow feature tags in the output
-m4_pattern_allow(^CAIRO_HAS_)
+m4_pattern_allow(^CAIRO_HAS_)dnl
 
 
 dnl
 dnl Define cr_feature_pc and friends ala other cr_feature_* macros
 dnl
 m4_define([cr_feature_pc_modname],
-	[[cairo-]m4_translit(cr_feature,_,-)])
+	[[cairo-]m4_translit(cr_feature,_,-)])dnl
 m4_define([cr_feature_pc],
-	[cr_feature_pc_modname[.pc]])
+	[cr_feature_pc_modname[.pc]])dnl
 m4_define([cr_feature_uninstalled_pc],
-	[cr_feature_pc_modname[-uninstalled.pc]])
+	[cr_feature_pc_modname[-uninstalled.pc]])dnl
 
 
 dnl ===========================================================================
@@ -520,9 +518,9 @@ dnl
 dnl Automake conditionals for all features
 dnl
 CAIRO_FEATURE_HOOK_REGISTER(*,*,*,
-[
-	AM_CONDITIONAL(cr_feature_tag, test "x$use_$1" = xyes)
-])
+[dnl
+	AM_CONDITIONAL(cr_feature_tag, test "x$use_$1" = xyes)dnl
+])dnl
 
 
 dnl ===========================================================================
@@ -544,36 +542,36 @@ all_cairo_headers = $(cairo_headers)
 all_cairo_private = $(cairo_private)
 all_cairo_sources = $(cairo_sources)
 supported_cairo_headers = $(cairo_headers)
-unsupported_cairo_headers =])
+unsupported_cairo_headers =])dnl
 
-CAIRO_ACCUMULATORS_REGISTER_UNQUOTED(CONFIG_WIN32,m4_newline,[$CAIRO_CONFIG_AMAKE])
+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'])
+		      [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'])
+		      [CAIRO_CONFIG_WIN32='$CAIRO_CONFIG_WIN32'])dnl
 
 dnl Collect list of all supported public cairo headers
 CAIRO_FEATURE_HOOK_REGISTER(*,!no,!,
-[
-	CAIRO_ACCUMULATE(CONFIG_AMAKE, [supported_cairo_headers += $(cairo_$1_headers)])
-	CAIRO_ACCUMULATE(CONFIG_WIN32, [supported_cairo_headers += $(cairo_$1_headers)])
-])
+[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,!,
-[
-	CAIRO_ACCUMULATE(CONFIG_AMAKE, [unsupported_cairo_headers += $(cairo_$1_headers)])
-	CAIRO_ACCUMULATE(CONFIG_WIN32, [unsupported_cairo_headers += $(cairo_$1_headers)])
-])
+[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(*,*,!,
-[
-	CAIRO_ACCUMULATE(CONFIG_AMAKE, [
+[dnl
+	CAIRO_ACCUMULATE(CONFIG_AMAKE, [dnl
 all_cairo_headers += $(cairo_$1_headers)
 all_cairo_private += $(cairo_$1_private)
 all_cairo_sources += $(cairo_$1_sources)
@@ -582,8 +580,8 @@ enabled_cairo_headers += $(cairo_$1_headers)
 enabled_cairo_private += $(cairo_$1_private)
 enabled_cairo_sources += $(cairo_$1_sources)
 endif
-])
-	CAIRO_ACCUMULATE(CONFIG_WIN32, [
+])dnl
+	CAIRO_ACCUMULATE(CONFIG_WIN32, [dnl
 all_cairo_headers += $(cairo_$1_headers)
 all_cairo_private += $(cairo_$1_private)
 all_cairo_sources += $(cairo_$1_sources)
@@ -592,30 +590,30 @@ 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, [
+	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
-])
-	CAIRO_ACCUMULATE(CONFIG_WIN32, [
+])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 ===========================================================================
@@ -624,78 +622,78 @@ dnl Generate .pc files
 dnl
 
 dnl All .pc files are generated automatically except for this one
-AC_CONFIG_FILES([src/cairo.pc])
-AC_CONFIG_FILES([cairo-uninstalled.pc:src/cairo-uninstalled.pc.in])
+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])
-CAIRO_ACCUMULATED_FEATURE_VARS_REGISTER([REQUIRES],,[ ])
-CAIRO_ACCUMULATED_FEATURE_VARS_REGISTER([CFLAGS NONPKGCONFIG_CFLAGS],,[ ])
-CAIRO_ACCUMULATED_FEATURE_VARS_REGISTER([LIBS NONPKGCONFIG_LIBS],,[ ],[$LIBS])
-AC_SUBST(CAIRO_REQUIRES)
-AC_SUBST(CAIRO_BASE)
-AC_SUBST(CAIRO_CFLAGS)
-AC_SUBST(CAIRO_NONPKGCONFIG_CFLAGS)
-AC_SUBST(CAIRO_LIBS)
-AC_SUBST(CAIRO_NONPKGCONFIG_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_BASE)dnl
+AC_SUBST(CAIRO_CFLAGS)dnl
+AC_SUBST(CAIRO_NONPKGCONFIG_CFLAGS)dnl
+AC_SUBST(CAIRO_LIBS)dnl
+AC_SUBST(CAIRO_NONPKGCONFIG_LIBS)dnl
 
 
 dnl Generate .pc files for enabled non-builtin public features
 CAIRO_FEATURE_HOOK_REGISTER(yes,!always,!,
-[
+[dnl
 	AC_CONFIG_FILES(src/cr_feature_pc:src/cairo-features.pc.in,
-	[
-		$SED -i -e "
-		s%@FEATURE_PC@%]cr_feature_pc_modname[%g;
-		s%@FEATURE_NAME@%]cr_feature_name[%g;
-		s%@FEATURE_BASE@%$$1_BASE%g;
-		s%@FEATURE_REQUIRES@%$$1_REQUIRES%g;
-		s%@FEATURE_NONPKGCONFIG_LIBS@%$$1_NONPKGCONFIG_LIBS%g;
-		s%@FEATURE_NONPKGCONFIG_CFLAGS@%$$1_NONPKGCONFIG_CFLAGS%g;
+	[dnl
+		$SED -i -e "dnl
+		s%@FEATURE_PC@%]cr_feature_pc_modname[%g;dnl
+		s%@FEATURE_NAME@%]cr_feature_name[%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
 		" "]src/cr_feature_pc[" ||
 		AC_MSG_ERROR(failed to update ]src/cr_feature_pc[)
-	],[
+	],[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 -uninstalled.pc files for enabled non-builtin public features
 CAIRO_FEATURE_HOOK_REGISTER(yes,!always,!,
-[
+[dnl
 	AC_CONFIG_FILES(cr_feature_uninstalled_pc:src/cairo-features-uninstalled.pc.in,
-	[
-		$SED -i -e "
-		s%@FEATURE_PC@%]cr_feature_pc_modname[%g;
-		s%@FEATURE_NAME@%]cr_feature_name[%g;
-		s%@FEATURE_BASE@%$$1_BASE%g;
-		s%@FEATURE_REQUIRES@%$$1_REQUIRES%g;
-		s%@FEATURE_NONPKGCONFIG_LIBS@%$$1_NONPKGCONFIG_LIBS%g;
-		s%@FEATURE_NONPKGCONFIG_CFLAGS@%$$1_NONPKGCONFIG_CFLAGS%g;
+	[dnl
+		$SED -i -e "dnl
+		s%@FEATURE_PC@%]cr_feature_pc_modname[%g;dnl
+		s%@FEATURE_NAME@%]cr_feature_name[%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
 		" "]src/cr_feature_pc[" ||
 		AC_MSG_ERROR(failed to update ]src/cr_feature_pc[)
-	],[
+	],[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 Collect list of .pc files for all/enabled non-builtin public features
 CAIRO_FEATURE_HOOK_REGISTER(*,!always,!,
-[
+[dnl
 	CAIRO_CONFIG_AMAKE=$CAIRO_CONFIG_AMAKE'
 all_cairo_pkgconf += cr_feature_pc
 if cr_feature_tag
 enabled_cairo_pkgconf += cr_feature_pc
 endif
 '
-])
+])dnl
 
 
 dnl ===========================================================================
@@ -704,27 +702,27 @@ dnl Generate src/cairo-features.h src/cairo-supported-features.h
 dnl
 
 dnl Collect list of enabled public features
-CAIRO_ACCUMULATORS_REGISTER(FEATURES,[ ])
-CAIRO_FEATURE_HOOK_REGISTER(yes,*,!,
-[
-	CAIRO_ACCUMULATE(FEATURES, cr_feature_tag)
-])
+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,[ ])
-CAIRO_FEATURE_HOOK_REGISTER(*,!no,!,
-[
+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,[ ])
+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'
@@ -738,12 +736,12 @@ CAIRO_CONFIG_COMMANDS([src/cairo-features.h],
 	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'
@@ -755,38 +753,38 @@ CAIRO_CONFIG_COMMANDS([$srcdir/src/cairo-supported-features.h],
 	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)
+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:"
@@ -835,5 +833,5 @@ AC_DEFUN([CAIRO_REPORT],
 			])
 	fi
 	echo "$CAIRO_WARNING_MESSAGE"
-])
+])dnl
 
commit c358abfb156ceb552ded2daad4068d6f0f0044a9
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Sep 11 03:08:15 2008 -0400

    [configure.ac.enable] Implement accumulators

diff --git a/build/configure.ac.enable b/build/configure.ac.enable
index 3486052..dea7409 100644
--- a/build/configure.ac.enable
+++ b/build/configure.ac.enable
@@ -8,6 +8,11 @@ dnl
 dnl ===========================================================================
 
 dnl
+dnl Used to force cache invalidation
+dnl
+m4_define([cr_cache_version], [6])
+
+dnl
 dnl Define a macro to enable features
 dnl  - Macro: _CAIRO_ENABLE (ID, NAME, WHAT, DEFAULT, COMMANDS)
 dnl
@@ -80,6 +85,10 @@ AC_DEFUN([_CAIRO_ENABLE],
 		dnl To be extremely user-friendly, we discard cache results if
 		dnl any of the following conditions happens:
 		dnl
+		dnl   - Global cache version changes
+		dnl     This is used to force a cache invalidation for these
+		dnl     macros
+		dnl
 		dnl   - Set of cached variables changes
 		dnl     (XXX should also do if the default value of such
 		dnl     variables changes.  Argh...)
@@ -102,8 +111,9 @@ AC_DEFUN([_CAIRO_ENABLE],
 		dnl    last time and so we recheck.  Although even in that
 		dnl    case other cached values probably get in the way...
 		dnl
-		AS_IF([test "x$cairo_cv_[]$1[]_cache_commands_len" != "x[]cr_feature_commands_len" -o \
-			    "x$cairo_cv_[]$1[]_cache_vars" != "x[]CAIRO_FEATURE_VARS"],
+		AS_IF([test "x$cairo_cv_[]$1[]_cache_version" != "x[]cr_cache_version" -o \
+			    "x$cairo_cv_[]$1[]_cache_commands_len" != "x[]cr_feature_commands_len" -o \
+			    "x$cairo_cv_[]$1[]_cache_vars" != "x[]_CAIRO_FEATURE_VARS"],
 		      [unset cairo_cv_[]$1[]_use])
 		AS_IF([test "x$enable_$1" = xyes -a "x$cairo_cv_[]$1[]_use" != xyes],
 		      [unset cairo_cv_[]$1[]_use])
@@ -112,14 +122,13 @@ AC_DEFUN([_CAIRO_ENABLE],
 		[
 			echo
 			use_[]$1=yes
-			CAIRO_FEATURE_VARS_FOREACH(cr_var, [cr_feature[_]cr_var[=$ac_env_]cr_feature[_]cr_var[_value]
-			])
+			CAIRO_FEATURE_VARS_FOREACH(cr_var, [cr_feature[_]cr_var[=]m4_do([cr_var_default_]cr_var[_value])]m4_newline)
 			cr_feature_commands
 			cairo_cv_[]$1[]_use=$use_[]$1
-			cairo_cv_[]$1[]_cache_vars="CAIRO_FEATURE_VARS"
+			cairo_cv_[]$1[]_cache_vars="_CAIRO_FEATURE_VARS"
 			cairo_cv_[]$1[]_cache_commands_len="cr_feature_commands_len"
-			CAIRO_FEATURE_VARS_FOREACH([cr_var], [[cairo_cv_]cr_feature[_]cr_var[=$]cr_feature[_]cr_var
-			])
+			cairo_cv_[]$1[]_cache_version="cr_cache_version"
+			CAIRO_FEATURE_VARS_FOREACH([cr_var], [[cairo_cv_]cr_feature[_]cr_var[=$]cr_feature[_]cr_var]m4_newline)
 			AC_MSG_CHECKING([whether cairo's ]cr_feature_name[ feature could be enabled])
 		])
 
@@ -142,12 +151,14 @@ AC_DEFUN([_CAIRO_ENABLE],
 
 	AS_IF([test "x$use_$1" = "xyes"],
 	[
-		CAIRO_FEATURE_VARS_FOREACH([cr_var], [cr_feature[_]cr_var[=$cairo_cv_]cr_feature[_]cr_var
+		CAIRO_FEATURE_VARS_FOREACH([cr_var], [cr_feature[_]cr_var[=$cairo_cv_]cr_feature[_]cr_var]m4_newline)
+		CAIRO_ACCUMULATED_FEATURE_VARS_FOREACH([cr_var],
+		[
+			CAIRO_ACCUMULATE_UNQUOTED_BEFORE(cr_var, [$]cr_feature[_]cr_var)
 		])
 	],[
 		dnl If not enabled, empty the vars so no one accidentally uses them.
-		CAIRO_FEATURE_VARS_FOREACH([cr_var], [cr_feature[_]cr_var[=$cairo_cv_]cr_feature[_]cr_var
-		])
+		CAIRO_FEATURE_VARS_FOREACH([cr_var], [cr_feature[_]cr_var[=$cairo_cv_]cr_feature[_]cr_var]m4_newline)
 	])
 
 
@@ -166,37 +177,185 @@ AC_DEFUN([_CAIRO_ENABLE],
 
 dnl ===========================================================================
 
+m4_define([_CAIRO_FEATURE_VARS])
+
 dnl
-dnl CAIRO_FEATURE_VARS_REGISTER(VARS, INITIAL-VALUE=[])
+dnl CAIRO_FEATURE_VARS_REGISTER(VARS, DEFAULT-VALUE=[])
 dnl
 dnl Registers variables to be collected from feature-enabling code segments.
 dnl VARS should be a whitespace-separate list of variable names.
 dnl
-dnl XXX Should be able to set default value
-dnl
-dnl XXX Set separator.  Also, prepend/append setting
-dnl
-dnl XXX An aggregate of the values from all enabled features is collected in
-dnl variables named as VARS but prefixed with CAIRO_.
+dnl DEFAULT-VALUE is m4 macros to set default value of VARS
 dnl
 AC_DEFUN([CAIRO_FEATURE_VARS_REGISTER],
 [
 	m4_foreach_w([cr_var], [$1],
-		     [m4_append_uniq([CAIRO_FEATURE_VARS], cr_var, [ ],,
+		     [m4_append_uniq([_CAIRO_FEATURE_VARS], cr_var, [ ],,
 				     [m4_fatal([Feature variable `]cr_var[' already registered])])])
-	m4_foreach_w([cr_var], [$1], [[CAIRO_]cr_var[="$2"]
+	m4_foreach_w([cr_var], [$1],
+	[
+		m4_define([cr_var_default_]cr_var[_value], m4_default([$2],[[$ac_env_[]]cr_feature[[]_]]cr_var[[_value]]))
 	])
-	m4_foreach_w([cr_var], [$1], [m4_pattern_allow([CAIRO_]cr_var)])
 ])
 
+dnl
+dnl CAIRO_FEATURE_VARS_FOREACH(VAR, COMMANDS)
+dnl 
+dnl Run COMMANDS for each registered feature variable.
+dnl Defines VAR to the variable being processed.
+dnl
 AC_DEFUN([CAIRO_FEATURE_VARS_FOREACH],
 [
-	m4_foreach_w([$1], m4_quote(CAIRO_FEATURE_VARS), [$2])
+	m4_foreach_w([$1], m4_defn([_CAIRO_FEATURE_VARS]), [$2])
+])
+
+
+dnl ===========================================================================
+
+m4_define([_CAIRO_ACCUMULATORS])
+
+m4_define([_CAIRO_ACCUMULATORS_REGISTER],
+[
+	m4_foreach_w([cr_var], [$1],
+		     [m4_append_uniq([_CAIRO_ACCUMULATORS], cr_var, [ ],,
+				     [m4_fatal([Accumulator `]cr_var[' already registered])])])dnl
+	m4_foreach_w([cr_var], [$1], [m4_define([cr_acc_]cr_var[_sep], [$2])])dnl
+	m4_foreach_w([cr_var], [$1], [[CAIRO_]cr_var[=$3]]m4_newline)dnl
+	m4_foreach_w([cr_var], [$1], [m4_pattern_allow([CAIRO_]cr_var)])dnl
+])
+
+dnl
+dnl CAIRO_ACCUMULATORS_REGISTER(VARS, SEPARATOR=[], INITIAL-VALUE=[])
+dnl
+dnl Registers accumulators.  An accumulator is a shell variable that can
+dnl be accumulated to.  The macros take care of adding a SEPARATOR between
+dnl accumulated values.
+dnl
+dnl VARS should be a whitespace-separate list of variable names.  The actual
+dnl shell variable resulting for each variable is prefixed with CAIRO_.
+dnl
+AC_DEFUN([CAIRO_ACCUMULATORS_REGISTER],
+[
+	_CAIRO_ACCUMULATORS_REGISTER([$1],[$2],['$3'])
+])
+
+dnl
+dnl Like CAIRO_ACCUMULATORS_REGISTER but INITIAL-VALUE is left unquoted,
+dnl so it can reference other shell variables for example.
+dnl
+AC_DEFUN([CAIRO_ACCUMULATORS_REGISTER_UNQUOTED],
+[
+	_CAIRO_ACCUMULATORS_REGISTER([$1],[$2],["$3"])
+])
+
+m4_define([_CAIRO_ACCUMULATOR_CHECK],
+[
+        m4_ifdef([cr_acc_$1_sep],,[m4_fatal([Accumulator ]$1[ not defined.])])
+])
+
+m4_define([_CAIRO_ACCUMULATE],
+[
+	_CAIRO_ACCUMULATOR_CHECK([$1])
+	m4_ifval([$2], [$3])
+])
+
+dnl
+dnl CAIRO_ACCUMULATE(VAR, VALUE)
+dnl
+dnl Appends VALUE to accumulator VAR
+dnl
+AC_DEFUN([CAIRO_ACCUMULATE],
+[
+	_CAIRO_ACCUMULATE([$1], [$2], [CAIRO_$1="${CAIRO_$1}]m4_do([cr_acc_$1_sep])["'$2'])
+])
+
+dnl
+dnl CAIRO_ACCUMULATE(VAR, VALUE)
+dnl
+dnl Prepends VALUE to accumulator VAR
+dnl
+AC_DEFUN([CAIRO_ACCUMULATE_BEFORE],
+[
+	_CAIRO_ACCUMULATE([$1], [$2], [CAIRO_$1='$2'"]m4_do([cr_acc_$1_sep])[${CAIRO_$1}"])
+])
+
+m4_define([_CAIRO_ACCUMULATE_UNQUOTED],
+[
+	_CAIRO_ACCUMULATOR_CHECK([$1])
+	m4_ifval([$2], [m4_bmatch([$2],[[$]],[test -n "$2" &&]) $3])
+])
+
+dnl
+dnl CAIRO_ACCUMULATE_UNQUOTED(VAR, VALUE)
+dnl
+dnl Like CAIRO_ACCUMULATE but VALUE is left unquoted,
+dnl so it can reference other shell variables for example.
+dnl
+AC_DEFUN([CAIRO_ACCUMULATE_UNQUOTED],
+[
+	_CAIRO_ACCUMULATE_UNQUOTED([$1], [$2], [CAIRO_$1="${CAIRO_$1}]m4_do([cr_acc_$1_sep])[$2"])
+])
+
+dnl
+dnl CAIRO_ACCUMULATE_UNQUOTED_BEFORE(VAR, VALUE)
+dnl
+dnl Like CAIRO_ACCUMULATE_BEFORE but VALUE is left unquoted,
+dnl so it can reference other shell variables for example.
+dnl
+AC_DEFUN([CAIRO_ACCUMULATE_UNQUOTED_BEFORE],
+[
+	_CAIRO_ACCUMULATE_UNQUOTED([$1], [$2], [CAIRO_$1="$2]m4_do([cr_acc_$1_sep])[${CAIRO_$1}"])
+])
+
+dnl
+dnl CAIRO_ACCUMULATORS_FOREACH(VAR, COMMANDS)
+dnl 
+dnl Run COMMANDS for each registered accumulator.
+dnl Defines VAR to the accumulator being processed.
+dnl
+AC_DEFUN([CAIRO_ACCUMULATORS_FOREACH],
+[
+	m4_foreach_w([$1], m4_defn([_CAIRO_ACCUMULATORS]), [$2])
 ])
 
 
 dnl ===========================================================================
 
+m4_define([_CAIRO_ACCUMULATED_FEATURE_VARS])
+
+dnl
+dnl CAIRO_ACCUMULATED_FEATURE_VARS_REGISTER(VARS, DEFAULT-VALUE=[], SEPARATOR=[], INITIAL-VALUE=[])
+dnl
+dnl Defines VARS as feature variables and accumulators.  Also accumulates
+dnl (prepending, not appending) feature values for VARS.
+dnl
+AC_DEFUN([CAIRO_ACCUMULATED_FEATURE_VARS_REGISTER],
+[
+	m4_foreach_w([cr_var], [$1],
+		     [m4_append_uniq([_CAIRO_ACCUMULATED_FEATURE_VARS], cr_var, [ ],,
+				     [m4_fatal([Accumulated feature variable `]cr_var[' already registered])])])dnl
+	CAIRO_FEATURE_VARS_REGISTER([$1],[$2])dnl
+	CAIRO_ACCUMULATORS_REGISTER_UNQUOTED([$1],[$3],[$4])dnl
+])
+
+dnl
+dnl CAIRO_ACCUMULATED_FEATURE_VARS_FOREACH(VAR, COMMANDS)
+dnl 
+dnl Run COMMANDS for each registered accumulated feature variable.
+dnl Defines VAR to the variable being processed.
+dnl
+AC_DEFUN([CAIRO_ACCUMULATED_FEATURE_VARS_FOREACH],
+[
+	m4_foreach_w([$1], m4_defn([_CAIRO_ACCUMULATED_FEATURE_VARS]), [$2])
+])
+
+dnl ===========================================================================
+
+dnl
+dnl CAIRO_FEATURE_IF_ENABLED(FEATURE=cr_feature, COMMANDS)
+dnl
+dnl Run COMMANDS if FEATURE is enabled.
+dnl
 AC_DEFUN([CAIRO_FEATURE_IF_ENABLED],
 [
 	AS_IF([test "x$use_]m4_default([$1], cr_feature)[" = xyes], [$2], [$3])
@@ -368,36 +527,12 @@ CAIRO_FEATURE_HOOK_REGISTER(*,*,*,
 
 dnl ===========================================================================
 dnl
-dnl Substitute vars
-dnl
-AC_SUBST(CAIRO_REQUIRES)
-AC_SUBST(CAIRO_BASE)
-AC_SUBST(CAIRO_CFLAGS)
-AC_SUBST(CAIRO_NONPKGCONFIG_CFLAGS)
-AC_SUBST(CAIRO_LIBS)
-AC_SUBST(CAIRO_NONPKGCONFIG_LIBS)
-
-
-dnl ===========================================================================
-dnl
-dnl Accumulate values for all feature vars for enabled features
-dnl
-
-CAIRO_FEATURE_HOOK_REGISTER(yes,*,*,
-[
-	CAIRO_FEATURE_VARS_FOREACH([cr_var], [[test -n "$]cr_feature[_]cr_var[" && CAIRO_]cr_var[="$]cr_feature[_]cr_var[ $CAIRO_]cr_var["]]m4_newline)
-])
-
-
-dnl ===========================================================================
-dnl
 dnl Generate {src,boilerplate}/Makefile.{am,win32}.config
 dnl
 
 dnl Accumulators
-m4_pattern_allow(^CAIRO_CONFIG_AMAKE$)
-CAIRO_CONFIG_AMAKE='# Generated by configure.  Do not edit.
-
+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
 
 enabled_cairo_pkgconf = cairo.pc
@@ -409,10 +544,9 @@ all_cairo_headers = $(cairo_headers)
 all_cairo_private = $(cairo_private)
 all_cairo_sources = $(cairo_sources)
 supported_cairo_headers = $(cairo_headers)
-unsupported_cairo_headers =
-'
-m4_pattern_allow(^CAIRO_CONFIG_WIN32$)
-CAIRO_CONFIG_WIN32=$CAIRO_CONFIG_AMAKE
+unsupported_cairo_headers =])
+
+CAIRO_ACCUMULATORS_REGISTER_UNQUOTED(CONFIG_WIN32,m4_newline,[$CAIRO_CONFIG_AMAKE])
 
 dnl Generate
 CAIRO_CONFIG_COMMANDS([$srcdir/src/Makefile.am.config],
@@ -425,21 +559,21 @@ CAIRO_CONFIG_COMMANDS([$srcdir/src/Makefile.win32.config],
 dnl Collect list of all supported public cairo headers
 CAIRO_FEATURE_HOOK_REGISTER(*,!no,!,
 [
-	CAIRO_CONFIG_AMAKE=$CAIRO_CONFIG_AMAKE'm4_newline()supported_cairo_headers += $(cairo_$1_headers)'
-	CAIRO_CONFIG_WIN32=$CAIRO_CONFIG_WIN32'm4_newline()supported_cairo_headers += $(cairo_$1_headers)'
+	CAIRO_ACCUMULATE(CONFIG_AMAKE, [supported_cairo_headers += $(cairo_$1_headers)])
+	CAIRO_ACCUMULATE(CONFIG_WIN32, [supported_cairo_headers += $(cairo_$1_headers)])
 ])
 
 dnl Collect list of all unsupported public cairo headers
 CAIRO_FEATURE_HOOK_REGISTER(*,no,!,
 [
-	CAIRO_CONFIG_AMAKE=$CAIRO_CONFIG_AMAKE'm4_newline()unsupported_cairo_headers += $(cairo_$1_headers)'
-	CAIRO_CONFIG_WIN32=$CAIRO_CONFIG_WIN32'm4_newline()unsupported_cairo_headers += $(cairo_$1_headers)'
+	CAIRO_ACCUMULATE(CONFIG_AMAKE, [unsupported_cairo_headers += $(cairo_$1_headers)])
+	CAIRO_ACCUMULATE(CONFIG_WIN32, [unsupported_cairo_headers += $(cairo_$1_headers)])
 ])
 
 dnl Collect list of source files for all/enabled public features
 CAIRO_FEATURE_HOOK_REGISTER(*,*,!,
 [
-	CAIRO_CONFIG_AMAKE=$CAIRO_CONFIG_AMAKE'
+	CAIRO_ACCUMULATE(CONFIG_AMAKE, [
 all_cairo_headers += $(cairo_$1_headers)
 all_cairo_private += $(cairo_$1_private)
 all_cairo_sources += $(cairo_$1_sources)
@@ -448,8 +582,8 @@ enabled_cairo_headers += $(cairo_$1_headers)
 enabled_cairo_private += $(cairo_$1_private)
 enabled_cairo_sources += $(cairo_$1_sources)
 endif
-'
-	CAIRO_CONFIG_WIN32=$CAIRO_CONFIG_WIN32'
+])
+	CAIRO_ACCUMULATE(CONFIG_WIN32, [
 all_cairo_headers += $(cairo_$1_headers)
 all_cairo_private += $(cairo_$1_private)
 all_cairo_sources += $(cairo_$1_sources)
@@ -458,29 +592,29 @@ enabled_cairo_headers += $(cairo_$1_headers)
 enabled_cairo_private += $(cairo_$1_private)
 enabled_cairo_sources += $(cairo_$1_sources)
 endif
-'
+])
 ])
 
 dnl Collect list of source files for all/enabled private features
 CAIRO_FEATURE_HOOK_REGISTER(*,*,,
 [
 	dnl No public headers for private features
-	CAIRO_CONFIG_AMAKE=$CAIRO_CONFIG_AMAKE'
+	CAIRO_ACCUMULATE(CONFIG_AMAKE, [
 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
-'
-	CAIRO_CONFIG_WIN32=$CAIRO_CONFIG_WIN32'
+])
+	CAIRO_ACCUMULATE(CONFIG_WIN32, [
 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
-'
+])
 ])
 
 
@@ -494,9 +628,17 @@ AC_CONFIG_FILES([src/cairo.pc])
 AC_CONFIG_FILES([cairo-uninstalled.pc:src/cairo-uninstalled.pc.in])
 
 dnl pkg-config requires, non-pkgconfig cflags and libs, and total cflags and libs
-CAIRO_FEATURE_VARS_REGISTER([REQUIRES BASE])
-CAIRO_FEATURE_VARS_REGISTER([CFLAGS NONPKGCONFIG_CFLAGS])
-CAIRO_FEATURE_VARS_REGISTER([LIBS NONPKGCONFIG_LIBS], [$LIBS])
+CAIRO_FEATURE_VARS_REGISTER([BASE],[cairo])
+CAIRO_ACCUMULATED_FEATURE_VARS_REGISTER([REQUIRES],,[ ])
+CAIRO_ACCUMULATED_FEATURE_VARS_REGISTER([CFLAGS NONPKGCONFIG_CFLAGS],,[ ])
+CAIRO_ACCUMULATED_FEATURE_VARS_REGISTER([LIBS NONPKGCONFIG_LIBS],,[ ],[$LIBS])
+AC_SUBST(CAIRO_REQUIRES)
+AC_SUBST(CAIRO_BASE)
+AC_SUBST(CAIRO_CFLAGS)
+AC_SUBST(CAIRO_NONPKGCONFIG_CFLAGS)
+AC_SUBST(CAIRO_LIBS)
+AC_SUBST(CAIRO_NONPKGCONFIG_LIBS)
+
 
 dnl Generate .pc files for enabled non-builtin public features
 CAIRO_FEATURE_HOOK_REGISTER(yes,!always,!,
@@ -562,29 +704,24 @@ dnl Generate src/cairo-features.h src/cairo-supported-features.h
 dnl
 
 dnl Collect list of enabled public features
+CAIRO_ACCUMULATORS_REGISTER(FEATURES,[ ])
 CAIRO_FEATURE_HOOK_REGISTER(yes,*,!,
 [
-	CAIRO_FEATURES="cr_feature_tag $CAIRO_FEATURES"
+	CAIRO_ACCUMULATE(FEATURES, cr_feature_tag)
 ])
 dnl Collect list of all supported public features
+CAIRO_ACCUMULATORS_REGISTER(SUPPORTED_FEATURES,[ ])
 CAIRO_FEATURE_HOOK_REGISTER(*,!no,!,
 [
-	CAIRO_SUPPORTED_FEATURES="cr_feature_tag $CAIRO_SUPPORTED_FEATURES"
+	CAIRO_ACCUMULATE(SUPPORTED_FEATURES, cr_feature_tag)
 ])
 dnl Collect list of all supported disabled public features
+CAIRO_ACCUMULATORS_REGISTER(NO_FEATURES,[ ])
 CAIRO_FEATURE_HOOK_REGISTER(no,!no,!,
 [
-	CAIRO_NO_FEATURES="cr_feature_tag $CAIRO_NO_FEATURES"
+	CAIRO_ACCUMULATE(NO_FEATURES, cr_feature_tag)
 ])
 
-dnl Accumulators
-m4_pattern_allow(^CAIRO_FEATURES$)
-CAIRO_FEATURES=""
-m4_pattern_allow(^CAIRO_NO_FEATURES$)
-CAIRO_NO_FEATURES=""
-m4_pattern_allow(^CAIRO_SUPPORTED_FEATURES$)
-CAIRO_SUPPORTED_FEATURES=""
-
 dnl Generate src/cairo-features.h and src/cairo-supported-features.h
 CAIRO_CONFIG_COMMANDS([src/cairo-features.h],
 [
@@ -633,19 +770,18 @@ dnl
 dnl Report
 dnl
 
-dnl Accumulator for warning messages
-CAIRO_FEATURE_VARS_REGISTER([WARNING_MESSAGE])
+CAIRO_ACCUMULATORS_REGISTER([WARNING_MESSAGE],m4_newline()m4_newline)
 
 dnl Collect warning message for enabled unsupported public features
 CAIRO_FEATURE_HOOK_REGISTER(yes,no,!,
 [
-	CAIRO_WARNING_MESSAGE="$CAIRO_WARNING_MESSAGE]m4_newline[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)m4_newline"
+	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 Collect warning message for disabled recommended features
 CAIRO_FEATURE_HOOK_REGISTER(no,yes,*,
 [
-	CAIRO_WARNING_MESSAGE="$CAIRO_WARNING_MESSAGE]m4_newline[m4_text_wrap([It is strictly recommended that you do NOT disable the ]cr_feature_name[ feature.], [+++ ],, 78)m4_newline"
+	CAIRO_ACCUMULATE([WARNING_MESSAGE], m4_text_wrap([It is strictly recommended that you do NOT disable the ]cr_feature_name[ feature.], [+++ ],, 78))
 ])
 
 


More information about the cairo-commit mailing list