Remove old, dead code in last commit.
[gnulib.git] / m4 / posix-shell.m4
index ac526d5..4c56193 100644 (file)
@@ -1,6 +1,6 @@
 # Find a POSIX-conforming shell.
 
-# Copyright (C) 2007 Free Software Foundation, Inc.
+# Copyright (C) 2007-2008 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -15,7 +15,7 @@
 AC_DEFUN([gl_POSIX_SHELL],
 [
   AC_CACHE_CHECK([for a shell that conforms to POSIX], [gl_cv_posix_shell],
-    [gl_test_POSIX_SHELL='
+    [gl_test_posix_shell_script='
        func_return () {
         (exit [$]1)
        }
@@ -31,18 +31,23 @@ AC_DEFUN([gl_POSIX_SHELL],
        func_ret_failure () {
         return 1
        }
+       subshell_umask_sanity () {
+        (umask 22; (umask 0); test $(umask) -eq 22)
+       }
        test "[$](echo foo)" = foo &&
        func_success &&
        ! func_failure &&
        func_ret_success &&
        ! func_ret_failure &&
-       (set x && func_ret_success y && test x = "[$]1")
+       (set x && func_ret_success y && test x = "[$]1") &&
+       subshell_umask_sanity
      '
      for gl_cv_posix_shell in \
         "$CONFIG_SHELL" "$SHELL" /bin/sh /bin/bash /bin/ksh /bin/sh5 no; do
        case $gl_cv_posix_shell in
          /*)
-          "$gl_cv_posix_shell" -c "$gl_test_POSIX_shell" 2>/dev/null && break;;
+          "$gl_cv_posix_shell" -c "$gl_test_posix_shell_script" 2>/dev/null \
+            && break;;
        esac
      done])