summaryrefslogtreecommitdiff
path: root/autoconf/aclocal.m4
diff options
context:
space:
mode:
authorJohn Criswell <criswell@uiuc.edu>2003-10-13 16:22:01 +0000
committerJohn Criswell <criswell@uiuc.edu>2003-10-13 16:22:01 +0000
commita0137d3d825f4d562b55d4358d66e005c10eea01 (patch)
treebf3ae883e7f2e0acbf609f79b6d07c70e503aeba /autoconf/aclocal.m4
parentb5ca43e000427d220f90dc120502ad7b54392eca (diff)
downloadllvm-a0137d3d825f4d562b55d4358d66e005c10eea01.tar.gz
llvm-a0137d3d825f4d562b55d4358d66e005c10eea01.tar.bz2
llvm-a0137d3d825f4d562b55d4358d66e005c10eea01.tar.xz
Added a macro and code that checks for the %a format string in sprintf().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9089 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'autoconf/aclocal.m4')
-rw-r--r--autoconf/aclocal.m429
1 files changed, 29 insertions, 0 deletions
diff --git a/autoconf/aclocal.m4 b/autoconf/aclocal.m4
index 51040fb523..da725af8a4 100644
--- a/autoconf/aclocal.m4
+++ b/autoconf/aclocal.m4
@@ -6166,4 +6166,33 @@ AC_DEFUN([AC_CONFIG_MAKEFILE],
[AC_CONFIG_COMMANDS($1,${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/$1 $1,${srcdir}/autoconf/mkinstalldirs `dirname $1`)
])
+#
+# Determine if the printf() functions have the %a format character.
+# This is modified from:
+# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_slist.html
+AC_DEFUN([AC_C_PRINTF_A],
+[
+ AC_LANG_SAVE
+ AC_LANG_C
+ AC_RUN_IFELSE(
+ AC_LANG_PROGRAM([#include <stdio.h>
+ #include <stdlib.h>],
+ [[[
+ volatile double A, B;
+ char Buffer[100];
+ A = 1;
+ A /= 10.0;
+ sprintf(Buffer, "%a", A);
+ B = atof(Buffer);
+ if (A != B)
+ return (1);
+ if (A != 0x1.999999999999ap-4)
+ return (1);
+ return (0);]]]),
+ ac_c_printf_a=yes,ac_c_printf_a=no)
+ AC_LANG_RESTORE
+ if test "$ac_c_printf_a" = "yes"; then
+ AC_DEFINE([HAVE_PRINTF_A],[1],[Define to have the %a format string])
+ fi
+])