[Cairo] Re: Patch for cairo --without-x
James Henstridge
james at daa.com.au
Sun Nov 30 22:09:34 PST 2003
On 29/11/2003 7:04 AM, Sasha Vasko wrote:
>
>
> James Henstridge wrote:
>
>> If we decide to require automake >= 1.7 to build Cairo from CVS
>> (which I highly recommend), then it should be pretty easy to
>> conditionally install the cairo-xlib.h with syntax like this:
>>
> <snip>
>
>> This is easy to read, and should work okay. I would think absense of
>> a header is a better indication that the feature isn't available,
>> compared to having a present but effectively empty header installed
>> on the system
>
>
> Conditional installation of headers is evil, as it requires apps to
> check not only for cairo, but also for its individual headers, while
> configuring self. Also it makes impossible explicit include of it in
> main header cairo.h.
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.
If you want to automatically include cairo-xlib.h when appropriate, it
would be just as easy to do:
#ifdef CAIRO_SUPPORTS_X
# include <cairo-xlib.h>
#endif
If xlib support isn't available, it won't try to include the header.
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).
>> (would we install a cairo-win32.h header on unix systems in the future?)
>
>
> Well yeah, from this perspective better solution would be to rename
> header to something like cairo-interfaces.h, and have all the
> optional stuff in this single header.
I would expect that the xlib and win32 specific functions would be quite
different. One is going to be dealing with X drawables, etc while the
other will be dealing with the Windows equivalents.
>> For conditional compilation of the actual Cairo code, it would be
>> better to do it the normal way. That is, just use an AC_DEFINE()
>> statement in the configure script to define CAIRO_HAS_X_BACKEND. If
>> config.h is
>
> That was the way I did it at first, but as Carl noted that forces
> compilation of effectively empty file, which makes conditional
> compilation a preffered method.
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.
James.
--
Email: james at daa.com.au
WWW: http://www.daa.com.au/~james/
More information about the cairo
mailing list