]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
`foo=1 foo=2 cmd' has an undefined behavior.
authorAkim Demaille <akim@epita.fr>
Wed, 7 Jun 2000 11:57:11 +0000 (11:57 +0000)
committerAkim Demaille <akim@epita.fr>
Wed, 7 Jun 2000 11:57:11 +0000 (11:57 +0000)
* acgeneral.m4 (_AC_COMPUTE_INT_COMPILE): Do not put two shell
variable assignments in one shell command.
* doc/autoconf.texi (Shell Substitutions): Document.

ChangeLog
acgeneral.m4
doc/autoconf.texi
lib/autoconf/general.m4

index e2d2e9456673424916e159f7e70a881a35faf3ef..8fd82eb8288afa970d0c2b9cae53dc172e5d5329 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2000-06-07  Philippe De Muyter  <phdm@macqel.be>
+
+       `foo=1 foo=2 cmd' has an undefined behavior.
+
+       * acgeneral.m4 (_AC_COMPUTE_INT_COMPILE): Do not put two shell
+       variable assignments in one shell command.
+       * doc/autoconf.texi (Shell Substitutions): Document.
+
 2000-06-07  Steven G. Johnson  <stevenj@alum.mit.edu>
 
        * aclang.m4 (AC_F77_LIBRARY_LDFLAGS): Fix problem on Cray due to
index 0f93996034faa7bd9a7d964019c0374d717d90ac..b1a22e1590be3c428faecf4597e0473c48fd08cb 100644 (file)
@@ -3178,14 +3178,14 @@ AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) >= 0])],
  [ac_lo=0 ac_try=0
   while true; do
     AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) <= $ac_try])],
-                    [ac_hi=$ac_try; break],
-                    [ac_lo=`expr $ac_try + 1` ac_try=`expr 2 '*' $ac_try + 1`])
+                   [ac_hi=$ac_try; break],
+                   [ac_lo=`expr $ac_try + 1`; ac_try=`expr 2 '*' $ac_try + 1`])
   done],
  [ac_hi=-1 ac_try=-1
   while true; do
     AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) >= $ac_try])],
                       [ac_lo=$ac_try; break],
-                      [ac_hi=`expr $ac_try - 1` ac_try=`expr 2 '*' $ac_try`])
+                      [ac_hi=`expr $ac_try - 1`; ac_try=`expr 2 '*' $ac_try`])
   done])
 # Binary search between lo and hi bounds.
 while test "x$ac_lo" != "x$ac_hi"; do
index 838fcaf72ee8df806b6f75fc18a97678ee3e7201..586eb164f915605b39bf87bee8f70f757ddcecb8 100644 (file)
@@ -4718,6 +4718,11 @@ If the value is a literal string, it should be quoted:
 otherwise some shells, such as on Digital Unix V 5.0, will die because
 of a @emph{bad substitution}.
 
+When setting several variables in a row, be aware that the order of the
+evaluation is undefined.  For instance @samp{foo=1 foo=2; echo $foo}
+gives @samp{1} with sh on Solaris, but @samp{2} with bash.  You must use
+@samp{;} to enforce the order: @samp{foo=1; foo=2; echo $foo}.
+
 Contrary to a persistent urban legend, the Bourne shell does not
 systematically split variables and backquoted expressions, in
 particular, the following code:
index 0f93996034faa7bd9a7d964019c0374d717d90ac..b1a22e1590be3c428faecf4597e0473c48fd08cb 100644 (file)
@@ -3178,14 +3178,14 @@ AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) >= 0])],
  [ac_lo=0 ac_try=0
   while true; do
     AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) <= $ac_try])],
-                    [ac_hi=$ac_try; break],
-                    [ac_lo=`expr $ac_try + 1` ac_try=`expr 2 '*' $ac_try + 1`])
+                   [ac_hi=$ac_try; break],
+                   [ac_lo=`expr $ac_try + 1`; ac_try=`expr 2 '*' $ac_try + 1`])
   done],
  [ac_hi=-1 ac_try=-1
   while true; do
     AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) >= $ac_try])],
                       [ac_lo=$ac_try; break],
-                      [ac_hi=`expr $ac_try - 1` ac_try=`expr 2 '*' $ac_try`])
+                      [ac_hi=`expr $ac_try - 1`; ac_try=`expr 2 '*' $ac_try`])
   done])
 # Binary search between lo and hi bounds.
 while test "x$ac_lo" != "x$ac_hi"; do