autoconf
[Top][All Lists]
Advanced

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

Re: flags for different fortran compilers


From: Ralf Wildenhues
Subject: Re: flags for different fortran compilers
Date: Tue, 1 Feb 2011 22:06:57 +0100
User-agent: Mutt/1.5.20 (2010-08-04)

Hello,

* Eve-Marie Devaliere wrote on Tue, Feb 01, 2011 at 09:39:14PM CET:
> > > Which kinds of flags do you need support for?
> lots... :(
> For example, in their original make.macros they had
> # Compiler settings for DEBUG builds
> LINUX_COMMON_FLAGS_GFORTRAN_DEBUG = -pg
> LINUX_FLAGS_GFORTRAN_DEBUG =
>                              "FC_FLAGS= -c \
>                                         -fbounds-check \
>                                         -fconvert=big-endian \
>                                         -ffpe-trap=overflow,zero \
>                                         -ffree-form \
>                                         -fno-second-underscore \
>                                         -frecord-marker=4 \
>                                         -ggdb \
>                                         -static \
>                                         -Wall \
>                                         ${INCLUDES} \
>                                       ${LINUX_COMMON_FLAGS_GFORTRAN_DEBUG}" \

Well, we've already clarified that you should drop -c.

For any gfortran-specific flag that there is no good macro for, you can
start off by wrapping it in this if clause:

if test $ac_cv_fc_compiler_gnu = yes; then
  FCFLAGS="$FCFLAGS -fbounds-check -fconvert=big-endian ..."
fi

Remarks to the flags you are using:

- Debugging: -ggdb is GCC specific; you can use -g fairly portably.

- Symbol underscoring: Autoconf's support for this currently only
  supports a kind of different strategy: allow the user (the person
  running configure) to set the desired underscoring strategy by passing
  FCFLAGS as configure argument; the linking from different languages
  can then be achieved as described in 'info Autoconf --index AC_FC_WRAPPERS'.

- Free-form is already handled by AC_FC_FREEFORM.  The necessary flag
  is added to the FCFLAGS variable if you call that macro in
  configure.ac.

> ok, yes I think I have seen explanations about that... from what I tried
> though, if I say
> AC_FC_FREEFORM()
> nothing happens as far as creating a 'free flag'... I thought it would
> find the appropriate one...?
> I need to say AC_FC_FREEFORM([],[FCFLAGS="$FCFLAGS -free"]) to add it
> but of course that will work for intel compiler but not for others....

No, it should be sufficient to just use AC_FC_FREEFORM.

> > > If you can formulate your needs in such a way, then the next hurdle is
> > > to overcome the M4 language and a few Autoconf building block macros
> > > like AC_COMPILE_IFELSE and AC_LINK_IFELSE.  We can help with the latter
> > > if the former is clear.
> Thanks. I tried to do a locate to see if I could figure out what is done
> for  AC_FC_FREEFORM but I couldn't find it.... would you have an example
> to suggest to put me on the way?

Please try this in an empty directory:

cat >configure.ac <<\END
AC_INIT
AC_PROG_FC
AC_FC_FREEFORM
echo "FCFLAGS is $FCFLAGS"
AC_OUTPUT
END

autoconf
./configure

The output should indicate that the flag has been added.  Please post
the output and config.log if that isn't the case.

Thanks,
Ralf



reply via email to

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