curl/m4
Viktor Szakats 2100d9fde2
cmake: pre-fill rest of detection values for Windows
The goal of this patch is to avoid unnecessary feature detection work
when doing Windows builds with CMake. Do this by pre-filling well-known
detection results for Windows and specifically for mingw-w64 and MSVC
compilers. Also limit feature checks to platforms where the results are
actually used. Drop a few redundant ones. And some tidying up.

- pre-fill remaining detection values in Windows CMake builds.

  Based on actual detection results observed in CI runs, preceding
  similar work over libssh2 and matching up values with
  `lib/config-win32.h`.

  This brings down CMake configuration time from 58 to 14 seconds on the
  same local machine.

  On AppVeyor CI this translates to:
  - 128 seconds -> 50 seconds VS2022 MSVC with OpenSSL (per CMake job):
    https://ci.appveyor.com/project/curlorg/curl/builds/48208419/job/4gw66ecrjpy7necb#L296
    https://ci.appveyor.com/project/curlorg/curl/builds/48217440/job/8m4fwrr2fe249uo8#L186
  - 62 seconds -> 16 seconds VS2017 MINGW (per CMake job):
    https://ci.appveyor.com/project/curlorg/curl/builds/48208419/job/s1y8q5ivlcs7ub29?fullLog=true#L290
    https://ci.appveyor.com/project/curlorg/curl/builds/48217440/job/pchpxyjsyc9kl13a?fullLog=true#L194

  The formula is about 1-3 seconds delay for each detection. Almost all
  of these trigger a full compile-link cycle behind the scenes, slow
  even today, both cross and native, mingw-w64 and apparently MSVC too.
  Enabling .map files or other custom build features slows it down
  further. (Similar is expected for autotools configure.)

- stop detecting `idn2.h` if idn2 was deselected.
  autotools does this.

- stop detecting `idn2.h` if idn2 was not found.
  This deviates from autotools. Source code requires both header and
  lib, so this is still correct, but faster.

- limit `ADDRESS_FAMILY` detection to Windows.

- normalize `HAVE_WIN32_WINNT` value to lowercase `0x0a12` format.

- pre-fill `HAVE_WIN32_WINNT`-dependent detection results.
  Saving 4 (slow) feature-detections in most builds: `getaddrinfo`,
  `freeaddrinfo`, `inet_ntop`, `inet_pton`

- fix pre-filled `HAVE_SYS_TIME_H`, `HAVE_SYS_PARAM_H`,
  `HAVE_GETTIMEOFDAY` for mingw-w64.
  Luckily this do not change build results, as `WIN32` took
  priority over `HAVE_GETTIMEOFDAY` with the current source
  code.

- limit `HAVE_CLOCK_GETTIME_MONOTONIC_RAW` and
  `HAVE_CLOCK_GETTIME_MONOTONIC` detections to non-Windows.
  We're not using these in the source code for Windows.

- reduce compiler warning noise in CMake internal logs:
  - fix to include `winsock2.h` before `windows.h`.
    Apply it to autotools test snippets too.
  - delete previous `-D_WINSOCKAPI_=` hack that aimed to fix the above.
  - cleanup `CMake/CurlTests.c` to emit less warnings.

- delete redundant `HAVE_MACRO_SIGSETJMP` feature check.
  It was the same check as `HAVE_SIGSETJMP`.

- delete 'experimental' marking from `CURL_USE_OPENSSL`.

- show CMake version via `CMakeLists.txt`.
  Credit to the `zlib-ng` project for the idea:
  61e181c8ae/CMakeLists.txt (L7)

- make `CMake/CurlTests.c` pass `checksrc`.

- `CMake/WindowsCache.cmake` tidy-ups.

- replace `WIN32` guard with `_WIN32` in `CMake/CurlTests.c`.

Closes #12044
2023-10-24 21:06:36 +00:00
..
.gitignore copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
curl-amissl.m4 amissl: fix AmiSSL v5 detection 2023-07-21 12:45:11 +02:00
curl-bearssl.m4 tidy-up: mostly whitespace nits 2023-08-31 23:02:10 +00:00
curl-compilers.m4 autotools: sync up clang picky warnings with cmake 2023-04-17 11:35:56 +00:00
curl-confopts.m4 misc: fix spelling mistakes 2023-05-23 10:42:09 +02:00
curl-functions.m4 cmake: pre-fill rest of detection values for Windows 2023-10-24 21:06:36 +00:00
curl-gnutls.m4 copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
curl-mbedtls.m4 tidy-up: mostly whitespace nits 2023-08-31 23:02:10 +00:00
curl-openssl.m4 build: do not publish HAVE_BORINGSSL, HAVE_AWSLC macros 2023-10-08 22:29:45 +00:00
curl-override.m4 copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
curl-reentrant.m4 copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
curl-rustls.m4 tidy-up: mostly whitespace nits 2023-08-31 23:02:10 +00:00
curl-schannel.m4 copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
curl-sectransp.m4 cmake, configure: also link with CoreServices 2023-09-20 08:38:19 +02:00
curl-sysconfig.m4 cmake, configure: also link with CoreServices 2023-09-20 08:38:19 +02:00
curl-wolfssl.m4 tidy-up: mostly whitespace nits 2023-08-31 23:02:10 +00:00
xc-am-iface.m4 build: drop the use of XC_AMEND_DISTCLEAN 2023-03-03 09:54:44 +01:00
xc-cc-check.m4 copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
xc-lt-iface.m4 copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
xc-translit.m4 copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
xc-val-flgs.m4 copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
zz40-xc-ovr.m4 copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
zz50-xc-ovr.m4 copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
zz60-xc-ovr.m4 copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00