gcc/libstdc++-v3/crossconfig.m4
Jonathan Wakely b02923592a Add support for opening file streams from wide character strings
C++17 added new overloads to <fstream> class templates to support
opening files from wide character strings "on systems where
filesystem::path::value_type is not char". This patch adds those
overloads conditional on _wfopen being available, and enables them for
pre-C++17 modes as well.

	Add support for opening file streams from wide character strings.
	* config/io/basic_file_stdio.cc [_GLIBCXX_HAVE__WFOPEN]
	(__basic_file<char>::open(const wchar_t*, ios_base::openmode)):
	Define new overload.
	* config/io/basic_file_stdio.h [_GLIBCXX_HAVE__WFOPEN]
	(__basic_file<char>::open(const wchar_t*, ios_base::openmode)):
	Declare new overload.
	* configure.ac: Check for _wfopen.
	* crossconfig.m4: Likewise.
	* configure: Regenerate.
	* config.h.in: Regenerate.
	* include/bits/fstream.tcc [_GLIBCXX_HAVE__WFOPEN]
	(basic_filebuf<C,T>::open(const wchar_t*, ios_base::openmode)):
	Define new overload.
	* include/std/fstream [_GLIBCXX_HAVE__WFOPEN]
	(basic_filebuf<C,T>::open(const wchar_t*, ios_base::openmode)):
	Declare new overload.
	[_GLIBCXX_HAVE__WFOPEN]
	(basic_ifstream<C,T>::basic_ifstream(const wchar_t*, openmode))
	(basic_ifstream<C,T>::basic_open(const wchar_t*, openmode))
	(basic_ofstream<C,T>::basic_ifstream(const wchar_t*, openmode))
	(basic_ofstream<C,T>::basic_open(const wchar_t*, openmode))
	(basic_fstream<C,T>::basic_ifstream(const wchar_t*, openmode))
	(basic_fstream<C,T>::basic_open(const wchar_t*, openmode)): Define
	new overloads.
	* testsuite/27_io/basic_filebuf/open/wchar_t/1.cc: New.
	* testsuite/27_io/basic_ifstream/cons/wchar_t/1.cc: New.
	* testsuite/27_io/basic_ifstream/open/wchar_t/1.cc: New.
	* testsuite/27_io/basic_ofstream/cons/wchar_t/1.cc: New.
	* testsuite/27_io/basic_ofstream/open/wchar_t/1.cc: New.
	* testsuite/27_io/basic_fstream/cons/wchar_t/1.cc: New.
	* testsuite/27_io/basic_fstream/open/wchar_t/1.cc: New.

From-SVN: r260479
2018-05-21 18:18:35 +01:00

299 lines
7.6 KiB
Plaintext

dnl
dnl This file contains details for non-native builds.
dnl
AC_DEFUN([GLIBCXX_CROSSCONFIG],[
# Base decisions on target environment.
case "${host}" in
arm*-*-symbianelf*)
# This is a freestanding configuration; there is nothing to do here.
;;
avr*-*-*)
AC_DEFINE(HAVE_ACOSF)
AC_DEFINE(HAVE_ASINF)
AC_DEFINE(HAVE_ATAN2F)
AC_DEFINE(HAVE_ATANF)
AC_DEFINE(HAVE_CEILF)
AC_DEFINE(HAVE_COSF)
AC_DEFINE(HAVE_COSHF)
AC_DEFINE(HAVE_EXPF)
AC_DEFINE(HAVE_FABSF)
AC_DEFINE(HAVE_FLOORF)
AC_DEFINE(HAVE_FMODF)
AC_DEFINE(HAVE_FREXPF)
AC_DEFINE(HAVE_SQRTF)
AC_DEFINE(HAVE_HYPOTF)
AC_DEFINE(HAVE_LDEXPF)
AC_DEFINE(HAVE_LOG10F)
AC_DEFINE(HAVE_LOGF)
AC_DEFINE(HAVE_MODFF)
AC_DEFINE(HAVE_POWF)
AC_DEFINE(HAVE_SINF)
AC_DEFINE(HAVE_SINHF)
AC_DEFINE(HAVE_TANF)
AC_DEFINE(HAVE_TANHF)
;;
mips*-sde-elf*)
# These definitions are for the SDE C library rather than newlib.
SECTION_FLAGS='-ffunction-sections -fdata-sections'
AC_SUBST(SECTION_FLAGS)
GLIBCXX_CHECK_COMPILER_FEATURES
GLIBCXX_CHECK_LINKER_FEATURES
GLIBCXX_CHECK_MATH_SUPPORT
GLIBCXX_CHECK_STDLIB_SUPPORT
AC_DEFINE(HAVE_FINITE)
AC_DEFINE(HAVE_HYPOT)
AC_DEFINE(HAVE_ISNAN)
AC_DEFINE(HAVE_ISINF)
AC_DEFINE(HAVE_LDEXPF)
AC_DEFINE(HAVE_MODF)
AC_DEFINE(HAVE_SQRTF)
;;
spu-*-elf*)
GLIBCXX_CHECK_COMPILER_FEATURES
GLIBCXX_CHECK_LINKER_FEATURES
GLIBCXX_CHECK_MATH_SUPPORT
GLIBCXX_CHECK_STDLIB_SUPPORT
AM_ICONV
;;
*-aix*)
GLIBCXX_CHECK_LINKER_FEATURES
GLIBCXX_CHECK_MATH_SUPPORT
GLIBCXX_CHECK_STDLIB_SUPPORT
AC_DEFINE(_GLIBCXX_USE_RANDOM_TR1)
# We don't yet support AIX's TLS ABI.
#GCC_CHECK_TLS
AM_ICONV
;;
*-darwin*)
# Darwin versions vary, but the linker should work in a cross environment,
# so we just check for all the features here.
# Check for available headers.
# Don't call GLIBCXX_CHECK_LINKER_FEATURES, Darwin doesn't have a GNU ld
GLIBCXX_CHECK_MATH_SUPPORT
GLIBCXX_CHECK_STDLIB_SUPPORT
;;
*djgpp)
# GLIBCXX_CHECK_MATH_SUPPORT
AC_DEFINE(HAVE_ISINF)
AC_DEFINE(HAVE_ISNAN)
AC_DEFINE(HAVE_FINITE)
AC_DEFINE(HAVE_SINCOS)
AC_DEFINE(HAVE_HYPOT)
;;
*-freebsd*)
SECTION_FLAGS='-ffunction-sections -fdata-sections'
AC_SUBST(SECTION_FLAGS)
GLIBCXX_CHECK_LINKER_FEATURES
AC_DEFINE(HAVE_SETENV)
AC_DEFINE(HAVE_FINITEF)
AC_DEFINE(HAVE_FINITE)
AC_DEFINE(HAVE_FREXPF)
AC_DEFINE(HAVE_HYPOT)
AC_DEFINE(HAVE_HYPOTF)
AC_DEFINE(HAVE_ISINF)
AC_DEFINE(HAVE_ISNAN)
AC_DEFINE(HAVE_ISNANF)
AC_DEFINE(HAVE_ACOSF)
AC_DEFINE(HAVE_ASINF)
AC_DEFINE(HAVE_ATAN2F)
AC_DEFINE(HAVE_ATANF)
AC_DEFINE(HAVE_CEILF)
AC_DEFINE(HAVE_COSF)
AC_DEFINE(HAVE_COSHF)
AC_DEFINE(HAVE_EXPF)
AC_DEFINE(HAVE_FABSF)
AC_DEFINE(HAVE_FLOORF)
AC_DEFINE(HAVE_FMODF)
AC_DEFINE(HAVE_FREXPF)
AC_DEFINE(HAVE_LDEXPF)
AC_DEFINE(HAVE_LOG10F)
AC_DEFINE(HAVE_LOGF)
AC_DEFINE(HAVE_MODFF)
AC_DEFINE(HAVE_POWF)
AC_DEFINE(HAVE_SINF)
AC_DEFINE(HAVE_SINHF)
AC_DEFINE(HAVE_SQRTF)
AC_DEFINE(HAVE_TANF)
AC_DEFINE(HAVE_TANHF)
if test x"long_double_math_on_this_cpu" = x"yes"; then
AC_DEFINE(HAVE_FINITEL)
AC_DEFINE(HAVE_ISINFL)
AC_DEFINE(HAVE_ISNANL)
fi
AC_CHECK_FUNCS(__cxa_thread_atexit)
AC_CHECK_FUNCS(aligned_alloc posix_memalign memalign _aligned_malloc)
;;
*-fuchsia*)
SECTION_FLAGS='-ffunction-sections -fdata-sections'
AC_SUBST(SECTION_FLAGS)
;;
*-hpux*)
SECTION_FLAGS='-ffunction-sections -fdata-sections'
AC_SUBST(SECTION_FLAGS)
GLIBCXX_CHECK_LINKER_FEATURES
# GLIBCXX_CHECK_MATH_SUPPORT
AC_DEFINE(HAVE_ISNAN)
AC_DEFINE(HAVE_HYPOT)
AC_DEFINE(HAVE_ACOSF)
AC_DEFINE(HAVE_ASINF)
AC_DEFINE(HAVE_ATANF)
AC_DEFINE(HAVE_COSF)
AC_DEFINE(HAVE_COSHF)
AC_DEFINE(HAVE_SINF)
AC_DEFINE(HAVE_SINHF)
AC_DEFINE(HAVE_TANF)
AC_DEFINE(HAVE_TANHF)
AC_DEFINE(HAVE_EXPF)
AC_DEFINE(HAVE_ATAN2F)
AC_DEFINE(HAVE_FABSF)
AC_DEFINE(HAVE_FMODF)
AC_DEFINE(HAVE_FREXPF)
AC_DEFINE(HAVE_LOGF)
AC_DEFINE(HAVE_LOG10F)
AC_DEFINE(HAVE_MODF)
AC_DEFINE(HAVE_POWF)
AC_DEFINE(HAVE_SQRTF)
# GLIBCXX_CHECK_STDLIB_SUPPORT
AC_DEFINE(HAVE_STRTOLD)
GCC_CHECK_TLS
case "$target" in
*-hpux10*)
AC_DEFINE(HAVE_ISINF)
AC_DEFINE(HAVE_ISINFF)
AC_DEFINE(HAVE_ISNANF)
AC_DEFINE(HAVE_FINITE)
AC_DEFINE(HAVE_FINITEF)
;;
esac
;;
*-linux* | *-uclinux* | *-gnu* | *-kfreebsd*-gnu | *-cygwin* | *-solaris*)
GLIBCXX_CHECK_COMPILER_FEATURES
GLIBCXX_CHECK_LINKER_FEATURES
GLIBCXX_CHECK_MATH_SUPPORT
GLIBCXX_CHECK_STDLIB_SUPPORT
AC_DEFINE(_GLIBCXX_USE_RANDOM_TR1)
GCC_CHECK_TLS
AC_CHECK_FUNCS(__cxa_thread_atexit_impl)
AC_CHECK_FUNCS(aligned_alloc posix_memalign memalign _aligned_malloc)
AM_ICONV
;;
*-mingw32*)
GLIBCXX_CHECK_LINKER_FEATURES
GLIBCXX_CHECK_MATH_SUPPORT
GLIBCXX_CHECK_STDLIB_SUPPORT
AC_CHECK_FUNCS(aligned_alloc posix_memalign memalign _aligned_malloc)
AC_CHECK_FUNCS(_wfopen)
;;
*-netbsd*)
SECTION_FLAGS='-ffunction-sections -fdata-sections'
AC_SUBST(SECTION_FLAGS)
GLIBCXX_CHECK_LINKER_FEATURES
AC_DEFINE(HAVE_FINITEF)
AC_DEFINE(HAVE_FINITE)
AC_DEFINE(HAVE_FREXPF)
AC_DEFINE(HAVE_HYPOTF)
AC_DEFINE(HAVE_ISINF)
AC_DEFINE(HAVE_ISINFF)
AC_DEFINE(HAVE_ISNAN)
AC_DEFINE(HAVE_ISNANF)
if test x"long_double_math_on_this_cpu" = x"yes"; then
AC_DEFINE(HAVE_FINITEL)
AC_DEFINE(HAVE_ISINFL)
AC_DEFINE(HAVE_ISNANL)
fi
;;
*-qnx6.1* | *-qnx6.2*)
SECTION_FLAGS='-ffunction-sections -fdata-sections'
AC_SUBST(SECTION_FLAGS)
GLIBCXX_CHECK_LINKER_FEATURES
AC_DEFINE(HAVE_COSF)
AC_DEFINE(HAVE_COSL)
AC_DEFINE(HAVE_COSHF)
AC_DEFINE(HAVE_COSHL)
AC_DEFINE(HAVE_LOGF)
AC_DEFINE(HAVE_LOGL)
AC_DEFINE(HAVE_LOG10F)
AC_DEFINE(HAVE_LOG10L)
AC_DEFINE(HAVE_SINF)
AC_DEFINE(HAVE_SINL)
AC_DEFINE(HAVE_SINHF)
AC_DEFINE(HAVE_SINHL)
;;
*-rtems*)
GLIBCXX_CHECK_COMPILER_FEATURES
GLIBCXX_CHECK_LINKER_FEATURES
GLIBCXX_CHECK_MATH_SUPPORT
GLIBCXX_CHECK_STDLIB_SUPPORT
;;
*-tpf)
SECTION_FLAGS='-ffunction-sections -fdata-sections'
SECTION_LDFLAGS='-Wl,--gc-sections $SECTION_LDFLAGS'
AC_SUBST(SECTION_FLAGS)
AC_DEFINE(HAVE_FINITE)
AC_DEFINE(HAVE_FINITEF)
AC_DEFINE(HAVE_FREXPF)
AC_DEFINE(HAVE_HYPOTF)
AC_DEFINE(HAVE_ISINF)
AC_DEFINE(HAVE_ISINFF)
AC_DEFINE(HAVE_ISNAN)
AC_DEFINE(HAVE_ISNANF)
AC_DEFINE(HAVE_SINCOS)
AC_DEFINE(HAVE_SINCOSF)
if test x"long_double_math_on_this_cpu" = x"yes"; then
AC_DEFINE(HAVE_FINITEL)
AC_DEFINE(HAVE_HYPOTL)
AC_DEFINE(HAVE_ISINFL)
AC_DEFINE(HAVE_ISNANL)
fi
;;
*-*vms*)
# Check for available headers.
# Don't call GLIBCXX_CHECK_LINKER_FEATURES, VMS doesn't have a GNU ld
GLIBCXX_CHECK_MATH_SUPPORT
GLIBCXX_CHECK_STDLIB_SUPPORT
;;
*-vxworks)
AC_DEFINE(HAVE_ACOSF)
AC_DEFINE(HAVE_ASINF)
AC_DEFINE(HAVE_ATAN2F)
AC_DEFINE(HAVE_ATANF)
AC_DEFINE(HAVE_CEILF)
AC_DEFINE(HAVE_COSF)
AC_DEFINE(HAVE_COSHF)
AC_DEFINE(HAVE_EXPF)
AC_DEFINE(HAVE_FABSF)
AC_DEFINE(HAVE_FLOORF)
AC_DEFINE(HAVE_FMODF)
AC_DEFINE(HAVE_HYPOT)
AC_DEFINE(HAVE_LOG10F)
AC_DEFINE(HAVE_LOGF)
AC_DEFINE(HAVE_POWF)
AC_DEFINE(HAVE_SINF)
AC_DEFINE(HAVE_SINHF)
AC_DEFINE(HAVE_SQRTF)
AC_DEFINE(HAVE_TANF)
AC_DEFINE(HAVE_TANHF)
;;
*)
AC_MSG_ERROR([No support for this host/target combination.])
;;
esac
])