Fix int8 configure one more time ... prior version didn't

define INT64_FORMAT in all cases.
This commit is contained in:
Tom Lane 1999-03-15 01:43:07 +00:00
parent 98ad3fcfaf
commit f621b85a2a
4 changed files with 508 additions and 614 deletions

1051
src/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -791,8 +791,12 @@ fi
dnl If we found "long int" is 64 bits, assume snprintf handles it.
dnl If we found we need to use "long long int", better check.
dnl We cope with snprintfs that use either %lld or %qd as the format.
dnl If neither works, fall back to our own snprintf emulation (which we
dnl know uses %lld).
if [[ x$SNPRINTF = x -a $HAVE_LONG_LONG_INT_64 -eq 1 ]] ; then
if [[ $HAVE_LONG_LONG_INT_64 -eq 1 ]] ; then
if [[ x$SNPRINTF = x ]] ; then
AC_MSG_CHECKING(whether snprintf handles 'long long int' as %lld)
AC_TRY_RUN([#include <stdio.h>
typedef long long int int64;
@ -819,7 +823,8 @@ main() {
exit(! does_int64_snprintf_work());
}],
[ AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_INT64_AS_LLD) ],
INT64_FORMAT='"%lld"'
],
[ AC_MSG_RESULT(no)
AC_MSG_CHECKING(whether snprintf handles 'long long int' as %qd)
AC_TRY_RUN([#include <stdio.h>
@ -846,19 +851,35 @@ int does_int64_snprintf_work()
main() {
exit(! does_int64_snprintf_work());
}],
[ AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_INT64_AS_QD) ],
[ SNPRINTF='snprintf.o'
AC_MSG_RESULT(no)],
[ SNPRINTF='snprintf.o'
AC_MSG_RESULT(assuming not on target machine)]) ],
[ SNPRINTF='snprintf.o'
AC_MSG_RESULT(no)],
[ SNPRINTF='snprintf.o'
AC_MSG_RESULT(assuming not on target machine)])
[ AC_MSG_RESULT(yes)
INT64_FORMAT='"%qd"'
],
[ AC_MSG_RESULT(no)
# Force usage of our own snprintf, since system snprintf is broken
SNPRINTF='snprintf.o'
INT64_FORMAT='"%lld"'
],
[ AC_MSG_RESULT(assuming not on target machine)
# Force usage of our own snprintf, since we cannot test foreign snprintf
SNPRINTF='snprintf.o'
INT64_FORMAT='"%lld"'
]) ],
[ AC_MSG_RESULT(assuming not on target machine)
# Force usage of our own snprintf, since we cannot test foreign snprintf
SNPRINTF='snprintf.o'
INT64_FORMAT='"%lld"'
])
else
# here if we previously decided we needed to use our own snprintf
INT64_FORMAT='"%lld"'
fi
else
# Here if we are not using 'long long int' at all
INT64_FORMAT='"%ld"'
fi
AC_DEFINE_UNQUOTED(INT64_FORMAT, $INT64_FORMAT)
dnl Check to see if platform has POSIX signal interface.
dnl NOTE: if this test fails then POSIX signals definitely don't work.

View File

@ -281,18 +281,15 @@ extern void srandom(unsigned int seed);
/* Set to 1 if your DBL_MIN is problematic */
#undef HAVE_DBL_MIN_PROBLEM
/* Set to 1 if your snprintf has %lld for 'long long int' */
#undef HAVE_INT64_AS_LLD
/* Set to 1 if your snprintf has %qd for 'long long int' */
#undef HAVE_INT64_AS_QD
/* Set to 1 if type "long int" works and is 64 bits */
#undef HAVE_LONG_INT_64
/* Set to 1 if type "long long int" works and is 64 bits */
#undef HAVE_LONG_LONG_INT_64
/* Define this as the appropriate snprintf format for 64-bit ints, if any */
#undef INT64_FORMAT
/* Define as the base type of the last arg to accept */
#undef SOCKET_SIZE_TYPE

View File

@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: int8.h,v 1.11 1999/03/08 04:17:33 scrappy Exp $
* $Id: int8.h,v 1.12 1999/03/15 01:43:05 tgl Exp $
*
* NOTES
* These data types are supported on all 64-bit architectures, and may
@ -27,26 +27,25 @@
/* Plain "long int" fits, use it */
typedef long int int64;
#define INT64_FORMAT "%ld"
#else
#ifdef HAVE_LONG_LONG_INT_64
/* We have working support for "long long int", use that */
typedef long long int int64;
#ifdef HAVE_INT64_AS_LLD
# define INT64_FORMAT "%lld"
#elif HAVE_INT64_AS_QD
# define INT64_FORMAT "%qd"
#endif
#else
/* Won't actually work, but fall back to long int so that int8.c compiles */
typedef long int int64;
#define INT64_FORMAT "%ld"
#define INT64_IS_BUSTED
#endif
#endif
/* this should be set in config.h: */
#ifndef INT64_FORMAT
#define INT64_FORMAT "%ld"
#endif
extern int64 *int8in(char *str);
extern char *int8out(int64 * val);