On Sat, 23 Aug 2003, Albert Chin wrote:

> There is some sed magic in apr_common.m4 to source config.layout. The
> first sed line is:

    I've fixed this in May but have not come around to commit it
    yet.  See the attached patch.  And no, I have no idea what
    the first sed expression is trying to achieve.

> What does this do? It breaks the sed statement on IRIX 6.5.19m.
> Removing the sed statement above causes everything to work fine. I've
> tested the sed statement without the first line on the following
> platforms with success:

    Can you give the patch a try?  It is _way_ easier to maintain
    than the sed version.

    - Sascha
--- build/apr_common.m4~        Fri May 30 18:29:34 2003
+++ build/apr_common.m4 Fri May 30 18:53:46 2003
@@ -756,14 +756,13 @@
     exit 1
   fi
   pldconf=./config.pld
-  changequote({,})
-  sed -e "1s/[         ]*<[lL]ayout[   ]*$2[   ]*>[    ]*//;t" \
-      -e "1,/[         ]*<[lL]ayout[   ]*$2[   ]*>[    ]*/d" \
-      -e '/[   ]*<\/Layout>[   ]*/,$d' \
-      -e "s/^[         ]*//g" \
-      -e "s/:[         ]*/=\'/g" \
-      -e "s/[  ]*$/'/g" \
-      $1 > $pldconf
+  changequote({{,}})
+  awk -v layout=$2 '                                                         \
+        /<[Ll]ayout/ { if ({{$}}2 == layout ">") ok=1; next; }               \
+        ok == 1 && /<\/Layout>/ { exit; }                                    \
+        ok == 1 { print {{substr}}({{$}}1,1,length({{$}}1)-1) "=\"" {{$}}2 "\"" } ' \
+        < $1 > $pldconf
+
   layout_name=$2
   if test ! -s $pldconf; then
     echo "** Error: unable to find layout $layout_name"
@@ -771,6 +770,7 @@
   fi
   . $pldconf
   rm $pldconf
+  changequote({,})
   for var in prefix exec_prefix bindir sbindir libexecdir mandir \
              sysconfdir datadir includedir localstatedir runtimedir \
              logfiledir libdir installbuilddir libsuffix $3; do

Reply via email to