aboutsummaryrefslogtreecommitdiff
path: root/gdbsupport/common.m4
diff options
context:
space:
mode:
authorPedro Alves <pedro@palves.net>2024-05-14 15:43:41 +0100
committerPedro Alves <pedro@palves.net>2024-05-16 13:03:58 +0100
commit3e09762b7d1243d7d75c885537f67fa66416bb8b (patch)
tree7e62d0c08c6d4bff3003345f106a0a140d05f231 /gdbsupport/common.m4
parentf01ae0392ed9e7012ae33fdcf972ee4508fb7db2 (diff)
downloadgdb-3e09762b7d1243d7d75c885537f67fa66416bb8b.zip
gdb-3e09762b7d1243d7d75c885537f67fa66416bb8b.tar.gz
gdb-3e09762b7d1243d7d75c885537f67fa66416bb8b.tar.bz2
Stop 'configure --enable-threading' if std::thread doesn't work
Currently, if you configure gdb with explicit --enable-threading, but then configure detects std::thread does not work, configure silently disables threading support and continues configuring. This patch makes that scenario cause a configuration error, like so: $ /home/pedro/gdb/src/configure --enable-threading && make ... configure: error: std::thread does not work; disable threading make[1]: *** [Makefile:11225: configure-gdbsupport] Error 1 make[1]: Leaving directory '/home/pedro/gdb/build-windows-threads' make: *** [Makefile:1041: all] Error 2 $ Additionally, if you don't explicitly pass --enable-threading, and std::thread does not work, we will now get a warning (and the build continues): $ /home/pedro/gdb/src/configure && make ... configure: WARNING: std::thread does not work; disabling threading ... This is similar to how we handle --enable-tui and missing curses. The code and error/warning messages were borrowed from there. Change-Id: I73a8b580d1e2a796b23136920c0e181408ae1b22 Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdbsupport/common.m4')
-rw-r--r--gdbsupport/common.m413
1 files changed, 10 insertions, 3 deletions
diff --git a/gdbsupport/common.m4 b/gdbsupport/common.m4
index bef3964..6c317ff 100644
--- a/gdbsupport/common.m4
+++ b/gdbsupport/common.m4
@@ -89,10 +89,11 @@ AC_DEFUN([GDB_AC_COMMON], [
no) want_threading=no ;;
*) AC_MSG_ERROR([bad value $enableval for threading]) ;;
esac],
- [want_threading=yes])
+ [want_threading=auto])
# Check for std::thread. This does not work on some platforms, like
- # mingw and DJGPP.
+ # mingw using the win32 threads model with gcc older than 13, and
+ # DJGPP.
AC_LANG_PUSH([C++])
AX_PTHREAD([threads=yes], [threads=no])
save_LIBS="$LIBS"
@@ -128,10 +129,16 @@ AC_DEFUN([GDB_AC_COMMON], [
LIBS="$save_LIBS"
CXXFLAGS="$save_CXXFLAGS"
- if test "$want_threading" = "yes"; then
+ if test "$want_threading" != "no"; then
if test "$gdb_cv_cxx_std_thread" = "yes"; then
AC_DEFINE(CXX_STD_THREAD, 1,
[Define to 1 if std::thread works.])
+ else
+ if test "$want_threading" = "yes"; then
+ AC_MSG_ERROR([std::thread does not work; disable threading])
+ else
+ AC_MSG_WARN([std::thread does not work; disabling threading])
+ fi
fi
fi
AC_LANG_POP