libtool
[Top][All Lists]
Advanced

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

Combining two Fortran libraries?


From: Pekko Metsä
Subject: Combining two Fortran libraries?
Date: Sat, 04 Jul 2009 06:49:53 +0300
User-agent: Internet Messaging Program (IMP) H3 (4.2)

Hi,

I'm trying to use GNU autotools (automake-1.10.1, autoconf-2.61 and
libtool-2.2.4) for linking Fortran libraries. First I compile two
libraries in separate directories, lib1/libx.la and lib2/liby.la.
There libtool is doing what I want, ie.

make[1]: Entering directory `/home/username/src/f95/libtoytest/lib1'
/bin/bash ../libtool   --mode=compile gfortran  -g -O2 -c -o xmod.lo xmod.f95
libtool: compile:  gfortran -g -O2 -c xmod.f95 -o xmod.o
/bin/bash ../libtool --mode=link gfortran -g -O2 -o libx.la -rpath /home/us
ername/tmp/toytest/lib xmod.lo

and similarly for the second library lib2/liby.la.

But, when I try to combine libx.la and liby.la together to libxy.la,
libtool is not using gfortran for linking (but gcc):

make[1]: Entering directory `/home/username/src/f95/libtoytest'
/bin/bash ./libtool --tag=CC --mode=link gcc -g -O2 -o libxy.la -rpath /hom
e/username/tmp/toytest/lib  lib1/libx.la lib2/liby.la
libtool: link: gcc -shared -Wl,-rpath -Wl,/home/ppiirola/src/f95/libtoytest/li b1/.libs -Wl,-rpath -Wl,/home/ppiirola/src/f95/libtoytest/lib2/.libs -Wl,-rpath -Wl,/home/ppiirola/tmp/toytest/lib lib1/.libs/libx.so lib2/.libs/liby.so -Wl,-soname -Wl,libxy.so.0 -o .libs/libxy.so.0.0.0


What should I have in configure.ac and Makefile.am to force
libtool to use gfortran for linking?  Currently the files are:

# cat configure.ac
AC_INIT([toytest],[0.01],address@hidden)
AM_INIT_AUTOMAKE([-Wall -Werror])
AC_PREREQ([2.59])
LT_PREREQ([2.2.4])
AC_CONFIG_MACRO_DIR([m4])
AC_PROG_INSTALL
AC_PROG_FC([gfortran])
AC_COPYRIGHT([(c) <address@hidden>])
AC_CONFIG_FILES([
        Makefile
        lib1/Makefile
        lib2/Makefile])
LT_INIT
LT_LANG([Fortran])
AC_OUTPUT

and
# cat Makefile.am
ACLOCAL_AMFLAGS= -I m4
SUBDIRS = lib1 lib2
lib_LTLIBRARIES = libxy.la
libxy_la_SOURCES =
libxy_la_LIBADD = lib1/libx.la lib2/liby.la


Thanks for the help!
Pekko





reply via email to

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