aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog9
-rwxr-xr-xgdb/configure17
-rw-r--r--gdb/configure.ac17
-rw-r--r--gdb/python/python-config.py34
4 files changed, 60 insertions, 17 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9d61108..3cbfba5 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,14 @@
2011-01-31 Joel Brobecker <brobecker@adacore.com>
+ * configure.ac: Add handling of Python distribution on Windows.
+ * python-config.py: If the LIBS, SYSLIBS, LIBPL and/or LINKFORSHARED
+ sysconfig variables are not defined, then do not use them.
+ On Windows, if LIBPL is not defined, then use prefix + '/libs'
+ instead. On Windows, return all paths using forward-slashes
+ rather than backslashes.
+
+2011-01-31 Joel Brobecker <brobecker@adacore.com>
+
* configure.ac: Remove fallback behavior for building
against Python. Remove tweaking of Python include path.
Add PYTHON_CPPFLAGS and PYTHON_LIBS substitution.
diff --git a/gdb/configure b/gdb/configure
index 2540f8b..5a6d0be 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -10478,6 +10478,13 @@ else
# Assume the python binary is ${with_python}/bin/python.
python_prog="${with_python}/bin/python"
python_prefix=
+ # If python does not exit ${with_python}/bin, then try in
+ # ${with_python}. On Windows/MinGW, this is where the Python
+ # executable is.
+ if test ! -x "${python_prog}"; then
+ python_prog="${with_python}/python"
+ python_prefix=
+ fi
if test ! -x "${python_prog}"; then
# Fall back to gdb 7.0/7.1 behaviour.
python_prog=missing
@@ -10652,7 +10659,7 @@ fi
have_libpython=no
if test "${have_python_config}" = yes; then
python_version=`echo " ${python_libs} " \
- | sed -e 's,^.* -l\(python[0-9]*[.][0-9]*\) .*$,\1,'`
+ | sed -e 's,^.* -l\(python[0-9]*[.]\?[0-9]*\).*$,\1,'`
case "${python_version}" in
python*)
@@ -10850,19 +10857,19 @@ $as_echo "${found_usable_python}" >&6; }
fi
fi
- if test "${have_libpython}" = python2.7; then
+ if test "${have_libpython}" = python2.7 -o "${have_libpython}" = python27; then
$as_echo "#define HAVE_LIBPYTHON2_7 1" >>confdefs.h
- elif test "${have_libpython}" = python2.6; then
+ elif test "${have_libpython}" = python2.6 -o "${have_libpython}" = python26; then
$as_echo "#define HAVE_LIBPYTHON2_6 1" >>confdefs.h
- elif test "${have_libpython}" = python2.5; then
+ elif test "${have_libpython}" = python2.5 -o "${have_libpython}" = python25; then
$as_echo "#define HAVE_LIBPYTHON2_5 1" >>confdefs.h
- elif test "${have_libpython}" = python2.4; then
+ elif test "${have_libpython}" = python2.4 -o "${have_libpython}" = python24; then
$as_echo "#define HAVE_LIBPYTHON2_4 1" >>confdefs.h
diff --git a/gdb/configure.ac b/gdb/configure.ac
index afb7314..68b0838 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -669,6 +669,13 @@ else
# Assume the python binary is ${with_python}/bin/python.
python_prog="${with_python}/bin/python"
python_prefix=
+ # If python does not exit ${with_python}/bin, then try in
+ # ${with_python}. On Windows/MinGW, this is where the Python
+ # executable is.
+ if test ! -x "${python_prog}"; then
+ python_prog="${with_python}/python"
+ python_prefix=
+ fi
if test ! -x "${python_prog}"; then
# Fall back to gdb 7.0/7.1 behaviour.
python_prog=missing
@@ -763,7 +770,7 @@ else
have_libpython=no
if test "${have_python_config}" = yes; then
python_version=`echo " ${python_libs} " \
- | sed -e 's,^.* -l\(python[[0-9]]*[[.]][[0-9]]*\) .*$,\1,'`
+ | sed -e 's,^.* -l\(python[[0-9]]*[[.]]\?[[0-9]]*\).*$,\1,'`
case "${python_version}" in
python*)
AC_TRY_LIBPYTHON(${python_version}, have_libpython,
@@ -791,13 +798,13 @@ else
${python_includes}, "${python_libs} -lpython2.4")
fi
fi
- if test "${have_libpython}" = python2.7; then
+ if test "${have_libpython}" = python2.7 -o "${have_libpython}" = python27; then
AC_DEFINE(HAVE_LIBPYTHON2_7, 1, [Define if Python 2.7 is being used.])
- elif test "${have_libpython}" = python2.6; then
+ elif test "${have_libpython}" = python2.6 -o "${have_libpython}" = python26; then
AC_DEFINE(HAVE_LIBPYTHON2_6, 1, [Define if Python 2.6 is being used.])
- elif test "${have_libpython}" = python2.5; then
+ elif test "${have_libpython}" = python2.5 -o "${have_libpython}" = python25; then
AC_DEFINE(HAVE_LIBPYTHON2_5, 1, [Define if Python 2.5 is being used.])
- elif test "${have_libpython}" = python2.4; then
+ elif test "${have_libpython}" = python2.4 -o "${have_libpython}" = python24; then
AC_DEFINE(HAVE_LIBPYTHON2_4, 1, [Define if Python 2.4 is being used.])
fi
diff --git a/gdb/python/python-config.py b/gdb/python/python-config.py
index 0230eb4..75ed2d2 100644
--- a/gdb/python/python-config.py
+++ b/gdb/python/python-config.py
@@ -30,28 +30,48 @@ opt_flags = [flag for (flag, val) in opts]
if '--help' in opt_flags:
exit_with_usage(code=0)
+def to_unix_path(path):
+ """On Windows, returns the given path with all backslashes
+ converted into forward slashes. This is to help prevent problems
+ when using the paths returned by this script with cygwin tools.
+ In particular, cygwin bash treats backslashes as a special character.
+
+ On Unix systems, returns the path unchanged.
+ """
+ if os.name == 'nt':
+ path = path.replace('\\', '/')
+ return path
+
for opt in opt_flags:
if opt == '--prefix':
- print sysconfig.PREFIX
+ print to_unix_path(sysconfig.PREFIX)
elif opt == '--exec-prefix':
- print sysconfig.EXEC_PREFIX
+ print to_unix_path(sysconfig.EXEC_PREFIX)
elif opt in ('--includes', '--cflags'):
flags = ['-I' + sysconfig.get_python_inc(),
'-I' + sysconfig.get_python_inc(plat_specific=True)]
if opt == '--cflags':
flags.extend(getvar('CFLAGS').split())
- print ' '.join(flags)
+ print to_unix_path(' '.join(flags))
elif opt in ('--libs', '--ldflags'):
- libs = getvar('LIBS').split() + getvar('SYSLIBS').split()
+ libs = []
+ if getvar('LIBS') is not None:
+ libs.extend(getvar('LIBS').split())
+ if getvar('SYSLIBS') is not None:
+ libs.extend(getvar('SYSLIBS').split())
libs.append('-lpython'+pyver)
# add the prefix/lib/pythonX.Y/config dir, but only if there is no
# shared library in prefix/lib/.
if opt == '--ldflags':
if not getvar('Py_ENABLE_SHARED'):
- libs.insert(0, '-L' + getvar('LIBPL'))
- libs.extend(getvar('LINKFORSHARED').split())
- print ' '.join(libs)
+ if getvar('LIBPL') is not None:
+ libs.insert(0, '-L' + getvar('LIBPL'))
+ elif os.name == 'nt':
+ libs.insert(0, '-L' + sysconfig.PREFIX + '/libs')
+ if getvar('LINKFORSHARED') is not None:
+ libs.extend(getvar('LINKFORSHARED').split())
+ print to_unix_path(' '.join(libs))