[cairo-commit] 5 commits - build/configure.ac.enable configure.ac doc/public .gitignore src/cairo-features-uninstalled.pc.in src/cairo-uninstalled.pc.in

Behdad Esfahbod behdad at kemper.freedesktop.org
Wed Sep 10 21:38:42 PDT 2008


 .gitignore                            |    1 
 build/configure.ac.enable             |  103 ++++++++++++++++++++++++++--------
 configure.ac                          |   30 ++++-----
 doc/public/Makefile.am                |    2 
 doc/public/cairo-sections.txt         |    2 
 doc/public/tmpl/cairo-image.sgml      |   11 +++
 doc/public/tmpl/cairo-user-fonts.sgml |   12 +++
 src/cairo-features-uninstalled.pc.in  |    7 ++
 src/cairo-uninstalled.pc.in           |    8 ++
 9 files changed, 138 insertions(+), 38 deletions(-)

New commits:
commit 391bef58fcb301014adc8b06db7265c5c9b3bee3
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Sep 10 23:23:08 2008 -0400

    Add support for always-builtin features in the build system
    
    Like image surface and user fonts.

diff --git a/build/configure.ac.enable b/build/configure.ac.enable
index 71e887b..3c1dae6 100644
--- a/build/configure.ac.enable
+++ b/build/configure.ac.enable
@@ -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,
 	[
diff --git a/configure.ac b/configure.ac
index b11f78c..67e2a98 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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/)"])
+])
+
+dnl ===========================================================================
 
-CAIRO_REQUIRES="$PIXMAN_REQUIRES $CAIRO_REQUIRES"
-CAIRO_CFLAGS="$pixman_CFLAGS $CAIRO_CFLAGS"
-CAIRO_LIBS="$pixman_LIBS $CAIRO_LIBS"
+CAIRO_ENABLE_FONT_BACKEND(user, user, always)
 
 dnl ===========================================================================
 dnl Build the external converter if we have any of the test backends
diff --git a/doc/public/cairo-sections.txt b/doc/public/cairo-sections.txt
index b2bb1f1..160de46 100644
--- a/doc/public/cairo-sections.txt
+++ b/doc/public/cairo-sections.txt
@@ -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
diff --git a/doc/public/tmpl/cairo-image.sgml b/doc/public/tmpl/cairo-image.sgml
index c15cc66..6ac615b 100644
--- a/doc/public/tmpl/cairo-image.sgml
+++ b/doc/public/tmpl/cairo-image.sgml
@@ -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>
+
+ at Since: 1.8
+
+
+
 <!-- ##### ENUM cairo_format_t ##### -->
 <para>
 
diff --git a/doc/public/tmpl/cairo-user-fonts.sgml b/doc/public/tmpl/cairo-user-fonts.sgml
index c1cf8c4..14b3257 100644
--- a/doc/public/tmpl/cairo-user-fonts.sgml
+++ b/doc/public/tmpl/cairo-user-fonts.sgml
@@ -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>
+
+ at Since: 1.8
+
+
+
 <!-- ##### USER_FUNCTION cairo_user_scaled_font_init_func_t ##### -->
 <para>
 
commit 4a01b1d9c94beb4b3df9d4c7c8d7411c6afa1034
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Sep 10 21:36:27 2008 -0400

    Build -uninstalled.pc files

diff --git a/.gitignore b/.gitignore
index b240109..09cd963 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,3 +26,4 @@ stamp-h.in
 *.lo
 *.orig
 *.rej
+*-uninstalled.pc
diff --git a/build/configure.ac.enable b/build/configure.ac.enable
index 5791bad..71e887b 100644
--- a/build/configure.ac.enable
+++ b/build/configure.ac.enable
@@ -326,12 +326,14 @@ m4_pattern_allow(^CAIRO_HAS_)
 
 
 dnl
-dnl Define cr_feature_pc_modname and cr_feature_pc ala other cr_feature_* macros
+dnl Define cr_feature_pc and friends ala other cr_feature_* macros
 dnl
 m4_define([cr_feature_pc_modname],
 	[[cairo-]m4_translit(cr_feature,_,-)])
 m4_define([cr_feature_pc],
 	[cr_feature_pc_modname[.pc]])
+m4_define([cr_feature_uninstalled_pc],
+	[cr_feature_pc_modname[-uninstalled.pc]])
 
 
 dnl ===========================================================================
@@ -478,6 +480,7 @@ dnl
 
 dnl All .pc files are generated automatically except for this one
 AC_CONFIG_FILES([src/cairo.pc])
+AC_CONFIG_FILES([cairo-uninstalled.pc:src/cairo-uninstalled.pc.in])
 
 dnl pkg-config requires, non-pkgconfig cflags and libs, and total cflags and libs
 CAIRO_FEATURE_VARS_REGISTER([REQUIRES BASE])
@@ -507,6 +510,29 @@ CAIRO_FEATURE_HOOK_REGISTER(yes,*,!,
 	])
 ])
 
+dnl Generate -uninstalled.pc files for enabled public features
+CAIRO_FEATURE_HOOK_REGISTER(yes,*,!,
+[
+	AC_CONFIG_FILES(cr_feature_uninstalled_pc:src/cairo-features-uninstalled.pc.in,
+	[
+		$SED -i -e "
+		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;
+		" "]src/cr_feature_pc[" ||
+		AC_MSG_ERROR(failed to update ]src/cr_feature_pc[)
+	],[
+		SED='$SED'
+		$1_BASE='$$1_BASE'
+		$1_REQUIRES='$$1_REQUIRES'
+		$1_NONPKGCONFIG_LIBS='$$1_NONPKGCONFIG_LIBS'
+		$1_NONPKGCONFIG_CFLAGS='$$1_NONPKGCONFIG_CFLAGS'
+	])
+])
+
 
 dnl ===========================================================================
 dnl
diff --git a/src/cairo-features-uninstalled.pc.in b/src/cairo-features-uninstalled.pc.in
new file mode 100644
index 0000000..cc05247
--- /dev/null
+++ b/src/cairo-features-uninstalled.pc.in
@@ -0,0 +1,7 @@
+Name: @FEATURE_PC@
+Description: @FEATURE_NAME@ for cairo graphics library
+Version: @VERSION@
+
+Requires: @FEATURE_BASE@ @FEATURE_REQUIRES@
+Libs: @FEATURE_NONPKGCONFIG_LIBS@
+Cflags: -I${pc_top_builddir}/${pcfiledir}/@srcdir@/src @FEATURE_NONPKGCONFIG_CFLAGS@
diff --git a/src/cairo-uninstalled.pc.in b/src/cairo-uninstalled.pc.in
new file mode 100644
index 0000000..9dc3231
--- /dev/null
+++ b/src/cairo-uninstalled.pc.in
@@ -0,0 +1,8 @@
+Name: cairo
+Description: Multi-platform 2D graphics library
+Version: @VERSION@
+
+ at PKGCONFIG_REQUIRES@: @CAIRO_REQUIRES@
+Libs: ${pc_top_builddir}/${pcfiledir}/src/libcairo.la
+Libs.private: @CAIRO_NONPKGCONFIG_LIBS@
+Cflags: -I${pc_top_builddir}/${pcfiledir}/@srcdir@/src
commit a18c75c3e9a63dc23aaad0faf2e963973a306d65
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Sep 10 21:24:50 2008 -0400

    [configure.ac.enable] More fixes for private features
    
    Don't expect pkgconfig files for them.  Also, don't give them a chance
    to install public headers.

diff --git a/build/configure.ac.enable b/build/configure.ac.enable
index 2dfc0a0..5791bad 100644
--- a/build/configure.ac.enable
+++ b/build/configure.ac.enable
@@ -407,22 +407,22 @@ CAIRO_CONFIG_COMMANDS([$srcdir/src/Makefile.win32.config],
 		      [echo "$CAIRO_CONFIG_WIN32"],
 		      [CAIRO_CONFIG_WIN32='$CAIRO_CONFIG_WIN32'])
 
-dnl Collect list of all supported cairo headers
-CAIRO_FEATURE_HOOK_REGISTER(*,!no,*,
+dnl Collect list of all supported public cairo headers
+CAIRO_FEATURE_HOOK_REGISTER(*,!no,!,
 [
 	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
-CAIRO_FEATURE_HOOK_REGISTER(*,no,*,
+dnl Collect list of all unsupported public cairo headers
+CAIRO_FEATURE_HOOK_REGISTER(*,no,!,
 [
 	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
-CAIRO_FEATURE_HOOK_REGISTER(*,*,*,
+dnl Collect list of source files for all/enabled public features
+CAIRO_FEATURE_HOOK_REGISTER(*,*,!,
 [
 	CAIRO_CONFIG_AMAKE=$CAIRO_CONFIG_AMAKE'
 all_cairo_pkgconf += cr_feature_pc
@@ -448,6 +448,28 @@ endif
 '
 ])
 
+dnl Collect list of source files for all/enabled private features
+CAIRO_FEATURE_HOOK_REGISTER(*,*,,
+[
+	dnl No public headers for private features
+	CAIRO_CONFIG_AMAKE=$CAIRO_CONFIG_AMAKE'
+all_cairo_private += $(cairo_$1_private) $(cairo_$1_headers)
+all_cairo_sources += $(cairo_$1_sources)
+if cr_feature_tag
+enabled_cairo_private += $(cairo_$1_private) $(cairo_$1_headers)
+enabled_cairo_sources += $(cairo_$1_sources)
+endif
+'
+	CAIRO_CONFIG_WIN32=$CAIRO_CONFIG_WIN32'
+all_cairo_private += $(cairo_$1_private) $(cairo_$1_headers)
+all_cairo_sources += $(cairo_$1_sources)
+ifeq ($(cr_feature_tag),1)
+enabled_cairo_private += $(cairo_$1_private) $(cairo_$1_headers)
+enabled_cairo_sources += $(cairo_$1_sources)
+endif
+'
+])
+
 
 dnl ===========================================================================
 dnl
commit 771ff1a06e93255cd0015c59f5e4f33c25490546
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Sep 10 21:21:58 2008 -0400

    [configure.ac.enable] Don't collect .pc files in win32 Makefile
    
    We only generate them using autotools.  No point.

diff --git a/build/configure.ac.enable b/build/configure.ac.enable
index d3e53c1..2dfc0a0 100644
--- a/build/configure.ac.enable
+++ b/build/configure.ac.enable
@@ -437,12 +437,10 @@ enabled_cairo_sources += $(cairo_$1_sources)
 endif
 '
 	CAIRO_CONFIG_WIN32=$CAIRO_CONFIG_WIN32'
-all_cairo_pkgconf += cr_feature_pc
 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_pkgconf += cr_feature_pc
 enabled_cairo_headers += $(cairo_$1_headers)
 enabled_cairo_private += $(cairo_$1_private)
 enabled_cairo_sources += $(cairo_$1_sources)
commit c73f58e3a7a83faa687a148d2363979f3e7d001f
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Sep 10 21:19:25 2008 -0400

    [doc] Don't include *.h as sources
    
    No idea why this was done initially but other projects I checked did not
    do it.

diff --git a/doc/public/Makefile.am b/doc/public/Makefile.am
index b1d113c..6446739 100644
--- a/doc/public/Makefile.am
+++ b/doc/public/Makefile.am
@@ -14,7 +14,7 @@ DOC_SOURCE_DIR=../../src
 
 # Used for dependencies
 HFILE_GLOB=$(top_srcdir)/src/cairo-*.h
-CFILE_GLOB=$(top_srcdir)/src/cairo-*.c $(top_srcdir)/src/cairo-*.h
+CFILE_GLOB=$(top_srcdir)/src/cairo-*.c
 
 include $(top_srcdir)/src/Makefile.am.config
 


More information about the cairo-commit mailing list