autoconf
[Top][All Lists]
Advanced

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

Re: to conditionally test, or not to conditionally test?


From: Ralf Corsepius
Subject: Re: to conditionally test, or not to conditionally test?
Date: Fri, 27 May 2005 15:25:56 +0200

On Fri, 2005-05-27 at 13:38 +0100, Keith MARSHALL wrote:
> Stepan Kasal wrote:
> > It's hard to tell whether a macro calls AC_REQUIRE.  (It can call it
> > indirectly.)
> >
> > A real fix will be to use shell functions to reimplement AC_REQUIRE,
> > in autoconf-3.
> 
> Are you now saying that shell functions are safe to use in a portable
> fashion?  That would contradict the advice given in "info autoconf",
> node "Portable Shell":--
> 
> >      You should not use shell functions, aliases, negated
> >   character classes, or other features that are not found in all
> >   Bourne-compatible shells; restrict yourself to the lowest common
> >   denominator.

The answer to this question is two-fold:

1. In general, shell functions are not portable, because there exist
shells which do not support shells. Though these are old shells, these
still can be met on occasion.

2. In practice, all currently used shells have functions.


Therefore, released versions of autoconf do not apply shell functions,
and you are better off not using functions in configure scripts/sh-
fragments, if you want your configure script to be generally applicable.

In practice, however, it is pretty safe to use shell functions in
configure scripts if you ignore the small number of shells not
supporting them, and if you tell those users hitting a shell not
supporting functions to use one which does.

Also, AFAICT, there exist versions of autoconf with some kind of support
for functions - I don't know about its current status nor about what
exactly is planned, there.

Ralf







reply via email to

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