-AC_DEFUN([DX_DO], [m4_do([$1], [m4_map([m4_newline], m4_cdr($@))])])
+AC_DEFUN([DX_DO], [m4_do([$1], [m4_map_args([m4_newline], m4_shift($@))])])
+
+dnl DX_VAR_NORMALIZE_SPACE(varname)
+dnl Trim leading and trailing whitespace from a shell variable, and replace
+dnl consecutive sequences of internal whitespace with a single space.
+AC_DEFUN([DX_VAR_NORMALIZE_SPACE], [set -f; set x $$1; shift; $1=$[]* set +f])