summaryrefslogtreecommitdiff
path: root/sim/cris/configure
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-10-19 21:28:27 +0000
committerMike Frysinger <vapier@gentoo.org>2011-10-19 21:28:27 +0000
commit4399a56be2e20b4a0862c6d67cf20a497571ac9d (patch)
treeac14ddec2889375d8e3fab152f08ac30ffb428c5 /sim/cris/configure
parentf05e2e1de66ff08f7551de7bb8e1411540c9fffa (diff)
sim: dv-cfi: check for log2 support in libm when enabled
The dv-cfi model uses log2() internally, so make sure we automatically link in libm when required. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'sim/cris/configure')
-rwxr-xr-xsim/cris/configure48
1 files changed, 48 insertions, 0 deletions
diff --git a/sim/cris/configure b/sim/cris/configure
index c83f0fa382..ff122beaa0 100755
--- a/sim/cris/configure
+++ b/sim/cris/configure
@@ -5007,6 +5007,54 @@ if test x"$silent" != x"yes"; then
fi
fi
+case " $hardware " in
+ *" cfi "*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for log2 in -lm" >&5
+$as_echo_n "checking for log2 in -lm... " >&6; }
+if test "${ac_cv_lib_m_log2+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char log2 ();
+int
+main ()
+{
+return log2 ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_m_log2=yes
+else
+ ac_cv_lib_m_log2=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_log2" >&5
+$as_echo "$ac_cv_lib_m_log2" >&6; }
+if test "x$ac_cv_lib_m_log2" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+ LIBS="-lm $LIBS"
+
+fi
+;;
+esac
+
# The default model shouldn't matter as long as there's a BFD.