OSDN Git Service

2008-08-06 Paolo Carlini <paolo.carlini@oracle.com>
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 6 Aug 2008 12:25:00 +0000 (12:25 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 6 Aug 2008 12:25:00 +0000 (12:25 +0000)
* acinclude.m4 ([GLIBCXX_CHECK_INT64_T]): Also check whether int64_t
is actually a typedef to long or long long.
* include/bits/postypes.h: If int64_t is actually a typedef for
long or long long don't include <stdint.h> unnecessarily.
* configure: Regenerate.
* config.h.in: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@138797 138bc75d-0d04-0410-961f-82ee72b054a4

libstdc++-v3/ChangeLog
libstdc++-v3/acinclude.m4
libstdc++-v3/config.h.in
libstdc++-v3/configure
libstdc++-v3/include/bits/postypes.h

index 704ae7c..8d81860 100644 (file)
@@ -1,3 +1,12 @@
+008-08-06  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * acinclude.m4 ([GLIBCXX_CHECK_INT64_T]): Also check whether int64_t
+       is actually a typedef to long or long long.
+       * include/bits/postypes.h: If int64_t is actually a typedef for
+       long or long long don't include <stdint.h> unnecessarily.
+       * configure: Regenerate.
+       * config.h.in: Likewise.
+       
 2008-08-05  Paolo Carlini  <paolo.carlini@oracle.com>
 
        * testsuite/util/testsuite_api.h (diamond_derivation<>::test):
index 0a669c9..50f207c 100644 (file)
@@ -466,8 +466,13 @@ AC_DEFUN([GLIBCXX_CHECK_WRITEV], [
 
 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(
@@ -476,10 +481,43 @@ AC_DEFUN([GLIBCXX_CHECK_INT64_T], [
       [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
 ])
 
 
index 256637a..438fe14 100644 (file)
 /* Define if int64_t is available in <stdint.h>. */
 #undef HAVE_INT64_T
 
+/* Define if int64_t is a long. */
+#undef HAVE_INT64_T_LONG
+
+/* Define if int64_t is a long long. */
+#undef HAVE_INT64_T_LONG_LONG
+
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
index 2ea940a..5fb3107 100755 (executable)
@@ -39677,6 +39677,16 @@ echo "${ECHO_T}$glibcxx_cv_WRITEV" >&6
 
   # For the __streamoff_base_type typedef.
 
+
+
+
+  ac_ext=cc
+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
+
+
   echo "$as_me:$LINENO: checking for int64_t" >&5
 echo $ECHO_N "checking for int64_t... $ECHO_C" >&6
   if test "${glibcxx_cv_INT64_T+set}" = set; then
@@ -39707,7 +39717,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
+        { ac_try='test -z "$ac_cxx_werror_flag"
                         || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
@@ -39731,16 +39741,160 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 
 fi
 
+
   if test $glibcxx_cv_INT64_T = yes; then
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_INT64_T 1
 _ACEOF
 
-  fi
-  echo "$as_me:$LINENO: result: $glibcxx_cv_INT64_T" >&5
+    echo "$as_me:$LINENO: result: $glibcxx_cv_INT64_T" >&5
 echo "${ECHO_T}$glibcxx_cv_INT64_T" >&6
 
+    echo "$as_me:$LINENO: checking for int64_t as long" >&5
+echo $ECHO_N "checking for int64_t as long... $ECHO_C" >&6
+    if test "${glibcxx_cv_int64_t_long+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+      cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#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];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  glibcxx_cv_int64_t_long=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+glibcxx_cv_int64_t_long=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+
+
+    if test $glibcxx_cv_int64_t_long = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_INT64_T_LONG 1
+_ACEOF
+
+      echo "$as_me:$LINENO: result: $glibcxx_cv_int64_t_long" >&5
+echo "${ECHO_T}$glibcxx_cv_int64_t_long" >&6
+    fi
+
+    echo "$as_me:$LINENO: checking for int64_t as long long" >&5
+echo $ECHO_N "checking for int64_t as long long... $ECHO_C" >&6
+    if test "${glibcxx_cv_int64_t_long_long+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+      cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#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];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  glibcxx_cv_int64_t_long_long=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+glibcxx_cv_int64_t_long_long=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+
+
+    if test $glibcxx_cv_int64_t_long_long = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_INT64_T_LONG_LONG 1
+_ACEOF
+
+      echo "$as_me:$LINENO: result: $glibcxx_cv_int64_t_long_long" >&5
+echo "${ECHO_T}$glibcxx_cv_int64_t_long_long" >&6
+    fi
+  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
+
+
 
   # For LFS support.
 
index cdcafe2..1bc972a 100644 (file)
@@ -49,7 +49,8 @@
 // XXX If <stdint.h> is really needed, make sure to define the macros,
 // in order not to break <tr1/cstdint> (and <cstdint> in C++0x).
 // Reconsider all this as soon as possible...
-#ifdef _GLIBCXX_HAVE_INT64_T
+#if (defined(_GLIBCXX_HAVE_INT64_T) && !defined(_GLIBCXX_HAVE_INT64_T_LONG) \
+     && !defined(_GLIBCXX_HAVE_INT64_T_LONG_LONG))
 #ifndef __STDC_LIMIT_MACROS
 # define __STDC_LIMIT_MACROS
 #endif
@@ -76,7 +77,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    *  Note: In versions of GCC up to and including GCC 3.3, streamoff
    *  was typedef long.
   */  
-#ifdef _GLIBCXX_HAVE_INT64_T
+#ifdef _GLIBCXX_HAVE_INT64_T_LONG
+  typedef long          streamoff;
+#elif defined(_GLIBCXX_HAVE_INT64_T_LONG_LONG)
+  typedef long long     streamoff;
+#elif defined(_GLIBCXX_HAVE_INT64_T) 
   typedef int64_t       streamoff;
 #else
   typedef long long     streamoff;