From 100f13552520d72f54b45d2a67076a22e43d9408 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnim=20L=C3=A4uger?= Date: Wed, 11 Jun 2008 19:35:06 +0000 Subject: [PATCH] detect absence of fmax() in libm and activate fallback for generic_set_frequency() git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1282 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- jtag/ChangeLog | 4 ++++ jtag/configure.ac | 7 +++++++ jtag/src/tap/cable/generic.c | 7 +++++++ 3 files changed, 18 insertions(+) diff --git a/jtag/ChangeLog b/jtag/ChangeLog index ba5a8887..1cfce61e 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,5 +1,9 @@ 2008-06-11 Arnim Laeuger + * src/tap/cable/generic.c (fmax): define fallback in case libm doesn't + provide fmax() + * configure.ac: detect availability of fmax() in libm + * src/bus/bf548_ezkit.c, src/bus/ppc405ep.c, src/bus/sh7727.c, src/bus/sa1110.c, src/bus/ppc440gx_ebc8.c, src/bus/tx4925.c, src/bus/sh7750r.c, src/bus/pxa2x0.c, src/bus/bf533_stamp.c, diff --git a/jtag/configure.ac b/jtag/configure.ac index d07b8f76..646f4ac6 100644 --- a/jtag/configure.ac +++ b/jtag/configure.ac @@ -540,6 +540,13 @@ AS_IF([test "x$relocatable" = xyes], [ AM_CONDITIONAL(JTAG_RELOCATABLE, false) ]) + +dnl Is fmax() provided by libm? +AC_CHECK_LIB([m], [fmax], [ + AC_DEFINE(HAVE_FMAX, 1, [Define if -lm provides fmax()]) +]) + + AC_OUTPUT dnl diff --git a/jtag/src/tap/cable/generic.c b/jtag/src/tap/cable/generic.c index 251f9226..d178bfdf 100644 --- a/jtag/src/tap/cable/generic.c +++ b/jtag/src/tap/cable/generic.c @@ -39,6 +39,13 @@ #include + +#ifndef HAVE_FMAX +/* workaround for libm implementations that don't provide the fmax() function */ +#define fmax(_f1_,_f2_) ( (_f1_) > (_f2_) ? (_f1_) : (_f2_) ) +#endif + + #undef VERBOSE #ifdef VERBOSE