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>
+
+ 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
./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
# 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 = `'])
# 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])
## --------------------------------------------------- ##
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 \
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
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
])
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
])
[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
])
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
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
[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
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
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
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
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.
(@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
(@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
@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
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
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
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.
@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}
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
@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
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
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
])
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
])
[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
])
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
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
[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
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
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
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
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
])
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
])
[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
])
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
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
[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
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
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
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
# 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 = `'])
# 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])
## --------------------------------------------------- ##
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 \
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
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
])
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
])
[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
])
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
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
[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
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
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
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