[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Simplify cwrapper handling a bit
From: |
Ralf Wildenhues |
Subject: |
Simplify cwrapper handling a bit |
Date: |
Tue, 11 Nov 2008 07:05:49 +0100 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
OK to apply?
FWIW, IFS splitting of $list in
for item in $list; do ... done
is done once, at the beginning of the list.
Thanks,
Ralf
2008-11-11 Ralf Wildenhues <address@hidden>
Simplify cwrapper handling a bit.
* libltdl/config/ltmain.m4sh (func_emit_wrapper_part1)
(func_emit_wrapper_part2, func_to_host_path)
(func_to_host_pathlist, func_emit_wrapper): Simplify using
default argument, func_append.
diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
index 005c6a8..a382758 100644
--- a/libltdl/config/ltmain.m4sh
+++ b/libltdl/config/ltmain.m4sh
@@ -2306,10 +2306,7 @@ func_extract_archives ()
# func_emit_wrapper(), below.
func_emit_wrapper_part1 ()
{
- func_emit_wrapper_part1_arg1=no
- if test -n "$1" ; then
- func_emit_wrapper_part1_arg1=$1
- fi
+ func_emit_wrapper_part1_arg1=${1-no}
$ECHO "\
#! $SHELL
@@ -2404,10 +2401,7 @@ else
# func_emit_wrapper(), below.
func_emit_wrapper_part2 ()
{
- func_emit_wrapper_part2_arg1=no
- if test -n "$1" ; then
- func_emit_wrapper_part2_arg1=$1
- fi
+ func_emit_wrapper_part2_arg1=${1-no}
$ECHO "\
@@ -2549,15 +2543,10 @@ fi\
# behavior.
func_emit_wrapper ()
{
- func_emit_wrapper_arg1=no
- if test -n "$1" ; then
- func_emit_wrapper_arg1=$1
- fi
-
# split this up so that func_emit_cwrapperexe_src
# can call each part independently.
- func_emit_wrapper_part1 "${func_emit_wrapper_arg1}"
- func_emit_wrapper_part2 "${func_emit_wrapper_arg1}"
+ func_emit_wrapper_part1 ${1-no}
+ func_emit_wrapper_part2 ${1-no}
}
@@ -2592,16 +2581,12 @@ func_to_host_path ()
case $build in
*mingw* ) # actually, msys
# awkward: cmd appends spaces to result
- lt_sed_strip_trailing_spaces="s/[ ]*\$//"
- func_to_host_path_tmp1=`( cmd //c echo "$1" |\
- $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
- func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
- $SED -e "$lt_sed_naive_backslashify"`
+ func_to_host_path_result=`( cmd //c echo "$1" ) 2>/dev/null |
+ $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
;;
*cygwin* )
- func_to_host_path_tmp1=`cygpath -w "$1"`
- func_to_host_path_result=`$ECHO "$func_to_host_path_tmp1" |\
- $SED -e "$lt_sed_naive_backslashify"`
+ func_to_host_path_result=`cygpath -w "$1" |
+ $SED -e "$lt_sed_naive_backslashify"`
;;
* )
# Unfortunately, winepath does not exit with a non-zero
@@ -2611,14 +2596,8 @@ func_to_host_path ()
# *an error message* to stdout. So we must check for both
# error code of zero AND non-empty stdout, which explains
# the odd construction:
- func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
- if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
- func_to_host_path_result=`$ECHO "$func_to_host_path_tmp1" |\
- $SED -e "$lt_sed_naive_backslashify"`
- else
- # Allow warning below.
- func_to_host_path_result=""
- fi
+ func_to_host_path_result=`( winepath -w "$1" ) 2>/dev/null |
+ $SED -e "$lt_sed_naive_backslashify"`
;;
esac
if test -z "$func_to_host_path_result" ; then
@@ -2663,23 +2642,17 @@ func_to_host_pathlist ()
# Remove leading and trailing path separator characters from
# ARG. msys behavior is inconsistent here, cygpath turns them
# into '.;' and ';.', and winepath ignores them completely.
- func_to_host_pathlist_tmp2="$1"
- # Once set for this call, this variable should not be
- # reassigned. It is used in tha fallback case.
- func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\
- $SED -e 's|^:*||' -e 's|:*$||'`
+ func_stripname : : "$1"
+ func_to_host_pathlist_tmp1=$func_stripname_result
case $build in
*mingw* ) # Actually, msys.
# Awkward: cmd appends spaces to result.
- lt_sed_strip_trailing_spaces="s/[ ]*\$//"
- func_to_host_pathlist_tmp2=`( cmd //c echo
"$func_to_host_pathlist_tmp1" |\
- $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
- func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
- $SED -e "$lt_sed_naive_backslashify"`
+ func_to_host_pathlist_result=`
+ ( cmd //c echo "$func_to_host_pathlist_tmp1" ) 2>/dev/null |
+ $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
;;
*cygwin* )
- func_to_host_pathlist_tmp2=`cygpath -w -p
"$func_to_host_pathlist_tmp1"`
- func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
+ func_to_host_pathlist_result=`cygpath -w -p
"$func_to_host_pathlist_tmp1" |
$SED -e "$lt_sed_naive_backslashify"`
;;
* )
@@ -2695,11 +2668,10 @@ func_to_host_pathlist ()
if test -z "$func_to_host_pathlist_result" ; then
func_to_host_pathlist_result="$func_to_host_path_result"
else
-
func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result"
+ func_append func_to_host_pathlist_result
";$func_to_host_path_result"
fi
fi
fi
- IFS=:
done
IFS=$func_to_host_pathlist_oldIFS
;;
@@ -2723,7 +2695,7 @@ func_to_host_pathlist ()
;;
esac
case "$1" in
- *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;"
+ *: ) func_append func_to_host_pathlist_result ";"
;;
esac
;;
- Simplify cwrapper handling a bit,
Ralf Wildenhues <=