This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

(Toplevel patch) Macroize build_subdir, target_subdir determination


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]