1 # Check for a working shell.
3 # Copyright (C) 2000-2001, 2007, 2009-2016 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3, or (at your option)
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21 # Check for a working (i.e. POSIX-compatible) shell.
22 # Written by Paul Eggert <eggert@twinsun.com>,
23 # from an idea suggested by Albert Chin-A-Young <china@thewrittenword.com>.
24 AC_DEFUN([AC_PROG_SHELL],
25 [AC_MSG_CHECKING([for a POSIX-compliant shell])
26 AC_CACHE_VAL(ac_cv_path_shell,
28 # Test the noclobber option, using the portable POSIX.2 syntax.
34 # Test that $(...) works.
35 test "$(expr 3 + 4)" -eq 7 || exit
42 if ("$SHELL" -c "$ac_command") 2>/dev/null; then
43 ac_cv_path_shell=$SHELL
47 case $ac_cv_path_shell in
49 # Prefer shells that are more likely to be installed in the
50 # same place on all hosts of this platform. Therefore, prefer
51 # shells in /bin and /usr/bin to shells in the installer's
52 # PATH. Also, loop through PATH first and then through
53 # shells, since less-"nice" shells in /bin and /usr/bin are
54 # more likely to be installed than "nicer" shells elsewhere.
55 as_save_IFS=$IFS; IFS=:
56 for as_dir in /bin /usr/bin $PATH
61 for ac_base in sh bash ksh sh5; do
63 if ("$as_dir/$ac_base" -c "$ac_command") 2>/dev/null; then
64 ac_cv_path_shell=$as_dir/$ac_base
68 case $ac_cv_path_shell in
75 AC_MSG_RESULT($ac_cv_path_shell)
76 SHELL=$ac_cv_path_shell
77 if test "$SHELL" = no; then
79 AC_MSG_WARN([using $SHELL, even though it does not conform to POSIX])