Author: rjung Date: Fri Sep 19 05:42:26 2008 New Revision: 697070 URL: http://svn.apache.org/viewvc?rev=697070&view=rev Log: Remove sed regular expression juggling in configure used for optionally prefixing LDFLAGS by "-Wl,".
Instead use a shell loop and "case" pattern matching defined in a reusable way as a new JK m4 macro. Modified: tomcat/connectors/trunk/jk/native/configure.in tomcat/connectors/trunk/jk/native/scripts/build/jk_common.m4 Modified: tomcat/connectors/trunk/jk/native/configure.in URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/configure.in?rev=697070&r1=697069&r2=697070&view=diff ============================================================================== --- tomcat/connectors/trunk/jk/native/configure.in (original) +++ tomcat/connectors/trunk/jk/native/configure.in Fri Sep 19 05:42:26 2008 @@ -106,15 +106,7 @@ APXSCC="`$APXS -q CC`" APXSCFLAGS="`$APXS -q CFLAGS` -DJK_PREFORK" 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/\([[ ]]\{1,\}\)-Wl,/\1/g' \ - -e 's/^-Wl,//g' \ - -e 's/\([[^ ]]\{1,\}\)/-Wl,\1/g'`" + APXSLDFLAGS="`$APXS -q LDFLAGS_SHLIB`" else WEBSERVER="apache-2.0" APRINCLUDEDIR="" @@ -126,15 +118,7 @@ APXSCC="`$APXS -q CC`" APXSCFLAGS="`${APXS} -q CFLAGS` `${APXS} -q EXTRA_CFLAGS` -DHAVE_APR ${APRINCLUDEDIR}" 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/\([[ ]]\{1,\}\)-Wl,/\1/g' \ - -e 's/^-Wl,//g' \ - -e 's/\([[^ ]]\{1,\}\)/-Wl,\1/g'`" + APXSLDFLAGS="`$APXS -q LDFLAGS`" APACHE_CONFIG_VARS="`${APXS} -q exp_installbuilddir`/config_vars.mk" LIBTOOL=`$APXS -q LIBTOOL` fi @@ -538,25 +522,21 @@ AC_SUBST(CFLAGS) dnl the APXSCFLAGS is given by apxs to the C compiler -dnl the APXSLDFLAGS is normally empty but APXSCFLAGS is not. if ${TEST} -n "${CFLAGS}" ; then APXSCFLAGS="${APXSCFLAGS} ${CFLAGS}" fi +AC_SUBST(APXSCFLAGS) +AC_SUBST(APXSCPPFLAGS) + dnl the APXSLDFLAGS is given to the linker (for APRVARS). if ${TEST} -n "${LDFLAGS}" ; then - 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}" + APXSLDFLAGS="${APXSLDFLAGS} ${LDFLAGS}" fi -AC_SUBST(APXSCFLAGS) -AC_SUBST(APXSCPPFLAGS) + +dnl Prefix all LDFLAGS with "-Wl,", +dnl because we pass them to libtool +JK_PREFIX_IF_MISSING(APXSLDFLAGS, [-Wl,]) + AC_SUBST(APXSLDFLAGS) if ${TEST} -n "${JK_JNI_WORKER}" ; then Modified: tomcat/connectors/trunk/jk/native/scripts/build/jk_common.m4 URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/scripts/build/jk_common.m4?rev=697070&r1=697069&r2=697070&view=diff ============================================================================== --- tomcat/connectors/trunk/jk/native/scripts/build/jk_common.m4 (original) +++ tomcat/connectors/trunk/jk/native/scripts/build/jk_common.m4 Fri Sep 19 05:42:26 2008 @@ -50,5 +50,28 @@ undefine([AC_CV_NAME])dnl ]) - - +dnl +dnl JK_PREFIX_IF_MISSING(variable, prefix) +dnl +dnl Prefix all tokens in a variable with "prefix" unless +dnl it is already there. +dnl +AC_DEFUN([JK_PREFIX_IF_MISSING], [ + jk_new_val="" + jk_val_changed=0 + for i in $$1; do + case $i in + $2*) + jk_new_val="$jk_new_val $i" + ;; + *) + jk_new_val="$jk_new_val $2$i" + jk_val_changed=1 + ;; + esac + done + if test $jk_val_changed = "1"; then + AC_MSG_NOTICE(tokens in $1 have been prefixed with '[$2]') + $1=$jk_new_val + fi +]) dnl --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]