autoconf
[Top][All Lists]
Advanced

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

Re: how to tell autoconf/automake where fortran .mod file lives


From: Tim Dennis
Subject: Re: how to tell autoconf/automake where fortran .mod file lives
Date: Sat, 15 Mar 2008 14:22:42 -0500 (EST)
User-agent: SquirrelMail/1.4.5

Hi Ralf,

> * Tim Dennis wrote on Sat, Mar 15, 2008 at 07:17:46PM CET:
>>
>> Thanks Ralf. This may be just what the doctor ordered. Keith has also
>> sent some helpful info, but I'm still running into trouble.
>
> Well to be honest, I don't think autotools have seen much use in Fortran
> 90+ code, and module handling is probably still going to be a bit rough.
> We may be able to help more easily if you provide examples for the stuff
> that doesn't work.
>
> At one point I planned to add module dependency tracking and more
> generally, decent module handling, into Automake.  Alas, I never
> found the time to do this; but if somebody else has the motivation
> and some knowledge about Fortran compilers to do this, that'd be great.
>
> I guess if those macros from the archive prove generally useful,
> some of them could be pulled into Autoconf proper, too.

I've downloaded the archive and will take a look, but since you suggested
examples I thought I'd give you a synopsis of the situation if your
interested. In the meantime I'll look over the archive and report back. If
necessary I'll write my own macro and contribute it.

My test program is:
       program test
       call h5open_f
       end program test
Which functionally identical to the test program automatically generated
by autoconf (see below)

the macro call:
AC_SEARCH_LIBS(h5open_f,[hdf5_fortran],[],[],[ -L$prefix/lib -I$prefix/lib])
causes configure to attempt:
g95 -o conftest -g -O2   conftest.f -lhdf5_fortran  -L/Users/tjd/local/lib
-I/Users/tjd/local/lib
which results in the error:
ld: Undefined symbols:
_h5open_f__

the macro call:
AC_SEARCH_LIBS(h5open_f,[hdf5_fortran],[],[],[-c -L$prefix/lib
-I$prefix/lib])
causes configure to attempt:
g95 -o conftest -g -O2   conftest.f -lhdf5_fortran -c
-L/Users/tjd/local/lib -I/Users/tjd/local/lib
which results in the error:
g95: -lhdf5_fortran: linker input file unused because linking not done

----------------------------------------------------------------------------------------------------

In all case the test program automatically generated and tested is:

       program main
       call h5open_f
       end

Which if compiled by hand using:
g95 -c -o conftest -g -O2 conftest.f
works just fine, except that there is no test for the desired library.

If compiled by hand using:
g95 -c -o conftest -g -O2 conftest.f -lhdf5_fortran -L/Users/tjd/local/lib
-I/Users/tjd/local/lib
g95: -lhdf5_fortran: linker input file unused because linking not done
Which leaves the matter unresolved as far as autoconf is concerned (see
below).

If compiled and linked by hand using
g95 -o conftest -g -O2 conftest.f -lhdf5_fortran -L/Users/tjd/local/lib
-I/Users/tjd/local/lib
ld: Undefined symbols:
_h5open_f__
which can be "fixed" by adding the line
use hdf5
below the "program main" statement except that now the compiler complains:
call h5open_f
     1
Error: Missing actual argument for argument 'error' at (1)
which can be fixed by adding more stuff as follows....
program main
use hdf5
integer :: i
call h5open_f(i)
end
but this also requires modifying the compiler command:
g95 -o conftest -g -O2 conftest.f -lhdf5_fortran -lhdf5 -lz
-L/Users/tjd/local/lib -I/Users/tjd/local/lib

The sticking point as I see it is that there is no mechanism in standard
autoconf for adding the needed lines
in the source of the test. What is particularly puzzling about this is
that AC_SEARCH_LIB isn't supposed to
link, only compile as I understand it -- at least that's what I gathered
from Keith's response to my other post.
But when I use AC_SEARCH_LIBS there is no -c flag, and in any case how can
it know that the library is
linkable unless it tries to link.



>
>
> _______________________________________________
> Autoconf mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/autoconf
>
>


-- 
Timothy J. Dennis                                email:
address@hidden
Research Associate                              office: 477 Bausch & Lomb
Hall
Department of Physics & Astronomy    Voice: 585-275-8556
University of Rochester                           Fax: 585-273-2813
Rochester, NY 14627





reply via email to

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