diff posix-modules @ 13625:c2d737898a4e

Set PATH_SEPARATOR the same way autoconf does. * gnulib-tool (func_gnulib_dir): Determine the value of PATH_SEPARATOR the same way autoconf-generated configure scripts do. * posix-modules: Likewise.
author Stefano Lattarini <stefano.lattarini@gmail.com>
date Sat, 04 Sep 2010 11:01:27 +0200
parents 88d6d025ee3b
children 97fc9a21a8fb
line wrap: on
line diff
--- a/posix-modules	Fri Sep 03 06:07:11 2010 -0700
+++ b/posix-modules	Sat Sep 04 11:01:27 2010 +0200
@@ -115,15 +115,14 @@
       # explicit canonicalization command when $PATH contains no empty fields.
       self_abspathname=
       if test "${PATH_SEPARATOR+set}" != set; then
-        func_tmpdir
-        { echo "#! /bin/sh"; echo "exit 0"; } > "$tmp"/conf.sh
-        chmod +x "$tmp"/conf.sh
-        if (PATH="/nonexistent;$tmp"; conf.sh) >/dev/null 2>&1; then
-          PATH_SEPARATOR=';'
-        else
-          PATH_SEPARATOR=:
-        fi
-        rm -rf "$tmp"
+        # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
+        # contains only /bin. Note that ksh looks also at the FPATH variable,
+        # so we have to set that as well for the test.
+        PATH_SEPARATOR=:
+        (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+          && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+                 || PATH_SEPARATOR=';'
+             }
       fi
       if test "$PATH_SEPARATOR" = ";"; then
         # On Windows, programs are searched in "." before $PATH.