summaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-11-13 20:36:46 -0800
committerKaz Kylheku <kaz@kylheku.com>2015-11-13 20:36:46 -0800
commit9f633256dea9a141bc5a4d96b2b9c47e3ecb4858 (patch)
treee2b375d7384323b9abeb55a8af10edec08b3a101 /configure
parentb8cfcb2280d63ac9ebf92a001f87c2b3fe4e204b (diff)
downloadtxr-9f633256dea9a141bc5a4d96b2b9c47e3ecb4858.tar.gz
txr-9f633256dea9a141bc5a4d96b2b9c47e3ecb4858.tar.bz2
txr-9f633256dea9a141bc5a4d96b2b9c47e3ecb4858.zip
New global control over float print precision.
* configure (have_dbl_decimal_dig): New variable. New configure test to test for DBL_DECIMAL_DIG or __DBL_DECIMAL_DIG__, resulting in FLO_MAX_DIG macro being deposited in config.h. * arith.c (arith_init): Register flo-max-dig variable. * stream.c (print_flo_precision_s): New symbol variable. (formatv): Obtain default precision from *print-flo-precision* special variable, rather than hard coded DBL_DIG. (stream_init): Initialize print_flo_precision_s variable, and register *print-flo-precision* special. * txr.1: Document flo-max-dig, *print-flo-precision*, and change of behavior in format.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure32
1 files changed, 32 insertions, 0 deletions
diff --git a/configure b/configure
index 8ee9c4e0..528f77ad 100755
--- a/configure
+++ b/configure
@@ -112,6 +112,7 @@ lit_align=
extra_debugging=
debug_support=y
gen_gc=y
+have_dbl_decimal_dig=
have_unistd=
have_sys_time=
have_syslog=
@@ -1265,6 +1266,37 @@ printf '"%s"\n' "$inline"
printf "#define INLINE $inline\n" >> $config_h
#
+# DBL_DECIMAL_DIG
+#
+
+printf "Checking for DBL_DECIMAL_DIG ... "
+
+for try_sym in DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__ ; do
+ cat > conftest.c <<!
+#include <float.h>
+
+#ifndef $try_sym
+#error $try_sym not defined
+#else
+int main(void)
+{
+ return 0;
+}
+#endif
+!
+ if conftest ; then
+ printf "yes (%s)\n" $try_sym
+ printf "#define FLO_MAX_DIG $try_sym\n" >> $config_h
+ have_dbl_decimal_dig=y
+ fi
+done
+
+if ! [ $have_dbl_decimal_dig ] ; then
+ printf "no\n"
+ printf "#define FLO_MAX_DIG (DBL_DIG + 2)\n" >> $config_h
+fi
+
+#
# Valgrind
#