2008-09-04 16:00:40 -04:00
dnl
2008-09-06 09:50:57 -04:00
dnl These are the facilities for enable/disabling various features,
dnl and for collecting CFLAGS/LIBS and generating per feature .pc
2008-09-04 16:00:40 -04:00
dnl files, assembling list of source files to compile, and creating
dnl cairo-features.h and other generated files.
dnl
2008-09-03 20:06:26 -04:00
dnl ===========================================================================
2008-09-06 15:10:24 -04:00
2008-09-03 20:06:26 -04:00
dnl
2008-09-04 19:50:32 -04:00
dnl Define a macro to enable features
2008-09-06 15:54:23 -04:00
dnl - Macro: _CAIRO_ENABLE (ID, NAME, WHAT, DEFAULT, COMMANDS)
2008-09-03 20:06:26 -04:00
dnl
dnl where:
dnl
2008-09-06 09:50:57 -04:00
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"
2008-09-04 21:13:39 -04:00
dnl WHAT is the type of feature:
2008-09-06 15:10:24 -04:00
dnl "surface" for surface backends
dnl "font" for font backends
dnl "functions" for set of functions
dnl "" for private configurations
2008-09-06 09:50:57 -04:00
dnl DEFAULT is the default state of the feature:
2008-09-03 20:06:26 -04:00
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
2008-09-06 09:50:57 -04:00
dnl COMMANDS are run to check whether the feature can be enabled. Their
2008-09-03 20:06:26 -04:00
dnl result may be cached, so user should not count on them being run.
2008-09-06 09:50:57 -04:00
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/...
2008-09-03 20:06:26 -04:00
dnl appropriately. Look at the macro definition for more details,
dnl or ask if in doubt.
dnl
2008-09-06 15:54:23 -04:00
AC_DEFUN([_CAIRO_ENABLE],
2008-09-06 09:50:57 -04:00
[
2008-09-06 15:54:23 -04:00
dnl Sanity check ID
m4_if(
[$1],
m4_tolower(AS_TR_SH([$1])),
,
[m4_fatal([invalid feature name `$1'])]
)
2008-09-10 12:41:57 -04:00
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
m4_pushdef([cr_feature_arg], m4_translit([$1],_,-))dnl
2008-09-06 15:54:23 -04:00
2008-09-06 18:02:21 -04:00
dnl Sanity check default
m4_case(
cr_feature_default,
[no],,
[yes],,
[auto],,
[m4_fatal([Invalid default value `]cr_feature_default[' for feature `]cr_feature['])]
)
2008-09-06 09:50:57 -04:00
AC_ARG_ENABLE(cr_feature_arg,
2008-09-06 15:10:24 -04:00
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)
2008-09-04 17:50:15 -04:00
case $enable_$1 in
no)
2008-09-06 09:50:57 -04:00
use_$1="no (disabled, use --enable-cr_feature_arg to enable)"
2008-09-04 17:50:15 -04:00
;;
yes|auto)
2008-09-06 16:34:18 -04:00
dnl Cache invalidating:
dnl
dnl To be extremely user-friendly, we discard cache results if
dnl any of the following conditions happens:
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_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])
2008-09-06 09:50:57 -04:00
AC_CACHE_CHECK([for cairo's ]cr_feature_name[ feature], cairo_cv_[]$1[]_use,
2008-09-04 17:50:15 -04:00
[
echo
use_[]$1=yes
2008-09-06 09:50:57 -04:00
CAIRO_FEATURE_VARS_FOREACH(cr_var, [cr_feature[_]cr_var[=$ac_env_]cr_feature[_]cr_var[_value]
])
cr_feature_commands
cairo_cv_[]$1[]_use=$use_[]$1
2008-09-06 16:34:18 -04:00
cairo_cv_[]$1[]_cache_vars="CAIRO_FEATURE_VARS"
cairo_cv_[]$1[]_cache_commands_len="cr_feature_commands_len"
2008-09-06 09:50:57 -04:00
CAIRO_FEATURE_VARS_FOREACH([cr_var], [[cairo_cv_]cr_feature[_]cr_var[=$]cr_feature[_]cr_var
])
AC_MSG_CHECKING([whether cairo's ]cr_feature_name[ feature could be enabled])
2008-09-03 20:06:26 -04:00
])
2008-09-04 17:50:15 -04:00
2008-09-06 09:50:57 -04:00
use_[]$1=$cairo_cv_[]$1[]_use
2008-09-04 17:50:15 -04:00
AS_IF([test "x$enable_$1" = "xyes" -a "x$use_$1" != xyes],
[
2008-09-06 09:50:57 -04:00
AC_MSG_ERROR([requested ]cr_feature_name[ feature could not be enabled])
2008-09-04 17:50:15 -04:00
])
;;
*)
2008-09-06 09:50:57 -04:00
AC_MSG_ERROR([invalid argument passed to --enable-]cr_feature_arg[: `$use_$1', should be one of @<:@no/auto/yes@:>@])
2008-09-04 17:50:15 -04:00
;;
esac
2008-09-06 09:50:57 -04:00
AS_IF([test "x$use_$1" = "xyes"],
[
CAIRO_FEATURE_VARS_FOREACH([cr_var], [cr_feature[_]cr_var[=$cairo_cv_]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
])
])
2008-09-06 15:10:24 -04:00
_CAIRO_FEATURE_HOOKS(cr_feature, cr_feature_name, cr_feature_default, cr_feature_what)
2008-09-10 12:41:57 -04:00
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
2008-09-04 17:50:15 -04:00
])
2008-09-04 16:41:51 -04:00
2008-09-06 09:50:57 -04:00
dnl ===========================================================================
2008-09-06 15:10:24 -04:00
2008-09-06 09:50:57 -04:00
dnl
dnl CAIRO_FEATURE_VARS_REGISTER(VARS, INITIAL-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
AC_DEFUN([CAIRO_FEATURE_VARS_REGISTER],
[
m4_foreach_w([cr_var], [$1],
[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_pattern_allow([CAIRO_]cr_var)])
])
AC_DEFUN([CAIRO_FEATURE_VARS_FOREACH],
[
2008-09-07 16:53:14 -04:00
m4_foreach_w([$1], m4_quote(CAIRO_FEATURE_VARS), [$2])
2008-09-06 09:50:57 -04:00
])
2008-09-06 16:59:41 -04:00
2008-09-06 15:10:24 -04:00
dnl ===========================================================================
2008-09-06 15:27:24 -04:00
AC_DEFUN([CAIRO_FEATURE_IF_ENABLED],
[
AS_IF([test "x$use_]m4_default([$1], cr_feature)[" = xyes], [$2], [$3])
])
2008-09-07 17:43:30 -04:00
m4_define([_CAIRO_FEATURE_HOOK_MATCH_SH_BOOL],
[
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['])])
])
m4_define([_CAIRO_FEATURE_HOOK_MATCH_M4],
2008-09-06 15:10:24 -04:00
[
m4_case([$1],
[*], [$3],
[$2], [$3],
[!$2], ,
[m4_bmatch([$1], [^!], [$3])])
])
m4_define([_CAIRO_FEATURE_HOOKS])
dnl
2008-09-07 17:43:30 -04:00
dnl CAIRO_FEATURE_HOOK_REGISTER(ENABLED, DEFAULT, WHAT, COMMANDS)
2008-09-06 15:12:32 -04:00
dnl
2008-09-07 17:43:30 -04:00
dnl ENABLED is the feature enabledness to match
2008-09-06 15:12:32 -04:00
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.
2008-09-06 15:10:24 -04:00
dnl
2008-09-07 17:43:30 -04:00
dnl Runs COMMANDS for features matching ENABLED, DEFAULT, and WHAT.
dnl Hooks are run for each feature in the order they are added.
2008-09-06 15:10:24 -04:00
dnl
2008-09-06 15:12:32 -04:00
dnl DEFAULT and WHAT are matched like this:
2008-09-06 15:10:24 -04:00
dnl [*] matches all values
dnl [val] matches [val]
dnl [!val] matches anything other than [val]
dnl
2008-09-07 17:43:30 -04:00
dnl ENABLED is matched like this:
dnl [yes] matches enabled features
dnl [no] matches disabled features
dnl [*] matches all features
dnl
2008-09-06 15:10:24 -04:00
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 backends, eg. your favorite new backend
dnl "yes" for mandatory backends, eg. png
dnl "auto" for other supported backends, eg. xlib
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
2008-09-07 17:43:30 -04:00
dnl enabled from within COMMANDS, use CAIRO_FEATURE_IF_ENABLED:
2008-09-06 15:27:24 -04:00
dnl
dnl CAIRO_FEATURE_IF_ENABLED($1, [IF-ENABLED], [IF-DISABLED])
dnl
dnl or compare $use_$1 to string "yes". As in:
2008-09-06 15:10:24 -04:00
dnl
2008-09-06 15:27:24 -04:00
dnl AS_IF([test "x$use_$1" = "xyes"], [IF-ENABLED], [IF-DISABLED])
2008-09-06 15:10:24 -04:00
dnl
AC_DEFUN([CAIRO_FEATURE_HOOK_REGISTER],
[
m4_append([_CAIRO_FEATURE_HOOKS],
[
2008-09-07 17:43:30 -04:00
_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]
)])])
2008-09-06 15:10:24 -04:00
], m4_newline)
])
2008-09-06 16:59:41 -04:00
dnl ===========================================================================
dnl
dnl Cairo-specific configuration facilities
dnl
2008-09-06 17:26:51 -04:00
dnl ===========================================================================
2008-09-06 16:59:41 -04:00
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])])
AC_DEFUN([CAIRO_ENABLE_SURFACE_BACKEND],
[_CAIRO_ENABLE([$1], [$2 surface backend], surface, [$3],[$4])])
AC_DEFUN([CAIRO_ENABLE_FONT_BACKEND],
[_CAIRO_ENABLE([$1], [$2 font backend], font, [$3],[$4])])
AC_DEFUN([CAIRO_ENABLE_FUNCTIONS],
[_CAIRO_ENABLE([$1], [$2 functions], functions, [$3],[$4])])
2008-09-06 15:12:32 -04:00
dnl
2008-09-06 17:26:51 -04:00
dnl Define cr_feature_tag ala other cr_feature_* macros
dnl Expands to CAIRO_HAS_FEATURE_ID
2008-09-06 15:12:32 -04:00
dnl
2008-09-06 15:54:23 -04:00
m4_define([_CAIRO_BUILD_FEATURE_TAG_NORMALIZED],
[CAIRO_HAS_[$1]m4_bmatch([$1],[$2$],,[$2])])
m4_define([_CAIRO_BUILD_FEATURE_TAG],
[_CAIRO_BUILD_FEATURE_TAG_NORMALIZED(AS_TR_CPP([$1]),AS_TR_CPP(m4_ifval([$2],[ $2])))])
m4_define([cr_feature_tag],
[_CAIRO_BUILD_FEATURE_TAG(cr_feature,cr_feature_what)])
2008-09-06 15:12:32 -04:00
2008-09-06 17:26:51 -04:00
dnl Allow feature tags in the output
m4_pattern_allow(^CAIRO_HAS_)
2008-09-06 15:12:32 -04:00
2008-09-10 12:15:20 -04:00
dnl
2008-09-10 12:41:57 -04:00
dnl Define cr_feature_pc_modname and cr_feature_pc ala other cr_feature_* macros
dnl
m4_define([cr_feature_pc_modname],
[[cairo-]m4_translit(cr_feature,_,-)])
2008-09-10 12:15:20 -04:00
m4_define([cr_feature_pc],
2008-09-10 12:41:57 -04:00
[cr_feature_pc_modname[.pc]])
2008-09-10 12:15:20 -04:00
2008-09-06 15:34:29 -04:00
2008-09-04 16:41:51 -04:00
dnl ===========================================================================
dnl
2008-09-06 17:26:51 -04:00
dnl Hooks
2008-09-04 16:41:51 -04:00
dnl
2008-09-06 17:26:51 -04:00
dnl ===========================================================================
2008-09-04 16:41:51 -04:00
dnl ===========================================================================
dnl
2008-09-06 17:26:51 -04:00
dnl Automake conditionals for all features
2008-09-04 16:41:51 -04:00
dnl
2008-09-07 17:43:30 -04:00
CAIRO_FEATURE_HOOK_REGISTER(*,*,*,
2008-09-06 17:26:51 -04:00
[
AM_CONDITIONAL(cr_feature_tag, test "x$use_$1" = xyes)
])
2008-09-04 16:41:51 -04:00
2008-09-06 17:26:51 -04:00
dnl ===========================================================================
dnl
2008-09-06 09:50:57 -04:00
dnl Substitute vars
2008-09-06 17:26:51 -04:00
dnl
2008-09-04 16:41:51 -04:00
AC_SUBST(CAIRO_REQUIRES)
2008-09-06 09:50:57 -04:00
AC_SUBST(CAIRO_BASE)
2008-09-04 16:41:51 -04:00
AC_SUBST(CAIRO_CFLAGS)
2008-09-06 09:50:57 -04:00
AC_SUBST(CAIRO_NONPKGCONFIG_CFLAGS)
2008-09-04 16:41:51 -04:00
AC_SUBST(CAIRO_LIBS)
2008-09-06 09:50:57 -04:00
AC_SUBST(CAIRO_NONPKGCONFIG_LIBS)
2008-09-04 16:41:51 -04:00
2008-09-06 17:26:51 -04:00
dnl ===========================================================================
dnl
2008-09-07 17:43:30 -04:00
dnl Accumulate values for all feature vars for enabled features
2008-09-06 17:26:51 -04:00
dnl
2008-09-07 17:43:30 -04:00
CAIRO_FEATURE_HOOK_REGISTER(yes,*,*,
2008-09-06 17:26:51 -04:00
[
2008-09-07 17:43:30 -04:00
CAIRO_FEATURE_VARS_FOREACH([cr_var], [[test -n "$]cr_feature[_]cr_var[" && CAIRO_]cr_var[="$]cr_feature[_]cr_var[ $CAIRO_]cr_var["]]m4_newline)
2008-09-06 17:26:51 -04:00
])
2008-09-04 16:41:51 -04:00
dnl ===========================================================================
dnl
2008-09-04 22:21:29 -04:00
dnl Generate {src,boilerplate}/Makefile.{am,win32}.config
2008-09-04 16:41:51 -04:00
dnl
dnl Accumulators
2008-09-04 21:59:27 -04:00
m4_pattern_allow(^CAIRO_CONFIG_AMAKE$)
2008-09-03 20:06:26 -04:00
CAIRO_CONFIG_AMAKE='# Generated by configure. Do not edit.
2008-09-04 22:21:29 -04:00
include $(top_srcdir)/src/Makefile.sources
2008-09-03 20:06:26 -04:00
enabled_cairo_pkgconf = cairo.pc
enabled_cairo_headers = $(cairo_headers)
enabled_cairo_private = $(cairo_private)
enabled_cairo_sources = $(cairo_sources)
all_cairo_pkgconf =
all_cairo_headers = $(cairo_headers)
all_cairo_private = $(cairo_private)
all_cairo_sources = $(cairo_sources)
supported_cairo_headers = $(cairo_headers)
unsupported_cairo_headers =
'
2008-09-04 21:59:27 -04:00
m4_pattern_allow(^CAIRO_CONFIG_WIN32$)
2008-09-04 17:22:07 -04:00
CAIRO_CONFIG_WIN32=$CAIRO_CONFIG_AMAKE
2008-09-03 20:06:26 -04:00
2008-09-04 16:41:51 -04:00
dnl Generate
2008-09-04 22:21:29 -04:00
CAIRO_CONFIG_COMMANDS([$srcdir/src/Makefile.am.config],
2008-09-03 20:06:26 -04:00
[echo "$CAIRO_CONFIG_AMAKE"],
[CAIRO_CONFIG_AMAKE='$CAIRO_CONFIG_AMAKE'])
2008-09-04 22:21:29 -04:00
CAIRO_CONFIG_COMMANDS([$srcdir/src/Makefile.win32.config],
2008-09-03 20:06:26 -04:00
[echo "$CAIRO_CONFIG_WIN32"],
[CAIRO_CONFIG_WIN32='$CAIRO_CONFIG_WIN32'])
2008-09-04 16:41:51 -04:00
2008-09-06 17:26:51 -04:00
dnl Collect list of all supported cairo headers
2008-09-07 17:43:30 -04:00
CAIRO_FEATURE_HOOK_REGISTER(*,!no,*,
2008-09-06 17:26:51 -04:00
[
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)'
])
dnl Collect list of all unsupported cairo headers
2008-09-07 17:43:30 -04:00
CAIRO_FEATURE_HOOK_REGISTER(*,no,*,
2008-09-06 17:26:51 -04:00
[
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)'
])
dnl Collect list of all/enabled cairo source files
2008-09-07 17:43:30 -04:00
CAIRO_FEATURE_HOOK_REGISTER(*,*,*,
2008-09-06 17:26:51 -04:00
[
CAIRO_CONFIG_AMAKE=$CAIRO_CONFIG_AMAKE'
2008-09-10 12:15:20 -04:00
all_cairo_pkgconf += cr_feature_pc
2008-09-06 17:26:51 -04:00
all_cairo_headers += $(cairo_$1_headers)
all_cairo_private += $(cairo_$1_private)
all_cairo_sources += $(cairo_$1_sources)
if cr_feature_tag
2008-09-10 12:15:20 -04:00
enabled_cairo_pkgconf += cr_feature_pc
2008-09-06 17:26:51 -04:00
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'
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 Generate .pc files
dnl
dnl All .pc files are generated automatically except for this one
AC_CONFIG_FILES([src/cairo.pc])
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])
2008-09-10 18:22:07 -04:00
dnl Generate .pc files for enabled public features
CAIRO_FEATURE_HOOK_REGISTER(yes,*,!,
2008-09-06 17:26:51 -04:00
[
2008-09-10 12:18:27 -04:00
AC_CONFIG_FILES(src/cr_feature_pc:src/cairo-features.pc.in,
2008-09-06 17:26:51 -04:00
[
2008-09-07 17:43:30 -04:00
$SED -i -e "
2008-09-10 12:41:57 -04:00
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;
2008-09-10 12:15:20 -04:00
" "]src/cr_feature_pc[" ||
AC_MSG_ERROR(failed to update ]src/cr_feature_pc[)
2008-09-07 17:43:30 -04:00
],[
SED='$SED'
$1_BASE='$$1_BASE'
$1_REQUIRES='$$1_REQUIRES'
$1_NONPKGCONFIG_LIBS='$$1_NONPKGCONFIG_LIBS'
$1_NONPKGCONFIG_CFLAGS='$$1_NONPKGCONFIG_CFLAGS'
2008-09-06 17:26:51 -04:00
])
])
2008-09-04 16:41:51 -04:00
dnl ===========================================================================
dnl
2008-09-06 17:26:51 -04:00
dnl Generate src/cairo-features.h src/cairo-supported-features.h
2008-09-04 16:41:51 -04:00
dnl
2008-09-10 18:22:07 -04:00
dnl Collect list of enabled public features
CAIRO_FEATURE_HOOK_REGISTER(yes,*,!,
2008-09-06 17:26:51 -04:00
[
2008-09-07 17:43:30 -04:00
CAIRO_FEATURES="cr_feature_tag $CAIRO_FEATURES"
2008-09-06 17:26:51 -04:00
])
2008-09-10 18:22:07 -04:00
dnl Collect list of all supported public features
CAIRO_FEATURE_HOOK_REGISTER(*,!no,!,
2008-09-06 17:26:51 -04:00
[
CAIRO_SUPPORTED_FEATURES="cr_feature_tag $CAIRO_SUPPORTED_FEATURES"
2008-09-07 17:43:30 -04:00
])
2008-09-10 18:22:07 -04:00
dnl Collect list of all supported disabled public features
CAIRO_FEATURE_HOOK_REGISTER(no,!no,!,
2008-09-07 17:43:30 -04:00
[
CAIRO_NO_FEATURES="cr_feature_tag $CAIRO_NO_FEATURES"
2008-09-06 17:26:51 -04:00
])
2008-09-04 16:41:51 -04:00
dnl Accumulators
2008-09-04 21:59:27 -04:00
m4_pattern_allow(^CAIRO_FEATURES$)
2008-09-04 16:41:51 -04:00
CAIRO_FEATURES=""
2008-09-04 21:59:27 -04:00
m4_pattern_allow(^CAIRO_NO_FEATURES$)
2008-09-04 16:41:51 -04:00
CAIRO_NO_FEATURES=""
2008-09-04 21:59:27 -04:00
m4_pattern_allow(^CAIRO_SUPPORTED_FEATURES$)
2008-09-04 16:41:51 -04:00
CAIRO_SUPPORTED_FEATURES=""
dnl Generate src/cairo-features.h and src/cairo-supported-features.h
2008-09-03 20:06:26 -04:00
CAIRO_CONFIG_COMMANDS([src/cairo-features.h],
[
echo '/* Generated by configure. Do not edit. */'
echo '#ifndef CAIRO_FEATURES_H'
echo '#define CAIRO_FEATURES_H'
echo ''
for FEATURE in $CAIRO_FEATURES; do
2008-09-04 21:13:39 -04:00
echo "#define $FEATURE 1"
2008-09-03 20:06:26 -04:00
done | LANG=C sort
echo ''
for FEATURE in $CAIRO_NO_FEATURES; do
2008-09-04 21:13:39 -04:00
echo "/*#undef $FEATURE */"
2008-09-03 20:06:26 -04:00
done | LANG=C sort
echo ''
echo '#endif'
],[
CAIRO_FEATURES='$CAIRO_FEATURES'
CAIRO_NO_FEATURES='$CAIRO_NO_FEATURES'
])
2008-09-03 20:50:26 -04:00
CAIRO_CONFIG_COMMANDS([$srcdir/src/cairo-supported-features.h],
2008-09-03 20:06:26 -04:00
[
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
2008-09-04 21:13:39 -04:00
echo "#define $FEATURE 1"
2008-09-03 20:06:26 -04:00
done
echo ''
echo '#endif'
],[
CAIRO_SUPPORTED_FEATURES='$CAIRO_SUPPORTED_FEATURES'
])
2008-09-04 16:41:51 -04:00
2008-09-10 18:22:07 -04:00
dnl For enabled private features just define them in config.h. No fanfare!
CAIRO_FEATURE_HOOK_REGISTER(yes,*,,
[
AC_DEFINE(cr_feature_tag, 1, [Define to 1 to enable cairo's ]cr_feature_name[ feature])
])
2008-09-06 16:59:41 -04:00
dnl ===========================================================================
dnl
dnl Report
dnl
dnl Accumulator for warning messages
CAIRO_FEATURE_VARS_REGISTER([WARNING_MESSAGE])
2008-09-10 18:22:07 -04:00
dnl Collect warning message for enabled unsupported public features
CAIRO_FEATURE_HOOK_REGISTER(yes,no,!,
2008-09-06 16:59:41 -04:00
[
2008-09-07 17:43:30 -04:00
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"
2008-09-06 16:59:41 -04:00
])
2008-09-10 12:19:21 -04:00
dnl Collect warning message for disabled recommended features
2008-09-07 17:43:30 -04:00
CAIRO_FEATURE_HOOK_REGISTER(no,yes,*,
2008-09-06 16:59:41 -04:00
[
2008-09-10 12:19:21 -04:00
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"
2008-09-06 16:59:41 -04:00
])
AC_DEFUN([CAIRO_REPORT],
[
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"
])