bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] bootstrap: avoid broken Solaris sed


From: Eric Blake
Subject: [PATCH] bootstrap: avoid broken Solaris sed
Date: Sat, 13 Nov 2010 16:18:11 -0700

* build-aux/bootstrap (SED): Filter out bad sed.
Reported by Ralf Wildenhues.

Signed-off-by: Eric Blake <address@hidden>
---

Any objections to this?  I figured it was faster to do a quick filter
and hard-code a working path for Solaris than to try and port the
full-blown PATH search done by autoconf script in AC_PROG_SED.


 ChangeLog | 6 ++++++ build-aux/bootstrap | 49
 ++++++++++++++++++++++++++++++++----------------- 2 files changed, 38
 insertions(+), 17 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3c45886..5793db1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-11-13  Eric Blake  <address@hidden>
+
+       bootstrap: avoid broken Solaris sed
+       * build-aux/bootstrap (SED): Filter out bad sed.
+       Reported by Ralf Wildenhues.
+
 2010-11-13  Bruno Haible  <address@hidden>

        rename test: Add comments.
diff --git a/build-aux/bootstrap b/build-aux/bootstrap
index 6c311c3..6830079 100755
--- a/build-aux/bootstrap
+++ b/build-aux/bootstrap
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Print a version string.
-scriptversion=2010-11-12.21; # UTC
+scriptversion=2010-11-13.23; # UTC

 # Bootstrap this package from checked-out sources.

@@ -38,9 +38,24 @@ export LC_ALL

 local_gl_dir=gl

+# Find a working sed; Solaris /bin/sed is too weak for some of our uses.
+if test "x$SED" = x; then
+  case `(echo a | gsed -n 1p) 2>/dev/null || echo b | sed -n '/\(b\)*/p'` in
+    a) SED=gsed;;
+    b) SED=sed;;
+    *)
+    if test -x /usr/xpg4/bin/sed; then
+      SED=/usr/xpg4/bin/sed
+    else
+      echo "$0: could not find decent value for \$SED" >&2
+      exit 1
+    fi;;
+  esac
+fi
+
 # Temporary directory names.
 bt='._bootmp'
-bt_regex=`echo "$bt"| sed 's/\./[.]/g'`
+bt_regex=`echo "$bt"| $SED 's/\./[.]/g'`
 bt2=${bt}2

 usage() {
@@ -114,7 +129,7 @@ extract_package_name='
      p
   }
 '
-package=`sed -n "$extract_package_name" configure.ac` || exit
+package=`$SED -n "$extract_package_name" configure.ac` || exit
 gnulib_name=lib$package

 build_aux=build-aux
@@ -271,7 +286,7 @@ insert_vc_ignore() {
     # A .gitignore entry that does not start with `/' applies
     # recursively to subdirectories, so prepend `/' to every
     # .gitignore entry.
-    pattern=`echo "$pattern" | sed s,^,/,`;;
+    pattern=`echo "$pattern" | $SED s,^,/,`;;
   esac
   insert_sorted_if_absent "$vc_ignore_file" "$pattern"
 }
@@ -344,7 +359,7 @@ get_version() {
   $app --version >/dev/null 2>&1 || return 1

   $app --version 2>&1 |
-  sed -n '# extract version within line
+  $SED -n '# extract version within line
           s/.*[v ]\{1,\}\([0-9]\{1,\}\(\.[.a-z0-9-]*\)*\).*/\1/
           t done

@@ -530,9 +545,9 @@ update_po_files() {
   test -d $ref_po_dir || mkdir $ref_po_dir || return
   download_po_files $ref_po_dir $domain \
     && ls "$ref_po_dir"/*.po 2>/dev/null |
-      sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS" || return
+      $SED 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS" || return

-  langs=`cd $ref_po_dir && echo *.po|sed 's/\.po//g'`
+  langs=`cd $ref_po_dir && echo *.po|$SED 's/\.po//g'`
   test "$langs" = '*' && langs=x
   for po in $langs; do
     case $po in x) continue;; esac
@@ -580,7 +595,7 @@ symlink_to_dir()
       for dot_ig in x $vc_ignore; do
         test $dot_ig = x && continue
         ig=$parent/$dot_ig
-        insert_vc_ignore $ig `echo "$dst_dir"|sed 's,.*/,,'`
+        insert_vc_ignore $ig `echo "$dst_dir"|$SED 's,.*/,,'`
       done
     fi

@@ -651,7 +666,7 @@ cp_mark_as_generated()
         echo "$0: cp -f $cp_src $cp_dst" &&
         rm -f "$cp_dst" &&
         cp "$cp_src" "$cp_dst-t" &&
-        sed "s!$bt_regex/!!g" "$cp_src" > "$cp_dst-t" &&
+        $SED "s!$bt_regex/!!g" "$cp_src" > "$cp_dst-t" &&
         mv -f "$cp_dst-t" "$cp_dst"
       }
     else
@@ -661,7 +676,7 @@ cp_mark_as_generated()
       (
         echo "$c1-*- buffer-read-only: t -*- vi: set ro:$c2" &&
         echo "${c1}DO NOT EDIT! GENERATED AUTOMATICALLY!$c2" &&
-        sed "s!$bt_regex/!!g" "$cp_src"
+        $SED "s!$bt_regex/!!g" "$cp_src"
       ) > $cp_dst-t &&
       if cmp -s "$cp_dst-t" "$cp_dst"; then
         rm -f "$cp_dst-t"
@@ -707,11 +722,11 @@ slurp() {
       if test $file = Makefile.am && test "X$gnulib_mk" != XMakefile.am; then
         copied=$copied${sep}$gnulib_mk; sep=$nl
         remove_intl='/^[^#].*\/intl/s/^/#/;'"s!$bt_regex/!!g"
-        sed "$remove_intl" $1/$dir/$file |
+        $SED "$remove_intl" $1/$dir/$file |
         cmp - $dir/$gnulib_mk > /dev/null || {
           echo "$0: Copying $1/$dir/$file to $dir/$gnulib_mk ..." &&
           rm -f $dir/$gnulib_mk &&
-          sed "$remove_intl" $1/$dir/$file >$dir/$gnulib_mk &&
+          $SED "$remove_intl" $1/$dir/$file >$dir/$gnulib_mk &&
           gnulib_mk_hook $dir/$gnulib_mk
         }
       elif { test "${2+set}" = set && test -r $2/$dir/$file; } ||
@@ -722,7 +737,7 @@ slurp() {
         if test $file = gettext.m4; then
           echo "$0: patching m4/gettext.m4 to remove need for intl/* ..."
           rm -f $dir/$file
-          sed '
+          $SED '
             /^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\
               AC_DEFUN([AM_INTL_SUBDIR], [])
             /^AC_DEFUN(\[gt_INTL_SUBDIR_CORE],/,/^]/c\
@@ -746,7 +761,7 @@ slurp() {
         # e.g., stdint.in.h -> stdint.h, dirent.in.h ->..., etc.
         # Likewise for .gperf -> .h, .y -> .c, and .sin -> .sed
         f=`echo "$copied" |
-          sed '
+          $SED '
             s/\.in\.h$/.h/
             s/\.sin$/.sed/
             s/\.y$/.c/
@@ -757,7 +772,7 @@ slurp() {

         # For files like sys_stat.in.h and sys_time.in.h, record as
         # ignorable the directory we might eventually create: sys/.
-        f=`echo "$copied"|sed 's/sys_.*\.in\.h$/sys/'`
+        f=`echo "$copied"|$SED 's/sys_.*\.in\.h$/sys/'`
         insert_vc_ignore $ig "$f"
       fi
     done
@@ -860,7 +875,7 @@ if test $with_gettext = yes; then
   # Create gettext configuration.
   echo "$0: Creating po/Makevars from po/Makevars.template ..."
   rm -f po/Makevars
-  sed '
+  $SED '
     /^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/
     /^COPYRIGHT_HOLDER *=/s/=.*/= '"$COPYRIGHT_HOLDER"'/
     /^MSGID_BUGS_ADDRESS *=/s|=.*|= '"$MSGID_BUGS_ADDRESS"'|
@@ -874,7 +889,7 @@ if test $with_gettext = yes; then
   if test -d runtime-po; then
     # Similarly for runtime-po/Makevars, but not quite the same.
     rm -f runtime-po/Makevars
-    sed '
+    $SED '
       /^DOMAIN *=.*/s/=.*/= '"$package"'-runtime/
       /^subdir *=.*/s/=.*/= runtime-po/
       /^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/
-- 
1.7.3.2




reply via email to

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