]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* libltdl/config/general.m4sh (sed_double_backslash): Replace
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 11 Feb 2007 11:07:08 +0000 (11:07 +0000)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 11 Feb 2007 11:07:08 +0000 (11:07 +0000)
POSIX sed script with a hack that treats up to 10 backslashes
in the input correctly and is portable to Solaris /bin/sed.

ChangeLog
libltdl/config/general.m4sh

index 0edfc15764c919dbb478880f984d0b571130ab46..c225689c134543d73ba7fc2766982cf9f364cc81 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-02-08  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       * libltdl/config/general.m4sh (sed_double_backslash): Replace
+       POSIX sed script with a hack that treats up to 10 backslashes
+       in the input correctly and is portable to Solaris /bin/sed.
+
 2007-02-08  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        * tests/testsuite.at (LT_AT_TAG): Skip also if the compiler
index 8340a71a1f80ec70235e52f7358bebdfec3f4ff6..4e1d1f1bdb408ab16877aaf99d5a5171be7e0c51 100644 (file)
@@ -1,7 +1,7 @@
 m4_if([# general.m4sh -- general shell script boiler plate -*- Autoconf -*-
 # Written by Gary V. Vaughan <gary@gnu.org>, 2004
 
-# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
 # This is free software; see the source for copying conditions.  There is NO
 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
@@ -100,10 +100,29 @@ double_quote_subst='s/\([["`\\]]\)/\\\1/g'
 # `\'-ed in input to the same.  If an odd number of `\' preceded a '$'
 # in input to double_quote_subst, that '$' was protected from expansion.
 # Since each input `\' is now two `\'s, look for any number of runs of
-# four `\'s followed by two `\'s and then a '$'.  `\' that '$'.  Note
-# that the embedded single quotes serve only to enhance readability.
-sed_double_backslash='s/^\(\(''\\\\''\\\\''\)*''\\\\''\)\$/\1\\$/;
-                s/\([[^\\]]\(''\\\\''\\\\''\)*''\\\\''\)\$/\1\\$/g'
+# four `\'s followed by two `\'s and then a '$'.  `\' that '$'. 
+#
+# Note in the first, non-portable but general version, the embedded single
+# quotes serve only to enhance readability.
+#sed_double_backslash='s/^\(\(''\\\\''\\\\''\)*''\\\\''\)\$/\1\\$/;
+#                s/\([[^\\]]\(''\\\\''\\\\''\)*''\\\\''\)\$/\1\\$/g'
+bs='\\'
+bs2='\\\\'
+bs4='\\\\\\\\'
+dollar='\$'
+sed_double_backslash="\
+  s/^$bs2$dollar/$bs&/
+  s/^$bs4$bs2$dollar/$bs&/
+  s/^$bs4$bs4$bs2$dollar/$bs&/
+  s/^$bs4$bs4$bs4$bs2$dollar/$bs&/
+  s/^$bs4$bs4$bs4$bs4$bs2$dollar/$bs&/
+  s/^$bs4$bs4$bs4$bs4$bs4$bs2$dollar/$bs&/
+  s/\\([[^$bs]]\\)\\($bs2$dollar\\)/\\1$bs\\2/g
+  s/\\([[^$bs]]\\)\\($bs4$bs2$dollar\\)/\\1$bs\\2/g
+  s/\\([[^$bs]]\\)\\($bs4$bs4$bs2$dollar\\)/\\1$bs\\2/g
+  s/\\([[^$bs]]\\)\\($bs4$bs4$bs4$bs2$dollar\\)/\\1$bs\\2/g
+  s/\\([[^$bs]]\\)\\($bs4$bs4$bs4$bs4$bs2$dollar\\)/\\1$bs\\2/g
+  s/\\([[^$bs]]\\)\\($bs4$bs4$bs4$bs4$bs4$bs2$dollar\\)/\\1$bs\\2/g"
 
 # Standard options:
 opt_dry_run=false