summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2008-09-11 04:17:43 -0400
committerBehdad Esfahbod <behdad@behdad.org>2008-09-11 04:17:43 -0400
commitb7a838261bd2aace4466a725a8de08cdd4dccc9c (patch)
treea0a60c2a25eead7b0c74913e9b717ce9b7c83122 /build
parentac6e4b83e7eac8cf99849b3c4b60da7fdace8625 (diff)
Move m4 macros into build/aclocal.*.m4 files
Diffstat (limited to 'build')
-rw-r--r--build/aclocal.cairo.m4146
-rw-r--r--build/aclocal.enable.m4439
-rw-r--r--build/aclocal.float.m464
-rw-r--r--build/aclocal.gtk-doc.m439
-rw-r--r--build/aclocal.pkg.m4155
-rw-r--r--build/configure.ac.enable447
6 files changed, 843 insertions, 447 deletions
diff --git a/build/aclocal.cairo.m4 b/build/aclocal.cairo.m4
new file mode 100644
index 000000000..ce0c5a731
--- /dev/null
+++ b/build/aclocal.cairo.m4
@@ -0,0 +1,146 @@
+
+dnl ==========================================================================
+dnl
+dnl Cairo-specific macros
+dnl
+m4_pattern_forbid([CAIRO])
+m4_pattern_forbid([^cr_])
+
+dnl ==========================================================================
+
+dnl Parse Version.mk and declare m4 variables out of it
+m4_define([CAIRO_PARSE_VERSION],dnl
+ m4_translit(dnl
+ m4_bpatsubst(m4_include(cairo-version.h),
+ [^.define \([a-zA-Z0-9_]*\) *\([0-9][0-9]*\)],
+ [[m4_define(\1, \[\2\])]]),
+ [A-Z], [a-z])dnl
+)dnl
+
+dnl ==========================================================================
+
+dnl Usage:
+dnl CAIRO_BIGENDIAN
+dnl
+AC_DEFUN([CAIRO_BIGENDIAN],
+[dnl
+ case $host_os in
+ darwin*)
+ AH_VERBATIM([X_BYTE_ORDER],
+[
+/* Deal with multiple architecture compiles on Mac OS X */
+#ifdef __APPLE_CC__
+#ifdef __BIG_ENDIAN__
+#define WORDS_BIGENDIAN 1
+#define FLOAT_WORDS_BIGENDIAN 1
+#else
+#undef WORDS_BIGENDIAN
+#undef FLOAT_WORDS_BIGENDIAN
+#endif
+#endif
+])
+ ;;
+ *)
+ AC_C_BIGENDIAN
+ AX_C_FLOAT_WORDS_BIGENDIAN
+ ;;
+ esac
+])
+
+dnl CAIRO_CHECK_FUNCS_WITH_FLAGS(FUNCTION..., CFLAGS, LIBS
+dnl [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
+dnl Like AC_CHECK_FUNCS but with additional CFLAGS and LIBS
+dnl --------------------------------------------------------------------
+AC_DEFUN([CAIRO_CHECK_FUNCS_WITH_FLAGS],
+[dnl
+ _save_cflags="$CFLAGS"
+ _save_libs="$LIBS"
+ CFLAGS="$CFLAGS $2"
+ LIBS="$LIBS $3"
+ AC_CHECK_FUNCS($1, $4, $5)
+ CFLAGS="$_save_cflags"
+ LIBS="$_save_libs"
+])
+
+dnl CAIRO_CONFIG_COMMANDS is like AC_CONFIG_COMMANDS, except that:
+dnl
+dnl 1) It redirects the stdout of the command to the file.
+dnl 2) It does not recreate the file if contents didn't change.
+dnl
+AC_DEFUN([CAIRO_CONFIG_COMMANDS],
+[dnl
+ AC_CONFIG_COMMANDS($1,
+ [
+ _config_file=$1
+ _tmp_file=cairoconf.tmp
+ AC_MSG_NOTICE([creating $_config_file])
+ {
+ $2
+ } >> "$_tmp_file" ||
+ AC_MSG_ERROR([failed to write to $_tmp_file])
+
+ if cmp -s "$_tmp_file" "$_config_file"; then
+ AC_MSG_NOTICE([$_config_file is unchanged])
+ rm -f "$_tmp_file"
+ else
+ mv "$_tmp_file" "$_config_file" ||
+ AC_MSG_ERROR([failed to update $_config_file])
+ fi
+ ], $3)
+])
+
+dnl check compiler flags
+AC_DEFUN([CAIRO_CC_TRY_FLAG],
+[dnl
+ AC_MSG_CHECKING([whether $CC supports $1])
+
+ _save_cflags="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror $1"
+ AC_COMPILE_IFELSE([ ], [cairo_cc_flag=yes], [cairo_cc_flag=no])
+ CFLAGS="$_save_cflags"
+
+ if test "x$cairo_cc_flag" = "xyes"; then
+ ifelse([$2], , :, [$2])
+ else
+ ifelse([$3], , :, [$3])
+ fi
+ AC_MSG_RESULT([$cairo_cc_flag])
+])
+
+dnl Usage:
+dnl CAIRO_CHECK_NATIVE_ATOMIC_PRIMITIVES
+AC_DEFUN([CAIRO_CHECK_NATIVE_ATOMIC_PRIMITIVES],
+[dnl
+ AC_CACHE_CHECK([for native atomic primitives], cairo_cv_atomic_primitives,
+ [
+ cairo_cv_atomic_primitives="none"
+
+ AC_TRY_LINK([int atomic_add(int i) { return __sync_fetch_and_add (&i, 1); }], [],
+ cairo_cv_atomic_primitives="Intel"
+ )
+ ])
+ if test "x$cairo_cv_atomic_primitives" = xIntel; then
+ AC_DEFINE(HAVE_INTEL_ATOMIC_PRIMITIVES, 1,
+ [Enable if your compiler supports the Intel __sync_* atomic primitives])
+ fi
+])
+
+dnl Usage:
+dnl CAIRO_CHECK_ATOMIC_OP_NEEDS_MEMORY_BARRIER
+AC_DEFUN([CAIRO_CHECK_ATOMIC_OP_NEEDS_MEMORY_BARRIER],
+[dnl
+ AC_CACHE_CHECK([whether atomic ops require a memory barrier], cairo_cv_atomic_op_needs_memory_barrier,
+ [
+ case $host_cpu in
+ i?86) cairo_cv_atomic_op_needs_memory_barrier="no" ;;
+ x86_64) cairo_cv_atomic_op_needs_memory_barrier="no" ;;
+ arm*) cairo_cv_atomic_op_needs_memory_barrier="no" ;;
+ *) cairo_cv_atomic_op_needs_memory_barrier="yes" ;;
+ esac
+ ])
+ if test "x$cairo_cv_atomic_op_needs_memory_barrier" = "xyes"; then
+ AC_DEFINE_UNQUOTED(ATOMIC_OP_NEEDS_MEMORY_BARRIER, 1,
+ [whether memory barriers are needed around atomic operations])
+ fi
+])
+
diff --git a/build/aclocal.enable.m4 b/build/aclocal.enable.m4
new file mode 100644
index 000000000..b3a0d82ad
--- /dev/null
+++ b/build/aclocal.enable.m4
@@ -0,0 +1,439 @@
+dnl
+dnl These are the facilities for enable/disabling various features,
+dnl and for collecting CFLAGS/LIBS and generating per feature .pc
+dnl files, assembling list of source files to compile, creating
+dnl cairo-features.h and other generated files, etc...
+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
+dnl where:
+dnl
+dnl ID is the sub-namespace in function names, eg. "ft" for cairo_ft_...
+dnl NAME is the human-readable name of the feature, eg. "FreeType font"
+dnl WHAT is the type of feature:
+dnl "surface" for surface backends
+dnl "font" for font backends
+dnl "functions" for set of functions
+dnl "" for private configurations
+dnl DEFAULT is the default state of the feature:
+dnl "no" for experimental features, eg. your favorite new backend
+dnl "yes" for recommended features, eg. png functions
+dnl "auto" for other supported features, eg. xlib surface backend
+dnl "always" for mandatory features (can't be disabled), eg. image surface backend
+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],
+[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,
+ [no],,
+ [yes],,
+ [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
+ dnl
+ AS_CASE([$enable_$1],
+ [no],[dnl
+ use_$1="no (disabled, use --enable-cr_feature_arg to enable)"
+ ],dnl
+ [yes|auto],[dnl
+ dnl Cache invalidating:
+ dnl
+ 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...)
+ dnl
+ dnl - Length of the COMMANDS string changes!
+ dnl (This is much more friendly to the cache than caching
+ dnl the commands string itself. Note that this still does
+ dnl not catch all valid cases where we should be
+ dnl invalidting. For example if COMMANDS uses
+ dnl variables/macros defined outside, we don't detect changes
+ dnl in those variables. Also doesn't detect in-place
+ dnl modifications like bumping verson numbers.
+ dnl Just modify COMMANDS in an obvious way to force recheck.
+ dnl Hashing sounds a bit too harsh to do here...)
+ dnl
+ dnl - If feature is requested and cached results for enabling
+ dnl feature is no. We are going to terminate with an error
+ dnl if this happens anyway, so we can be more friendly by
+ dnl assuming that user installed some missing pieces since
+ 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_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])
+
+ 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)
+ cr_feature_commands
+ cairo_cv_[]$1[]_use=$use_[]$1
+ cairo_cv_[]$1[]_cache_vars="_CAIRO_FEATURE_VARS"
+ cairo_cv_[]$1[]_cache_commands_len="cr_feature_commands_len"
+ 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
+ ],dnl
+ [dnl
+ AC_MSG_ERROR([invalid argument passed to --enable-]cr_feature_arg[: `$use_$1', should be one of @<:@no/auto/yes@:>@])
+ ])dnl
+
+ 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)
+ ])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
+ m4_popdef([cr_feature_what])dnl
+ m4_popdef([cr_feature_default])dnl
+ m4_popdef([cr_feature_commands])dnl
+ m4_popdef([cr_feature_commands_len])dnl
+ m4_popdef([cr_feature_arg])dnl
+])
+
+
+dnl ===========================================================================
+
+m4_define([_CAIRO_FEATURE_VARS])
+
+dnl
+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 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])])])dnl
+ m4_foreach_w([cr_var], [$1],
+ [dnl
+ m4_define([cr_var_default_]cr_var[_value], m4_default([$2],[[$ac_env_[]]cr_feature[[]_]]cr_var[[_value]]))dnl
+ ])dnl
+])
+
+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],
+[dnl
+ m4_foreach_w([$1], m4_defn([_CAIRO_FEATURE_VARS]), [$2])dnl
+])
+
+
+dnl ===========================================================================
+
+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=[])
+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],
+[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],
+[dnl
+ _CAIRO_ACCUMULATORS_REGISTER([$1],[$2],["$3"])dnl
+])dnl
+
+m4_define([_CAIRO_ACCUMULATOR_CHECK],
+[dnl
+ m4_ifdef([cr_acc_$1_sep],,[m4_fatal([Accumulator ]$1[ not defined.])])dnl
+])dnl
+
+m4_define([_CAIRO_ACCUMULATE],
+[dnl
+ _CAIRO_ACCUMULATOR_CHECK([$1])dnl
+ m4_ifval([$2], [$3]m4_newline)dnl
+])dnl
+
+dnl
+dnl CAIRO_ACCUMULATE(VAR, VALUE)
+dnl
+dnl Appends VALUE to accumulator VAR
+dnl
+AC_DEFUN([CAIRO_ACCUMULATE],
+[dnl
+ _CAIRO_ACCUMULATE([$1], [$2], [CAIRO_$1="${CAIRO_$1}]m4_do([cr_acc_$1_sep])["'$2'])dnl
+])dnl
+
+dnl
+dnl CAIRO_ACCUMULATE(VAR, VALUE)
+dnl
+dnl Prepends VALUE to accumulator VAR
+dnl
+AC_DEFUN([CAIRO_ACCUMULATE_BEFORE],
+[dnl
+ _CAIRO_ACCUMULATE([$1], [$2], [CAIRO_$1='$2'"]m4_do([cr_acc_$1_sep])[${CAIRO_$1}"])dnl
+])dnl
+
+m4_define([_CAIRO_ACCUMULATE_UNQUOTED],
+[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)
+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],
+[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)
+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],
+[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)
+dnl
+dnl Run COMMANDS for each registered accumulator.
+dnl Defines VAR to the accumulator being processed.
+dnl
+AC_DEFUN([CAIRO_ACCUMULATORS_FOREACH],
+[dnl
+ m4_foreach_w([$1], m4_defn([_CAIRO_ACCUMULATORS]), [$2])dnl
+])dnl
+
+
+dnl ===========================================================================
+
+m4_define([_CAIRO_ACCUMULATED_FEATURE_VARS])dnl
+
+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],
+[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)
+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],
+[dnl
+ m4_foreach_w([$1], m4_defn([_CAIRO_ACCUMULATED_FEATURE_VARS]), [$2])dnl
+])dnl
+
+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],
+[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['])])dnl
+])dnl
+
+m4_define([_CAIRO_FEATURE_HOOK_MATCH_M4],
+[dnl
+ m4_case([$1],
+ [*], [$3],
+ [$2], [$3],
+ [!$2], ,
+ [m4_bmatch([$1], [^!], [$3])])dnl
+])dnl
+
+m4_define([_CAIRO_FEATURE_HOOKS])dnl
+
+dnl
+dnl CAIRO_FEATURE_HOOK_REGISTER(ENABLED, DEFAULT, WHAT, COMMANDS)
+dnl
+dnl ENABLED is the feature enabledness to match
+dnl DEFAULT is the default value of features to match
+dnl WHAT is the type of features to match
+dnl COMMANDS is commands to run for matched features.
+dnl
+dnl Runs COMMANDS for features matching ENABLED, DEFAULT, and WHAT.
+dnl Hooks are run for each feature in the order they are added.
+dnl
+dnl DEFAULT and WHAT are matched like this:
+dnl [*] matches all values
+dnl [val] matches [val]
+dnl [!val] matches anything other than [val]
+dnl
+dnl ENABLED is matched like this:
+dnl [yes] matches enabled features
+dnl [no] matches disabled features
+dnl [*] matches all features
+dnl
+dnl The following macros can be used in COMMANDS:
+dnl
+dnl cr_feature expands to the feature id, eg "ft"
+dnl cr_feature_name expands to the human-readable name of the feature, eg. "FreeType font"
+dnl cr_feature_default expands to the default state of the feature:
+dnl "no" for experimental features, eg. your favorite new backend
+dnl "yes" for recommended features, eg. png functions
+dnl "auto" for other supported features, eg. xlib surface backend
+dnl "always" for mandatory features (can't be disabled), eg. image surface backend
+dnl cr_what expands to the type of feature:
+dnl "surface" for surface backends
+dnl "font" for font backends
+dnl "functions" for set of functions
+dnl "" for private configurations
+dnl
+dnl These four values are also set as $1 to $4. To know if feature was
+dnl enabled from within COMMANDS, use CAIRO_FEATURE_IF_ENABLED:
+dnl
+dnl CAIRO_FEATURE_IF_ENABLED($1, [IF-ENABLED], [IF-DISABLED])
+dnl
+dnl or compare $use_$1 to string "yes". As in:
+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]
+ )])])dnl
+ ], m4_newline)dnl
+])dnl
+
+
diff --git a/build/aclocal.float.m4 b/build/aclocal.float.m4
new file mode 100644
index 000000000..18ec31618
--- /dev/null
+++ b/build/aclocal.float.m4
@@ -0,0 +1,64 @@
+# AX_C_FLOAT_WORDS_BIGENDIAN ([ACTION-IF-TRUE], [ACTION-IF-FALSE],
+# [ACTION-IF-UNKNOWN])
+#
+# Checks the ordering of words within a multi-word float. This check
+# is necessary because on some systems (e.g. certain ARM systems), the
+# float word ordering can be different from the byte ordering. In a
+# multi-word float context, "big-endian" implies that the word containing
+# the sign bit is found in the memory location with the lowest address.
+# This implemenation was inspired by the AC_C_BIGENDIAN macro in autoconf.
+# -------------------------------------------------------------------------
+AC_DEFUN([AX_C_FLOAT_WORDS_BIGENDIAN],
+ [AC_CACHE_CHECK(whether float word ordering is bigendian,
+ ax_cv_c_float_words_bigendian, [
+
+# The endianess is detected by first compiling C code that contains a special
+# double float value, then grepping the resulting object file for certain
+# strings of ascii values. The double is specially crafted to have a
+# binary representation that corresponds with a simple string. In this
+# implementation, the string "noonsees" was selected because the individual
+# word values ("noon" and "sees") are palindromes, thus making this test
+# byte-order agnostic. If grep finds the string "noonsees" in the object
+# file, the target platform stores float words in big-endian order. If grep
+# finds "seesnoon", float words are in little-endian order. If neither value
+# is found, the user is instructed to specify the ordering.
+
+ax_cv_c_float_words_bigendian=unknown
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+
+double d = 90904234967036810337470478905505011476211692735615632014797120844053488865816695273723469097858056257517020191247487429516932130503560650002327564517570778480236724525140520121371739201496540132640109977779420565776568942592.0;
+
+]])], [
+
+if strings - conftest.$ac_objext | grep noonsees >/dev/null ; then
+ ax_cv_c_float_words_bigendian=yes
+fi
+if strings - conftest.$ac_objext | grep seesnoon >/dev/null ; then
+ if test "$ax_cv_c_float_words_bigendian" = unknown; then
+ ax_cv_c_float_words_bigendian=no
+ else
+ ax_cv_c_float_words_bigendian=unknown
+ fi
+fi
+
+])])
+
+case $ax_cv_c_float_words_bigendian in
+ yes)
+ m4_default([$1],
+ [AC_DEFINE([FLOAT_WORDS_BIGENDIAN], 1,
+ [Define to 1 if your system stores words within floats
+ with the most significant word first])]) ;;
+ no)
+ $2 ;;
+ *)
+ m4_default([$3],
+ [AC_MSG_ERROR([
+
+Unknown float word ordering. You need to manually preset
+ax_cv_c_float_words_bigendian=no (or yes) according to your system.
+
+ ])]) ;;
+esac
+
+])# AX_C_FLOAT_WORDS_BIGENDIAN
diff --git a/build/aclocal.gtk-doc.m4 b/build/aclocal.gtk-doc.m4
new file mode 100644
index 000000000..bfdfa1da6
--- /dev/null
+++ b/build/aclocal.gtk-doc.m4
@@ -0,0 +1,39 @@
+dnl -*- mode: autoconf -*-
+
+# serial 1
+
+dnl Usage:
+dnl GTK_DOC_CHECK([minimum-gtk-doc-version])
+AC_DEFUN([GTK_DOC_CHECK],
+[
+ AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
+ AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
+ dnl for overriding the documentation installation directory
+ AC_ARG_WITH([html-dir],
+ AS_HELP_STRING([--with-html-dir=PATH], [path to installed docs]),,
+ [with_html_dir='${datadir}/gtk-doc/html'])
+ HTML_DIR="$with_html_dir"
+ AC_SUBST([HTML_DIR])
+
+ dnl enable/disable documentation building
+ AC_ARG_ENABLE([gtk-doc],
+ AS_HELP_STRING([--enable-gtk-doc],
+ [use gtk-doc to build documentation [[default=no]]]),,
+ [enable_gtk_doc=no])
+
+ if test x$enable_gtk_doc = xyes; then
+ ifelse([$1],[],
+ [PKG_CHECK_EXISTS([gtk-doc],,
+ AC_MSG_ERROR([gtk-doc not installed and --enable-gtk-doc requested]))],
+ [PKG_CHECK_EXISTS([gtk-doc >= $1],,
+ AC_MSG_ERROR([You need to have gtk-doc >= $1 installed to build gtk-doc]))])
+ fi
+
+ AC_MSG_CHECKING([whether to build gtk-doc documentation])
+ AC_MSG_RESULT($enable_gtk_doc)
+
+ AC_PATH_PROGS(GTKDOC_CHECK,gtkdoc-check,)
+
+ AM_CONDITIONAL([ENABLE_GTK_DOC], [test x$enable_gtk_doc = xyes])
+ AM_CONDITIONAL([GTK_DOC_USE_LIBTOOL], [test -n "$LIBTOOL"])
+])
diff --git a/build/aclocal.pkg.m4 b/build/aclocal.pkg.m4
new file mode 100644
index 000000000..a0b9cd45d
--- /dev/null
+++ b/build/aclocal.pkg.m4
@@ -0,0 +1,155 @@
+# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
+#
+# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# PKG_PROG_PKG_CONFIG([MIN-VERSION])
+# ----------------------------------
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
+m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+ AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+fi
+if test -n "$PKG_CONFIG"; then
+ _pkg_min_version=m4_default([$1], [0.9.0])
+ AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ PKG_CONFIG=""
+ fi
+
+fi[]dnl
+])# PKG_PROG_PKG_CONFIG
+
+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#
+# Check to see whether a particular set of modules exists. Similar
+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
+#
+#
+# Similar to PKG_CHECK_MODULES, make sure that the first instance of
+# this or PKG_CHECK_MODULES is called, or make sure to call
+# PKG_CHECK_EXISTS manually
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_EXISTS],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+if test -n "$PKG_CONFIG" && \
+ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
+ m4_ifval([$2], [$2], [:])
+m4_ifvaln([$3], [else
+ $3])dnl
+fi])
+
+
+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+# ---------------------------------------------
+m4_define([_PKG_CONFIG],
+[if test -n "$$1"; then
+ pkg_cv_[]$1="$$1"
+ elif test -n "$PKG_CONFIG"; then
+ PKG_CHECK_EXISTS([$3],
+ [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
+ [pkg_failed=yes])
+ else
+ pkg_failed=untried
+fi[]dnl
+])# _PKG_CONFIG
+
+# _PKG_SHORT_ERRORS_SUPPORTED
+# -----------------------------
+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi[]dnl
+])# _PKG_SHORT_ERRORS_SUPPORTED
+
+
+# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+# [ACTION-IF-NOT-FOUND])
+#
+#
+# Note that if there is a possibility the first call to
+# PKG_CHECK_MODULES might not happen, you should be sure to include an
+# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
+#
+#
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_MODULES],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
+
+pkg_failed=no
+AC_MSG_CHECKING([for $1])
+
+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
+
+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
+and $1[]_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.])
+
+if test $pkg_failed = yes; then
+ _PKG_SHORT_ERRORS_SUPPORTED
+ if test $_pkg_short_errors_supported = yes; then
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
+ else
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+
+ ifelse([$4], , [AC_MSG_ERROR(dnl
+[Package requirements ($2) were not met:
+
+$$1_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+_PKG_TEXT
+])],
+ [AC_MSG_RESULT([no])
+ $4])
+elif test $pkg_failed = untried; then
+ ifelse([$4], , [AC_MSG_FAILURE(dnl
+[The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+_PKG_TEXT
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
+ [$4])
+else
+ $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+ $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+ AC_MSG_RESULT([yes])
+ ifelse([$3], , :, [$3])
+fi[]dnl
+])# PKG_CHECK_MODULES
diff --git a/build/configure.ac.enable b/build/configure.ac.enable
index afb797f5f..aa5d71dee 100644
--- a/build/configure.ac.enable
+++ b/build/configure.ac.enable
@@ -1,450 +1,3 @@
-dnl
-dnl These are the facilities for enable/disabling various features,
-dnl and for collecting CFLAGS/LIBS and generating per feature .pc
-dnl files, assembling list of source files to compile, and creating
-dnl cairo-features.h and other generated files.
-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
-dnl where:
-dnl
-dnl ID is the sub-namespace in function names, eg. "ft" for cairo_ft_...
-dnl NAME is the human-readable name of the feature, eg. "FreeType font"
-dnl WHAT is the type of feature:
-dnl "surface" for surface backends
-dnl "font" for font backends
-dnl "functions" for set of functions
-dnl "" for private configurations
-dnl DEFAULT is the default state of the feature:
-dnl "no" for experimental features, eg. your favorite new backend
-dnl "yes" for recommended features, eg. png functions
-dnl "auto" for other supported features, eg. xlib surface backend
-dnl "always" for mandatory features (can't be disabled), eg. image surface backend
-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],
-[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,
- [no],,
- [yes],,
- [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
- dnl
- AS_CASE([$enable_$1],
- [no],[dnl
- use_$1="no (disabled, use --enable-cr_feature_arg to enable)"
- ],dnl
- [yes|auto],[dnl
- dnl Cache invalidating:
- dnl
- 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...)
- dnl
- dnl - Length of the COMMANDS string changes!
- dnl (This is much more friendly to the cache than caching
- dnl the commands string itself. Note that this still does
- dnl not catch all valid cases where we should be
- dnl invalidting. For example if COMMANDS uses
- dnl variables/macros defined outside, we don't detect changes
- dnl in those variables. Also doesn't detect in-place
- dnl modifications like bumping verson numbers.
- dnl Just modify COMMANDS in an obvious way to force recheck.
- dnl Hashing sounds a bit too harsh to do here...)
- dnl
- dnl - If feature is requested and cached results for enabling
- dnl feature is no. We are going to terminate with an error
- dnl if this happens anyway, so we can be more friendly by
- dnl assuming that user installed some missing pieces since
- 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_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])
-
- 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)
- cr_feature_commands
- cairo_cv_[]$1[]_use=$use_[]$1
- cairo_cv_[]$1[]_cache_vars="_CAIRO_FEATURE_VARS"
- cairo_cv_[]$1[]_cache_commands_len="cr_feature_commands_len"
- 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
- ],dnl
- [dnl
- AC_MSG_ERROR([invalid argument passed to --enable-]cr_feature_arg[: `$use_$1', should be one of @<:@no/auto/yes@:>@])
- ])dnl
-
- 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)
- ])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
- m4_popdef([cr_feature_what])dnl
- m4_popdef([cr_feature_default])dnl
- m4_popdef([cr_feature_commands])dnl
- m4_popdef([cr_feature_commands_len])dnl
- m4_popdef([cr_feature_arg])dnl
-])
-
-
-dnl ===========================================================================
-
-m4_define([_CAIRO_FEATURE_VARS])
-
-dnl
-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 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])])])dnl
- m4_foreach_w([cr_var], [$1],
- [dnl
- m4_define([cr_var_default_]cr_var[_value], m4_default([$2],[[$ac_env_[]]cr_feature[[]_]]cr_var[[_value]]))dnl
- ])dnl
-])
-
-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],
-[dnl
- m4_foreach_w([$1], m4_defn([_CAIRO_FEATURE_VARS]), [$2])dnl
-])
-
-
-dnl ===========================================================================
-
-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=[])
-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],
-[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],
-[dnl
- _CAIRO_ACCUMULATORS_REGISTER([$1],[$2],["$3"])dnl
-])dnl
-
-m4_define([_CAIRO_ACCUMULATOR_CHECK],
-[dnl
- m4_ifdef([cr_acc_$1_sep],,[m4_fatal([Accumulator ]$1[ not defined.])])dnl
-])dnl
-
-m4_define([_CAIRO_ACCUMULATE],
-[dnl
- _CAIRO_ACCUMULATOR_CHECK([$1])dnl
- m4_ifval([$2], [$3]m4_newline)dnl
-])dnl
-
-dnl
-dnl CAIRO_ACCUMULATE(VAR, VALUE)
-dnl
-dnl Appends VALUE to accumulator VAR
-dnl
-AC_DEFUN([CAIRO_ACCUMULATE],
-[dnl
- _CAIRO_ACCUMULATE([$1], [$2], [CAIRO_$1="${CAIRO_$1}]m4_do([cr_acc_$1_sep])["'$2'])dnl
-])dnl
-
-dnl
-dnl CAIRO_ACCUMULATE(VAR, VALUE)
-dnl
-dnl Prepends VALUE to accumulator VAR
-dnl
-AC_DEFUN([CAIRO_ACCUMULATE_BEFORE],
-[dnl
- _CAIRO_ACCUMULATE([$1], [$2], [CAIRO_$1='$2'"]m4_do([cr_acc_$1_sep])[${CAIRO_$1}"])dnl
-])dnl
-
-m4_define([_CAIRO_ACCUMULATE_UNQUOTED],
-[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)
-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],
-[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)
-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],
-[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)
-dnl
-dnl Run COMMANDS for each registered accumulator.
-dnl Defines VAR to the accumulator being processed.
-dnl
-AC_DEFUN([CAIRO_ACCUMULATORS_FOREACH],
-[dnl
- m4_foreach_w([$1], m4_defn([_CAIRO_ACCUMULATORS]), [$2])dnl
-])dnl
-
-
-dnl ===========================================================================
-
-m4_define([_CAIRO_ACCUMULATED_FEATURE_VARS])dnl
-
-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],
-[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)
-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],
-[dnl
- m4_foreach_w([$1], m4_defn([_CAIRO_ACCUMULATED_FEATURE_VARS]), [$2])dnl
-])dnl
-
-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],
-[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['])])dnl
-])dnl
-
-m4_define([_CAIRO_FEATURE_HOOK_MATCH_M4],
-[dnl
- m4_case([$1],
- [*], [$3],
- [$2], [$3],
- [!$2], ,
- [m4_bmatch([$1], [^!], [$3])])dnl
-])dnl
-
-m4_define([_CAIRO_FEATURE_HOOKS])dnl
-
-dnl
-dnl CAIRO_FEATURE_HOOK_REGISTER(ENABLED, DEFAULT, WHAT, COMMANDS)
-dnl
-dnl ENABLED is the feature enabledness to match
-dnl DEFAULT is the default value of features to match
-dnl WHAT is the type of features to match
-dnl COMMANDS is commands to run for matched features.
-dnl
-dnl Runs COMMANDS for features matching ENABLED, DEFAULT, and WHAT.
-dnl Hooks are run for each feature in the order they are added.
-dnl
-dnl DEFAULT and WHAT are matched like this:
-dnl [*] matches all values
-dnl [val] matches [val]
-dnl [!val] matches anything other than [val]
-dnl
-dnl ENABLED is matched like this:
-dnl [yes] matches enabled features
-dnl [no] matches disabled features
-dnl [*] matches all features
-dnl
-dnl The following macros can be used in COMMANDS:
-dnl
-dnl cr_feature expands to the feature id, eg "ft"
-dnl cr_feature_name expands to the human-readable name of the feature, eg. "FreeType font"
-dnl cr_feature_default expands to the default state of the feature:
-dnl "no" for experimental features, eg. your favorite new backend
-dnl "yes" for recommended features, eg. png functions
-dnl "auto" for other supported features, eg. xlib surface backend
-dnl "always" for mandatory features (can't be disabled), eg. image surface backend
-dnl cr_what expands to the type of feature:
-dnl "surface" for surface backends
-dnl "font" for font backends
-dnl "functions" for set of functions
-dnl "" for private configurations
-dnl
-dnl These four values are also set as $1 to $4. To know if feature was
-dnl enabled from within COMMANDS, use CAIRO_FEATURE_IF_ENABLED:
-dnl
-dnl CAIRO_FEATURE_IF_ENABLED($1, [IF-ENABLED], [IF-DISABLED])
-dnl
-dnl or compare $use_$1 to string "yes". As in:
-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]
- )])])dnl
- ], m4_newline)dnl
-])dnl
-
-
-
-dnl ===========================================================================
-dnl
-dnl Cairo-specific configuration facilities
-dnl
-dnl ===========================================================================
-
-
dnl
dnl Define macros to enable various features.