namespace std in <cuchar>.])
fi
+ CXXFLAGS="$CXXFLAGS -fchar8_t"
+ if test x"$ac_has_uchar_h" = x"yes"; then
+ AC_MSG_CHECKING([for c8rtomb and mbrtoc8 in <uchar.h> with -fchar8_t])
+ AC_TRY_COMPILE([#include <uchar.h>
+ namespace test
+ {
+ using ::c8rtomb;
+ using ::mbrtoc8;
+ }
+ ],
+ [], [ac_uchar_c8rtomb_mbrtoc8_fchar8_t=yes],
+ [ac_uchar_c8rtomb_mbrtoc8_fchar8_t=no])
+ else
+ ac_uchar_c8rtomb_mbrtoc8_fchar8_t=no
+ fi
+ AC_MSG_RESULT($ac_uchar_c8rtomb_mbrtoc8_fchar8_t)
+ if test x"$ac_uchar_c8rtomb_mbrtoc8_fchar8_t" = x"yes"; then
+ AC_DEFINE(_GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_FCHAR8_T, 1,
+ [Define if c8rtomb and mbrtoc8 functions in <uchar.h> should be
+ imported into namespace std in <cuchar> for -fchar8_t.])
+ fi
+
+ CXXFLAGS="$CXXFLAGS -std=c++20"
+ if test x"$ac_has_uchar_h" = x"yes"; then
+ AC_MSG_CHECKING([for c8rtomb and mbrtoc8 in <uchar.h> with -std=c++20])
+ AC_TRY_COMPILE([#include <uchar.h>
+ namespace test
+ {
+ using ::c8rtomb;
+ using ::mbrtoc8;
+ }
+ ],
+ [], [ac_uchar_c8rtomb_mbrtoc8_cxx20=yes],
+ [ac_uchar_c8rtomb_mbrtoc8_cxx20=no])
+ else
+ ac_uchar_c8rtomb_mbrtoc8_cxx20=no
+ fi
+ AC_MSG_RESULT($ac_uchar_c8rtomb_mbrtoc8_cxx20)
+ if test x"$ac_uchar_c8rtomb_mbrtoc8_cxx20" = x"yes"; then
+ AC_DEFINE(_GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_CXX20, 1,
+ [Define if c8rtomb and mbrtoc8 functions in <uchar.h> should be
+ imported into namespace std in <cuchar> for C++20.])
+ fi
+
CXXFLAGS="$ac_save_CXXFLAGS"
AC_LANG_RESTORE
])
/* Define if obsolescent tmpnam is available in <stdio.h>. */
#undef _GLIBCXX_USE_TMPNAM
+/* Define if c8rtomb and mbrtoc8 functions in <uchar.h> should be imported
+ into namespace std in <cuchar> for C++20. */
+#undef _GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_CXX20
+
+/* Define if c8rtomb and mbrtoc8 functions in <uchar.h> should be imported
+ into namespace std in <cuchar> for -fchar8_t. */
+#undef _GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_FCHAR8_T
+
/* Define if utime is available in <utime.h>. */
#undef _GLIBCXX_USE_UTIME
fi
+ CXXFLAGS="$CXXFLAGS -fchar8_t"
+ if test x"$ac_has_uchar_h" = x"yes"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for c8rtomb and mbrtoc8 in <uchar.h> with -fchar8_t" >&5
+$as_echo_n "checking for c8rtomb and mbrtoc8 in <uchar.h> with -fchar8_t... " >&6; }
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <uchar.h>
+ namespace test
+ {
+ using ::c8rtomb;
+ using ::mbrtoc8;
+ }
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ ac_uchar_c8rtomb_mbrtoc8_fchar8_t=yes
+else
+ ac_uchar_c8rtomb_mbrtoc8_fchar8_t=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ else
+ ac_uchar_c8rtomb_mbrtoc8_fchar8_t=no
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_uchar_c8rtomb_mbrtoc8_fchar8_t" >&5
+$as_echo "$ac_uchar_c8rtomb_mbrtoc8_fchar8_t" >&6; }
+ if test x"$ac_uchar_c8rtomb_mbrtoc8_fchar8_t" = x"yes"; then
+
+$as_echo "#define _GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_FCHAR8_T 1" >>confdefs.h
+
+ fi
+
+ CXXFLAGS="$CXXFLAGS -std=c++20"
+ if test x"$ac_has_uchar_h" = x"yes"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for c8rtomb and mbrtoc8 in <uchar.h> with -std=c++20" >&5
+$as_echo_n "checking for c8rtomb and mbrtoc8 in <uchar.h> with -std=c++20... " >&6; }
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <uchar.h>
+ namespace test
+ {
+ using ::c8rtomb;
+ using ::mbrtoc8;
+ }
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ ac_uchar_c8rtomb_mbrtoc8_cxx20=yes
+else
+ ac_uchar_c8rtomb_mbrtoc8_cxx20=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ else
+ ac_uchar_c8rtomb_mbrtoc8_cxx20=no
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_uchar_c8rtomb_mbrtoc8_cxx20" >&5
+$as_echo "$ac_uchar_c8rtomb_mbrtoc8_cxx20" >&6; }
+ if test x"$ac_uchar_c8rtomb_mbrtoc8_cxx20" = x"yes"; then
+
+$as_echo "#define _GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_CXX20 1" >>confdefs.h
+
+ fi
+
CXXFLAGS="$ac_save_CXXFLAGS"
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
#ifdef _GLIBCXX_NAMESPACE_C
+#if (_GLIBCXX_USE_CHAR8_T \
+ && (_GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_FCHAR8_T \
+ || (__cplusplus >= 202002 \
+ && _GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_CXX20)))
+using std::mbrtoc8;
+using std::c8rtomb;
+#endif // _GLIBCXX_USE_CHAR8_T
+
#if _GLIBCXX_USE_C11_UCHAR_CXX11
using std::mbrtoc16;
using std::c16rtomb;
#include <bits/c++config.h>
#include <cwchar>
-#if _GLIBCXX_USE_C11_UCHAR_CXX11
+#if (_GLIBCXX_USE_C11_UCHAR_CXX11 \
+ || (_GLIBCXX_USE_CHAR8_T \
+ && (_GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_FCHAR8_T \
+ || (__cplusplus >= 202002 \
+ && _GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_CXX20))))
#include <uchar.h>
+#endif
+
+
+// Support for mbrtoc8 and c8rtomb is conditioned on support by the C library.
+#if (_GLIBCXX_USE_CHAR8_T \
+ && (_GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_FCHAR8_T \
+ || (__cplusplus >= 202002 \
+ && _GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_CXX20)))
+
+#undef mbrtoc8
+#undef c8rtomb
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ using ::mbrtoc8;
+ using ::c8rtomb;
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std
+
+#endif // _GLIBCXX_USE_CHAR8_T
+
+
+#if _GLIBCXX_USE_C11_UCHAR_CXX11
+
// Get rid of those macros defined in <uchar.h> in lieu of real functions.
#undef mbrtoc16
#undef c16rtomb
#if _GLIBCXX_USE_C11_UCHAR_CXX11
+#if (_GLIBCXX_USE_C11_UCHAR_CXX11 \
+ || (_GLIBCXX_USE_CHAR8_T \
+ && (_GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_FCHAR8_T \
+ || (__cplusplus >= 202002 \
+ && _GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_CXX20))))
+
#include <uchar.h>
+
+#endif
+
+
+// Support for mbrtoc8 and c8rtomb is conditioned on support by the C library.
+#if (_GLIBCXX_USE_CHAR8_T \
+ && (_GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_FCHAR8_T \
+ || (__cplusplus >= 202002 \
+ && _GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_CXX20)))
+
+// Get rid of those macros defined in <uchar.h> in lieu of real functions.
+#undef mbrtoc8
+#undef c8rtomb
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ using ::mbrtoc8;
+ using ::c8rtomb;
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std
+
+#endif // _GLIBCXX_USE_CHAR8_T
+
+
+#if _GLIBCXX_USE_C11_UCHAR_CXX11
+
// Get rid of those macros defined in <uchar.h> in lieu of real functions.
#undef mbrtoc16
--- /dev/null
+// { dg-options "-std=c++20" }
+// { dg-do compile { target c++20 } }
+
+#include <cuchar>
+
+namespace gnu
+{
+#if _GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_CXX20
+ using std::mbrtoc8;
+ using std::c8rtomb;
+#endif // _GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_CXX20
+}
--- /dev/null
+// { dg-options "-fchar8_t" }
+// { dg-do compile { target c++11 } }
+
+#include <cuchar>
+
+namespace gnu
+{
+#if _GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_FCHAR8_T
+ using std::mbrtoc8;
+ using std::c8rtomb;
+#endif // _GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_FCHAR8_T
+}