libtool-patches
[Top][All Lists]
Advanced

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

FYI: sed/shell portability fixes


From: Ralf Wildenhues
Subject: FYI: sed/shell portability fixes
Date: Thu, 30 Dec 2004 13:04:19 +0100
User-agent: Mutt/1.4.1i

Applied to HEAD and branch-2-0 (these bugs are not in branch-1-5).
A quick check did not turn op other instances of the first
incompatibility in Libtool (sed outputs the whole `libtool' script),
neither the second (a similar bug was reported against Autoconf by
Eric Blake).

Am thinking about a patch for the Autoconf manual.

Regards,
Ralf

        * config/getopt.m4sh (func_version, func_usage, func_help):
        Use `$SED -n' instead of `$SED RANGE {[...]p;}; d' as AIX sed
        cannot handle the latter.
        (func_help): start autoconf and automake in subshells to avoid
        error messages from ash and Bourne shells if not available.

Index: config/getopt.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/config/getopt.m4sh,v
retrieving revision 1.2
diff -u -r1.2 getopt.m4sh
--- config/getopt.m4sh  10 Oct 2004 23:27:24 -0000      1.2
+++ config/getopt.m4sh  30 Dec 2004 10:41:29 -0000
@@ -31,11 +31,11 @@
 # Echo version message to standard output and exit.
 func_version ()
 {
-    $SED '/^# '$PROGRAM' (GNU /,/# warranty; / {
+    $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
         s/^# //; s/^# *$//;
         s/\((C)\)[[ 0-9,-]]*\( [[1-9]][[0-9]]*\)/\1\2/;
         p;
-     }; d' < "$progpath"
+     }' < "$progpath"
      exit $EXIT_SUCCESS
 }
 
@@ -43,11 +43,11 @@
 # Echo short help message to standard output and exit.
 func_usage ()
 {
-    $SED '/^# Usage:/,/# -h/ {
+    $SED -n '/^# Usage:/,/# -h/ {
         s/^# //; s/^# *$//;
        s/\$progname/'$progname'/;
        p;
-    }; d' < "$progpath"
+    }' < "$progpath"
     $ECHO
     $ECHO "run \`$progname --help | more' for full usage"
     exit $EXIT_SUCCESS
@@ -57,7 +57,7 @@
 # Echo long help message to standard output and exit.
 func_help ()
 {
-    $SED '/^# Usage:/,/# Report bugs to/ {
+    $SED -n '/^# Usage:/,/# Report bugs to/ {
         s/^# //; s/^# *$//;
        s*\$progname*'$progname'*;
        s*\$SHELL*'"$SHELL"'*;
@@ -65,10 +65,10 @@
        s*\$LTCFLAGS*'"$LTCFLAGS"'*;
        s*\$LD*'"$LD"'*;
        s/\$with_gnu_ld/'"$with_gnu_ld"'/;
-       s/\$automake_version/'"`automake --version 2>/dev/null |$SED 1q`"'/;
-       s/\$autoconf_version/'"`autoconf --version 2>/dev/null |$SED 1q`"'/;
+       s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/;
+       s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/;
        p;
-     }; d' < "$progpath"
+     }' < "$progpath"
     exit $EXIT_SUCCESS
 }
 




reply via email to

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