Set PATH_SEPARATOR the same way autoconf does.
authorStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 4 Sep 2010 09:01:27 +0000 (11:01 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 4 Sep 2010 09:01:27 +0000 (11:01 +0200)
* gnulib-tool (func_gnulib_dir): Determine the value of PATH_SEPARATOR
the same way autoconf-generated configure scripts do.
* posix-modules: Likewise.

ChangeLog
gnulib-tool
posix-modules

index 5be2ceb..c3fdec4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-09-04  Stefano Lattarini  <stefano.lattarini@gmail.com>  (tiny change)
+
+       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.
+
 2010-09-02  Paul Eggert  <eggert@cs.ucla.edu>
 
        hash: fix safe_hasher const typo
index b606ad6..8168408 100755 (executable)
@@ -372,15 +372,14 @@ func_gnulib_dir ()
       # 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.
index 46de93d..b93b283 100755 (executable)
@@ -115,15 +115,14 @@ func_gnulib_dir ()
       # 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.