autoconf-patches
[Top][All Lists]
Advanced

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

another old patch: use the vertical bar as sed delimiter


From: Jim Meyering
Subject: another old patch: use the vertical bar as sed delimiter
Date: Sat, 22 Sep 2007 16:57:55 +0200

Here's another old patch.
It goes a little further on the sed-consistency front.

Once applied, if you rebuild autoconf, install it, and
regenerate autoconf's own configure script with the just-built
autoconf, you'll find that there are no more matches (modulo
some deliberate exceptions) when you run this command:

    grep -rl '\<sed ['\''"]s[^/|]' .|grep -v Makefil

Initially I also changed

    $ grep '\<sed ['\''"]s[^/|]' lib/autotest/general.m4
    AUTOTEST_PATH=`AS_ECHO(["$AUTOTEST_PATH"]) | sed "s&:&$PATH_SEPARATOR&g"`

but see Paul wanted to use "&" there:

2005-07-03  Paul Eggert  <address@hidden>

        * lib/autoconf/general.m4 (AC_ARG_PROGRAM): Use &, not |, in
        sed substitution command, so that we allow | in program prefixes
        and program suffixes.  (& is a problem anyway; we're not fixing
        that here.)
        * lib/autoconf/status.m4 (AC_CONFIG_FILES): Likewise, for
        configure_input, top_builddir, srcdir, etc.
        * lib/autotest/general.m4 (AT_INIT): Likewise, for
        PATH_SEPARATOR in AUTOTEST_PATH.

Is the concern that "|" might be used as a path separator?
Does any shell use that?

If no one objects, I'll commit this on Monday.

>From 8e07cb1112fe34c58cd1fa8b595c8b39843b79e3 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sat, 22 Sep 2007 14:04:51 +0200
Subject: [PATCH] Whenever possible, use the vertical bar as sed delimiter.

* lib/autoconf/functions.m4 (GETLOADAVG_LIBS) [AC_FUNC_GETLOADAVG]:
Use "|", not "!".
* lib/autoconf/status.m4 (_AC_SRCDIRS) [ac_top_builddir_sub]:
[ac_dir_suffix]: Use "|", not "," as sed delimiter.
* tests/mktests.sh (as_me): Likewise.
* lib/freeze.mk (check-forbidden-patterns): Likewise.
* lib/autoconf/fortran.m4 (_AC_PROG_FC_V_OUTPUT): Likewise.
* configure: Regenerate.
* doc/autoconf.texi (Shell Substitutions): Use "|", not "," in examples.

Signed-off-by: Jim Meyering <address@hidden>
---
 configure                 |    8 ++++----
 doc/autoconf.texi         |    4 ++--
 lib/autoconf/fortran.m4   |    2 +-
 lib/autoconf/functions.m4 |    2 +-
 lib/autoconf/status.m4    |    4 ++--
 lib/freeze.mk             |    2 +-
 tests/mktests.sh          |    4 ++--
 7 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/configure b/configure
index b7ebea5..a6f20ac 100755
--- a/configure
+++ b/configure
@@ -1339,9 +1339,9 @@ if test "$ac_init_help" = "recursive"; then
 case "$ac_dir" in
 .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
 *)
-  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
   # A ".." for each directory in $ac_dir_suffix.
-  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 
's,/[^\\/]*,/..,g;s,/,,'`
+  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 
's|/[^\\/]*|/..|g;s|/||'`
   case $ac_top_builddir_sub in
   "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
   *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
@@ -3808,9 +3808,9 @@ $as_echo "$as_me: error: cannot create directory $as_dir" 
>&2;}
 case "$ac_dir" in
 .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
 *)
-  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
   # A ".." for each directory in $ac_dir_suffix.
-  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 
's,/[^\\/]*,/..,g;s,/,,'`
+  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 
's|/[^\\/]*|/..|g;s|/||'`
   case $ac_top_builddir_sub in
   "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
   *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index a2af90c..f05b109 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -11794,7 +11794,7 @@ For instance, the following code:

 @example
 case "$given_srcdir" in
-.)  top_srcdir="`echo "$dots" | sed 's,/$,,'`" ;;
+.)  top_srcdir="`echo "$dots" | sed 's|/$||'`" ;;
 *)  top_srcdir="$dots$given_srcdir" ;;
 esac
 @end example
@@ -11804,7 +11804,7 @@ is more readable when written as:

 @example
 case $given_srcdir in
-.)  top_srcdir=`echo "$dots" | sed 's,/$,,'` ;;
+.)  top_srcdir=`echo "$dots" | sed 's|/$||'` ;;
 *)  top_srcdir=$dots$given_srcdir ;;
 esac
 @end example
diff --git a/lib/autoconf/fortran.m4 b/lib/autoconf/fortran.m4
index a5d34d7..0907e40 100644
--- a/lib/autoconf/fortran.m4
+++ b/lib/autoconf/fortran.m4
@@ -560,7 +560,7 @@ rm -f conftest*
 # Here, we change these into -L/foo -L/bar -L/baz (and put it first):
 ac_[]_AC_LANG_ABBREV[]_v_output="`echo $ac_[]_AC_LANG_ABBREV[]_v_output |
        grep 'LPATH is:' |
-       sed 's,.*LPATH is\(: *[[^ ]]*\).*,\1,;s,: */, -L/,g'` 
$ac_[]_AC_LANG_ABBREV[]_v_output"
+       sed 's|.*LPATH is\(: *[[^ ]]*\).*|\1|;s|: */| -L/|g'` 
$ac_[]_AC_LANG_ABBREV[]_v_output"

 # FIXME: we keep getting bitten by quoted arguments; a more general fix
 #        that detects unbalanced quotes in FLIBS should be implemented
diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4
index e1598c8..a992325 100644
--- a/lib/autoconf/functions.m4
+++ b/lib/autoconf/functions.m4
@@ -775,7 +775,7 @@ fi
 if test "x$ac_save_LIBS" = x; then
   GETLOADAVG_LIBS=$LIBS
 else
-  GETLOADAVG_LIBS=`AS_ECHO(["$LIBS"]) | sed "s!$ac_save_LIBS!!"`
+  GETLOADAVG_LIBS=`AS_ECHO(["$LIBS"]) | sed "s|$ac_save_LIBS||"`
 fi
 LIBS=$ac_save_LIBS

diff --git a/lib/autoconf/status.m4 b/lib/autoconf/status.m4
index c07e6d7..5b43e11 100644
--- a/lib/autoconf/status.m4
+++ b/lib/autoconf/status.m4
@@ -105,9 +105,9 @@ m4_define([_AC_SRCDIRS],
 case $1 in
 .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
 *)
-  ac_dir_suffix=/`AS_ECHO([$1]) | sed 's,^\.[[\\/]],,'`
+  ac_dir_suffix=/`AS_ECHO([$1]) | sed 's|^\.[[\\/]]||'`
   # A ".." for each directory in $ac_dir_suffix.
-  ac_top_builddir_sub=`AS_ECHO(["$ac_dir_suffix"]) | sed 
's,/[[^\\/]]*,/..,g;s,/,,'`
+  ac_top_builddir_sub=`AS_ECHO(["$ac_dir_suffix"]) | sed 
's|/[[^\\/]]*|/..|g;s|/||'`
   case $ac_top_builddir_sub in
   "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
   *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
diff --git a/lib/freeze.mk b/lib/freeze.mk
index 28cf554..7f40bad 100644
--- a/lib/freeze.mk
+++ b/lib/freeze.mk
@@ -122,7 +122,7 @@ check-forbidden-patterns:
            $(GREP) $(forbidden_patterns) $(forbidden_patterns_files)) \
            >forbidden.log; then \
          echo "ERROR: forbidden patterns were found:" >&2; \
-         sed "s,^,$*.m4: ," <forbidden.log >&2; \
+         sed "s|^|$*.m4: |" <forbidden.log >&2; \
          echo >&2; \
          exit 1; \
        else \
diff --git a/tests/mktests.sh b/tests/mktests.sh
index a7145e9..68631b0 100755
--- a/tests/mktests.sh
+++ b/tests/mktests.sh
@@ -23,7 +23,7 @@
 # If we fail, clean up, but touch the output files.  We probably failed
 # because we used some non-portable tool.

-as_me=`echo "$0" | sed 's,.*[\\/],,'`
+as_me=`echo "$0" | sed 's|.*[\\/]||'`

 trap 'echo "'"$as_me"': failed." >&2
       rm -f acdefuns audefuns requires *.tat
@@ -181,7 +181,7 @@ au_exclude_script="$exclude_list $au_exclude_list {print}"

 for file in $src
 do
-  base=`echo "$file" | sed 's,.*[\\/],,;s/\..*//'`
+  base=`echo "$file" | sed 's|.*[\\/]||;s|\..*||'`
   # Get the list of macros which are defined in Autoconf level.
   # Get rid of the macros we are not interested in.
   sed -n -e 's/^AC_DEFUN(\[*\([a-zA-Z0-9_]*\).*$/\1/p' \
--
1.5.3.2.81.g17ed-dirty




reply via email to

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