[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: configure: error: cannot find install-sh,, or shtool in "

From: TomK
Subject: Re: configure: error: cannot find install-sh,, or shtool in "." "./.." "./../.."
Date: Sat, 1 Aug 2020 20:47:01 -0400
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.0.1

On 7/30/2020 8:46 PM, Nick Bowler wrote:
On 25/07/2020, TomK <> wrote:
Out of curiosity and a bit on another topic.  Is the syntax written
like this for compatibility reasons with other shells?  Or because it
could get in the way of the parsers Automake uses?

Autoconf is primarily a portability tool and thus a key goal is for
generated configure scripts to run in pretty much any unix-like
environment that anyone could possibly want to run them on.

Although these days configure expects support for things like shell
functions and comments so you probably won't have much luck on the
original 1979 Bourne shell, but there are a lot of different ksh88
derivatives/workalikes still floating around which were the basis
for POSIX standardization and the default shell on basically every
unix-like environment you're likely to encounter outside of museums.

Code snippet:
In particular:

"x$host_alias" != x;

I know adding 'x' or another character prevents failures when a variable
is empty but that's been deprecated for sometime.

I don't know of any shell that gets this wrong with empty variables.
But metacharacters are a problem.  For example, if we write:

   test "$a" != "hello"

then at least some shells, (e.g., heirloom-sh), fail if a="!" or
a="(", etc, even though it is valid according to POSIX:

   $ a='('
   $ test "$a" != "hello"
   test: argument expected
   $ echo $?

Prefixing with a benign (usually "x") string neatly avoids this problem:

   $ test x"$a" != x"hello"
   $ echo $?

It's simple enough to do that usually this pattern is applied everywhere
even in cases where it is not strictly necessary -- I don't need to know
whether or not host_alias can legitimately be set to '!'.

[] is deprecated in favor of [[]]
`` is deprecated in favor of $()

[[ ]] is not POSIX compliant, and won't work at all in many modern
shells including dash.

$() is POSIX but unfortunately not widely portable in practice, e.g.,
again in heirloom-sh:

   $ a=$(echo hello)
   syntax error: `a=$' unexpected


Thanks Guy's! Always saw the syntax used and wondered reasoning behind it given various recommendations over the years.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]