5 # Check for a working (i.e. POSIX-compatible) shell.
6 # Written by Paul Eggert <eggert@twinsun.com>,
7 # from an idea suggested by Albert Chin-A-Young <china@thewrittenword.com>.
8 AC_DEFUN([AC_PROG_SHELL],
9 [AC_MSG_CHECKING([for a POSIX-compliant shell])
10 AC_CACHE_VAL(ac_cv_path_shell,
12 # Test the noclobber option, using the portable POSIX.2 syntax.
18 # Test that $(...) works.
19 test "$(expr 3 + 4)" -eq 7 || exit
26 if ("$SHELL" -c "$ac_command") 2>/dev/null; then
27 ac_cv_path_shell=$SHELL
31 case $ac_cv_path_shell in
33 # Prefer shells that are more likely to be installed in the
34 # same place on all hosts of this platform. Therefore, prefer
35 # shells in /bin and /usr/bin to shells in the installer's
36 # PATH. Also, loop through PATH first and then through
37 # shells, since less-"nice" shells in /bin and /usr/bin are
38 # more likely to be installed than "nicer" shells elsewhere.
39 as_save_IFS=$IFS; IFS=:
40 for as_dir in /bin /usr/bin $PATH
45 for ac_base in sh bash ksh sh5; do
47 if ("$as_dir/$ac_base" -c "$ac_command") 2>/dev/null; then
48 ac_cv_path_shell=$as_dir/$ac_base
52 case $ac_cv_path_shell in
59 AC_MSG_RESULT($ac_cv_path_shell)
60 SHELL=$ac_cv_path_shell
61 if test "$SHELL" = no; then
63 AC_MSG_WARN([using $SHELL, even though it does not conform to POSIX])