Non-GNU sed do not like the '?' quantifier when used in a s/// regexp
that involve back-references, causing the build to fail when trying
to link with Python support. This fixes it by using the '*' quantifier
instead.
gdb/ChangeLog:
* configure.ac: Work around non-GNU sed limitation when computing
python version number.
* configure: Regenerate.
This makes several adjustements to the configure python-config.py
scripts to deal with the differences between a Unix install of Python
and a Windows install of Python (as downloaded from the Python website).
Differences:
- The Python executable is directly in the python prefix directory
as opposed to inside the bin/ subdirectory.
- The name of the python library is does not have a dot in the version
number: On Unix, we have libpython2.7, while on Windows, it's
libpython27. So the regexp extracting the python version from
the Python lib filename had to be adjusted slightly.
Also, the tests checking the name of the libpython had to be
adjusted to allow for that.
- There are no link options following the -lpython<version> switch
on Windows, but the regexp extracting the python version was
using it as a delimiter. It had to be removed.
- python-config.py does not work on Windows, mostly because
some sysconfig variables are missing. They are not necessary
so the script was adapted to skip them if not defined.
- The paths returned by python-config.py follow the Windows filename
convention in terms of the directory separator, and this is causing
trouble when the build environment is cygwin (while the compiler
and Python are MinGW). We could have fixed that in the configure
script, but it felt simpler to do so in python-config.py
gdb/ChangeLog:
* 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.
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.
This is a nasty interaction between Python and GDB. Basically,
Python causes some macros to be unilaterally defined in order
to turns some features on:
/* Define to activate features from IEEE Stds 1003.1-2001 */
#define _POSIX_C_SOURCE 200112L
/* Define to the level of X/Open that your system supports */
#define _XOPEN_SOURCE 600
But the problem is that they turn off defines provided by some
system headers on which we depend. Namely:
* sys/siginfo.h:
#if _SGIAPI
#define siginfo __siginfo
#endif
* sys/ucontext.h:
#if _SGIAPI && !defined(__SGI_NOUCONTEXT_COMPAT)
[...]
#define fp_r __fp_r
[...]
#define fp_csr __fp_csr
[...]
#endif
The important macro here is _SGIAPI, defined as follow in standards.h:
#define _SGIAPI ((defined(_SGI_SOURCE) && \
_NO_POSIX && _NO_XOPEN4 && _NO_XOPEN5) || \
(_ANSIMODE && _NO_POSIX && _NO_XOPEN4 && _NO_XOPEN5))
If one builds GDB without Python, then _SGIAPI is true, and all is fine.
But building with Python causes both _POSIX_C_SOURCE and _XOPEN_SOURCE
to trip all the _NO_[...] tests (_NO_POSIX, _NO_XOPEN4, _NO_XOPEN5).
And so we get build failures because we try to use undefined types, or
non-existent component names inside the regset structure.
The latter problem is observed only within irix5-nat.c, which means
that it is specific to IRIX. So it's easy to write the code in a way
that it does not require the macros (just use the real component names,
rather than relying on the macros to do the translation).
The former, on the other hand, is a little trickier, because the problem
occurs inside a generic unit (procfs.c). The solution I chose was to
adjust the configure script to add -Dsiginfo=__siginfo to the CPPFLAGS
if building with python using GCC on IRIX.
We hadn't seen this sort of issue up to now because the affect units
have not been dependent on the python includes up to now. Recent changes
have made them indirectly dependent on Python, thus triggering the issues.
gdb/ChangeLog:
* irix5-nat.c: Replace fp_r, fp_regs and fp_scr by __fp_r, __fp_regs
and __fp_scr respectively throughout.
* configure.ac: Compile with -Dsiginfo=__siginfo if building with
Python using GCC on IRIX.
* configure: Regenerate.
* Makefile.in (XML_SYSCALL_DIR, XML_SYSCALL_FILES): Moved to
data-directory/Makefile.in.
(SUBDIRS): Add data-directory.
(all): Remove xml-syscall-copy dependency.
(xml-syscall-copy): Moved to data-directory/Makefile.in as
stamp-syscalls.
(xml-syscall-install): Moved to data-directory/Makefile.in as
install-syscalls.
(install-only): Remove xml-syscall-install dependency.
(all-data-directory): New rule.
(data-directory/Makefile): New rule.
* configure.ac (AC_OUTPUT): Add data-directory/Makefile.
* configure: Regenerate.
* data-directory/Makefile.in: New file.
* python/lib/gdb/__init__.py: New file.
testsuite/
* gdb.base/catch-syscall.exp (do_syscall_tests): Update location
of syscall staging area.
This patch adds a new --enable-gdbserver=yes/no/auto command-line switch
in gdb/configure. The primary purpose is to allow a user to disable the
build & install of gdbserver when not desired. It also allows the user
to request gdbserver in which case the configure script will abort if
automatic building of gdbserver is not supported for that configuration.
The default keeps things as is: We automatically build gdbserver if
building for a native configuration and if gdbserver is supported for
that configuration.
gdb/ChangeLog:
* configure.ac: Add support for --enable-gdbserver.
* configure: Regenerate.
At AdaCore, this is mostly intended for ia64-linux, where we currently
do not want to distribute gdbserver. This will be useful in the context
of I417-033, where we are now using "make install" to determine what
needs to be packaged inside the GNAT Pro package.
* 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.
* configure.ac (--with-datarootdir, --with-docdir, --with-pdfdir,
--with-htmldir): New.
* configure: Regenerate.
gdb/doc:
* configure.ac (--with-datarootdir, --with-docdir, --with-pdfdir,
--with-htmldir): New.
* configure: Regenerate.
* Makefile.in (datarootdir, docdir): Define.
(gdb.dvi, gdb.pdf): Use same -I options as for building gdb.info
instead of $(SET_TEXINPUTS).
(gdbint.dvi, gdbint.pdf): Use same -I options as for building
gdbint.info instead of $(SET_TEXINPUTS).
(gdbint/index.html): Use same -I options as for building
gdbint.info.
(stabs.dvi, stabs.pdf): Use same -I options as for building
stabs.info instead of $(SET_TEXINPUTS).
(stabs/index.html): Use same -I options as for building
stabs.info.
(annotate.dvi, annotate.pdf): Use same -I options as for building
annotate.info instead of $(SET_TEXINPUTS).
(annotate/index.html): Use same -I options as for building
annotate.info.