Have configure check for use of %lld for int64, and if that fails, check for


			
			
				REL6_5_PATCHES
			
			
		
Marc G. Fournier 27 years ago
parent a431aaec44
commit 75007a72d6
  1. 1054
      src/configure
  2. 46
      src/configure.in
  3. 6
      src/include/config.h.in
  4. 8
      src/include/utils/int8.h

1054
src/configure vendored

File diff suppressed because it is too large Load Diff

@ -788,7 +788,7 @@ 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 If we found we need to use "long long int", better check.
if [[ x$SNPRINTF = x -a $HAVE_LONG_LONG_INT_64 -eq 1 ]] ; then if [[ x$SNPRINTF = x -a $HAVE_LONG_LONG_INT_64 -eq 1 ]] ; then
AC_MSG_CHECKING(whether snprintf handles 'long long int') AC_MSG_CHECKING(whether snprintf handles 'long long int' as %lld)
AC_TRY_RUN([#include <stdio.h> AC_TRY_RUN([#include <stdio.h>
typedef long long int int64; typedef long long int int64;
#define INT64_FORMAT "%lld" #define INT64_FORMAT "%lld"
@ -813,11 +813,45 @@ int does_int64_snprintf_work()
main() { main() {
exit(! does_int64_snprintf_work()); exit(! does_int64_snprintf_work());
}], }],
AC_MSG_RESULT(yes), [ AC_MSG_RESULT(yes)
[SNPRINTF='snprintf.o' AC_DEFINE(HAVE_INT64_AS_LLD) ],
AC_MSG_RESULT(no)], [ AC_MSG_RESULT(no)
[SNPRINTF='snprintf.o' AC_MSG_CHECKING(whether snprintf handles 'long long int' as %qd)
AC_MSG_RESULT(assuming not on target machine)]) AC_TRY_RUN([#include <stdio.h>
typedef long long int int64;
#define INT64_FORMAT "%qd"
int64 a = 20000001;
int64 b = 40000005;
int does_int64_snprintf_work()
{
int64 c;
char buf[100];
if (sizeof(int64) != 8)
return 0; /* doesn't look like the right size */
c = a * b;
snprintf(buf, 100, INT64_FORMAT, c);
if (strcmp(buf, "800000140000005") != 0)
return 0; /* either multiply or snprintf is busted */
return 1;
}
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)])
fi fi

@ -281,6 +281,12 @@ extern void srandom(unsigned int seed);
/* Set to 1 if your DBL_MIN is problematic */ /* Set to 1 if your DBL_MIN is problematic */
#undef HAVE_DBL_MIN_PROBLEM #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 */ /* Set to 1 if type "long int" works and is 64 bits */
#undef HAVE_LONG_INT_64 #undef HAVE_LONG_INT_64

@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: int8.h,v 1.10 1999/02/13 23:22:23 momjian Exp $ * $Id: int8.h,v 1.11 1999/03/08 04:17:33 scrappy Exp $
* *
* NOTES * NOTES
* These data types are supported on all 64-bit architectures, and may * These data types are supported on all 64-bit architectures, and may
@ -33,7 +33,11 @@ typedef long int int64;
/* We have working support for "long long int", use that */ /* We have working support for "long long int", use that */
typedef long long int int64; typedef long long int int64;
#define INT64_FORMAT "%lld" #ifdef HAVE_INT64_AS_LLD
# define INT64_FORMAT "%lld"
#elif HAVE_INT64_AS_QD
# define INT64_FORMAT "%qd"
#endif
#else #else
/* Won't actually work, but fall back to long int so that int8.c compiles */ /* Won't actually work, but fall back to long int so that int8.c compiles */
typedef long int int64; typedef long int int64;

Loading…
Cancel
Save