public inbox for crossgcc@sourceware.org
 help / color / mirror / Atom feed
* crosstool-ng libncurses check in configure
@ 2009-05-10 14:31 Joachim Nilsson
  2009-05-11 17:03 ` Yann E. MORIN
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Joachim Nilsson @ 2009-05-10 14:31 UTC (permalink / raw)
  To: crossgcc

Hi!

I run Ubuntu, a Debian GNU/Linux derivative.  Debian has a policy about /bin/sh scripts that basically states that any such script be POSIX compatible.  To further complicate matters /bin/sh is by default /bin/dash (Debian Almquist SHell) and it is rather picky about its syntax.

With the new, very neat, configure check for libncurses the configure script no longer runs on Debian or Ubuntu default installations.  It seems to boil down to the use of variable expansion in the following line:

	lib="$( echo lib{ncursesw,ncurses,curses}.{so,a,dylib} )"

Is it possible we could change the configure script to use /bin/bash instead of /bin/sh?  I think that solution would be the best in the long run.

Regards
 /Joachim

--
For unsubscribe information see http://sourceware.org/lists.html#faq

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

* Re: crosstool-ng libncurses check in configure
  2009-05-10 14:31 crosstool-ng libncurses check in configure Joachim Nilsson
@ 2009-05-11 17:03 ` Yann E. MORIN
  2009-05-11 17:27   ` Michael Abbott
  2009-05-11 20:48 ` Yann E. MORIN
  2009-05-12 15:26 ` Paul Smith
  2 siblings, 1 reply; 7+ messages in thread
From: Yann E. MORIN @ 2009-05-11 17:03 UTC (permalink / raw)
  To: crossgcc; +Cc: Joachim Nilsson

Joachim,
All,

On Sunday 10 May 2009 16:30:41 Joachim Nilsson wrote:
> I run Ubuntu, a Debian GNU/Linux derivative.  Debian has a policy about
> /bin/sh scripts that basically states that any such script be POSIX
> compatible.  To further complicate matters /bin/sh is by default /bin/dash
> (Debian Almquist SHell)

<rant>
Better known as the "Deffective Annoying SHell". :-)
</rant>

> and it is rather picky about its syntax.    

No it is not picky. It is simply POSIX compliant, with no extensions (*).

> With the new, very neat, configure check for libncurses the configure
> script no longer runs on Debian or Ubuntu default installations.  It
> seems to boil down to the use of variable expansion in the following line:
> 	lib="$( echo lib{ncursesw,ncurses,curses}.{so,a,dylib} )"

Oh, that's not POSIX? Damned. Bashism again... :-(

> Is it possible we could change the configure script to use /bin/bash
> instead of /bin/sh?  I think that solution would be the best in the
> long run.

No. ./configure *shall* be a POSIX compliant script. The real solution is
to fix ./configure to use POSIX-only syntax. I can do that, but I would
appreciate a patch ;-)

Regards,
Yann E. MORIN.

(*) In fact, there might be non-POSIX extensions in dash, but dash is not
    incorporating every existing bashisms.
YEM.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +0/33 662376056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| --==< ^_^ >==-- `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
`------------------------------^-------^------------------^--------------------'


--
For unsubscribe information see http://sourceware.org/lists.html#faq

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

* Re: crosstool-ng libncurses check in configure
  2009-05-11 17:03 ` Yann E. MORIN
@ 2009-05-11 17:27   ` Michael Abbott
  2009-05-11 18:13     ` Yann E. MORIN
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Abbott @ 2009-05-11 17:27 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: crossgcc, Joachim Nilsson

On Mon, 11 May 2009, Yann E. MORIN wrote:
> > 	lib="$( echo lib{ncursesw,ncurses,curses}.{so,a,dylib} )"
> No. ./configure *shall* be a POSIX compliant script. The real solution is
> to fix ./configure to use POSIX-only syntax. I can do that, but I would
> appreciate a patch ;-)

Not a patch ... but how about:

	lib="$(
	    for l in ncursesw ncurses curses; do
	        for x in so a dylib; do
	            echo -n "lib$l.$x "
	        done
	    done)"

?  You probably don't need the -n (then you don't need the "... " either), 
but I'm not actually looking at the useage here, just the one line.

Actually, if the order matters you need to swap the for lines around, but 
again I don't suppose it does.

--
For unsubscribe information see http://sourceware.org/lists.html#faq

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

* Re: crosstool-ng libncurses check in configure
  2009-05-11 17:27   ` Michael Abbott
@ 2009-05-11 18:13     ` Yann E. MORIN
  0 siblings, 0 replies; 7+ messages in thread
From: Yann E. MORIN @ 2009-05-11 18:13 UTC (permalink / raw)
  To: Michael Abbott; +Cc: crossgcc, Joachim Nilsson

[-- Attachment #1: Type: text/plain, Size: 1459 bytes --]

Michael,
Joachim,
All,

On Monday 11 May 2009 19:26:54 Michael Abbott wrote:
> Not a patch ... but how about:
> 	lib="$(
> 	    for l in ncursesw ncurses curses; do
> 	        for x in so a dylib; do
> 	            echo -n "lib$l.$x "
> 	        done
> 	    done)"

Yeah! Nice. See attached patch. Will be comitted soonish.

> ?  You probably don't need the -n (then you don't need the "... " either), 
> but I'm not actually looking at the useage here, just the one line.

See The Open Group Base Specifications Issue 7:
http://www.opengroup.org/onlinepubs/9699919799/utilities/echo.html

OK, seems clear enough: echo has *not* option! Will be using printf instead,
which is strongly recommended in the "Application Usage" section.

> Actually, if the order matters you need to swap the for lines around, but 
> again I don't suppose it does.

Yes, the order matters (we prefer ncursesw, then ncurses, then curses), but
you got it right! :-)

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +0/33 662376056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| --==< ^_^ >==-- `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
`------------------------------^-------^------------------^--------------------'

[-- Attachment #2: configure-POSIX-compliance.patch --]
[-- Type: text/x-diff, Size: 912 bytes --]

Index: ct-ng.trunk/configure
===================================================================
--- ct-ng.trunk/configure	(revision 1515)
+++ ct-ng.trunk/configure	(working copy)
@@ -350,7 +350,13 @@
 has_or_abort inc="ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h"    \
              err="'ncurses' headers files were not found"
 
-has_or_abort lib="$( echo lib{ncursesw,ncurses,curses}.{so,a,dylib} )"  \
+ncurses_libs="$( for l in ncursesw ncurses curses; do   \
+                     for x in so a dylib; do            \
+                         printf "lib$l.$x ";            \
+                     done;                              \
+                 done                                   \
+               )"
+has_or_abort lib="${ncurses_libs}"                  \
              err="'ncurses' library was not found"
 
 #---------------------------------------------------------------------


[-- Attachment #3: Type: text/plain, Size: 71 bytes --]

--
For unsubscribe information see http://sourceware.org/lists.html#faq

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

* Re: crosstool-ng libncurses check in configure
  2009-05-10 14:31 crosstool-ng libncurses check in configure Joachim Nilsson
  2009-05-11 17:03 ` Yann E. MORIN
@ 2009-05-11 20:48 ` Yann E. MORIN
  2009-05-12 15:26 ` Paul Smith
  2 siblings, 0 replies; 7+ messages in thread
From: Yann E. MORIN @ 2009-05-11 20:48 UTC (permalink / raw)
  To: crossgcc; +Cc: Joachim Nilsson, Michael Abbott

Joachim,
All,

On Sunday 10 May 2009 16:30:41 Joachim Nilsson wrote:
> With the new, very neat, configure check for libncurses the configure
> script no longer runs on Debian or Ubuntu default installations.
> It seems to boil down to the use of variable expansion in the following
> line:
> 	lib="$( echo lib{ncursesw,ncurses,curses}.{so,a,dylib} )"

I committed the neat solution of Michael as the fix: revision 1517.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +0/33 662376056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| --==< ^_^ >==-- `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
`------------------------------^-------^------------------^--------------------'


--
For unsubscribe information see http://sourceware.org/lists.html#faq

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

* Re: crosstool-ng libncurses check in configure
  2009-05-10 14:31 crosstool-ng libncurses check in configure Joachim Nilsson
  2009-05-11 17:03 ` Yann E. MORIN
  2009-05-11 20:48 ` Yann E. MORIN
@ 2009-05-12 15:26 ` Paul Smith
  2009-05-12 16:33   ` Yann E. MORIN
  2 siblings, 1 reply; 7+ messages in thread
From: Paul Smith @ 2009-05-12 15:26 UTC (permalink / raw)
  To: crossgcc

On Sun, 2009-05-10 at 10:30 -0400, Joachim Nilsson wrote:
> 	lib="$( echo lib{ncursesw,ncurses,curses}.{so,a,dylib} )"
> 
> Is it possible we could change the configure script to use /bin/bash
> instead of /bin/sh?  I think that solution would be the best in the
> long run.

Personally I think that changing the script to work properly with a
POSIX shell is the best in the _long_ run, as it's the most portable.

The above seems like a lot of processing (non-portable, invokes an extra
shell, etc.) to avoid writing 9 words:

lib="libcursesw.so libcursesw.a libcursesw.dylib \
     libncurses.so libncurses.a libncurses.dylib \
     libcurses.so libcurses.a libcurses.dylib"


JMHO.


--
For unsubscribe information see http://sourceware.org/lists.html#faq

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

* Re: crosstool-ng libncurses check in configure
  2009-05-12 15:26 ` Paul Smith
@ 2009-05-12 16:33   ` Yann E. MORIN
  0 siblings, 0 replies; 7+ messages in thread
From: Yann E. MORIN @ 2009-05-12 16:33 UTC (permalink / raw)
  To: crossgcc, psmith

Paul,
All,

On Tuesday 12 May 2009 17:26:14 Paul Smith wrote:
> On Sun, 2009-05-10 at 10:30 -0400, Joachim Nilsson wrote:
> > 	lib="$( echo lib{ncursesw,ncurses,curses}.{so,a,dylib} )"
> Personally I think that changing the script to work properly with a
> POSIX shell is the best in the _long_ run, as it's the most portable.

Yes, ./configure *shall* be a POSIX-compliant shell script.
This is the course I took when fixing that non-portable line.

> The above seems like a lot of processing (non-portable, invokes an extra
> shell, etc.) to avoid writing 9 words:

Programers are lazy, and if they can write smaller code, all the
better. Note also that programers also prefer writing bigger code
to generate a list of constants, rather than writing said list.
Given this, please note that you can call me a programmer! ;-P

Using loops to generate said list has one positive side effect, by
the way: if we have to add a new library name and/or extension, it
is easier to update the loop that handles that part, rather than
updating the full list, which would become unmanageable in the
loooong term.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +0/33 662376056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| --==< ^_^ >==-- `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
`------------------------------^-------^------------------^--------------------'


--
For unsubscribe information see http://sourceware.org/lists.html#faq

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

end of thread, other threads:[~2009-05-12 16:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-10 14:31 crosstool-ng libncurses check in configure Joachim Nilsson
2009-05-11 17:03 ` Yann E. MORIN
2009-05-11 17:27   ` Michael Abbott
2009-05-11 18:13     ` Yann E. MORIN
2009-05-11 20:48 ` Yann E. MORIN
2009-05-12 15:26 ` Paul Smith
2009-05-12 16:33   ` Yann E. MORIN

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).