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.
This commit is contained in:
Doug Evans 2010-05-27 03:40:45 +00:00
parent ec685c5eca
commit 0c4a40633c
8 changed files with 185 additions and 35 deletions

View file

@ -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,