On Windows/mingw32, scanf only accepts %I64d for long long integers.

Reference that gave me this hint: http://acm.pku.edu.cn/JudgeOnline/faq.htm

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@14806 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Christian Stimming
2006-09-06 11:46:36 +00:00
parent 7b0ec87f66
commit 0415051267
3 changed files with 39 additions and 2 deletions

View File

@@ -135,7 +135,10 @@ if test x$am_cv_scanf_lld = "xno"; then
SCANF_QD_CHECK
if test x$am_cv_scanf_qd = "xno"; then
AC_MSG_ERROR([cannot continue, no long long conversion support in scanf])
SCANF_I64D_CHECK
if test x$am_cv_scanf_i64d = "xno"; then
AC_MSG_ERROR([Cannot continue, no long long conversion support in scanf.])
fi
fi
fi

View File

@@ -48,7 +48,11 @@
# if HAVE_SCANF_QD
# define QOF_SCANF_LLD "%qd"
# else
# error "No scanf format string is known for LLD. Fix your ./configure so that the correct one is detected!"
# if HAVE_SCANF_I64D
# define QOF_SCANF_LLD "%I64d"
# else
# error "No scanf format string is known for LLD. Fix your ./configure so that the correct one is detected!"
# endif
# endif
#endif

View File

@@ -153,6 +153,36 @@ int main ()
fi
])
AC_DEFUN([SCANF_I64D_CHECK],
[
AC_CACHE_CHECK([if scanf supports %I64d conversions],
am_cv_scanf_i64d,
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
int main ()
{
long long int d;
long long int e;
d = 0;
e = 100000;
e *= 100000;
if ((sscanf ("10000000000", "%I64d", &d) != 1) || (d != e))
exit (1);
exit (0);
}
],
am_cv_scanf_i64d=yes,
am_cv_scanf_i64d=no))
if test $am_cv_scanf_i64d = yes; then
AC_DEFINE(HAVE_SCANF_I64D, 1,
[Define if scanf supports %I64d conversions.])
fi
])
AC_DEFUN([LANGINFO_D_FMT_CHECK],
[
AC_CACHE_CHECK([for nl_langinfo and D_FMT], am_cv_langinfo_dfmt,