Initial revision
[debian/gzip] / m4 / shell.m4
1 #serial 1
2
3 # Check for a working (i.e. POSIX-compatible) shell.
4
5 # Written by Paul Eggert <eggert@twinsun.com>,
6 # from an idea suggested by Albert Chin-A-Young <china@thewrittenword.com>.
7
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_cv_path_shell=no
12       IFS="${IFS=       }"; ac_save_ifs="$IFS"; IFS=":"
13       ac_dummy=/bin:/usr/bin:/usr/bin/posix:/usr/xpg4/bin:$PATH
14       for ac_dir in $ac_dummy; do
15         for ac_base in sh bash ksh sh5; do
16           case "$ac_dir" in
17           /*)
18             if ("$ac_dir/$ac_base" -c '
19
20                   # Test the noclobber option,
21                   # using the portable POSIX.2 syntax.
22                   set -C
23                   rm -f conftest.c || exit
24                   >conftest.c || exit
25                   >|conftest.c || exit
26                   !>conftest.c || exit
27
28                 ') 2>/dev/null; then
29               ac_cv_path_shell="$ac_dir/$ac_base"
30               break
31             fi
32             ;;
33           esac
34         done
35         if test "$ac_cv_path_shell" != no; then
36           break
37         fi
38       done
39       IFS="$ac_save_ifs"])
40    AC_MSG_RESULT($ac_cv_path_shell)
41    SHELL=$ac_cv_path_shell
42    if test "$SHELL" = no; then
43      SHELL=/bin/sh
44      AC_MSG_WARN(Using $SHELL, even though it is not POSIX-compliant)
45    fi
46    AC_SUBST(SHELL)])