autoconf-patches
[Top][All Lists]
Advanced

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

Re: [PATCH] remove warning for --host without --build


From: Peter Rosin
Subject: Re: [PATCH] remove warning for --host without --build
Date: Mon, 23 Apr 2012 12:24:24 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20120327 Thunderbird/11.0.1

On 2012-04-23 11:14, Bruno Haible wrote:
> Peter Rosin wrote:
>> If you don't specify --build when you are cross-compiling (i.e. host != 
>> build),
>> in an environment where the build system -- for one reason or another -- is 
>> able
>> to execute the host code, the heuristic to detect a cross-compiler fails.
> 
> I have never observed this. What are the steps to reproduce the problem?

Trivial:

$ uname -mo
i686 Cygwin
$ cat << EOF > configure.ac
AC_INIT([cross-test], [0.1])
AC_PROG_CC
AC_OUTPUT
EOF
$ autoconf
$ ./configure --host=i686-pc-mingw32
configure: WARNING: if you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used
checking for i686-pc-mingw32-gcc... i686-pc-mingw32-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no   <<<<<<<<<<<WRONG<<<<<<<<<<<<<<
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether i686-pc-mingw32-gcc accepts -g... yes
checking for i686-pc-mingw32-gcc option to accept ISO C89... none needed
configure: creating ./config.status
$ ./configure --host=i686-pc-mingw32 --build=i686-pc-cygwin
checking for i686-pc-mingw32-gcc... i686-pc-mingw32-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... yes  <<<<<<<<<<CORRECT<<<<<<<<<<<<<
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether i686-pc-mingw32-gcc accepts -g... yes
checking for i686-pc-mingw32-gcc option to accept ISO C89... none needed
configure: creating ./config.status

And, follow up problems with this difference is that e.g. the line ending
convention used by MinGW executables are different from Cygwin and can
easily cause testsuite failures when comparing text.  Another potential
problem can be found in the Automake testsuite which attempts to build
an executable that outputs on fd 9, runs the executable and tries to read
that output, something which I don't think is possible with MinGW
executables.  I.e. corner cases, but I bet there are more.

It's simply not a good idea to assume that you can run all programs just
because you can run a very simple one, and it certainly isn't such a good
indication whether or not you are doing a cross.  And testsuites tend to
assume that anything goes when configure says that it is not a cross build.

> You are aware that there are assignments to the 'cross_compiling' variable
> not only in AC_INIT, but also in _AC_COMPILER_EXEEXT (invoked by AC_PROG_CC)?

I wasn't aware that it was set in AC_INIT, only that it potentially ends
up incorrect after AC_PROG_CC when --build isn't specified.

Cheers,
Peter



reply via email to

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