Improved checks for scanf %lld and %qd as per gc-devel mail.

* acinclude.m4: create a SCANF_QD_CHECK and make sure both
	  that and SCANF_LLD_CHECK are "long long" constant-safe
	* configure.in: use the new SCANF_QD_CHECK and use it
	  earlier in the configuration.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@10161 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Derek Atkins 2004-07-05 03:24:04 +00:00
parent f732926232
commit 2168045b6f
3 changed files with 48 additions and 26 deletions

View File

@ -1,3 +1,10 @@
2004-07-04 Derek Atkins <derek@ihtfp.com>
* acinclude.m4: create a SCANF_QD_CHECK and make sure both
that and SCANF_LLD_CHECK are "long long" constant-safe
* configure.in: use the new SCANF_QD_CHECK and use it
earlier in the configuration.
2004-07-02 Derek Atkins <derek@ihtfp.com>
* src/gnome/dialog-print-check.c:

View File

@ -4337,9 +4337,12 @@ AC_DEFUN([SCANF_LLD_CHECK],
int main ()
{
long long int d;
long long int e;
d = 0;
if ((sscanf ("10000000000", "%lld", &d) != 1) || (d != 10000000000))
e = 100000;
e *= 100000;
if ((sscanf ("10000000000", "%lld", &d) != 1) || (d != e))
exit (1);
exit (0);
@ -4352,3 +4355,33 @@ int main ()
[Define if scanf supports %lld conversions.])
fi
])
AC_DEFUN([SCANF_QD_CHECK],
[
AC_CACHE_CHECK([if scanf supports %qd conversions],
am_cv_scanf_qd,
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", "%qd", &d) != 1) || (d != e))
exit (1);
exit (0);
}
],
am_cv_scanf_qd=yes,
am_cv_scanf_qd=no))
if test $am_cv_scanf_qd = yes; then
AC_DEFINE(HAVE_SCANF_QD, 1,
[Define if scanf supports %qd conversions.])
fi
])

View File

@ -106,6 +106,13 @@ AC_CHECK_FUNCS(stpcpy memcpy timegm towupper)
STRUCT_TM_GMTOFF_CHECK
SCANF_LLD_CHECK
if test $am_cv_scanf_lld = "no"; then
SCANF_QD_CHECK
if test $am_cv_scanf_qs = "no"; then
AC_MSG_ERROR([cannot continue, no long long conversion support in scanf])
fi
fi
AC_CHECK_HEADERS(ltdl.h)
if test "x$ac_cv_header_ltdl_h" = xno; then
@ -1030,31 +1037,6 @@ else
fi
AC_SUBST(LC_MESSAGES_ENUM)
if test $am_cv_scanf_lld = "no"; then
AC_MSG_CHECKING(if scanf supports %qd conversion)
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
int main ()
{
long long int d;
d = 0;
if ((sscanf ("10000000000", "%qd", &d) != 1) || (d != 10000000000))
exit (1);
exit (0);
}
],[
AC_DEFINE(HAVE_SCANF_QD, 1,
[Define if scanf supports %qd conversions.])
AC_MSG_RESULT(yes)
],[
AC_MSG_RESULT(no)
AC_MSG_ERROR([cannot continue, no long long conversion support in scanf])
])
fi
### --------------------------------------------------------------------------
### GnuCash flags and libs configuration