]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
configure: testsuite shell set exit traps in shell functions
authorStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 25 Jul 2012 17:51:27 +0000 (19:51 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 26 Jul 2012 12:11:35 +0000 (14:11 +0200)
* configure.ac: Check that the shell selected to run the test
scripts can set an exit trap in a shell function, without having
that trap executed at the termination of the function rather
than of the scripts.  According to the Autoconf manual, at least
AUX 5.3 /bin/sh suffers of such a bug.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
configure.ac

index a8db0614ea8d5ed6e450e58b5ba282f09445a7d3..45143c0d84e61b22b6c74e517a6947b7f8612fe7 100644 (file)
@@ -318,6 +318,11 @@ AC_DEFUN([_AM_CHECK_CANDIDATE_SHELL],
       [set -e; trap 'exit $?' 0; (exit 77); exit 77],
       [], [am_score=1; break])
 
+    _AM_CHECK_SHELL_FEATURE([$1],
+      [can define exit traps in a shell function],
+      [fail=0 && foo() { trap 'fail=1' 0; } && foo && test $fail = 0],
+      [], [am_score=1; break])
+
     _AM_CHECK_SHELL_FEATURE([$1],
       [corrupts stderr with "set -x"],
       [(set -x; P=1 true 2>&3) 3>&1 2>/dev/null | grep P=1],