This is the mail archive of the gdb-patches@sourceware.org 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]

Allow sysroots to be relocated under $prefix as well as $exec_prefix


--exec-prefix is useful if you want to install toolchains for two hosts
(but the same target) side-by-side.  The toolchains can then share various
files, thus reducing the install footprint.

If you're using a sysroot, you'll probably want to share that sysroot
between hosts.  Thus if you're putting the sysroot in the install tree,
you'll probably want to put it in something relative to --prefix rather
than something relative to --exec-prefix.

Unfortunately, the current configure code only treats sysroots as
relocatable if they are subdirectories of --exec-prefix.  This seems
to be academic in the case of ld and gdb; they don't seem to take any
notice of TARGET_SYSTEM_ROOT_RELOCATABLE anyway.  (ld relies on the
relocation performed by the gcc driver.)  However, the gcc driver can
relocate sysroots in --prefix just as easily as those in --exec-prefix;
no driver changes are needed.  The configure check therefore seems
unnecessarily restrictive.

This patch makes configure treat sysroots as relocatable if they are
under either --prefix or --exec-prefix.  I've updated the ld and gdb
versions to keep them in sync.

Bootstrapped & regression-tested on x86_64-linux-gnu.  Also tested
on a sysrooted mips-linux-gnu compiler.  OK to install?

Richard


gcc/
	* configure.ac: Allow sysroots to be relocated under $prefix as
	well as $exec_prefix.
	* configure: Regenerate.

ld/
	* configure.in: Allow sysroots to be relocated under $prefix as
	well as $exec_prefix.
	* configure: Regenerate.

gdb/
	* configure.ac: Allow sysroots to be relocated under $prefix as
	well as $exec_prefix.
	* configure: Regenerate.

Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac	(revision 124214)
+++ gcc/configure.ac	(working copy)
@@ -787,17 +787,20 @@ AC_ARG_WITH(sysroot,
  TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
  CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)'
 	
+ if test "x$prefix" = xNONE; then
+  test_prefix=/usr/local
+ else
+  test_prefix=$prefix
+ fi
  if test "x$exec_prefix" = xNONE; then
-  if test "x$prefix" = xNONE; then
-   test_prefix=/usr/local
-  else
-   test_prefix=$prefix
-  fi
+  test_exec_prefix=$test_prefix
  else
-  test_prefix=$exec_prefix
+  test_exec_prefix=$exec_prefix
  fi
  case ${TARGET_SYSTEM_ROOT} in
  "${test_prefix}"|"${test_prefix}/"*|\
+ "${test_exec_prefix}"|"${test_exec_prefix}/"*|\
+ '${prefix}'|'${prefix}/'*|\
  '${exec_prefix}'|'${exec_prefix}/'*)
    t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE"
    TARGET_SYSTEM_ROOT_DEFINE="$t"

Index: gcc/configure.ac
===================================================================
--- ld/configure.in	(revision 124214)
+++ ld/configure.in	(working copy)
@@ -787,17 +787,20 @@ AC_ARG_WITH(sysroot,
  TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
  use_sysroot=yes
 
+ if test "x$prefix" = xNONE; then
+  test_prefix=/usr/local
+ else
+  test_prefix=$prefix
+ fi
  if test "x$exec_prefix" = xNONE; then
-  if test "x$prefix" = xNONE; then
-   test_prefix=/usr/local
-  else
-   test_prefix=$prefix
-  fi
+  test_exec_prefix=$test_prefix
  else
-  test_prefix=$exec_prefix
+  test_exec_prefix=$exec_prefix
  fi
  case ${TARGET_SYSTEM_ROOT} in
  "${test_prefix}"|"${test_prefix}/"*|\
+ "${test_exec_prefix}"|"${test_exec_prefix}/"*|\
+ '${prefix}'|'${prefix}/'*|\
  '${exec_prefix}'|'${exec_prefix}/'*)
    t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE"
    TARGET_SYSTEM_ROOT_DEFINE="$t"

Index: gdb/configure.ac
===================================================================
RCS file: /cvs/src/src/gdb/configure.ac,v
retrieving revision 1.44
diff -u -p -r1.44 configure.ac
--- gdb/configure.ac	11 Apr 2007 18:36:50 -0000	1.44
+++ gdb/configure.ac	2 May 2007 10:10:06 -0000
@@ -1121,17 +1121,20 @@ AC_ARG_WITH(sysroot,
 
  TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
 
+ if test "x$prefix" = xNONE; then
+  test_prefix=/usr/local
+ else
+  test_prefix=$prefix
+ fi
  if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then
-  if test "x$prefix" = xNONE; then
-   test_prefix=/usr/local
-  else
-   test_prefix=$prefix
-  fi
+  test_exec_prefix=$test_prefix
  else
-  test_prefix=$exec_prefix
+  test_exec_prefix=$exec_prefix
  fi
  case ${TARGET_SYSTEM_ROOT} in
  "${test_prefix}"|"${test_prefix}/"*|\
+ "${test_exec_prefix}"|"${test_exec_prefix}/"*|\
+ '${prefix}'|'${prefix}/'*|\
  '${exec_prefix}'|'${exec_prefix}/'*)
    t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE"
    TARGET_SYSTEM_ROOT_DEFINE="$t"


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