+dnl
+dnl Check whether sysconf(_SC_NPROC_ONLN) is available in <unistd.h>, and define _GLIBCXX_USE_SC_NPROC_ONLN.
+dnl
+AC_DEFUN([GLIBCXX_CHECK_SC_NPROC_ONLN], [
+
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -fno-exceptions"
+
+ AC_MSG_CHECKING([for _SC_NPROC_ONLN])
+ AC_CACHE_VAL(glibcxx_cv_SC_NPROC_ONLN, [
+ GCC_TRY_COMPILE_OR_LINK(
+ [#include <unistd.h>],
+ [int n = sysconf(_SC_NPROC_ONLN);],
+ [glibcxx_cv_SC_NPROC_ONLN=yes],
+ [glibcxx_cv_SC_NPROC_ONLN=no])
+ ])
+ if test $glibcxx_cv_SC_NPROC_ONLN = yes; then
+ AC_DEFINE(_GLIBCXX_USE_SC_NPROC_ONLN, 1, [Define if _SC_NPROC_ONLN is available in <unistd.h>.])
+ fi
+ AC_MSG_RESULT($glibcxx_cv_SC_NPROC_ONLN)
+
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ AC_LANG_RESTORE
+])
+
+dnl
+dnl Check whether pthread_num_processors_np is available in <pthread.h>, and define _GLIBCXX_USE_PTHREADS_NUM_PROCESSORS_NP.
+dnl
+AC_DEFUN([GLIBCXX_CHECK_PTHREADS_NUM_PROCESSORS_NP], [
+
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -fno-exceptions"
+
+ AC_MSG_CHECKING([for pthreads_num_processors_np])
+ AC_CACHE_VAL(glibcxx_cv_PTHREADS_NUM_PROCESSORS_NP, [
+ GCC_TRY_COMPILE_OR_LINK(
+ [#include <pthread.h>],
+ [int n = pthread_num_processors_np();],
+ [glibcxx_cv_PTHREADS_NUM_PROCESSORS_NP=yes],
+ [glibcxx_cv_PTHREADS_NUM_PROCESSORS_NP=no])
+ ])
+ if test $glibcxx_cv_PTHREADS_NUM_PROCESSORS_NP = yes; then
+ AC_DEFINE(_GLIBCXX_USE_PTHREADS_NUM_PROCESSORS_NP, 1, [Define if pthreads_num_processors_np is available in <pthread.h>.])
+ fi
+ AC_MSG_RESULT($glibcxx_cv_PTHREADS_NUM_PROCESSORS_NP)
+
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ AC_LANG_RESTORE
+])
+
+dnl
+dnl Check whether sysctl is available in <pthread.h>, and define _GLIBCXX_USE_SYSCTL_HW_NCPU.
+dnl
+AC_DEFUN([GLIBCXX_CHECK_SYSCTL_HW_NCPU], [
+
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -fno-exceptions"
+
+ AC_MSG_CHECKING([for hw.ncpu sysctl])
+ AC_CACHE_VAL(glibcxx_cv_SYSCTL_HW_NCPU, [
+ GCC_TRY_COMPILE_OR_LINK(
+ [
+ #include <stddef.h>
+ #include <sys/sysctl.h>
+ ],
+ [
+ int count;
+ size_t size = sizeof(count);
+ int mib[] = { CTL_HW, HW_NCPU };
+ sysctl(mib, 2, &count, &size, NULL, 0);
+ ],
+ [glibcxx_cv_SYSCTL_HW_NCPU=yes],
+ [glibcxx_cv_SYSCTL_HW_NCPU=no])
+ ])
+ if test $glibcxx_cv_SYSCTL_HW_NCPU = yes; then
+ AC_DEFINE(_GLIBCXX_USE_SYSCTL_HW_NCPU, 1, [Define if sysctl(), CTL_HW and HW_NCPU are available in <sys/sysctl.h>.])
+ fi
+ AC_MSG_RESULT($glibcxx_cv_SYSCTL_HW_NCPU)
+
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ AC_LANG_RESTORE
+])
+
+dnl
+dnl Check to see if python pretty printing can be activated.
+dnl
+dnl --with-python-dir=dir
+dnl installs directory into $prefix/dir
+AC_DEFUN([GLIBCXX_ENABLE_PYTHON], [
+
+AC_MSG_CHECKING([for custom python install directory])
+AC_ARG_WITH([python-dir],
+ AS_HELP_STRING([--with-python-dir],
+ [the location to install Python modules. This path is relative starting from the prefix.]),
+ [with_python_dir=$withval], [with_python_dir="no"])
+AC_MSG_RESULT(${with_python_dir})
+
+# Needed for installing Python modules during make install.
+python_mod_dir="${with_python_dir}"
+AC_SUBST(python_mod_dir)
+GLIBCXX_CONDITIONAL(ENABLE_PYTHONDIR, test $python_mod_dir != no)
+])
+
+dnl
+dnl Check to see if -Werror is disabled.
+dnl
+dnl --enable-werror/--disable-werror
+AC_DEFUN([GLIBCXX_ENABLE_WERROR], [
+ AC_MSG_CHECKING([for -Werror])
+ GLIBCXX_ENABLE(werror,$1,,[turns on -Werror])
+ AC_MSG_RESULT($enable_werror)
+ GLIBCXX_CONDITIONAL(ENABLE_WERROR, test $enable_werror = yes)
+])
+
+dnl
+dnl Check whether obsolescent tmpnam is available in <stdio.h>,
+dnl and define _GLIBCXX_USE_TMPNAM.
+dnl
+AC_DEFUN([GLIBCXX_CHECK_TMPNAM], [dnl
+dnl
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -fno-exceptions"
+dnl
+ AC_MSG_CHECKING([for tmpnam])
+ AC_CACHE_VAL(glibcxx_cv_TMPNAM, [dnl
+ GCC_TRY_COMPILE_OR_LINK(
+ [#include <stdio.h>],
+ [char *tmp = tmpnam(NULL);],
+ [glibcxx_cv_TMPNAM=yes],
+ [glibcxx_cv_TMPNAM=no])
+ ])
+ if test $glibcxx_cv_TMPNAM = yes; then
+ AC_DEFINE(_GLIBCXX_USE_TMPNAM, 1, [Define if obsolescent tmpnam is available in <stdio.h>.])
+ fi
+ AC_MSG_RESULT($glibcxx_cv_TMPNAM)
+dnl
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ AC_LANG_RESTORE
+])
+
+dnl
+dnl Check to see if sys/sdt.h exists and that it is suitable for use.
+dnl Some versions of sdt.h were not compatible with C++11.
+dnl
+AC_DEFUN([GLIBCXX_CHECK_SDT_H], [
+ AC_MSG_CHECKING([for suitable sys/sdt.h])
+ # Note that this test has to be run with the C language.
+ # Otherwise, sdt.h will try to include some headers from
+ # libstdc++ itself.
+ AC_LANG_SAVE
+ AC_LANG_C
+ AC_CACHE_VAL(glibcxx_cv_sys_sdt_h, [
+ # Because we have to run the test in C, we use grep rather
+ # than the compiler to check for the bug. The bug is that
+ # were strings without trailing whitespace, causing g++
+ # to look for operator"". The pattern searches for the fixed
+ # output.
+ AC_EGREP_CPP([ \",\" ], [
+ #include <sys/sdt.h>
+ int f() { STAP_PROBE(hi, bob); }
+ ], [glibcxx_cv_sys_sdt_h=yes], [glibcxx_cv_sys_sdt_h=no])
+ ])
+ AC_LANG_RESTORE
+ if test $glibcxx_cv_sys_sdt_h = yes; then
+ AC_DEFINE(HAVE_SYS_SDT_H, 1,
+ [Define to 1 if you have a suitable <sys/sdt.h> header file])
+ fi
+ AC_MSG_RESULT($glibcxx_cv_sys_sdt_h)
+])
+
+dnl
+dnl Control whether the library should define symbols for old and new ABIs.
+dnl This affects definitions of strings, stringstreams and locale facets.
+dnl
+dnl --disable-libstdcxx-dual-abi will use old ABI for all types.
+dnl
+dnl Defines:
+dnl _GLIBCXX_USE_DUAL_ABI (always defined, either to 1 or 0)
+dnl
+AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_DUAL_ABI], [
+ GLIBCXX_ENABLE(libstdcxx-dual-abi,$1,,[support two versions of std::string])
+ if test x"$enable_libstdcxx_dual_abi" != xyes; then
+ AC_MSG_NOTICE([dual ABI is disabled])
+ default_libstdcxx_abi="c++98"
+ fi
+ GLIBCXX_CONDITIONAL(ENABLE_DUAL_ABI, test $enable_libstdcxx_dual_abi = yes)
+])
+
+dnl
+dnl Check to see which ABI should be enabled by default.
+dnl
+dnl --with-default-libstdcxx-abi={c++98,c++11}
+dnl
+dnl Defines:
+dnl _GLIBCXX_USE_CXX11_ABI (always defined, either to 1 or 0)
+dnl
+AC_DEFUN([GLIBCXX_DEFAULT_ABI], [
+ if test x$enable_libstdcxx_dual_abi = xyes; then
+ AC_MSG_CHECKING([for default std::string ABI to use])
+ AC_ARG_WITH([default-libstdcxx-abi],
+ AS_HELP_STRING([--with-default-libstdcxx-abi],
+ [set the std::string ABI to use by default]),
+ [case "$withval" in
+ c++98|gnu++98|c++03|gnu++03) default_libstdcxx_abi="c++98" ;;
+ c++1?|gnu++1?) default_libstdcxx_abi="c++11" ;;
+ *) AC_MSG_ERROR([Invalid argument for --with-default-libstdcxx-abi]) ;;
+ esac],
+ [default_libstdcxx_abi="c++11"])
+ AC_MSG_RESULT(${default_libstdcxx_abi})
+ fi
+ if test $default_libstdcxx_abi = "c++11"; then
+ glibcxx_cxx11_abi=1
+ glibcxx_cxx98_abi=0
+ else
+ glibcxx_cxx11_abi=0
+ glibcxx_cxx98_abi=1
+ fi
+ AC_SUBST(glibcxx_cxx98_abi)
+ GLIBCXX_CONDITIONAL(ENABLE_CXX11_ABI, test $glibcxx_cxx11_abi = 1)
+])
+