From: Akim Demaille Date: Thu, 21 Jun 2001 09:18:16 +0000 (+0000) Subject: ./configure --program-suffix=foo produces `transform=s,$$,foo,;', X-Git-Tag: AUTOCONF-2.50a~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=21c5ee474bc14af7573dff87f17ec8d43c9fcb65;p=thirdparty%2Fautoconf.git ./configure --program-suffix=foo produces `transform=s,$$,foo,;', but some sed choke on multiple `;', and other tools (e.g., Automake), include the separator themselves. * acgeneral.m4 (AC_ARG_VAR): Be sure not to leave extra `;'. --- diff --git a/ChangeLog b/ChangeLog index 4c631e4c9..60698bed2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2001-06-21 Akim Demaille + + ./configure --program-suffix=foo produces `transform=s,$$,foo,;', + but some sed choke on multiple `;', and other tools (e.g., + Automake), include the separator themselves. + + * acgeneral.m4 (AC_ARG_VAR): Be sure not to leave extra `;'. + 2001-06-19 Tim Van Holder * doc/autoconf.texi (Functions Portability): Rename as... diff --git a/NEWS b/NEWS index 1e6eb06ec..94e90e34f 100644 --- a/NEWS +++ b/NEWS @@ -24,6 +24,7 @@ of the first one. - AC_ARG_VAR properly propagates precious variables inherited from the environment to ./config.status. +- Using --program-suffix/--program-prefix is portable. ** Generic macros - AC_CHECK_HEADER and AC_CHECK_HEADERS support a fourth argument to diff --git a/acgeneral.m4 b/acgeneral.m4 index 44e17c518..f26d79422 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -1570,9 +1570,9 @@ dnl it's sensitive. Putting any kind of quote in it causes syntax errors. esac fi done -if $ac_suggest_removing_cache; then - AC_MSG_WARN([changes in the environment can compromise the build]) - AC_MSG_WARN([consider removing $cache_file and starting over]) +if $ac_cache_corrupted; then + AS_MESSAGE([error: changes in the environment can compromise the build]) + AS_ERROR([run `make distclean' and/or `rm $config_cache' and start over]) fi ])# _AC_ARG_VAR_VALIDATE @@ -1615,24 +1615,18 @@ Program names: --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names m4_divert_pop([HELP_BEGIN])dnl -if test "$program_transform_name" = s,x,x,; then - program_transform_name= -else - # Double any \ or $. echo might interpret backslashes. - cat <<\EOF >conftest.sed -s,\\,\\\\,g; s,\$,$$,g -EOF - program_transform_name=`echo $program_transform_name | sed -f conftest.sed` - rm -f conftest.sed -fi test "$program_prefix" != NONE && - program_transform_name="s,^,${program_prefix},;$program_transform_name" + program_transform_name="s,^,$program_prefix,;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && - program_transform_name="s,\$\$,${program_suffix},;$program_transform_name" - -# sed with no file args requires a program. -test -z "$program_transform_name" && program_transform_name="s,x,x," + program_transform_name="s,\$,$program_suffix,;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +[s/[\\$]/&&/g;s/;s,x,x,$//] +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm conftest.sed ])# AC_ARG_PROGRAM diff --git a/configure b/configure index f877296f5..b343d382a 100755 --- a/configure +++ b/configure @@ -1042,24 +1042,18 @@ fi rm -f conftest* echo "$as_me:1043: result: yes" >&5 echo "${ECHO_T}yes" >&6 -if test "$program_transform_name" = s,x,x,; then - program_transform_name= -else - # Double any \ or $. echo might interpret backslashes. - cat <<\EOF >conftest.sed -s,\\,\\\\,g; s,\$,$$,g -EOF - program_transform_name=`echo $program_transform_name | sed -f conftest.sed` - rm -f conftest.sed -fi test "$program_prefix" != NONE && - program_transform_name="s,^,${program_prefix},;$program_transform_name" + program_transform_name="s,^,$program_prefix,;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && - program_transform_name="s,\$\$,${program_suffix},;$program_transform_name" - -# sed with no file args requires a program. -test -z "$program_transform_name" && program_transform_name="s,x,x," + program_transform_name="s,\$,$program_suffix,;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm conftest.sed test x"${MISSING+set}" = xset || MISSING="\${SHELL} `CDPATH=:; cd $ac_aux_dir && pwd`/missing" @@ -1069,11 +1063,11 @@ if eval "$MISSING --run true"; then else am_missing_run= am_backtick='`' - { echo "$as_me:1072: WARNING: ${am_backtick}missing' script is too old or missing" >&5 + { echo "$as_me:1066: WARNING: ${am_backtick}missing' script is too old or missing" >&5 echo "$as_me: WARNING: ${am_backtick}missing' script is too old or missing" >&2;} fi -echo "$as_me:1076: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "$as_me:1070: checking whether ${MAKE-make} sets \${MAKE}" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then @@ -1093,11 +1087,11 @@ fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$as_me:1096: result: yes" >&5 + echo "$as_me:1090: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else - echo "$as_me:1100: result: no" >&5 + echo "$as_me:1094: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi @@ -1107,7 +1101,7 @@ PACKAGE=autoconf VERSION=2.50a if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then - { { echo "$as_me:1110: error: source directory already configured; run \"make distclean\" there first" >&5 + { { echo "$as_me:1104: error: source directory already configured; run \"make distclean\" there first" >&5 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } fi @@ -1137,7 +1131,7 @@ AUTOTEST_PATH=.. # Extract the first word of "expr", so it can be a program name with args. set dummy expr; ac_word=$2 -echo "$as_me:1140: checking for $ac_word" >&5 +echo "$as_me:1134: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_EXPR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1154,7 +1148,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_EXPR="$ac_dir/$ac_word" - echo "$as_me:1157: found $ac_dir/$ac_word" >&5 + echo "$as_me:1151: found $ac_dir/$ac_word" >&5 break fi done @@ -1165,10 +1159,10 @@ fi EXPR=$ac_cv_path_EXPR if test -n "$EXPR"; then - echo "$as_me:1168: result: $EXPR" >&5 + echo "$as_me:1162: result: $EXPR" >&5 echo "${ECHO_T}$EXPR" >&6 else - echo "$as_me:1171: result: no" >&5 + echo "$as_me:1165: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1180,7 +1174,7 @@ for ac_prog in gm4 gnum4 m4 do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo "$as_me:1183: checking for $ac_word" >&5 +echo "$as_me:1177: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_M4+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1197,7 +1191,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_M4="$ac_dir/$ac_word" - echo "$as_me:1200: found $ac_dir/$ac_word" >&5 + echo "$as_me:1194: found $ac_dir/$ac_word" >&5 break fi done @@ -1208,10 +1202,10 @@ fi M4=$ac_cv_path_M4 if test -n "$M4"; then - echo "$as_me:1211: result: $M4" >&5 + echo "$as_me:1205: result: $M4" >&5 echo "${ECHO_T}$M4" >&6 else - echo "$as_me:1214: result: no" >&5 + echo "$as_me:1208: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1219,7 +1213,7 @@ fi done test -n "$M4" || M4="m4" -echo "$as_me:1222: checking whether m4 supports frozen files" >&5 +echo "$as_me:1216: checking whether m4 supports frozen files" >&5 echo $ECHO_N "checking whether m4 supports frozen files... $ECHO_C" >&6 if test "${ac_cv_prog_gnu_m4+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1231,10 +1225,10 @@ if test x"$M4" != x; then esac fi fi -echo "$as_me:1234: result: $ac_cv_prog_gnu_m4" >&5 +echo "$as_me:1228: result: $ac_cv_prog_gnu_m4" >&5 echo "${ECHO_T}$ac_cv_prog_gnu_m4" >&6 if test x"$ac_cv_prog_gnu_m4" != xyes; then - { { echo "$as_me:1237: error: GNU m4 1.4 is required" >&5 + { { echo "$as_me:1231: error: GNU m4 1.4 is required" >&5 echo "$as_me: error: GNU m4 1.4 is required" >&2;} { (exit 1); exit 1; }; } fi @@ -1246,7 +1240,7 @@ for ac_prog in mawk gawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo "$as_me:1249: checking for $ac_word" >&5 +echo "$as_me:1243: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1261,7 +1255,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_AWK="$ac_prog" -echo "$as_me:1264: found $ac_dir/$ac_word" >&5 +echo "$as_me:1258: found $ac_dir/$ac_word" >&5 break done @@ -1269,10 +1263,10 @@ fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then - echo "$as_me:1272: result: $AWK" >&5 + echo "$as_me:1266: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6 else - echo "$as_me:1275: result: no" >&5 + echo "$as_me:1269: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1286,7 +1280,7 @@ HELP2MAN=${HELP2MAN-"${am_missing_run}help2man"} # We use a path for perl so the #! line in autoscan will work. # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 -echo "$as_me:1289: checking for $ac_word" >&5 +echo "$as_me:1283: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_PERL+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1303,7 +1297,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_PERL="$ac_dir/$ac_word" - echo "$as_me:1306: found $ac_dir/$ac_word" >&5 + echo "$as_me:1300: found $ac_dir/$ac_word" >&5 break fi done @@ -1315,17 +1309,17 @@ fi PERL=$ac_cv_path_PERL if test -n "$PERL"; then - echo "$as_me:1318: result: $PERL" >&5 + echo "$as_me:1312: result: $PERL" >&5 echo "${ECHO_T}$PERL" >&6 else - echo "$as_me:1321: result: no" >&5 + echo "$as_me:1315: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "$PERL" != no; then PERLSCRIPTS="autoscan autoupdate" else - { echo "$as_me:1328: WARNING: autoscan and autoupdate will not be built since perl is not found" >&5 + { echo "$as_me:1322: WARNING: autoscan and autoupdate will not be built since perl is not found" >&5 echo "$as_me: WARNING: autoscan and autoupdate will not be built since perl is not found" >&2;} fi @@ -1341,7 +1335,7 @@ fi # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. -echo "$as_me:1344: checking for a BSD compatible install" >&5 +echo "$as_me:1338: checking for a BSD compatible install" >&5 echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then @@ -1390,7 +1384,7 @@ fi INSTALL=$ac_install_sh fi fi -echo "$as_me:1393: result: $INSTALL" >&5 +echo "$as_me:1387: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. @@ -1514,7 +1508,7 @@ rm -f confdef2opt.sed : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:1517: creating $CONFIG_STATUS" >&5 +{ echo "$as_me:1511: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL @@ -1682,7 +1676,7 @@ cat >>$CONFIG_STATUS <<\EOF echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header - { { echo "$as_me:1685: error: ambiguous option: $1 + { { echo "$as_me:1679: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} @@ -1710,12 +1704,12 @@ Try \`$0 --help' for more information." >&2;} 'tests/atconfig' ) CONFIG_FILES="$CONFIG_FILES tests/atconfig" ;; # This is an error. - -*) { { echo "$as_me:1713: error: unrecognized option: $1 + -*) { { echo "$as_me:1707: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; - *) { { echo "$as_me:1718: error: invalid argument: $1" >&5 + *) { { echo "$as_me:1712: error: invalid argument: $1" >&5 echo "$as_me: error: invalid argument: $1" >&2;} { (exit 1); exit 1; }; };; esac @@ -1943,7 +1937,7 @@ done; } esac if test x"$ac_file" != x-; then - { echo "$as_me:1946: creating $ac_file" >&5 + { echo "$as_me:1940: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi @@ -1961,7 +1955,7 @@ echo "$as_me: creating $ac_file" >&6;} -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:1964: error: cannot find input file: $f" >&5 + test -f "$f" || { { echo "$as_me:1958: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; @@ -1974,7 +1968,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;} echo $srcdir/$f else # /dev/null tree - { { echo "$as_me:1977: error: cannot find input file: $f" >&5 + { { echo "$as_me:1971: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; diff --git a/doc/autoconf.texi b/doc/autoconf.texi index ae8f66653..63358a42a 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -8431,6 +8431,14 @@ of a character class. In conformance with @sc{posix}, the Cray Sed scripts should not use branch labels longer than 8 characters and should not contain comments. +Don't include extra @samp{;}, as some @command{sed}, such as NetBSD +1.4.2's, try to interpret the second as a command: + +@example +$ echo a | sed 's/x/x/;;s/x/x/' +sed: 1: "s/x/x/;;s/x/x/": invalid command code ; +@end example + Input should have reasonably long lines, since some @command{sed} have an input buffer limited to 4000 bytes. @@ -9078,10 +9086,12 @@ the same name. For example, if you configure @sc{gnu} @code{diff} with installed as @file{/usr/local/bin/gdiff}. As a more sophisticated example, you could use + @example --program-transform-name='s/^/g/; s/^gg/g/; s/^gless/less/' @end example @noindent + to prepend @samp{g} to most of the program names in a source tree, excepting those like @code{gdb} that already have one and those like @code{less} and @code{lesskey} that aren't @sc{gnu} programs. (That is @@ -9130,6 +9140,15 @@ uninstall: done @end example +It is guaranteed that @code{program_transform_name} is never empty, and +that there are no useless separators. Therefore you may safely embed +@code{program_transform_name} within a sed program using @samp{;}: + +@example +transform = @@program_transform_name@@ +transform_exe = s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/ +@end example + Whether to do the transformations on documentation files (Texinfo or @code{man}) is a tricky question; there seems to be no perfect answer, due to the several reasons for name transforming. Documentation is not diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index 44e17c518..f26d79422 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -1570,9 +1570,9 @@ dnl it's sensitive. Putting any kind of quote in it causes syntax errors. esac fi done -if $ac_suggest_removing_cache; then - AC_MSG_WARN([changes in the environment can compromise the build]) - AC_MSG_WARN([consider removing $cache_file and starting over]) +if $ac_cache_corrupted; then + AS_MESSAGE([error: changes in the environment can compromise the build]) + AS_ERROR([run `make distclean' and/or `rm $config_cache' and start over]) fi ])# _AC_ARG_VAR_VALIDATE @@ -1615,24 +1615,18 @@ Program names: --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names m4_divert_pop([HELP_BEGIN])dnl -if test "$program_transform_name" = s,x,x,; then - program_transform_name= -else - # Double any \ or $. echo might interpret backslashes. - cat <<\EOF >conftest.sed -s,\\,\\\\,g; s,\$,$$,g -EOF - program_transform_name=`echo $program_transform_name | sed -f conftest.sed` - rm -f conftest.sed -fi test "$program_prefix" != NONE && - program_transform_name="s,^,${program_prefix},;$program_transform_name" + program_transform_name="s,^,$program_prefix,;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && - program_transform_name="s,\$\$,${program_suffix},;$program_transform_name" - -# sed with no file args requires a program. -test -z "$program_transform_name" && program_transform_name="s,x,x," + program_transform_name="s,\$,$program_suffix,;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +[s/[\\$]/&&/g;s/;s,x,x,$//] +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm conftest.sed ])# AC_ARG_PROGRAM diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4 index d3210e83f..a0036e17d 100644 --- a/lib/m4sugar/m4sh.m4 +++ b/lib/m4sugar/m4sh.m4 @@ -220,8 +220,8 @@ m4_define([_AS_QUOTE], $1])]) -# _AS_ECHO(STRING, [FD = AS_FD_MSG]) -# ---------------------------------- +# _AS_ECHO(STRING, [FD = AS_MESSAGE_FD]) +# -------------------------------------- # Protect STRING from backquote expansion, echo the result to FD. m4_define([_AS_ECHO], [_AS_ECHO_UNQUOTED([_AS_QUOTE([$1])], [$2])]) diff --git a/m4sh.m4 b/m4sh.m4 index d3210e83f..a0036e17d 100644 --- a/m4sh.m4 +++ b/m4sh.m4 @@ -220,8 +220,8 @@ m4_define([_AS_QUOTE], $1])]) -# _AS_ECHO(STRING, [FD = AS_FD_MSG]) -# ---------------------------------- +# _AS_ECHO(STRING, [FD = AS_MESSAGE_FD]) +# -------------------------------------- # Protect STRING from backquote expansion, echo the result to FD. m4_define([_AS_ECHO], [_AS_ECHO_UNQUOTED([_AS_QUOTE([$1])], [$2])])