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. 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. 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. >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. Anyway, I don't see a reason to apply this as it is. Thanks, /mjt > > Signed-off-by: Ed Maste <ema...@freebsd.org> > --- > configure | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/configure b/configure > index cfdb564..7c99ef9 100755 > --- a/configure > +++ b/configure > @@ -2157,7 +2157,7 @@ fi > if test "$mingw32" = "yes" ; then > curses_list="-lpdcurses" > else > - curses_list="-lncurses:-lcurses:$($pkg_config --libs ncurses > 2>/dev/null)" > + curses_list="$($pkg_config --libs ncurses > 2>/dev/null):-lncurses:-lcurses" > fi > > if test "$curses" != "no" ; then >