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
This commit is contained in:
John Criswell
2003-10-13 16:22:01 +00:00
parent b5ca43e000
commit a0137d3d82
5 changed files with 120 additions and 69 deletions

29
autoconf/aclocal.m4 vendored
View File

@@ -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
])

View File

@@ -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