]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/configure
configure.ac: Check whether the underlying type of int64_t is long or long long.
[thirdparty/gcc.git] / gcc / configure
index f60d3476a654af1608ae32f887426115cbc1a08f..6c35041b6a79039fa72b683e0f2b31dc7d833abd 100755 (executable)
@@ -6230,6 +6230,87 @@ if test x"$ac_cv_c_uint64_t" = x"no" -o x"$ac_cv_c_int64_t" = x"no"; then
   as_fn_error "uint64_t or int64_t not found" "$LINENO" 5
 fi
 
+# check what underlying integer type int64_t uses
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for int64_t underlying type" >&5
+$as_echo_n "checking for int64_t underlying type... " >&6; }
+if test "${ac_cv_int64_t_type+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+template <typename T> struct X { };
+template <>
+struct X<long> { typedef long t; };
+
+int
+main ()
+{
+X<int64_t>::t x;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_int64_t_type=long
+else
+  ac_cv_int64_t_type="long long"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_int64_t_type" >&5
+$as_echo "$ac_cv_int64_t_type" >&6; }
+if test "$ac_cv_int64_t_type" = "long"; then
+
+$as_echo "#define INT64_T_IS_LONG 1" >>confdefs.h
+
+else
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+template <typename T> struct X { };
+template <>
+struct X<long long> { typedef long long t; };
+
+int
+main ()
+{
+X<int64_t>::t x;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
+else
+  as_fn_error "error verifying int64_t uses long long" "$LINENO" 5
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
 # ---------------------
 # Warnings and checking
 # ---------------------
@@ -8746,7 +8827,6 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 
 
-
 for ac_header in unordered_map
 do :
   ac_fn_cxx_check_header_preproc "$LINENO" "unordered_map" "ac_cv_header_unordered_map"
@@ -9163,7 +9243,8 @@ LIBS="$save_LIBS"
 
 
 # Use <inttypes.h> only if it exists,
-# doesn't clash with <sys/types.h>, and declares intmax_t.
+# doesn't clash with <sys/types.h>, declares intmax_t and defines
+# PRId64
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inttypes.h" >&5
 $as_echo_n "checking for inttypes.h... " >&6; }
 if test "${gcc_cv_header_inttypes_h+set}" = set; then :
@@ -9171,12 +9252,16 @@ if test "${gcc_cv_header_inttypes_h+set}" = set; then :
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
+#define __STDC_FORMAT_MACROS
 #include <sys/types.h>
 #include <inttypes.h>
 int
 main ()
 {
 intmax_t i = -1;
+#ifndef PRId64
+choke me
+#endif
   ;
   return 0;
 }
@@ -17948,7 +18033,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17951 "configure"
+#line 18036 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -18054,7 +18139,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18057 "configure"
+#line 18142 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H