summaryrefslogtreecommitdiff
path: root/acinclude.m4
diff options
context:
space:
mode:
authorthevenyp <thevenyp@280ebfd0-de03-0410-8827-d642c229c3f4>2009-03-26 15:09:38 +0000
committerthevenyp <thevenyp@280ebfd0-de03-0410-8827-d642c229c3f4>2009-03-26 15:09:38 +0000
commit8427a181b42c4156f0abc20fe6b77fc29fb556ee (patch)
treebb30e0174f854615a389f5cd9dcaec88324aa37c /acinclude.m4
parenta798c983b7e111580492009ef53f954aeb186656 (diff)
downloadmpfr-8427a181b42c4156f0abc20fe6b77fc29fb556ee.tar.gz
acinclude.m4: Change MPFR_FUNC_PRINTF_SPEC (renamed MPFR_FUNC_GMP_PRINTF_SPEC) so that it actually checks output.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@6142 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'acinclude.m4')
-rw-r--r--acinclude.m446
1 files changed, 23 insertions, 23 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 89bd5d022..4040db376 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -668,74 +668,74 @@ fi
])
-dnl MPFR_FUNC_PRINTF_SPEC
+dnl MPFR_FUNC_GMP_PRINTF_SPEC
dnl ------------------------------------
-dnl MPFR_FUNC_PRINTF_SPEC(spec, type, [includes], [lib-prefix], [if-true], [if-false])
-dnl Check if printf supports the conversion specification 'spec'
+dnl MPFR_FUNC_GMP_PRINTF_SPEC(spec, type, [includes], [if-true], [if-false])
+dnl Check if gmp_sprintf supports the conversion specification 'spec'
dnl with type 'type'.
dnl Expand 'if-true' if printf supports 'spec', 'if-false' otherwise.
-AC_DEFUN([MPFR_FUNC_PRINTF_SPEC],[
-AC_MSG_CHECKING(if $4printf supports "$1")
+AC_DEFUN([MPFR_FUNC_GMP_PRINTF_SPEC],[
+AC_MSG_CHECKING(if gmp_printf supports "%$1")
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
$3
+#include <gmp.h>
]], [[
char s[256];
- $2 a = 0;
- return ($4sprintf (s, "$1", a) != 1) ? 1 : 0;
+ $2 a = 17;
+
+ if (gmp_sprintf (s, "(%0.0$1)(%d)", a, 42) == -1) return 1;
+ return (strcmp (s, "(17)(42)") != 0);
]])],
[AC_MSG_RESULT(yes)
- $5],
+ $4],
[AC_MSG_RESULT(no)
- $6])
+ $5])
])
dnl MPFR_CHECK_PRINTF_SPEC
dnl ----------------------
-dnl Check if libc printf and gmp_printf support some optional length
-dnl modifiers.
+dnl Check if gmp_printf supports some optional length modifiers.
dnl Defined symbols are negative to shorten the gcc command line.
AC_DEFUN([MPFR_CHECK_PRINTF_SPEC], [
AC_REQUIRE([MPFR_CONFIGS])dnl
if test "$ac_cv_type_intmax_t" = yes; then
- MPFR_FUNC_PRINTF_SPEC([%jd], [intmax_t], [
+ MPFR_FUNC_GMP_PRINTF_SPEC([jd], [intmax_t], [
#ifdef HAVE_STDINT_H
# include <stdint.h>
#endif
#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#endif
-
-#include <gmp.h>
- ], [gmp_],,
+ ],,
[AC_DEFINE([NPRINTF_J], 1, [gmp_printf cannot read intmax_t])])
fi
-MPFR_FUNC_PRINTF_SPEC([%hhd], [char], [
+MPFR_FUNC_GMP_PRINTF_SPEC([hhd], [char], [
#include <gmp.h>
- ], [gmp_],,
+ ],,
[AC_DEFINE([NPRINTF_HH], 1, [gmp_printf cannot use 'hh' length modifier])])
-MPFR_FUNC_PRINTF_SPEC([%lld], [long long int], [
+MPFR_FUNC_GMP_PRINTF_SPEC([lld], [long long int], [
#include <gmp.h>
- ], [gmp_],,
+ ],,
[AC_DEFINE([NPRINTF_LL], 1, [gmp_printf cannot read long long int])])
-MPFR_FUNC_PRINTF_SPEC([%.0Lf], [long double], [
+MPFR_FUNC_GMP_PRINTF_SPEC([Lf], [long double], [
#include <gmp.h>
- ], [gmp_],,
+ ],,
[AC_DEFINE([NPRINTF_L], 1, [gmp_printf cannot read long double])])
-MPFR_FUNC_PRINTF_SPEC([%td], [ptrdiff_t], [
+MPFR_FUNC_GMP_PRINTF_SPEC([td], [ptrdiff_t], [
#if defined (__cplusplus)
#include <cstddef>
#else
#include <stddef.h>
#endif
#include "gmp.h"
- ], [gmp_],,
+ ],,
[AC_DEFINE([NPRINTF_T], 1, [gmp_printf cannot read ptrdiff_t])])
])