Translations: Update the Hungarian translation.
[xz.git] / m4 / posix-shell.m4
blob95a19a96904c43b1c42730e4c820dcb5022b2f51
1 dnl SPDX-License-Identifier: FSFULLR
3 # Find a POSIX-conforming shell.
5 # Copyright (C) 2007-2008 Free Software Foundation, Inc.
7 # This file is free software; the Free Software Foundation
8 # gives unlimited permission to copy and/or distribute it,
9 # with or without modifications, as long as this notice is preserved.
11 # Written by Paul Eggert.
13 # If a POSIX-conforming shell can be found, set POSIX_SHELL and
14 # PREFERABLY_POSIX_SHELL to it.  If not, set POSIX_SHELL to the
15 # empty string and PREFERABLY_POSIX_SHELL to '/bin/sh'.
17 AC_DEFUN([gl_POSIX_SHELL],
19   AC_CACHE_CHECK([for a shell that conforms to POSIX], [gl_cv_posix_shell],
20     [gl_test_posix_shell_script='
21        func_return () {
22          (exit [$]1)
23        }
24        func_success () {
25          func_return 0
26        }
27        func_failure () {
28          func_return 1
29        }
30        func_ret_success () {
31          return 0
32        }
33        func_ret_failure () {
34          return 1
35        }
36        subshell_umask_sanity () {
37          (umask 22; (umask 0); test $(umask) -eq 22)
38        }
39        test "[$](echo foo)" = foo &&
40        func_success &&
41        ! func_failure &&
42        func_ret_success &&
43        ! func_ret_failure &&
44        (set x && func_ret_success y && test x = "[$]1") &&
45        subshell_umask_sanity
46      '
47      for gl_cv_posix_shell in \
48          "$CONFIG_SHELL" "$SHELL" /bin/sh /bin/bash /bin/ksh /bin/sh5 no; do
49        case $gl_cv_posix_shell in
50          /*)
51            "$gl_cv_posix_shell" -c "$gl_test_posix_shell_script" 2>/dev/null \
52              && break;;
53        esac
54      done])
56   if test "$gl_cv_posix_shell" != no; then
57     POSIX_SHELL=$gl_cv_posix_shell
58     PREFERABLY_POSIX_SHELL=$POSIX_SHELL
59   else
60     POSIX_SHELL=
61     PREFERABLY_POSIX_SHELL=/bin/sh
62   fi
63   AC_SUBST([POSIX_SHELL])
64   AC_SUBST([PREFERABLY_POSIX_SHELL])