]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libstdc++-v3/acinclude.m4
cwchar: New.
[thirdparty/gcc.git] / libstdc++-v3 / acinclude.m4
index 4e2b169352536143fe5019677d98ebcdbd541008..a582d611dd37ee85417d7dcaff87335375f07ef6 100644 (file)
@@ -1098,7 +1098,9 @@ AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [
   AC_MSG_CHECKING([for ISO C99 support to TR1 in <ctype.h>])
   AC_CACHE_VAL(ac_c99_ctype_tr1, [
   AC_TRY_COMPILE([#include <ctype.h>],
-                [isblank(0);
+                [int ch;
+                 int ret;
+                 ret = isblank(ch);
                 ],[ac_c99_ctype_tr1=yes], [ac_c99_ctype_tr1=no])
   ])
   AC_MSG_RESULT($ac_c99_ctype_tr1)
@@ -1108,6 +1110,143 @@ AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [
              <tr1/cctype> in namespace std::tr1.])
   fi
 
+  # Check for the existence of <fenv.h> functions.
+  AC_CHECK_HEADERS(fenv.h, ac_has_fenv_h=yes, ac_has_fenv_h=no)
+  ac_c99_fenv_tr1=no;
+  if test x"$ac_has_fenv_h" = x"yes"; then
+    AC_MSG_CHECKING([for ISO C99 support to TR1 in <fenv.h>])
+    AC_TRY_COMPILE([#include <fenv.h>],
+                  [int except, mode;
+                   fexcept_t* pflag;
+                    fenv_t* penv;
+                   int ret;
+                   ret = feclearexcept(except);
+                   ret = fegetexceptflag(pflag, except);
+                   ret = feraiseexcept(except);
+                   ret = fesetexceptflag(pflag, except);
+                   ret = fetestexcept(except);
+                   ret = fegetround();
+                   ret = fesetround(mode);
+                   ret = fegetenv(penv);
+                   ret = feholdexcept(penv);
+                   ret = fesetenv(penv);
+                   ret = feupdateenv(penv);
+                  ],[ac_c99_fenv_tr1=yes], [ac_c99_fenv_tr1=no])
+  fi
+  AC_MSG_RESULT($ac_c99_fenv_tr1)
+  if test x"$ac_c99_fenv_tr1" = x"yes"; then
+    AC_DEFINE(_GLIBCXX_USE_C99_FENV_TR1, 1,
+              [Define if C99 functions in <fenv.h> should be imported in
+             <tr1/cfenv> in namespace std::tr1.])
+  fi
+
+  # Check for the existence of <stdint.h> types.
+  AC_MSG_CHECKING([for ISO C99 support to TR1 in <stdint.h>])
+  AC_CACHE_VAL(ac_c99_stdint_tr1, [
+  AC_TRY_COMPILE([#include <stdint.h>],
+                [typedef int8_t          my_int8_t;
+                 typedef int16_t         my_int16_t;
+                 typedef int32_t         my_int32_t;
+                 typedef int64_t         my_int64_t;
+                 typedef int_fast8_t     my_int_fast8_t;
+                 typedef int_fast16_t    my_int_fast16_t;
+                 typedef int_fast32_t    my_int_fast32_t;
+                 typedef int_fast64_t    my_int_fast64_t;      
+                 typedef int_least8_t    my_int_least8_t;
+                 typedef int_least16_t   my_int_least16_t;
+                 typedef int_least32_t   my_int_least32_t;
+                 typedef int_least64_t   my_int_least64_t;
+                 typedef intmax_t        my_intmax_t;
+                 typedef intptr_t        my_intptr_t;
+                 typedef uint8_t         my_uint8_t;
+                 typedef uint16_t        my_uint16_t;
+                 typedef uint32_t        my_uint32_t;
+                 typedef uint64_t        my_uint64_t;
+                 typedef uint_fast8_t    my_uint_fast8_t;
+                 typedef uint_fast16_t   my_uint_fast16_t;
+                 typedef uint_fast32_t   my_uint_fast32_t;
+                 typedef uint_fast64_t   my_uint_fast64_t;     
+                 typedef uint_least8_t   my_uint_least8_t;
+                 typedef uint_least16_t  my_uint_least16_t;
+                 typedef uint_least32_t  my_uint_least32_t;
+                 typedef uint_least64_t  my_uint_least64_t;
+                 typedef uintmax_t       my_uintmax_t;
+                 typedef uintptr_t       my_uintptr_t;
+                ],[ac_c99_stdint_tr1=yes], [ac_c99_stdint_tr1=no])
+  ])
+  AC_MSG_RESULT($ac_c99_stdint_tr1)
+  if test x"$ac_c99_stdint_tr1" = x"yes"; then
+    AC_DEFINE(_GLIBCXX_USE_C99_STDINT_TR1, 1,
+              [Define if C99 types in <stdint.h> should be imported in
+             <tr1/cstdint> in namespace std::tr1.])
+  fi
+
+  # Check for the existence of <inttypes.h> functions (NB: doesn't make
+  # sense if the previous check fails, per C99, 7.8/1).
+  ac_c99_inttypes_tr1=no;
+  if test x"$ac_c99_stdint_tr1" = x"yes"; then
+    AC_MSG_CHECKING([for ISO C99 support to TR1 in <inttypes.h>])
+    AC_TRY_COMPILE([#include <inttypes.h>],
+                  [intmax_t i, numer, denom, base;
+                   const char* s;
+                   char** endptr;
+                   intmax_t ret = imaxabs(i);
+                   imaxdiv_t dret = imaxdiv(numer, denom);
+                   ret = strtoimax(s, endptr, base);
+                   uintmax_t uret = strtoumax(s, endptr, base);
+                  ],[ac_c99_inttypes_tr1=yes], [ac_c99_inttypes_tr1=no])
+  fi
+  AC_MSG_RESULT($ac_c99_inttypes_tr1)
+  if test x"$ac_c99_inttypes_tr1" = x"yes"; then
+    AC_DEFINE(_GLIBCXX_USE_C99_INTTYPES_TR1, 1,
+              [Define if C99 functions in <inttypes.h> should be imported in
+              <tr1/cinttypes> in namespace std::tr1.])
+  fi
+
+  # Check for the existence of <wchar.h> functions.
+  AC_MSG_CHECKING([for ISO C99 support to TR1 in <wchar.h>])
+  AC_CACHE_VAL(ac_c99_wchar_tr1, [
+  AC_TRY_COMPILE([#include <wchar.h>
+                 #include <stdio.h>
+                 #include <stdarg.h>],
+                [const wchar_t* nptr;
+                 const wchar_t* format;
+                 const wchar_t* s;
+                 wchar_t** endptr;
+                 FILE* stream;
+                 va_list arg;
+                 int base;
+                 float fret = wcstof(nptr, endptr);
+                 long double ldret = wcstold(nptr, endptr);
+                 int ret = vfwscanf(stream, format, arg);
+                 ret = vswscanf(s, format, arg);
+                 ret = vwscanf(format, arg);
+                 long long llret = wcstoll(nptr, endptr, base);
+                 unsigned long long ullret = wcstoull(nptr, endptr, base);
+                ],[ac_c99_wchar_tr1=yes], [ac_c99_wchar_tr1=no])
+  ])
+  AC_MSG_RESULT($ac_c99_wchar_tr1)
+  if test x"$ac_c99_wchar_tr1" = x"yes"; then
+    AC_DEFINE(_GLIBCXX_USE_C99_WCHAR_TR1, 1,
+              [Define if C99 functions in <wchar.h> should be imported in
+             <tr1/cwchar> in namespace std::tr1.])
+  fi
+
+  # Check for the existence of <wctype.h> functions.
+  AC_MSG_CHECKING([for ISO C99 support to TR1 in <wctype.h>])
+  AC_CACHE_VAL(ac_c99_wctype_tr1, [
+  AC_TRY_COMPILE([#include <wctype.h>],
+                [wint_t ch;
+                 int ret = iswblank(ch);
+                ],[ac_c99_wctype_tr1=yes], [ac_c99_wctype_tr1=no])
+  ])
+  AC_MSG_RESULT($ac_c99_wctype_tr1)
+  if test x"$ac_c99_wctype_tr1" = x"yes"; then
+    AC_DEFINE(_GLIBCXX_USE_C99_WCTYPE_TR1, 1,
+              [Define if C99 functions in <wctype.h> should be imported in
+             <tr1/cwctype> in namespace std::tr1.])
+  fi
+
   AC_LANG_RESTORE
 ])