autoconf
[Top][All Lists]
Advanced

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

Re: produce *mod with fortran


From: Christopher Hulbert
Subject: Re: produce *mod with fortran
Date: Tue, 18 Jan 2011 11:08:00 -0500

On Tue, Jan 18, 2011 at 9:48 AM, Eve-Marie Devaliere
<address@hidden> wrote:
> Good morning,
> Thanks all for your posts....
> I haven't written the package and I am just trying to use autoconf to
> make the install easier...Just to say that I am trying to make sense of
> the package too... :) They are using modules so for each f90 file I need
> a .o and .mod.... the -c -02... flags are the one they were using in
> their initial setup....
> If I get rid of the -c, yes your are right configure runs fine but then
> make crashes on the first program because it is not finding a main... I
> think they mentioned they just want to link the programs.... but it
> still sounds to me like we need a main too (oh yes I am a fortran newbie
> too... ;-} )
>  I think what the problem is is that:
> 1. configure doesn't want -c because it wants to test if it can make an
> executable
> 2. the package needs the -c to be setup properly but once the -c is not
> given in configure, we cannot use it there....
>

Here's a pretty minimal example that:
1. makes a libtool convenience library of the module sources
2. links a program using those modules (in the convenience library)

So, if you don't have a main and want just a library of the object
files, change noinst_LTLIBRARIES to lib_LTLIBRARIES. Also, if you do
that, you probaly want to add the module output names (i.e. mod1.mod,
etc.) to something like include_HEADERS so they get installed. I think
at least a lot of fortran compilers look for .mod files with an
include flag (i.e. -I).

address@hidden f90mod]$ libtoolize
libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
address@hidden f90mod]$ aclocal -I m4
address@hidden f90mod]$ autoconf
address@hidden f90mod]$ automake
address@hidden f90mod]$ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... none
checking for gfortran... gfortran
checking whether we are using the GNU Fortran compiler... yes
checking whether gfortran accepts -g... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 98304
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for ar... ar
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports
shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for gfortran option to produce PIC... -fPIC
checking if gfortran PIC flag -fPIC works... yes
checking if gfortran static flag -static works... yes
checking if gfortran supports -c -o file.o... yes
checking if gfortran supports -c -o file.o... (cached) yes
checking whether the gfortran linker (/usr/bin/ld -m elf_x86_64)
supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
configure: creating ./config.status
config.status: creating Makefile
config.status: executing depfiles commands
config.status: executing libtool commands
address@hidden f90mod]$ make
/bin/sh ./libtool --tag=FC   --mode=compile gfortran  -g -O2 -c -o
mod1.lo mod1.f90
libtool: compile:  gfortran -g -O2 -c mod1.f90  -fPIC -o .libs/mod1.o
libtool: compile:  gfortran -g -O2 -c mod1.f90 -o mod1.o >/dev/null 2>&1
/bin/sh ./libtool --tag=FC   --mode=compile gfortran  -g -O2 -c -o
mod2.lo mod2.f90
libtool: compile:  gfortran -g -O2 -c mod2.f90  -fPIC -o .libs/mod2.o
libtool: compile:  gfortran -g -O2 -c mod2.f90 -o mod2.o >/dev/null 2>&1
/bin/sh ./libtool --tag=FC   --mode=link gfortran  -g -O2   -o liba.la
 mod1.lo mod2.lo
libtool: link: ar cru .libs/liba.a .libs/mod1.o .libs/mod2.o
libtool: link: ranlib .libs/liba.a
libtool: link: ( cd ".libs" && rm -f "liba.la" && ln -s "../liba.la" "liba.la" )
gfortran  -g -O2 -c -o prog.o prog.f90
/bin/sh ./libtool --tag=FC   --mode=link gfortran  -g -O2   -o prog
prog.o liba.la
libtool: link: gfortran -g -O2 -o prog prog.o   ./.libs/liba.a
address@hidden f90mod]$ ./prog
   5.09901951359278

Chris

>
> Thanks again so much for your support! You are the men! :)
> Cheers,
> Eve-Marie
>

Attachment: f90mod.tar.gz
Description: GNU Zip compressed data


reply via email to

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