+2020-02-20 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * config.in: Regenerate.
+ * configure: Regenerate.
+ * configure.ac: Add --with-python-libdir option.
+ * main.c: Use WITH_PYTHON_LIBDIR.
+
2020-02-19 Tom Tromey <tom@tromey.com>
* symtab.c (general_symbol_info::compute_and_set_names): Use
/* Define as the return type of ptrace. */
#undef PTRACE_TYPE_RET
+/* Define if the python lib directory should be relocated when GDB is moved.
+ */
+#undef PYTHON_LIBDIR_RELOCATABLE
+
/* Define if the python directory should be relocated when GDB is moved. */
#undef PYTHON_PATH_RELOCATABLE
/* Define if the PPC simulator is being linked in. */
#undef WITH_PPC_SIM
+/* Directory containing Python's standard libraries from --with-python-libdir.
+ */
+#undef WITH_PYTHON_LIBDIR
+
/* Define if --with-python provides a path, either directly or via
python-config.py --exec-prefix. */
#undef WITH_PYTHON_PATH
with_libmpfr_prefix
with_libmpfr_type
with_python
+with_python_libdir
with_guile
enable_source_highlight
with_intel_pt
--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)
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
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
fi
fi
+dnl Use --with-python-libdir to control where GDB looks for the Python
+dnl libraries.
+dnl
+dnl If this is not given then the default will be based on the value
+dnl passed to --with-python, which is in the python_prefix variable.
+dnl If the --with-python option wasn't given then the default value in
+dnl python_prefix is based on running the 'gdb/python/python-config
+dnl --exec-prefix' script.
+AC_ARG_WITH(python-libdir,
+ AS_HELP_STRING([--with-python-libdir@<:@=DIR@:>@], [search for python's libraries in DIR]),
+ [],[
+ # 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
+ ])
+
if test "${have_libpython}" != no; then
AC_DEFINE(HAVE_PYTHON, 1, [Define if Python interpreter is being linked in.])
CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_PYTHON_OBS)"
CONFIG_INSTALL="$CONFIG_INSTALL install-python"
ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_PYTHON_CFLAGS)"
+ if test -n "${with_python_libdir}"; then
+ AC_DEFINE_UNQUOTED(WITH_PYTHON_LIBDIR, "${with_python_libdir}",
+ [Directory containing Python's standard libraries from --with-python-libdir.])
+ GDB_AC_DEFINE_RELOCATABLE(PYTHON_LIBDIR, [python lib], ${with_python_libdir})
+ 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
gdb_datadir = relocate_gdb_directory (GDB_DATADIR,
GDB_DATADIR_RELOCATABLE);
-#ifdef WITH_PYTHON_PATH
- {
- /* For later use in helping Python find itself. */
- char *tmp = concat (WITH_PYTHON_PATH, SLASH_STRING, "lib", (char *) NULL);
-
- python_libdir = relocate_gdb_directory (tmp, PYTHON_PATH_RELOCATABLE);
- xfree (tmp);
- }
+#ifdef WITH_PYTHON_LIBDIR
+ python_libdir = relocate_gdb_directory (WITH_PYTHON_LIBDIR,
+ PYTHON_LIBDIR_RELOCATABLE);
#endif
#ifdef RELOC_SRCDIR