# 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 doc po testsuite])
+ m4_define([glibcxx_SUBDIRS],[include libsupc++ src doc po testsuite])
SUBDIRS='glibcxx_SUBDIRS'
# These need to be absolute paths, yet at the same time need to
# 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
# Check for uClibc since Linux platforms use different configuration
# directories depending on the C library in use.
dnl Define HAVE_S_ISREG / HAVE_S_IFREG appropriately.
dnl
AC_DEFUN([GLIBCXX_CHECK_S_ISREG_OR_S_IFREG], [
+
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -fno-exceptions"
+
AC_MSG_CHECKING([for S_ISREG or S_IFREG])
AC_CACHE_VAL(glibcxx_cv_S_ISREG, [
- AC_TRY_LINK(
+ GCC_TRY_COMPILE_OR_LINK(
[#include <sys/stat.h>],
[struct stat buffer;
fstat(0, &buffer);
[glibcxx_cv_S_ISREG=no])
])
AC_CACHE_VAL(glibcxx_cv_S_IFREG, [
- AC_TRY_LINK(
+ GCC_TRY_COMPILE_OR_LINK(
[#include <sys/stat.h>],
[struct stat buffer;
fstat(0, &buffer);
res=S_IFREG
fi
AC_MSG_RESULT($res)
+
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ AC_LANG_RESTORE
])
dnl Check whether poll is available in <poll.h>, and define HAVE_POLL.
dnl
AC_DEFUN([GLIBCXX_CHECK_POLL], [
+
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -fno-exceptions"
+
AC_MSG_CHECKING([for poll])
AC_CACHE_VAL(glibcxx_cv_POLL, [
- AC_TRY_LINK(
+ GCC_TRY_COMPILE_OR_LINK(
[#include <poll.h>],
[struct pollfd pfd[1];
pfd[0].events = POLLIN;
AC_DEFINE(HAVE_POLL, 1, [Define if poll is available in <poll.h>.])
fi
AC_MSG_RESULT($glibcxx_cv_POLL)
+
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ AC_LANG_RESTORE
])
dnl Check whether writev is available in <sys/uio.h>, and define HAVE_WRITEV.
dnl
AC_DEFUN([GLIBCXX_CHECK_WRITEV], [
+
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -fno-exceptions"
+
AC_MSG_CHECKING([for writev])
AC_CACHE_VAL(glibcxx_cv_WRITEV, [
- AC_TRY_LINK(
+ GCC_TRY_COMPILE_OR_LINK(
[#include <sys/uio.h>],
[struct iovec iov[2];
writev(0, iov, 0);],
AC_DEFINE(HAVE_WRITEV, 1, [Define if writev is available in <sys/uio.h>.])
fi
AC_MSG_RESULT($glibcxx_cv_WRITEV)
+
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ AC_LANG_RESTORE
])
dnl
dnl Check whether int64_t is available in <stdint.h>, and define HAVE_INT64_T.
+dnl Also check whether int64_t is actually a typedef to long or long long.
dnl
AC_DEFUN([GLIBCXX_CHECK_INT64_T], [
+
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+
AC_MSG_CHECKING([for int64_t])
AC_CACHE_VAL(glibcxx_cv_INT64_T, [
AC_TRY_COMPILE(
[glibcxx_cv_INT64_T=yes],
[glibcxx_cv_INT64_T=no])
])
+
if test $glibcxx_cv_INT64_T = yes; then
AC_DEFINE(HAVE_INT64_T, 1, [Define if int64_t is available in <stdint.h>.])
+ AC_MSG_RESULT($glibcxx_cv_INT64_T)
+
+ AC_MSG_CHECKING([for int64_t as long])
+ AC_CACHE_VAL(glibcxx_cv_int64_t_long, [
+ AC_TRY_COMPILE(
+ [#include <stdint.h>
+ template<typename, typename> struct same { enum { value = -1 }; };
+ template<typename Tp> struct same<Tp, Tp> { enum { value = 1 }; };
+ int array[same<int64_t, long>::value];], [],
+ [glibcxx_cv_int64_t_long=yes], [glibcxx_cv_int64_t_long=no])
+ ])
+
+ if test $glibcxx_cv_int64_t_long = yes; then
+ AC_DEFINE(HAVE_INT64_T_LONG, 1, [Define if int64_t is a long.])
+ AC_MSG_RESULT($glibcxx_cv_int64_t_long)
+ fi
+
+ AC_MSG_CHECKING([for int64_t as long long])
+ AC_CACHE_VAL(glibcxx_cv_int64_t_long_long, [
+ AC_TRY_COMPILE(
+ [#include <stdint.h>
+ template<typename, typename> struct same { enum { value = -1 }; };
+ template<typename Tp> struct same<Tp, Tp> { enum { value = 1 }; };
+ int array[same<int64_t, long long>::value];], [],
+ [glibcxx_cv_int64_t_long_long=yes], [glibcxx_cv_int64_t_long_long=no])
+ ])
+
+ if test $glibcxx_cv_int64_t_long_long = yes; then
+ AC_DEFINE(HAVE_INT64_T_LONG_LONG, 1, [Define if int64_t is a long long.])
+ AC_MSG_RESULT($glibcxx_cv_int64_t_long_long)
+ fi
fi
- AC_MSG_RESULT($glibcxx_cv_INT64_T)
+
+ AC_LANG_RESTORE
])
CXXFLAGS="$CXXFLAGS -fno-exceptions"
AC_MSG_CHECKING([for LFS support])
AC_CACHE_VAL(glibcxx_cv_LFS, [
- AC_TRY_LINK(
+ GCC_TRY_COMPILE_OR_LINK(
[#include <unistd.h>
#include <stdio.h>
#include <sys/stat.h>
fi
# Export file names for ABI checking.
- baseline_dir="$glibcxx_srcdir/config/abi/post/${abi_baseline_pair}\$(MULTISUBDIR)"
+ baseline_dir="$glibcxx_srcdir/config/abi/post/${abi_baseline_pair}"
AC_SUBST(baseline_dir)
])
tmpf = ctanf(tmpf);
tmpf = ctanhf(tmpf);
tmpf = cpowf(tmpf, tmpf);
+ tmpf = cprojf(tmpf);
d = cabs(tmpd);
d = carg(tmpd);
tmpd = ccos(tmpd);
tmpd = ctan(tmpd);
tmpd = ctanh(tmpd);
tmpd = cpow(tmpd, tmpd);
+ tmpd = cproj(tmpd);
ld = cabsl(tmpld);
ld = cargl(tmpld);
tmpld = ccosl(tmpld);
tmpld = ctanl(tmpld);
tmpld = ctanhl(tmpld);
tmpld = cpowl(tmpld, tmpld);
+ tmpld = cprojl(tmpld);
],[glibcxx_cv_c99_complex=yes], [glibcxx_cv_c99_complex=no])
fi
AC_MSG_RESULT($glibcxx_cv_c99_complex)
dnl
+dnl Check for clock_gettime, nanosleep and sched_yield, used in the
+dnl implementation of 20.8.5 [time.clock], and 30.2.2 [thread.thread.this]
+dnl in the current C++0x working draft.
+dnl
+dnl --enable-libstdcxx-time
+dnl --enable-libstdcxx-time=yes
+dnl checks for the availability of monotonic and realtime clocks,
+dnl nanosleep and sched_yield in libc and libposix4 and, in case, links
+dnl the latter
+dnl --enable-libstdcxx-time=rt
+dnl also searches (and, in case, links) librt. Note that this is
+dnl not always desirable because, in glibc, for example, in turn it
+dnl triggers the linking of libpthread too, which activates locking,
+dnl a large overhead for single-thread programs.
+dnl --enable-libstdcxx-time=no
+dnl --disable-libstdcxx-time
+dnl disables the checks completely
+dnl
+AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_TIME], [
+
+ AC_MSG_CHECKING([for clock_gettime, nanosleep and sched_yield])
+ GLIBCXX_ENABLE(libstdcxx-time,$1,[=KIND],
+ [use KIND for check type],
+ [permit yes|no|rt])
+
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -fno-exceptions"
+ ac_save_LIBS="$LIBS"
+
+ ac_has_clock_monotonic=no;
+ ac_has_clock_realtime=no;
+
+ if test x"$enable_libstdcxx_time" != x"no"; then
+
+ if test x"$enable_libstdcxx_time" = x"rt"; then
+ AC_SEARCH_LIBS(clock_gettime, [rt posix4])
+ AC_SEARCH_LIBS(nanosleep, [rt posix4])
+ else
+ AC_SEARCH_LIBS(clock_gettime, [posix4])
+ AC_SEARCH_LIBS(nanosleep, [posix4])
+ fi
+
+ case "$ac_cv_search_clock_gettime" in
+ -l*) GLIBCXX_LIBS=$ac_cv_search_clock_gettime
+ ;;
+ esac
+ case "$ac_cv_search_nanosleep" in
+ -l*) GLIBCXX_LIBS="$GLIBCXX_LIBS $ac_cv_search_nanosleep"
+ ;;
+ esac
+
+ AC_SEARCH_LIBS(sched_yield, [rt posix4])
+
+ case "$ac_cv_search_sched_yield" in
+ -lposix4*)
+ GLIBCXX_LIBS="$GLIBCXX_LIBS $ac_cv_search_sched_yield"
+ AC_DEFINE(_GLIBCXX_USE_SCHED_YIELD, 1,
+ [ Defined if sched_yield is available. ])
+ ;;
+ -lrt*)
+ if test x"$enable_libstdcxx_time" = x"rt"; then
+ GLIBCXX_LIBS="$GLIBCXX_LIBS $ac_cv_search_sched_yield"
+ AC_DEFINE(_GLIBCXX_USE_SCHED_YIELD, 1,
+ [ Defined if sched_yield is available. ])
+ fi
+ ;;
+ *)
+ AC_DEFINE(_GLIBCXX_USE_SCHED_YIELD, 1,
+ [ Defined if sched_yield is available. ])
+ ;;
+ esac
+
+ AC_CHECK_HEADERS(unistd.h, ac_has_unistd_h=yes, ac_has_unistd_h=no)
+
+ if test x"$ac_has_unistd_h" = x"yes"; then
+ AC_MSG_CHECKING([for monotonic clock])
+ AC_TRY_LINK(
+ [#include <unistd.h>
+ #include <time.h>
+ ],
+ [#if _POSIX_TIMERS > 0 && defined(_POSIX_MONOTONIC_CLOCK)
+ timespec tp;
+ #endif
+ clock_gettime(CLOCK_MONOTONIC, &tp);
+ ], [ac_has_clock_monotonic=yes], [ac_has_clock_monotonic=no])
+
+ AC_MSG_RESULT($ac_has_clock_monotonic)
+
+ AC_MSG_CHECKING([for realtime clock])
+ AC_TRY_LINK(
+ [#include <unistd.h>
+ #include <time.h>
+ ],
+ [#if _POSIX_TIMERS > 0
+ timespec tp;
+ #endif
+ clock_gettime(CLOCK_REALTIME, &tp);
+ ], [ac_has_clock_realtime=yes], [ac_has_clock_realtime=no])
+
+ AC_MSG_RESULT($ac_has_clock_realtime)
+
+ AC_MSG_CHECKING([for nanosleep])
+ AC_TRY_LINK(
+ [#include <unistd.h>
+ #include <time.h>
+ ],
+ [#if _POSIX_TIMERS > 0
+ timespec tp;
+ #endif
+ nanosleep(&tp, 0);
+ ], [ac_has_nanosleep=yes], [ac_has_nanosleep=no])
+
+ AC_MSG_RESULT($ac_has_nanosleep)
+ fi
+ fi
+
+ if test x"$ac_has_clock_monotonic" = x"yes"; then
+ AC_DEFINE(_GLIBCXX_USE_CLOCK_MONOTONIC, 1,
+ [ Defined if clock_gettime has monotonic clock support. ])
+ fi
+
+ if test x"$ac_has_clock_realtime" = x"yes"; then
+ AC_DEFINE(_GLIBCXX_USE_CLOCK_REALTIME, 1,
+ [ Defined if clock_gettime has realtime clock support. ])
+ fi
+
+ if test x"$ac_has_nanosleep" = x"yes"; then
+ AC_DEFINE(_GLIBCXX_USE_NANOSLEEP, 1,
+ [ Defined if nanosleep is available. ])
+ fi
+
+ AC_SUBST(GLIBCXX_LIBS)
+
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ LIBS="$ac_save_LIBS"
+ AC_LANG_RESTORE
+])
+
+dnl
+dnl Check for gettimeofday, used in the implementation of 20.8.5
+dnl [time.clock] in the current C++0x working draft.
+dnl
+AC_DEFUN([GLIBCXX_CHECK_GETTIMEOFDAY], [
+
+ AC_MSG_CHECKING([for gettimeofday])
+
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -fno-exceptions"
+
+ ac_has_gettimeofday=no;
+ AC_CHECK_HEADERS(sys/time.h, ac_has_sys_time_h=yes, ac_has_sys_time_h=no)
+ if test x"$ac_has_sys_time_h" = x"yes"; then
+ AC_MSG_CHECKING([for gettimeofday])
+ GCC_TRY_COMPILE_OR_LINK([#include <sys/time.h>],
+ [timeval tv; gettimeofday(&tv, 0);],
+ [ac_has_gettimeofday=yes], [ac_has_gettimeofday=no])
+
+ AC_MSG_RESULT($ac_has_gettimeofday)
+ fi
+
+ if test x"$ac_has_gettimeofday" = x"yes"; then
+ AC_DEFINE(_GLIBCXX_USE_GETTIMEOFDAY, 1,
+ [ Defined if gettimeofday is available. ])
+ fi
+
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ AC_LANG_RESTORE
+])
+
+dnl
dnl Check for ISO/IEC 9899:1999 "C99" support to ISO/IEC DTR 19768 "TR1"
dnl facilities in Chapter 8, "C compatibility".
dnl
[int ch;
int ret;
ret = isblank(ch);
- ],[glibcxx_cv_c99_ctype_tr1=yes], [glibcxx_cv_c99_ctype_tr1=no])
+ ],[glibcxx_cv_c99_ctype_tr1=yes],
+ [glibcxx_cv_c99_ctype_tr1=no])
])
AC_MSG_RESULT($glibcxx_cv_c99_ctype_tr1)
if test x"$glibcxx_cv_c99_ctype_tr1" = x"yes"; then
# Check for the existence of <stdint.h> types.
AC_MSG_CHECKING([for ISO C99 support to TR1 in <stdint.h>])
AC_CACHE_VAL(glibcxx_cv_c99_stdint_tr1, [
- AC_TRY_COMPILE([#include <stdint.h>],
+ AC_TRY_COMPILE([#define __STDC_LIMIT_MACROS
+ #define __STDC_CONSTANT_MACROS
+ #include <stdint.h>],
[typedef int8_t my_int8_t;
+ my_int8_t i8 = INT8_MIN;
+ i8 = INT8_MAX;
typedef int16_t my_int16_t;
+ my_int16_t i16 = INT16_MIN;
+ i16 = INT16_MAX;
typedef int32_t my_int32_t;
+ my_int32_t i32 = INT32_MIN;
+ i32 = INT32_MAX;
typedef int64_t my_int64_t;
+ my_int64_t i64 = INT64_MIN;
+ i64 = INT64_MAX;
typedef int_fast8_t my_int_fast8_t;
+ my_int_fast8_t if8 = INT_FAST8_MIN;
+ if8 = INT_FAST8_MAX;
typedef int_fast16_t my_int_fast16_t;
+ my_int_fast16_t if16 = INT_FAST16_MIN;
+ if16 = INT_FAST16_MAX;
typedef int_fast32_t my_int_fast32_t;
- typedef int_fast64_t my_int_fast64_t;
+ my_int_fast32_t if32 = INT_FAST32_MIN;
+ if32 = INT_FAST32_MAX;
+ typedef int_fast64_t my_int_fast64_t;
+ my_int_fast64_t if64 = INT_FAST64_MIN;
+ if64 = INT_FAST64_MAX;
typedef int_least8_t my_int_least8_t;
+ my_int_least8_t il8 = INT_LEAST8_MIN;
+ il8 = INT_LEAST8_MAX;
typedef int_least16_t my_int_least16_t;
+ my_int_least16_t il16 = INT_LEAST16_MIN;
+ il16 = INT_LEAST16_MAX;
typedef int_least32_t my_int_least32_t;
+ my_int_least32_t il32 = INT_LEAST32_MIN;
+ il32 = INT_LEAST32_MAX;
typedef int_least64_t my_int_least64_t;
+ my_int_least64_t il64 = INT_LEAST64_MIN;
+ il64 = INT_LEAST64_MAX;
typedef intmax_t my_intmax_t;
+ my_intmax_t im = INTMAX_MAX;
+ im = INTMAX_MIN;
typedef intptr_t my_intptr_t;
+ my_intptr_t ip = INTPTR_MAX;
+ ip = INTPTR_MIN;
typedef uint8_t my_uint8_t;
+ my_uint8_t ui8 = UINT8_MAX;
+ ui8 = UINT8_MAX;
typedef uint16_t my_uint16_t;
+ my_uint16_t ui16 = UINT16_MAX;
+ ui16 = UINT16_MAX;
typedef uint32_t my_uint32_t;
+ my_uint32_t ui32 = UINT32_MAX;
+ ui32 = UINT32_MAX;
typedef uint64_t my_uint64_t;
+ my_uint64_t ui64 = UINT64_MAX;
+ ui64 = UINT64_MAX;
typedef uint_fast8_t my_uint_fast8_t;
+ my_uint_fast8_t uif8 = UINT_FAST8_MAX;
+ uif8 = UINT_FAST8_MAX;
typedef uint_fast16_t my_uint_fast16_t;
+ my_uint_fast16_t uif16 = UINT_FAST16_MAX;
+ uif16 = UINT_FAST16_MAX;
typedef uint_fast32_t my_uint_fast32_t;
- typedef uint_fast64_t my_uint_fast64_t;
+ my_uint_fast32_t uif32 = UINT_FAST32_MAX;
+ uif32 = UINT_FAST32_MAX;
+ typedef uint_fast64_t my_uint_fast64_t;
+ my_uint_fast64_t uif64 = UINT_FAST64_MAX;
+ uif64 = UINT_FAST64_MAX;
typedef uint_least8_t my_uint_least8_t;
+ my_uint_least8_t uil8 = UINT_LEAST8_MAX;
+ uil8 = UINT_LEAST8_MAX;
typedef uint_least16_t my_uint_least16_t;
+ my_uint_least16_t uil16 = UINT_LEAST16_MAX;
+ uil16 = UINT_LEAST16_MAX;
typedef uint_least32_t my_uint_least32_t;
+ my_uint_least32_t uil32 = UINT_LEAST32_MAX;
+ uil32 = UINT_LEAST32_MAX;
typedef uint_least64_t my_uint_least64_t;
+ my_uint_least64_t uil64 = UINT_LEAST64_MAX;
+ uil64 = UINT_LEAST64_MAX;
typedef uintmax_t my_uintmax_t;
+ my_uintmax_t uim = UINTMAX_MAX;
+ uim = UINTMAX_MAX;
typedef uintptr_t my_uintptr_t;
- ],[glibcxx_cv_c99_stdint_tr1=yes], [glibcxx_cv_c99_stdint_tr1=no])
+ my_uintptr_t uip = UINTPTR_MAX;
+ uip = UINTPTR_MAX;
+ ],[glibcxx_cv_c99_stdint_tr1=yes],
+ [glibcxx_cv_c99_stdint_tr1=no])
])
AC_MSG_RESULT($glibcxx_cv_c99_stdint_tr1)
if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then
remainderf(0.0f, 0.0f);
remainderl(0.0l, 0.0l);
remquo(0.0, 0.0, 0);
- remquo(0.0f, 0.0f, 0);
- remquo(0.0l, 0.0l, 0);
+ remquof(0.0f, 0.0f, 0);
+ remquol(0.0l, 0.0l, 0);
rint(0.0);
rintf(0.0f);
rintl(0.0l);
fi
# Check for the existence of <inttypes.h> functions (NB: doesn't make
- # sense if the previous check fails, per C99, 7.8/1).
+ # sense if the glibcxx_cv_c99_stdint_tr1 check fails, per C99, 7.8/1).
ac_c99_inttypes_tr1=no;
if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then
AC_MSG_CHECKING([for ISO C99 support to TR1 in <inttypes.h>])
<tr1/cinttypes> in namespace std::tr1.])
fi
+ # Check for the existence of whcar_t <inttypes.h> functions (NB: doesn't
+ # make sense if the glibcxx_cv_c99_stdint_tr1 check fails, per C99, 7.8/1).
+ ac_c99_inttypes_wchar_t_tr1=no;
+ if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then
+ AC_MSG_CHECKING([for wchar_t ISO C99 support to TR1 in <inttypes.h>])
+ AC_TRY_COMPILE([#include <inttypes.h>],
+ [intmax_t base;
+ const wchar_t* s;
+ wchar_t** endptr;
+ intmax_t ret = wcstoimax(s, endptr, base);
+ uintmax_t uret = wcstoumax(s, endptr, base);
+ ],[ac_c99_inttypes_wchar_t_tr1=yes],
+ [ac_c99_inttypes_wchar_t_tr1=no])
+ fi
+ AC_MSG_RESULT($ac_c99_inttypes_wchar_t_tr1)
+ if test x"$ac_c99_inttypes_wchar_t_tr1" = x"yes"; then
+ AC_DEFINE(_GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1, 1,
+ [Define if wchar_t C99 functions in <inttypes.h> should be
+ imported in <tr1/cinttypes> in namespace std::tr1.])
+ fi
+
# Check for the existence of the <stdbool.h> header.
AC_CHECK_HEADERS(stdbool.h)
])
dnl
-dnl Check whether "dev/random" and "dev/urandom" are available for the
+dnl Check whether "/dev/random" and "/dev/urandom" are available for the
dnl random_device of "TR1" (Chapter 5.1, "Random number generation").
dnl
AC_DEFUN([GLIBCXX_CHECK_RANDOM_TR1], [
- AC_MSG_CHECKING([for "dev/random" and "dev/urandom" for TR1 random_device])
+ AC_MSG_CHECKING([for "/dev/random" and "/dev/urandom" for TR1 random_device])
AC_CACHE_VAL(glibcxx_cv_random_tr1, [
- AC_TRY_RUN([#include <stdio.h>
- int main()
- {
- return !(fopen("/dev/random", "r")
- && fopen("/dev/urandom", "r"));
- }
- ],
- [glibcxx_cv_random_tr1=yes], [glibcxx_cv_random_tr1=no],
- [glibcxx_cv_random_tr1=no])
+ if test -r /dev/random && test -r /dev/urandom; then
+ glibcxx_cv_random_tr1=yes;
+ else
+ glibcxx_cv_random_tr1=no;
+ fi
])
AC_MSG_RESULT($glibcxx_cv_random_tr1)
+
if test x"$glibcxx_cv_random_tr1" = x"yes"; then
AC_DEFINE(_GLIBCXX_USE_RANDOM_TR1, 1,
- [Define if dev/random and dev/urandom are available for
+ [Define if /dev/random and /dev/urandom are available for
the random_device of TR1 (Chapter 5.1).])
fi
])
dnl
+dnl Check whether EOF, SEEK_CUR, and SEEK_END have the most common values:
+dnl in that case including <cstdio> in some C++ headers can be avoided.
+dnl
+AC_DEFUN([GLIBCXX_CHECK_STDIO_MACROS], [
+
+ AC_MSG_CHECKING([for EOF == -1, SEEK_CUR == 1, SEEK_END == 2])
+ AC_CACHE_VAL(glibcxx_cv_stdio_macros, [
+ AC_TRY_COMPILE([#include <stdio.h>],
+ [#if ((EOF != -1) || (SEEK_CUR != 1) || (SEEK_END != 2))
+ unusual values...
+ #endif
+ ], [glibcxx_cv_stdio_macros=yes],
+ [glibcxx_cv_stdio_macros=no])
+ ])
+ AC_MSG_RESULT($glibcxx_cv_stdio_macros)
+ if test x"$glibcxx_cv_stdio_macros" = x"yes"; then
+ AC_DEFINE(_GLIBCXX_STDIO_MACROS, 1,
+ [Define if EOF == -1, SEEK_CUR == 1, SEEK_END == 2.])
+ fi
+
+])
+
+dnl
dnl Check whether macros, etc are present for <system_error>
dnl
AC_DEFUN([GLIBCXX_CHECK_SYSTEM_ERROR], [
m4_pushdef([n_syserr], [1])dnl
m4_foreach([syserr], [EOWNERDEAD, ENOTRECOVERABLE, ENOLINK, EPROTO, ENODATA,
- ENOSR, ENOSTR, ETIME, sys_nerr, EBADMSG, ECANCELED,
+ ENOSR, ENOSTR, ETIME, EBADMSG, ECANCELED,
EOVERFLOW, ENOTSUP, EIDRM, ETXTBSY],
[m4_pushdef([SYSERR], m4_toupper(syserr))dnl
AC_MSG_CHECKING([for syserr])
])
dnl
-dnl Check whether C++200x's standard layout types are supported.
-dnl
-AC_DEFUN([GLIBCXX_CHECK_STANDARD_LAYOUT], [
-
- AC_MSG_CHECKING([for ISO C++200x standard layout type support])
- AC_CACHE_VAL(ac_standard_layout, [
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
- ac_test_CXXFLAGS="${CXXFLAGS+set}"
- ac_save_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS='-std=gnu++0x'
-
- AC_TRY_COMPILE([struct b
- {
- bool t;
-
- // Need standard layout relaxation from POD
- private:
- b& operator=(const b&);
- b(const b&);
- };
-
- int main()
- {
- b tst1 = { false };
- return 0;
- }],,
- [ac_standard_layout=yes], [ac_standard_layout=no])
-
- CXXFLAGS="$ac_save_CXXFLAGS"
- AC_LANG_RESTORE
- ])
- AC_MSG_RESULT($ac_standard_layout)
- if test x"$ac_standard_layout" = x"yes"; then
- AC_DEFINE(_GLIBCXX_USE_STANDARD_LAYOUT, 1,
- [Define if standard layout types are supported in C++200x.])
- fi
-])
-
-dnl
dnl Check for what type of C headers to use.
dnl
dnl --enable-cheaders= [does stuff].
dnl
dnl Defines:
dnl _GLIBCXX_ATOMIC_BUILTINS_1
+dnl _GLIBCXX_ATOMIC_BUILTINS_2
dnl _GLIBCXX_ATOMIC_BUILTINS_4
+dnl _GLIBCXX_ATOMIC_BUILTINS_8
dnl
AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [
AC_LANG_SAVE
[#]line __oline__ "configure"
int main()
{
+ typedef bool atomic_type;
+ atomic_type c1;
+ atomic_type c2;
+ const atomic_type c3(0);
+ __sync_fetch_and_add(&c1, c2);
+ __sync_val_compare_and_swap(&c1, c3, c2);
+ __sync_lock_test_and_set(&c1, c3);
+ __sync_lock_release(&c1);
+ __sync_synchronize();
+ return 0;
+}
+EOF
+
+ AC_MSG_CHECKING([for atomic builtins for bool])
+ if AC_TRY_EVAL(ac_compile); then
+ if grep __sync_ conftest.s >/dev/null 2>&1 ; then
+ enable_atomic_builtinsb=no
+ else
+ AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_1, 1,
+ [Define if builtin atomic operations for bool are supported on this host.])
+ enable_atomic_builtinsb=yes
+ fi
+ fi
+ AC_MSG_RESULT($enable_atomic_builtinsb)
+ rm -f conftest*
+
+ cat > conftest.$ac_ext << EOF
+[#]line __oline__ "configure"
+int main()
+{
+ typedef short atomic_type;
+ atomic_type c1;
+ atomic_type c2;
+ const atomic_type c3(0);
+ __sync_fetch_and_add(&c1, c2);
+ __sync_val_compare_and_swap(&c1, c3, c2);
+ __sync_lock_test_and_set(&c1, c3);
+ __sync_lock_release(&c1);
+ __sync_synchronize();
+ return 0;
+}
+EOF
+
+ AC_MSG_CHECKING([for atomic builtins for short])
+ if AC_TRY_EVAL(ac_compile); then
+ if grep __sync_ conftest.s >/dev/null 2>&1 ; then
+ enable_atomic_builtinss=no
+ else
+ AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_2, 1,
+ [Define if builtin atomic operations for short are supported on this host.])
+ enable_atomic_builtinss=yes
+ fi
+ fi
+ AC_MSG_RESULT($enable_atomic_builtinss)
+ rm -f conftest*
+
+ cat > conftest.$ac_ext << EOF
+[#]line __oline__ "configure"
+int main()
+{
// NB: _Atomic_word not necessarily int.
typedef int atomic_type;
atomic_type c1;
[#]line __oline__ "configure"
int main()
{
- typedef bool atomic_type;
+ typedef long long atomic_type;
atomic_type c1;
atomic_type c2;
const atomic_type c3(0);
}
EOF
- AC_MSG_CHECKING([for atomic builtins for bool])
+ AC_MSG_CHECKING([for atomic builtins for long long])
if AC_TRY_EVAL(ac_compile); then
if grep __sync_ conftest.s >/dev/null 2>&1 ; then
- enable_atomic_builtinsb=no
+ enable_atomic_builtinsll=no
else
- AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_1, 1,
- [Define if builtin atomic operations for bool are supported on this host.])
- enable_atomic_builtinsb=yes
+ AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_8, 1,
+ [Define if builtin atomic operations for long long are supported on this host.])
+ enable_atomic_builtinsll=yes
fi
fi
- AC_MSG_RESULT($enable_atomic_builtinsb)
+ AC_MSG_RESULT($enable_atomic_builtinsll)
rm -f conftest*
+
CXXFLAGS="$old_CXXFLAGS"
AC_LANG_RESTORE
if test $atomicity_dir = "cpu/generic" ; then
atomicity_dir=cpu/generic/atomicity_mutex
AC_MSG_WARN([No native atomic operations are provided for this platform.])
- if test $target_thread_file = single; then
+ if test "x$target_thread_file" = xsingle; then
AC_MSG_WARN([They cannot be faked when thread support is disabled.])
AC_MSG_WARN([Thread-safety of certain classes is not guaranteed.])
else
enable_symvers=no
else
if test $with_gnu_ld = yes ; then
- enable_symvers=gnu
+ case ${target_os} in
+ cygwin* | pe | mingw32* | hpux*)
+ enable_symvers=no ;;
+ *)
+ enable_symvers=gnu ;;
+ esac
else
case ${target_os} in
darwin*)
[Define to use symbol versioning in the shared library.])
fi
+AC_CACHE_CHECK([whether the target supports .symver directive],
+ glibcxx_cv_have_as_symver_directive, [
+ AC_TRY_COMPILE([void foo (void); __asm (".symver foo, bar@SYMVER");],
+ [], glibcxx_cv_have_as_symver_directive=yes,
+ glibcxx_cv_have_as_symver_directive=no)])
+if test $glibcxx_cv_have_as_symver_directive = yes; then
+ AC_DEFINE(HAVE_AS_SYMVER_DIRECTIVE, 1,
+ [Define to 1 if the target assembler supports .symver directive.])
+fi
+
AC_SUBST(SYMVER_FILE)
AC_SUBST(port_specific_symbol_files)
GLIBCXX_CONDITIONAL(ENABLE_SYMVERS, test $enable_symvers != no)
])
+dnl
+dnl Check if gthread implementation defines the types and functions
+dnl required by the c++0x thread library. Conforming gthread
+dnl implementations can define __GTHREADS_CXX0X to enable use with c++0x.
+dnl
+AC_DEFUN([GLIBCXX_CHECK_GTHREADS], [
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -fno-exceptions -I${toplevel_srcdir}/gcc"
+
+ target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'`
+ case $target_thread_file in
+ posix)
+ CXXFLAGS="$CXXFLAGS -DSUPPORTS_WEAK -DGTHREAD_USE_WEAK -D_PTHREADS"
+ esac
+
+ AC_MSG_CHECKING([for gthreads library])
+
+ AC_TRY_COMPILE([#include "gthr.h"],
+ [
+ #ifndef __GTHREADS_CXX0X
+ #error
+ #endif
+
+ // In case of POSIX threads check _POSIX_TIMEOUTS too.
+ #if (defined(_PTHREADS) \
+ && (!defined(_POSIX_TIMEOUTS) || _POSIX_TIMEOUTS <= 0))
+ #error
+ #endif
+ ], [ac_has_gthreads=yes], [ac_has_gthreads=no])
+
+ AC_MSG_RESULT([$ac_has_gthreads])
+
+ if test x"$ac_has_gthreads" = x"yes"; then
+ AC_DEFINE(_GLIBCXX_HAS_GTHREADS, 1,
+ [Define if gthreads library is available.])
+ fi
+
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ AC_LANG_RESTORE
+])
+
+
# Check whether LC_MESSAGES is available in <locale.h>.
# Ulrich Drepper <drepper@cygnus.com>, 1995.
#
AC_DEFUN([AC_LC_MESSAGES], [
AC_CHECK_HEADER(locale.h, [
AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
- [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
+ [AC_TRY_COMPILE([#include <locale.h>], [return LC_MESSAGES],
ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
if test $ac_cv_val_LC_MESSAGES = yes; then
AC_DEFINE(HAVE_LC_MESSAGES, 1,