Am 25.05.2013 06:25, schrieb Michael Tokarev:
> 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.

I think the submitter wanted to assure that pkg-config --libs ncurses is
tried *before* falling back to -lcurses? (Rather than caring about the
order of -lncurses vs. pkg-config --libs ncurses.)

> 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.

$pkg_config should already contain --static for static builds, so I see
nothing wrong with this patch,

Reviewed-by: Andreas Färber <afaer...@suse.de>

but maybe I'm missing something?

One thing to note is that in an unfortunate layering violation unicore32
uses curses, so static libs and their potential need to link in
additional dependencies may be more than just a theoretical concern.

Regards,
Andreas

> 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
>>

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

Reply via email to