dnl
+dnl GLIBCXX_CONDITIONAL (NAME, SHELL-TEST)
+dnl
+dnl Exactly like AM_CONDITIONAL, but delays evaluation of the test until the
+dnl end of configure. This lets tested variables be reassigned, and the
+dnl conditional will depend on the final state of the variable. For a simple
+dnl example of why this is needed, see GLIBCXX_ENABLE_HOSTED.
+dnl
+m4_define([_m4_divert(glibcxx_diversion)], 8000)dnl
+AC_DEFUN(GLIBCXX_CONDITIONAL, [dnl
+ m4_divert_text([glibcxx_diversion],dnl
+ AM_CONDITIONAL([$1],[$2])
+ )dnl
+])dnl
+AC_DEFUN(GLIBCXX_EVALUATE_CONDITIONALS, [m4_undivert([glibcxx_diversion])])dnl
+
+
+dnl
dnl Check to see what architecture and operating system we are compiling
dnl for. Also, if architecture- or OS-specific flags are required for
dnl compilation, pick them up here.
dnl
dnl Sets:
dnl gcc_version (x.y.z format)
+dnl SUBDIRS
dnl Substs:
dnl glibcxx_builddir (absolute path)
dnl glibcxx_srcdir (absolute path)
dnl - lots of tools, like CC and CXX
dnl
AC_DEFUN(GLIBCXX_CONFIGURE, [
+ # Keep these sync'd with the list in Makefile.am. The first provides an
+ # expandable list at autoconf time; the second provides an expandable list
+ # (i.e., shell variable) at configure time.
+ m4_define([glibcxx_SUBDIRS],[include libmath libsupc++ src po testsuite])
+ SUBDIRS='glibcxx_SUBDIRS'
+
# These need to be absolute paths, yet at the same time need to
# canonicalize only relative paths, because then amd will not unmount
# drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd.
AC_HELP_STRING([--with-newlib],
[assume newlib as a system C library]))
- AC_PROG_CC
-
# We're almost certainly being configured before anything else which uses
# C++, so all of our AC_PROG_* discoveries will be cached. It's vital that
# we not cache the value of CXX that we "discover" here, because it's set
# wrong (non-multilib-adjusted) value will be used in multilibs. This
# little trick also affects CPPFLAGS, CXXFLAGS, and LDFLAGS. And as a side
# effect, CXXFLAGS is no longer automagically subst'd, so we have to do
- # that ourselves.
+ # that ourselves. Un-preciousing AC_PROG_CC also affects CC and CFLAGS.
#
# -fno-builtin must be present here so that a non-conflicting form of
# std::exit can be guessed by AC_PROG_CXX, and used in later tests.
+
m4_define([ac_cv_prog_CXX],[glibcxx_cv_prog_CXX])
m4_rename([_AC_ARG_VAR_PRECIOUS],[glibcxx_PRECIOUS])
m4_define([_AC_ARG_VAR_PRECIOUS],[])
save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -fno-builtin"
+ AC_PROG_CC
AC_PROG_CXX
CXXFLAGS="$save_CXXFLAGS"
m4_rename([glibcxx_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
+ AC_SUBST(CFLAGS)
AC_SUBST(CXXFLAGS)
# For directory versioning (e.g., headers) and other variables.
gcc_version=`$CXX -dumpversion`
AC_MSG_RESULT($gcc_version)
- # For some reason, gettext needs this.
- AC_ISC_POSIX
-
# Will set LN_S to either 'ln -s', 'ln', or 'cp -p' (if linking isn't
# available). Uncomment the next line to force a particular method.
AC_PROG_LN_S
AM_MAINTAINER_MODE
- # Set up safe default values for all subsequent AM_CONDITIONAL tests.
+ # Set up safe default values for all subsequent AM_CONDITIONAL tests
+ # which are themselves conditionally expanded.
+ ## (Right now, this only matters for enable_wchar_t, but nothing prevents
+ ## other macros from doing the same. This should be automated.) -pme
need_libmath=no
enable_wchar_t=no
#enable_libstdcxx_debug=no
#c_compatibility=no
#enable_abi_check=no
#enable_symvers=no
+ #enable_hosted_libstdcxx=yes
# Find platform-specific directories containing configuration info.
# Also possibly modify flags used elsewhere, as needed by the platform.
m4_include([linkage.m4])
+m4_include([../config/no-executables.m4])
dnl
# Checks for names injected into std:: by the c_std headers.
AC_CHECK_FUNCS([btowc wctob fgetwc fgetws fputwc fputws fwide \
- fwprintf fwscanf swprintf swscanf vfwprintf vfwscanf vswprintf vswscanf \
- vwprintf vwscanf wprintf wscanf getwc getwchar mbsinit mbrlen mbrtowc \
- mbsrtowcs wcsrtombs putwc putwchar ungetwc wcrtomb wcstod wcstof wcstol \
+ fwprintf fwscanf swprintf swscanf vfwprintf vswprintf \
+ vwprintf wprintf wscanf getwc getwchar mbsinit mbrlen mbrtowc \
+ mbsrtowcs wcsrtombs putwc putwchar ungetwc wcrtomb wcstod wcstol \
wcstoul wcscpy wcsncpy wcscat wcsncat wcscmp wcscoll wcsncmp wcsxfrm \
wcscspn wcsspn wcstok wcsftime wcschr wcspbrk wcsrchr wcsstr],
[],[ac_wfuncs=no])
+ # Checks for wide character functions that are not required
+ # for basic wchar_t support. Don't disable support if they are missing.
+ # Injection of these is wrapped with guard macros.
+ AC_CHECK_FUNCS([vfwscanf vswscanf vwscanf wcstof iswblank],[],[])
+
AC_MSG_CHECKING([for ISO C99 wchar_t support])
if test x"$has_weof" = xyes &&
test x"$has_wchar_minmax" = xyes &&
dnl
AC_DEFUN(GLIBCXX_CHECK_POLL, [
AC_CACHE_VAL(glibcxx_cv_POLL, [
- AC_TRY_COMPILE(
+ AC_TRY_LINK(
[#include <poll.h>],
[struct pollfd pfd[1];
pfd[0].events = POLLIN;
dnl
AC_DEFUN(GLIBCXX_CHECK_WRITEV, [
AC_CACHE_VAL(glibcxx_cv_WRITEV, [
- AC_TRY_COMPILE(
+ AC_TRY_LINK(
[#include <sys/uio.h>],
[struct iovec iov[2];
writev(0, iov, 0);],
dnl
+dnl Check whether int64_t is available in <stdint.h>, and define HAVE_INT64_T.
+dnl
+AC_DEFUN(GLIBCXX_CHECK_INT64_T, [
+ AC_CACHE_VAL(glibcxx_cv_INT64_T, [
+ AC_TRY_COMPILE(
+ [#include <stdint.h>],
+ [int64_t var;],
+ [glibcxx_cv_INT64_T=yes],
+ [glibcxx_cv_INT64_T=no])
+ ])
+ if test $glibcxx_cv_INT64_T = yes; then
+ AC_DEFINE(HAVE_INT64_T)
+ fi
+])
+
+
+dnl
+dnl Check whether LFS support is available.
+dnl
+AC_DEFUN(GLIBCXX_CHECK_LFS, [
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ AC_CACHE_VAL(glibcxx_cv_LFS, [
+ AC_TRY_LINK(
+ [#include <unistd.h>
+ #include <stdio.h>
+ ],
+ [FILE* fp;
+ fopen64("t", "w");
+ fseeko64(fp, 0, SEEK_CUR);
+ ftello64(fp);
+ lseek64(1, 0, SEEK_CUR);],
+ [glibcxx_cv_LFS=yes],
+ [glibcxx_cv_LFS=no])
+ ])
+ if test $glibcxx_cv_LFS = yes; then
+ AC_DEFINE(_GLIBCXX_USE_LFS)
+ fi
+ AC_LANG_RESTORE
+])
+
+
+dnl
dnl Does any necessary configuration of the testsuite directory. Generates
dnl the testsuite_hooks.h header.
dnl
dnl baseline_dir
dnl
AC_DEFUN(GLIBCXX_CONFIGURE_TESTSUITE, [
- if $GLIBCXX_IS_NATIVE; then
+ if $GLIBCXX_IS_NATIVE && test $is_hosted = yes; then
# Do checks for memory limit functions.
GLIBCXX_CHECK_SETRLIMIT
# Look for setenv, so that extended locale tests can be performed.
GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_3(setenv)
+
+ if test $enable_symvers = no; then
+ enable_abi_check=no
+ else
+ case "$host" in
+ *-*-cygwin*)
+ enable_abi_check=no ;;
+ *)
+ enable_abi_check=yes ;;
+ esac
+ fi
+ else
+ # Only build this as native, since automake does not understand
+ # CXX_FOR_BUILD.
+ enable_abi_check=no
fi
# Export file names for ABI checking.
baseline_dir="$glibcxx_srcdir/config/abi/${abi_baseline_pair}\$(MULTISUBDIR)"
AC_SUBST(baseline_dir)
- # Determine if checking the ABI is desirable.
- if test $enable_symvers = no; then
- enable_abi_check=no
- else
- case "$host" in
- *-*-cygwin*)
- enable_abi_check=no ;;
- *)
- enable_abi_check=yes ;;
- esac
- fi
-
- AM_CONDITIONAL(GLIBCXX_TEST_WCHAR_T, test $enable_wchar_t = yes)
- AM_CONDITIONAL(GLIBCXX_TEST_ABI, test $enable_abi_check = yes)
+ GLIBCXX_CONDITIONAL(GLIBCXX_TEST_WCHAR_T, test $enable_wchar_t = yes)
+ GLIBCXX_CONDITIONAL(GLIBCXX_TEST_ABI, test $enable_abi_check = yes)
])
dnl Substs:
dnl GLIBCXX_INCLUDES
dnl TOPLEVEL_INCLUDES
-dnl LIBMATH_INCLUDES
-dnl LIBSUPCXX_INCLUDES
dnl
AC_DEFUN(GLIBCXX_EXPORT_INCLUDES, [
- # Root level of the build directory include sources.
- GLIBCXX_INCLUDES="-I$glibcxx_builddir/include/$host_alias -I$glibcxx_builddir/include"
+ # Used for every C++ compile we perform.
+ GLIBCXX_INCLUDES="\
+-I$glibcxx_builddir/include/$host_alias \
+-I$glibcxx_builddir/include \
+-I$glibcxx_srcdir/libsupc++"
- # Passed down for canadian crosses.
+ # For Canadian crosses, pick this up too.
if test $CANADIAN = yes; then
- TOPLEVEL_INCLUDES='-I${includedir}'
+ GLIBCXX_INCLUDES="$GLIBCXX_INCLUDES -I\${includedir}"
fi
- LIBMATH_INCLUDES='-I${glibcxx_srcdir}/libmath'
-
- LIBSUPCXX_INCLUDES='-I${glibcxx_srcdir}/libsupc++'
+ # Stuff in the actual top level. Currently only used by libsupc++ to
+ # get unwind* headers from the gcc dir.
+ #TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/gcc -I$(toplevel_srcdir)/include'
+ TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/gcc'
# Now, export this to all the little Makefiles....
AC_SUBST(GLIBCXX_INCLUDES)
AC_SUBST(TOPLEVEL_INCLUDES)
- AC_SUBST(LIBMATH_INCLUDES)
- AC_SUBST(LIBSUPCXX_INCLUDES)
])
OPTIMIZE_CXXFLAGS=
AC_SUBST(OPTIMIZE_CXXFLAGS)
- WARN_FLAGS='-Wall -Wno-format -W -Wwrite-strings'
+ WARN_FLAGS='-Wall -W -Wwrite-strings -Wcast-qual'
AC_SUBST(WARN_FLAGS)
])
# and header files if --enable-version-specific-runtime-libs option
# is selected.
if test x"$gxx_include_dir" = x"no"; then
- gxx_include_dir='$libdir/gcc-lib/$host_alias/'$gcc_version/include/c++
+ gxx_include_dir='${libdir}/gcc-lib/${host_alias}/'$gcc_version/include/c++
fi
- glibcxx_toolexecdir='$libdir/gcc-lib/$host_alias'
- glibcxx_toolexeclibdir='$toolexecdir/'$gcc_version'$(MULTISUBDIR)'
+ glibcxx_toolexecdir='${libdir}/gcc-lib/${host_alias}'
+ glibcxx_toolexeclibdir='${toolexecdir}/'$gcc_version'$(MULTISUBDIR)'
fi
# Calculate glibcxx_toolexecdir, glibcxx_toolexeclibdir
if test x"$glibcxx_toolexecdir" = x"no"; then
if test -n "$with_cross_host" &&
test x"$with_cross_host" != x"no"; then
- glibcxx_toolexecdir='$(exec_prefix)/$(host_alias)'
- glibcxx_toolexeclibdir='$(toolexecdir)/lib'
+ glibcxx_toolexecdir='${exec_prefix}/${host_alias}'
+ glibcxx_toolexeclibdir='${toolexecdir}/lib'
else
- glibcxx_toolexecdir='$(libdir)/gcc-lib/$(host_alias)'
- glibcxx_toolexeclibdir='$(libdir)'
+ glibcxx_toolexecdir='${libdir}/gcc-lib/${host_alias}'
+ glibcxx_toolexeclibdir='${libdir}'
fi
- multi_os_directory=`$CC -print-multi-os-directory`
+ multi_os_directory=`$CXX -print-multi-os-directory`
case $multi_os_directory in
.) ;; # Avoid trailing /.
*) glibcxx_toolexeclibdir=$glibcxx_toolexeclibdir/$multi_os_directory ;;
C_INCLUDE_DIR='${glibcxx_srcdir}/include/'$enable_cheaders
AC_SUBST(C_INCLUDE_DIR)
- AM_CONDITIONAL(GLIBCXX_C_HEADERS_C, test $enable_cheaders = c)
- AM_CONDITIONAL(GLIBCXX_C_HEADERS_C_STD, test $enable_cheaders = c_std)
- AM_CONDITIONAL(GLIBCXX_C_HEADERS_COMPATIBILITY, test $c_compatibility = yes)
+ GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C, test $enable_cheaders = c)
+ GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C_STD, test $enable_cheaders = c_std)
+ GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_COMPATIBILITY, test $c_compatibility = yes)
])
# Default to "generic".
if test $enable_clocale_flag = auto; then
case x${target_os} in
- xlinux* | xgnu*)
+ xlinux* | xgnu* | xkfreebsd*-gnu | xknetbsd*-gnu)
AC_EGREP_CPP([_GLIBCXX_ok], [
#include <features.h>
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
;;
esac
- dnl Set directory for fpos.h
- FPOS_H=$fpos_include_dir
-
AC_SUBST(CSTDIO_H)
- AC_SUBST(FPOS_H)
AC_SUBST(BASIC_FILE_H)
AC_SUBST(BASIC_FILE_CC)
])
AC_MSG_CHECKING([for additional debug build])
GLIBCXX_ENABLE(libstdcxx-debug,$1,,[build extra debug library])
AC_MSG_RESULT($enable_libstdcxx_debug)
- AM_CONDITIONAL(GLIBCXX_BUILD_DEBUG, test $enable_libstdcxx_debug = yes)
+ GLIBCXX_CONDITIONAL(GLIBCXX_BUILD_DEBUG, test $enable_libstdcxx_debug = yes)
])
dnl
-dnl Check for libunwind exception handling support. If enabled, then
-dnl we assume that the _Unwind_* functions that make up the Unwind ABI
-dnl (_Unwind_RaiseException, _Unwind_Resume, etc.) are defined by
-dnl libunwind instead of libgcc, and that libstdc++ has a dependency
-dnl on libunwind as well as libgcc.
+dnl Check if the user only wants a freestanding library implementation.
dnl
-dnl --enable-libunwind-exceptions forces the use of libunwind.
-dnl --disable-libunwind-exceptions assumes there is no libunwind.
+dnl --disable-hosted-libstdcxx will turn off most of the library build,
+dnl installing only the headers required by [17.4.1.3] and the language
+dnl support library. More than that will be built (to keep the Makefiles
+dnl conveniently clean), but not installed.
dnl
-dnl Substs:
-dnl LIBUNWIND_FLAG
-dnl
-AC_DEFUN(GLIBCXX_ENABLE_LIBUNWIND_EXCEPTIONS, [
- AC_MSG_CHECKING([for use of libunwind])
- GLIBCXX_ENABLE(libunwind-exceptions,no,,
- [force use of libunwind for exceptions])
- AC_MSG_RESULT($use_libunwind_exceptions)
- if test $enable_libunwind_exceptions = yes; then
- LIBUNWIND_FLAG="-lunwind"
+dnl Sets:
+dnl is_hosted (yes/no)
+dnl
+dnl Defines:
+dnl _GLIBCXX_HOSTED (always defined, either to 1 or 0)
+dnl
+AC_DEFUN(GLIBCXX_ENABLE_HOSTED, [
+ AC_ARG_ENABLE([hosted-libstdcxx],
+ AC_HELP_STRING([--disable-hosted-libstdcxx],
+ [only build freestanding C++ runtime support]),,
+ [enable_hosted_libstdcxx=yes])
+ if test "$enable_hosted_libstdcxx" = no; then
+ AC_MSG_NOTICE([Only freestanding libraries will be built])
+ is_hosted=no
+ hosted_define=0
+ enable_abi_check=no
+ enable_libstdcxx_pch=no
else
- LIBUNWIND_FLAG=""
+ is_hosted=yes
+ hosted_define=1
fi
- AC_SUBST(LIBUNWIND_FLAG)
+ GLIBCXX_CONDITIONAL(GLIBCXX_HOSTED, test $is_hosted = yes)
+ AC_DEFINE_UNQUOTED(_GLIBCXX_HOSTED, $hosted_define,
+ [Define to 1 if a full hosted library is built, or 0 if freestanding.])
])
enable_libstdcxx_pch=$glibcxx_cv_prog_CXX_pch
fi
- AM_CONDITIONAL(GLIBCXX_BUILD_PCH, test $enable_libstdcxx_pch = yes)
+ GLIBCXX_CONDITIONAL(GLIBCXX_BUILD_PCH, test $enable_libstdcxx_pch = yes)
if test $enable_libstdcxx_pch = yes; then
glibcxx_PCHFLAGS="-include bits/stdc++.h"
else
AC_SUBST(SYMVER_MAP)
AC_SUBST(port_specific_symbol_files)
-AM_CONDITIONAL(GLIBCXX_BUILD_VERSIONED_SHLIB, test $enable_symvers != no)
+GLIBCXX_CONDITIONAL(GLIBCXX_BUILD_VERSIONED_SHLIB, test $enable_symvers != no)
AC_MSG_NOTICE(versioning on shared library symbols is $enable_symvers)
])
dnl
AC_DEFUN(GLIBCXX_ENABLE_THREADS, [
AC_MSG_CHECKING([for thread model used by GCC])
- target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
+ target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'`
AC_MSG_RESULT([$target_thread_file])
if test $target_thread_file != single; then