[Cairo] Re: Patch for cairo --without-x

Carl Worth cworth at east.isi.edu
Wed Dec 3 06:58:51 PST 2003


On Dec 1, James Henstridge wrote:
 > 
 > If an app requires xlib support, is it really that much of a problem to 
 > check for a cairo-xlib.h header?  If using autoconf, it is only a single 
 > line in the configure.in file to perform such a check.

Actually, I was already planning on eliminating the cairo-xlib.h
header file. I think it will be much cleaner if the user only needs to
include cairo.h and then test macros for which backends are
available. I've already gone this direction with the PS backend --- we
still need to fold in the contents of cairo-xlib.h.

 > I would recommend putting definitions like CAIRO_SUPPORTS_X into a 
 > separate header file (cairo-config.h, maybe?), which could be generated 
 > in a manner similar to glib's glib-config.h (this is a bit cleaner than 
 > getting autoconf to expand substitutions in all headers).

That would probably be OK if it's just an implementation detail that
the user doesn't have to be too aware of. I can see how it might be
cleaner to have an almost-trivial configure-processed
cairo-config.h.in and a static cairo.h.

However, with the current plan of a single header file, we can install
cairo.h without a subdirectory in $prefix/include. I wouldn't want to
clutter that directory too much, nor would I want to move to
$prefix/include/cairo just for cairo-config.h.

Since there's only one header file, perhaps it just as clean to just
do expansion directly from cairo.h.in.

Finally, as for naming the macros, I'd like:

	CAIRO_HAS_FOO_BACKEND

which guards the prototypes for cairo_set_target_foo and
cairo_foo_surface_create.

I mentioned CAIRO_HAS_X_BACKEND before but that should really be
CAIRO_HAS_XLIB_BACKEND instead. And cairo_set_target_drawable should
also be renamed cairo_set_target_xlib.

 > I was actually thinking about using a CAIRO_HAS_X_BACKEND define for 
 > xlib specific stuff outside of cairo_xlib_surface.c (the makefile 
 > conditional would handle skipping cairo_xlib_surface.c).  If there isn't 
 > any such code, then you can ignore the above statement.

I would like the define to be available. There are functions in
cairo_xlib_surface.c right now that I would prefer to move to cairo.c,
(where they would need to be guarded by CAIRO_HAS_XLIB_BACKEND).

-Carl





More information about the cairo mailing list