From 3e09762b7d1243d7d75c885537f67fa66416bb8b Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Tue, 14 May 2024 15:43:41 +0100 Subject: 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 --- gdbserver/configure | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'gdbserver') diff --git a/gdbserver/configure b/gdbserver/configure index 2da525e..3abc647 100755 --- a/gdbserver/configure +++ b/gdbserver/configure @@ -8888,12 +8888,13 @@ if test "${enable_threading+set}" = set; then : *) as_fn_error $? "bad value $enableval for threading" "$LINENO" 5 ;; esac else - want_threading=yes + want_threading=auto fi # 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_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -9600,11 +9601,18 @@ done 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 $as_echo "#define CXX_STD_THREAD 1" >>confdefs.h + else + if test "$want_threading" = "yes"; then + as_fn_error $? "std::thread does not work; disable threading" "$LINENO" 5 + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: std::thread does not work; disabling threading" >&5 +$as_echo "$as_me: WARNING: std::thread does not work; disabling threading" >&2;} + fi fi fi ac_ext=c -- cgit v1.1