From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id B497D3858C66; Thu, 12 Jan 2023 14:59:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B497D3858C66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1673535556; bh=H/I59Cdx9U8WU6OD7ZFp5a0nL5n0wjqQv+jdKPjIe+4=; h=From:To:Subject:Date:From; b=AdEhPxX4soV12GI4gFVt28fQyTsPk6To8lkDwxDBTkjCBFK8uxGr+rBpR5EshWkIy iq0rM38rz8sohFI9H5qZpHfM9GirrhXOv5Gg4xBndK+hpiUXfy5ef0VrzLO9VT83vN 1peDN1rrBRAIVf2WYeykuw/5Q+lKFt/FMUxE+tP8= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb/gdb-13-branch] Set _WIN32_WINNT in common.m4 configure check X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/gdb-13-branch X-Git-Oldrev: 86ac3f1401297070ede1f1d3aac247260c14cd84 X-Git-Newrev: 3cc048fc6b1f29ea7f5de83815e56884bbd05f61 Message-Id: <20230112145916.B497D3858C66@sourceware.org> Date: Thu, 12 Jan 2023 14:59:16 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D3cc048fc6b1f= 29ea7f5de83815e56884bbd05f61 commit 3cc048fc6b1f29ea7f5de83815e56884bbd05f61 Author: Tom Tromey Date: Mon Jan 9 07:43:29 2023 -0700 Set _WIN32_WINNT in common.m4 configure check =20 GCC recently added support for the Windows thread model, enabling libstdc++ to support Windows natively. However, this supporrt requires a version of Windows later than the minimum version that is supported by GDB. =20 PR build/29966 points out that the GDB configure test for std::thread does not work in this situation, because _WIN32_WINNT is not defined in test program, and so seems to be fine. =20 This patch is an attempt to fix the problem, by using the same setting for _WIN32_WINNT at configure time as is used at build time. =20 I don't have access to one of the older systems so I don't think I can truly test this. I did do a mingw cross build, though. I'm going to ask the bug reporter to test it. =20 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D29966 =20 (cherry picked from commit 2124b2de4bba05063218501dcccfc4cffe648cda) Diff: --- gdb/configure | 12 +++++++++++- gdbserver/configure | 12 +++++++++++- gdbsupport/common-defs.h | 4 +++- gdbsupport/common.m4 | 13 ++++++++++++- gdbsupport/configure | 12 +++++++++++- 5 files changed, 48 insertions(+), 5 deletions(-) diff --git a/gdb/configure b/gdb/configure index 23e6b7160ec..bdea17043b5 100755 --- a/gdb/configure +++ b/gdb/configure @@ -25967,7 +25967,17 @@ if ${gdb_cv_cxx_std_thread+:} false; then : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include + #if defined (__MINGW32__) || defined (__CYGWIN__) + # ifdef _WIN32_WINNT + # if _WIN32_WINNT < 0x0501 + # undef _WIN32_WINNT + # define _WIN32_WINNT 0x0501 + # endif + # else + # define _WIN32_WINNT 0x0501 + # endif + #endif /* __MINGW32__ || __CYGWIN__ */ + #include void callback() { } int main () diff --git a/gdbserver/configure b/gdbserver/configure index 050264ed7da..6dc6b1ff6ad 100755 --- a/gdbserver/configure +++ b/gdbserver/configure @@ -7941,7 +7941,17 @@ if ${gdb_cv_cxx_std_thread+:} false; then : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include + #if defined (__MINGW32__) || defined (__CYGWIN__) + # ifdef _WIN32_WINNT + # if _WIN32_WINNT < 0x0501 + # undef _WIN32_WINNT + # define _WIN32_WINNT 0x0501 + # endif + # else + # define _WIN32_WINNT 0x0501 + # endif + #endif /* __MINGW32__ || __CYGWIN__ */ + #include void callback() { } int main () diff --git a/gdbsupport/common-defs.h b/gdbsupport/common-defs.h index bcebd7187d9..5e529f6febf 100644 --- a/gdbsupport/common-defs.h +++ b/gdbsupport/common-defs.h @@ -70,7 +70,9 @@ =20 /* We don't support Windows versions before XP, so we define _WIN32_WINNT correspondingly to ensure the Windows API headers - expose the required symbols. */ + expose the required symbols. + + NOTE: this must be kept in sync with common.m4. */ #if defined (__MINGW32__) || defined (__CYGWIN__) # ifdef _WIN32_WINNT # if _WIN32_WINNT < 0x0501 diff --git a/gdbsupport/common.m4 b/gdbsupport/common.m4 index 7b100262c29..b3aa27185ea 100644 --- a/gdbsupport/common.m4 +++ b/gdbsupport/common.m4 @@ -100,7 +100,18 @@ AC_DEFUN([GDB_AC_COMMON], [ AC_CACHE_CHECK([for std::thread], gdb_cv_cxx_std_thread, [AC_COMPILE_IFELSE([AC_LANG_PROGRAM( - [[#include + dnl NOTE: this must be kept in sync with common-defs.h. + [[#if defined (__MINGW32__) || defined (__CYGWIN__) + # ifdef _WIN32_WINNT + # if _WIN32_WINNT < 0x0501 + # undef _WIN32_WINNT + # define _WIN32_WINNT 0x0501 + # endif + # else + # define _WIN32_WINNT 0x0501 + # endif + #endif /* __MINGW32__ || __CYGWIN__ */ + #include void callback() { }]], [[std::thread t(callback);]])], gdb_cv_cxx_std_thread=3Dyes, diff --git a/gdbsupport/configure b/gdbsupport/configure index 38541e87c15..44dd8a9f704 100755 --- a/gdbsupport/configure +++ b/gdbsupport/configure @@ -8957,7 +8957,17 @@ if ${gdb_cv_cxx_std_thread+:} false; then : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include + #if defined (__MINGW32__) || defined (__CYGWIN__) + # ifdef _WIN32_WINNT + # if _WIN32_WINNT < 0x0501 + # undef _WIN32_WINNT + # define _WIN32_WINNT 0x0501 + # endif + # else + # define _WIN32_WINNT 0x0501 + # endif + #endif /* __MINGW32__ || __CYGWIN__ */ + #include void callback() { } int main ()