aboutsummaryrefslogtreecommitdiff
path: root/gdb/main.c
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2010-05-27 03:40:45 +0000
committerDoug Evans <dje@google.com>2010-05-27 03:40:45 +0000
commit0c4a40633c767da2c7659a3f460cf1e8e3dd3a5c (patch)
tree5e04abc4cc89fd32c6532d5d7bdd654af37b4c45 /gdb/main.c
parentec685c5ecafd5bf8876d332a0eb17f206c8d733a (diff)
downloadgdb-0c4a40633c767da2c7659a3f460cf1e8e3dd3a5c.zip
gdb-0c4a40633c767da2c7659a3f460cf1e8e3dd3a5c.tar.gz
gdb-0c4a40633c767da2c7659a3f460cf1e8e3dd3a5c.tar.bz2
Allow python to find its files if moved from original location.
* acinclude.m4 (GDB_AC_DEFINE_RELOCATABLE): New function. (GDB_AC_WITH_DIR): Call it. * configure.ac: Define WITH_PYTHON_PATH if we can find the python installation directory. * config.in: Regenerate. * configure: Regenerate. * defs.h (python_libdir): Declare. * main.c (python_libdir): Define. (captured_main): Initialize python_libdir. * python/python.c (_initialize_python): #ifdef WITH_PYTHON_PATH, call Py_SetProgramName to make sure python can find its libraries and modules.
Diffstat (limited to 'gdb/main.c')
-rw-r--r--gdb/main.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gdb/main.c b/gdb/main.c
index 254e74d..c5c712a 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -68,6 +68,10 @@ char *gdb_sysroot = 0;
/* GDB datadir, used to store data files. */
char *gdb_datadir = 0;
+/* If gdb was configured with --with-python=/path,
+ the possibly relocated path to python's lib directory. */
+char *python_libdir = 0;
+
struct ui_file *gdb_stdout;
struct ui_file *gdb_stderr;
struct ui_file *gdb_stdlog;
@@ -351,6 +355,14 @@ captured_main (void *data)
gdb_datadir = relocate_directory (argv[0], GDB_DATADIR,
GDB_DATADIR_RELOCATABLE);
+#ifdef WITH_PYTHON_PATH
+ /* For later use in helping Python find itself. */
+ python_libdir = relocate_directory (argv[0],
+ concat (WITH_PYTHON_PATH,
+ SLASH_STRING, "lib", NULL),
+ PYTHON_PATH_RELOCATABLE);
+#endif
+
#ifdef RELOC_SRCDIR
add_substitute_path_rule (RELOC_SRCDIR,
make_relative_prefix (argv[0], BINDIR,