]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Re-enable the old behavior of --host and --build.
authorAkim Demaille <akim@epita.fr>
Fri, 30 Jun 2000 13:34:37 +0000 (13:34 +0000)
committerAkim Demaille <akim@epita.fr>
Fri, 30 Jun 2000 13:34:37 +0000 (13:34 +0000)
* acgeneral.m4 (build_alias): Set to host_alias if --build is not
given but --host is, and enable cross-compile auto-detection.  If
both are, and are different, enable cross compilation.
(AC_CANONICAL_HOST): Adjust help message.
(cross_compiling): Enclose in quotes when testing.
* aclang.m4 (_AC_LANG_COMPILER_WORKS): If cross_compiling is
maybe, set it to yes or no depending on the result of the
execution test.
* doc/autoconf.texi: Document the change.
* doc/install.texi: Likewise.

ChangeLog
acgeneral.m4
aclang.m4
doc/autoconf.texi
doc/install.texi
lib/autoconf/c.m4
lib/autoconf/fortran.m4
lib/autoconf/general.m4
lib/autoconf/lang.m4

index 8cc60bbc2fc45728a218fd00d60c435e123a52a9..94f2c1901f01fdb7ad54df246c0a47c8cd9544a0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2000-06-30  Alexandre Oliva  <oliva@lsd.ic.unicamp.br>
+
+       Re-enable the old behavior of --host and --build.
+
+       * acgeneral.m4 (build_alias): Set to host_alias if --build is not
+       given but --host is, and enable cross-compile auto-detection.  If
+       both are, and are different, enable cross compilation.
+       (AC_CANONICAL_HOST): Adjust help message.
+       (cross_compiling): Enclose in quotes when testing.
+       * aclang.m4 (_AC_LANG_COMPILER_WORKS): If cross_compiling is
+       maybe, set it to yes or no depending on the result of the
+       execution test.
+       * doc/autoconf.texi: Document the change.
+       * doc/install.texi: Likewise.
+
 2000-06-27  Jim Meyering  <meyering@lucent.com>
 
        * acspecific.m4 (_AC_LIBOBJ_GETLOADAVG): Put quotes around use of
index 925ca2f7db2ff5b707ce582baceb6f52b6f7c10f..ae4a815ab0c2e5f79bec8aaf5242caa0867b05ac 100644 (file)
@@ -1329,10 +1329,8 @@ do
     ac_init_help=short ;;
 
   -host | --host | --hos | --ho)
-    cross_compiling=yes
     ac_prev=host_alias ;;
   -host=* | --host=* | --hos=* | --ho=*)
-    cross_compiling=yes
     host_alias=$ac_optarg ;;
 
   -includedir | --includedir | --includedi | --included | --include \
@@ -1531,6 +1529,7 @@ Try `configure --help' for more information.])
     export $ac_envvar ;;
 
   *)
+    # FIXME: should be removed in autoconf 3.0.
     AC_MSG_WARN([you should use --build, --host, --target])
     expr "x$ac_option" : "[.*[^a-zA-Z0-9.]]" >/dev/null &&
       AC_MSG_WARN([invalid host type: $ac_option])
@@ -1564,6 +1563,17 @@ build=$build_alias
 host=$host_alias
 target=$target_alias
 
+# FIXME: should be removed in autoconf 3.0.
+if test "x$host_alias" != x; then
+  if test "x$build_alias" = x; then
+    cross_compiling=maybe
+    AC_MSG_WARN([Did you mean --build instead of --host?  Assuming you did.])
+    AC_MSG_WARN([If not, please specify both --build and --host.])
+  elif test "x$build_alias" != "x$host_alias"; then
+    cross_compiling=yes
+  fi
+fi
+
 ac_tool_prefix=
 test -n "$host_alias" && ac_tool_prefix=$host_alias-
 
@@ -2100,7 +2110,7 @@ AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
 #    configure --host=HOST --target=TARGET --build=BUILD
 #
 # The rules are:
-# 1. Build defaults to the current host, as determined by config.guess.
+# 1. Build defaults to the current platform, as determined by config.guess.
 # 2. Host defaults to build.
 # 3. Target defaults to host.
 
@@ -2149,7 +2159,7 @@ _AC_CANONICAL_SPLIT(build)
 AC_DEFUN_ONCE([AC_CANONICAL_HOST],
 [AC_REQUIRE([AC_CANONICAL_BUILD])dnl
 AC_DIVERT([HELP_CANON],
-[[  --host=HOST       cross-compile to build programs running on HOST [BUILD]]])dnl
+[[  --host=HOST       build programs to run on HOST [BUILD]]])dnl
 AC_CACHE_CHECK([host system type], [ac_cv_host],
 [ac_cv_host_alias=$host_alias
 test -z "$ac_cv_host_alias" &&
@@ -3234,7 +3244,7 @@ rm -f conftest*[]dnl
 #            [ACTION-IF-CROSS-COMPILING])
 # --------------------------------------------------------
 AC_DEFUN([AC_TRY_RUN],
-[if test $cross_compiling = yes; then
+[if test "$cross_compiling" = yes; then
   m4_default([$4],
    [AC_DIAGNOSE([cross],
             [AC_TRY_RUN called without default to allow cross compiling])dnl
@@ -3296,11 +3306,10 @@ AC_DEFUN([AC_CHECK_FILE],
 [AC_DIAGNOSE([cross],
              [Cannot check for file existence when cross compiling])dnl
 AC_VAR_PUSHDEF([ac_File], [ac_cv_file_$1])dnl
-dnl FIXME: why was there this line? AC_REQUIRE([AC_PROG_CC])dnl
 AC_CACHE_CHECK([for $1], ac_File,
-[test $cross_compiling = yes &&
+[test "$cross_compiling" = yes &&
   AC_MSG_ERROR([Cannot check for file existence when cross compiling])
-if test -r "[$1]"; then
+if test -r "$1"; then
   AC_VAR_SET(ac_File, yes)
 else
   AC_VAR_SET(ac_File, no)
index 5ed296b3047371704be64e9decc0bbeaf648c6d4..0ba41fbe2200c5a619f0d68b1ad4a17c4af9813f 100644 (file)
--- a/aclang.m4
+++ b/aclang.m4
@@ -472,11 +472,17 @@ define([_AC_LANG_COMPILER_WORKS],
 [AC_MSG_CHECKING([whether the _AC_LANG compiler works])
 AC_LINK_IFELSE([AC_LANG_PROGRAM()],
 [# If not cross compiling, check that we can run a simple program.
-if test $cross_compiling != yes; then
-  if AC_TRY_COMMAND(./conftest); then :; else
+if test "$cross_compiling" != yes; then
+  if AC_TRY_COMMAND(./conftest); then
+    cross_compiling=no
+  else
     AC_MSG_RESULT(no)
-    AC_MSG_ERROR([cannot run _AC_LANG compiled programs.
+    if test "$cross_compiling" = maybe; then
+      cross_compiling=yes
+    else
+      AC_MSG_ERROR([cannot run _AC_LANG compiled programs.
 To enable cross compilation, use `--host'.])
+    fi
   fi
 fi
 AC_MSG_RESULT(yes)],
index 360db49c6a5cd23f6b0a4d206e66f8701da1686c..6bc99ec0ac7dabb970a032d56d59f8056f697d30 100644 (file)
@@ -6478,48 +6478,71 @@ command or symbols predefined by the C preprocessor.
 Alternately, the user can specify the system type with command line
 arguments to @code{configure}.  Doing so is necessary when
 cross-compiling.  In the most complex case of cross-compiling, three
-system types are involved.  The options to specify them are:
+system types are involved.  The options to specify them are@footnote{For
+backward compatibility, @code{configure} will accept a system type as an
+option by itself.  Such an option will override the defaults for build,
+host and target system types.  The following configure statement will
+configure a cross toolchain that will run on NetBSD/alpha but generate
+code for GNU Hurd/sparc, which is also the build platform.
+
+@example
+./configure --host=alpha-netbsd sparc-gnu
+@end example
+}:
 
 @table @option
 @item --build=@var{build-type}
 the type of system on which the package is being configured and
-compiled (rarely needed).
+compiled.
 
 @item --host=@var{host-type}
 @ovindex cross_compiling
-the type of system on which the package will run.  When this option is
-specified, @command{configure} enters the cross compilation mode
-(@code{cross_compiling} is set @samp{yes} instead of @samp{no}), i.e.,
-it can compile and link, but cannot run compiled programs to check the
-host system features.
+the type of system on which the package will run.
 
 @item --target=@var{target-type}
 the type of system for which any compiler tools in the package will
-produce code (rarely needed).
+produce code (rarely needed).  By default, it is the same as host.
 @end table
 
-By default, the build system type is guessed (by @code{config.guess}),
-the host system is the build system, and the target is the host system.
+They all default to the result of running @code{config.guess}, unless
+you specify either @samp{--build} or @samp{--host}.  In this case, the
+default becomes the system type you specified.  If you specify both, and
+they're different, @code{configure} will enter cross compilation mode,
+so it won't run any tests that require execution.
 
-Using @option{--host=@var{host-type}} enables cross-compilation.
-line, e.g.,
+Hint: if you mean to override the result of @code{config.guess}, prefer
+@samp{--build} over @samp{--host}.  In the future, @samp{--host} will
+not override the name of the build system type.  Also, when you specify
+@samp{--host}, but not @samp{--build}, when @code{configure} performs
+the first compiler test, it will try to run an executable produced by
+the compiler.  If the execution fails, it will enter cross compilation
+mode.  Note, however, that it won't guess the build system type, since
+this may require running test programs.  Moreover, by the time the
+compiler test is performed, it may be too late to modify the build
+system type: other tests may have already been performed.  Therefore,
+whenever you specify @code{--host}, be sure to specify @code{--build}
+too.
 
 @example
-./configure --host=m68k-coff
+./configure --build=i686-pc-linux-gnu --host=m68k-coff
 @end example
 
 @noindent
-but @code{configure} will fail with unexpected cross-compilers:
+will enter cross compilation mode, but @code{configure} will fail if it
+can't run the code generated by the specified compiler if you configure
+as follows:
 
 @example
 ./configure CC=m68k-coff-gcc
 @end example
 
 @code{configure} recognizes short aliases for many system types; for
-example, @samp{decstation} can be given on the command line instead of
+example, @samp{decstation} can be used instead of
 @samp{mips-dec-ultrix4.2}.  @code{configure} runs a script called
 @code{config.sub} to canonicalize system type aliases.
 
+
+
 @node Canonicalizing, Using System Type, Specifying Names, Manual Configuration
 @section Getting the Canonical System Type
 
@@ -6576,6 +6599,12 @@ three individual parts @code{host_cpu}, @code{host_vendor}, and
 If @samp{--host} was specified, then @code{host} is the
 canonicalization of @code{host_alias} by @command{config.sub},
 otherwise it defaults to @code{build}.
+
+For temporary backward-compatibility, when @samp{--host} is specified
+by @samp{--build} isn't, the build system will be assumed to be the
+same as @samp{--host}, and @samp{build_alias} will be set to that
+value.  Eventually, this historically incorrect behavior will go away.
+
 @end defmac
 
 @defmac AC_CANONICAL_TARGET
index a10c3528eac27a350866c6856645108f99c45512..77b491709ed0c52b2d583d97586be01c4eca9531 100644 (file)
@@ -150,7 +150,7 @@ There may be some features @code{configure} cannot figure out
 automatically, but needs to determine by the type of host the package
 will run on.  Usually @code{configure} can figure that out, but if it
 prints a message saying it cannot guess the host type, give it the
-@option{--host=@var{type}} option.  @var{type} can either be a short
+@option{--build=@var{type}} option.  @var{type} can either be a short
 name for the system type, such as @samp{sun4}, or a canonical name which
 has the form:
 
@@ -170,9 +170,18 @@ See the file @file{config.sub} for the possible values of each field.
 If @file{config.sub} isn't included in this package, then this package
 doesn't need to know the host type.
 
-If you are building compiler tools for cross-compiling, you can also use
-the @option{--target=@var{type}} option to select the type of system they
-will produce code for.
+If you are @emph{building} compiler tools for cross-compiling, you can
+also use the @option{--target=@var{type}} option to select the type of
+system they will produce code for.
+
+If you want to @emph{use} a cross compiler, that generates code for a
+platform different from the build platform, you should specify the host
+platform (i.e., that on which the generated programs will eventually be
+run) with @option{--host=@var{type}}.  In this case, you should also
+specify the build platform with @option{--build=@var{type}}, because, in
+this case, it may not be possible to guess the build platform (it
+sometimes involves compiling and running simple test programs, and this
+can't be done if the compiler is a cross compiler).
 
 @node Sharing Defaults
 @section Sharing Defaults
index 5ed296b3047371704be64e9decc0bbeaf648c6d4..0ba41fbe2200c5a619f0d68b1ad4a17c4af9813f 100644 (file)
@@ -472,11 +472,17 @@ define([_AC_LANG_COMPILER_WORKS],
 [AC_MSG_CHECKING([whether the _AC_LANG compiler works])
 AC_LINK_IFELSE([AC_LANG_PROGRAM()],
 [# If not cross compiling, check that we can run a simple program.
-if test $cross_compiling != yes; then
-  if AC_TRY_COMMAND(./conftest); then :; else
+if test "$cross_compiling" != yes; then
+  if AC_TRY_COMMAND(./conftest); then
+    cross_compiling=no
+  else
     AC_MSG_RESULT(no)
-    AC_MSG_ERROR([cannot run _AC_LANG compiled programs.
+    if test "$cross_compiling" = maybe; then
+      cross_compiling=yes
+    else
+      AC_MSG_ERROR([cannot run _AC_LANG compiled programs.
 To enable cross compilation, use `--host'.])
+    fi
   fi
 fi
 AC_MSG_RESULT(yes)],
index 5ed296b3047371704be64e9decc0bbeaf648c6d4..0ba41fbe2200c5a619f0d68b1ad4a17c4af9813f 100644 (file)
@@ -472,11 +472,17 @@ define([_AC_LANG_COMPILER_WORKS],
 [AC_MSG_CHECKING([whether the _AC_LANG compiler works])
 AC_LINK_IFELSE([AC_LANG_PROGRAM()],
 [# If not cross compiling, check that we can run a simple program.
-if test $cross_compiling != yes; then
-  if AC_TRY_COMMAND(./conftest); then :; else
+if test "$cross_compiling" != yes; then
+  if AC_TRY_COMMAND(./conftest); then
+    cross_compiling=no
+  else
     AC_MSG_RESULT(no)
-    AC_MSG_ERROR([cannot run _AC_LANG compiled programs.
+    if test "$cross_compiling" = maybe; then
+      cross_compiling=yes
+    else
+      AC_MSG_ERROR([cannot run _AC_LANG compiled programs.
 To enable cross compilation, use `--host'.])
+    fi
   fi
 fi
 AC_MSG_RESULT(yes)],
index 925ca2f7db2ff5b707ce582baceb6f52b6f7c10f..ae4a815ab0c2e5f79bec8aaf5242caa0867b05ac 100644 (file)
@@ -1329,10 +1329,8 @@ do
     ac_init_help=short ;;
 
   -host | --host | --hos | --ho)
-    cross_compiling=yes
     ac_prev=host_alias ;;
   -host=* | --host=* | --hos=* | --ho=*)
-    cross_compiling=yes
     host_alias=$ac_optarg ;;
 
   -includedir | --includedir | --includedi | --included | --include \
@@ -1531,6 +1529,7 @@ Try `configure --help' for more information.])
     export $ac_envvar ;;
 
   *)
+    # FIXME: should be removed in autoconf 3.0.
     AC_MSG_WARN([you should use --build, --host, --target])
     expr "x$ac_option" : "[.*[^a-zA-Z0-9.]]" >/dev/null &&
       AC_MSG_WARN([invalid host type: $ac_option])
@@ -1564,6 +1563,17 @@ build=$build_alias
 host=$host_alias
 target=$target_alias
 
+# FIXME: should be removed in autoconf 3.0.
+if test "x$host_alias" != x; then
+  if test "x$build_alias" = x; then
+    cross_compiling=maybe
+    AC_MSG_WARN([Did you mean --build instead of --host?  Assuming you did.])
+    AC_MSG_WARN([If not, please specify both --build and --host.])
+  elif test "x$build_alias" != "x$host_alias"; then
+    cross_compiling=yes
+  fi
+fi
+
 ac_tool_prefix=
 test -n "$host_alias" && ac_tool_prefix=$host_alias-
 
@@ -2100,7 +2110,7 @@ AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
 #    configure --host=HOST --target=TARGET --build=BUILD
 #
 # The rules are:
-# 1. Build defaults to the current host, as determined by config.guess.
+# 1. Build defaults to the current platform, as determined by config.guess.
 # 2. Host defaults to build.
 # 3. Target defaults to host.
 
@@ -2149,7 +2159,7 @@ _AC_CANONICAL_SPLIT(build)
 AC_DEFUN_ONCE([AC_CANONICAL_HOST],
 [AC_REQUIRE([AC_CANONICAL_BUILD])dnl
 AC_DIVERT([HELP_CANON],
-[[  --host=HOST       cross-compile to build programs running on HOST [BUILD]]])dnl
+[[  --host=HOST       build programs to run on HOST [BUILD]]])dnl
 AC_CACHE_CHECK([host system type], [ac_cv_host],
 [ac_cv_host_alias=$host_alias
 test -z "$ac_cv_host_alias" &&
@@ -3234,7 +3244,7 @@ rm -f conftest*[]dnl
 #            [ACTION-IF-CROSS-COMPILING])
 # --------------------------------------------------------
 AC_DEFUN([AC_TRY_RUN],
-[if test $cross_compiling = yes; then
+[if test "$cross_compiling" = yes; then
   m4_default([$4],
    [AC_DIAGNOSE([cross],
             [AC_TRY_RUN called without default to allow cross compiling])dnl
@@ -3296,11 +3306,10 @@ AC_DEFUN([AC_CHECK_FILE],
 [AC_DIAGNOSE([cross],
              [Cannot check for file existence when cross compiling])dnl
 AC_VAR_PUSHDEF([ac_File], [ac_cv_file_$1])dnl
-dnl FIXME: why was there this line? AC_REQUIRE([AC_PROG_CC])dnl
 AC_CACHE_CHECK([for $1], ac_File,
-[test $cross_compiling = yes &&
+[test "$cross_compiling" = yes &&
   AC_MSG_ERROR([Cannot check for file existence when cross compiling])
-if test -r "[$1]"; then
+if test -r "$1"; then
   AC_VAR_SET(ac_File, yes)
 else
   AC_VAR_SET(ac_File, no)
index 5ed296b3047371704be64e9decc0bbeaf648c6d4..0ba41fbe2200c5a619f0d68b1ad4a17c4af9813f 100644 (file)
@@ -472,11 +472,17 @@ define([_AC_LANG_COMPILER_WORKS],
 [AC_MSG_CHECKING([whether the _AC_LANG compiler works])
 AC_LINK_IFELSE([AC_LANG_PROGRAM()],
 [# If not cross compiling, check that we can run a simple program.
-if test $cross_compiling != yes; then
-  if AC_TRY_COMMAND(./conftest); then :; else
+if test "$cross_compiling" != yes; then
+  if AC_TRY_COMMAND(./conftest); then
+    cross_compiling=no
+  else
     AC_MSG_RESULT(no)
-    AC_MSG_ERROR([cannot run _AC_LANG compiled programs.
+    if test "$cross_compiling" = maybe; then
+      cross_compiling=yes
+    else
+      AC_MSG_ERROR([cannot run _AC_LANG compiled programs.
 To enable cross compilation, use `--host'.])
+    fi
   fi
 fi
 AC_MSG_RESULT(yes)],