aboutsummaryrefslogtreecommitdiff
path: root/gdb/configure.ac
diff options
context:
space:
mode:
authorYit Phang Khoo <khooyp@sourceware.org>2012-09-02 22:57:43 +0000
committerYit Phang Khoo <khooyp@sourceware.org>2012-09-02 22:57:43 +0000
commita8db421230d409d050c44a5145d4792f8c629a93 (patch)
tree2cb85606a1c8b6be3126b33874054caa8a249b30 /gdb/configure.ac
parent9637f6ef78ecc63d9fca3ccffe825fb8e908a575 (diff)
downloadgdb-a8db421230d409d050c44a5145d4792f8c629a93.zip
gdb-a8db421230d409d050c44a5145d4792f8c629a93.tar.gz
gdb-a8db421230d409d050c44a5145d4792f8c629a93.tar.bz2
2012-09-02 Khoo Yit Phang <khooyp@cs.umd.edu>
Do not enable -lmcheck by default when Python is enabled with threading support. * configure.ac: (python_has_threads) New variable, by testing if WITH_THREAD is defined in Python.h. Move --enable-lmcheck after --with-python. Do not enable -lmcheck by default if python_has_threads=yes. Warn if --enable-lmcheck and python_has_threads=yes. * configure: Regenerate.
Diffstat (limited to 'gdb/configure.ac')
-rw-r--r--gdb/configure.ac69
1 files changed, 47 insertions, 22 deletions
diff --git a/gdb/configure.ac b/gdb/configure.ac
index b33de61..0c62b46 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -645,28 +645,6 @@ AC_SUBST(READLINE_DEPS)
AC_SUBST(READLINE_CFLAGS)
AC_SUBST(READLINE_TEXI_INCFLAG)
-# Provide a --enable-libmcheck/--disable-libmcheck set of options
-# allowing a user to enable this option even when building releases,
-# or to disable it when building a snapshot.
-AC_ARG_ENABLE(libmcheck,
- AS_HELP_STRING([--enable-libmcheck],
- [Try building GDB with -lmcheck if available]),
- [case "${enableval}" in
- yes | y) ENABLE_LIBMCHECK="yes" ;;
- no | n) ENABLE_LIBMCHECK="no" ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-libmcheck) ;;
- esac])
-
-# Enable -lmcheck by default (it provides cheap-enough memory mangling),
-# but turn it off for releases.
-if test -z "${ENABLE_LIBMCHECK}" && $development; then
- ENABLE_LIBMCHECK=yes
-fi
-
-if test "$ENABLE_LIBMCHECK" = "yes" ; then
- AC_CHECK_LIB(mcheck, main)
-fi
-
# Generate jit-reader.h
# This is typedeffed to GDB_CORE_ADDR in jit-reader.h
@@ -1017,6 +995,23 @@ if test "${have_libpython}" != no; then
fi
;;
esac
+
+ # Note that "python -m threading" cannot be used to check for
+ # threading support due to a bug in Python 2.7.3
+ # (http://bugs.python.org/issue15567).
+ AC_MSG_CHECKING(whether python supports threads)
+ saved_CPPFLAGS="${CPPFLAGS}"
+ CPPFLAGS="${PYTHON_CPPFLAGS}"
+ # Note that the test is reversed so that python_has_threads=yes on
+ # unexpected failures.
+ AC_PREPROC_IFELSE(AC_LANG_SOURCE([[
+#include <Python.h>
+#ifdef WITH_THREAD
+# error
+#endif
+ ]]), [python_has_threads=no], [python_has_threads=yes])
+ AC_MSG_RESULT(${python_has_threads})
+ CPPFLAGS="${saved_CPPFLAGS}"
else
# Even if Python support is not compiled in, we need to have these files
# included.
@@ -1028,6 +1023,36 @@ AC_SUBST(PYTHON_CFLAGS)
AC_SUBST(PYTHON_CPPFLAGS)
AC_SUBST(PYTHON_LIBS)
+# Provide a --enable-libmcheck/--disable-libmcheck set of options
+# allowing a user to enable this option even when building releases,
+# or to disable it when building a snapshot.
+AC_ARG_ENABLE(libmcheck,
+ AS_HELP_STRING([--enable-libmcheck],
+ [Try building GDB with -lmcheck if available]),
+ [case "${enableval}" in
+ yes | y) ENABLE_LIBMCHECK="yes" ;;
+ no | n) ENABLE_LIBMCHECK="no" ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-libmcheck) ;;
+ esac])
+
+# Enable -lmcheck by default (it provides cheap-enough memory mangling),
+# but turn it off if Python is enabled with threads, since -lmcheck is
+# not thread safe (http://sourceware.org/bugzilla/show_bug.cgi?id=9939),
+# and for releases.
+if test -z "${ENABLE_LIBMCHECK}" \
+ -a \( "${have_libpython}" = "no" \
+ -o "${python_has_threads}" = "no" \) \
+ && $development; then
+ ENABLE_LIBMCHECK=yes
+fi
+
+if test "$ENABLE_LIBMCHECK" = "yes" ; then
+ if test "${have_libpython}" != "no" -a "${python_has_threads}" = "yes" ; then
+ AC_MSG_WARN(--enable-libmcheck may lead to spurious crashes if threads are used in python)
+ fi
+ AC_CHECK_LIB(mcheck, main)
+fi
+
# ------------------------- #
# Checks for header files. #
# ------------------------- #