From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4672 invoked by alias); 11 Feb 2003 20:17:57 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 4501 invoked from network); 11 Feb 2003 20:17:56 -0000 Received: from unknown (HELO ms-smtp-03.nyroc.rr.com) (24.92.226.153) by 172.16.49.205 with SMTP; 11 Feb 2003 20:17:56 -0000 Received: from doctormoo (syr-24-24-17-145.twcny.rr.com [24.24.17.145]) by ms-smtp-03.nyroc.rr.com (8.12.5/8.12.2) with ESMTP id h1BKHsbF005077; Tue, 11 Feb 2003 15:17:54 -0500 (EST) Received: from neroden by doctormoo with local (Exim 3.36 #1 (Debian)) id 18igqg-0000Ld-00; Tue, 11 Feb 2003 15:17:46 -0500 Date: Tue, 11 Feb 2003 20:17:00 -0000 To: gcc-patches@gcc.gnu.org, binutils@sources.redhat.com, gdb-patches@sources.redhat.com, dj@redhat.com Subject: (Toplevel patch) Macroize build_subdir, target_subdir determination Message-ID: <20030211201744.GA1338@doctormoo> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i From: Nathanael Nerode X-SW-Source: 2003-02/txt/msg00278.txt.bz2 As I mentioned a while back, this pulls the determination of target_subdir and build_subdir into a (slightly more general than necessary) macro. The macro works correctly under autoconf 2.13 and 2.5x, which is part of the point. To see that it works, consider the trouble cases, which are the cases where build_alias or target_alias is not specified on the command line. * If build_alias is not specified, and host_alias is not specified, build_subdir is never used, so we can ignore this case. * If build_alias is not specified, and host_alias is specified, then currently build_alias is set to host_alias, but in 2.5x it will be blank. And my macro will set build_subdir to "build-$build" (canonical). Which is a good change because in the 2.13 case we use this deprecated defaulting of build to host and with 2.5x we really should treat this as a cross-build. * If target_alias is not specified, it currently defaults to host_alias. If host_alias is also not specified, it becomes host (canonical), which is the same as target (canonical). Under 2.5 it will be blank, so we must reproduce this logic. Tested on i686-pc-linux-gnu. (toplev) * configure.in: Replace determination of target_subdir, build_subdir with call to GCC_TOPLEV_SUBDIRS. * configure: Regenerate. (config) * acx.m4: Introduce GCC_TOPLEV_SUBDIRS. This only modifies the top level, though my intention is to make all subdirectories which care about this stuff use the same macro, so that the comment in acx.m4 will be entirely true. It's just that each subdirectory is sufficient work that I wanted to do this a bit at a time. Index: configure.in =================================================================== RCS file: /cvs/gcc/gcc/configure.in,v retrieving revision 1.219 diff -u -r1.219 configure.in --- configure.in 6 Feb 2003 20:55:11 -0000 1.219 +++ configure.in 11 Feb 2003 19:46:20 -0000 @@ -199,9 +199,7 @@ is_cross_compiler=yes fi -# We always want to use the same name for this directory, so that dejagnu -# can reliably find it. -target_subdir=${target_alias} +GCC_TOPLEV_SUBDIRS if test ! -d ${target_subdir} ; then if mkdir ${target_subdir} ; then true @@ -210,9 +208,6 @@ exit 1 fi fi - -build_prefix=build- -build_subdir=${build_prefix}${build_alias} if test x"${build_alias}" != x"${host}" ; then if test ! -d ${build_subdir} ; then Index: config/acx.m4 =================================================================== RCS file: /cvs/gcc/gcc/config/acx.m4,v retrieving revision 1.2 diff -u -r1.2 acx.m4 --- config/acx.m4 28 Dec 2002 17:57:00 -0000 1.2 +++ config/acx.m4 11 Feb 2003 20:16:37 -0000 @@ -79,3 +79,37 @@ $1="$ac_cv_prog_$1" fi ]) []dnl # NCN_STRICT_CHECK_TARGET_TOOL + +### +# GCC_TOPLEV_SUBDIRS +# GCC & friends build 'build', 'host', and 'target' tools. These must +# be separated into three well-known subdirectories of the build directory: +# build_subdir, host_subdir, and target_subdir. The values are determined +# here so that they can (theoretically) be changed in the future. They were +# previously reproduced across many different files. +AC_DEFUN([GCC_TOPLEV_SUBDIRS], +[AC_REQUIRE([AC_CANONICAL_BUILD]) []dnl +AC_REQUIRE([AC_CANONICAL_HOST]) []dnl +AC_REQUIRE([AC_CANONICAL_TARGET]) []dnl +# Use build_alias if specified; if not, use canonical build. Prefix 'build-' +# so that it never conflicts with target_subdir. +case "$build_alias" in + "") build_subdir="build-$build" ;; + *) build_subdir="build-$build_alias" ;; +esac +# Host subdir is not really a subdirectory, but is here for completeness. +host_subdir=. +# Use target_alias if specified; use host_alias if specified; if neither, +# use canonical target. +case "$target_alias" in + "") case "$host_alias" in + "") target_subdir="$target" ;; + *) target_subdir="$host_alias" ;; + esac + ;; + *) target_subdir="$target_alias" ;; +esac +AC_SUBST([build_subdir]) +AC_SUBST([host_subdir]) +AC_SUBST([target_subdir]) +]) []dnl # GCC_TOPLEV_SUBDIRS