|
|
|
@ -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. |
|
|
|
|
|
|
|
|
|
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> |
|
|
|
|
typedef long long int int64; |
|
|
|
|
#define INT64_FORMAT "%lld" |
|
|
|
@ -813,11 +813,45 @@ int does_int64_snprintf_work() |
|
|
|
|
main() { |
|
|
|
|
exit(! does_int64_snprintf_work()); |
|
|
|
|
}], |
|
|
|
|
AC_MSG_RESULT(yes), |
|
|
|
|
[SNPRINTF='snprintf.o' |
|
|
|
|
AC_MSG_RESULT(no)], |
|
|
|
|
[SNPRINTF='snprintf.o' |
|
|
|
|
AC_MSG_RESULT(assuming not on target machine)]) |
|
|
|
|
[ AC_MSG_RESULT(yes) |
|
|
|
|
AC_DEFINE(HAVE_INT64_AS_LLD) ], |
|
|
|
|
[ AC_MSG_RESULT(no) |
|
|
|
|
AC_MSG_CHECKING(whether snprintf handles 'long long int' as %qd) |
|
|
|
|
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 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|