From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18941 invoked by alias); 20 May 2010 18:40:21 -0000 Received: (qmail 18716 invoked by uid 22791); 20 May 2010 18:40:18 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 20 May 2010 18:40:13 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 959B72BAB88 for ; Thu, 20 May 2010 14:40:11 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Q-zE626uhphu for ; Thu, 20 May 2010 14:40:11 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 561702BAB2F for ; Thu, 20 May 2010 14:40:11 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 31B67F5916; Thu, 20 May 2010 11:40:09 -0700 (PDT) From: Joel Brobecker To: gdb-patches@sourceware.org Subject: [PATCH 1/2] Add support for --with-gdb-libdir (default: /lib/gdb) Date: Thu, 20 May 2010 18:54:00 -0000 Message-Id: <1274380803-25266-2-git-send-email-brobecker@adacore.com> In-Reply-To: <1274380803-25266-1-git-send-email-brobecker@adacore.com> References: <1274380803-25266-1-git-send-email-brobecker@adacore.com> 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: 2010-05/txt/msg00437.txt.bz2 This patch is adding a gdb_libdir path where we can store/install gdb-specific library/object-code files... The default is lib/gdb. 2010-05-20 Joel Brobecker * configure.ac: Add --with-gdb-libdir command-line option. * configure, config.in: Regenerate. * defs.h (gdb_libdir): Add declaration. * main.c (gdb_libdir): New global. (captured_main): Compute gdb_libdir. Tested on x86_64-linux. No regression. --- gdb/config.in | 7 +++++++ gdb/configure | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ gdb/configure.ac | 6 ++++++ gdb/defs.h | 3 +++ gdb/main.c | 6 ++++++ 5 files changed, 73 insertions(+), 0 deletions(-) diff --git a/gdb/config.in b/gdb/config.in index 5414b08..da098da 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -65,6 +65,13 @@ /* Host long double floatformat */ #undef GDB_HOST_LONG_DOUBLE_FORMAT +/* look for global separate lib files in this path [LIBDIR/gdb] */ +#undef GDB_LIBDIR + +/* Define if the gdb-libdir directory should be relocated when GDB is moved. + */ +#undef GDB_LIBDIR_RELOCATABLE + /* nativefile */ #undef GDB_NM_FILE diff --git a/gdb/configure b/gdb/configure index 301394f..4432af1 100755 --- a/gdb/configure +++ b/gdb/configure @@ -676,6 +676,7 @@ REPORT_BUGS_TO PKGVERSION TARGET_OBS subdirs +GDB_LIBDIR GDB_DATADIR DEBUGDIR am__fastdepCC_FALSE @@ -884,6 +885,7 @@ enable_largefile enable_dependency_tracking with_separate_debug_dir with_gdb_datadir +with_gdb_libdir with_relocated_sources enable_targets enable_64_bit_bfd @@ -1584,6 +1586,8 @@ Optional Packages: [LIBDIR/debug] --with-gdb-datadir=PATH look for global separate data files in this path [DATADIR/gdb] + --with-gdb-libdir=PATH look for global separate lib files in this path + [LIBDIR/gdb] --with-relocated-sources=PATH automatically relocate this path for source files --with-libunwind use libunwind frame unwinding support @@ -6847,6 +6851,53 @@ _ACEOF +# GDB's libdir relocation + + + +# Check whether --with-gdb-libdir was given. +if test "${with_gdb_libdir+set}" = set; then : + withval=$with_gdb_libdir; + GDB_LIBDIR=$withval +else + GDB_LIBDIR=${libdir}/gdb +fi + + + test "x$prefix" = xNONE && prefix="$ac_default_prefix" + test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + ac_define_dir=`eval echo $GDB_LIBDIR` + ac_define_dir=`eval echo $ac_define_dir` + +cat >>confdefs.h <<_ACEOF +#define GDB_LIBDIR "$ac_define_dir" +_ACEOF + + + + 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 + else + test_prefix=$exec_prefix + fi + value=0 + case ${ac_define_dir} in + "${test_prefix}"|"${test_prefix}/"*|\ + '${exec_prefix}'|'${exec_prefix}/'*) + value=1 + ;; + esac + +cat >>confdefs.h <<_ACEOF +#define GDB_LIBDIR_RELOCATABLE $value +_ACEOF + + + # Check whether --with-relocated-sources was given. if test "${with_relocated_sources+set}" = set; then : diff --git a/gdb/configure.ac b/gdb/configure.ac index 4704a53..78eedde 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -101,6 +101,12 @@ GDB_AC_WITH_DIR(GDB_DATADIR, gdb-datadir, [look for global separate data files in this path @<:@DATADIR/gdb@:>@], [${datadir}/gdb]) +# GDB's libdir relocation + +GDB_AC_WITH_DIR(GDB_LIBDIR, gdb-libdir, + [look for global separate lib files in this path @<:@LIBDIR/gdb@:>@], + [${libdir}/gdb]) + AC_ARG_WITH(relocated-sources, AS_HELP_STRING([--with-relocated-sources=PATH], [automatically relocate this path for source files]), [reloc_srcdir="${withval}" diff --git a/gdb/defs.h b/gdb/defs.h index b18e03f..61fe7a3 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -157,6 +157,9 @@ extern char *gdb_sysroot; /* GDB datadir, used to store data files. */ extern char *gdb_datadir; +/* GDB libdir, used to store lib files. */ +extern char *gdb_libdir; + /* Search path for separate debug files. */ extern char *debug_file_directory; diff --git a/gdb/main.c b/gdb/main.c index 254e74d..fab9012 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -68,6 +68,9 @@ char *gdb_sysroot = 0; /* GDB datadir, used to store data files. */ char *gdb_datadir = 0; +/* GDB libdir, used to store lib files. */ +char *gdb_libdir = 0; + struct ui_file *gdb_stdout; struct ui_file *gdb_stderr; struct ui_file *gdb_stdlog; @@ -351,6 +354,9 @@ captured_main (void *data) gdb_datadir = relocate_directory (argv[0], GDB_DATADIR, GDB_DATADIR_RELOCATABLE); + gdb_libdir = relocate_directory (argv[0], GDB_LIBDIR, + GDB_LIBDIR_RELOCATABLE); + #ifdef RELOC_SRCDIR add_substitute_path_rule (RELOC_SRCDIR, make_relative_prefix (argv[0], BINDIR, -- 1.7.1