[libcxx] Don't autodetect pthreads on MinGW
authorMartin Storsjö <martin@martin.st>
Fri, 1 Oct 2021 20:44:17 +0000 (23:44 +0300)
committerMartin Storsjö <martin@martin.st>
Tue, 5 Oct 2021 07:46:48 +0000 (10:46 +0300)
commita8d15a926689c126c4d316788786e0160cfc1d5d
tree8e76b5caeb5c39c8f8d98b30eb4e67332429adf5
parenta785e5c3958eda8aafd6a6da2b23be2b92d3b165
[libcxx] Don't autodetect pthreads on MinGW

e9ee517930f76a972fcda00d9dd0466db80d60f7 added support for using
winpthreads on Windows, enabled if `__WINPTHREADS_VERSION` was
defined (i.e. if winpthreads headers have been included before
including libcxx `__config`). This was fragile (libcxx changed
behaviour depending on what headers had been included externally
before), and was changed in a1bc823a59d5b6f310bdf6c7c7b62ec71b87d1aa
to use pthreads on Windows whenever the pthread.h header was
available.

This is also fragile; pthread.h might be unavailable while building
libcxx but installed later, and available when users include the
libcxx headers.

In practice, in every modern setup for building libcxx for Windows
I've seen, users end up manually configuring it with
`LIBCXX_HAS_WIN32_THREAD_API=ON`, as the users may have winpthreads
installed (for other libraries/projects to use) while wanting to
build libcxx with the default win32 threading.

Don't automatically pick up pthreads on Windows even if the header
is available. Instead require the user to configure the libcxx
build with `LIBCXX_HAS_PTHREAD_API=ON` if that's desired.

Differential Revision: https://reviews.llvm.org/D110975
libcxx/include/__config