diff options
author | Doug Evans <dje@google.com> | 2010-05-27 03:40:43 +0000 |
---|---|---|
committer | Doug Evans <dje@google.com> | 2010-05-27 03:40:43 +0000 |
commit | e2525e60c4727ffa8ce5a9f94ad49ea54d8284d9 (patch) | |
tree | 448bae9b1c78aa33f74b504f52ed76735ba8e79e /gdb/main.c | |
parent | 2fe486b869f8d2c434900635de935bb81a2ff187 (diff) | |
download | gdb-e2525e60c4727ffa8ce5a9f94ad49ea54d8284d9.tar.gz |
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.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gdb/main.c b/gdb/main.c index 254e74d4d19..c5c712acff8 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, |