On 2/21/17, Reuben Thomas <[hidden email]> wrote:
> In the first example for AC_ARG_WITH, there's an "if test…fi" block:
> if test "x$with_readline" != xcheck; then
> [--with-readline was given, but test for readline failed])
> Is there some reason why this doesn't use AS_IF?
Probably the author simply preferred regular shell if statements.
There's nothing wrong with a plain 'if' here, so the author used it.
The main practical difference between AS_IF and regular 'if' relates to
the AC_REQUIRE machinery. Since Autoconf "understands" the AS_IF macro,
it can hoist AC_REQUIREd or AC_DEFUN_ONCE macros expanded inside the
if body outside of the condition (this is normally the desired result).
I would not expect AC_MSG_FAILURE to use such expansions so regular 'if'
is fine. Moreover, this particular 'if' is found inside the body of
AS_IF so the hoisting should work anyway.
> I see a comment above saying:
> @c FIXME: Remove AS_IF when the problem of AC_REQUIRE within `if' is
> but it's not clear whether that's relevant (the commit log that introduced
> the comment doesn't seem to explain it).
Just speculating, but the original author in 2005 probably did not like
AS_IF stylistically and was hoping that, someday, AC_REQUIRE would work
with regular shell 'if' statements. Then the examples could be reworked
to not use AS_IF.
I expect such magic will probably never happen so AS_IF is here to stay.