Skip to content

Commit 3ec22f0

Browse files
committed
Merge branch 'maint'
2 parents 908a89a + 1784109 commit 3ec22f0

2 files changed

Lines changed: 80 additions & 10 deletions

File tree

erts/configure

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26388,6 +26388,8 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
2638826388

2638926389
old_CXXFLAGS=$CXXFLAGS
2639026390
CXXFLAGS="$CXXFLAGS -std=c++17"
26391+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++17 support" >&5
26392+
printf %s "checking for C++17 support... " >&6; }
2639126393
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
2639226394
/* end confdefs.h. */
2639326395

@@ -26397,24 +26399,68 @@ main (void)
2639726399
#if __cplusplus < 201703L
2639826400
#error "Needs C++17 compiler"
2639926401
#endif
26402+
2640026403
;
2640126404
return 0;
2640226405
}
26406+
2640326407
_ACEOF
2640426408
if ac_fn_cxx_try_compile "$LINENO"
2640526409
then :
26406-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++17 support" >&5
26407-
printf %s "checking for C++17 support... " >&6; }
26410+
2640826411
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
2640926412
printf "%s\n" "yes" >&6; }
2641026413
HAVE_CXX17=true
26414+
26415+
if test "$builtin_ryu" = "no"
26416+
then :
26417+
26418+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ std::to_chars" >&5
26419+
printf %s "checking for C++ std::to_chars... " >&6; }
26420+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
26421+
/* end confdefs.h. */
26422+
26423+
#include <charconv>
26424+
26425+
int
26426+
main (void)
26427+
{
26428+
26429+
char fbuf[20];
26430+
std::to_chars(fbuf, fbuf + sizeof(fbuf), 3.14);
26431+
26432+
;
26433+
return 0;
26434+
}
26435+
26436+
_ACEOF
26437+
if ac_fn_cxx_try_compile "$LINENO"
26438+
then :
26439+
26440+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
26441+
printf "%s\n" "yes" >&6; }
26442+
2641126443
else case e in #(
26412-
e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++17 support" >&5
26413-
printf %s "checking for C++17 support... " >&6; }
26444+
e)
26445+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
26446+
printf "%s\n" "no" >&6; }
26447+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: C++17 support found but no std::to_chars for floating point" >&5
26448+
printf "%s\n" "$as_me: WARNING: C++17 support found but no std::to_chars for floating point" >&2;}
26449+
as_fn_error $? "Alternative to builtin ryu needs C++17 with std::to_chars" "$LINENO" 5
26450+
;;
26451+
esac
26452+
fi
26453+
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
26454+
26455+
fi
26456+
26457+
else case e in #(
26458+
e)
2641426459
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
2641526460
printf "%s\n" "no" >&6; }
2641626461
CXXFLAGS=$old_CXXFLAGS
26417-
HAVE_CXX17=false ;;
26462+
HAVE_CXX17=false
26463+
;;
2641826464
esac
2641926465
fi
2642026466
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext

erts/configure.ac

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3099,18 +3099,42 @@ AS_IF([test ${enable_jit} != no -o "$builtin_ryu" = "no"],
30993099
AC_LANG_PUSH(C++)
31003100
old_CXXFLAGS=$CXXFLAGS
31013101
CXXFLAGS="$CXXFLAGS -std=c++17"
3102+
AC_MSG_CHECKING([for C++17 support])
31023103
AC_COMPILE_IFELSE(
31033104
[AC_LANG_PROGRAM([[]],
31043105
[[#if __cplusplus < 201703L
31053106
#error "Needs C++17 compiler"
3106-
#endif]])],
3107-
[AC_MSG_CHECKING([for C++17 support])
3107+
#endif
3108+
]])
3109+
],[
31083110
AC_MSG_RESULT([yes])
3109-
HAVE_CXX17=true],
3110-
[AC_MSG_CHECKING([for C++17 support])
3111+
HAVE_CXX17=true
3112+
3113+
AS_IF([test "$builtin_ryu" = "no"],
3114+
[
3115+
AC_MSG_CHECKING([for C++ std::to_chars])
3116+
AC_COMPILE_IFELSE(
3117+
[AC_LANG_PROGRAM(
3118+
[[
3119+
#include <charconv>
3120+
]],
3121+
[[
3122+
char fbuf[20];
3123+
std::to_chars(fbuf, fbuf + sizeof(fbuf), 3.14);
3124+
]])
3125+
],[
3126+
AC_MSG_RESULT([yes])
3127+
],[
3128+
AC_MSG_RESULT([no])
3129+
AC_MSG_WARN([C++17 support found but no std::to_chars for floating point])
3130+
AC_MSG_ERROR([Alternative to builtin ryu needs C++17 with std::to_chars])
3131+
])
3132+
])
3133+
],[
31113134
AC_MSG_RESULT([no])
31123135
CXXFLAGS=$old_CXXFLAGS
3113-
HAVE_CXX17=false])
3136+
HAVE_CXX17=false
3137+
])
31143138
AC_LANG_POP()
31153139
])
31163140
if test "$CXX" = false -o "$HAVE_CXX17" = false; then

0 commit comments

Comments
 (0)