summaryrefslogtreecommitdiff
path: root/gdbsupport/common.m4
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2022-03-31 08:26:12 -0600
committerTom Tromey <tromey@adacore.com>2022-04-14 09:28:56 -0600
commitc560a5fbae3b6e0b7c2119e6fc276941517377fa (patch)
treee07887af60fda3b3e30d5b491501fc28e41fe24d /gdbsupport/common.m4
parent11d7dd3357997616427e22969ea8a929f5db59c9 (diff)
downloadbinutils-gdb-c560a5fbae3b6e0b7c2119e6fc276941517377fa.tar.gz
Let std::thread check pass even without pthreads
Currently, the configure check for std::thread relies on pthreads existing. However, this means that if std::thread is implemented for a non-pthreads host, then the check will yield the wrong answer. This happened in AdaCore internal builds. Here, we have this GCC patch: https://gcc.gnu.org/legacy-ml/gcc-patches/2019-06/msg01840.html ... which adds mingw support to GCC's gthreads implementation, and also to std::thread. This configure change fixes this problem and enables threading for gdb.
Diffstat (limited to 'gdbsupport/common.m4')
-rw-r--r--gdbsupport/common.m431
1 files changed, 15 insertions, 16 deletions
diff --git a/gdbsupport/common.m4 b/gdbsupport/common.m4
index 838c01c00da..d3e9ecbe823 100644
--- a/gdbsupport/common.m4
+++ b/gdbsupport/common.m4
@@ -93,27 +93,26 @@ AC_DEFUN([GDB_AC_COMMON], [
# mingw and DJGPP.
AC_LANG_PUSH([C++])
AX_PTHREAD([threads=yes], [threads=no])
- if test "$threads" = "yes"; then
- save_LIBS="$LIBS"
- LIBS="$PTHREAD_LIBS $LIBS"
- save_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS="$PTHREAD_CFLAGS $save_CXXFLAGS"
- AC_CACHE_CHECK([for std::thread],
- gdb_cv_cxx_std_thread,
- [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
- [[#include <thread>
- void callback() { }]],
- [[std::thread t(callback);]])],
- gdb_cv_cxx_std_thread=yes,
- gdb_cv_cxx_std_thread=no)])
+ save_LIBS="$LIBS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+ save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$PTHREAD_CFLAGS $save_CXXFLAGS"
+ AC_CACHE_CHECK([for std::thread],
+ gdb_cv_cxx_std_thread,
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+ [[#include <thread>
+ void callback() { }]],
+ [[std::thread t(callback);]])],
+ gdb_cv_cxx_std_thread=yes,
+ gdb_cv_cxx_std_thread=no)])
+ if test "$threads" = "yes"; then
# This check must be here, while LIBS includes any necessary
# threading library.
AC_CHECK_FUNCS([pthread_sigmask pthread_setname_np])
-
- LIBS="$save_LIBS"
- CXXFLAGS="$save_CXXFLAGS"
fi
+ LIBS="$save_LIBS"
+ CXXFLAGS="$save_CXXFLAGS"
if test "$want_threading" = "yes"; then
if test "$gdb_cv_cxx_std_thread" = "yes"; then