[EMAIL PROTECTED] wrote:
Author: rjung
Date: Tue Sep 16 13:05:34 2008
New Revision: 696032

URL: http://svn.apache.org/viewvc?rev=696032&view=rev
Log:
Improve sed expresion added in r695003.
LDFLAGS could already include "Wl,", so we shouldn't
add them a second time.
Problem reported by Brian Rectanus.

Modified:
    tomcat/connectors/trunk/jk/native/configure.in

Modified: tomcat/connectors/trunk/jk/native/configure.in
URL: 
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/configure.in?rev=696032&r1=696031&r2=696032&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/configure.in (original)
+++ tomcat/connectors/trunk/jk/native/configure.in Tue Sep 16 13:05:34 2008
@@ -108,8 +108,13 @@
                 APXSCPPFLAGS=""
                 dnl sed magic needed to prepend each token with "-Wl," s.t. 
libtool
                 dnl detects those arguments correctly as ld flags.
+                dnl Prevent double Wl by first stripping it.
+                dnl Allow space and tab as separators.
                 dnl Double square brackets needed, because single ones will be 
removed by autoconf.
-                APXSLDFLAGS="`$APXS -q LDFLAGS_SHLIB | $SED -e 's/\([[^ 
]]*\)/-Wl,\1/g'`"
+                APXSLDFLAGS="`$APXS -q LDFLAGS_SHLIB | \
+                    $SED -e 's/\([[    ]]\{1,\}\)-Wl,/\1/g' \
+                         -e 's/^-Wl,//g' \
+                         -e 's/\([[^   ]]\{1,\}\)/-Wl,\1/g'`"
             else
                 WEBSERVER="apache-2.0"
                 APRINCLUDEDIR=""
@@ -123,8 +128,13 @@
                 APXSCPPFLAGS="`${APXS} -q EXTRA_CPPFLAGS`"
                 dnl sed magic needed to prepend each token with "-Wl," s.t. 
libtool
                 dnl detects those arguments correctly as ld flags.
+                dnl Prevent double Wl by first stripping it.
+                dnl Allow space and tab as separators.
                 dnl Double square brackets needed, because single ones will be 
removed by autoconf.
-                APXSLDFLAGS="`$APXS -q LDFLAGS | $SED -e 's/\([[^ 
]]*\)/-Wl,\1/g'`"
+                APXSLDFLAGS="`$APXS -q LDFLAGS | \
+                    $SED -e 's/\([[    ]]\{1,\}\)-Wl,/\1/g' \
+                         -e 's/^-Wl,//g' \
+                         -e 's/\([[^   ]]\{1,\}\)/-Wl,\1/g'`"
                 APACHE_CONFIG_VARS="`${APXS} -q 
exp_installbuilddir`/config_vars.mk"
                 LIBTOOL=`$APXS -q LIBTOOL`
             fi
@@ -534,7 +544,15 @@
 fi
 dnl the APXSLDFLAGS is given to the linker (for APRVARS).
 if ${TEST} -n "${LDFLAGS}" ; then
-    TMPLDFLAGS="`${ECHO} ${LDFLAGS} | $SED -e 's/\([[^ ]]*\)/-Wl,\1/g'`"
+    dnl sed magic needed to prepend each token with "-Wl," s.t. libtool
+    dnl detects those arguments correctly as ld flags.
+    dnl Prevent double Wl by first stripping it.
+    dnl Allow space and tab as separators.
+    dnl Double square brackets needed, because single ones will be removed by 
autoconf.
+    TMPLDFLAGS="`${ECHO} ${LDFLAGS} | \
+        $SED -e 's/\([[        ]]\{1,\}\)-Wl,/\1/g' \
+             -e 's/^-Wl,//g' \
+             -e 's/\([[^       ]]\{1,\}\)/-Wl,\1/g'`"
     APXSLDFLAGS="${APXSLDFLAGS} ${TMPLDFLAGS}"
 fi
 AC_SUBST(APXSCFLAGS)



Why not making something like:

dnl
dnl APR_REMOVEFROM(variable, value)
dnl
dnl Remove a value from a variable
dnl
AC_DEFUN([APR_REMOVEFROM], [
  if test "x$$1" = "x$2"; then
    test "x$silent" != "xyes" && echo "  nulling $1"
    $1=""
  else
    apr_new_bugger=""
    apr_removed=0
    for i in $$1; do
      if test "x$i" != "x$2"; then
        apr_new_bugger="$apr_new_bugger $i"
      else
        apr_removed=1
      fi
    done
    if test $apr_removed = "1"; then
      test "x$silent" != "xyes" && echo "  removed \"$2\" from $1"
      $1=$apr_new_bugger
    fi
  fi
]) dnl

This looks more simpler to me, compared to hard-to-read regex
sed rules.

Regards
--
^(TM)

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to