1 | #serial 5
|
---|
2 |
|
---|
3 | # AC_PROG_SHELL
|
---|
4 | # -------------
|
---|
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,
|
---|
11 | [ac_command='
|
---|
12 | # Test the noclobber option, using the portable POSIX.2 syntax.
|
---|
13 | set -C
|
---|
14 | rm -f conftest.c
|
---|
15 | >conftest.c || exit
|
---|
16 | >|conftest.c || exit
|
---|
17 | !>conftest.c || exit
|
---|
18 | # Test that $(...) works.
|
---|
19 | test "$(expr 3 + 4)" -eq 7 || exit
|
---|
20 | '
|
---|
21 | ac_cv_path_shell=no
|
---|
22 |
|
---|
23 | case $SHELL in
|
---|
24 | /*)
|
---|
25 | rm -f conftest.c
|
---|
26 | if ("$SHELL" -c "$ac_command") 2>/dev/null; then
|
---|
27 | ac_cv_path_shell=$SHELL
|
---|
28 | fi;;
|
---|
29 | esac
|
---|
30 |
|
---|
31 | case $ac_cv_path_shell in
|
---|
32 | no)
|
---|
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
|
---|
41 | do
|
---|
42 | IFS=$as_save_IFS
|
---|
43 | case $as_dir in
|
---|
44 | /*)
|
---|
45 | for ac_base in sh bash ksh sh5; do
|
---|
46 | rm -f conftest.c
|
---|
47 | if ("$as_dir/$ac_base" -c "$ac_command") 2>/dev/null; then
|
---|
48 | ac_cv_path_shell=$as_dir/$ac_base
|
---|
49 | break
|
---|
50 | fi
|
---|
51 | done
|
---|
52 | case $ac_cv_path_shell in
|
---|
53 | /*) break;;
|
---|
54 | esac;;
|
---|
55 | esac
|
---|
56 | done
|
---|
57 | rm -f conftest.c;;
|
---|
58 | esac])
|
---|
59 | AC_MSG_RESULT($ac_cv_path_shell)
|
---|
60 | SHELL=$ac_cv_path_shell
|
---|
61 | if test "$SHELL" = no; then
|
---|
62 | SHELL=/bin/sh
|
---|
63 | AC_MSG_WARN([using $SHELL, even though it does not conform to POSIX])
|
---|
64 | fi
|
---|
65 | AC_SUBST(SHELL)])
|
---|