]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Fix AS_ERROR for FreeBSD sh.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Tue, 2 Mar 2010 19:19:32 +0000 (20:19 +0100)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Tue, 2 Mar 2010 19:19:32 +0000 (20:19 +0100)
* lib/m4sugar/m4sh.m4 (_AS_ERROR_PREPARE): Rewrite as_fn_error
to take additional first argument STATUS instead of transporting
$? across shell function entry, which does not work with FreeBSD
sh.  Shift all other arguments by one, adjust.
(AS_ERROR): Pass EXIT-STATUS, defaulting to $?, to as_fn_error.
Report by Václav Haisman.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
ChangeLog
lib/m4sugar/m4sh.m4

index 9e86d5f3686c30af5624e46468e1b2bb618fa34b..46022de1b6bbee442e7d67b5860a3ee351fa9a7e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2010-03-02  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
+       Fix AS_ERROR for FreeBSD sh.
+       * lib/m4sugar/m4sh.m4 (_AS_ERROR_PREPARE): Rewrite as_fn_error
+       to take additional first argument STATUS instead of transporting
+       $? across shell function entry, which does not work with FreeBSD
+       sh.  Shift all other arguments by one, adjust.
+       (AS_ERROR): Pass EXIT-STATUS, defaulting to $?, to as_fn_error.
+       Report by Václav Haisman.
+
        Fix `autom4te cache creation' testsuite failure on FreeBSD.
        * tests/tools.at (autom4te cache creation): Normalize exit
        status of failed redirection to 1, may be 2 with FreeBSD sh.
index 8160b3d6edaf6274cbb2d7198af1ff29cda4b628..bfa6b4409f8277c479917a26768ca01ad4cc62e7 100644 (file)
@@ -816,22 +816,22 @@ m4_define([AS_WARN],
 # otherwise, assume the entire script does not do logging.
 m4_define([_AS_ERROR_PREPARE],
 [AS_REQUIRE_SHELL_FN([as_fn_error],
-  [AS_FUNCTION_DESCRIBE([as_fn_error], [ERROR]m4_ifval(AS_MESSAGE_LOG_FD,
+  [AS_FUNCTION_DESCRIBE([as_fn_error], [STATUS ERROR]m4_ifval(AS_MESSAGE_LOG_FD,
       [[ [[LINENO LOG_FD]]]]),
     [Output "`basename @S|@0`: error: ERROR" to stderr.]
 m4_ifval(AS_MESSAGE_LOG_FD,
     [[If LINENO and LOG_FD are provided, also output the error to LOG_FD,
       referencing LINENO.]])
-    [Then exit the script with status $?, using 1 if that was 0.])],
-[  as_status=$?; test $as_status -eq 0 && as_status=1
+    [Then exit the script with STATUS, using 1 if that was 0.])],
+[  as_status=$[1]; test $as_status -eq 0 && as_status=1
 m4_ifval(AS_MESSAGE_LOG_FD,
-[m4_pushdef([AS_MESSAGE_LOG_FD], [$[3]])dnl
-  if test "$[3]"; then
-    AS_LINENO_PUSH([$[2]])
-    _AS_ECHO_LOG([error: $[1]])
+[m4_pushdef([AS_MESSAGE_LOG_FD], [$[4]])dnl
+  if test "$[4]"; then
+    AS_LINENO_PUSH([$[3]])
+    _AS_ECHO_LOG([error: $[2]])
   fi
 m4_define([AS_MESSAGE_LOG_FD])], [m4_pushdef([AS_MESSAGE_LOG_FD])])dnl
-  AS_MESSAGE([error: $[1]], [2])
+  AS_MESSAGE([error: $[2]], [2])
 _m4_popdef([AS_MESSAGE_LOG_FD])dnl
   AS_EXIT([$as_status])])])
 
@@ -842,9 +842,8 @@ _m4_popdef([AS_MESSAGE_LOG_FD])dnl
 m4_defun_init([AS_ERROR],
 [m4_append_uniq([_AS_CLEANUP],
   [m4_divert_text([M4SH-INIT-FN], [_AS_ERROR_PREPARE[]])])],
-[m4_ifvaln([$2], [{ AS_SET_STATUS([$2])])]dnl
-[as_fn_error "_AS_QUOTE([$1])"m4_ifval(AS_MESSAGE_LOG_FD,
-  [ "$LINENO" AS_MESSAGE_LOG_FD])[]m4_ifval([$2], [; }])])
+[as_fn_error m4_default([$2], [$?]) "_AS_QUOTE([$1])"m4_ifval(AS_MESSAGE_LOG_FD,
+  [ "$LINENO" AS_MESSAGE_LOG_FD])])
 
 
 # AS_LINENO_PUSH([LINENO])