bug-autoconf
[Top][All Lists]
Advanced

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

[sr #110656] On AT&T UnixPC (3b1), parameter $3 gets overwritten (cleare


From: Alain Knaff
Subject: [sr #110656] On AT&T UnixPC (3b1), parameter $3 gets overwritten (cleared) by call to subfunction.
Date: Sun, 15 May 2022 13:55:24 -0400 (EDT)

URL:
  <https://savannah.gnu.org/support/?110656>

                 Summary: On AT&T UnixPC (3b1), parameter $3 gets overwritten
(cleared) by call to subfunction.
                 Project: Autoconf
            Submitted by: alainknaff
            Submitted on: Sun 15 May 2022 07:55:22 PM CEST
                Category: None
                Priority: 5 - Normal
                Severity: 3 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
        Operating System: None

    _______________________________________________________

Details:

In many tests in autoconf generated configure scripts we have the following
pattern:

ac_fn_c_check_header_compile ()
{
   ...
   do preparatory work
   ...
if ac_fn_c_try_compile "$LINENO"; then :
  eval "$3=yes"
else
  eval "$3=no"
fi
 ...
}


On entry to ac_fn_c_check_header_compile, positional parameter 3 contains the
name of the variable where to put the test result.
However, on AT&T UnixPC, this is cleared by any call to another function (such
as ac_fn_c_try_compile in this case), leading to an eval that does just
"=yes", which obviously fails, as it will try to look for a command named
"=yes"

Solution: store $3 in a variable:

ac_fn_c_check_header_compile ()
{
   result_var=$3
   ...
   do preparatory work
   ...
if ac_fn_c_try_compile "$LINENO"; then :
  eval "$result_var=yes"
else
  eval "$result_var=no"
fi
 ...
}

Interestingly enough, configure prints out "positional parameters were not
saved." early on the the configure process, so it seems to notice the problem,
but then fails to act on it.






    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/support/?110656>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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