[Patch] libgfortran: do not assume libm

Ralf Corsepius ralf.corsepius@rtems.org
Tue Mar 20 09:58:00 GMT 2012


On 03/20/2012 10:01 AM, Tristan Gingold wrote:
> Hi,
>
> I am starting to build fortran for VMS.
>
> The first serious issue was with libgfortran/configure.  It checks for several math functions, but directly in libm using AC_CHECK_LIB.
> But there is on such things as libm on VMS systems (thus requiring to define MATH_LIBRARY as "").  Therefore all these tests fail,
> resulting in a failure during libgfortran build.
>
> I think the best way to test for the math function is to use AC_CHECK_DECLS as hinted by the autoconf manual
> (cf the AC_CHECK_DECLS example in http://www.gnu.org/software/autoconf/manual/autoconf.html
>           AC_CHECK_DECLS([j0], [], [], [[#include<math.h>]])
>           AC_CHECK_DECLS([[basename(char *)], [dirname(char *)]])
>
> )
> but I am not an autoconf expert.
>
> I think that this change makes the AIX specific check for __clog obsolete, but I haven't removed it.
>
> With this change I was able to cross build libgfortran for VMS (ia64 and alpha).
> I have also bootstrapped gcc for x86_64-darwin, without fortran regressions.
>
> Ok for trunk ?

IMO, no.

What you are doing here is to replace checks, which check for presence 
of a symbol in a library (e.g. cos in libm.*) by checks for presence of 
a symbol's declaration inside of a header.

This is something entirely different (This also reflects in 
AC_CHECK_DECL by default providing HAVE_DECL_XXX defines).

Also note that it's not uncommon to have declarations inside of headers, 
which are not present inside of a library.

Ralf



More information about the Gcc-patches mailing list