From: Akim Demaille <[EMAIL PROTECTED]>
   Date: 25 Feb 2000 17:41:57 +0100

   | I've been using autoconf since the beginning, and I've used a lot of
   | different Unix systems.  If you have any specific questions, I'm
   | willing to take a stab at them.

   OK.  Can you tell me why the heck the cache looks like this:

   ac_cv_path_M4=${ac_cv_path_M4=/usr/bin/m4}
   ac_cv_path_PERL=${ac_cv_path_PERL=/usr/bin/perl}
   ac_cv_path_install=${ac_cv_path_install='/usr/bin/install -c'}
   ac_cv_prog_AWK=${ac_cv_prog_AWK=mawk}
   ac_cv_prog_gnu_m4=${ac_cv_prog_gnu_m4=yes}
   ac_cv_prog_make_make_set=${ac_cv_prog_make_make_set=yes}

   and not like this:

   : ${ac_cv_path_M4=/usr/bin/m4}
   : ${ac_cv_path_PERL=/usr/bin/perl}
   : ${ac_cv_path_install='/usr/bin/install -c'}
   : ${ac_cv_prog_AWK=mawk}
   : ${ac_cv_prog_gnu_m4=yes}
   : ${ac_cv_prog_make_make_set=yes}

Well, here is the relevant ChangeLog entry:

Thu Feb  2 11:32:07 1995  David J. MacKenzie  <[EMAIL PROTECTED]>

        * acgeneral.m4 (AC_CACHE_SAVE): Workaround Ultrix and 4.3BSD sh
          bug in setting the high bit on variable values.
          From Ken Raeburn.

Ken Raeburn is [EMAIL PROTECTED], if you want to ask him about it.

I can replicate this bug on Ultrix with this shell script:

rm -f foo.cache
ac_cv_path_M4=/usr/bin/m4
(set) 2>&1 |
  sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/: \${\1='\2'}/p" \
  >> foo.cache
/bin/sh -c '
  . foo.cache
  echo $ac_cv_path_M4
  (set) 2>&1 |
    sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/: \${\1='"'"'\2'"'"'}/p" \
    >> foo.cache
  echo $ac_cv_path_M4
  cat -v foo.cache'

On Ultrix, the output is this:

/usr/bin/m4
/usr/bin/m4
: ${ac_cv_path_M4='/usr/bin/m4'}
: ${ac_cv_path_M4='M-/M-uM-sM-rM-/M-bM-iM-nM-/M-mM-4'}

This bug does not happen if I change the use of /bin/sh in the script
to /bin/sh5, and invoke the script with /bin/sh5.  In that case, I see
this:

/usr/bin/m4
/usr/bin/m4
: ${ac_cv_path_M4='/usr/bin/m4'}
: ${ac_cv_path_M4='/usr/bin/m4'}

Note that the ChangeLog entry indicates that this bug arises on the
4.3BSD shell as well.  The BSD shells used to use the high bit to
record information--that is, they were not eight bit clean.  This was
a problem with csh in particular for years.  I'm pretty certain that
4.3BSD did not have a second shell like the Ultrix /bin/sh5.  On the
other hand, I don't know whether anybody still runs 4.3BSD.

   | My SVR2 example was not arbitrary.  I've run autoconf generated
   | configure scripts on Z8000 based SVR2 systems.  As of a couple of
   | years ago, those systems were still running, and I don't know of any
   | reason why they would not still be running today (well, I suppose they
   | might have been replaced due to Y2K concerns).  (Those systems are so
   | old that they don't have setjmp/longjmp--they have a different
   | mechanism, called setret/longret.)

   Wow :)  Never heard of these guys.  Still, you didn't answer my
   question: there are *no* shells on these machines which support
   functions?

That is correct: there are no shells on those machines which support
functions.  In those days machines only had one shell.  Ultrix only
has two shell programs because it is trying to merge BSD and Sysem V;
/bin/sh is the BSD shell, and /bin/sh5 is the System V shell.  Having
two shells is just a holdover from the BSD/System V split.  Presumably
modern systems drop the two shells as they become POSIX.2 compliant.

Shell functions were introduced in SVR3.  They didn't get into BSD
until it became more or less POSIX.2 compliant with 4.4BSD.

   |    In addition, though I agree to be extremely oldish compatible, we
   |    should not still fight for PDP11.  Yet Autoconf, as we have recently
   |    discovered is far from being really portable as compared to
   |    Metaconfig.  But in practice, AFAIK, *never* this has been reported.
   | 
   | I guess I don't understand what you mean here.  I probably just didn't
   | read the messages.  I mean, naturally nobody has reported that
   | autoconf is being used on a system which does not support shell
   | functions, because autoconf doesn't use shell functions.

   Yep, but for instance Metaconfig does not use `#' for comments, but
   `:', because it is not portable.  And Autoconf's configure scripts
   cannot run on Eunice, while Configure does.  How Eunice and SVR2
   compare in terms of age?

SVR2 came out in 1984.  Eunice is a Unix simulator which runs on VMS.
A little net spelunking reveals that it was around in 1982.

I just checked Horton's Portable C Programming.  He says ``There have
been some features added to the Bourne shell since V7 that are not
portable.  These include the : operator used with parameter expansion:
${x:-y} and the use of # for comments.  Systems derived from V7, such
as 4BSD, do not support these features.  The test or [ commands also
vary from system to system.''

Ian

Reply via email to