aboutsummaryrefslogtreecommitdiff
path: root/gdb/configure
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2020-01-17 00:10:22 +0000
committerAndrew Burgess <andrew.burgess@embecosm.com>2020-02-20 10:14:43 +0000
commitd13c7322fe1266984024644154003a19664610ea (patch)
tree1177c0438c9e3fe8741c5e7f3b561aba2ad7f9e7 /gdb/configure
parentd7445728b14851cb8535a6a9fa2995817dea2e60 (diff)
downloadgdb-d13c7322fe1266984024644154003a19664610ea.zip
gdb-d13c7322fe1266984024644154003a19664610ea.tar.gz
gdb-d13c7322fe1266984024644154003a19664610ea.tar.bz2
gdb: Allow more control over where to find python libraries
The motivation behind this commit is to make it easier to bundle the Python *.py library files with GDB when statically linking GDB against libpython. The Python files will be manually added into the GDB installation tree, and GDB should be able to find them at run-time. The installation tree will look like this: . |-- bin/ |-- include/ |-- lib/ | `-- python3.8/ `-- share/ The benefit here is that the entire installation tree can be bundled into a single archive and copied to another machine with a different version of Python installed, and GDB will still work, including its Python support. In use the new configure options would be used something like this, first build and install a static Python library: mkdir python cd python # Clone or download Python into a src/ directory. mkdir build export PYTHON_INSTALL_PATH=$PWD/install cd build ../src/configure --disable-shared --prefix=$PYTHON_INSTALL_PATH make make install Now build and install GDB: mkdir binutils-gdb cd binutils-gdb # Clone or download GDB into a src/ directory. mkdir build export GDB_INSTALL_DIR=$PWD/install cd build ../src/configure \ --prefix=$GDB_INSTALL_DIR \ --with-python=$PYTHON_INSTALL_PATH/bin/python3 \ --with-python-libdir=$GDB_INSTALL_DIR/lib make all-gdb make install-gdb Finally, copy the Python libraries into the GDB install: cp -r $PYTHON_INSTALL_DIR/lib/python3.8/ $GDB_INSTALL_DIR/lib After this the Python src, build, and install directories are no longer needed and can be deleted. If the new --with-python-libdir option is not used then the existing behaviour is left unchanged, GDB will look for the Python libraries in the lib/ directory within the python path. The concatenation of the python prefix and the string 'lib/' is now done at configure time, rather than at run time in GDB as it was previous, however, this was never something that the user had dynamic control over, so there's no loss of functionality. gdb/ChangeLog: * config.in: Regenerate. * configure: Regenerate. * configure.ac: Add --with-python-libdir option. * main.c: Use WITH_PYTHON_LIBDIR.
Diffstat (limited to 'gdb/configure')
-rwxr-xr-xgdb/configure49
1 files changed, 49 insertions, 0 deletions
diff --git a/gdb/configure b/gdb/configure
index 2f6ecb5..e6b5a51 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -890,6 +890,7 @@ with_mpfr
with_libmpfr_prefix
with_libmpfr_type
with_python
+with_python_libdir
with_guile
enable_source_highlight
with_intel_pt
@@ -1625,6 +1626,8 @@ Optional Packages:
--with-libmpfr-type=TYPE type of library to search for (auto/static/shared)
--with-python[=PYTHON] include python support
(auto/yes/no/<python-program>)
+ --with-python-libdir[=DIR]
+ search for python's libraries in DIR
--with-guile[=GUILE] include guile support
(auto/yes/no/<guile-version>/<pkg-config-program>)
--with-intel-pt include Intel Processor Trace support (auto/yes/no)
@@ -10665,6 +10668,21 @@ _ACEOF
fi
fi
+
+# Check whether --with-python-libdir was given.
+if test "${with_python_libdir+set}" = set; then :
+ withval=$with_python_libdir;
+else
+
+ # If no python libdir is specified then select one based on
+ # python's prefix path.
+ if test -n "${python_prefix}"; then
+ with_python_libdir=${python_prefix}/lib
+ fi
+
+fi
+
+
if test "${have_libpython}" != no; then
$as_echo "#define HAVE_PYTHON 1" >>confdefs.h
@@ -10675,6 +10693,37 @@ $as_echo "#define HAVE_PYTHON 1" >>confdefs.h
CONFIG_INSTALL="$CONFIG_INSTALL install-python"
ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_PYTHON_CFLAGS)"
+ if test -n "${with_python_libdir}"; then
+
+cat >>confdefs.h <<_ACEOF
+#define WITH_PYTHON_LIBDIR "${with_python_libdir}"
+_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 ${with_python_libdir} in
+ "${test_prefix}"|"${test_prefix}/"*|\
+ '${exec_prefix}'|'${exec_prefix}/'*)
+ value=1
+ ;;
+ esac
+
+cat >>confdefs.h <<_ACEOF
+#define PYTHON_LIBDIR_RELOCATABLE $value
+_ACEOF
+
+
+ fi
+
# Flags needed to compile Python code (taken from python-config --cflags).
# We cannot call python-config directly because it will output whatever was
# used when compiling the Python interpreter itself, including flags which