Conversation
765a4a4 to
e14a277
Compare
Autoconf, through the [`AC_PROG_CC`][] macro (called by libtool's [`LT_INIT`][]), tries to detect whether the C compiler needs options to enable C11 support (we require a C11 compiler). Autoconf development branch now understand hows to enable MSVC C11 support ([bug report][1], [patch][2]), which defaults to a C99 dialect. The code to detect C11 has also been fixed in the dev branch. We may use ac_prog_cc_stdc when Autoconf 2.73 is released. Note that clang-cl defaults to C17. It would be unfair to use Autoconf tests for missing or buggy C11 features if MSVC is in C99 mode, so we have to add `-std:c11` or `-std:c17` to `CFLAGS`. Our Autoconf tests can now expect a C11 compiler by default. The best-effort MSVC handling code can be removed once we switch to Autoconf 2.73. It works even if the user overwrites the `CFLAGS`, potentially disabling C11. [`AC_PROG_CC`]: https://www.gnu.org/software/autoconf/manual/autoconf-2.72/html_node/C-Compiler.html#index-AC_005fPROG_0 05fCC-1 [`LT_INIT`]: https://www.gnu.org/software/libtool/manual/html_node/LT_005fINIT.html [1]: https://lists.gnu.org/archive/html/autoconf/2024-04/msg00001.html [2]: http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commit;h=e9fee73dba5d2156abc48734b5a9faff89dcdc11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Autoconf, through the
AC_PROG_CCmacro (called by libtool'sLT_INIT), tries to detect whether the C compiler needs options to enable C11 support (we require a C11 compiler).Autoconf development branch now understand hows to enable MSVC C11 support (bug report, patch), which defaults to a C99 dialect. Note that clang-cl defaults to C17.
It would be unfair to use Autoconf tests for missing or buggy C11 features if MSVC is in C99 mode, so we have to add
-std:c11or-std:c17toCFLAGS.We can already re-organize our tests to assume C11, and, until Autoconf 2.73 is used, we can enable MSVC' C11 support by default. As it is still possible for the user to mess up the
CFLAGS, we can keep a convenience fallback re-enabling C11 in case it was disabled. I'm tempted to remove this fallback altogether (for instance, if the user inadvertently disables C11, Autoconf tests will use the C99 compiler until the fallback re-enabling C11 is reached…).The first and last commit should be reverted once we'll use Autoconf 2.73.
No change entry needed.