LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: Ralf Wildenhues (Ralf.Wildenhues_at_[hidden])
Date: 2005-01-19 13:42:21


* Jeff Squyres wrote on Wed, Jan 19, 2005 at 06:45:24PM CET:
> On Jan 19, 2005, at 12:04 PM, Ralf Wildenhues wrote:
>
> >I should note that the way of getting at flags by grepping Makefiles is
> >quite brittle and could be subject to all sorts of interesting
> >failures.
> >E.g., configure could output
> >LIBS = -la \
> > -lb
> >or make use of other variables or whatever. None of this is specified
> >by Automake. (One could replace `egrep | cut' with a little sed
> >hackery to prepare for the first issue.)
>
> Yeah, unfortunately, we're aware of this, but this hack was the only
> reasonable way that we could think of to extract the information that
> we needed without adding undue complexity and overhead for what, in
> this case, was a simple, single-line result.

How about: add

| print-libs:
| @echo 'X$(LIBS)' | sed 's,^X,,'

to the corresponding Makefile.am and replace the egrep|cut by
something along the lines of

| flags=`cd $path_to_Makefile && ${MAKE} print-libs 2>/dev/null`

(untested as well). At least that gets you by Make issues.
I have not checked further if you use any undocumented Libtool
features.

> However, it's not quite as icky as it looks.

Wouldn't be too sure..

> Remember that the values of LDFLAGS and LIBS are passed in via
> AC_SUBST. Automake does not re-indent these values to span lines
> (there's no good technical reason to, and a lot of technical complexity
> involved in doing it safely). So we ruled it "safe enough" to assume
> that LDFLAGS and LIBS would always be a single line in the resulting
> Makefiles.

.. about this in general. See for example
http://lists.gnu.org/archive/html/autoconf/2005-01/msg00053.html
for a related issue.

And, BTW, there is a technical reason against arbitrarily long lines:
there are tools that break. `make' for example (documented in
autoconf.info). Yes, all of this likely does not apply in your
specific case (but you've been warned).

> >Furthermore, there are a couple more such places where I'm not sure a
> >similar thing could happen. However, I don't know LAM well enough to
> >be able to decide.
>
> Can you pass those along to me?

I wondered merely about these lines:
  grep '\<cut\>' $top_srcdir/configure.in

Regards,
Ralf