aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/python-internal.h
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2011-01-31 04:41:27 +0000
committerJoel Brobecker <brobecker@gnat.com>2011-01-31 04:41:27 +0000
commitac534cba292dd37e6c0e2a6e30e455a92018cf66 (patch)
treeb4d315f2bc935a85dc019f9a2072fb272e51f95a /gdb/python/python-internal.h
parentc2f0d045af0d6add5f901d7d2f5175f289054978 (diff)
downloadgdb-ac534cba292dd37e6c0e2a6e30e455a92018cf66.zip
gdb-ac534cba292dd37e6c0e2a6e30e455a92018cf66.tar.gz
gdb-ac534cba292dd37e6c0e2a6e30e455a92018cf66.tar.bz2
do not use python<version> subdir when including Python .h file
This is preparation work for being able to build GDB with Python support on MinGW. So far, the "python<version>" subdirectory needs to be specified when including a Python header file. In order to do that, we have some special configury that tweaks the include path returned by python-config.py such that the use of the subdirectory in the include is necessary. This was done in order to protect ourselves from possible filename conflicts, since some of the filenames chosen by Python were a little generic. The problem is that this cannot work with a standard Python install on MinGW systems. On such systems, the .h files are located in <python_prefix>/include. So, in preparation for allowing us to build GDB on MinGW with Python support enabled, this patch changes the requirement to provide the "python<version>" subdirectory in the include directive. The positive consequence is that we no longer need to have a set of #include directives for each version of Python, since the include directive is now the same for all versions of Python. However, the downside is that we are losing the level of protection we were trying to achieve by forcing the subdirectory in the include directive. In order to reduce a bit the consequences of a possible conflict, this patch also changes the location where the -I/path/to/python switch goes, to be last in the list (suggested by Doug Evans). One last change is the fact that we are now including Python.h and all other Python include headers using angle brackets rather than double-quotes. This fixes a problem on case-insensitive systems where #include "Python.h" causes our gdb/python/python.h header to be included instead of Python's <Python.h> header. gdb/ChangeLog: * configure.ac: Remove fallback behavior for building against Python. Remove tweaking of Python include path. Add PYTHON_CPPFLAGS and PYTHON_LIBS substitution. (AC_TRY_LIBPYTHON): Adjust program used in linking test. If link is successful, set PYTHON_CPPFLAGS and PYTHON_LIBS. Always restore CPPFLAGS and LIBS after linking test. * configure: Regenerated. * Makefile.in (INTERNAL_CPPFLAGS): Add @PYTHON_CPPFLAGS@. (INSTALLED_LIBS, CLIBS): Add @PYTHON_LIBS@. * python/python-internal.h: Adjust includes of Python .h files.
Diffstat (limited to 'gdb/python/python-internal.h')
-rw-r--r--gdb/python/python-internal.h18
1 files changed, 5 insertions, 13 deletions
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index 9dac04d..cf4f936 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -41,25 +41,17 @@
around technique as above. */
#undef _FILE_OFFSET_BITS
+/* Include the Python header files using angle brackets rather than
+ double quotes. On case-insensitive filesystems, this prevents us
+ from including our python/python.h header file. */
+#include <Python.h>
+#include <frameobject.h>
#if HAVE_LIBPYTHON2_4
-#include "python2.4/Python.h"
-#include "python2.4/frameobject.h"
/* Py_ssize_t is not defined until 2.5.
Logical type for Py_ssize_t is Py_intptr_t, but that fails in 64-bit
compilation due to several apparent mistakes in python2.4 API, so we
use 'int' instead. */
typedef int Py_ssize_t;
-#elif HAVE_LIBPYTHON2_5
-#include "python2.5/Python.h"
-#include "python2.5/frameobject.h"
-#elif HAVE_LIBPYTHON2_6
-#include "python2.6/Python.h"
-#include "python2.6/frameobject.h"
-#elif HAVE_LIBPYTHON2_7
-#include "python2.7/Python.h"
-#include "python2.7/frameobject.h"
-#else
-#error "Unable to find usable Python.h"
#endif
/* If Python.h does not define WITH_THREAD, then the various