autoconf
[Top][All Lists]
Advanced

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

Re: sh compatibility question


From: Akim Demaille
Subject: Re: sh compatibility question
Date: 20 Sep 2000 16:37:43 +0200
User-agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Channel Islands)

>>>>> "Martin" == Martin Wilck <address@hidden> writes:

Martin> I wonder why autoconf doesn't use shell functions.  Is that a
Martin> compatibility issue?  According to the bash info pages, shell
Martin> functions belong to the POSIX standard for the Bourne shell.

You are twice right, but the implicit assertion that POSIX is
available everywhere configure is run is wrong.

About sh functions themselves, I'm pretty sure we are still asking for
troubles: but on some truly exotic platforms which some portability
gurus keep precisely to torture their package, they are supported.

Anyway, no flame, no thread, please, we will not consider using sh
functions in Autoconf before another couple of hundreds of years.  We
are doing well without, it'd be a pity to take that risk and lose (but
it is sooooooo tempting :-) Shell functions are the best means to
avoid that good environments have pay the price of workarounds for
broken system bugs).

BTW, it means that *but* for Autoconf (and Libtool), you should
consider sh functions to be available.  The thing is: build your
script in such a way that it's ready to re-run itself with another
shell.  For instance here is the method followed by some TeX related
scripts:


#!/bin/sh

test -f /bin/sh5 && test -z "$RUNNING_SH5" \
  && { UNAMES=`uname -s`; test "x$UNAMES" = xULTRIX; } 2>/dev/null \
  && { RUNNING_SH5=true; export RUNNING_SH5; exec /bin/sh5 $0 ${1+"$@"}; }
unset RUNNING_SH5

test -f /bin/bsh && test -z "$RUNNING_BSH" \
  && { UNAMES=`uname -s`; test "x$UNAMES" = xAIX; } 2>/dev/null \
  && { RUNNING_BSH=true; export RUNNING_BSH; exec /bin/bsh $0 ${1+"$@"}; }
unset RUNNING_BSH

Gary has a better method somewhere.


You may fall on some lonely hermit who decided plain old functionless
sh was enough for him, but then 1. he is certainly not interested in
your scripts, or 2. if he wants them, let him install bash.



Nobody but Autoconf and Libtool maintainers should ever bother with
non POSIX shell portability issues.  That's an absolute waste of time
for a totally uninteresting issue (Gosh, how I'd love not to have the
brain encumbered with references to *bugs*).

F*k portability!

(Hm, maybe it's time for me to step down as an Autoconf maintainer,
I'm not sure I still appreciate the ``````funny'''''' aspects of
working around bucking fugs).

(No, I'm kidding, not right now, I still have a set to play with RMS :)


reply via email to

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