]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* lib/autoconf/autotest.m4 (AC_CONFIG_TESTDIR): Don't pass
authorAkim Demaille <akim@epita.fr>
Mon, 10 Sep 2001 07:17:41 +0000 (07:17 +0000)
committerAkim Demaille <akim@epita.fr>
Mon, 10 Sep 2001 07:17:41 +0000 (07:17 +0000)
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.

ChangeLog
lib/autoconf/autotest.m4
lib/autoconf/general.m4
lib/autoconf/programs.m4
lib/autotest/general.m4
lib/m4sugar/m4sh.m4
tests/semantics.at

index cf14cf96f8a398e48aa471acbe89141dc64b9875..508727f73771fecdfbb18f244841f21d2f622d05 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2001-09-10  Akim Demaille  <akim@epita.fr>
+
+       * 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.
+
 2001-09-07  Akim Demaille  <akim@epita.fr>
 
        * bin/autom4te.in (&handle_m4): `< /dev/null' so that GNU M4 1.5
index 205f239816a5debe3255549577495d3b06585be4..f79e90b13d259cd2849c7bb3f8fcc41c661e57d2 100644 (file)
@@ -83,7 +83,6 @@ top_builddir='$ac_top_builddir'
 AUTOTEST_PATH='m4_default([$2], [$1])'
 
 SHELL=\${CONFIG_SHELL-'$at_shell'}
-PATH_SEPARATOR='$at_path_separator'
 ATEOF
 ],
 [at_package_name='$PACKAGE_NAME'
@@ -95,7 +94,6 @@ at_n='$ECHO_N'
 at_c='$ECHO_C'
 
 at_shell='$SHELL'
-at_path_separator='$PATH_SEPARATOR'
 ])
 
 if test -f $srcdir/$1/atlocal.in; then
index c0e6055725dabd1b36b66920d800867d5ccf11b1..01410b1f82663d055ee4681d2e389914dcb7ed41 100644 (file)
@@ -484,8 +484,10 @@ exec AS_MESSAGE_FD>&1
 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 @@ _ACEOF
 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 @@ echo >confdefs.h
 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 6985d6cbf5f89e4525b4ec1212bc7a5115efef5a..8e7b2efd6fd4ad0a8d83d6718794672887c68bef 100644 (file)
 ## ----------------------------- ##
 
 
-# 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_CACHE_VAL(ac_cv_prog_$1,
 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 @@ m4_ifvaln([$6],
     # 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+"$[@]"}
+    set dummy "$as_dir/$ac_word" ${1+"$[@]"}
     shift
     ac_cv_prog_$1="$[@]"
 m4_if([$2], [$4],
@@ -158,10 +139,10 @@ AC_CACHE_VAL([ac_cv_path_$1],
   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 6d078664262f00a803ff9c078c613810ef2357d6..1978c4299a0fff19353d9f4cee439448f316d52b 100644 (file)
@@ -260,44 +260,38 @@ test -z "$at_tests" && at_tests=$at_tests_all
 #
 # 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 @@ fi
 # 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 33fdd678efa7a68c492f089503c54f051946baac..1d4b7c856e028ba92171c41c3a369fe4060eea40 100644 (file)
@@ -115,9 +115,10 @@ as_me=`AS_BASENAME($[0])`
 
 _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 @@ rm -f conf$$ conf$$.exe conf$$.file
 ])# _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 @@ hostinfo               = `(hostinfo) 2>/dev/null               || echo unknown`
 
 _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 2f5a9b349b45c4a1cfcc214855a854b487956e8f..1454c0b0efe64b86d25938d43925690429d94a26 100644 (file)
@@ -286,7 +286,7 @@ 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 @@ 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