This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[v3] Improve the inttypes.h checks
- From: Paolo Carlini <pcarlini at suse dot de>
- To: "'gcc-patches at gcc dot gnu dot org'" <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 30 Jan 2006 16:35:29 +0100
- Subject: [v3] Improve the inttypes.h checks
Hi,
built on x86-linux, committed to mainline.
Paolo.
////////////////
2006-01-30 Paolo Carlini <pcarlini@suse.de>
* acinclude.m4 ([GLIBCXX_CHECK_C99_TR1]): Do the <inttypes.h>
checks only if the <stdint.h> checks are successful.
* configure: Regenerate.
Index: acinclude.m4
===================================================================
--- acinclude.m4 (revision 110397)
+++ acinclude.m4 (working copy)
@@ -1181,27 +1181,29 @@
<tr1/cstdint> in namespace std::tr1.])
fi
- # Check for the existence of <inttypes.h> functions.
- AC_MSG_CHECKING([for ISO C99 support to TR1 in <inttypes.h>])
- AC_CACHE_VAL(ac_c99_inttypes_tr1, [
- AC_TRY_COMPILE([#include <inttypes.h>],
- [intmax_t i, numer, denom, base;
- const char* s;
- char** endptr;
- intmax_t ret;
- uintmax_t uret;
- imaxdiv_t dret;
- ret = imaxabs(i);
- dret = imaxdiv(numer, denom);
- ret = strtoimax(s, endptr, base);
- uret = strtoumax(s, endptr, base);
- ],[ac_c99_inttypes_tr1=yes], [ac_c99_inttypes_tr1=no])
- ])
+ # 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;
+ uintmax_t uret;
+ imaxdiv_t dret;
+ ret = imaxabs(i);
+ dret = imaxdiv(numer, denom);
+ ret = strtoimax(s, endptr, base);
+ 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.])
+ <tr1/cinttypes> in namespace std::tr1.])
fi
AC_LANG_RESTORE