[Top][All Lists]

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

question about using AC_SEARCH_LIBS with fortran...

From: Ed Hartnett
Subject: question about using AC_SEARCH_LIBS with fortran...
Date: Tue, 01 Dec 2009 17:26:02 -0700
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux)

Howdy all!

I am a programmer on a free software scientific data package called
libcf, to be used by climate scientists to make their data more

I am trying to use the AC_SEARCH_LIBS macro to find a fortran library.

I have read this tread in the mailing list, in which it is stated that
the user must set FCFLAGS and LDFLAGS to point to the fortran
directories that contain the mod and library files.

But what if it is installed in a standard location, like /usr/local?
When I test for C libraries, I don't have to put a -I/usr/local/include
in CPPFLAGS, it just finds it there. 

Why can't fortran do the same thing?

Or am I missing something here?

Also, I agree with the poster on that thread who contends that fortran
will not correctly compile the test program conftest.f with the use
LIBRARY statement.

I am trying to get my library (libcf) to find another fortran library
that should be already installed: the netCDF library. I am trying this:

   AC_SEARCH_LIBS([nf90_open], [netcdf])

Which generates the following test program:
configure:5217: gfortran -o conftest -g -O2   conftest.f90  >&5
/tmp/ccaZquLl.o: In function `main':
/home/ed/snapshot/lb_new2/conftest.f90:2: undefined reference to
collect2: ld returned 1 exit status
configure:5217: $? = 1
configure: failed program was:
|       program main
|       call nf90_open
|       end

In fact, the smallest test program I can get gfortran to compile is:

program main
  use netcdf
  res = nf90_open('lll', 0, ncid)
end program main

Does anyone use the AC_SEARCH_LIBS macro with fortran?



Ed Hartnett  -- address@hidden

reply via email to

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