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: Dan Manthey
Subject: Re: RFE: configure -> dependency list on exit.
Date: Thu, 24 Feb 2005 14:01:06 -0500

I have a modest proprosal that may capture the desired features, and
requires only quite minimal help from Autoconf (other than completion of
another proposal that stands quite well on its own merits).

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]))
else
  AC_PROG_YACC
  ...
fi

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
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.

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'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])

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

-Dan





reply via email to

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