1 dnl Check longest integer in digits.
3 AC_DEFUN([BLP_INT_DIGITS],
5 AC_MSG_CHECKING(number of digits in LONG_MIN (incl. sign))
6 AC_CACHE_VAL(blp_int_digits,
7 [AC_TRY_RUN([#include <stdio.h>
14 sprintf(s, "%ld", LONG_MAX);
16 sprintf(s, "%ld", LONG_MIN);
17 if(strlen(s)>len) len=strlen(s);
18 sprintf(s, "%lu", ULONG_MAX);
19 if(strlen(s)>len) len=strlen(s);
23 eval "blp_int_digits=19",
24 eval "blp_int_digits=$?"
25 if test "$blp_int_digits" -lt 11; then
28 eval "blp_int_digits=19")
30 AC_DEFINE_UNQUOTED([INT_DIGITS], $blp_int_digits,
31 [Number of digits in longest `long' value, including sign.
32 This is usually 11, for 32-bit `long's, or 19, for 64-bit
34 AC_MSG_RESULT($blp_int_digits) ])dnl
36 dnl Check quality of this machine's sprintf implementation.
38 AC_DEFUN([BLP_IS_SPRINTF_GOOD],
40 AC_MSG_CHECKING(if sprintf returns a char count)
41 AC_CACHE_VAL(blp_is_sprintf_good,
42 [AC_TRY_RUN([#include <stdio.h>
47 exit((int)sprintf(s, "abcdefg")!=7);
50 eval "blp_is_sprintf_good=yes",
51 eval "blp_is_sprintf_good=no",
52 eval "blp_is_sprintf_good=no")
54 if test "$blp_is_sprintf_good" = yes; then
55 AC_DEFINE([HAVE_GOOD_SPRINTF], 1,
56 [Define if sprintf() returns the number of characters written
57 to the destination string, excluding the null terminator.])
64 dnl Check for proper random number generator.
66 AC_DEFUN([BLP_RANDOM],
68 AC_MSG_CHECKING(random number generator)
69 AC_CACHE_VAL(blp_random_good,
70 AC_TRY_COMPILE([#include <stdlib.h>], [int x=RAND_MAX;],
71 blp_random_good=yes, blp_random_good=no))
72 if test "$blp_random_good" = yes; then
73 AC_DEFINE([HAVE_GOOD_RANDOM], 1,
74 [Define if rand() and company work according to ANSI.])
81 dnl aclocal.m4 ends here