]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Either we cross-compile the whole package, or we don't.
authorAkim Demaille <akim@epita.fr>
Fri, 19 May 2000 12:40:45 +0000 (12:40 +0000)
committerAkim Demaille <akim@epita.fr>
Fri, 19 May 2000 12:40:45 +0000 (12:40 +0000)
Using --host enables cross-compilation.

* acgeneral.m4 (_AC_INIT_PARSE_ARGS): `--host' enables cross
compilation.
(AC_CANONICAL_BUILD): The help string should explicitly mention
cross compilation.
* aclang.m4 (AC_LANG(C), AC_LANG(C++), AC_LANG(Fortran 77)): Don't
set `cross_compiling'.
(AC_PROG_CC, AC_PROG_CXX, AC_PROG_F77): Run your `WORK' partner
only if not cross-compiling.
(AC_PROG_CC_WORKS, AC_PROG_CXX_WORKS, AC_PROG_F77_WORKS):
If does not work, don't assume an implicit cross-compilation:
fail.
* doc/autoconf.texi: Adjust.

ChangeLog
NEWS
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 3d0db231cda3b566361b7af046b06f9956a7cd2e..c9a6e7b98b02098c567d9c4bcbe445f5c80818e7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2000-05-19  Akim Demaille  <akim@epita.fr>
+
+       Either we cross-compile the whole package, or we don't.
+       Using --host enables cross-compilation.
+
+       * acgeneral.m4 (_AC_INIT_PARSE_ARGS): `--host' enables cross
+       compilation.
+       (AC_CANONICAL_BUILD): The help string should explicitly mention
+       cross compilation.
+       * aclang.m4 (AC_LANG(C), AC_LANG(C++), AC_LANG(Fortran 77)): Don't
+       set `cross_compiling'.
+       (AC_PROG_CC, AC_PROG_CXX, AC_PROG_F77): Run your `WORK' partner
+       only if not cross-compiling.
+       (AC_PROG_CC_WORKS, AC_PROG_CXX_WORKS, AC_PROG_F77_WORKS):
+       If does not work, don't assume an implicit cross-compilation:
+       fail.
+       * doc/autoconf.texi: Adjust.
+
 2000-05-19  Akim Demaille  <akim@epita.fr>
 
        * acgeneral.m4 (AC_SHELL_UNSETENV, AC_SHELL_UNSET): Add the
diff --git a/NEWS b/NEWS
index 22b1b01ffd56b563e61f42866aa2a0ad6cf6d243..03c985a8e89dc150d0e20ee371d2d06ee423f2cc 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -52,6 +52,14 @@ test cases in this new frame work.
     ./configure ENV=VAR
   and then --recheck will work properly.  Variables declared with
   AC_ARG_VAR are also preserved.
+- cross-compilation
+  $build defaults to `config.guess`, $host to $build, and then $target
+  to $host.
+  Cross-compilation is a global status of the package, it no longer
+  depends upon the current language.
+  Cross compilation is enabled iff the user specified `--host'.
+  `configure' now fails if it can't run the executables it compiles,
+  unless cross-compilation is enabled.
 
 ** config.status
 - faster
index 951dbf69ab49817ed1c1d66fd5485794a2c4c52c..9bba944d3d7e21639e8ba5feb44c33c4ea01beb1 100644 (file)
@@ -478,7 +478,7 @@ $debug ||
 # Try to unset the env VAR, otherwise set it to
 # VALUE-IF-UNSET-NOT-SUPPORTED.  `ac_unset' must have been computed.
 define([AC_SHELL_UNSET],
-[$ac_unset $1 || test ${$1+set} != set || $1=$2])
+[$ac_unset $1 || test "${$1+set}" != set || $1=$2])
 
 
 # AC_SHELL_UNSETENV(VAR, [VALUE-IF-UNSET-NOT-SUPPORTED = `'])
@@ -486,7 +486,7 @@ define([AC_SHELL_UNSET],
 # Try to unset the env VAR, otherwise set it to
 # VALUE-IF-UNSET-NOT-SUPPORTED.  `ac_unset' must have been computed.
 define([AC_SHELL_UNSETENV],
-[$ac_unset $1 || test ${$1+set} != set || $1=$2 && export $1])
+[$ac_unset $1 || test "${$1+set}" != set || $1=$2 && export $1])
 
 
 ## --------------------------------------------------- ##
@@ -1063,8 +1063,10 @@ do
     ac_init_help=short ;;
 
   -host | --host | --hos | --ho)
+    cross_compiling=yes
     ac_prev=host ;;
   -host=* | --host=* | --hos=* | --ho=*)
+    cross_compiling=yes
     host=$ac_optarg ;;
 
   -includedir | --includedir | --includedi | --included | --include \
@@ -1879,7 +1881,7 @@ _AC_CANONICAL_THING(build)[]dnl
 AC_DEFUN_ONCE([AC_CANONICAL_HOST],
 [AC_REQUIRE([AC_CANONICAL_BUILD])dnl
 AC_DIVERT([HELP_CANON],
-[[  --host=HOST       configure for building programs running on HOST [BUILD]]])dnl
+[[  --host=HOST       cross-compile to build programs running on HOST [BUILD]]])dnl
 _AC_CANONICAL_THING(host)[]dnl
 ])# AC_CANONICAL_HOST
 
index 5a018fe3bb4e9de816f31e1e1817c88850f68b9b..998031b67492fa3b42e93911333f42cd5648e3bc 100644 (file)
--- a/aclang.m4
+++ b/aclang.m4
@@ -182,7 +182,6 @@ define([AC_LANG(C)],
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&AC_FD_LOG'
 ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
-cross_compiling=$ac_cv_prog_cc_cross
 ])
 
 
@@ -245,7 +244,6 @@ define([AC_LANG(C++)],
 ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&AC_FD_LOG'
 ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
-cross_compiling=$ac_cv_prog_cxx_cross
 ])
 
 
@@ -289,7 +287,6 @@ define([AC_LANG(Fortran 77)],
 [ac_ext=f
 ac_compile='${F77-f77} -c $FFLAGS conftest.$ac_ext >&AC_FD_LOG'
 ac_link='${F77-f77} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
-cross_compiling=$ac_cv_prog_f77_cross
 ])
 
 
@@ -399,7 +396,9 @@ ifval([$1],
 
 test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
 
-AC_PROG_CC_WORKS
+if test "$cross_compiling" != yes; then
+  AC_PROG_CC_WORKS
+fi
 AC_PROG_CC_GNU
 
 if test $ac_cv_prog_gcc = yes; then
@@ -447,7 +446,10 @@ if test $ac_cv_prog_cc_works = no; then
 fi
 AC_MSG_CHECKING([whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler])
 AC_MSG_RESULT($ac_cv_prog_cc_cross)
-cross_compiling=$ac_cv_prog_cc_cross
+if test $cross_compiling,$ac_cv_prog_cc_cross = no,yes; then
+  AC_MSG_ERROR([installation or configuration problem: cannot run C compiled programs.
+To enable cross compilation, use `--host'.])
+fi
 ])# AC_PROG_CC_WORKS
 
 
@@ -594,7 +596,9 @@ AC_DEFUN(AC_PROG_CXX,
 [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
 AC_CHECK_PROGS(CXX, $CCC m4_default([$1], [c++ g++ gpp CC cxx cc++ cl]), g++)
 
-AC_PROG_CXX_WORKS
+if test "$cross_compiling" != yes; then
+  AC_PROG_CXX_WORKS
+fi
 AC_PROG_CXX_GNU
 
 if test $ac_cv_prog_gxx = yes; then
@@ -642,7 +646,10 @@ if test $ac_cv_prog_cxx_works = no; then
 fi
 AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler])
 AC_MSG_RESULT($ac_cv_prog_cxx_cross)
-cross_compiling=$ac_cv_prog_cxx_cross
+if test $cross_compiling,$ac_cv_prog_cxx_cross = no,yes; then
+  AC_MSG_ERROR([installation or configuration problem: cannot run C++ compiled programs.
+To enable cross compilation, use `--host'.])
+fi
 ])# AC_PROG_CXX_WORKS
 
 
@@ -693,7 +700,9 @@ AC_DEFUN(AC_PROG_F77,
 AC_CHECK_PROGS(F77,
                m4_default([$1], [g77 f77 xlf cf77 fl32 fort77 f90 xlf90 f2c]))
 
-AC_PROG_F77_WORKS
+if test "$cross_compiling" != yes; then
+  AC_PROG_F77_WORKS
+fi
 AC_PROG_F77_GNU
 
 if test $ac_cv_prog_g77 = yes; then
@@ -739,7 +748,10 @@ if test $ac_cv_prog_f77_works = no; then
 fi
 AC_MSG_CHECKING([whether the Fortran 77 compiler ($F77 $FFLAGS $LDFLAGS) is a cross-compiler])
 AC_MSG_RESULT($ac_cv_prog_f77_cross)
-cross_compiling=$ac_cv_prog_f77_cross
+if test $cross_compiling,$ac_cv_prog_f77_cross = no,yes; then
+  AC_MSG_ERROR([installation or configuration problem: cannot run Fortran 77 compiled programs.
+To enable cross compilation, use `--host'.])
+fi
 ])# AC_PROG_F77_WORKS
 
 
index 1eafe58600bb2ca7cebbaa00c134531edaf4e40e..55bafdc2c088c7b51badfbdbe5ed134c09c4ce1d 100644 (file)
@@ -405,8 +405,8 @@ reason, it needs to be changed in only one place; all of the
 configuration scripts can be regenerated automatically to take advantage
 of the updated code.
 
-The Metaconfig package is similar in purpose to Autoconf, but
-the scripts it produces require manual user intervention, which is quite
+The Metaconfig package is similar in purpose to Autoconf, but the
+scripts it produces require manual user intervention, which is quite
 inconvenient when configuring large source trees.  Unlike Metaconfig
 scripts, Autoconf scripts can support cross-compiling, if some care is
 taken in writing them.
@@ -2358,13 +2358,9 @@ already set, set it to @samp{-g -O2} for the @sc{gnu} C compiler
 (@samp{-O2} on systems where GCC does not accept @samp{-g}), or
 @samp{-g} for other compilers.
 
-If the C compiler being used does not produce executables that can run
-on the system where @code{configure} is being run, set the shell
-variable @code{cross_compiling} to @samp{yes}, otherwise @samp{no}.  In
-other words, this tests whether the build system type is different from
-the host system type (the target system type is irrelevant to this
-test).  @xref{Manual Configuration}, for more on support for cross
-compiling.
+If the compiler being used does not produce executables, fail.  If the
+executables can't be run, and cross-compilation is not enabled, fail.
+@xref{Manual Configuration}, for more on support for cross compiling.
 @end defmac
 
 @defmac AC_PROG_CC_C_O
@@ -2440,13 +2436,9 @@ already set, set it to @samp{-g -O2} for the @sc{gnu} C++ compiler
 (@samp{-O2} on systems where G++ does not accept @samp{-g}), or
 @samp{-g} for other compilers.
 
-If the C++ compiler being used does not produce executables that can run
-on the system where @code{configure} is being run, set the shell
-variable @code{cross_compiling} to @samp{yes}, otherwise @samp{no}.  In
-other words, this tests whether the build system type is different from
-the host system type (the target system type is irrelevant to this
-test).  @xref{Manual Configuration}, for more on support for cross
-compiling.
+If the compiler being used does not produce executables, fail.  If the
+executables can't be run, and cross-compilation is not enabled, fail.
+@xref{Manual Configuration}, for more on support for cross compiling.
 @end defmac
 
 @defmac AC_PROG_CXXCPP
@@ -2491,6 +2483,10 @@ already set in the environment, then set it to @samp{-g -02} for
 @code{g77} (or @samp{-O2} where @code{g77} does not accept @samp{-g}).
 Otherwise, set @code{FFLAGS} to @samp{-g} for all other Fortran 77
 compilers.
+
+If the compiler being used does not produce executables, fail.  If the
+executables can't be run, and cross-compilation is not enabled, fail.
+@xref{Manual Configuration}, for more on support for cross compiling.
 @end defmac
 
 @defmac AC_PROG_F77_C_O
@@ -3072,9 +3068,9 @@ functions is not found.
 
 Autoconf follows a philosophy which was hammered along the years by the
 people who fought for portability: isolate the portability issues in
-specific files, and program as if you were on a @sc{posix} host.  Some
-functions cannot be repaired or are completely missing, your package
-must be ready to replace them.
+specific files, and program as if you were in a @sc{posix} environment.
+Some functions cannot be repaired or are completely missing, your
+package must be ready to replace them.
 
 Use the two following macros to specify the function which might be
 replaced, and use the third one to check and replace a function if
@@ -4410,7 +4406,7 @@ distributed with Autoconf produce this warning message.
 To configure for cross-compiling you can also choose a value for those
 parameters based on the canonical system name (@pxref{Manual
 Configuration}).  Alternatively, set up a test results cache file with
-the correct values for the target system (@pxref{Caching Results}).
+the correct values for the host system (@pxref{Caching Results}).
 
 To provide a default for calls of @code{AC_TRY_RUN} that are embedded in
 other macros, including a few of the ones that come with Autoconf, you
@@ -4727,13 +4723,9 @@ is nonportable.  If you combine @samp{&&} and @samp{||} in the same
 statement, keep in mind that they have equal precedence.
 
 @item @command{test} (files)
-@c FIXME: Hm, I'd say the sentence should be
-@c  To enable @code{configure} scripts to support cross-compilation, they
-@c  shouldn't do anything that tests features of the build system instead of
-@c  the host system.
 To enable @code{configure} scripts to support cross-compilation, they
-shouldn't do anything that tests features of the host system instead of
-the target system.  But occasionally you may find it necessary to check
+shouldn't do anything that tests features of the build system instead of
+the host system.  But occasionally you may find it necessary to check
 whether some arbitrary file exists.  To do so, use @samp{test -f} or
 @samp{test -r}.  Do not use @samp{test -x}, because @sc{4.3bsd} does not
 have it.
@@ -5980,6 +5972,14 @@ for the system type, which has the form:
 @var{cpu}-@var{company}-@var{system}
 @end example
 
+@noindent
+where @var{system} can have one of these forms:
+
+@example
+@var{os}
+@var{kernel}-@var{os}
+@end example
+
 @code{configure} can usually guess the canonical name for the type of
 system it's running on.  To do so it runs a script called
 @code{config.guess}, which derives the name using the @code{uname}
@@ -6003,15 +6003,23 @@ the type of system for which any compiler tools in the package will
 produce code.
 @end table
 
-By default, the build is guessed (by @code{config.guess}), the host
-system is the build system, and the target is the host system.
+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.
+
+Using @samp{--host=@var{host-type}} enables cross-compilation to
+@var{host-type}.  You still have to specify the names of the cross-tools
+you use, in particular the C compiler, on the @code{configure} command
+line, e.g.,
+
+@example
+./configure --host=m68k-coff CC=m68k-coff-gcc
+@end example
 
-If you are cross-compiling, you still have to specify the names of the
-cross-tools you use, in particular the C compiler, on the
-@code{configure} command line, e.g.,
+@noindent
+but @code{configure} will fail with unexpected cross-compilers:
 
 @example
-./configure --target=m68k-coff CC=m68k-coff-gcc
+./configure CC=m68k-coff-gcc
 @end example
 
 @code{configure} recognizes short aliases for many system types; for
@@ -6061,9 +6069,8 @@ run on a machine, but work on binaries from another machine.
 
 @defmac AC_VALIDATE_CACHED_SYSTEM_TUPLE (@var{cmd})
 @maindex VALIDATE_CACHED_SYSTEM_TUPLE
-If the cache file is inconsistent with the current host,
-target and build system types, execute @var{cmd} or print a default
-error message.
+If the cache file is inconsistent with the current host, target and
+build system types, execute @var{cmd} or print a default error message.
 @end defmac
 
 @node System Type Variables, Using System Type, Canonicalizing, Manual Configuration
index eab8e93dab851d5acd8bb91e122d951b612b7c3c..88eb5b69a7f8be6bccd8468a1d8bc28de04c1531 100644 (file)
@@ -148,21 +148,28 @@ 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
 @samp{--host=@var{type}} option.  @var{type} can either be a short name
-for the system type, such as @samp{sun4}, or a canonical name with three
-fields:
+for the system type, such as @samp{sun4}, or a canonical name which has
+the form:
+
 @example
 @var{cpu}-@var{company}-@var{system}
-@var{cpu}-@var{company}-@var{kernel}-@var{system}
 @end example
+
 @noindent
+where @var{system} can have one of these forms:
+
+@example
+@var{os}
+@var{kernel}-@var{os}
+@end example
+
 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 @samp{--target=@var{type}} option to select the type of system they
-will produce code for and the @samp{--build=@var{type}} option to select
-the type of system on which you are compiling the package.
+will produce code for.
 
 @node Sharing Defaults
 @section Sharing Defaults
index 5a018fe3bb4e9de816f31e1e1817c88850f68b9b..998031b67492fa3b42e93911333f42cd5648e3bc 100644 (file)
@@ -182,7 +182,6 @@ define([AC_LANG(C)],
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&AC_FD_LOG'
 ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
-cross_compiling=$ac_cv_prog_cc_cross
 ])
 
 
@@ -245,7 +244,6 @@ define([AC_LANG(C++)],
 ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&AC_FD_LOG'
 ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
-cross_compiling=$ac_cv_prog_cxx_cross
 ])
 
 
@@ -289,7 +287,6 @@ define([AC_LANG(Fortran 77)],
 [ac_ext=f
 ac_compile='${F77-f77} -c $FFLAGS conftest.$ac_ext >&AC_FD_LOG'
 ac_link='${F77-f77} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
-cross_compiling=$ac_cv_prog_f77_cross
 ])
 
 
@@ -399,7 +396,9 @@ ifval([$1],
 
 test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
 
-AC_PROG_CC_WORKS
+if test "$cross_compiling" != yes; then
+  AC_PROG_CC_WORKS
+fi
 AC_PROG_CC_GNU
 
 if test $ac_cv_prog_gcc = yes; then
@@ -447,7 +446,10 @@ if test $ac_cv_prog_cc_works = no; then
 fi
 AC_MSG_CHECKING([whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler])
 AC_MSG_RESULT($ac_cv_prog_cc_cross)
-cross_compiling=$ac_cv_prog_cc_cross
+if test $cross_compiling,$ac_cv_prog_cc_cross = no,yes; then
+  AC_MSG_ERROR([installation or configuration problem: cannot run C compiled programs.
+To enable cross compilation, use `--host'.])
+fi
 ])# AC_PROG_CC_WORKS
 
 
@@ -594,7 +596,9 @@ AC_DEFUN(AC_PROG_CXX,
 [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
 AC_CHECK_PROGS(CXX, $CCC m4_default([$1], [c++ g++ gpp CC cxx cc++ cl]), g++)
 
-AC_PROG_CXX_WORKS
+if test "$cross_compiling" != yes; then
+  AC_PROG_CXX_WORKS
+fi
 AC_PROG_CXX_GNU
 
 if test $ac_cv_prog_gxx = yes; then
@@ -642,7 +646,10 @@ if test $ac_cv_prog_cxx_works = no; then
 fi
 AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler])
 AC_MSG_RESULT($ac_cv_prog_cxx_cross)
-cross_compiling=$ac_cv_prog_cxx_cross
+if test $cross_compiling,$ac_cv_prog_cxx_cross = no,yes; then
+  AC_MSG_ERROR([installation or configuration problem: cannot run C++ compiled programs.
+To enable cross compilation, use `--host'.])
+fi
 ])# AC_PROG_CXX_WORKS
 
 
@@ -693,7 +700,9 @@ AC_DEFUN(AC_PROG_F77,
 AC_CHECK_PROGS(F77,
                m4_default([$1], [g77 f77 xlf cf77 fl32 fort77 f90 xlf90 f2c]))
 
-AC_PROG_F77_WORKS
+if test "$cross_compiling" != yes; then
+  AC_PROG_F77_WORKS
+fi
 AC_PROG_F77_GNU
 
 if test $ac_cv_prog_g77 = yes; then
@@ -739,7 +748,10 @@ if test $ac_cv_prog_f77_works = no; then
 fi
 AC_MSG_CHECKING([whether the Fortran 77 compiler ($F77 $FFLAGS $LDFLAGS) is a cross-compiler])
 AC_MSG_RESULT($ac_cv_prog_f77_cross)
-cross_compiling=$ac_cv_prog_f77_cross
+if test $cross_compiling,$ac_cv_prog_f77_cross = no,yes; then
+  AC_MSG_ERROR([installation or configuration problem: cannot run Fortran 77 compiled programs.
+To enable cross compilation, use `--host'.])
+fi
 ])# AC_PROG_F77_WORKS
 
 
index 5a018fe3bb4e9de816f31e1e1817c88850f68b9b..998031b67492fa3b42e93911333f42cd5648e3bc 100644 (file)
@@ -182,7 +182,6 @@ define([AC_LANG(C)],
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&AC_FD_LOG'
 ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
-cross_compiling=$ac_cv_prog_cc_cross
 ])
 
 
@@ -245,7 +244,6 @@ define([AC_LANG(C++)],
 ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&AC_FD_LOG'
 ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
-cross_compiling=$ac_cv_prog_cxx_cross
 ])
 
 
@@ -289,7 +287,6 @@ define([AC_LANG(Fortran 77)],
 [ac_ext=f
 ac_compile='${F77-f77} -c $FFLAGS conftest.$ac_ext >&AC_FD_LOG'
 ac_link='${F77-f77} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
-cross_compiling=$ac_cv_prog_f77_cross
 ])
 
 
@@ -399,7 +396,9 @@ ifval([$1],
 
 test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
 
-AC_PROG_CC_WORKS
+if test "$cross_compiling" != yes; then
+  AC_PROG_CC_WORKS
+fi
 AC_PROG_CC_GNU
 
 if test $ac_cv_prog_gcc = yes; then
@@ -447,7 +446,10 @@ if test $ac_cv_prog_cc_works = no; then
 fi
 AC_MSG_CHECKING([whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler])
 AC_MSG_RESULT($ac_cv_prog_cc_cross)
-cross_compiling=$ac_cv_prog_cc_cross
+if test $cross_compiling,$ac_cv_prog_cc_cross = no,yes; then
+  AC_MSG_ERROR([installation or configuration problem: cannot run C compiled programs.
+To enable cross compilation, use `--host'.])
+fi
 ])# AC_PROG_CC_WORKS
 
 
@@ -594,7 +596,9 @@ AC_DEFUN(AC_PROG_CXX,
 [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
 AC_CHECK_PROGS(CXX, $CCC m4_default([$1], [c++ g++ gpp CC cxx cc++ cl]), g++)
 
-AC_PROG_CXX_WORKS
+if test "$cross_compiling" != yes; then
+  AC_PROG_CXX_WORKS
+fi
 AC_PROG_CXX_GNU
 
 if test $ac_cv_prog_gxx = yes; then
@@ -642,7 +646,10 @@ if test $ac_cv_prog_cxx_works = no; then
 fi
 AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler])
 AC_MSG_RESULT($ac_cv_prog_cxx_cross)
-cross_compiling=$ac_cv_prog_cxx_cross
+if test $cross_compiling,$ac_cv_prog_cxx_cross = no,yes; then
+  AC_MSG_ERROR([installation or configuration problem: cannot run C++ compiled programs.
+To enable cross compilation, use `--host'.])
+fi
 ])# AC_PROG_CXX_WORKS
 
 
@@ -693,7 +700,9 @@ AC_DEFUN(AC_PROG_F77,
 AC_CHECK_PROGS(F77,
                m4_default([$1], [g77 f77 xlf cf77 fl32 fort77 f90 xlf90 f2c]))
 
-AC_PROG_F77_WORKS
+if test "$cross_compiling" != yes; then
+  AC_PROG_F77_WORKS
+fi
 AC_PROG_F77_GNU
 
 if test $ac_cv_prog_g77 = yes; then
@@ -739,7 +748,10 @@ if test $ac_cv_prog_f77_works = no; then
 fi
 AC_MSG_CHECKING([whether the Fortran 77 compiler ($F77 $FFLAGS $LDFLAGS) is a cross-compiler])
 AC_MSG_RESULT($ac_cv_prog_f77_cross)
-cross_compiling=$ac_cv_prog_f77_cross
+if test $cross_compiling,$ac_cv_prog_f77_cross = no,yes; then
+  AC_MSG_ERROR([installation or configuration problem: cannot run Fortran 77 compiled programs.
+To enable cross compilation, use `--host'.])
+fi
 ])# AC_PROG_F77_WORKS
 
 
index 951dbf69ab49817ed1c1d66fd5485794a2c4c52c..9bba944d3d7e21639e8ba5feb44c33c4ea01beb1 100644 (file)
@@ -478,7 +478,7 @@ $debug ||
 # Try to unset the env VAR, otherwise set it to
 # VALUE-IF-UNSET-NOT-SUPPORTED.  `ac_unset' must have been computed.
 define([AC_SHELL_UNSET],
-[$ac_unset $1 || test ${$1+set} != set || $1=$2])
+[$ac_unset $1 || test "${$1+set}" != set || $1=$2])
 
 
 # AC_SHELL_UNSETENV(VAR, [VALUE-IF-UNSET-NOT-SUPPORTED = `'])
@@ -486,7 +486,7 @@ define([AC_SHELL_UNSET],
 # Try to unset the env VAR, otherwise set it to
 # VALUE-IF-UNSET-NOT-SUPPORTED.  `ac_unset' must have been computed.
 define([AC_SHELL_UNSETENV],
-[$ac_unset $1 || test ${$1+set} != set || $1=$2 && export $1])
+[$ac_unset $1 || test "${$1+set}" != set || $1=$2 && export $1])
 
 
 ## --------------------------------------------------- ##
@@ -1063,8 +1063,10 @@ do
     ac_init_help=short ;;
 
   -host | --host | --hos | --ho)
+    cross_compiling=yes
     ac_prev=host ;;
   -host=* | --host=* | --hos=* | --ho=*)
+    cross_compiling=yes
     host=$ac_optarg ;;
 
   -includedir | --includedir | --includedi | --included | --include \
@@ -1879,7 +1881,7 @@ _AC_CANONICAL_THING(build)[]dnl
 AC_DEFUN_ONCE([AC_CANONICAL_HOST],
 [AC_REQUIRE([AC_CANONICAL_BUILD])dnl
 AC_DIVERT([HELP_CANON],
-[[  --host=HOST       configure for building programs running on HOST [BUILD]]])dnl
+[[  --host=HOST       cross-compile to build programs running on HOST [BUILD]]])dnl
 _AC_CANONICAL_THING(host)[]dnl
 ])# AC_CANONICAL_HOST
 
index 5a018fe3bb4e9de816f31e1e1817c88850f68b9b..998031b67492fa3b42e93911333f42cd5648e3bc 100644 (file)
@@ -182,7 +182,6 @@ define([AC_LANG(C)],
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&AC_FD_LOG'
 ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
-cross_compiling=$ac_cv_prog_cc_cross
 ])
 
 
@@ -245,7 +244,6 @@ define([AC_LANG(C++)],
 ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&AC_FD_LOG'
 ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
-cross_compiling=$ac_cv_prog_cxx_cross
 ])
 
 
@@ -289,7 +287,6 @@ define([AC_LANG(Fortran 77)],
 [ac_ext=f
 ac_compile='${F77-f77} -c $FFLAGS conftest.$ac_ext >&AC_FD_LOG'
 ac_link='${F77-f77} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AC_FD_LOG'
-cross_compiling=$ac_cv_prog_f77_cross
 ])
 
 
@@ -399,7 +396,9 @@ ifval([$1],
 
 test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
 
-AC_PROG_CC_WORKS
+if test "$cross_compiling" != yes; then
+  AC_PROG_CC_WORKS
+fi
 AC_PROG_CC_GNU
 
 if test $ac_cv_prog_gcc = yes; then
@@ -447,7 +446,10 @@ if test $ac_cv_prog_cc_works = no; then
 fi
 AC_MSG_CHECKING([whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler])
 AC_MSG_RESULT($ac_cv_prog_cc_cross)
-cross_compiling=$ac_cv_prog_cc_cross
+if test $cross_compiling,$ac_cv_prog_cc_cross = no,yes; then
+  AC_MSG_ERROR([installation or configuration problem: cannot run C compiled programs.
+To enable cross compilation, use `--host'.])
+fi
 ])# AC_PROG_CC_WORKS
 
 
@@ -594,7 +596,9 @@ AC_DEFUN(AC_PROG_CXX,
 [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
 AC_CHECK_PROGS(CXX, $CCC m4_default([$1], [c++ g++ gpp CC cxx cc++ cl]), g++)
 
-AC_PROG_CXX_WORKS
+if test "$cross_compiling" != yes; then
+  AC_PROG_CXX_WORKS
+fi
 AC_PROG_CXX_GNU
 
 if test $ac_cv_prog_gxx = yes; then
@@ -642,7 +646,10 @@ if test $ac_cv_prog_cxx_works = no; then
 fi
 AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler])
 AC_MSG_RESULT($ac_cv_prog_cxx_cross)
-cross_compiling=$ac_cv_prog_cxx_cross
+if test $cross_compiling,$ac_cv_prog_cxx_cross = no,yes; then
+  AC_MSG_ERROR([installation or configuration problem: cannot run C++ compiled programs.
+To enable cross compilation, use `--host'.])
+fi
 ])# AC_PROG_CXX_WORKS
 
 
@@ -693,7 +700,9 @@ AC_DEFUN(AC_PROG_F77,
 AC_CHECK_PROGS(F77,
                m4_default([$1], [g77 f77 xlf cf77 fl32 fort77 f90 xlf90 f2c]))
 
-AC_PROG_F77_WORKS
+if test "$cross_compiling" != yes; then
+  AC_PROG_F77_WORKS
+fi
 AC_PROG_F77_GNU
 
 if test $ac_cv_prog_g77 = yes; then
@@ -739,7 +748,10 @@ if test $ac_cv_prog_f77_works = no; then
 fi
 AC_MSG_CHECKING([whether the Fortran 77 compiler ($F77 $FFLAGS $LDFLAGS) is a cross-compiler])
 AC_MSG_RESULT($ac_cv_prog_f77_cross)
-cross_compiling=$ac_cv_prog_f77_cross
+if test $cross_compiling,$ac_cv_prog_f77_cross = no,yes; then
+  AC_MSG_ERROR([installation or configuration problem: cannot run Fortran 77 compiled programs.
+To enable cross compilation, use `--host'.])
+fi
 ])# AC_PROG_F77_WORKS