is set correctly within the exit trap.
(AS_TMPDIR): Use it.
* acgeneral.m4 (AC_MSG_ERROR): Likewise,
+2000-10-30 Pavel Roskin <proski@gnu.org>
+
+ * m4sh.m4 (AS_EXIT): New macro that exits and makes sure that $?
+ is set correctly within the exit trap.
+ (AS_TMPDIR): Use it.
+ * acgeneral.m4 (AC_MSG_ERROR): Likewise,
+
2000-10-29 Pavel Roskin <proski@gnu.org>
* acgeneral.m4 (AC_CHECK_TOOL): Set VARIABLE also when using the
define([AC_MSG_ERROR],
[{ _AC_ECHO([configure:__oline__: error: $1], AC_FD_LOG)
_AC_ECHO([configure: error: $1], 2)
- exit m4_default([$2], 1); }])
+ AS_EXIT([m4_default([$2], 1)]); }])
# AU::AC_CHECKING(FEATURE)
define([AC_MSG_ERROR],
[{ _AC_ECHO([configure:__oline__: error: $1], AC_FD_LOG)
_AC_ECHO([configure: error: $1], 2)
- exit m4_default([$2], 1); }])
+ AS_EXIT([m4_default([$2], 1)]); }])
# AU::AC_CHECKING(FEATURE)
[$ac_unset $1 || test "${$1+set}" != set || { $1=$2; export $1; }])
+# AS_EXIT([EXIT-CODE = 1])
+# ------------------------
+# Exit and set exit code to EXIT-CODE in the way that it's seen
+# within "trap 0".
+#
+# We cannot simply use "exit N" because some shells (zsh and Solaris sh)
+# will not set $? to N while running the code set by "trap 0"
+# So we set $? by executing "exit N" in the subshell and then exit.
+define([AS_EXIT],
+[{ (exit m4_default([$1], 1)); exit; }])
+
+
## ------------------------------------------- ##
$debug ||
{
trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
- trap 'exit $?' 1 2 13 15
+ trap 'AS_EXIT([$?])' 1 2 13 15
}
# Create a (secure) tmp directory for tmp files.
} ||
{
echo "$me: cannot create a temporary directory in $TMPDIR" >&2
- exit 1;
+ AS_EXIT
}dnl
])# AS_TMPDIR
[$ac_unset $1 || test "${$1+set}" != set || { $1=$2; export $1; }])
+# AS_EXIT([EXIT-CODE = 1])
+# ------------------------
+# Exit and set exit code to EXIT-CODE in the way that it's seen
+# within "trap 0".
+#
+# We cannot simply use "exit N" because some shells (zsh and Solaris sh)
+# will not set $? to N while running the code set by "trap 0"
+# So we set $? by executing "exit N" in the subshell and then exit.
+define([AS_EXIT],
+[{ (exit m4_default([$1], 1)); exit; }])
+
+
## ------------------------------------------- ##
$debug ||
{
trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
- trap 'exit $?' 1 2 13 15
+ trap 'AS_EXIT([$?])' 1 2 13 15
}
# Create a (secure) tmp directory for tmp files.
} ||
{
echo "$me: cannot create a temporary directory in $TMPDIR" >&2
- exit 1;
+ AS_EXIT
}dnl
])# AS_TMPDIR