Skip to content
Snippets Groups Projects
Commit be760bed authored by Yang Tse's avatar Yang Tse
Browse files

Ensure that shell variable contents which have active meaning

to the shell echo command are not interpreted when trying to
remove extra whitespace from shell variable content.
parent 35738315
No related branches found
No related tags found
No related merge requests found
......@@ -886,13 +886,13 @@ AC_SUBST(CARES_PRIVATE_LIBS)
dnl squeeze whitespace out of some variables
CFLAGS=`eval echo $CFLAGS`
CPPFLAGS=`eval echo $CPPFLAGS`
DEFS=`eval echo $DEFS`
LDFLAGS=`eval echo $LDFLAGS`
LIBS=`eval echo $LIBS`
squeeze CFLAGS
squeeze CPPFLAGS
squeeze DEFS
squeeze LDFLAGS
squeeze LIBS
CARES_PRIVATE_LIBS=`eval echo $CARES_PRIVATE_LIBS`
squeeze CARES_PRIVATE_LIBS
AC_CONFIG_FILES([Makefile libcares.pc])
AC_OUTPUT
......@@ -16,7 +16,7 @@
#***************************************************************************
# File version for 'aclocal' use. Keep it a single number.
# serial 34
# serial 35
dnl CARES_CHECK_COMPILER
......@@ -378,6 +378,7 @@ dnl headers from these locations, even though this is
dnl not reliable on ancient GNUC versions.
AC_DEFUN([CARES_CONVERT_INCLUDE_TO_ISYSTEM], [
AC_REQUIRE([CARES_SHFUNC_SQUEEZE])dnl
tmp_has_include="no"
tmp_chg_FLAGS=$CFLAGS
for word1 in $tmp_chg_FLAGS; do
......@@ -390,7 +391,8 @@ AC_DEFUN([CARES_CONVERT_INCLUDE_TO_ISYSTEM], [
if test "$tmp_has_include" = "yes"; then
tmp_chg_FLAGS=`echo $tmp_chg_FLAGS | sed 's/^-I/ -isystem /g'`
tmp_chg_FLAGS=`echo $tmp_chg_FLAGS | sed 's/ -I/ -isystem /g'`
CFLAGS=`eval echo $tmp_chg_FLAGS`
CFLAGS="$tmp_chg_FLAGS"
squeeze CFLAGS
fi
tmp_has_include="no"
tmp_chg_FLAGS=$CPPFLAGS
......@@ -404,7 +406,8 @@ AC_DEFUN([CARES_CONVERT_INCLUDE_TO_ISYSTEM], [
if test "$tmp_has_include" = "yes"; then
tmp_chg_FLAGS=`echo $tmp_chg_FLAGS | sed 's/^-I/ -isystem /g'`
tmp_chg_FLAGS=`echo $tmp_chg_FLAGS | sed 's/ -I/ -isystem /g'`
CPPFLAGS=`eval echo $tmp_chg_FLAGS`
CPPFLAGS="$tmp_chg_FLAGS"
squeeze CPPFLAGS
fi
])
......@@ -487,6 +490,7 @@ dnl options.
AC_DEFUN([CARES_SET_COMPILER_BASIC_OPTS], [
AC_REQUIRE([CARES_CHECK_COMPILER])dnl
AC_REQUIRE([CARES_SHFUNC_SQUEEZE])dnl
#
if test "$compiler_id" != "unknown"; then
#
......@@ -615,13 +619,15 @@ AC_DEFUN([CARES_SET_COMPILER_BASIC_OPTS], [
#
esac
#
tmp_CPPFLAGS=`eval echo $tmp_CPPFLAGS`
tmp_CFLAGS=`eval echo $tmp_CFLAGS`
squeeze tmp_CPPFLAGS
squeeze tmp_CFLAGS
#
if test ! -z "$tmp_CFLAGS" || test ! -z "$tmp_CPPFLAGS"; then
AC_MSG_CHECKING([if compiler accepts some basic options])
CPPFLAGS=`eval echo $tmp_save_CPPFLAGS $tmp_CPPFLAGS`
CFLAGS=`eval echo $tmp_save_CFLAGS $tmp_CFLAGS`
CPPFLAGS="$tmp_save_CPPFLAGS $tmp_CPPFLAGS"
CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS"
squeeze CPPFLAGS
squeeze CFLAGS
CARES_COMPILER_WORKS_IFELSE([
AC_MSG_RESULT([yes])
AC_MSG_NOTICE([compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS])
......@@ -646,6 +652,7 @@ dnl on configure's debug option.
AC_DEFUN([CARES_SET_COMPILER_DEBUG_OPTS], [
AC_REQUIRE([CARES_CHECK_OPTION_DEBUG])dnl
AC_REQUIRE([CARES_CHECK_COMPILER])dnl
AC_REQUIRE([CARES_SHFUNC_SQUEEZE])dnl
#
if test "$compiler_id" != "unknown"; then
#
......@@ -667,8 +674,10 @@ AC_DEFUN([CARES_SET_COMPILER_DEBUG_OPTS], [
tmp_options="$flags_dbg_off"
fi
#
CPPFLAGS=`eval echo $tmp_CPPFLAGS`
CFLAGS=`eval echo $tmp_CFLAGS $tmp_options`
CPPFLAGS="$tmp_CPPFLAGS"
CFLAGS="$tmp_CFLAGS $tmp_options"
squeeze CPPFLAGS
squeeze CFLAGS
CARES_COMPILER_WORKS_IFELSE([
AC_MSG_RESULT([yes])
AC_MSG_NOTICE([compiler options added: $tmp_options])
......@@ -692,6 +701,7 @@ dnl on configure's optimize option.
AC_DEFUN([CARES_SET_COMPILER_OPTIMIZE_OPTS], [
AC_REQUIRE([CARES_CHECK_OPTION_OPTIMIZE])dnl
AC_REQUIRE([CARES_CHECK_COMPILER])dnl
AC_REQUIRE([CARES_SHFUNC_SQUEEZE])dnl
#
if test "$compiler_id" != "unknown"; then
#
......@@ -740,8 +750,10 @@ AC_DEFUN([CARES_SET_COMPILER_OPTIMIZE_OPTS], [
AC_MSG_CHECKING([if compiler accepts optimizer disabling options])
tmp_options="$flags_opt_off"
fi
CPPFLAGS=`eval echo $tmp_CPPFLAGS`
CFLAGS=`eval echo $tmp_CFLAGS $tmp_options`
CPPFLAGS="$tmp_CPPFLAGS"
CFLAGS="$tmp_CFLAGS $tmp_options"
squeeze CPPFLAGS
squeeze CFLAGS
CARES_COMPILER_WORKS_IFELSE([
AC_MSG_RESULT([yes])
AC_MSG_NOTICE([compiler options added: $tmp_options])
......@@ -766,6 +778,7 @@ dnl configure's warnings given option.
AC_DEFUN([CARES_SET_COMPILER_WARNING_OPTS], [
AC_REQUIRE([CARES_CHECK_OPTION_WARNINGS])dnl
AC_REQUIRE([CARES_CHECK_COMPILER])dnl
AC_REQUIRE([CARES_SHFUNC_SQUEEZE])dnl
#
if test "$compiler_id" != "unknown"; then
#
......@@ -982,13 +995,15 @@ AC_DEFUN([CARES_SET_COMPILER_WARNING_OPTS], [
#
esac
#
tmp_CPPFLAGS=`eval echo $tmp_CPPFLAGS`
tmp_CFLAGS=`eval echo $tmp_CFLAGS`
squeeze tmp_CPPFLAGS
squeeze tmp_CFLAGS
#
if test ! -z "$tmp_CFLAGS" || test ! -z "$tmp_CPPFLAGS"; then
AC_MSG_CHECKING([if compiler accepts strict warning options])
CPPFLAGS=`eval echo $tmp_save_CPPFLAGS $tmp_CPPFLAGS`
CFLAGS=`eval echo $tmp_save_CFLAGS $tmp_CFLAGS`
CPPFLAGS="$tmp_save_CPPFLAGS $tmp_CPPFLAGS"
CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS"
squeeze CPPFLAGS
squeeze CFLAGS
CARES_COMPILER_WORKS_IFELSE([
AC_MSG_RESULT([yes])
AC_MSG_NOTICE([compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS])
......@@ -1005,6 +1020,28 @@ AC_DEFUN([CARES_SET_COMPILER_WARNING_OPTS], [
])
dnl CARES_SHFUNC_SQUEEZE
dnl -------------------------------------------------
dnl Declares a shell function squeeze() which removes
dnl redundant whitespace out of a shell variable.
AC_DEFUN([CARES_SHFUNC_SQUEEZE], [
squeeze() {
_sqz_result=""
eval _sqz_input=\[$][$]1
for _sqz_token in $_sqz_input; do
if test -z "$_sqz_result"; then
_sqz_result="$_sqz_token"
else
_sqz_result="$_sqz_result $_sqz_token"
fi
done
eval [$]1=\$_sqz_result
return 0
}
])
dnl CARES_PROCESS_DEBUG_BUILD_OPTS
dnl -------------------------------------------------
dnl Settings which depend on configure's debug given
......@@ -1013,6 +1050,7 @@ dnl Don't use this macro for compiler dependant stuff.
AC_DEFUN([CARES_PROCESS_DEBUG_BUILD_OPTS], [
AC_REQUIRE([CARES_CHECK_OPTION_DEBUG])dnl
AC_REQUIRE([CARES_SHFUNC_SQUEEZE])dnl
AC_BEFORE([$0],[AC_PROG_LIBTOOL])dnl
#
if test "$want_debug" = "yes"; then
......@@ -1031,6 +1069,7 @@ AC_DEFUN([CARES_PROCESS_DEBUG_BUILD_OPTS], [
dnl CHECKME: Do we still need so specify this include path here?
CPPFLAGS="$CPPFLAGS -I$srcdir/../include"
squeeze CPPFLAGS
fi
#
])
......@@ -1094,6 +1133,7 @@ dnl as whitespace separated lists of words. Each word
dnl from VALUE is removed from VARNAME when present.
AC_DEFUN([CARES_VAR_STRIP], [
AC_REQUIRE([CARES_SHFUNC_SQUEEZE])dnl
ac_var_stripped=""
for word1 in $[$1]; do
ac_var_strip_word="no"
......@@ -1107,5 +1147,7 @@ AC_DEFUN([CARES_VAR_STRIP], [
fi
done
dnl squeeze whitespace out of result
[$1]=`eval echo $ac_var_stripped`
[$1]="$ac_var_stripped"
squeeze [$1]
])
......@@ -2534,15 +2534,15 @@ AC_SUBST(SUPPORT_PROTOCOLS)
dnl squeeze whitespace out of some variables
CFLAGS=`eval echo $CFLAGS`
CPPFLAGS=`eval echo $CPPFLAGS`
DEFS=`eval echo $DEFS`
LDFLAGS=`eval echo $LDFLAGS`
LIBS=`eval echo $LIBS`
CURL_LIBS=`eval echo $CURL_LIBS`
LIBCURL_LIBS=`eval echo $LIBCURL_LIBS`
TEST_SERVER_LIBS=`eval echo $TEST_SERVER_LIBS`
squeeze CFLAGS
squeeze CPPFLAGS
squeeze DEFS
squeeze LDFLAGS
squeeze LIBS
squeeze CURL_LIBS
squeeze LIBCURL_LIBS
squeeze TEST_SERVER_LIBS
AC_CONFIG_FILES([Makefile \
docs/Makefile \
......
......@@ -22,7 +22,7 @@
#***************************************************************************
# File version for 'aclocal' use. Keep it a single number.
# serial 33
# serial 34
dnl CURL_CHECK_COMPILER
......@@ -384,6 +384,7 @@ dnl headers from these locations, even though this is
dnl not reliable on ancient GNUC versions.
AC_DEFUN([CURL_CONVERT_INCLUDE_TO_ISYSTEM], [
AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
tmp_has_include="no"
tmp_chg_FLAGS=$CFLAGS
for word1 in $tmp_chg_FLAGS; do
......@@ -396,7 +397,8 @@ AC_DEFUN([CURL_CONVERT_INCLUDE_TO_ISYSTEM], [
if test "$tmp_has_include" = "yes"; then
tmp_chg_FLAGS=`echo $tmp_chg_FLAGS | sed 's/^-I/ -isystem /g'`
tmp_chg_FLAGS=`echo $tmp_chg_FLAGS | sed 's/ -I/ -isystem /g'`
CFLAGS=`eval echo $tmp_chg_FLAGS`
CFLAGS="$tmp_chg_FLAGS"
squeeze CFLAGS
fi
tmp_has_include="no"
tmp_chg_FLAGS=$CPPFLAGS
......@@ -410,7 +412,8 @@ AC_DEFUN([CURL_CONVERT_INCLUDE_TO_ISYSTEM], [
if test "$tmp_has_include" = "yes"; then
tmp_chg_FLAGS=`echo $tmp_chg_FLAGS | sed 's/^-I/ -isystem /g'`
tmp_chg_FLAGS=`echo $tmp_chg_FLAGS | sed 's/ -I/ -isystem /g'`
CPPFLAGS=`eval echo $tmp_chg_FLAGS`
CPPFLAGS="$tmp_chg_FLAGS"
squeeze CPPFLAGS
fi
])
......@@ -493,6 +496,7 @@ dnl options.
AC_DEFUN([CURL_SET_COMPILER_BASIC_OPTS], [
AC_REQUIRE([CURL_CHECK_COMPILER])dnl
AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
#
if test "$compiler_id" != "unknown"; then
#
......@@ -621,13 +625,15 @@ AC_DEFUN([CURL_SET_COMPILER_BASIC_OPTS], [
#
esac
#
tmp_CPPFLAGS=`eval echo $tmp_CPPFLAGS`
tmp_CFLAGS=`eval echo $tmp_CFLAGS`
squeeze tmp_CPPFLAGS
squeeze tmp_CFLAGS
#
if test ! -z "$tmp_CFLAGS" || test ! -z "$tmp_CPPFLAGS"; then
AC_MSG_CHECKING([if compiler accepts some basic options])
CPPFLAGS=`eval echo $tmp_save_CPPFLAGS $tmp_CPPFLAGS`
CFLAGS=`eval echo $tmp_save_CFLAGS $tmp_CFLAGS`
CPPFLAGS="$tmp_save_CPPFLAGS $tmp_CPPFLAGS"
CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS"
squeeze CPPFLAGS
squeeze CFLAGS
CURL_COMPILER_WORKS_IFELSE([
AC_MSG_RESULT([yes])
AC_MSG_NOTICE([compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS])
......@@ -652,6 +658,7 @@ dnl on configure's debug option.
AC_DEFUN([CURL_SET_COMPILER_DEBUG_OPTS], [
AC_REQUIRE([CURL_CHECK_OPTION_DEBUG])dnl
AC_REQUIRE([CURL_CHECK_COMPILER])dnl
AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
#
if test "$compiler_id" != "unknown"; then
#
......@@ -673,8 +680,10 @@ AC_DEFUN([CURL_SET_COMPILER_DEBUG_OPTS], [
tmp_options="$flags_dbg_off"
fi
#
CPPFLAGS=`eval echo $tmp_CPPFLAGS`
CFLAGS=`eval echo $tmp_CFLAGS $tmp_options`
CPPFLAGS="$tmp_CPPFLAGS"
CFLAGS="$tmp_CFLAGS $tmp_options"
squeeze CPPFLAGS
squeeze CFLAGS
CURL_COMPILER_WORKS_IFELSE([
AC_MSG_RESULT([yes])
AC_MSG_NOTICE([compiler options added: $tmp_options])
......@@ -698,6 +707,7 @@ dnl on configure's optimize option.
AC_DEFUN([CURL_SET_COMPILER_OPTIMIZE_OPTS], [
AC_REQUIRE([CURL_CHECK_OPTION_OPTIMIZE])dnl
AC_REQUIRE([CURL_CHECK_COMPILER])dnl
AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
#
if test "$compiler_id" != "unknown"; then
#
......@@ -746,8 +756,10 @@ AC_DEFUN([CURL_SET_COMPILER_OPTIMIZE_OPTS], [
AC_MSG_CHECKING([if compiler accepts optimizer disabling options])
tmp_options="$flags_opt_off"
fi
CPPFLAGS=`eval echo $tmp_CPPFLAGS`
CFLAGS=`eval echo $tmp_CFLAGS $tmp_options`
CPPFLAGS="$tmp_CPPFLAGS"
CFLAGS="$tmp_CFLAGS $tmp_options"
squeeze CPPFLAGS
squeeze CFLAGS
CURL_COMPILER_WORKS_IFELSE([
AC_MSG_RESULT([yes])
AC_MSG_NOTICE([compiler options added: $tmp_options])
......@@ -772,6 +784,7 @@ dnl configure's warnings given option.
AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
AC_REQUIRE([CURL_CHECK_OPTION_WARNINGS])dnl
AC_REQUIRE([CURL_CHECK_COMPILER])dnl
AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
#
if test "$compiler_id" != "unknown"; then
#
......@@ -988,13 +1001,15 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
#
esac
#
tmp_CPPFLAGS=`eval echo $tmp_CPPFLAGS`
tmp_CFLAGS=`eval echo $tmp_CFLAGS`
squeeze tmp_CPPFLAGS
squeeze tmp_CFLAGS
#
if test ! -z "$tmp_CFLAGS" || test ! -z "$tmp_CPPFLAGS"; then
AC_MSG_CHECKING([if compiler accepts strict warning options])
CPPFLAGS=`eval echo $tmp_save_CPPFLAGS $tmp_CPPFLAGS`
CFLAGS=`eval echo $tmp_save_CFLAGS $tmp_CFLAGS`
CPPFLAGS="$tmp_save_CPPFLAGS $tmp_CPPFLAGS"
CFLAGS="$tmp_save_CFLAGS $tmp_CFLAGS"
squeeze CPPFLAGS
squeeze CFLAGS
CURL_COMPILER_WORKS_IFELSE([
AC_MSG_RESULT([yes])
AC_MSG_NOTICE([compiler options added: $tmp_CFLAGS $tmp_CPPFLAGS])
......@@ -1011,6 +1026,28 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
])
dnl CURL_SHFUNC_SQUEEZE
dnl -------------------------------------------------
dnl Declares a shell function squeeze() which removes
dnl redundant whitespace out of a shell variable.
AC_DEFUN([CURL_SHFUNC_SQUEEZE], [
squeeze() {
_sqz_result=""
eval _sqz_input=\[$][$]1
for _sqz_token in $_sqz_input; do
if test -z "$_sqz_result"; then
_sqz_result="$_sqz_token"
else
_sqz_result="$_sqz_result $_sqz_token"
fi
done
eval [$]1=\$_sqz_result
return 0
}
])
dnl CURL_PROCESS_DEBUG_BUILD_OPTS
dnl -------------------------------------------------
dnl Settings which depend on configure's debug given
......@@ -1019,10 +1056,12 @@ dnl Don't use this macro for compiler dependant stuff.
AC_DEFUN([CURL_PROCESS_DEBUG_BUILD_OPTS], [
AC_REQUIRE([CURL_CHECK_OPTION_DEBUG])dnl
AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
AC_BEFORE([$0],[AC_PROG_LIBTOOL])dnl
#
if test "$want_debug" = "yes"; then
CPPFLAGS="$CPPFLAGS -DCURLDEBUG"
squeeze CPPFLAGS
fi
#
])
......@@ -1086,6 +1125,7 @@ dnl as whitespace separated lists of words. Each word
dnl from VALUE is removed from VARNAME when present.
AC_DEFUN([CURL_VAR_STRIP], [
AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
ac_var_stripped=""
for word1 in $[$1]; do
ac_var_strip_word="no"
......@@ -1099,5 +1139,7 @@ AC_DEFUN([CURL_VAR_STRIP], [
fi
done
dnl squeeze whitespace out of result
[$1]=`eval echo $ac_var_stripped`
[$1]="$ac_var_stripped"
squeeze [$1]
])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment