This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
[patch] build vs. host confusion
- To: egcs at cygnus dot com
- Subject: [patch] build vs. host confusion
- From: Bruno Haible <haible at ilog dot fr>
- Date: Mon, 2 Mar 1998 15:46:58 +0100 (MET)
Hi,
The egcs configuration differs in two points from its documentation (the file
INSTALL and the info files).
1. When configured as
./configure --build=i486-linuxlibc1
it installs into $(prefix)/lib/gcc-lib/i486-pc-linux-gnulibc1/
instead of into $(prefix)/lib/gcc-lib/i486-linuxlibc1/
2. The TARGET and BUILD values default from HOST. The doc says (and this
makes much more sense) that the TARGET and HOST values default from
BUILD.
The confusion comes from the autoconf macro AC_CANONICAL_SYSTEM, which
was designed for programs which know only about HOST and TARGET.
Here is a fix to both.
Sat Feb 28 22:30:13 1998 Bruno Haible <bruno@linuix.mathematik.uni-karlsruhe.de>
* aclocal.m4 (GCC_CANONICAL_SYSTEM): New macro.
* configure.in: Use it.
*** egcs-980214/gcc/configure.in.bak Sun Feb 22 10:34:03 1998
--- egcs-980214/gcc/configure.in Sat Feb 28 22:14:59 1998
***************
*** 123,130 ****
;;
esac
! # Determine the host, build, and target systems
! AC_CANONICAL_SYSTEM
# Find the native compiler
AC_PROG_CC
--- 123,130 ----
;;
esac
! # Determine the build, host, and target systems
! GCC_CANONICAL_SYSTEM
# Find the native compiler
AC_PROG_CC
*** egcs-980214/gcc/aclocal.m4.bak Sun Feb 22 10:33:34 1998
--- egcs-980214/gcc/aclocal.m4 Sat Feb 28 22:12:29 1998
***************
*** 1,3 ****
--- 1,139 ----
+ dnl Canonicalize the build, host, and target system types.
+ dnl The original autoconf macro AC_CANONICAL_SYSTEM determines HOST from
+ dnl config.guess, and has TARGET and BUILD default from HOST.
+ dnl GCC needs to determine BUILD from config.guess, and have HOST and TARGET
+ dnl default from BUILD.
+ AC_DEFUN(GCC_CANONICAL_SYSTEM,
+ [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
+ AC_BEFORE([$0], [AC_ARG_PROGRAM])
+ # Do some error checking and defaulting for the host and target type.
+ # The inputs are:
+ # configure --build=BUILD --host=HOST --target=TARGET NONOPT
+ #
+ # The rules are:
+ # 1. You are not allowed to specify --host, --target, and nonopt at the
+ # same time.
+ # 2. Build defaults to nonopt.
+ # 3. If nonopt is not specified, then build defaults to the current host,
+ # as determined by config.guess.
+ # 4. Target and host default to nonopt.
+ # 5. If nonopt is not specified, then target and host default to build.
+
+ # The aliases save the names the user supplied, while $host etc.
+ # will get canonicalized.
+ case $host---$target---$nonopt in
+ NONE---*---* | *---NONE---* | *---*---NONE) ;;
+ *) AC_MSG_ERROR(can only configure for one host and one target at a time) ;;
+ esac
+
+ GCC_CANONICAL_BUILD
+ GCC_CANONICAL_HOST
+ GCC_CANONICAL_TARGET
+ test "$host_alias" != "$target_alias" &&
+ test "$program_prefix$program_suffix$program_transform_name" = \
+ NONENONEs,x,x, &&
+ program_prefix=${target_alias}-
+ ])
+
+ dnl Subroutines of GCC_CANONICAL_SYSTEM.
+
+ AC_DEFUN(GCC_CANONICAL_BUILD,
+ [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
+
+ # Make sure we can run config.sub.
+ if $ac_config_sub sun4 >/dev/null 2>&1; then :
+ else AC_MSG_ERROR(can not run $ac_config_sub)
+ fi
+
+ AC_MSG_CHECKING(build system type)
+
+ dnl Set build_alias.
+ build_alias=$build
+ case "$build_alias" in
+ NONE)
+ case $nonopt in
+ NONE)
+ if build_alias=`$ac_config_guess`; then :
+ else AC_MSG_ERROR(can not guess build type; you must specify one)
+ fi ;;
+ *) build_alias=$nonopt ;;
+ esac ;;
+ esac
+
+ dnl Set the other build vars.
+ changequote(<<, >>)dnl
+ build=`$ac_config_sub $build_alias`
+ build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+ build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+ build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+ changequote([, ])dnl
+ AC_MSG_RESULT($build)
+ AC_SUBST(build)dnl
+ AC_SUBST(build_alias)dnl
+ AC_SUBST(build_cpu)dnl
+ AC_SUBST(build_vendor)dnl
+ AC_SUBST(build_os)dnl
+ ])
+
+ AC_DEFUN(GCC_CANONICAL_HOST,
+ [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
+ AC_MSG_CHECKING(host system type)
+
+ dnl Set host_alias.
+ host_alias=$host
+ case "$host_alias" in
+ NONE)
+ case $nonopt in
+ NONE) host_alias=$build_alias ;;
+ *) host_alias=$nonopt ;;
+ esac ;;
+ esac
+
+ dnl Set the other host vars.
+ changequote(<<, >>)dnl
+ host=`$ac_config_sub $host_alias`
+ host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+ host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+ changequote([, ])dnl
+ AC_MSG_RESULT($host)
+ AC_SUBST(host)dnl
+ AC_SUBST(host_alias)dnl
+ AC_SUBST(host_cpu)dnl
+ AC_SUBST(host_vendor)dnl
+ AC_SUBST(host_os)dnl
+ ])
+
+ AC_DEFUN(GCC_CANONICAL_TARGET,
+ [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
+ AC_MSG_CHECKING(target system type)
+
+ dnl Set target_alias.
+ target_alias=$target
+ case "$target_alias" in
+ NONE)
+ case $nonopt in
+ NONE) target_alias=$build_alias ;;
+ *) target_alias=$nonopt ;;
+ esac ;;
+ esac
+
+ dnl Set the other target vars.
+ changequote(<<, >>)dnl
+ target=`$ac_config_sub $target_alias`
+ target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+ target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+ changequote([, ])dnl
+ AC_MSG_RESULT($target)
+ AC_SUBST(target)dnl
+ AC_SUBST(target_alias)dnl
+ AC_SUBST(target_cpu)dnl
+ AC_SUBST(target_vendor)dnl
+ AC_SUBST(target_os)dnl
+ ])
+
+
dnl See whether we need a declaration for a function.
AC_DEFUN(GCC_NEED_DECLARATION,
[AC_MSG_CHECKING([whether $1 must be declared])