[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
set -e causes AS_IF to exit in else clause
From: |
Peter Johansson |
Subject: |
set -e causes AS_IF to exit in else clause |
Date: |
Fri, 1 Apr 2022 11:25:44 +1000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 |
Hi,
This is with autoconf 2.71.
I use autom4te to create a script and discovered that the script exits
when the else clause in AS_IF is reached. It seems it's caused by the
combination that function as_fn_nop() is called in the else clause and
that I have 'set -e' earlier in the script.
I suppose my workaround will be that I remove the 'set -e', but the
behaviour is quite unexpected. I've boiled down the script to a minimal
test case that illustrates the behaviour
cat > foo.m4sh <<EOF
AS_INIT
AS_ME_PREPARE
set -e
if test x"$1" = x"apple"; then
echo apple;
else
echo not apple;
fi
AS_IF([test x"$1" = x"orange"],
[AS_ECHO([orange])],
[AS_ECHO([not orange])])
EOF
autom4te -l M4sh -o foo.sh foo.m4sh
sh -x foo.sh hello world
...
+ set -e
+ test x = xapple
+ echo not apple
not apple
+ test x = xorange
+ as_fn_nop
+ return 1
i.e., it exits before printing anything about the orange
Thanks,
Peter
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- set -e causes AS_IF to exit in else clause,
Peter Johansson <=