[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
AS_IF: empty run-if-false causes invalid code.
From: |
Van de Bugger |
Subject: |
AS_IF: empty run-if-false causes invalid code. |
Date: |
Wed, 13 Jan 2016 01:34:50 +0300 |
Hi,
I am using Autoconf 2.69 on Fedora Linux. Let us consider an trivial
example:
$ cat configure.ac
AC_INIT([foo],[0.001])
AS_IF([true],[
# Comment
])
$ autoreconf -i .
$ ./configure
$ cat ./configure | tail -n 10
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS
conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
if true; then :
# Comment
fi
Everything is ok. If the second argument of AS_IF does not include any
executable commands, it is perfectly acceptable and generates valid
code because AS_IF uses : command immediatelly after "then" keyword.
Let us add the third argument to AS_IF:
$ cat configure.ac
AC_INIT([foo],[0.001])
AS_IF([true],[
# Comment
],[
# Another comment
])
$ autoreconf -i .
$ ./configure
./configure: line 1670: syntax error near unexpected token `fi'
./configure: line 1670: `fi'
$ cat ./configure | tail -n 10
if true; then :
# Comment
else
# Another comment
fi
You see, generated code is not correct: there is no command in "else"
part, bash does not like it.
It is not a big problem, but it is quite confusing for newbie user. And
it seems it can be easily avoided by generating ":" command in the
"else" part, like AS_IF does it in "then" part of conditional
statement.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- AS_IF: empty run-if-false causes invalid code.,
Van de Bugger <=