From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 1/2] Add support for --with-gdb-libdir (default: <prefix>/lib/gdb)
Date: Thu, 20 May 2010 18:54:00 -0000 [thread overview]
Message-ID: <1274380803-25266-2-git-send-email-brobecker@adacore.com> (raw)
In-Reply-To: <1274380803-25266-1-git-send-email-brobecker@adacore.com>
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 <brobecker@adacore.com>
* 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
next prev parent reply other threads:[~2010-05-20 18:40 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-20 18:40 Add LIBDIR/gdb/python-<version> to Python search path Joel Brobecker
2010-05-20 18:40 ` [PATCH 2/2] Add gdb_libdir/python-<version> in front of " Joel Brobecker
2010-05-20 21:37 ` Jan Kratochvil
2010-05-20 21:49 ` Joel Brobecker
2010-05-20 22:09 ` Jan Kratochvil
2010-05-20 23:03 ` Joel Brobecker
2010-05-21 9:33 ` Doug Evans
2010-05-21 16:01 ` Joel Brobecker
2010-05-21 16:17 ` Tom Tromey
2010-05-21 19:39 ` Doug Evans
2010-05-20 18:54 ` Joel Brobecker [this message]
2010-05-27 15:04 ` [PATCH 1/2] Add support for --with-gdb-libdir (default: <prefix>/lib/gdb) Joel Brobecker
2010-05-28 5:27 ` Doug Evans
2010-05-28 16:08 ` Joel Brobecker
2010-05-20 19:03 ` Add LIBDIR/gdb/python-<version> to Python search path Daniel Jacobowitz
2010-05-20 19:15 ` Joel Brobecker
2010-05-20 19:23 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1274380803-25266-2-git-send-email-brobecker@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox