autoconf
[Top][All Lists]
Advanced

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

Re: RFE: configure -> dependency list on exit.


From: Hugh Sasse Staff Elec Eng
Subject: Re: RFE: configure -> dependency list on exit.
Date: Thu, 24 Feb 2005 19:44:12 +0000 (WET)

On Thu, 24 Feb 2005, Dan Manthey wrote:

I have a modest proprosal that may capture the desired features, and
        [...]
We've been discussing in another thread on this list that Autoconf tests
are usually preformed unconditionally because of issues with calling
prerequisite macros conditionally and the inability of m4 to understand sh
if-else blocks.  If we presume for the moment that problem is solved
(which I think is a fair assumption given the discussion of the other
thread), then we could have in configure.ac something like the following:

AC_PROG_LEX
if test $LEX = :; then
 # No lex was found, so we can't use yacc.
 AC_MSG_END([A lexer is needed for yacc.]
AS_PACKAGE_SUGGEST([flex 2.5.x],[http://gnu.org/whereever_flex_is.html])
AS_PACKAGE_SUGGEST([lex]))

        [OT] I don't understand this extra ')' but ...
else
 AC_PROG_YACC
 ...
fi

I like this, it is clear.  Could the shell logic be produced by a
Macro, though, to help people get it right?

Beyond the handling of conditional macros, this only requires AC_MSG_END
(which I assume would be a trivial matter outputting messages to a temp

That would be a good solution.

file which is later output), and possibly AS_PACKAGE_SUGGEST, a fascility
quite orthogonal to the logic that determines which tests are run.  It
would have the job of appropriately describing a recommended place to get
a package.  This could (possibly) do anything from simple string
formatting to some sort of database lookup.

Yes, that would be a good addition, though I think it will meet
resistance because of the documentation overhead.  Anwyway, having
it as a standard macro allows future flexibility, such as the Free
Software Directory adopting GNOWSYS or enquiring of some future vast
artificial intelligence :-).

The only problem this doesn't solve is that of generating a DEPENDENCIES
files.  If this is the critical need, then how about:  (This is clearly
not a final proposal since this is terribly ugly.)

AC_DEPENDS([A lexer is needed for yacc.]
AS_PACKAGE_SUGGEST([flex 2.5.x],[http://gnu.org/whereever_flex_is.html])
AS_PACKAGE_SUGGEST([lex]),
          [AC_PROG_LEX],
          [test $LEX != :],
[AC_PROG_YACC
...
])

At this point the Autoconf macro accounting mechanism can note that
AC_PROG_LEX was called to prepare to test whether to run AC_PROG_YACC.
Personally, I don't think the added complexity of this second choice is
warranted by its small benefit of generating a rather brittle description
that's already captured in the prose output by AC_MSG_END.

I don't think we need to generate a DEPENDENCIES file, although it
would be nice to generate supporting documentation automatically.
I think that provided the AS_MSG_END macro produces a clear message
with dependency information when configure is run, and does so at
the end as you say, this would be a very significant improvement.

I'm not convinced that the dependencies are complex enough to need
anything more than sane use of if-else, but in the few cases where it is,
that can be expressed with the form of AC_REQUIRE that takes code to
execute as well as an identifier to have provided:

AC_DEFUN([AC_PROG_YACC_THAT_NEEDS_LEX],
[AC_REQUIRE([_YACC_CHECK_LEX],
[AC_PROG_LEX
if test $LEX = :; then
AC_MSG_END([Yacc needs lex])
fi])
if test $LEX != :; then
 AC_PROG_YACC
fi])


If the case for a failure is always a : (nicely a NO-OP in ksh at
least, and, it seems, bash) then there is scope for something like

#define  AC_IF_FAILED(LEX) if test $LEX != :; then
#define  AC_ELSE_FAILED(LEX) else
#define  AC_END_FAILED(LEX) fi

to clarify what the 'else' and 'fi' refer to, and automate the
construction of the test clause.  [I always seem to munge test
commands!]

(Okay, that's a poor example, but I hope it shows that the needed tools
already exist.)

Thank you.  I think you have cut through a lot of the confusion that
was springing up.  I like it when people manage to simplify things
so neatly.

-Dan

        Thank you,
        Hugh




reply via email to

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