Re: configure adds -std=gnu++11 to CXX variable
Peter Johansson <[email protected]> Sun, 26 May 2024 22:51:53 +1000
| Newsgroups | gmane.comp.sysutils.autoconf.general |
|---|---|
| Message-ID | <[email protected]> |
Hi Zack, On 5/3/24 00:54, Zack Weinberg wrote: >> conftest.cpp: In function 'int main(int, char**)': >> conftest.cpp:199:22: error: invalid conversion from 'const char8_t*' to >> 'const char*' [-fpermissive] >> 199 | char const *utf8 = u8"UTF-8 string \u2500"; > Fixing these things is a high priority for Autoconf 2.73 but nobody > currently has time to work on it. If you have time, we would > appreciate your working on it -- even just a rough draft of revised > test programs would be helpful. Please find a trivial patch that makes the test pass when compiled with a C++20 compiler. I simply removed the line mentioned above and that sufficed. If someone knows how to write something similar that works both in C++11 and C++20, I'm very keen to hear. I'veĀ tested this with g++ 11.4 (Ubuntu) and the following small configure.ac AC_INIT([hello], [1.0]) AC_LANG([C++]) AC_PROG_CXXCPP AC_PROG_CXX AC_CONFIG_FILES([Makefile]) AC_OUTPUT Makefile.in: CXX = @CXX@ and $ autoconf $ ./configure CXX="g++ -std=c++20" results in Makefile: CXX = g++ -std=c++20 whereas without the patch the resulting Makefile is CXX = g++ -std=c++20 -std=gnu++11 I'm not sure if it's practical to add that a test in the test suite, since the expected behavior depends very much on compiler versions and so on. Happy to help with this further if possible and when people have agreed on a what interface is ideal. Cheers, Peter
autoconf.accept.c++20.compiler.patch
(text/x-patch, 364 B)
diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4
index 89f6a608..35dc7676 100644
--- a/lib/autoconf/c.m4
+++ b/lib/autoconf/c.m4
@@ -2759,7 +2759,6 @@ ac_cxx_conftest_cxx11_main='
}
{
// Unicode literals
- char const *utf8 = u8"UTF-8 string \u2500";
char16_t const *utf16 = u"UTF-8 string \u2500";
char32_t const *utf32 = U"UTF-32 string \u2500";
}