All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Tokarev <mjt@tls.msk.ru>
To: Ed Maste <emaste@freebsd.org>
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-trivial] [PATCH] configure: try pkg-config ncurses first
Date: Sat, 25 May 2013 08:25:08 +0400	[thread overview]
Message-ID: <51A03D24.5010306@msgid.tls.msk.ru> (raw)
In-Reply-To: <1369426020-39060-1-git-send-email-emaste@freebsd.org>

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



WARNING: multiple messages have this Message-ID (diff)
From: Michael Tokarev <mjt@tls.msk.ru>
To: Ed Maste <emaste@freebsd.org>
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-trivial] [PATCH] configure: try pkg-config ncurses first
Date: Sat, 25 May 2013 08:25:08 +0400	[thread overview]
Message-ID: <51A03D24.5010306@msgid.tls.msk.ru> (raw)
In-Reply-To: <1369426020-39060-1-git-send-email-emaste@freebsd.org>

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

  reply	other threads:[~2013-05-25  4:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-24 20:07 [Qemu-trivial] [PATCH] configure: try pkg-config ncurses first Ed Maste
2013-05-24 20:07 ` [Qemu-devel] " Ed Maste
2013-05-25  4:25 ` Michael Tokarev [this message]
2013-05-25  4:25   ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2013-05-25 11:30   ` [Qemu-trivial] [Qemu-devel] " Ed Maste
2013-05-25 11:30     ` [Qemu-devel] [Qemu-trivial] " Ed Maste
2013-05-25 11:38   ` [Qemu-trivial] [Qemu-devel] " Andreas Färber
2013-05-25 11:38     ` [Qemu-devel] [Qemu-trivial] " Andreas Färber
2013-05-25 11:58     ` [Qemu-trivial] [Qemu-devel] " Michael Tokarev
2013-05-25 11:58       ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2013-05-27 19:44 ` Michael Tokarev
2013-05-27 19:44   ` [Qemu-devel] " Michael Tokarev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51A03D24.5010306@msgid.tls.msk.ru \
    --to=mjt@tls.msk.ru \
    --cc=emaste@freebsd.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.