xref: /titanic_50/usr/src/lib/libshell/common/features/options (revision c869993e79c1eafbec61a56bf6cea848fe754c71)
1# SHOPT_* option probe
2
3tst	cross{
4	: check for shell magic #!
5	cat > /tmp/file$$ <<!
6	#! /bin/echo
7	exit 1
8	!
9	chmod 755 /tmp/file$$
10	if	/tmp/file$$ > /dev/null
11	then	echo "#define SHELLMAGIC	1"
12	fi
13	rm -f /tmp/file$$
14
15	option() # name value
16	{
17		case $2 in
18		0)	echo "#ifndef SHOPT_$1"
19			echo "#   define SHOPT_$1	1"
20			echo "#endif"
21			;;
22		*)	echo "#undef  SHOPT_$1"
23			;;
24		esac
25	}
26
27	test -d /dev/fd
28	option DEVFD $?
29	case  `echo a | tr a '\012' | wc -l` in
30	*1*)	option MULTIBYTE 0 ;;
31	esac
32	test -x /bin/pfexec -o -x /usr/bin/pfexec
33	option PFSH $?
34	/bin/test ! -l . 2> /dev/null
35	option TEST_L $?
36	test -f /etc/ksh.kshrc -o -f /etc/bash.bashrc &&
37	option SYSRC 0
38	test -f /bin/universe && univ=`/bin/universe` > /dev/null 2>&1 -a ucb = "$univ"
39	option UCB $?
40}end
41
42cat{
43	#if !_PACKAGE_ast && ( (MB_LEN_MAX-1)<=0 || !defined(_lib_mbtowc) )
44	#   undef SHOPT_MULTIBYTE
45	#endif
46}end
47