[sr #110656] On AT&T UnixPC (3b1), parameter $3 gets overwritten (cleared) by call to subfunction.

Alain Knaff <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.bugs
Message-ID <[email protected]>
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/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.