autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AC_PROG_F77 thinks my compiler is g77 (it's not!)


From: Steven G. Johnson
Subject: Re: AC_PROG_F77 thinks my compiler is g77 (it's not!)
Date: Tue, 14 Nov 2000 22:46:39 -0500 (EST)

Paul Martinolich wrote:
> The _AC_COMPILER_GNU macro uses the cpp statements:
> [...] 
> to determine if the compile is a GNU compiler.  In strict Fortran,
> these statements are illegal!  Unfortunately, I don't believe there
> is a way (in strict Fortran) to determine those characteristics of
> the compiler.

(I think you're missing the point.  It's fine that other compilers will
choke on this--that will cause the test to correctly fail.  We only need
it to work for one compiler, g77.)

Anyway, I see that Akim has checked in fixes for this problem...
Unfortunately, it is still broken.  Now it doesn't think *any* compiler is
g77, including g77 itself.

The problem is that the test program is compiled as conftest.f, which
isn't run through the preprocessor by g77--it needs to be called
conftest.fpp or conftest.F.  I'm not sure what the right way to fix this
is.  The simplest thing would to be to simply change ac_ext temporarily
just before calling _AC_LANG_COMPILER_GNU for Fortran:

diff -u -r1.89 aclang.m4
--- aclang.m4   2000/11/14 11:06:37     1.89
+++ aclang.m4   2000/11/15 03:33:58
@@ -1029,7 +1029,10 @@
                   [g77 f77 xlf cf77 pgf77 fl32 fort77 f90 xlf90 f95 lf95 
fc])]) 
 _AC_LANG_COMPILER_WORKS
+ac_ext_SAVE="$ac_ext"
+ac_ext=F
 _AC_LANG_COMPILER_GNU
+ac_ext="$ac_ext_SAVE"
 G77=`test $ac_compiler_gnu = yes && echo yes`
 AC_EXPAND_ONCE([_AC_OBJEXT])
 AC_EXPAND_ONCE([_AC_EXEEXT])

This is a bit ugly, though, since _AC_LANG_COMPILER_GNU then does not work
on its own for Fortran; I'm not sure where the right place to put it would
be.  (In the long term, you may want some way of telling AC_COMPILE*
whether or not you want to use the preprocessor too, at least for
Fortran?)  In any case, though, you don't need to worry about using the
"right" filename extension for preprocessing in all compilers, since it
only has to work for g77 (and fail for other compilers).

Steven

PS. I wonder if a better way than #ifdef'ing __GNUC__ would be to just run
the compiler with --version and look for "GNU Fortran" on the first line?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]