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 20:27:40 -0500 (EST)
User-agent: SquirrelMail/1.4.5

Hi Keith,


> On Saturday 15 March 2008 19:22, Tim Dennis wrote:
>> the macro call:
>> AC_SEARCH_LIBS(h5open_f,[hdf5_fortran],[],[],[ -L$prefix/lib
>> -I$prefix/lib])
>
> This doesn't look right; that final argument isn't for specifying what
> LDFLAGS should be, it is to specify *other* libraries which are needed
> to satisfy the link test, in addition to the one you are checking.  You
> should simply write the test as:
>
>   AC_SEARCH_LIBS([h5open_f],[hdf5_fortran])

Yep you're right about this, and I probably should have explained this. I
already knew that I was
"cheating" by doing this. But if I dp what you sugggest then I just get
another kind of error about the linker not being able to find the library
in the first place. I just put it in there because I knew it needed to be
in the command and at the moment that's the only way I've been able to
make that happen (for more on this continue reading).

> then specify the proper LDFLAGS, and maybe also FFLAGS, (or whatever the
> appropriate variable for specifying compiler flags to be passed to your
> FORTRAN compiler is called), when you run configure:
>
>   path/to/configure FFLAGS='...' LDFLAGS='-L/path/to/my/libs' ...
>
This would be fine, if I could get autoconf to give me a configure script
that knows how to properly test for the  presence of the library.
AC_SEARCH_LIBS doesn't know that the -L flag needs to be there. The same
holds for the -I. My real reason for putting them there is just so I can
see the various ways that the test created by AC_SEARCH_LIBS fails
depending on what I put in that slot.  And while it's true that the -L
flag doesn't belong in that argument, it does make it  into the command in
a well-formed way when I put it there.

> (My apologies for inadvertently omitting the `-L' from the example I
> posted earlier).
>
> Note that the `-I' specification doesn't belong in LDFLAGS; if you need
> it, it should go in CPPFLAGS, (for C/C++), and I guess the equivalent
> would be FFLAGS for FORTRAN.  (These are all flags which should be left
> for the user to specify, when running configure).

Right again, and I do have CPPFLAGS specified in my source Makefile.am.
The point is that it needs to be in the command that the test configure
runs to find the library. If it's not there the test  fails. And the point
of the test is to tell autoconf what values to put into LDFLAGS which is
what I'm really trying to accomplish.  I know all this to be true because
I've tried all variations on the command and they all make g95 complain
except one. Namely,

g95 -g -o conftest -O2 -L/Users/tjd/local/lib -lhdf5_fortran -lhdf5 -lz
-I/Users/tjd/local

really this is the only one that works and then only if the test program
has the use statement and an integer argument for the function.

Ralf has put me on to some macros in the archive that might help. I'm
going to dig into them and see if I can figure this out. i'll report back
when I know more. In the meantime thanks for the help.

regards,

Tim

> Regards,
> Keith.
>
>


-- 
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]