From 35987ae95da833242def2e32fcc24100c20ef4b5 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 4 Jun 2014 12:35:26 +0000 Subject: configure.ac: Check whether the underlying type of int64_t is long or long long. 2014-06-04 Richard Biener * configure.ac: Check whether the underlying type of int64_t is long or long long. * configure: Regenerate. * config.in: Likewise. * hwint.h (HOST_WIDE_INT): Match the underlying type of int64_t. (HOST_WIDE_INT_PRINT_*): Define in terms of PRI*64. From-SVN: r211228 --- gcc/configure.ac | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) (limited to 'gcc/configure.ac') diff --git a/gcc/configure.ac b/gcc/configure.ac index aa697ce..2cec62a 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -316,6 +316,35 @@ if test x"$ac_cv_c_uint64_t" = x"no" -o x"$ac_cv_c_int64_t" = x"no"; then AC_MSG_ERROR([uint64_t or int64_t not found]) fi +# check what underlying integer type int64_t uses +AC_LANG_PUSH(C++) +AC_CACHE_CHECK(for int64_t underlying type, ac_cv_int64_t_type, [ +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#ifdef HAVE_STDINT_H +#include +#endif +template struct X { }; +template <> +struct X { typedef long t; }; +]], [[X::t x;]])],[ac_cv_int64_t_type=long],[ac_cv_int64_t_type="long long"])]) +if test "$ac_cv_int64_t_type" = "long"; then + AC_DEFINE(INT64_T_IS_LONG, 1, + [Define if int64_t uses long as underlying type.]) +else +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#ifdef HAVE_STDINT_H +#include +#endif +template struct X { }; +template <> +struct X { typedef long long t; }; +]], [[X::t x;]])],[],[AC_MSG_ERROR([error verifying int64_t uses long long])]) +fi +AC_LANG_POP(C++) + + + + # --------------------- # Warnings and checking # --------------------- @@ -1055,13 +1084,18 @@ LIBS="$save_LIBS" AC_SUBST(LDEXP_LIB) # Use only if it exists, -# doesn't clash with , and declares intmax_t. +# doesn't clash with , declares intmax_t and defines +# PRId64 AC_MSG_CHECKING(for inttypes.h) AC_CACHE_VAL(gcc_cv_header_inttypes_h, [AC_COMPILE_IFELSE([AC_LANG_PROGRAM( -[[#include +[[#define __STDC_FORMAT_MACROS +#include #include ]], - [[intmax_t i = -1;]])], + [[intmax_t i = -1; +#ifndef PRId64 +choke me +#endif]])], [gcc_cv_header_inttypes_h=yes], [gcc_cv_header_inttypes_h=no])]) AC_MSG_RESULT($gcc_cv_header_inttypes_h) -- cgit v1.1