[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [Qemu-trivial] [PATCH] configure: try pkg-config ncurse

From: Ed Maste
Subject: Re: [Qemu-devel] [Qemu-trivial] [PATCH] configure: try pkg-config ncurses first
Date: Sat, 25 May 2013 07:30:14 -0400

On 25 May 2013 00:25, Michael Tokarev <address@hidden> wrote:
> 25.05.2013 00:07, Ed Maste wrote:
>> When probing for ncurses, try pkg-config first rather than after
>> explicit -lncurses and -lcurses.  This fixes static linking in the case
>> that ncurses has additional dependencies, such as -ltinfo (as on FreeBSD).
> This is not a FreeBSD-specific thing, this is the way how current
> ncurses works -- they separated a bunch of functions into a new
> library, libtinfo.

Right, I don't mean to apply it was FreeBSD-specific.

Presumably QEMU builds with --static on at least some Linux distros,
so I assumed they must not have the external libtinfo dep for static
linking (because they build libncurses.a with it built-in, say).

> But this is interesting.
> I'm not sure I agree with this approach.  When we're building using
> shared library, libncurses.so already links with libtinfo.so, so we
> don't need to link executable itself with libtinfo.so, since executable
> itself uses none of its functions.

Right, and pkg-config doesn't include -ltinfo when using dynamic linking.

> On the other hand, the current logic appears to be fine, -- we first
> link with just -lncurses, and if that fails, we also try pkg-config --libs --
> because, maybe, we're linking statically and in that case, additional
> libs from pkg-config may help.

Except that the test snippet in configure will successfully link
statically without -ltinfo, so configure doesn't make it to the
pkg-config test.

> From yet another point of view, we may use --as-needed linker flag
> and just ignore all the above.
> Here, it is interesting to note that pkg-config does not actually do
> the right thing in this case.  Because practically, it should have
> one extra flag, something like --static-libs (or --libs --static),
> and it should actually be different from plain --libs.

In fact, it does:

feynman% pkg-config --libs ncurses
-L/usr/local/lib -lncurses
feynman% pkg-config --static --libs ncurses
-L/usr/local/lib -lncurses -ltinfo

and the configure script adds --static to QEMU_PKG_CONFIG_FLAGS when necessary.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]