[Top][All Lists]

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

Using AC_SEARCH_LIBS with Fortran95/2003 library

From: Paul van Delst
Subject: Using AC_SEARCH_LIBS with Fortran95/2003 library
Date: Tue, 05 Mar 2013 15:57:17 -0500
User-agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.12) Gecko/20130108 Thunderbird/10.0.12


Like the subject line says I'm trying to use the AC_SEARCH_LIBS macro with a library written in Fortran95/2003. I'll start with the question I end up asking at the end of this email:

Is there a way to specify a "custom" conftest.f90 for the AC_SEARCH_LIBS macro like I can do with the AC_LINK_IFELSE macro?

The details:

My contains

# Set the programming language

# Check for libraries
               [AC_MSG_FAILURE([Unable to find CRTM library],[1])])

This fails and checking the config.log I see why:

configure:1933: checking for library containing CRTM_Version
configure:1946: gfortran -o conftest -I/CRTM/trunk/src/Build/include -fno-second-underscore -fconvert=big-endian -ffree-form -L/CRTM/trunk/src/Build/lib conftest.f90 -lCRTM >&5
/tmp/ccs2Fl97.o: In function `MAIN__':
conftest.f90:(.text+0x27): undefined reference to `crtm_version_'
collect2: ld returned 1 exit status
configure:1952: $? = 1
configure: failed program was:
|       program main
|       call CRTM_Version
|       end

The test program is simply wrong (for Fortran90/95/2003/etc).

I scoured this mailing list and found the following discussions from waaay back in 2008 and 2009:

The upshot from the knowledgable replies is that I shouldn't worry about the "runability" of the test program, just the "linkability" since the AC_SEARCH_LIBS is a generic test.

Well, the problem is that it seems the test program has to compile to an executable state to not cause the linkerto return a failure status. This means that the argument list of the function is question also has to be specified - genericity (a word?) thus goes out the window.

The minimum code that will compile for my selected function is:

program main
  use CRTM_Module
  character(1) :: id
  call CRTM_Version(id)

If I do the following in

[AC_LANG_SOURCE([program main; use CRTM_Module; character(1)::id; call CRTM_Version(id); end])],
  [AC_MSG_FAILURE([Unable to link to CRTM library],[1])])

everything works. But, using this macro means @LIBS@ is not updated (and I don't get the "checking for library containing CRTM_Version" info output, but that's no biggie).

So, I'm at the asking point again: Is there a way to specify a "custom" conftest.f90 for use "in" the AC_SEARCH_LIBS macro?

I tried using AC_LANG_CONFTEST to generate my custom conftest.f90, but it wasn't used for the AC_SEARCH_LIBS case.

Thanks for any insight/help/suggestions/etc.



reply via email to

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