[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
/floppy/patches/88-m4sh-PATH-SEPARATOR.patch
From: |
Akim Demaille |
Subject: |
/floppy/patches/88-m4sh-PATH-SEPARATOR.patch |
Date: |
Mon, 10 Sep 2001 09:18:24 +0200 |
Libtool will need to be adjusted. The question being, are there any release
of Libtool using ac_path_separator? In which case we need to leave a
compatibility variable :(
Index: ChangeLog
from Akim Demaille <address@hidden>
* lib/autoconf/autotest.m4 (AC_CONFIG_TESTDIR): Don't pass
PATH_SEPARATOR, let M4sh compute it.
* lib/m4sugar/m4sh.m4 (_AS_PATH_SEPARATOR_PREPARE): New.
* lib/autoconf/programs.m4 (AC_SHELL_PATH_WALK): Use PATH_SEPARATOR.
Move to...
* lib/m4sugar/m4sh.m4 (_AS_PATH_WALK): Here.
Simplify when the path is not a literal.
(AS_UNAME): Use it to report PATH.
* lib/autoconf/general.m4 (_AC_INIT_PREPARE_FS_SEPARATORS): Remove.
(_AC_INIT_DEFAULTS): AC_SUBST PATH_SEPARATOR.
* lib/autoconf/programs.m4 (AC_PROG_INSTALL): Use _AS_PATH_WALK.
* lib/autotest/general.m4 (AT_INIT): Use _AS_PATH_WALK to
normalize the path, and to look for victims.
* tests/semantics.at (AC_PATH_PROG & AC_PATH_PROGS)
(AC_CHECK_PROG & AC_CHECK_PROGS): Use PATH_SEPARATOR.
Index: lib/autoconf/autotest.m4
--- lib/autoconf/autotest.m4 Thu, 06 Sep 2001 23:00:27 +0200 akim
+++ lib/autoconf/autotest.m4 Sun, 09 Sep 2001 20:42:06 +0200 akim
@@ -60,7 +60,7 @@
# into all the build dirs of AUTOTEST-PATH, then all the src dirs.
AC_DEFUN([AC_CONFIG_TESTDIR],
[AC_CONFIG_COMMANDS([$1/atconfig],
-[cat >$1/atconfig <<_ACEOF
+[cat >$1/atconfig <<_ATEOF
@%:@ Configurable variable values for building test suites.
@%:@ Generated by $[0]
@%:@ Copyright 2000, 2001 Free Software Foundation, Inc.
@@ -81,8 +81,7 @@ AC_DEFUN([AC_CONFIG_TESTDIR],
AUTOTEST_PATH='m4_default([$2], [$1])'
SHELL=\${CONFIG_SHELL-'$at_shell'}
-PATH_SEPARATOR='$at_path_separator'
-_ACEOF
+_ATEOF
],
[at_package_name='$PACKAGE_NAME'
at_package_version='$PACKAGE_VERSION'
@@ -93,7 +92,6 @@ AC_DEFUN([AC_CONFIG_TESTDIR],
at_c='$ECHO_C'
at_shell='$SHELL'
-at_path_separator='$PATH_SEPARATOR'
])
if test -f $srcdir/$1/atlocal.in; then
Index: lib/autoconf/general.m4
--- lib/autoconf/general.m4 Thu, 30 Aug 2001 16:11:54 +0200 akim
+++ lib/autoconf/general.m4 Sun, 09 Sep 2001 20:09:54 +0200 akim
@@ -484,8 +484,10 @@ m4_define([_AC_INIT_DEFAULTS],
ac_default_prefix=/usr/local
cross_compiling=no
subdirs=
-MFLAGS= MAKEFLAGS=
-AC_SUBST(SHELL, ${CONFIG_SHELL-/bin/sh})dnl
+MFLAGS=
+MAKEFLAGS=
+AC_SUBST([SHELL], [${CONFIG_SHELL-/bin/sh}])dnl
+AC_SUBST([PATH_SEPARATOR])dnl
# Maximum number of lines to put in a shell here document.
# This variable seems obsolete. It should probably be removed, and
@@ -1147,29 +1149,13 @@ m4_define([_AC_INIT_CONFIG_LOG],
AS_UNAME >&AS_MESSAGE_LOG_FD
cat >&AS_MESSAGE_LOG_FD <<_ACEOF
+
+
m4_text_box([Core tests.])
_ACEOF
])])# _AC_INIT_CONFIG_LOG
-# _AC_INIT_PREPARE_FS_SEPARATORS
-# ------------------------------
-# Compute the directory and path separators.
-# FIXME: Full version should include dir separator, documentation about
-# AC_SUBST'ed variables etc.
-m4_define([_AC_INIT_PREPARE_FS_SEPARATORS],
-[echo "#! $SHELL" >conftest.sh
-echo "exit 0" >>conftest.sh
-chmod +x conftest.sh
-if AC_RUN_LOG([PATH=".;."; conftest.sh]); then
- ac_path_separator=';'
-else
- ac_path_separator=:
-fi
-AC_SUBST([PATH_SEPARATOR], "$ac_path_separator")dnl
-rm -f conftest.sh
-])
-
# _AC_INIT_PREPARE
# ----------------
@@ -1249,13 +1235,12 @@ m4_define([_AC_INIT_PREPARE],
AC_SITE_LOAD
AC_CACHE_LOAD
_AC_ARG_VAR_VALIDATE
-_AC_ARG_VAR_PRECIOUS(build_alias)dnl
-_AC_ARG_VAR_PRECIOUS(host_alias)dnl
-_AC_ARG_VAR_PRECIOUS(target_alias)dnl
+_AC_ARG_VAR_PRECIOUS([build_alias])dnl
+_AC_ARG_VAR_PRECIOUS([host_alias])dnl
+_AC_ARG_VAR_PRECIOUS([target_alias])dnl
AC_LANG_PUSH(C)
_AC_PROG_ECHO()dnl
-_AC_INIT_PREPARE_FS_SEPARATORS
dnl Substitute for predefined variables.
AC_SUBST(DEFS)dnl
Index: lib/autoconf/programs.m4
--- lib/autoconf/programs.m4 Tue, 21 Aug 2001 11:14:47 +0200 akim
+++ lib/autoconf/programs.m4 Sun, 09 Sep 2001 20:13:57 +0200 akim
@@ -55,25 +55,6 @@
## ----------------------------- ##
-# AC_SHELL_PATH_WALK([PATH = $PATH], BODY)
-# ----------------------------------------
-# Walk through PATH running BODY for each `ac_dir'.
-#
-# `$ac_dummy' forces splitting on constant user-supplied paths.
-# POSIX.2 word splitting is done only on the output of word
-# expansions, not every word. This closes a longstanding sh security
-# hole.
-m4_define([AC_SHELL_PATH_WALK],
-[ac_save_IFS=$IFS; IFS=$ac_path_separator
-ac_dummy="m4_default([$1], [$PATH])"
-for ac_dir in $ac_dummy; do
- IFS=$ac_save_IFS
- test -z "$ac_dir" && ac_dir=.
- $2
-done
-])
-
-
# AC_CHECK_PROG(VARIABLE, PROG-TO-CHECK-FOR,
# [VALUE-IF-FOUND], [VALUE-IF-NOT-FOUND],
# [PATH], [REJECT])
@@ -88,15 +69,15 @@ AC_DEFUN([AC_CHECK_PROG],
else
m4_ifvaln([$6],
[ ac_prog_rejected=no])dnl
- AC_SHELL_PATH_WALK([$5],
-[AS_EXECUTABLE_P("$ac_dir/$ac_word") || continue
+ _AS_PATH_WALK([$5],
+[AS_EXECUTABLE_P("$as_dir/$ac_word") || continue
m4_ifvaln([$6],
-[if test "$ac_dir/$ac_word" = "$6"; then
+[if test "$as_dir/$ac_word" = "$6"; then
ac_prog_rejected=yes
continue
fi])dnl
ac_cv_prog_$1="$3"
-echo "$as_me:__oline__: found $ac_dir/$ac_word" >&AS_MESSAGE_LOG_FD
+echo "$as_me:__oline__: found $as_dir/$ac_word" >&AS_MESSAGE_LOG_FD
break])
m4_ifvaln([$6],
[if test $ac_prog_rejected = yes; then
@@ -108,7 +89,7 @@ AC_DEFUN([AC_CHECK_PROG],
# However, it has the same basename, so the bogon will be chosen
# first if we set $1 to just the basename; use the full file name.
shift
- set dummy "$ac_dir/$ac_word" ${1+"address@hidden"}
+ set dummy "$as_dir/$ac_word" ${1+"address@hidden"}
shift
ac_cv_prog_$1="address@hidden"
m4_if([$2], [$4],
@@ -158,10 +139,10 @@ AC_DEFUN([AC_PATH_PROG],
ac_cv_path_$1="$$1" # Let the user override the test with a path.
;;
*)
- AC_SHELL_PATH_WALK([$4],
-[if AS_EXECUTABLE_P("$ac_dir/$ac_word"); then
- ac_cv_path_$1="$ac_dir/$ac_word"
- echo "$as_me:__oline__: found $ac_dir/$ac_word" >&AS_MESSAGE_LOG_FD
+ _AS_PATH_WALK([$4],
+[if AS_EXECUTABLE_P("$as_dir/$ac_word"); then
+ ac_cv_path_$1="$as_dir/$ac_word"
+ echo "$as_me:__oline__: found $as_dir/$ac_word" >&AS_MESSAGE_LOG_FD
break
fi])
dnl If no 3rd arg is given, leave the cache variable unset,
@@ -316,37 +297,34 @@ AC_DEFUN([AC_PROG_INSTALL],
AC_MSG_CHECKING([for a BSD compatible install])
if test -z "$INSTALL"; then
AC_CACHE_VAL(ac_cv_path_install,
-[ ac_save_IFS=$IFS; IFS=$ac_path_separator
- for ac_dir in $PATH; do
- IFS=$ac_save_IFS
- # Account for people who put trailing slashes in PATH elements.
- case $ac_dir/ in
- / | ./ | .// | /[cC]/* \
- | /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* \
- | /usr/ucb/* ) ;;
- *)
- # OSF1 and SCO ODT 3.0 have their own names for install.
- # Don't use installbsd from OSF since it installs stuff as root
- # by default.
- for ac_prog in ginstall scoinst install; do
- if AS_EXECUTABLE_P(["$ac_dir/$ac_prog"]); then
- if test $ac_prog = install &&
- grep dspmsg "$ac_dir/$ac_prog" >/dev/null 2>&1; then
- # AIX install. It has an incompatible calling convention.
- :
- elif test $ac_prog = install &&
- grep pwplus "$ac_dir/$ac_prog" >/dev/null 2>&1; then
- # program-specific install script used by HP pwplus--don't use.
- :
- else
- ac_cv_path_install="$ac_dir/$ac_prog -c"
- break 2
- fi
- fi
- done
- ;;
- esac
- done
+[_AS_PATH_WALK([$PATH],
+[# Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+ ./ | .// | /[cC]/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ if AS_EXECUTABLE_P(["$as_dir/$ac_prog"]); then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ ac_cv_path_install="$as_dir/$ac_prog -c"
+ break 2
+ fi
+ fi
+ done
+ ;;
+esac])
])dnl
if test "${ac_cv_path_install+set}" = set; then
INSTALL=$ac_cv_path_install
Index: lib/autotest/general.m4
--- lib/autotest/general.m4 Thu, 06 Sep 2001 23:00:27 +0200 akim
+++ lib/autotest/general.m4 Sun, 09 Sep 2001 20:07:45 +0200 akim
@@ -260,44 +260,38 @@ Tests:
#
# There might be directories that don't exist, but don't redirect
# builtins' (eg., cd) stderr directly: Ultrix's sh hates that.
-at_IFS_save=$IFS
-IFS=$PATH_SEPARATOR
at_path=
-for at_dir in $AUTOTEST_PATH $PATH
-do
- case $at_dir in
- [[\\/]]* | ?:[[\\/]]* )
- at_path=$at_path$PATH_SEPARATOR$at_dir
- ;;
- * )
- if test -z "$top_builddir"; then
- # Stand-alone test suite.
- at_path=$at_path$PATH_SEPARATOR$at_dir
- else
- # Embedded test suite.
- at_path=$at_path$PATH_SEPARATOR$top_builddir/$at_dir
- at_path=$at_path$PATH_SEPARATOR$top_srcdir/$at_dir
- fi
- ;;
- esac
-done
+_AS_PATH_WALK([$AUTOTEST_PATH $PATH],
+[case $as_dir in
+ [[\\/]]* | ?:[[\\/]]* )
+ at_path=$at_path$PATH_SEPARATOR$as_dir
+ ;;
+ * )
+ if test -z "$top_builddir"; then
+ # Stand-alone test suite.
+ at_path=$at_path$PATH_SEPARATOR$as_dir
+ else
+ # Embedded test suite.
+ at_path=$at_path$PATH_SEPARATOR$top_builddir/$as_dir
+ at_path=$at_path$PATH_SEPARATOR$top_srcdir/$as_dir
+ fi
+ ;;
+esac])
+
# Now build and simplify PATH.
at_sep=
PATH=
-for at_dir in $at_path
-do
- at_dir=`(cd "$at_dir" && pwd) 2>/dev/null`
- test -d "$at_dir" || continue
- case $PATH in
- $at_dir | \
- $at_dir$PATH_SEPARATOR* | \
- *$PATH_SEPARATOR$at_dir | \
- *$PATH_SEPARATOR$at_dir$PATH_SEPARATOR* ) ;;
- *) PATH=$PATH$at_sep$at_dir
- at_sep=$PATH_SEPARATOR;;
- esac
-done
-IFS=$at_IFS_save
+_AS_PATH_WALK([$at_path],
+[as_dir=`(cd "$as_dir" && pwd) 2>/dev/null`
+test -d "$as_dir" || continue
+case $PATH in
+ $as_dir | \
+ $as_dir$PATH_SEPARATOR* | \
+ *$PATH_SEPARATOR$as_dir | \
+ *$PATH_SEPARATOR$as_dir$PATH_SEPARATOR* ) ;;
+ *) PATH=$PATH$at_sep$as_dir
+ at_sep=$PATH_SEPARATOR;;
+esac])
export PATH
# Can we diff with `/dev/null'? DU 5.0 refuses.
@@ -390,16 +384,20 @@ m4_define([AS_MESSAGE_LOG_FD], [6])
# what program is being used.
for at_program in $at_victims
do
+ _AS_PATH_WALK([$PATH],
+[if test -f $as_dir/$at_program; then
(
- echo "AT_LINE: $at_program --version"
- $at_program --version
+ echo "AT_LINE: $as_dir/$at_program --version"
+ $as_dir/$at_program --version
echo
) >&AS_MESSAGE_LOG_FD 2>&1
if test -n "$at_package_name" && test -n "$at_package_version"; then
- ($at_program --version |
+ ($as_dir/$at_program --version |
grep "$at_package_name.*$at_package_version") >/dev/null 2>&1 ||
- AS_ERROR([version mismatch (need $at_package_name $at_package_version):
$at_program])
+ AS_ERROR([version mismatch (need $at_package_name $at_package_version):
$as_dir/$at_program])
fi
+ break;
+fi])
done
{
Index: lib/m4sugar/m4sh.m4
--- lib/m4sugar/m4sh.m4 Thu, 06 Sep 2001 21:34:31 +0200 akim
+++ lib/m4sugar/m4sh.m4 Sun, 09 Sep 2001 20:36:30 +0200 akim
@@ -115,9 +115,10 @@ m4_define([_m4_divert(M4SH-INIT)],
_AS_EXPR_PREPARE
_AS_LN_S_PREPARE
+_AS_PATH_SEPARATOR_PREPARE
_AS_TEST_PREPARE
-_AS_UNSET_PREPARE
_AS_TR_PREPARE
+_AS_UNSET_PREPARE
# NLS nuisances.
AS_UNSET([LANG], [C])
@@ -398,6 +399,49 @@ m4_define([AS_ERROR],
])# _AS_LN_S_PREPARE
+# _AS_PATH_SEPARATOR_PREPARE
+# --------------------------
+# Compute the path separator.
+m4_define([_AS_PATH_SEPARATOR_PREPARE],
+[# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! $SHELL" >conftest.sh
+ echo "exit 0" >>conftest.sh
+ chmod +x conftest.sh
+ if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conftest.sh
+fi
+])# _AS_PATH_SEPARATOR_PREPARE
+
+
+# _AS_PATH_WALK([PATH = $PATH], BODY)
+# -----------------------------------
+# Walk through PATH running BODY for each `as_dir'.
+#
+# Still very private as its interface looks quite bad.
+#
+# `$as_dummy' forces splitting on constant user-supplied paths.
+# POSIX.2 word splitting is done only on the output of word
+# expansions, not every word. This closes a longstanding sh security
+# hole. Optimize it away when not needed.
+m4_define([_AS_PATH_WALK],
+[as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+AS_LITERAL_IF([m4_default([$1], [$PATH])],
+[as_dummy="$1"
+for as_dir in $as_dummy],
+[for as_dir in m4_default([$1], [$PATH])])
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ $2
+done
+])
+
+
# AS_LN_S(FILE, LINK)
# -------------------
# FIXME: Should we add the glue code to handle properly relative symlinks
@@ -572,13 +616,7 @@ m4_define([AS_UNAME],
_ASUNAME
-as_save_IFS=$IFS
-IFS=:
-for as_dir in $PATH
-do
- echo "PATH: $as_dir"
-done
-IFS=$as_save_IFS
+_AS_PATH_WALK([$PATH], [echo "PATH: $as_dir"])
}])
Index: tests/semantics.at
--- tests/semantics.at Fri, 31 Aug 2001 12:00:17 +0200 akim
+++ tests/semantics.at Sun, 09 Sep 2001 20:49:27 +0200 akim
@@ -286,7 +286,7 @@ m4_define([AT_CHECK_PROGS_PREPARE],
AT_DATA([configure.ac],
[[AC_INIT
pwd=`pwd`
-p="1${ac_path_separator}2${ac_path_separator}3${ac_path_separator}4${ac_path_separator}5${ac_path_separator}6"
+p="1${PATH_SEPARATOR}2${PATH_SEPARATOR}3${PATH_SEPARATOR}4${PATH_SEPARATOR}5${PATH_SEPARATOR}6"
path=`echo $p | sed -e 's,\([[0-9]]\),'"$pwd"'/path/\1,g'`
fail=false
@@ -372,7 +372,7 @@ m4_define([AT_CHECK_PROGS_PREPARE],
AT_DATA([configure.ac],
[[AC_INIT
pwd=`pwd`
-p="1${ac_path_separator}2${ac_path_separator}3${ac_path_separator}4${ac_path_separator}5${ac_path_separator}6"
+p="1${PATH_SEPARATOR}2${PATH_SEPARATOR}3${PATH_SEPARATOR}4${PATH_SEPARATOR}5${PATH_SEPARATOR}6"
path=`echo $p | sed -e 's,\([[0-9]]\),'"$pwd"'/path/\1,g'`
fail=false
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- /floppy/patches/88-m4sh-PATH-SEPARATOR.patch,
Akim Demaille <=