summaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-07-18 06:59:26 -0700
committerKaz Kylheku <kaz@kylheku.com>2014-07-18 06:59:26 -0700
commitc9977c0132b2a6a3df994dbdf58c27689658f20f (patch)
tree72601b227e5a9868e990e41936016e59473c6979 /configure
parent50c2dbed6f823a286d40a1378626467b09363cbb (diff)
downloadtxr-c9977c0132b2a6a3df994dbdf58c27689658f20f.tar.gz
txr-c9977c0132b2a6a3df994dbdf58c27689658f20f.tar.bz2
txr-c9977c0132b2a6a3df994dbdf58c27689658f20f.zip
* Makefile (conftest, conftest2): Link math
library so we can test for math functions. * arith.c (log2_init): New static function. (log2, logtwo): New functions. (l2): New static variable. (arith_init): Call log2_init. * configure (lang_flags): Switching _XOPEN_SOURCE from 500 to 600 to reveal log2. Adding test for log2. * eval.c (eval_init): Register log2 intrinsic. * lib.h (logtwo): Declared. * txr.1: Documented log2.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure20
1 files changed, 19 insertions, 1 deletions
diff --git a/configure b/configure
index 16b84cd7..0d36cff6 100755
--- a/configure
+++ b/configure
@@ -97,7 +97,7 @@ yacc='$(cross)$(tool_prefix)$(yaccname)'
yacc_given=
nm='$(cross)$(tool_prefix)nm'
opt_flags=-O2
-lang_flags='-ansi -D_XOPEN_SOURCE=500'
+lang_flags='-ansi -D_XOPEN_SOURCE=600'
diag_flags='-Wall -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=strict-prototypes'
debug_flags=-g
inline=
@@ -1809,6 +1809,24 @@ else
printf "no\n"
fi
+printf "Checking for log2 ... "
+
+cat > conftest.c <<!
+#include <math.h>
+
+int main(void)
+{
+ double x = log2(42.0);
+ return 0;
+}
+!
+if conftest ; then
+ printf "yes\n"
+ printf "#define HAVE_LOG2 1\n" >> config.h
+else
+ printf "no\n"
+fi
+
#
# Dependent variables
#