Add support for always-builtin features in the build system

Like image surface and user fonts.
This commit is contained in:
Behdad Esfahbod 2008-09-10 23:23:08 -04:00
parent 4a01b1d9c9
commit 391bef58fc
5 changed files with 68 additions and 30 deletions

View file

@ -21,9 +21,10 @@ 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 backends, eg. your favorite new backend
dnl "yes" for mandatory backends, eg. png
dnl "auto" for other supported backends, eg. xlib
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
@ -56,13 +57,19 @@ AC_DEFUN([_CAIRO_ENABLE],
[no],,
[yes],,
[auto],,
[always],,
[m4_fatal([Invalid default value `]cr_feature_default[' for feature `]cr_feature['])]
)
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)
m4_if(cr_feature_default, [always],
[
enable_$1=yes
],[
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)
])
case $enable_$1 in
no)
use_$1="no (disabled, use --enable-cr_feature_arg to enable)"
@ -120,7 +127,12 @@ AC_DEFUN([_CAIRO_ENABLE],
AS_IF([test "x$enable_$1" = "xyes" -a "x$use_$1" != xyes],
[
AC_MSG_ERROR([requested ]cr_feature_name[ feature could not be enabled])
AC_MSG_ERROR(
m4_case(cr_feature_default,
[always], [mandatory],
[yes], [recommended],
, [requested]
) cr_feature_name[ feature could not be enabled])
])
;;
*)
@ -236,9 +248,10 @@ 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 "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
@ -487,8 +500,8 @@ CAIRO_FEATURE_VARS_REGISTER([REQUIRES BASE])
CAIRO_FEATURE_VARS_REGISTER([CFLAGS NONPKGCONFIG_CFLAGS])
CAIRO_FEATURE_VARS_REGISTER([LIBS NONPKGCONFIG_LIBS], [$LIBS])
dnl Generate .pc files for enabled public features
CAIRO_FEATURE_HOOK_REGISTER(yes,*,!,
dnl Generate .pc files for enabled non-builtin public features
CAIRO_FEATURE_HOOK_REGISTER(yes,!always,!,
[
AC_CONFIG_FILES(src/cr_feature_pc:src/cairo-features.pc.in,
[
@ -510,8 +523,8 @@ CAIRO_FEATURE_HOOK_REGISTER(yes,*,!,
])
])
dnl Generate -uninstalled.pc files for enabled public features
CAIRO_FEATURE_HOOK_REGISTER(yes,*,!,
dnl Generate -uninstalled.pc files for enabled non-builtin public features
CAIRO_FEATURE_HOOK_REGISTER(yes,!always,!,
[
AC_CONFIG_FILES(cr_feature_uninstalled_pc:src/cairo-features-uninstalled.pc.in,
[

View file

@ -57,7 +57,7 @@ CAIRO_ENABLE_SURFACE_BACKEND(xlib_xrender, Xlib Xrender, auto, [
CPPFLAGS="$CPPFLAGS $xlib_CFLAGS $xlib_NONPKGCONFIG_CFLAGS"
AC_CHECK_HEADER(X11/extensions/Xrender.h,
[xlib_xrender_NONPKGCONFIG_LIBS="-lXrender"],
[use_xlib_xrender="no (requires Xrender http://freedesktop.org/Software/xlibs)"])
[use_xlib_xrender="no (requires $xlib_xrender_REQUIRES http://freedesktop.org/Software/xlibs)"])
CPPFLAGS=$old_CPPFLAGS
])
fi
@ -68,17 +68,17 @@ dnl ===========================================================================
CAIRO_ENABLE_SURFACE_BACKEND(xcb, XCB, no, [
xcb_REQUIRES="xcb >= 0.9.92 xcb-render >= 0.9.92 xcb-renderutil"
PKG_CHECK_MODULES(xcb, $xcb_REQUIRES, , [AC_MSG_RESULT(no)
use_xcb="no (requires XCB http://xcb.freedesktop.org)"])
use_xcb="no (requires $xcb_REQUIRES http://xcb.freedesktop.org)"])
])
dnl ===========================================================================
CAIRO_ENABLE_SURFACE_BACKEND(quartz, Quartz, auto, [
dnl There is no pkgconfig for quartz; lets do a header check
AC_CHECK_HEADER(ApplicationServices/ApplicationServices.h, , [use_quartz="no (ApplicationServices framework not found)"])
AC_CHECK_HEADER(ApplicationServices/ApplicationServices.h, , [use_quartz="no (requires ApplicationServices framework)"])
if test "x$use_quartz" != "xyes" ; then
dnl check for CoreGraphics as a separate framework
AC_CHECK_HEADER(CoreGraphics/CoreGraphics.h, , [use_quartz="no (CoreGraphics framework not found)"])
AC_CHECK_HEADER(CoreGraphics/CoreGraphics.h, , [use_quartz="no (requires CoreGraphics framework)"])
quartz_LIBS="-Xlinker -framework -Xlinker CoreGraphics"
else
quartz_LIBS="-Xlinker -framework -Xlinker ApplicationServices"
@ -180,7 +180,7 @@ GLITZ_MIN_VERSION=0.5.1
CAIRO_ENABLE_SURFACE_BACKEND(glitz, glitz, no, [
glitz_REQUIRES="glitz >= $GLITZ_MIN_VERSION"
PKG_CHECK_MODULES(glitz, $glitz_REQUIRES, , [AC_MSG_RESULT(no)
use_glitz="no (requires glitz http://freedesktop.org/Software/glitz)"])
use_glitz="no (requires $glitz_REQUIRES http://freedesktop.org/Software/glitz)"])
])
if test "x$use_glitz" = "xyes";then
@ -217,7 +217,7 @@ dnl ===========================================================================
CAIRO_ENABLE_SURFACE_BACKEND(directfb, directfb, no, [
directfb_REQUIRES=directfb
PKG_CHECK_MODULES(directfb, $directfb_REQUIRES, , AC_MSG_RESULT(no)
[use_directfb="no (requires directfb http://www.directfb.org)"])
[use_directfb="no (requires $directfb_REQUIRES http://www.directfb.org)"])
])
dnl ===========================================================================
@ -245,7 +245,7 @@ FREETYPE_MIN_VERSION=9.7.3
CAIRO_ENABLE_FONT_BACKEND(ft, FreeType, auto, [
ft_REQUIRES="fontconfig"
PKG_CHECK_MODULES(FONTCONFIG, $ft_REQUIRES,,
[AC_MSG_RESULT(no); use_ft="no (requires fontconfig)"])
[AC_MSG_RESULT(no); use_ft="no (requires $ft_REQUIRES)"])
if test "x$use_ft" = "xyes"; then
@ -414,15 +414,15 @@ CAIRO_ENABLE(test_surfaces, test surfaces, no)
dnl ===========================================================================
PIXMAN_VERSION="0.11.2"
PIXMAN_REQUIRES="pixman-1 >= $PIXMAN_VERSION"
PKG_CHECK_MODULES(pixman, $PIXMAN_REQUIRES, ,
[AC_MSG_ERROR([pixman >= $PIXMAN_VERSION is required
(http://cairographics.org/releases/)])])
CAIRO_ENABLE_SURFACE_BACKEND(image, image, always, [
pixman_REQUIRES="pixman-1 >= 0.11.2"
PKG_CHECK_MODULES(pixman, $pixman_REQUIRES, , [AC_MSG_RESULT(no)
use_image="no (requires $pixman_REQUIRES http://cairographics.org/releases/)"])
])
CAIRO_REQUIRES="$PIXMAN_REQUIRES $CAIRO_REQUIRES"
CAIRO_CFLAGS="$pixman_CFLAGS $CAIRO_CFLAGS"
CAIRO_LIBS="$pixman_LIBS $CAIRO_LIBS"
dnl ===========================================================================
CAIRO_ENABLE_FONT_BACKEND(user, user, always)
dnl ===========================================================================
dnl Build the external converter if we have any of the test backends

View file

@ -34,6 +34,7 @@ cairo_quartz_font_face_create_for_atsu_font_id
<SECTION>
<FILE>cairo-user-fonts</FILE>
<TITLE>user-font</TITLE>
CAIRO_HAS_USER_FONT
cairo_user_scaled_font_init_func_t
cairo_user_scaled_font_render_glyph_func_t
cairo_user_scaled_font_text_to_glyphs_func_t
@ -52,6 +53,7 @@ cairo_user_font_face_get_text_to_glyphs_func
<SECTION>
<FILE>cairo-image</FILE>
<TITLE>image-surface</TITLE>
CAIRO_HAS_IMAGE_SURFACE
cairo_format_t
cairo_format_stride_for_width
cairo_image_surface_create

View file

@ -21,6 +21,17 @@ image formats are those defined in #cairo_format_t.
<!-- ##### SECTION Stability_Level ##### -->
<!-- ##### MACRO CAIRO_HAS_IMAGE_SURFACE ##### -->
<para>
Defined if the image surface backend is available.
The image surface backend is always built in.
This macro was added for completeness in cairo 1.8.
</para>
@Since: 1.8
<!-- ##### ENUM cairo_format_t ##### -->
<para>

View file

@ -22,6 +22,18 @@ other application to draw "funky" fonts.
<!-- ##### SECTION Stability_Level ##### -->
<!-- ##### MACRO CAIRO_HAS_USER_FONT ##### -->
<para>
Defined if the user font backend is available.
This macro can be used to conditionally compile backend-specific code.
The user font backend is always built in versions of cairo that support
this feature (1.8 and later).
</para>
@Since: 1.8
<!-- ##### USER_FUNCTION cairo_user_scaled_font_init_func_t ##### -->
<para>