Commit 127ea18f authored by Tom Lane's avatar Tom Lane

Add configure support for determining UINT64_FORMAT, the appropriate

snprintf format for uint64 items.
parent feed7cf1
...@@ -13659,9 +13659,8 @@ fi ...@@ -13659,9 +13659,8 @@ fi
# If we found "long int" is 64 bits, assume snprintf handles it. If # If we found "long int" is 64 bits, assume snprintf handles it. If
# we found we need to use "long long int", better check. We cope with # we found we need to use "long long int", better check. We cope with
# snprintfs that use either %lld, %qd, or %I64d as the format. If # snprintfs that use %lld, %qd, or %I64d as the format. If none of these
# neither works, fall back to our own snprintf emulation (which we # work, fall back to our own snprintf emulation (which we know uses %lld).
# know uses %lld).
if test "$HAVE_LONG_LONG_INT_64" = yes ; then if test "$HAVE_LONG_LONG_INT_64" = yes ; then
if test $pgac_need_repl_snprintf = no; then if test $pgac_need_repl_snprintf = no; then
...@@ -13744,10 +13743,13 @@ esac ...@@ -13744,10 +13743,13 @@ esac
# Here if we previously decided we needed to use our own snprintf # Here if we previously decided we needed to use our own snprintf
LONG_LONG_INT_FORMAT='%lld' LONG_LONG_INT_FORMAT='%lld'
fi fi
LONG_LONG_UINT_FORMAT=`echo "$LONG_LONG_INT_FORMAT" | sed 's/d$/u/'`
INT64_FORMAT="\"$LONG_LONG_INT_FORMAT\"" INT64_FORMAT="\"$LONG_LONG_INT_FORMAT\""
UINT64_FORMAT="\"$LONG_LONG_UINT_FORMAT\""
else else
# Here if we are not using 'long long int' at all # Here if we are not using 'long long int' at all
INT64_FORMAT='"%ld"' INT64_FORMAT='"%ld"'
UINT64_FORMAT='"%lu"'
fi fi
...@@ -13756,6 +13758,12 @@ cat >>confdefs.h <<_ACEOF ...@@ -13756,6 +13758,12 @@ cat >>confdefs.h <<_ACEOF
_ACEOF _ACEOF
cat >>confdefs.h <<_ACEOF
#define UINT64_FORMAT $UINT64_FORMAT
_ACEOF
if test $pgac_need_repl_snprintf = yes; then if test $pgac_need_repl_snprintf = yes; then
LIBOBJS="$LIBOBJS snprintf.$ac_objext" LIBOBJS="$LIBOBJS snprintf.$ac_objext"
fi fi
......
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
dnl $PostgreSQL: pgsql/configure.in,v 1.313 2004/02/02 22:20:32 momjian Exp $ dnl $PostgreSQL: pgsql/configure.in,v 1.314 2004/02/10 19:55:45 tgl Exp $
dnl dnl
dnl Developers, please strive to achieve this order: dnl Developers, please strive to achieve this order:
dnl dnl
...@@ -1063,9 +1063,8 @@ fi ...@@ -1063,9 +1063,8 @@ fi
# If we found "long int" is 64 bits, assume snprintf handles it. If # If we found "long int" is 64 bits, assume snprintf handles it. If
# we found we need to use "long long int", better check. We cope with # we found we need to use "long long int", better check. We cope with
# snprintfs that use either %lld, %qd, or %I64d as the format. If # snprintfs that use %lld, %qd, or %I64d as the format. If none of these
# neither works, fall back to our own snprintf emulation (which we # work, fall back to our own snprintf emulation (which we know uses %lld).
# know uses %lld).
if test "$HAVE_LONG_LONG_INT_64" = yes ; then if test "$HAVE_LONG_LONG_INT_64" = yes ; then
if test $pgac_need_repl_snprintf = no; then if test $pgac_need_repl_snprintf = no; then
...@@ -1079,15 +1078,21 @@ if test "$HAVE_LONG_LONG_INT_64" = yes ; then ...@@ -1079,15 +1078,21 @@ if test "$HAVE_LONG_LONG_INT_64" = yes ; then
# Here if we previously decided we needed to use our own snprintf # Here if we previously decided we needed to use our own snprintf
LONG_LONG_INT_FORMAT='%lld' LONG_LONG_INT_FORMAT='%lld'
fi fi
LONG_LONG_UINT_FORMAT=`echo "$LONG_LONG_INT_FORMAT" | sed 's/d$/u/'`
INT64_FORMAT="\"$LONG_LONG_INT_FORMAT\"" INT64_FORMAT="\"$LONG_LONG_INT_FORMAT\""
UINT64_FORMAT="\"$LONG_LONG_UINT_FORMAT\""
else else
# Here if we are not using 'long long int' at all # Here if we are not using 'long long int' at all
INT64_FORMAT='"%ld"' INT64_FORMAT='"%ld"'
UINT64_FORMAT='"%lu"'
fi fi
AC_DEFINE_UNQUOTED(INT64_FORMAT, $INT64_FORMAT, AC_DEFINE_UNQUOTED(INT64_FORMAT, $INT64_FORMAT,
[Define to the appropriate snprintf format for 64-bit ints, if any.]) [Define to the appropriate snprintf format for 64-bit ints, if any.])
AC_DEFINE_UNQUOTED(UINT64_FORMAT, $UINT64_FORMAT,
[Define to the appropriate snprintf format for unsigned 64-bit ints, if any.])
if test $pgac_need_repl_snprintf = yes; then if test $pgac_need_repl_snprintf = yes; then
AC_LIBOBJ(snprintf) AC_LIBOBJ(snprintf)
fi fi
......
...@@ -588,6 +588,10 @@ ...@@ -588,6 +588,10 @@
/* Define to 1 if your <sys/time.h> declares `struct tm'. */ /* Define to 1 if your <sys/time.h> declares `struct tm'. */
#undef TM_IN_SYS_TIME #undef TM_IN_SYS_TIME
/* Define to the appropriate snprintf format for unsigned 64-bit ints, if any.
*/
#undef UINT64_FORMAT
/* Define to 1 to build with assertion checks. (--enable-cassert) */ /* Define to 1 to build with assertion checks. (--enable-cassert) */
#undef USE_ASSERT_CHECKING #undef USE_ASSERT_CHECKING
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment