[sr #110268] AC_RUN_IFELSE does not execute the test program although it could

Bruno Haible <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.bugs
Message-ID <[email protected]>
URL:
  <https://savannah.gnu.org/support/?110268>

                 Summary: AC_RUN_IFELSE does not execute the test program
although it could
                 Project: Autoconf
            Submitted by: haible
            Submitted on: Wed 15 Jul 2020 09:58:09 AM CEST
                Category: None
                Priority: 5 - Normal
                Severity: 4 - Important
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
        Operating System: None

    _______________________________________________________

Details:

This is a regression, compared to 2.69.

In situations where a platform is used as a development environment - with
program execution capability - for a different platform, AC_RUN_IFELSE now
does not execute the test program although it could; it falls back to the
cross-compilation guess instead.

This affects in particular
1) native Windows (mingw or MSVC) compilation in a Cygwin environment,
2) cross-compilation to Linux with a different architecture, on Linux.

Details about the environments:
1) See
https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=blob;f=INSTALL.windows
2) For example, cross-compilation to Linux/m68k from Linux/x86_64 (Ubuntu
16.04). See
https://git.savannah.gnu.org/gitweb/?p=libffcall.git;a=blob;f=porting-tools/emulation/qemu-m68k.txt
. The configure command I use is:

configure --prefix=/inst-m68k --host=m68k-linux CPPFLAGS="-I/inst-m68k/include
-Wall" LDFLAGS="-L/inst-m68k/lib"


The behaviour of AC_RUN_IFELSE is specified in the Autoconf documentation:
"If cross-compilation mode is enabled (this is the case if either the compiler
being used does not produce executables that run on the system where
@command{configure} is being run, or if the options @code{--build} and
@code{--host} were both specified and their values are different), then the
test program is not run."
This documentation has not changed since 2.69, and it makes perfect sense: it
generally allows to determine actual program behaviour, and it has a way to
disable it (in cases where that's needed).

In my case, the generated executables DO run in the environment, and I did NOT
specify a --build option. Therefore AC_RUN_IFELSE should execute the test
program.

Instead, what I see when configuring a gnulib testdir, generated with
+verbose+
  ./gnulib-tool --create-testdir --dir=../testdir-posixb --with-c++-tests
--single-configure `./posix-modules`
-verbose-
through
+verbose+
  ./configure --prefix=/inst-m68k --host=m68k-linux
CPPFLAGS="-I/inst-m68k/include -Wall" LDFLAGS="-L/inst-m68k/lib" -C 2>&1 | tee
log1
-verbose-
for Linux/m68k is that all AC_RUN_IFELSE invocation used the cross-compilation
branch, not the test program:

+verbose+
$ diff testdir-posix/build-m68k/config.cache
testdir-posixb/build-m68k/config.cache |head
16a17
> ac_cv_c_decl_report=${ac_cv_c_decl_report=error}
65c66
< ac_cv_func_chown_works=${ac_cv_func_chown_works=yes}
---
> ac_cv_func_chown_works=${ac_cv_func_chown_works='guessing yes'}
107c108
< ac_cv_func_getgroups_works=${ac_cv_func_getgroups_works=yes}
---
> ac_cv_func_getgroups_works=${ac_cv_func_getgroups_works='guessing yes'}
...
-verbose-
See attached file config.cache.diff.




    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Wed 15 Jul 2020 09:58:09 AM CEST  Name: config.cache.diff  Size: 31KiB  
By: haible

<http://savannah.gnu.org/support/download.php?file_id=49488>

    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  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.