zz40-xc-ovr.m4: fix 'wc' detection - follow-up

- Take into account that 'wc' may return leading spaces and/or tabs.

- Set initial IFS to space, tab and newline.
This commit is contained in:
Yang Tse 2013-01-30 15:46:46 +01:00
parent 38131d415b
commit ddd40a43aa
1 changed files with 20 additions and 8 deletions

View File

@ -51,10 +51,18 @@ XC_CONFIGURE_PREAMBLE_VER_MINOR ##
xc_configure_preamble_ver_major='XC_CONFIGURE_PREAMBLE_VER_MAJOR'
xc_configure_preamble_ver_minor='XC_CONFIGURE_PREAMBLE_VER_MINOR'
xc_configure_preamble_prev_IFS=$IFS
#
# Set IFS to space, tab and newline.
#
xc_space=' '
xc_tab=' '
xc_newline='
'
IFS="$xc_space$xc_tab$xc_newline"
#
# Set internationalization behavior variables
# Set internationalization behavior variables.
#
LANG='C'
@ -64,6 +72,10 @@ export LANG
export LC_ALL
export LANGUAGE
#
# Some useful variables.
#
xc_msg_warn='configure: WARNING:'
xc_msg_abrt='Can not continue.'
xc_msg_err='configure: error:'
@ -263,9 +275,9 @@ AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_VAR_PATH])dnl
# Verify that 'tr' utility is found within 'PATH', otherwise abort.
#
xc_tst_str='98s7u6c5c4e3s2s10'
xc_tst_str='${xc_tab}98s7u6c5c4e3s2s10'
xc_tst_str=`echo "$xc_tst_str" 2>/dev/null \
| tr -d '0123456789' 2>/dev/null`
| tr -d "0123456789$xc_tab" 2>/dev/null`
case "x$xc_tst_str" in @%:@ ((
xsuccess)
:
@ -294,7 +306,7 @@ AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_TR])dnl
xc_tst_str='unknown unknown unknown unknown'
xc_tst_str=`echo "$xc_tst_str" 2>/dev/null \
| wc -w 2>/dev/null | tr -d ' ' 2>/dev/null`
| wc -w 2>/dev/null | tr -d "$xc_space$xc_tab" 2>/dev/null`
case "x$xc_tst_str" in @%:@ ((
x4)
:
@ -322,7 +334,8 @@ AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_WC])dnl
#
xc_tst_str='unknown'
xc_tst_str=`cat <<_EOT 2>/dev/null | wc -l 2>/dev/null | tr -d ' ' 2>/dev/null
xc_tst_str=`cat <<_EOT 2>/dev/null \
| wc -l 2>/dev/null | tr -d "$xc_space$xc_tab" 2>/dev/null
unknown
unknown
unknown
@ -425,8 +438,7 @@ AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_TR])dnl
AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_WC])dnl
AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_CAT])dnl
AC_REQUIRE([_XC_CFG_PRE_CHECK_PATH_SEPARATOR])dnl
IFS=$xc_configure_preamble_prev_IFS
dnl
xc_configure_preamble_result='yes'
])