# HG changeset patch # Parent 38ae59cbbba369e1b4bd78b4b2f378e26548b79d Do not enable -lmcheck by default when Python is enabled with threading support. gdb/ChangeLog: 2012-08-30 Khoo Yit Phang Do not enable -lmcheck by default when Python is enabled with threading support. * configure.ac: (python_has_threads) New variable, by testing "python -m threading". Move --enable-lmcheck after --with-python. Do not enable -lmcheck by default if python_has_threads=yes. Warn if --enable-lmcheck=yes and python_has_threads=yes. * configure: Regenerate. diff --git a/gdb/configure.ac b/gdb/configure.ac --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -645,28 +645,6 @@ 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 @@ -882,6 +860,11 @@ AC_ERROR(failure running python-config --exec-prefix) fi fi + if ${python_prog} -m threading >/dev/null 2>/dev/null; then + python_has_threads=yes + else + python_has_threads=no + fi else # We do not have a python executable we can use to determine where # to find the Python headers and libs. We cannot guess the include @@ -890,6 +873,7 @@ # do except assume that the compiler will be able to find those files. python_includes= python_libs= + python_has_threads=yes have_python_config=no fi @@ -1028,6 +1012,34 @@ 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, 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. # # ------------------------- #