Minor refinements, mostly to configure.in.

This commit is contained in:
Behdad Esfahbod 2006-06-21 07:00:34 -04:00
parent c88bab66ab
commit f71313d427
3 changed files with 65 additions and 52 deletions

View file

@ -87,30 +87,41 @@ PKG_PROG_PKG_CONFIG
dnl ===========================================================================
dnl
dnl Define a macro to enable backends.
dnl - Macro: CAIRO_BACKEND_ENABLE (ID, NAME, NAMESPACE, FEATURE, DEFAULT, REQUIRES, COMMANDS-TO-CHECK-IT)
dnl - Macro: CAIRO_BACKEND_ENABLE (NAMESPACE, NAME, ARG, FEATURE_NAME, DEFAULT, REQUIRES, COMMANDS)
dnl
dnl Where COMMANDS should set $use_ID to something other than yes if the
dnl backend cannot be built.
dnl where:
dnl
dnl Check the CAIRO_BACKEND_ENABLE line for fontconfig to understand each
dnl parameter.
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 REQUIRES is the list of pkg-config modules that should be Require'd in the
dnl backend-specific .pc file.
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)"
dnl
AC_DEFUN([CAIRO_BACKEND_ENABLE],
[AC_ARG_ENABLE([$1],
AS_HELP_STRING([--enable-$1=@<:@no/auto/yes@:>@],
[Enable cairo's $2 backend @<:@default=$3@:>@]),
[AC_ARG_ENABLE([$3],
AS_HELP_STRING([--enable-$3=@<:@no/auto/yes@:>@],
[Enable cairo's $2 backend @<:@default=$5@:>@]),
use_$1=$enableval, use_$1=$5)
if test "x$use_$1" = xno; then
use_$1="no (disabled, use --enable-$1 to enable)"
use_$1="no (disabled, use --enable-$3 to enable)"
else
AC_CACHE_CHECK([for cairo's $1 backend], cairo_cv_use_$1,
AC_CACHE_CHECK([for cairo's $2 backend], cairo_cv_use_$1,
[echo
saved_use_$1=$use_$1
use_$1=yes
$7
cairo_cv_use_$1=$use_$1
use_$1=$saved_use_$1
AC_MSG_CHECKING([whether cairo's $1 backend could be enabled])])
AC_MSG_CHECKING([whether cairo's $2 backend could be enabled])])
case $use_$1 in
yes)
if test "x$cairo_cv_use_$1" = xyes; then
@ -123,15 +134,16 @@ AC_DEFUN([CAIRO_BACKEND_ENABLE],
use_$1=$cairo_cv_use_$1
;;
*)
AC_MSG_ERROR([invalid argument passed to --enable-$1: $use_$1, should be one of @<:@no/auto/yes@:>@])
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="$CAIRO_FEATURES $4"
AC_MSG_NOTICE([creating src/cairo-$3.pc])
outfile=`echo src/cairo-$1.pc | sed -e s/_/-/g`
AC_MSG_NOTICE([creating $outfile])
mkdir -p src
AS_IF([sed \
-e "s/@backend_name@/$3/g" \
-e "s/@backend_name@/$1/g" \
-e "s/@Backend_Name@/$2/g" \
-e "s/@BACKEND_REQUIRES@/$6/g" \
-e "s,@prefix@,$prefix,g" \
@ -139,9 +151,9 @@ AC_DEFUN([CAIRO_BACKEND_ENABLE],
-e "s,@libdir@,$libdir,g" \
-e "s,@includedir@,$includedir,g" \
-e "s,@VERSION@,$VERSION,g" \
$srcdir/src/cairo-backend.pc.in > src/cairo-$3.pc],,[
rm -f "src/cairo-$3.pc"
AC_MSG_ERROR([failed creating src/cairo-$3.pc])
$srcdir/src/cairo-backend.pc.in > $outfile],,[
rm -f "$outfile"
AC_MSG_ERROR([failed creating $outfile])
])
fi
fi
@ -172,7 +184,7 @@ dnl ===========================================================================
CAIRO_BACKEND_ENABLE(quartz, Quartz, quartz, QUARTZ_SURFACE, no, [], [
dnl There is no pkgconfig for quartz; lets do a header check
AC_CHECK_HEADER(Carbon/Carbon.h, [use_quartz=yes], [use_quartz="no (Carbon headers not found)"])
AC_CHECK_HEADER(Carbon/Carbon.h, , [use_quartz="no (Carbon headers not found)"])
QUARTZ_LIBS="-Xlinker -framework -Xlinker Carbon"
])
@ -181,7 +193,7 @@ CAIRO_LIBS="$CAIRO_LIBS $QUARTZ_LIBS"
dnl ===========================================================================
CAIRO_BACKEND_ENABLE(xcb, XCB, xcb, XCB_SURFACE, no, [xcb xcb-render], [
PKG_CHECK_MODULES(XCB, xcb xcb-render, [use_xcb=yes], [
PKG_CHECK_MODULES(XCB, xcb xcb-render, , [
use_xcb="no (requires XCB http://xcb.freedesktop.org)"])
])
@ -203,10 +215,10 @@ esac
CAIRO_BACKEND_ENABLE(win32, Microsoft Windows, win32, WIN32_SURFACE, auto, [], [
case "$host" in
*-*-mingw*|*-*-cygwin*)
use_win32=yes
:
;;
*)
use_win32="no (the Microsoft Windows backend requires a Win32 platform)"
use_win32="no (requires a Win32 platform)"
;;
esac
])
@ -216,7 +228,7 @@ if test "x$use_win32" = "xyes"; then
CAIRO_LIBS="$CAIRO_LIBS -lgdi32 -lmsimg32"
fi
CAIRO_BACKEND_ENABLE(win32_font, Microsoft Windows Fonts, win32-font, WIN32_FONT, auto, [], [
CAIRO_BACKEND_ENABLE(win32_font, Microsoft Windows font, win32-font, WIN32_FONT, auto, [], [
use_win32_font=$use_win32
])
@ -227,10 +239,10 @@ dnl ===========================================================================
CAIRO_BACKEND_ENABLE(beos, BeOS/Zeta, beos, BEOS_SURFACE, no, [], [
case "$host" in
*-*-beos)
use_beos=yes
:
;;
*)
use_beos="no (the BeOS backend requires a BeOS platform)"
use_beos="no (requires a BeOS platform)"
;;
esac
])
@ -277,21 +289,21 @@ AC_SUBST(PNG_REQUIRES)
dnl ===========================================================================
GLITZ_MIN_VERSION=0.5.1
CAIRO_BACKEND_ENABLE(glitz, glitz, glitz, GLITZ_SURFACE, no, [glitz], [
PKG_CHECK_MODULES(GLITZ, glitz >= 0.5.1, [
GLITZ_REQUIRES=glitz
use_glitz=yes], [use_glitz="no (requires glitz http://freedesktop.org/Software/glitz)"])
PKG_CHECK_MODULES(GLITZ, glitz >= $GLITZ_MIN_VERSION, [
GLITZ_REQUIRES=glitz], [use_glitz="no (requires glitz http://freedesktop.org/Software/glitz)"])
])
if test "x$use_glitz" = "xyes";then
PKG_CHECK_MODULES(GLITZ_AGL, glitz-agl >= 0.5.1,
[have_glitz_agl=yes], [have_glitz_agl=no])
PKG_CHECK_MODULES(GLITZ_EGL, glitz-egl >= 0.5.1,
[have_glitz_egl=yes], [have_glitz_egl=no])
PKG_CHECK_MODULES(GLITZ_GLX, glitz-glx >= 0.5.1,
[have_glitz_glx=yes], [have_glitz_glx=no])
PKG_CHECK_MODULES(GLITZ_WGL, glitz-wgl >= 0.5.1,
[have_glitz_wgl=yes], [have_glitz_wgl=no])
PKG_CHECK_MODULES(GLITZ_AGL, glitz-agl >= $GLITZ_MIN_VERSION,
[have_glitz_agl=yes], [have_glitz_agl=no; echo $MYSTUFF_PKG_ERRORS])
PKG_CHECK_MODULES(GLITZ_EGL, glitz-egl >= $GLITZ_MIN_VERSION,
[have_glitz_egl=yes], [have_glitz_egl=no; echo $MYSTUFF_PKG_ERRORS])
PKG_CHECK_MODULES(GLITZ_GLX, glitz-glx >= $GLITZ_MIN_VERSION,
[have_glitz_glx=yes], [have_glitz_glx=no; echo $MYSTUFF_PKG_ERRORS])
PKG_CHECK_MODULES(GLITZ_WGL, glitz-wgl >= $GLITZ_MIN_VERSION,
[have_glitz_wgl=yes], [have_glitz_wgl=no; echo $MYSTUFF_PKG_ERRORS])
if test "x$have_glitz_agl" = "xyes";then
AC_DEFINE(CAIRO_CAN_TEST_GLITZ_AGL_SURFACE, 1, [define if glitz backend can be tested against agl])
@ -320,7 +332,7 @@ AC_SUBST(GLITZ_REQUIRES)
dnl ===========================================================================
CAIRO_BACKEND_ENABLE(directfb, directfb, directfb, DIRECTFB_SURFACE, no, [directfb], [
PKG_CHECK_MODULES(DIRECTFB, directfb, [use_directfb=yes], [
PKG_CHECK_MODULES(DIRECTFB, directfb, , [
use_directfb="no (requires directfb http://www.directfb.org)"])
])
@ -329,9 +341,8 @@ CAIRO_LIBS="$CAIRO_LIBS $DIRECTFB_LIBS"
dnl ===========================================================================
CAIRO_BACKEND_ENABLE(freetype, freetype font, ft, FT_FONT, auto, [freetype2 fontconfig], [
PKG_CHECK_MODULES(FONTCONFIG, fontconfig,
[use_freetype=yes], [use_freetype=no])
CAIRO_BACKEND_ENABLE(ft, FreeType font, freetype, FT_FONT, auto, [freetype2 fontconfig], [
PKG_CHECK_MODULES(FONTCONFIG, fontconfig, , [use_ft=no])
_CHECK_FUNCS_WITH_FLAGS(FcFini, $FONTCONFIG_CFLAGS, $FONTCONFIG_LIBS)
])
@ -344,7 +355,7 @@ CAIRO_LIBS="$CAIRO_LIBS $FONTCONFIG_LIBS"
# Requires.private, but at least up to 2003-06-07, there was no
# freetype2.pc in the release.
#
# Freetype versions come in three forms:
# FreeType versions come in three forms:
# release (such as 2.1.5)
# libtool (such as 9.4.3) (returned by freetype-config and pkg-config)
# platform-specific/soname (such as 6.3.4)
@ -358,7 +369,7 @@ FREETYPE_MIN_RELEASE=2.1.0
# libtool-specific version - this is what is checked
FREETYPE_MIN_VERSION=8.0.2
if test "x$use_freetype" = "xyes"; then
if test "x$use_ft" = "xyes"; then
PKG_CHECK_MODULES(FREETYPE, freetype2 >= $FREETYPE_MIN_VERSION,
[freetype_pkgconfig=yes], [freetype_pkgconfig=no])
@ -374,7 +385,7 @@ if test "x$use_freetype" = "xyes"; then
fi
if test "$FREETYPE_CONFIG" = "no" ; then
AC_MSG_WARN([No freetype-config script found in path or FREETYPE_CONFIG])
use_freetype=no
use_ft=no
else
AC_MSG_CHECKING(freetype2 libtool version)
@ -385,7 +396,7 @@ if test "x$use_freetype" = "xyes"; then
if test $VERSION_DEC -lt $MIN_VERSION_DEC; then
AC_MSG_RESULT($FREETYPE_VERSION - Too old)
AC_MSG_WARN([$FREETYPE_VERSION - version $FREETYPE_MIN_VERSION from release $FREETYPE_MIN_RELEASE required])
use_freetype=no
use_ft=no
else
AC_MSG_RESULT($FREETYPE_VERSION - OK)
@ -401,7 +412,7 @@ fi
have_ft_load_sfnt_table=no
if test "x$use_freetype" = "xyes"; then
if test "x$use_ft" = "xyes"; then
AC_SUBST(FREETYPE_CFLAGS)
AC_SUBST(FREETYPE_LIBS)
AC_SUBST(FREETYPE_CONFIG_CFLAGS)
@ -439,7 +450,7 @@ dnl ===========================================================================
CAIRO_BACKEND_ENABLE(ps, PostScript, ps, PS_SURFACE, auto, [], [
if test x"$have_ft_load_sfnt_table" != "xyes" ; then
use_ps="no (PS backend requires FreeType 2.1.4 or newer)"
use_ps="no (requires FreeType 2.1.4 or newer)"
fi
])
@ -461,7 +472,7 @@ dnl ===========================================================================
CAIRO_BACKEND_ENABLE(pdf, PDF, pdf, PDF_SURFACE, auto, [], [
if test x"$have_ft_load_sfnt_table" != "xyes" ; then
use_pdf="no (PDF backend requires FreeType 2.1.4 or newer)"
use_pdf="no (requires FreeType 2.1.4 or newer)"
fi
])
@ -490,7 +501,7 @@ dnl ===========================================================================
CAIRO_BACKEND_ENABLE(svg, SVG, svg, SVG_SURFACE, auto, [], [
if test x"$have_ft_load_sfnt_table" != "xyes" ; then
use_svg="no (SVG backend requires FreeType 2.1.4 or newer)"
use_svg="no (requires FreeType 2.1.4 or newer)"
fi
])
@ -512,9 +523,9 @@ dnl ===========================================================================
dnl This check should default to 'auto' once we have code to actually
dnl check for the atsui font backend.
CAIRO_BACKEND_ENABLE(atsui, atsui font, atsui, ATSUI_FONT, no, [], [
CAIRO_BACKEND_ENABLE(atsui, ATSUI font, atsui, ATSUI_FONT, no, [], [
dnl There is no pkgconfig for atsui; lets do a header check
AC_CHECK_HEADER(Carbon/Carbon.h, [use_atsui=yes], [use_atsui=no])
AC_CHECK_HEADER(Carbon/Carbon.h, , [use_atsui=no])
])
dnl ===========================================================================
@ -747,7 +758,7 @@ echo " BeOS: $use_beos"
echo " DirectFB: $use_directfb"
echo ""
echo "the following font backends:"
echo " FreeType: $use_freetype"
echo " FreeType: $use_ft"
echo " Win32: $use_win32_font"
echo " ATSUI: $use_atsui"
echo ""
@ -762,7 +773,7 @@ echo "using CFLAGS:"
echo $CAIRO_CFLAGS
echo ""
if test x"$use_freetype" != "xyes" && \
if test x"$use_ft" != "xyes" && \
test x"$use_win32_font" != "xyes" && \
test x"$use_atsui" != "xyes" ; then

1
test/.gitignore vendored
View file

@ -2,6 +2,7 @@
.libs
Makefile
Makefile.in
index.html
a8-mask
bitmap-font
caps-joins

View file

@ -372,7 +372,8 @@ CLEANFILES = \
pdf-features.pdf \
ps-features.ps \
svg-surface.svg \
svg-clip.svg
svg-clip.svg \
index.html
check-valgrind:
TESTS_ENVIRONMENT="libtool --mode=execute valgrind --tool=memcheck --suppressions=./.valgrind-suppressions --leak-check=yes --show-reachable=yes" $(MAKE) check 2>&1 | tee valgrind.log