[kde-solaris] GNU Makefiles should only use Bourne Shell Syntax - Not Bash. (was: Re: Unhelpful error building dcop in kdelibs)

Rolf Sponsel Rolf.Sponsel at kstr.lth.se
Mon Jan 31 18:34:30 CET 2005

Stefan Teleman, 2005-01-31 17:30 GMT +01:00, wrote:

> No.
> The GNU autoconf/libtool/configure stuff is written for the 
> *GNU/Linux* /bin/sh.  On GNU/Linux systems, /bin/sh is either a
> symlink to the Bourne Again Shell, a.k.a. bash, or a duplicate
> of the /bin/bash binary:
> [steleman at darthvader][~][01/31/2005 7:27:44][4]>> ls -la /bin/sh
> lrwxrwxrwx    1 root     root            4 2003-12-27 23:33 /bin/sh -> 
> bash

GNU, and the GNU tools, have been around long before
the name Linux even existed.

The presence of a link '/bin/sh' ponting to bash doesn't
state that there is something called "GNU/Linux* /bin/sh".

It only indicates that bash, which is the
"Shell of the GNU operating system", is
an sh-compatible shell. See bash, at:


This is why it's perfectly legal to link '/bin/sh' to bash.

But this is also the reason for why, ususally Linux people,
*don't* understand why it's so important for portability to
stay away of non-sh-syntax available in bash.

> [steleman at darthvader][~][01/31/2005 11:22:09][5]>> uname -a
> Linux darthvader.nyc.rr.com 2.4.20-6 #1 Thu Feb 27 10:06:59 EST 2003 
> i686 i686 i386 GNU/Linux
> (this is RedHat 9).
> The Bourne shell and the Bourne Again Shell are not one and the same.

Exactly! And this is why they, the GNU people, explicitly
point out that it is  important to distinguish between them,
and always make sure that e.g. bash extensions are not to
being used (as explicitly stated in the GNU documentation).

> On Solaris, CONFIG_SHELL must be explicitly set to /bin/bash, and the 
> #!/bin/sh directives at top of all autoconf scripts should be changed 
> to #!/bin/bash, including libtool and ./configure, because /bin/sh 
> and /bin/bash are two different binaries. /bin/sh on Solaris is the 
> old, original Bourne shell, written by Stephen Bourne. The easiest 
> way of doing this is to do
> :1,$ s#/bin/sh#/bin/bash#g
> in ./configure and in libtool.

... which, of course, is the wrong way of solving the problem
     in the long run (although fine for overcoming problems in
     anticipation for the build files to become fixed).

> It is not true that the FSF pages contain references to the Bourne 
> shell.  They contain references to /bin/sh, which on GNU/Linux means
> the Bourne Again Shell, i.e. bash.
> --Stefan

I'm sorry to have to disappoint you here (although I fully can
understand your logic). The documentation explicitly states:

"Write the Makefile commands (and any shell scripts,
  such as configure) to run in sh, not in csh. Don't
  use any special features of ksh or bash."

> -------
> On Monday 31 January 2005 09:26, Rolf Sponsel wrote:
>>If you need bash to run the Makefile,
>>then the Makefile does not follow
>>the gnu makefile recommendations,
>>and thus should be fixed.
>>Please have a look at the GNU make documentation.
>>GNU make: Makefile Basics
>>  14.1 General Conventions for Makefiles
>>Bourne shell, NOT Bourne again shell!
>>Help spreading the awareness about this!
>>/ Rolf
>>Michael Lambrellis, 2005-01-31 05:57 GMT +01:00, wrote:
>>>OK. I got past this. I had to replace all the "SHELL = /bin/sh"
>>>lines in the Makefiles with "SHELL = /my/bash". By the way, is
>>>there an easy way to do this using the configure script? Is it as
>>>simple as: SHELL=/my/bash ./configure ...
>>>In any case, I used a little search-and replace tool called gsar
>>>that I HIGHLY recommend to have around.
>>>... SNIP ...


Rolf Sponsel


More information about the kde-solaris mailing list