[cairo] How to remove cairo's libstdc++ dependency?
Behdad Esfahbod
behdad at behdad.org
Sat Jul 25 16:26:10 PDT 2009
On 07/24/2009 12:24 AM, M Joonas Pihlaja wrote:
> Hi,
>
> Since including the Qt surface code into cairo master the autotools
> are convinced we need to be linked using a C++ compiler even if the Qt
> surface isn't enabled. This adds a dependency to libstdc++ to
> libcairo which to me at least is an unwelcome one. It looks like
> we've had this issue before as well with the BeOS backend, and in that
> case the (imho kludgy) solution was just to comment out the backend
> from the sources list.
>
> So I spent a while trying to understand why automake thinks we need a
> C++ compiler to link and got as far as becoming very confused about
> our build system. It appears to first think we're okay not to use C++
> compiler to link and then in a second phase of automagic it backs up
> and decides we need one after all. If anyone has any ideas on how to
> get around this issue beyond "go bug the automake people", please do
> tell. :)
I actually did bug automake people last year. Here's the excerpt:
=============================================
On Tue, 2008-04-15 at 20:09 +0200, Ralf Wildenhues wrote:
> Hi Behdad,
Hi Ralf,
Thanks for the quick response.
> * Behdad Esfahbod wrote on Tue, Apr 15, 2008 at 07:39:19PM CEST:
> > In short, all cairo source is C code, except for the BeOS backend that
> > is C++. So we have a block like this in our Makefile.am:
>
> > However, even if CAIRO_HAS_BEOS_SURFACE is false, the C++ linker is
> > chosen to link cairo. That we want to avoid. Any hints?
>
> You have to help automake pick the right linker, its linker choosing
> algorithm is blissfully unaware of conditionals. You should be able to
> set libcairo_la_LINK or cairo_LINK inside conditionals. Look in a
> Makefile.in how they are typically set (since this is an implementation
> detail, beware: this changed between 1.9.6 and 1.10+).
I would have been happy doing that if it was as simple as:
libcairo_la_LINK = $(LINK)
and
libcairo_la_LINK = $(CXXLINK)
But as it happens now I can't do that, since libcairo_la_LDFLAGS and
libcairo_la_CFLAGS need to go in the middle of the LINK command. It
prolly works if I append at the end, but don't want to change any flag
orders (yet).
> If that Makefile.am otherwise has no other C++ code, and you are not
> using cairo_LDFLAGS, you can just override
> CXXLINK = $(LINK)
I like this one.
> I guess.
Doesn't seem to work though. My libcairo_la_LINK is still a modified
version of the CXXLINK.
> Hope that helps.
It did. I fully understand the problem now.
> Of course somebody writing a patch to lift this
> limitation in Automake would help even more. ;-)
=============================================
behdad
> Joonas
More information about the cairo
mailing list