autoconf
[Top][All Lists]
Advanced

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

Re: Checking for built files


From: Brooks Moses
Subject: Re: Checking for built files
Date: Mon, 29 Oct 2007 19:41:31 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.8.1.6) Gecko/20070728 Thunderbird/2.0.0.6 Mnenhy/0.7.5.666

Andrej Prsa wrote:
a program I am working on consists of fortran sources that are compiled
with f2c into their C counterparts, linked into a shared library and
then used in the remainder of the program. To facilitate compiling, I
thought of distributing f2c'd C sources in the tarball so that the
users don't need to have f2c installed to compile the code. However, if
someone did `make distclean`, all built C sources would be deleted and
f2c then must be present on a system. What would be a good way to check
for the existence of built sources and to check for f2c in case these
sources are missing?

For what it's worth, I think one notable failure there is that "make distclean" should not delete the built C sources, if you expect them to be part of the distribution!

What we do for similar things (and this is also done in GCC, for example) is to define an --enable-maintainer-mode option. When maintainer-mode is disabled, which in the default case, configure will generate a makefile that assumes that things like your generated C files are already present in the source tree, and it does not try to rebuild them. When maintainer mode is enabled, the system will assume that you want these sources included in the makefile, and thus they'll get rebuilt if they're not present or are older than the corresponding Fortran files.

Note that this means that, when maintainer-mode is enabled, the makefile must generate the C sources in the _source_ tree, not the _build_ tree, in order for things to work correctly. But you have to deal with that problem anyway, if they might or might be part of the distribution....

(In any case, if you just want to do things exactly as you described, a simple AC_CHECK_PROGS(F2C, f2c) and then an "if test ! -f $(filename)" block surrounding some code that throws an error if the F2C variable is empty will do what you want.)

- Brooks





reply via email to

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