aboutsummaryrefslogtreecommitdiffstats
path: root/autoconf
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
parentb5ca43e000427d220f90dc120502ad7b54392eca (diff)
downloadexternal_llvm-a0137d3d825f4d562b55d4358d66e005c10eea01.zip
external_llvm-a0137d3d825f4d562b55d4358d66e005c10eea01.tar.gz
external_llvm-a0137d3d825f4d562b55d4358d66e005c10eea01.tar.bz2
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')
-rw-r--r--autoconf/aclocal.m429
-rw-r--r--autoconf/configure.ac3
2 files changed, 32 insertions, 0 deletions
diff --git a/autoconf/aclocal.m4 b/autoconf/aclocal.m4
index 51040fb..da725af 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
+])
diff --git a/autoconf/configure.ac b/autoconf/configure.ac
index 85a319f..62e6740 100644
--- a/autoconf/configure.ac
+++ b/autoconf/configure.ac
@@ -455,6 +455,9 @@ AC_CHECK_TYPES([uint64_t],,AC_MSG_ERROR([Type uint64_t required but not found]))
AC_HEADER_TIME
AC_STRUCT_TM
+dnl Check for various C features
+AC_C_PRINTF_A
+
dnl Check for C++ extensions
AC_CXX_HAVE_EXT_HASH_MAP
AC_CXX_HAVE_EXT_HASH_SET