From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18878 invoked by alias); 2 May 2007 10:32:29 -0000 Received: (qmail 18862 invoked by uid 22791); 2 May 2007 10:32:27 -0000 X-Spam-Check-By: sourceware.org Received: from gateway.codesourcery.com (HELO gateway.codesourcery.com) (65.74.133.9) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 02 May 2007 10:32:20 +0000 Received: (qmail 7419 invoked by uid 1010); 2 May 2007 10:32:19 -0000 From: Richard Sandiford To: gcc-patches@gcc.gnu.org, binutils@sourceware.org, gdb-patches@sourceware.org Mail-Followup-To: gcc-patches@gcc.gnu.org, binutils@sourceware.org, gdb-patches@sourceware.org, richard@codesourcery.com Subject: Allow sysroots to be relocated under $prefix as well as $exec_prefix Date: Wed, 02 May 2007 10:32:00 -0000 Message-ID: <87ejlz1pot.fsf@firetop.home> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-05/txt/msg00027.txt.bz2 --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"