Pushed as obvious: While it looks large, the entire patch was made with a 5-line sed script that replaces "XSI" with "Extended shell" or similar as appropriate to each context, followed by some manual layout cleanups and a complete run of the testsuite.
* libltdl/m4/libtool.m4 (_LT_PROG_XSI_SHELLFNS): Rename to _LT_PROG_REPLACE_SHELLFNS. (_LT_PROG_XSI_REPLACE): Rename to _LT_PROG_FUNCTION_REPLACE. (_LT_PROG_FUNCTION_REPLACE): Change decorator comment to use 'Extended shell' rather than 'XSI' on successful replacement. * libltdl/config/general.m4sh (func_dirname, func_basename) (func_dirname_and_basename, func_stripname): Change decorator comment to use 'extended shell' rather than 'XSI' on fallback implementations. * libltdl/config/getopt.m4sh (func_split_short_opt) (func_split_long_opt): Ditto. * libltdl/config/ltmain.m4sh (func_append, func_append_quoted) (func_arith, func_len, func_lo2o, func_xform): Ditto. * tests/getopt-m4sh.at (_LT_AT_XSI_FUNC_EXTRACT): Rename to _LT_AT_EXTENDED_SHELL_FUNC_EXTRACT. (_LT_AT_EXTENDED_SHELL_FUNC_EXTRACT): Change regular expression to match new replacable function decorator comments. Signed-off-by: Gary V. Vaughan <g...@gnu.org> --- ChangeLog | 19 +++++++++++++++ libltdl/config/general.m4sh | 8 +++--- libltdl/config/getopt.m4sh | 4 +- libltdl/config/ltmain.m4sh | 12 +++++----- libltdl/m4/libtool.m4 | 52 +++++++++++++++++++++--------------------- tests/getopt-m4sh.at | 8 +++--- 6 files changed, 61 insertions(+), 42 deletions(-) diff --git a/ChangeLog b/ChangeLog index b180dc6..acb9e2b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,24 @@ 2010-07-08 Gary V. Vaughan <g...@gnu.org> + Rename _LT_PROG_XSI_REPLACE macro to _LT_PROG_FUNCTION_REPLACE. + * libltdl/m4/libtool.m4 (_LT_PROG_XSI_SHELLFNS): Rename to + _LT_PROG_REPLACE_SHELLFNS. + (_LT_PROG_XSI_REPLACE): Rename to _LT_PROG_FUNCTION_REPLACE. + (_LT_PROG_FUNCTION_REPLACE): Change decorator comment to use + 'Extended shell' rather than 'XSI' on successful replacement. + * libltdl/config/general.m4sh (func_dirname, func_basename) + (func_dirname_and_basename, func_stripname): Change decorator + comment to use 'extended shell' rather than 'XSI' on fallback + implementations. + * libltdl/config/getopt.m4sh (func_split_short_opt) + (func_split_long_opt): Ditto. + * libltdl/config/ltmain.m4sh (func_append, func_append_quoted) + (func_arith, func_len, func_lo2o, func_xform): Ditto. + * tests/getopt-m4sh.at (_LT_AT_XSI_FUNC_EXTRACT): Rename to + _LT_AT_EXTENDED_SHELL_FUNC_EXTRACT. + (_LT_AT_EXTENDED_SHELL_FUNC_EXTRACT): Change regular expression to + match new replacable function decorator comments. + Fix a cut-n-pasto in "2010-07-07 Charles Wilson" patch. * libltdl/config/ltmain.m4sh (func_mode_link): Remove spurious variable dereference. diff --git a/libltdl/config/general.m4sh b/libltdl/config/general.m4sh index 5d7bef7..1245fe5 100644 --- a/libltdl/config/general.m4sh +++ b/libltdl/config/general.m4sh @@ -84,14 +84,14 @@ func_dirname () else func_dirname_result="$func_dirname_result${2}" fi -} # func_dirname may be replaced by XSI optimised implementation +} # func_dirname may be replaced by extended shell implementation # func_basename file func_basename () { func_basename_result=`$ECHO "${1}" | $SED "$basename"` -} # func_basename may be replaced by XSI optimised implementation +} # func_basename may be replaced by extended shell implementation # func_dirname_and_basename file append nondir_replacement @@ -116,7 +116,7 @@ func_dirname_and_basename () func_dirname_result="$func_dirname_result${2}" fi func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` -} # func_dirname_and_basename may be replaced by XSI optimised implementation +} # func_dirname_and_basename may be replaced by extended shell implementation # func_stripname prefix suffix name @@ -131,7 +131,7 @@ func_stripname () .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac -} # func_stripname may be replaced by XSI optimised implementation +} # func_stripname may be replaced by extended shell implementation # These SED scripts presuppose an absolute path with a trailing slash. diff --git a/libltdl/config/getopt.m4sh b/libltdl/config/getopt.m4sh index e9da56f..806c1d4 100644 --- a/libltdl/config/getopt.m4sh +++ b/libltdl/config/getopt.m4sh @@ -628,7 +628,7 @@ func_split_short_opt () func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` -} # func_split_short_opt may be replaced by XSI optimised implementation +} # func_split_short_opt may be replaced by extended shell implementation # func_split_long_opt longopt @@ -641,7 +641,7 @@ func_split_long_opt () func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` -} # func_split_long_opt may be replaced by XSI optimised implementation +} # func_split_long_opt may be replaced by extended shell implementation exit_cmd=: ]]) diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh index 1a2c02d..8b7c72d 100644 --- a/libltdl/config/ltmain.m4sh +++ b/libltdl/config/ltmain.m4sh @@ -154,7 +154,7 @@ exec_cmd= func_append () { eval "${1}=\$${1}\${2}" -} # func_append may be replaced by XSI optimised implementation +} # func_append may be replaced by extended shell implementation # func_append_quoted var value # Quote VALUE and append to the end of shell variable VAR. @@ -162,14 +162,14 @@ func_append_quoted () { func_quote_for_eval "${2}" eval "${1}=\$${1}\\ \$func_quote_for_eval_result" -} # func_append_quoted may be replaced by XSI optimised implementation +} # func_append_quoted may be replaced by extended shell implementation # func_arith arithmetic-term... func_arith () { func_arith_result=`expr "$...@}"` -} # func_arith may be replaced by XSI optimised implementation +} # func_arith may be replaced by extended shell implementation # func_len string @@ -177,21 +177,21 @@ func_arith () func_len () { func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` -} # func_len may be replaced by XSI optimised implementation +} # func_len may be replaced by extended shell implementation # func_lo2o object func_lo2o () { func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` -} # func_lo2o may be replaced by XSI optimised implementation +} # func_lo2o may be replaced by extended shell implementation # func_xform libobj-or-source func_xform () { func_xform_result=`$ECHO "${1}" | $SED 's/\.[[^.]]*$/.lo/'` -} # func_xform may be replaced by XSI optimised implementation +} # func_xform may be replaced by extended shell implementation # func_fatal_configuration arg... diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4 index eeec7f5..83d03bf 100644 --- a/libltdl/m4/libtool.m4 +++ b/libltdl/m4/libtool.m4 @@ -752,7 +752,7 @@ _LT_EOF sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) - _LT_PROG_XSI_SHELLFNS + _LT_PROG_REPLACE_SHELLFNS mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") @@ -7453,77 +7453,77 @@ _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES -# _LT_PROG_XSI_REPLACE (FUNCNAME, REPLACEMENT-BODY) -# ------------------------------------------------- +# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) +# ------------------------------------------------------ # In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and # '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. -m4_defun([_LT_PROG_XSI_REPLACE], +m4_defun([_LT_PROG_FUNCTION_REPLACE], [dnl { sed -e '/^$1 ()$/,/^} # $1 /c\ $1 ()\ {\ m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) -} # XSI $1 implementation' "$cfgfile" > $cfgfile.tmp \ +} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_xsi_replace_fail=: +test 0 -eq $? || _lt_function_replace_fail=: ]) -# _LT_PROG_XSI_SHELLFNS -# --------------------- +# _LT_PROG_REPLACE_SHELLFNS +# ------------------------- # Replace existing portable implementations of several shell functions with -# equivalent XSI compatible implementations. -m4_defun([_LT_PROG_XSI_SHELLFNS], +# equivalent extended shell implementations where those features are available.. +m4_defun([_LT_PROG_REPLACE_SHELLFNS], [if test x"$xsi_shell" = xyes; then - _LT_PROG_XSI_REPLACE([func_dirname], [dnl + _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac]) - _LT_PROG_XSI_REPLACE([func_basename], [dnl + _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl func_basename_result="${1##*/}"]) - _LT_PROG_XSI_REPLACE([func_dirname_and_basename], [dnl + _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac func_basename_result="${1##*/}"]) - _LT_PROG_XSI_REPLACE([func_stripname], [dnl + _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary parameter first. func_stripname_result=${3} func_stripname_result=${func_stripname_result#"${1}"} func_stripname_result=${func_stripname_result%"${2}"}]) - _LT_PROG_XSI_REPLACE([func_split_long_opt], [dnl + _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl func_split_long_opt_name=${1%%=*} func_split_long_opt_arg=${1#*=}]) - _LT_PROG_XSI_REPLACE([func_split_short_opt], [dnl + _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) - _LT_PROG_XSI_REPLACE([func_lo2o], [dnl + _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl case ${1} in *.lo) func_lo2o_result=${1%.lo}.${objext} ;; *) func_lo2o_result=${1} ;; esac]) - _LT_PROG_XSI_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) + _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) - _LT_PROG_XSI_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) + _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) - _LT_PROG_XSI_REPLACE([func_len], [ func_len_result=${#1}]) + _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) fi if test x"$lt_shell_append" = xyes; then - _LT_PROG_XSI_REPLACE([func_append], [ eval "${1}+=\\${2}"]) + _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) - _LT_PROG_XSI_REPLACE([func_append_quoted], [dnl + _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl func_quote_for_eval "${2}" dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) @@ -7532,16 +7532,16 @@ dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") - test 0 -eq $? || _lt_xsi_replace_fail=: + test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") - test 0 -eq $? || _lt_xsi_replace_fail=: + test 0 -eq $? || _lt_function_replace_fail=: fi -if test x"$_lt_xsi_replace_fail" = x":"; then - AC_MSG_WARN([Unable to substitute faster XSI functions in $ofile]) +if test x"$_lt_function_replace_fail" = x":"; then + AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) fi ]) diff --git a/tests/getopt-m4sh.at b/tests/getopt-m4sh.at index 8373c8e..b5f23fd 100644 --- a/tests/getopt-m4sh.at +++ b/tests/getopt-m4sh.at @@ -69,13 +69,13 @@ $SED '1,/^# func_dirname/d' options >> options.tmp rm -f options && mv options.tmp options]) -# _LT_AT_XSI_FUNC_EXTRACT(FUNC-NAME) -# ---------------------------------- -# Extract the XSI decorated function FUNC-NAME from libtool +# _LT_AT_EXTENDED_SHELL_FUNC_EXTRACT(FUNC-NAME) +# --------------------------------------------- +# Extract the 'Extended-shell'-decorated function FUNC-NAME from libtool m4_define([_LT_AT_XSI_FUNC_EXTRACT], [dnl {{ $SED '/^# $1/q' options > options.tmp -$SED -n '/^$1 ()/,/^} # XSI $1 /p' $abs_top_builddir/libtool >> options.tmp +$SED -n '/^$1 ()/,/^} # Extended-shell $1 /p' $abs_top_builddir/libtool >> options.tmp $SED '1,/^} # $1 /d' options >> options.tmp rm -f options && mv options.tmp options]) -- 1.7.1