autoconf
[Top][All Lists]
Advanced

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

Re: How to create tests for FC?


From: Steven G. Johnson
Subject: Re: How to create tests for FC?
Date: Mon, 06 Jun 2005 16:27:05 -0400
User-agent: Mozilla Thunderbird 1.0 (Macintosh/20041206)

Ralf Wildenhues wrote:
1) Within libtool.m4, a few tests need to be run to find out compiler/
linker characteristics.  These may give false failures if the user has
set AC_FC_SRCEXT(...) of AC_FC_FREEFORM differently than expected.
First: can I find out (without perusing Autoconf internal interface) if
they have been called, second may I override them and undo the effects
afterwards (how?) without harm, and third which would be the best choice
of extension for the test files if not?

Can you give an example of where you need to undo them and/or where this causes a problem?

For example, you can usually format a simple test program so that it will succeed in both a freeform and a non-freeform compiler (indeed, the autoconf macros currently assume this for compiling their tests). Your tests should also normally use AC_COMPILE_IFELSE which uses the current extension and flags (if any).

That being said, the manual should possibly document a couple of internals to enable more flexibility in the use of these two macros. First, after you call AC_FC_FREEFORM, the $ac_cv_fc_freeform cache variable is set to either the flag (if any), or "none" (if none needed), or "unknown" (if the test failed). Second, the current source filename extension is stored in $ac_ext and any flags required for $FC are in $ac_fcflags_srcext. Given this documentation, we should also arguably not modify FCFLAGS in AC_FC_FREEFORM if the user provides an alternate SUCCESS action.

2) For an eventual test suite addition, should I use `.f90' (so Automake
plays halfway well) and AC_FC_SRCEXT([.f90]), or stick fo `.f'?

It depends on what your test suite needs to do? You should either use .f or use .f90 with AC_FC_SRCEXT(f90).

FYI, some notes gathered (no guarantee on correctness):
- Intel ifc/ifort dislikes extension `.f95'.
- AIX xlf90/xlf95 dislikes extension that does not fit name.

Yup, this is already noted in the AC_FC_SRCEXT code. In fact, those two compilers (grrr) were the reason for this macro.

- Some compilers decide freeform/language level based on extension,
  some on which name they are called by.

Usually, .f90 and .f95 files are compiled as freeform... Hopefully, though, AC_FC_FREEFORM always works if the user needs to guarantee that freeform source is accepted?

- Automake chooses $(F77) for `.f'.  Workaround?

A workaround is to set F77=$FC and FFLAGS=$FCFLAGS

- Automake needs to use $(FCFLAGS_$EXT) as mentioned in [1].  Wait for
  solving this or add to $(FCFLAGS) as workaround?

Adding it to FCFLAGS will almost certainly cause other failures (because e.g. FCFLAGS are used for linking as well as for compiling).

I think you have to accept some failures in the short term until automake is fixed, unfortunately. (It might be helpful if the automake folks received an additional bug report or two in case I was not persuasive enough.)

Cordially,
Steven G. Johnson





reply via email to

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