# is installed.
# ('make test_bn' should not try to run 'bc' if it does not exist or if
# it is the broken SunOS 5.[78] bc, which fails the following test.)
+#
+# If 'bc' works, we also test if it knows the 'print' command.
+#
+# In any case, output an appropriate command line for running (or not
+# running) bc.
if [ 0 != "`bc <<\EOF
obase=16
EOF`" ]
then
echo "bc does not work. Consider installing GNU bc." >&2
+ echo "cat >/dev/null"
exit 1
+fi
+
+
+# insert SCO bc test case here:
+if [ 0 != "`bc <<\EOF
+0
+EOF`" ]
+then
+ echo "bc does not work. Consider installing GNU bc." >&2
+ echo "cat >/dev/null"
+ exit 1
+fi
+
+
+# bc works, good.
+# Now check if it knows the 'print' command.
+if [ "OK" = "`bc 2>/dev/null <<\EOF
+print \"OK\"
+EOF`" ]
+then
+ echo "bc"
else
- exit 0
+ echo "sed 's/print.*//' | bc"
fi
+
+exit 0