2008-09-03 20:06:26 -04:00
|
|
|
AC_CHECK_LIBM
|
|
|
|
|
LIBS="$LIBS $LIBM"
|
|
|
|
|
|
|
|
|
|
dnl ===========================================================================
|
|
|
|
|
dnl
|
|
|
|
|
dnl cairo_cache_version should be increased every time that the backend
|
|
|
|
|
dnl detection stuff changes in a way that removing the config.cache file may be
|
|
|
|
|
dnl needed for correct operation. (this is only for the backend detection
|
|
|
|
|
dnl changes; it doesn't have any effect on any other cached thing.)
|
|
|
|
|
dnl
|
|
|
|
|
m4_define(cairo_cache_version, 4)
|
|
|
|
|
|
|
|
|
|
dnl ===========================================================================
|
|
|
|
|
dnl
|
|
|
|
|
dnl Define a macro to enable backends.
|
|
|
|
|
dnl - Macro: CAIRO_BACKEND_ENABLE (NAMESPACE, NAME, ARG, FEATURE_NAME, DEFAULT, COMMANDS)
|
|
|
|
|
dnl
|
|
|
|
|
dnl where:
|
|
|
|
|
dnl
|
|
|
|
|
dnl NAMESPACE is the sub-namespace in function names, eg. "ft" for cairo_ft_...
|
|
|
|
|
dnl NAME is the human-readable name of the backend, eg. "FreeType font"
|
|
|
|
|
dnl ARG is what enables the backend, eg. "freetype" for --enable-freetype
|
|
|
|
|
dnl FEATURE_NAME is what's used in cairo-features.h, eg. FT_FONT for CAIRO_HAS_FT_FONT
|
|
|
|
|
dnl DEFAULT is the default state of the backend:
|
|
|
|
|
dnl "no" for experimental backends, eg. your favorite new backend
|
|
|
|
|
dnl "yes" for mandatory backends, eg. png
|
|
|
|
|
dnl "auto" for other supported backends, eg. xlib
|
|
|
|
|
dnl COMMANDS are run to check whether the backend can be enabled. Their
|
|
|
|
|
dnl result may be cached, so user should not count on them being run.
|
|
|
|
|
dnl They should set use_$(NAMESPACE) to something other than yes if the
|
|
|
|
|
dnl backend cannot be built, eg. "no (requires SomeThing)". It then
|
|
|
|
|
dnl should also set $(NAMESPACE)_REQUIRES/CFLAGS/LIBS/...
|
|
|
|
|
dnl appropriately. Look at the macro definition for more details,
|
|
|
|
|
dnl or ask if in doubt.
|
|
|
|
|
dnl
|
|
|
|
|
AC_DEFUN([CAIRO_BACKEND_ENABLE],
|
|
|
|
|
[AC_ARG_ENABLE([$3],
|
|
|
|
|
AS_HELP_STRING([--enable-$3=@<:@no/auto/yes@:>@],
|
|
|
|
|
[Enable cairo's $2 backend @<:@default=$5@:>@]),
|
|
|
|
|
enable_$1=$enableval, enable_$1=$5)
|
|
|
|
|
if test "x$enable_$1" = xno; then
|
|
|
|
|
use_$1="no (disabled, use --enable-$3 to enable)"
|
|
|
|
|
else
|
|
|
|
|
if test "x$cairo_cv_backend_[]$1[]_cache_version" != "x[]cairo_cache_version"; then
|
|
|
|
|
# cached results for this backend (if any) are stale. force rechecking.
|
|
|
|
|
unset cairo_cv_backend_[]$1[]_use
|
|
|
|
|
fi
|
|
|
|
|
AC_CACHE_CHECK([for cairo's $2 backend], cairo_cv_backend_[]$1[]_use,
|
|
|
|
|
[echo
|
|
|
|
|
use_[]$1=yes
|
|
|
|
|
$1[]_REQUIRES=$ac_env_[]$1[]_REQUIRES_value
|
|
|
|
|
$1[]_CFLAGS=$ac_env_[]$1[]_CFLAGS_value
|
|
|
|
|
$1[]_LIBS=$ac_env_[]$1[]_LIBS_value
|
|
|
|
|
$1[]_NONPKGCONFIG_CFLAGS=$ac_env_[]$1[]_NONPKGCONFIG_CFLAGS_value
|
|
|
|
|
$1[]_NONPKGCONFIG_LIBS=$ac_env_[]$1[]_NONPKGCONFIG_LIBS_value
|
|
|
|
|
$1[]_BASE=cairo
|
|
|
|
|
$6
|
|
|
|
|
cairo_cv_backend_[]$1[]_use=$use_[]$1
|
|
|
|
|
cairo_cv_backend_[]$1[]_cache_version=cairo_cache_version
|
|
|
|
|
cairo_cv_backend_[]$1[]_requires=$[]$1[]_REQUIRES
|
|
|
|
|
cairo_cv_backend_[]$1[]_cflags=$[]$1[]_CFLAGS
|
|
|
|
|
cairo_cv_backend_[]$1[]_libs=$[]$1[]_LIBS
|
|
|
|
|
cairo_cv_backend_[]$1[]_nonpkgconfig_cflags=$[]$1[]_NONPKGCONFIG_CFLAGS
|
|
|
|
|
cairo_cv_backend_[]$1[]_nonpkgconfig_libs=$[]$1[]_NONPKGCONFIG_LIBS
|
|
|
|
|
cairo_cv_backend_[]$1[]_base=$[]$1[]_BASE
|
|
|
|
|
AC_MSG_CHECKING([whether cairo's $2 backend could be enabled])])
|
|
|
|
|
|
|
|
|
|
use_[]$1=$cairo_cv_backend_[]$1[]_use
|
|
|
|
|
$1[]_BASE=$cairo_cv_backend_[]$1[]_base
|
|
|
|
|
|
|
|
|
|
$1[]_REQUIRES="$cairo_cv_backend_[]$1[]_requires "
|
|
|
|
|
$1[]_CFLAGS="$cairo_cv_backend_[]$1[]_cflags "
|
|
|
|
|
$1[]_LIBS="$cairo_cv_backend_[]$1[]_libs "
|
|
|
|
|
$1[]_NONPKGCONFIG_CFLAGS="$cairo_cv_backend_[]$1[]_nonpkgconfig_cflags "
|
|
|
|
|
$1[]_NONPKGCONFIG_LIBS="$cairo_cv_backend_[]$1[]_nonpkgconfig_libs "
|
|
|
|
|
|
|
|
|
|
# null the ones that only have space
|
|
|
|
|
test "x$$1[]_REQUIRES" = "x " && $1[]_REQUIRES=""
|
|
|
|
|
test "x$$1[]_CFLAGS" = "x " && $1[]_CFLAGS=""
|
|
|
|
|
test "x$$1[]_LIBS" = "x " && $1[]_LIBS=""
|
|
|
|
|
test "x$$1[]_NONPKGCONFIG_CFLAGS" = "x " && $1[]_NONPKGCONFIG_CFLAGS=""
|
|
|
|
|
test "x$$1[]_NONPKGCONFIG_LIBS" = "x " && $1[]_NONPKGCONFIG_LIBS=""
|
|
|
|
|
|
|
|
|
|
case $enable_[]$1 in
|
|
|
|
|
yes)
|
|
|
|
|
AS_IF([test "x$use_[]$1" = xyes],,[
|
|
|
|
|
AC_MSG_ERROR([requested $2 backend could not be enabled])
|
|
|
|
|
])
|
|
|
|
|
;;
|
|
|
|
|
auto)
|
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
AC_MSG_ERROR([invalid argument passed to --enable-$3: $use_$1, should be one of @<:@no/auto/yes@:>@])
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
if test "x$use_[]$1" = xyes; then
|
|
|
|
|
CAIRO_FEATURES="$4 $CAIRO_FEATURES"
|
|
|
|
|
CAIRO_REQUIRES="$$1_REQUIRES$CAIRO_REQUIRES"
|
|
|
|
|
CAIRO_CFLAGS="$$1_NONPKGCONFIG_CFLAGS$$1_CFLAGS$CAIRO_CFLAGS"
|
|
|
|
|
CAIRO_LIBS="$$1_NONPKGCONFIG_LIBS$$1_LIBS$CAIRO_LIBS"
|
|
|
|
|
CAIRO_NONPKGCONFIG_CFLAGS="$$1_NONPKGCONFIG_CFLAGS$CAIRO_NONPKGCONFIG_CFLAGS"
|
|
|
|
|
CAIRO_NONPKGCONFIG_LIBS="$$1_NONPKGCONFIG_LIBS$CAIRO_NONPKGCONFIG_LIBS"
|
|
|
|
|
m4_define([cairo_backend_pc], m4_bpatsubst(src/cairo-$1.pc,_,-))
|
|
|
|
|
AC_CONFIG_FILES(cairo_backend_pc():src/cairo-backend.pc.in,
|
|
|
|
|
[$SED -i -e "
|
|
|
|
|
s,@backend_name@,$1,g;
|
|
|
|
|
s,@Backend_Name@,$2,g;
|
|
|
|
|
s,@BACKEND_BASE@,$$1_BASE,g;
|
|
|
|
|
s,@BACKEND_REQUIRES@,$$1_REQUIRES,g;
|
|
|
|
|
s%@BACKEND_NONPKGCONFIG_LIBS@%$$1_NONPKGCONFIG_LIBS%g;
|
|
|
|
|
s,@BACKEND_NONPKGCONFIG_CFLAGS@,$$1_NONPKGCONFIG_CFLAGS,g;
|
|
|
|
|
" "]cairo_backend_pc()[" ||
|
|
|
|
|
AC_MSG_ERROR(failed to update ]cairo_backend_pc()[)
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
SED='$SED'
|
|
|
|
|
$1_BASE='$$1_BASE'
|
|
|
|
|
$1_REQUIRES='$$1_REQUIRES'
|
|
|
|
|
$1_NONPKGCONFIG_LIBS='$$1_NONPKGCONFIG_LIBS'
|
|
|
|
|
$1_NONPKGCONFIG_CFLAGS='$$1_NONPKGCONFIG_CFLAGS'
|
|
|
|
|
])
|
|
|
|
|
else
|
|
|
|
|
# Collect list of all supported but disabled features
|
|
|
|
|
AS_IF([test "x$5" = xno],,[
|
|
|
|
|
CAIRO_NO_FEATURES="$4 $CAIRO_NO_FEATURES"
|
|
|
|
|
])
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
AM_CONDITIONAL(CAIRO_HAS_$4, test "x$use_$1" = xyes)
|
|
|
|
|
# Collect list of all supported features and cairo headers
|
|
|
|
|
AS_IF([test "x$5" = xno],[
|
|
|
|
|
CAIRO_CONFIG_AMAKE=$CAIRO_CONFIG_AMAKE'
|
|
|
|
|
unsupported_cairo_headers += $(cairo_$1_headers)'
|
|
|
|
|
CAIRO_CONFIG_WIN32=$CAIRO_CONFIG_WIN32'
|
|
|
|
|
unsupported_cairo_headers += $(cairo_$1_headers)'
|
|
|
|
|
],[
|
|
|
|
|
CAIRO_SUPPORTED_FEATURES="$4 $CAIRO_SUPPORTED_FEATURES"
|
|
|
|
|
CAIRO_CONFIG_AMAKE=$CAIRO_CONFIG_AMAKE'
|
|
|
|
|
supported_cairo_headers += $(cairo_$1_headers)'
|
|
|
|
|
CAIRO_CONFIG_WIN32=$CAIRO_CONFIG_WIN32'
|
|
|
|
|
supported_cairo_headers += $(cairo_$1_headers)'
|
|
|
|
|
])
|
|
|
|
|
# Collect list of all/enabled cairo source files
|
|
|
|
|
CAIRO_CONFIG_AMAKE=$CAIRO_CONFIG_AMAKE'
|
|
|
|
|
all_cairo_pkgconf += $(cairo_$1_pkgconf)
|
|
|
|
|
all_cairo_headers += $(cairo_$1_headers)
|
|
|
|
|
all_cairo_private += $(cairo_$1_private)
|
|
|
|
|
all_cairo_sources += $(cairo_$1_sources)
|
|
|
|
|
if CAIRO_HAS_$4
|
|
|
|
|
enabled_cairo_pkgconf += $(cairo_$1_pkgconf)
|
|
|
|
|
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_pkgconf += $(cairo_$1_pkgconf)
|
|
|
|
|
all_cairo_headers += $(cairo_$1_headers)
|
|
|
|
|
all_cairo_private += $(cairo_$1_private)
|
|
|
|
|
all_cairo_sources += $(cairo_$1_sources)
|
|
|
|
|
ifeq ($(CAIRO_HAS_$4),1)
|
|
|
|
|
enabled_cairo_pkgconf += $(cairo_$1_pkgconf)
|
|
|
|
|
enabled_cairo_headers += $(cairo_$1_headers)
|
|
|
|
|
enabled_cairo_private += $(cairo_$1_private)
|
|
|
|
|
enabled_cairo_sources += $(cairo_$1_sources)
|
|
|
|
|
endif
|
|
|
|
|
'
|
|
|
|
|
# Collect warning message for enabled unsupported backends
|
|
|
|
|
AS_IF([test "x$use_[]$1" = xyes && test "x$5" = xno],[
|
|
|
|
|
CAIRO_WARNING_MESSAGE="$CAIRO_WARNING_MESSAGE
|
|
|
|
|
*** The $2 backend 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 $2-backend specific API.
|
|
|
|
|
"
|
|
|
|
|
],)
|
|
|
|
|
# Collect warning message for disabled recommended backends
|
|
|
|
|
AS_IF([test "x$use_[]$1" != xyes && test "x$5" = xyes],[
|
|
|
|
|
CAIRO_WARNING_MESSAGE="$CAIRO_WARNING_MESSAGE
|
|
|
|
|
*** It is strictly recommended that you do NOT disable
|
|
|
|
|
*** the $2 backend.
|
|
|
|
|
"
|
|
|
|
|
],)
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
CAIRO_WARNING_MESSAGE=""
|
|
|
|
|
CAIRO_FEATURES=""
|
|
|
|
|
CAIRO_NO_FEATURES=""
|
|
|
|
|
CAIRO_SUPPORTED_FEATURES=""
|
|
|
|
|
CAIRO_REQUIRES=""
|
|
|
|
|
CAIRO_NONPKGCONFIG_CFLAGS=""
|
|
|
|
|
CAIRO_NONPKGCONFIG_LIBS="$LIBM"
|
|
|
|
|
CAIRO_LDADD=""
|
|
|
|
|
CAIRO_CFLAGS=$CAIRO_NONPKGCONFIG_CFLAGS
|
|
|
|
|
CAIRO_LIBS=$CAIRO_NONPKGCONFIG_LIBS
|
|
|
|
|
CAIRO_CONFIG_AMAKE='# Generated by configure. Do not edit.
|
|
|
|
|
|
|
|
|
|
include $(top_srcdir)/src/Sources.mk
|
|
|
|
|
|
|
|
|
|
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 =
|
|
|
|
|
'
|
|
|
|
|
CAIRO_CONFIG_WIN32=$CAIRO_CONFIG_AMAKE'
|
|
|
|
|
enabled_cairo_headers += $(_cairo_nodist_headers) $(_cairo_extra_headers)
|
|
|
|
|
'
|
|
|
|
|
|
|
|
|
|
AC_SUBST(CAIRO_REQUIRES)
|
|
|
|
|
AC_SUBST(CAIRO_NONPKGCONFIG_CFLAGS)
|
|
|
|
|
AC_SUBST(CAIRO_NONPKGCONFIG_LIBS)
|
|
|
|
|
AC_SUBST(CAIRO_CFLAGS)
|
|
|
|
|
AC_SUBST(CAIRO_LDADD)
|
|
|
|
|
AC_SUBST(CAIRO_LIBS)
|
|
|
|
|
AC_SUBST(CAIROPERF_LIBS)
|
|
|
|
|
|
|
|
|
|
CAIRO_CONFIG_COMMANDS([$srcdir/src/Config.mk],
|
|
|
|
|
[echo "$CAIRO_CONFIG_AMAKE"],
|
|
|
|
|
[CAIRO_CONFIG_AMAKE='$CAIRO_CONFIG_AMAKE'])
|
|
|
|
|
CAIRO_CONFIG_COMMANDS([$srcdir/src/Config.mk.win32],
|
|
|
|
|
[echo "$CAIRO_CONFIG_WIN32"],
|
|
|
|
|
[CAIRO_CONFIG_WIN32='$CAIRO_CONFIG_WIN32'])
|
|
|
|
|
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
|
|
|
|
|
echo "#define CAIRO_HAS_$FEATURE 1"
|
|
|
|
|
done | LANG=C sort
|
|
|
|
|
echo ''
|
|
|
|
|
for FEATURE in $CAIRO_NO_FEATURES; do
|
|
|
|
|
echo "/*#undef CAIRO_HAS_$FEATURE */"
|
|
|
|
|
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
|
|
|
|
|
echo "#define CAIRO_HAS_$FEATURE 1"
|
|
|
|
|
done
|
|
|
|
|
echo ''
|
|
|
|
|
echo '#endif'
|
|
|
|
|
],[
|
|
|
|
|
CAIRO_SUPPORTED_FEATURES='$CAIRO_SUPPORTED_FEATURES'
|
|
|
|
|
])
|