Annotation of embedaddon/libnet/m4/shell.m4, revision 1.1.1.1
1.1 misho 1: # Check for a working shell.
2:
3: # Copyright (C) 2000-2001, 2007, 2009-2017 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)
7: # any later version.
8:
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.
13:
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
17: # 02111-1307, USA.
18:
19: # AC_PROG_SHELL
20: # -------------
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,
27: [ac_command='
28: # Test the noclobber option, using the portable POSIX.2 syntax.
29: set -C
30: rm -f conftest.c
31: >conftest.c || exit
32: >|conftest.c || exit
33: !>conftest.c || exit
34: # Test that $(...) works.
35: test "$(expr 3 + 4)" -eq 7 || exit
36: '
37: # Solaris 11 /bin/sh (AT&T Research) 93u 2011-02-08 has a file
38: # descriptor bug that breaks zgrep and is hard to test for
39: # directly. At some point $(...) is reading a pipe from the
40: # subshell, but the pipe is also open in the parent shell, so
41: # the read deadlocks. Prefer some other shell if available.
42: ac_maybe_solaris_sh_bug='test "${.sh.version}"'
43:
44: ac_cv_path_shell=no
45:
46: case $SHELL in
47: /*)
48: rm -f conftest.c
49: if ("$SHELL" -c "$ac_command") 2>/dev/null; then
50: "$SHELL" -c "$ac_maybe_solaris_sh_bug" 2>/dev/null ||
51: ac_cv_path_shell=$SHELL
52: fi
53: esac
54:
55: case $ac_cv_path_shell in
56: no)
57: # Prefer shells that are more likely to be installed in the
58: # same place on all hosts of this platform. Therefore, prefer
59: # shells in /bin and /usr/bin to shells in the installer's
60: # PATH. Also, loop through PATH first and then through
61: # shells, since less-"nice" shells in /bin and /usr/bin are
62: # more likely to be installed than "nicer" shells elsewhere.
63: ac_break_if_good_shell=:
64: as_save_IFS=$IFS; IFS=:
65: for as_dir in /bin /usr/bin $PATH
66: do
67: IFS=$as_save_IFS
68: case $as_dir in
69: /*)
70: for ac_base in sh bash ksh sh5; do
71: rm -f conftest.c
72: if ("$as_dir/$ac_base" -c "$ac_command") 2>/dev/null; then
73: if "$as_dir/$ac_base" -c "$ac_maybe_solaris_sh_bug" 2>/dev/null
74: then
75: test "$ac_cv_path_shell" = no
76: else
77: ac_break_if_good_shell=break
78: :
79: fi && ac_cv_path_shell=$as_dir/$ac_base
80: $ac_break_if_good_shell
81: fi
82: done
83: $ac_break_if_good_shell
84: esac
85: done
86: rm -f conftest.c
87: esac])
88: AC_MSG_RESULT($ac_cv_path_shell)
89: SHELL=$ac_cv_path_shell
90: if test "$SHELL" = no; then
91: SHELL=/bin/sh
92: AC_MSG_WARN([using $SHELL, even though it does not conform to POSIX])
93: fi
94: if "$SHELL" -c "$ac_maybe_solaris_sh_bug" 2>/dev/null; then
95: AC_MSG_WARN([using $SHELL, even though it may have file descriptor bugs])
96: fi
97: AC_SUBST(SHELL)])
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>