All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] use ncurses-config to find all curses related libs
@ 2011-11-22 11:35 Olaf Hering
  2011-11-24 18:38 ` Ian Jackson
  2011-11-29 12:50 ` [PATCH v2] " Olaf Hering
  0 siblings, 2 replies; 8+ messages in thread
From: Olaf Hering @ 2011-11-22 11:35 UTC (permalink / raw)
  To: xen-devel

After a split of libtinfo from libncurses in openSuSE Factory the tools
will not link anymore. In the URL below it was suggested to use
'ncurses-config --libs' to find the correct linker options. But
ncurses-config does not exist neither in SLES11 nor in openSuSE. So
check for both ncurses5-config and ncurses-config, if the latter happens
to exist in other environments.

With this change xen-unstable tools build succeeds again in SLES11 and
the latest openSuSE development branch.

http://lists.opensuse.org/opensuse-packaging/2011-11/msg00055.html

Signed-off-by: Olaf Hering <olaf@aepfle.de>

diff -r 0b1ac7b3ee4d config/StdGNU.mk
--- a/config/StdGNU.mk
+++ b/config/StdGNU.mk
@@ -67,7 +67,7 @@ XEN_CONFIG_DIR = $(CONFIG_DIR)/xen
 XEN_SCRIPT_DIR = $(XEN_CONFIG_DIR)/scripts
 
 SOCKET_LIBS =
-CURSES_LIBS = -lncurses
+CURSES_LIBS = $(shell if ! ncurses5-config --libs 2>/dev/null ; then ncurses-config --libs ; fi)
 PTHREAD_LIBS = -lpthread
 UTIL_LIBS = -lutil
 DLOPEN_LIBS = -ldl

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] use ncurses-config to find all curses related libs
  2011-11-22 11:35 [PATCH] use ncurses-config to find all curses related libs Olaf Hering
@ 2011-11-24 18:38 ` Ian Jackson
  2011-11-24 18:49   ` Olaf Hering
  2011-11-29 12:50 ` [PATCH v2] " Olaf Hering
  1 sibling, 1 reply; 8+ messages in thread
From: Ian Jackson @ 2011-11-24 18:38 UTC (permalink / raw)
  To: Olaf Hering; +Cc: xen-devel

Olaf Hering writes ("[Xen-devel] [PATCH] use ncurses-config to find all curses related libs"):
> After a split of libtinfo from libncurses in openSuSE Factory the tools
> will not link anymore. In the URL below it was suggested to use
> 'ncurses-config --libs' to find the correct linker options. But
> ncurses-config does not exist neither in SLES11 nor in openSuSE. So
> check for both ncurses5-config and ncurses-config, if the latter happens
> to exist in other environments.
> 
> With this change xen-unstable tools build succeeds again in SLES11 and
> the latest openSuSE development branch.

Thanks.  However:

> -CURSES_LIBS = -lncurses
> +CURSES_LIBS = $(shell if ! ncurses5-config --libs 2>/dev/null ; then ncurses-config --libs ; fi)

In the case where ncurses5-config is not provided, this will fail.

Ian.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] use ncurses-config to find all curses related libs
  2011-11-24 18:38 ` Ian Jackson
@ 2011-11-24 18:49   ` Olaf Hering
  2011-11-24 18:53     ` Ian Jackson
  0 siblings, 1 reply; 8+ messages in thread
From: Olaf Hering @ 2011-11-24 18:49 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel

On Thu, Nov 24, Ian Jackson wrote:

> Olaf Hering writes ("[Xen-devel] [PATCH] use ncurses-config to find all curses related libs"):
> > -CURSES_LIBS = -lncurses
> > +CURSES_LIBS = $(shell if ! ncurses5-config --libs 2>/dev/null ; then ncurses-config --libs ; fi)
> 
> In the case where ncurses5-config is not provided, this will fail.

It seems to work for me, with this example foo is printed:

if ! ABC 2>/dev/null ; then echo foo ; fi

Olaf

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] use ncurses-config to find all curses related libs
  2011-11-24 18:49   ` Olaf Hering
@ 2011-11-24 18:53     ` Ian Jackson
  2011-11-24 19:15       ` Olaf Hering
  0 siblings, 1 reply; 8+ messages in thread
From: Ian Jackson @ 2011-11-24 18:53 UTC (permalink / raw)
  To: Olaf Hering; +Cc: xen-devel@lists.xensource.com

Olaf Hering writes ("Re: [Xen-devel] [PATCH] use ncurses-config to find all curses related libs"):
> On Thu, Nov 24, Ian Jackson wrote:
> > Olaf Hering writes ("[Xen-devel] [PATCH] use ncurses-config to find all curses related libs"):
> > > -CURSES_LIBS = -lncurses
> > > +CURSES_LIBS = $(shell if ! ncurses5-config --libs 2>/dev/null ; then ncurses-config --libs ; fi)
> > 
> > In the case where ncurses5-config is not provided, this will fail.

Sorry, I wasn't sufficiently clear.  The case that fails is if neither
ncurses5-config nor ncurses-config is provided.  The default should be
to use -lncurses as before.

> It seems to work for me, with this example foo is printed:
> 
> if ! ABC 2>/dev/null ; then echo foo ; fi

Yes, but it won't include -lncurses in CURSES_LIBS.

Ian.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] use ncurses-config to find all curses related libs
  2011-11-24 18:53     ` Ian Jackson
@ 2011-11-24 19:15       ` Olaf Hering
  2011-11-24 19:20         ` Ian Jackson
  0 siblings, 1 reply; 8+ messages in thread
From: Olaf Hering @ 2011-11-24 19:15 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel@lists.xensource.com

On Thu, Nov 24, Ian Jackson wrote:

> Olaf Hering writes ("Re: [Xen-devel] [PATCH] use ncurses-config to find all curses related libs"):
> > On Thu, Nov 24, Ian Jackson wrote:
> > > Olaf Hering writes ("[Xen-devel] [PATCH] use ncurses-config to find all curses related libs"):
> > > > -CURSES_LIBS = -lncurses
> > > > +CURSES_LIBS = $(shell if ! ncurses5-config --libs 2>/dev/null ; then ncurses-config --libs ; fi)
> > > 
> > > In the case where ncurses5-config is not provided, this will fail.
> 
> Sorry, I wasn't sufficiently clear.  The case that fails is if neither
> ncurses5-config nor ncurses-config is provided.  The default should be
> to use -lncurses as before.

I see. Another if construct, or a check_ncurses script which looks for
ncurses5-config or ncurses-config. After some digging in old SuSE
releases, ncurses5-config appeared in 11.0 (2008), SLES10 does not have
it yes . So blindly relying on -config scripts will likely break
building on old distributions.

This should work:

if ! ncurses5-config --libs 2>/dev/null;then if ! ncurses-config --libs ; then echo '-lncurses' ; fi ; fi

Olaf

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] use ncurses-config to find all curses related libs
  2011-11-24 19:15       ` Olaf Hering
@ 2011-11-24 19:20         ` Ian Jackson
  2011-11-24 19:37           ` Olaf Hering
  0 siblings, 1 reply; 8+ messages in thread
From: Ian Jackson @ 2011-11-24 19:20 UTC (permalink / raw)
  To: Olaf Hering; +Cc: xen-devel@lists.xensource.com, Ian Jackson

Olaf Hering writes ("Re: [Xen-devel] [PATCH] use ncurses-config to find all curses related libs"):
> This should work:
> 
> if ! ncurses5-config --libs 2>/dev/null;then if ! ncurses-config --libs ; then echo '-lncurses' ; fi ; fi

That's an improvement, but it reruns the shell rune for every time
CURSES_LIBS is expanded.

Ian.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] use ncurses-config to find all curses related libs
  2011-11-24 19:20         ` Ian Jackson
@ 2011-11-24 19:37           ` Olaf Hering
  0 siblings, 0 replies; 8+ messages in thread
From: Olaf Hering @ 2011-11-24 19:37 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel@lists.xensource.com

On Thu, Nov 24, Ian Jackson wrote:

> Olaf Hering writes ("Re: [Xen-devel] [PATCH] use ncurses-config to find all curses related libs"):
> > This should work:
> > 
> > if ! ncurses5-config --libs 2>/dev/null;then if ! ncurses-config --libs ; then echo '-lncurses' ; fi ; fi
> 
> That's an improvement, but it reruns the shell rune for every time
> CURSES_LIBS is expanded.

Right. I remember there are ways to assign a variable only once, I will
check the make documentation.

Olaf

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2] use ncurses-config to find all curses related libs
  2011-11-22 11:35 [PATCH] use ncurses-config to find all curses related libs Olaf Hering
  2011-11-24 18:38 ` Ian Jackson
@ 2011-11-29 12:50 ` Olaf Hering
  1 sibling, 0 replies; 8+ messages in thread
From: Olaf Hering @ 2011-11-29 12:50 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

After a split of libtinfo from libncurses in openSuSE Factory the tools
will not link anymore. In the URL below it was suggested to use
'ncurses-config --libs' to find the correct linker options. But
ncurses-config does not exist neither in SLES11 nor in openSuSE. So
check for both ncurses5-config and ncurses-config, if the latter happens
to exist in other environments.

With this change xen-unstable tools build succeeds again in SLES11 and
the latest openSuSE development branch.

http://lists.opensuse.org/opensuse-packaging/2011-11/msg00055.html

Signed-off-by: Olaf Hering <olaf@aepfle.de>

diff -r 4319d77f5b3b config/StdGNU.mk
--- a/config/StdGNU.mk
+++ b/config/StdGNU.mk
@@ -67,7 +67,7 @@ XEN_CONFIG_DIR = $(CONFIG_DIR)/xen
 XEN_SCRIPT_DIR = $(XEN_CONFIG_DIR)/scripts
 
 SOCKET_LIBS =
-CURSES_LIBS = -lncurses
+CURSES_LIBS ?= $(shell if ! ncurses5-config --libs 2>/dev/null;then if ! ncurses-config --libs 2>/dev/null;then echo -lncurses;fi;fi)
 PTHREAD_LIBS = -lpthread
 UTIL_LIBS = -lutil
 DLOPEN_LIBS = -ldl

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-11-29 12:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-22 11:35 [PATCH] use ncurses-config to find all curses related libs Olaf Hering
2011-11-24 18:38 ` Ian Jackson
2011-11-24 18:49   ` Olaf Hering
2011-11-24 18:53     ` Ian Jackson
2011-11-24 19:15       ` Olaf Hering
2011-11-24 19:20         ` Ian Jackson
2011-11-24 19:37           ` Olaf Hering
2011-11-29 12:50 ` [PATCH v2] " Olaf Hering

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.