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: Bruno Haible
Subject: Re: [PATCH] remove warning for --host without --build
Date: Mon, 23 Apr 2012 21:43:04 +0200
User-agent: KMail/4.7.4 (Linux/3.1.0-1.2-desktop; KDE/4.7.4; x86_64; ; )

Hi Paul,

> I pushed the following slightly-different
> (and I hope clearer) patch.
> ...
> @@ -21747,10 +21747,12 @@ system types are involved.  The options to specify 
> them are:
>  @item address@hidden
>  the type of system on which the package is being configured and
>  compiled.  It defaults to the result of running @command{config.guess}.
> +Specifying a @var{build-type} that differs from @var{host-type} enables
> +cross-compilation mode.
>  
>  @item address@hidden
>  the type of system on which the package runs.  By default it is the
> -same as the build machine.  Specifying it enables the cross-compilation
> +same as the build machine.  Specifying it enables cross-compilation
>  mode.
>  

Ouch. There are now two wrong/inconsistent pieces of doc here:

1) The documentation of AC_RUN_IFELSE does not mention the cross-compilation
   mode. It says

     If the compiler being used does not produce executables that run
     on the system where `configure' is being run, then the test
     program is not run.

   which is factually wrong.

2) The second paragraph you showed says that specifying --host enables
   the cross-compilation mode. Either the cross-compilation mode influences
   AC_RUN_IFELSE - then this statement is wrong. Or it has no influence on
   AC_RUN_IFELSE - then what are its effect, what is this doc all about?

Let's go back to the sample provided by Peter Rosin:

===================== configure.ac ================
AC_INIT([cross-test], [0.1])
AC_PROG_CC
AC_RUN_IFELSE(
  [AC_LANG_PROGRAM([[]],[[]])],
  [echo executable],
  [echo not executable],
  [echo not attempted to execute])
AC_OUTPUT
===================================================

On Cygwin 1.5:

$ ./configure CC="gcc-3 -mno-cygwin" --host=i586-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 i586-pc-mingw32-gcc... gcc-3 -mno-cygwin
checking for C compiler default output file name... a.exe
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... .exe
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc-3 -mno-cygwin accepts -g... yes
checking for gcc-3 -mno-cygwin option to accept ISO C89... none needed
executable
configure: creating ./config.status

$ ./configure CC="gcc-3 -mno-cygwin" --host=i586-pc-mingw32 
--build=i686-pc-cygwin
checking for i586-pc-mingw32-gcc... gcc-3 -mno-cygwin
checking for C compiler default output file name... a.exe
checking whether the C compiler works... yes
checking whether we are cross compiling... yes
checking for suffix of executables... .exe
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc-3 -mno-cygwin accepts -g... yes
checking for gcc-3 -mno-cygwin option to accept ISO C89... none needed
not attempted to execute
configure: creating ./config.status

Results of this test:

1) When users obey the warning and pass --build, AC_RUN_IFELSE executes its
   4th arguments and therefore produces only guesses, not real findings.
   That's why I proposed the patch to eliminate the warning. Can someone
   please apply it?

2) The "checking whether we are cross compiling" result, i.e. the value
   of $cross_compiling (see node "Runtime"), correlates with the behaviour
   of AC_RUN_IFELSE. I assume this is meant by "cross-compilation mode".

3) --host alone does not enable the cross-compilation mode.

4) When --build is specified AND is different from the --host, the cross-
   compilation mode is forced.

Apparently these behaviours were installed as a "temporary" behaviour in 2000,
according to the doc in node "Hosts and Cross-Compilation". That piece of
doc also says

   In the future, `--host' will not override the
   name of the build system type.  Whenever you specify `--host', be sure
   to specify `--build' too.

"In the future" is wrong. That's already the case:
========================= configure.ac ====================
AC_INIT([cross-test], [0.1])
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_OUTPUT
===========================================================
$ ./configure CC="gcc-3 -mno-cygwin" --host=i586-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 build system type... i686-pc-cygwin
checking host system type... i586-pc-mingw32
configure: creating ./config.status

I specified --host, and --build was guessed correctly.

Here is a proposed patch to clean up some of these mistakes.


2012-04-23  Bruno Haible  <address@hidden>

        doc: Fix incorrect and incomplete doc about cross-compilation mode.
        * doc/autoconf.texi (Runtime): Mention the effect of the cross-
        compilation mode on AC_RUN_IFELSE.
        (Specifying Target Triplets): Fix description of --host's effects.
        (Hosts and Cross-Compilation): Remove incorrect statement about
        --host's effects.

--- doc/autoconf.texi.orig      Mon Apr 23 21:38:00 2012
+++ doc/autoconf.texi   Mon Apr 23 21:37:39 2012
@@ -9491,8 +9491,11 @@
 that of a failed compilation, or it might be that of a failed program
 execution.
 
-If the compiler being used does not produce executables that run on the
-system where @command{configure} is being run, then the test program is
+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.  If the optional shell commands @var{action-if-cross-compiling}
 are given, those commands are run instead; typically these commands
 provide pessimistic defaults that allow cross-compilation to work even
@@ -21752,8 +21755,9 @@
 
 @item address@hidden
 the type of system on which the package runs.  By default it is the
-same as the build machine.  Specifying it enables cross-compilation
-mode.
+same as the build machine.  Specifying a @var{host-type} that differs
+from @var{build-type}, when @var{build-type} was also explicitly
+specified, enables cross-compilation mode.
 
 @item address@hidden
 the type of system for which any compiler tools in the package
@@ -24459,10 +24463,7 @@
 mode, so it doesn't run any tests that require execution.
 
 Hint: if you mean to override the result of @command{config.guess},
-prefer @option{--build} over @option{--host}.  In the future,
address@hidden will not override the name of the build system type.
-Whenever you specify @option{--host}, be sure to specify @option{--build}
-too.
+prefer @option{--build} over @option{--host}.
 
 @sp 1
 




reply via email to

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