From: Bruno Haible Date: Sun, 18 Jun 2023 20:37:32 +0000 (+0200) Subject: configmake: Bypass the unusable 'echo' command of some shells. X-Git-Tag: v1.0~1206 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=78c49e3cac0859417b818be1823242cd31259b60;p=gnulib.git configmake: Bypass the unusable 'echo' command of some shells. Reported by Brian Inglis in . * m4/build-to-host.m4 (gl_BUILD_TO_HOST): Use 'printf' instead of 'echo', because the "dash" shell has a SystemV compatible 'echo' command. Also, be sure to remove trailing CRs. --- diff --git a/ChangeLog b/ChangeLog index f4b9116d42..15d375bbb6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2023-06-18 Bruno Haible + + configmake: Bypass the unusable 'echo' command of some shells. + Reported by Brian Inglis in + . + * m4/build-to-host.m4 (gl_BUILD_TO_HOST): Use 'printf' instead of + 'echo', because the "dash" shell has a SystemV compatible 'echo' + command. Also, be sure to remove trailing CRs. + 2023-06-18 Paul Eggert update-copyright tests: fix to match behavior diff --git a/m4/build-to-host.m4 b/m4/build-to-host.m4 index e3c72877f0..8964ee84a4 100644 --- a/m4/build-to-host.m4 +++ b/m4/build-to-host.m4 @@ -1,4 +1,4 @@ -# build-to-host.m4 serial 1 +# build-to-host.m4 serial 2 dnl Copyright (C) 2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -47,12 +47,12 @@ AC_DEFUN([gl_BUILD_TO_HOST], ;; esac dnl Convert it to C string syntax. - [$1]_c=`echo "$gl_final_[$1]" | sed -e "$gl_sed_double_backslashes" -e "$gl_sed_escape_doublequotes"` + [$1]_c=`printf '%s\n' "$gl_final_[$1]" | sed -e "$gl_sed_double_backslashes" -e "$gl_sed_escape_doublequotes" | tr -d "$gl_tr_cr"` [$1]_c='"'"$[$1]_c"'"' AC_SUBST([$1_c]) dnl Define somedir_c_make. - [$1]_c_make=`echo "$[$1]_c" | sed -e "$gl_sed_escape_for_make_1" -e "$gl_sed_escape_for_make_2"` + [$1]_c_make=`printf '%s\n' "$[$1]_c" | sed -e "$gl_sed_escape_for_make_1" -e "$gl_sed_escape_for_make_2" | tr -d "$gl_tr_cr"` dnl Use the substituted somedir variable, when possible, so that the user dnl may adjust somedir a posteriori when there are no special characters. if test "$[$1]_c_make" = '\"'"${gl_final_[$1]}"'\"'; then @@ -70,4 +70,10 @@ changequote(,)dnl gl_sed_escape_for_make_1="s,\\([ \"&'();<>\\\\\`|]\\),\\\\\\1,g" changequote([,])dnl gl_sed_escape_for_make_2='s,\$,\\$$,g' + dnl Find out how to remove carriage returns from output. Solaris /usr/ucb/tr + dnl does not understand '\r'. + case `echo r | tr -d '\r'` in + '') gl_tr_cr='\015' ;; + *) gl_tr_cr='\r' ;; + esac ])