From 75a3a3d326a56516bfe6e76b3eb523661f1c763f Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Fri, 30 Mar 2001 12:49:36 +0000 Subject: [PATCH] * m4sh.m4 (AS_BASENAME): New. (AS_SHELL_SANITIZE): Set `$as_me'. * acgeneral.m4: Don't set as_me; AS_SHELL_SANITIZE now does this. * tests/atgeneral.m4: Likewise. (AT_INIT): Use $PATH_SEPARATOR for walking the path. * autoconf.sh: Be DOS-friendly when setting as_me and M4. Add quotes to support spaces in $tmp. Work around problem in DJGPP port of awk by using a temporary file. * autoheader.sh: Be DOS-friendly when setting as_me. * autoreconf.sh: Be DOS-friendly when setting as_me, dir and template_dir. --- ChangeLog | 14 ++++++++++++++ acgeneral.m4 | 12 ++++-------- autoconf.in | 19 ++++++++++++------- autoconf.sh | 19 ++++++++++++------- autoheader.in | 2 +- autoheader.sh | 2 +- autoreconf.in | 6 +++--- autoreconf.sh | 6 +++--- bin/autoconf.in | 19 ++++++++++++------- bin/autoheader.in | 2 +- bin/autoreconf.in | 6 +++--- lib/autoconf/general.m4 | 12 ++++-------- lib/autotest/general.m4 | 7 ++----- lib/m4sugar/m4sh.m4 | 13 ++++++++++++- m4sh.m4 | 13 ++++++++++++- tests/atgeneral.m4 | 7 ++----- 16 files changed, 98 insertions(+), 61 deletions(-) diff --git a/ChangeLog b/ChangeLog index d85db2b3..8db3564d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2001-03-30 Tim Van Holder + + * m4sh.m4 (AS_BASENAME): New. + (AS_SHELL_SANITIZE): Set `$as_me'. + * acgeneral.m4: Don't set as_me; AS_SHELL_SANITIZE now does this. + * tests/atgeneral.m4: Likewise. + (AT_INIT): Use $PATH_SEPARATOR for walking the path. + * autoconf.sh: Be DOS-friendly when setting as_me and M4. + Add quotes to support spaces in $tmp. + Work around problem in DJGPP port of awk by using a temporary file. + * autoheader.sh: Be DOS-friendly when setting as_me. + * autoreconf.sh: Be DOS-friendly when setting as_me, dir and + template_dir. + 2001-03-27 Lars J. Aas * acgeneral.m4 (AC_INIT_VERSION): Improved version information string diff --git a/acgeneral.m4 b/acgeneral.m4 index 45feb57a..c0a3d2c1 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -723,9 +723,6 @@ AS_SHELL_SANITIZE # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` -# Name of the executable. -as_me=`echo "$[0]" | sed 's,.*/,,'` - cat >config.log <$CONFIG_STATUS <<_ACEOF # configure, is in config.log if it exists. debug=false -as_me=\`echo "\$[0]" | sed 's,.*/,,'\` SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF @@ -4000,8 +3996,8 @@ AC_PROVIDE_IFELSE([AC_PROG_INSTALL], for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; - [[\\/$]]* | ?:[[\\/]]*) - # Absolute + [[\\/$]]*) + # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || AC_MSG_ERROR([cannot find input file: $f]) echo $f;; *) # Relative @@ -4147,8 +4143,8 @@ for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; - [[\\/$]]* | ?:[[\\/]]*) - # Absolute + [[\\/$]]*) + # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || AC_MSG_ERROR([cannot find input file: $f]) echo $f;; *) # Relative diff --git a/autoconf.in b/autoconf.in index 315b0341..2a2222eb 100644 --- a/autoconf.in +++ b/autoconf.in @@ -18,7 +18,7 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -me=`echo "$0" | sed -e 's,.*/,,'` +me=`echo "$0" | sed -e 's,.*[\\/],,'` usage="\ Usage: $0 [OPTION] ... [TEMPLATE-FILE] @@ -95,8 +95,8 @@ ac_LF_and_DOT=`echo; echo .` # Handle the case that m4 has moved since we were configured. # It may have been found originally in a build directory. : ${M4=@M4@} -case $M4 in -/*|[a-zA-Z]:*) test -f "$M4" || M4=m4 ;; +case "$M4" in + [\\/]* | ?:[\\/]*) test -f "$M4" || M4=m4 ;; esac # Some non-GNU m4's don't reject the --help option, so give them /dev/null. case `$M4 --help &1` in @@ -322,7 +322,7 @@ case $task in # Put the real line numbers into configure to make config.log more # helpful. Because quoting can sometimes get really painful in m4, # there are special @tokens@ to substitute. - sed 's/^ //' >$tmp/finalize.awk <"$tmp/finalize.awk" <&2" + # BAD! the pipe to 'cat >&2' doesn't work for DJGPP. + # print message | "cat >&2" + # Use normal redirection instead: + print message > "$tmp/finalize.err" } function undefined (file, line, macro) @@ -421,8 +424,10 @@ case $task in EOF $AWK -v tmp="$tmp" \ `$verbose "-v verbose=1"` \ - -f $tmp/finalize.awk <$tmp/configure >&4 || - { (exit 1); exit; } + -f "$tmp/finalize.awk" <$tmp/configure >&4 || + { test -f "$tmp/finalize.err" && cat "$tmp/finalize.err" >&2 + (exit 1); exit; } + test -f "$tmp/finalize.err" && cat "$tmp/finalize.err" >&2 ;; # End of the task script. diff --git a/autoconf.sh b/autoconf.sh index 315b0341..2a2222eb 100644 --- a/autoconf.sh +++ b/autoconf.sh @@ -18,7 +18,7 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -me=`echo "$0" | sed -e 's,.*/,,'` +me=`echo "$0" | sed -e 's,.*[\\/],,'` usage="\ Usage: $0 [OPTION] ... [TEMPLATE-FILE] @@ -95,8 +95,8 @@ ac_LF_and_DOT=`echo; echo .` # Handle the case that m4 has moved since we were configured. # It may have been found originally in a build directory. : ${M4=@M4@} -case $M4 in -/*|[a-zA-Z]:*) test -f "$M4" || M4=m4 ;; +case "$M4" in + [\\/]* | ?:[\\/]*) test -f "$M4" || M4=m4 ;; esac # Some non-GNU m4's don't reject the --help option, so give them /dev/null. case `$M4 --help &1` in @@ -322,7 +322,7 @@ case $task in # Put the real line numbers into configure to make config.log more # helpful. Because quoting can sometimes get really painful in m4, # there are special @tokens@ to substitute. - sed 's/^ //' >$tmp/finalize.awk <"$tmp/finalize.awk" <&2" + # BAD! the pipe to 'cat >&2' doesn't work for DJGPP. + # print message | "cat >&2" + # Use normal redirection instead: + print message > "$tmp/finalize.err" } function undefined (file, line, macro) @@ -421,8 +424,10 @@ case $task in EOF $AWK -v tmp="$tmp" \ `$verbose "-v verbose=1"` \ - -f $tmp/finalize.awk <$tmp/configure >&4 || - { (exit 1); exit; } + -f "$tmp/finalize.awk" <$tmp/configure >&4 || + { test -f "$tmp/finalize.err" && cat "$tmp/finalize.err" >&2 + (exit 1); exit; } + test -f "$tmp/finalize.err" && cat "$tmp/finalize.err" >&2 ;; # End of the task script. diff --git a/autoheader.in b/autoheader.in index d93f330a..800a7172 100644 --- a/autoheader.in +++ b/autoheader.in @@ -20,7 +20,7 @@ # Written by Roland McGrath. -me=`echo "$0" | sed -e 's,.*/,,'` +me=`echo "$0" | sed -e 's,.*[/\\],,'` usage="\ Usage: $0 [OPTION] ... [TEMPLATE-FILE] diff --git a/autoheader.sh b/autoheader.sh index d93f330a..800a7172 100644 --- a/autoheader.sh +++ b/autoheader.sh @@ -20,7 +20,7 @@ # Written by Roland McGrath. -me=`echo "$0" | sed -e 's,.*/,,'` +me=`echo "$0" | sed -e 's,.*[/\\],,'` usage="\ Usage: $0 [OPTION] ... [TEMPLATE-FILE] diff --git a/autoreconf.in b/autoreconf.in index 82297c66..78e1c232 100644 --- a/autoreconf.in +++ b/autoreconf.in @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -me=`echo "$0" | sed -e 's,.*/,,'` +me=`echo "$0" | sed -e 's,.*[\\/],,'` usage="\ Usage: $0 [OPTION] ... [TEMPLATE-FILE] @@ -91,7 +91,7 @@ if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi # Variables. : ${autoconf_dir=${AC_MACRODIR=@datadir@}} debug=false -dir=`echo "$0" | sed -e 's,[^/]*$,,'` +dir=`echo "$0" | sed -e 's,[^\\/]*$,,'` force=false # --install -- as --add-missing in other tools. install=false @@ -382,7 +382,7 @@ while read dir; do : colon s/:.*// '` - template_dir=`echo $template | sed 's,/*[^/]*$,,;s,^$,.,'` + template_dir=`echo $template | sed -e 's,[\\/]*[^\\/]*$,,;s,^$,.,'` stamp_num=`test "$tcount" -gt 1 && echo "$tcount"` stamp=$template_dir/stamp-h$stamp_num.in # If config.hin exists, don't override it unless it was really diff --git a/autoreconf.sh b/autoreconf.sh index 82297c66..78e1c232 100644 --- a/autoreconf.sh +++ b/autoreconf.sh @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -me=`echo "$0" | sed -e 's,.*/,,'` +me=`echo "$0" | sed -e 's,.*[\\/],,'` usage="\ Usage: $0 [OPTION] ... [TEMPLATE-FILE] @@ -91,7 +91,7 @@ if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi # Variables. : ${autoconf_dir=${AC_MACRODIR=@datadir@}} debug=false -dir=`echo "$0" | sed -e 's,[^/]*$,,'` +dir=`echo "$0" | sed -e 's,[^\\/]*$,,'` force=false # --install -- as --add-missing in other tools. install=false @@ -382,7 +382,7 @@ while read dir; do : colon s/:.*// '` - template_dir=`echo $template | sed 's,/*[^/]*$,,;s,^$,.,'` + template_dir=`echo $template | sed -e 's,[\\/]*[^\\/]*$,,;s,^$,.,'` stamp_num=`test "$tcount" -gt 1 && echo "$tcount"` stamp=$template_dir/stamp-h$stamp_num.in # If config.hin exists, don't override it unless it was really diff --git a/bin/autoconf.in b/bin/autoconf.in index 315b0341..2a2222eb 100644 --- a/bin/autoconf.in +++ b/bin/autoconf.in @@ -18,7 +18,7 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -me=`echo "$0" | sed -e 's,.*/,,'` +me=`echo "$0" | sed -e 's,.*[\\/],,'` usage="\ Usage: $0 [OPTION] ... [TEMPLATE-FILE] @@ -95,8 +95,8 @@ ac_LF_and_DOT=`echo; echo .` # Handle the case that m4 has moved since we were configured. # It may have been found originally in a build directory. : ${M4=@M4@} -case $M4 in -/*|[a-zA-Z]:*) test -f "$M4" || M4=m4 ;; +case "$M4" in + [\\/]* | ?:[\\/]*) test -f "$M4" || M4=m4 ;; esac # Some non-GNU m4's don't reject the --help option, so give them /dev/null. case `$M4 --help &1` in @@ -322,7 +322,7 @@ case $task in # Put the real line numbers into configure to make config.log more # helpful. Because quoting can sometimes get really painful in m4, # there are special @tokens@ to substitute. - sed 's/^ //' >$tmp/finalize.awk <"$tmp/finalize.awk" <&2" + # BAD! the pipe to 'cat >&2' doesn't work for DJGPP. + # print message | "cat >&2" + # Use normal redirection instead: + print message > "$tmp/finalize.err" } function undefined (file, line, macro) @@ -421,8 +424,10 @@ case $task in EOF $AWK -v tmp="$tmp" \ `$verbose "-v verbose=1"` \ - -f $tmp/finalize.awk <$tmp/configure >&4 || - { (exit 1); exit; } + -f "$tmp/finalize.awk" <$tmp/configure >&4 || + { test -f "$tmp/finalize.err" && cat "$tmp/finalize.err" >&2 + (exit 1); exit; } + test -f "$tmp/finalize.err" && cat "$tmp/finalize.err" >&2 ;; # End of the task script. diff --git a/bin/autoheader.in b/bin/autoheader.in index d93f330a..800a7172 100644 --- a/bin/autoheader.in +++ b/bin/autoheader.in @@ -20,7 +20,7 @@ # Written by Roland McGrath. -me=`echo "$0" | sed -e 's,.*/,,'` +me=`echo "$0" | sed -e 's,.*[/\\],,'` usage="\ Usage: $0 [OPTION] ... [TEMPLATE-FILE] diff --git a/bin/autoreconf.in b/bin/autoreconf.in index 82297c66..78e1c232 100644 --- a/bin/autoreconf.in +++ b/bin/autoreconf.in @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -me=`echo "$0" | sed -e 's,.*/,,'` +me=`echo "$0" | sed -e 's,.*[\\/],,'` usage="\ Usage: $0 [OPTION] ... [TEMPLATE-FILE] @@ -91,7 +91,7 @@ if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi # Variables. : ${autoconf_dir=${AC_MACRODIR=@datadir@}} debug=false -dir=`echo "$0" | sed -e 's,[^/]*$,,'` +dir=`echo "$0" | sed -e 's,[^\\/]*$,,'` force=false # --install -- as --add-missing in other tools. install=false @@ -382,7 +382,7 @@ while read dir; do : colon s/:.*// '` - template_dir=`echo $template | sed 's,/*[^/]*$,,;s,^$,.,'` + template_dir=`echo $template | sed -e 's,[\\/]*[^\\/]*$,,;s,^$,.,'` stamp_num=`test "$tcount" -gt 1 && echo "$tcount"` stamp=$template_dir/stamp-h$stamp_num.in # If config.hin exists, don't override it unless it was really diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index 45feb57a..c0a3d2c1 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -723,9 +723,6 @@ AS_SHELL_SANITIZE # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` -# Name of the executable. -as_me=`echo "$[0]" | sed 's,.*/,,'` - cat >config.log <$CONFIG_STATUS <<_ACEOF # configure, is in config.log if it exists. debug=false -as_me=\`echo "\$[0]" | sed 's,.*/,,'\` SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF @@ -4000,8 +3996,8 @@ AC_PROVIDE_IFELSE([AC_PROG_INSTALL], for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; - [[\\/$]]* | ?:[[\\/]]*) - # Absolute + [[\\/$]]*) + # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || AC_MSG_ERROR([cannot find input file: $f]) echo $f;; *) # Relative @@ -4147,8 +4143,8 @@ for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; - [[\\/$]]* | ?:[[\\/]]*) - # Absolute + [[\\/$]]*) + # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || AC_MSG_ERROR([cannot find input file: $f]) echo $f;; *) # Relative diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4 index fff5c97c..4283d0da 100644 --- a/lib/autotest/general.m4 +++ b/lib/autotest/general.m4 @@ -95,9 +95,6 @@ m4_divert_push([DEFAULT])dnl #! /bin/sh AS_SHELL_SANITIZE - -# Name of the executable. -as_me=`echo "$[0]" | sed 's,.*/,,'` SHELL=${CONFIG_SHELL-/bin/sh} . ./atconfig @@ -108,12 +105,12 @@ at_top_srcdir=`cd "$top_srcdir" && pwd` # Don't take risks: use absolute path names. at_path=`pwd` at_IFS_save=$IFS -IFS=: +IFS=$PATH_SEPARATOR for at_dir in $AUTOTEST_PATH $PATH; do # There might be directories that don't exist, but don't redirect # builtins' (eg., cd) stderr directly: Ultrix's sh hates that. at_dir=`(cd "$at_dir" && pwd) 2>/dev/null` - test -n "$at_dir" && at_path=$at_path:$at_dir + test -n "$at_dir" && at_path="$at_path$PATH_SEPARATOR$at_dir" done IFS=$at_IFS_save PATH=$at_path diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4 index fcd87c9d..b1dbbd51 100644 --- a/lib/m4sugar/m4sh.m4 +++ b/lib/m4sugar/m4sh.m4 @@ -66,6 +66,10 @@ elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi +# Name of the executable. +dnl Moved here because the tests below can use AC_MSG_ERROR, which uses $as_me +as_me=`AS_BASENAME($[0])` + _AS_EXPR_PREPARE _AS_LN_S_PREPARE _AS_TEST_PREPARE @@ -291,6 +295,13 @@ m4_defun([AS_DIRNAME], AS_DIRNAME_SED([$1])]) +# AS_BASENAME(PATHNAME) +# -------------------- +# Simulate running `basename(1)' on PATHNAME, not all systems have it. +# This macro must be usable from inside ` `. +m4_defun([AS_BASENAME], +[echo "$1" |sed 's,.*[[\\/]],,']) + # AS_EXECUTABLE_P # --------------- # Check whether a file is executable. @@ -317,7 +328,7 @@ fi # _AS_LN_S_PREPARE # ---------------- # Don't use conftest.sym to avoid filename issues on DJGPP, where this -# would yield conftest.sym.exe for DJGPP < 2.04. And do use `conftest' +# would yield conftest.sym.exe for DJGPP < 2.04. And don't use `conftest' # as base name to avoid prohibiting concurrency (e.g., concurrent # config.statuses). m4_defun([_AS_LN_S_PREPARE], diff --git a/m4sh.m4 b/m4sh.m4 index fcd87c9d..b1dbbd51 100644 --- a/m4sh.m4 +++ b/m4sh.m4 @@ -66,6 +66,10 @@ elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi +# Name of the executable. +dnl Moved here because the tests below can use AC_MSG_ERROR, which uses $as_me +as_me=`AS_BASENAME($[0])` + _AS_EXPR_PREPARE _AS_LN_S_PREPARE _AS_TEST_PREPARE @@ -291,6 +295,13 @@ m4_defun([AS_DIRNAME], AS_DIRNAME_SED([$1])]) +# AS_BASENAME(PATHNAME) +# -------------------- +# Simulate running `basename(1)' on PATHNAME, not all systems have it. +# This macro must be usable from inside ` `. +m4_defun([AS_BASENAME], +[echo "$1" |sed 's,.*[[\\/]],,']) + # AS_EXECUTABLE_P # --------------- # Check whether a file is executable. @@ -317,7 +328,7 @@ fi # _AS_LN_S_PREPARE # ---------------- # Don't use conftest.sym to avoid filename issues on DJGPP, where this -# would yield conftest.sym.exe for DJGPP < 2.04. And do use `conftest' +# would yield conftest.sym.exe for DJGPP < 2.04. And don't use `conftest' # as base name to avoid prohibiting concurrency (e.g., concurrent # config.statuses). m4_defun([_AS_LN_S_PREPARE], diff --git a/tests/atgeneral.m4 b/tests/atgeneral.m4 index fff5c97c..4283d0da 100644 --- a/tests/atgeneral.m4 +++ b/tests/atgeneral.m4 @@ -95,9 +95,6 @@ m4_divert_push([DEFAULT])dnl #! /bin/sh AS_SHELL_SANITIZE - -# Name of the executable. -as_me=`echo "$[0]" | sed 's,.*/,,'` SHELL=${CONFIG_SHELL-/bin/sh} . ./atconfig @@ -108,12 +105,12 @@ at_top_srcdir=`cd "$top_srcdir" && pwd` # Don't take risks: use absolute path names. at_path=`pwd` at_IFS_save=$IFS -IFS=: +IFS=$PATH_SEPARATOR for at_dir in $AUTOTEST_PATH $PATH; do # There might be directories that don't exist, but don't redirect # builtins' (eg., cd) stderr directly: Ultrix's sh hates that. at_dir=`(cd "$at_dir" && pwd) 2>/dev/null` - test -n "$at_dir" && at_path=$at_path:$at_dir + test -n "$at_dir" && at_path="$at_path$PATH_SEPARATOR$at_dir" done IFS=$at_IFS_save PATH=$at_path