llvm.org GIT mirror llvm / a0137d3
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 John Criswell 16 years ago
5 changed file(s) with 121 addition(s) and 70 deletion(s). Raw diff Collapse all Expand all
61656165 [AC_CONFIG_COMMANDS($1,${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/$1 $1,${srcdir}/autoconf/mkinstalldirs `dirname $1`)
61666166 ])
61676167
6168
6168 #
6169 # Determine if the printf() functions have the %a format character.
6170 # This is modified from:
6171 # http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_slist.html
6172 AC_DEFUN([AC_C_PRINTF_A],
6173 [
6174 AC_LANG_SAVE
6175 AC_LANG_C
6176 AC_RUN_IFELSE(
6177 AC_LANG_PROGRAM([#include
6178 #include ],
6179 [[[
6180 volatile double A, B;
6181 char Buffer[100];
6182 A = 1;
6183 A /= 10.0;
6184 sprintf(Buffer, "%a", A);
6185 B = atof(Buffer);
6186 if (A != B)
6187 return (1);
6188 if (A != 0x1.999999999999ap-4)
6189 return (1);
6190 return (0);]]]),
6191 ac_c_printf_a=yes,ac_c_printf_a=no)
6192 AC_LANG_RESTORE
6193 if test "$ac_c_printf_a" = "yes"; then
6194 AC_DEFINE([HAVE_PRINTF_A],[1],[Define to have the %a format string])
6195 fi
6196 ])
6197
454454 AC_HEADER_TIME
455455 AC_STRUCT_TM
456456
457 dnl Check for various C features
458 AC_C_PRINTF_A
459
457460 dnl Check for C++ extensions
458461 AC_CXX_HAVE_EXT_HASH_MAP
459462 AC_CXX_HAVE_EXT_HASH_SET
2070120701 fi
2070220702
2070320703
20704
20705
20706
20707 ac_ext=c
20708 ac_cpp='$CPP $CPPFLAGS'
20709 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
20710 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
20711 ac_compiler_gnu=$ac_cv_c_compiler_gnu
20712
20713 if test "$cross_compiling" = yes; then
20714 { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling
20715 See \`config.log' for more details." >&5
20716 echo "$as_me: error: cannot run test program while cross compiling
20717 See \`config.log' for more details." >&2;}
20718 { (exit 1); exit 1; }; }
20719 else
20720 cat >conftest.$ac_ext <<_ACEOF
20721 #line $LINENO "configure"
20722 /* confdefs.h. */
20723 _ACEOF
20724 cat confdefs.h >>conftest.$ac_ext
20725 cat >>conftest.$ac_ext <<_ACEOF
20726 /* end confdefs.h. */
20727 #include
20728 #include
20729 int
20730 main ()
20731 {
20732
20733 volatile double A, B;
20734 char Buffer[100];
20735 A = 1;
20736 A /= 10.0;
20737 sprintf(Buffer, "%a", A);
20738 B = atof(Buffer);
20739 if (A != B)
20740 return (1);
20741 if (A != 0x1.999999999999ap-4)
20742 return (1);
20743 return (0);
20744 ;
20745 return 0;
20746 }
20747 _ACEOF
20748 rm -f conftest$ac_exeext
20749 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
20750 (eval $ac_link) 2>&5
20751 ac_status=$?
20752 echo "$as_me:$LINENO: \$? = $ac_status" >&5
20753 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
20754 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
20755 (eval $ac_try) 2>&5
20756 ac_status=$?
20757 echo "$as_me:$LINENO: \$? = $ac_status" >&5
20758 (exit $ac_status); }; }; then
20759 ac_c_printf_a=yes
20760 else
20761 echo "$as_me: program exited with status $ac_status" >&5
20762 echo "$as_me: failed program was:" >&5
20763 sed 's/^/| /' conftest.$ac_ext >&5
20764
20765 ( exit $ac_status )
20766 ac_c_printf_a=no
20767 fi
20768 rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
20769 fi
20770 ac_ext=c
20771 ac_cpp='$CPP $CPPFLAGS'
20772 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
20773 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
20774 ac_compiler_gnu=$ac_cv_c_compiler_gnu
20775
20776 if test "$ac_c_printf_a" = "yes"; then
20777
20778 cat >>confdefs.h <<\_ACEOF
20779 #define HAVE_PRINTF_A 1
20780 _ACEOF
20781
20782 fi
20783
20784
2070420785 echo "$as_me:$LINENO: checking whether the compiler implements namespaces" >&5
2070520786 echo $ECHO_N "checking whether the compiler implements namespaces... $ECHO_C" >&6
2070620787 if test "${ac_cv_cxx_namespaces+set}" = set; then
2241922500
2242022501
2242122502
22422
22423 for ac_func in getcwd gettimeofday strcspn strdup strerror strspn strstr strtod strtol strtoq strtoll strsignal
22503 for ac_func in getcwd gettimeofday strcspn strdup strerror strspn strstr strtod strtol strtoq strtoll
2242422504 do
2242522505 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
2242622506 echo "$as_me:$LINENO: checking for $ac_func" >&5
2250222582
2250322583 fi
2250422584 done
22505
22506 echo "$as_me:$LINENO: checking whether sys_siglist is declared" >&5
22507 echo $ECHO_N "checking whether sys_siglist is declared... $ECHO_C" >&6
22508 if test "${ac_cv_have_decl_sys_siglist+set}" = set; then
22509 echo $ECHO_N "(cached) $ECHO_C" >&6
22510 else
22511 cat >conftest.$ac_ext <<_ACEOF
22512 #line $LINENO "configure"
22513 /* confdefs.h. */
22514 _ACEOF
22515 cat confdefs.h >>conftest.$ac_ext
22516 cat >>conftest.$ac_ext <<_ACEOF
22517 /* end confdefs.h. */
22518
22519 #if HAVE_SIGNAL_H
22520 #include
22521 #endif
22522
22523 int
22524 main ()
22525 {
22526 #ifndef sys_siglist
22527 char *p = (char *) sys_siglist;
22528 #endif
22529
22530 ;
22531 return 0;
22532 }
22533 _ACEOF
22534 rm -f conftest.$ac_objext
22535 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
22536 (eval $ac_compile) 2>&5
22537 ac_status=$?
22538 echo "$as_me:$LINENO: \$? = $ac_status" >&5
22539 (exit $ac_status); } &&
22540 { ac_try='test -s conftest.$ac_objext'
22541 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
22542 (eval $ac_try) 2>&5
22543 ac_status=$?
22544 echo "$as_me:$LINENO: \$? = $ac_status" >&5
22545 (exit $ac_status); }; }; then
22546 ac_cv_have_decl_sys_siglist=yes
22547 else
22548 echo "$as_me: failed program was:" >&5
22549 sed 's/^/| /' conftest.$ac_ext >&5
22550
22551 ac_cv_have_decl_sys_siglist=no
22552 fi
22553 rm -f conftest.$ac_objext conftest.$ac_ext
22554 fi
22555 echo "$as_me:$LINENO: result: $ac_cv_have_decl_sys_siglist" >&5
22556 echo "${ECHO_T}$ac_cv_have_decl_sys_siglist" >&6
22557 if test $ac_cv_have_decl_sys_siglist = yes; then
22558
22559 cat >>confdefs.h <<_ACEOF
22560 #define HAVE_DECL_SYS_SIGLIST 1
22561 _ACEOF
22562
22563
22564 else
22565 cat >>confdefs.h <<_ACEOF
22566 #define HAVE_DECL_SYS_SIGLIST 0
22567 _ACEOF
22568
22569
22570 fi
22571
2257222585
2257322586
2257422587
225225
226226 /* Define to `unsigned' if does not define. */
227227 #undef size_t
228
229 /* Define to have the %a format string in printf() */
230 #undef HAVE_PRINTF_A
225225
226226 /* Define to `unsigned' if does not define. */
227227 #undef size_t
228
229 /* Define to have the %a format string in printf() */
230 #undef HAVE_PRINTF_A