This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 1/2] Add support for --with-gdb-libdir (default: <prefix>/lib/gdb)
- From: Joel Brobecker <brobecker at adacore dot com>
- To: gdb-patches at sourceware dot org
- Date: Thu, 20 May 2010 11:40:02 -0700
- Subject: [PATCH 1/2] Add support for --with-gdb-libdir (default: <prefix>/lib/gdb)
- References: <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