autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: more efficient AS_EXIT


From: Eric Blake
Subject: Re: more efficient AS_EXIT
Date: Fri, 21 Nov 2008 18:20:06 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Paolo Bonzini <bonzini <at> gnu.org> writes:

> > So what do you think of 
> > this, which moves the max($?,1) logic into AS_ERROR?
> 
> Very nice.

Committed.

> 
> >         AS_ECHO(["$as_me: invalid option $[1]"])
> 
> As a follow up, these (and many other AS_ECHOs) could be changed to
> AS_MESSAGE.

Done:

From: Eric Blake <address@hidden>
Date: Fri, 21 Nov 2008 08:31:17 -0700
Subject: [PATCH] Use modern m4sh constructs in autoconf.

* bin/autoconf.as (exit_missing_arg, getopt): Use AS_ERROR, rather
than AS_EXIT.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog       |    4 ++++
 bin/autoconf.as |   22 ++++++++--------------
 2 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1ac1e67..37ecf00 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2008-11-21  Eric Blake  <address@hidden>
 
+       Use modern m4sh constructs in autoconf.
+       * bin/autoconf.as (exit_missing_arg, getopt): Use AS_ERROR, rather
+       than AS_EXIT.
+
        Change the semantics of AS_EXIT without argument.
        * lib/m4sugar/m4sh.m4 (_AS_EXIT_PREPARE): When defaulting, use $?
        even if it is 0.
diff --git a/bin/autoconf.as b/bin/autoconf.as
index c678e55..dcd8ae0 100644
--- a/bin/autoconf.as
+++ b/bin/autoconf.as
@@ -79,10 +79,9 @@ help="\
 Try \`$as_me --help' for more information."
 
 exit_missing_arg='
-  AS_ECHO(["$as_me: option \`$[1]'\'' requires an argument"]) >&2
-  AS_ECHO(["$help"]) >&2
-  AS_EXIT([1])
-' # restore font-lock: "
+  m4_bpatsubst([AS_ERROR([option `$[1]' requires an argument$as_nl$help])],
+    ['], ['\\''])'
+# restore font-lock: '
 
 # Variables.
 : ${AUTOM4TE='@bindir@/@autom4te-name@'}
@@ -113,7 +112,7 @@ while test $# -gt 0 ; do
     --prepend-include=* | -B?* | \
     --warnings=* | -W?* )
        case $1 in
-        *\'*) arg=`AS_ECHO(["$1"]) | sed "s/'/'\\\\\\\\''/g"` ;;
+        *\'*) arg=`AS_ECHO(["$1"]) | sed "s/'/'\\\\\\\\''/g"` ;; #'
         *) arg=$1 ;;
        esac
        autom4te_options="$autom4te_options '$arg'"; shift ;;
@@ -123,7 +122,7 @@ while test $# -gt 0 ; do
     --warnings | -W )
        test $# = 1 && eval "$exit_missing_arg"
        case $2 in
-        *\'*) arg=`AS_ECHO(["$2"]) | sed "s/'/'\\\\\\\\''/g"` ;;
+        *\'*) arg=`AS_ECHO(["$2"]) | sed "s/'/'\\\\\\\\''/g"` ;; #'
         *) arg=$2 ;;
        esac
        autom4te_options="$autom4te_options $option '$arg'"
@@ -154,9 +153,7 @@ while test $# -gt 0 ; do
        break ;;
     -* )
        exec >&2
-       AS_ECHO(["$as_me: invalid option $[1]"])
-       AS_ECHO(["$help"])
-       AS_EXIT([1]) ;;
+       AS_ERROR([invalid option `$[1]'$as_nl$help]) ;; #`
     * )
        break ;;
   esac
@@ -174,16 +171,13 @@ case $# in
     elif test -f configure.in; then
       infile=configure.in
     else
-      AS_ECHO(["$as_me: no input file"]) >&2
-      AS_EXIT([1])
+      AS_ERROR([no input file])
     fi
     test -z "$traces" && test -z "$outfile" && outfile=configure;;
   1)
     infile=$1 ;;
   *) exec >&2
-     AS_ECHO(["$as_me: invalid number of arguments."])
-     AS_ECHO(["$help"])
-     AS_EXIT([1]) ;;
+     AS_ERROR([invalid number of arguments$as_nl$help]) ;;
 esac
 
 # Unless specified, the output is stdout.
-- 
1.6.0.4








reply via email to

[Prev in Thread] Current Thread [Next in Thread]