1########################################################################
2#                                                                      #
3#               This software is part of the ast package               #
4#                     Copyright (c) 1994-2011 AT&T                     #
5#                      and is licensed under the                       #
6#                  Common Public License, Version 1.0                  #
7#                               by AT&T                                #
8#                                                                      #
9#                A copy of the License is available at                 #
10#            http://www.opensource.org/licenses/cpl1.0.txt             #
11#         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         #
12#                                                                      #
13#              Information and Software Systems Research               #
14#                            AT&T Research                             #
15#                           Florham Park NJ                            #
16#                                                                      #
17#                 Glenn Fowler <gsf@research.att.com>                  #
18#                                                                      #
19########################################################################
20# Glenn Fowler & Phong Vo
21# AT&T Research
22#
23# test if feature exists
24# this script is written to make it through all sh variants
25#
26# NOTE: .exe a.out suffix and [\\/] in path patterns for dos/nt
27
28case $-:$BASH_VERSION in
29*x*:[0123456789]*)	: bash set -x is broken :; set +ex ;;
30esac
31
32command=iffe
33version=2011-01-07 # update in USAGE too #
34
35compile() # $cc ...
36{
37	"$@" 2>$tmp.err
38	_compile_status=$?
39	if	test -s $tmp.err
40	then	cat $tmp.err >&2
41		case $_compile_status in
42		[1-9]|[1-9][0-9]|1[01][0-9]|12[0-7])
43			if	egrep -i -c 'terminated with signal|core dump|segmentation fault' $tmp.err >&$nullout
44			then	_compile_status=139
45			fi
46			;;
47		esac
48	fi
49	case $_compile_status in
50	?|??|1[01]?|12[0-8]|25?)
51		;;
52	*)	echo "$command: $@" >&$stderr
53		cat $tmp.err >&$stderr
54		echo "$command: $1: core dump or fatal interruption -- results inconclusive" >&$stderr
55		exit $_compile_status
56		;;
57	esac
58	return $_compile_status
59}
60
61is_hdr() # [ - ] [ file.c ] hdr
62{
63	case $1 in
64	-)	_is_hdr_flag=-; shift ;;
65	*)	_is_hdr_flag= ;;
66	esac
67	case $1 in
68	*.c)	_is_hdr_file=$1; shift ;;
69	*)	_is_hdr_file=$tmp.c ;;
70	esac
71	is hdr $1
72	compile $cc -c $_is_hdr_file <&$nullin >&$nullout 2>$tmp.e
73	_is_hdr_status=$?
74	case $_is_hdr_status in
75	0)	if	test -s $tmp.e
76		then	case `grep '#.*error' $tmp.e` in
77			?*)	_is_hdr_status=1 ;;
78			esac
79		fi
80		;;
81	esac
82	case $_is_hdr_status in
83	0)	success $_is_hdr_flag
84		;;
85	*)	case $debug in
86		3)	cat $tmp.e >&$stderr ;;
87		esac
88		failure $_is_hdr_flag
89		;;
90	esac
91	return $_is_hdr_status
92}
93
94pkg() # package
95{
96	case $1 in
97	'<')	shift ;;
98	*)	return ;;
99	esac
100	case $1 in
101	X|X11*)	i="openwin"
102		case $1 in
103		X)	set X11 ;;
104		esac
105		case $1 in
106		X11)	case $# in
107			1)	set $1 6 5 4 ;;
108			esac
109			;;
110		esac
111		;;
112	*)	i=
113		;;
114	esac
115	pth="{ usr . - . contrib local $i - . share - . lib - $1"
116	i=$1
117	while	:
118	do	shift
119		case $# in
120		0)	break ;;
121		esac
122		case $1 in
123		'>')	shift; break ;;
124		esac
125		pth="$pth ${i}R$1 ${i}.$1"
126	done
127	pth="$pth . } $*"
128}
129
130is() # op name
131{
132	case $verbose in
133	1)	case $complete in
134		1)	failure ;;
135		esac
136		oo=$1
137		shift
138		case $1 in
139		?*)	yy=is
140			ii=$1
141			complete=1
142			case $oo in
143			cmd)	mm="a command" ;;
144			dat)	mm="a library data symbol" ;;
145			dfn)	mm="a macro with extractable value" ;;
146			exp)	mm="true" ;;
147			hdr)	mm="a header" ;;
148			id)	mm="an identifier" ;;
149			lcl)	mm="a native header" ;;
150			key)	mm="a reserved keyword" ;;
151			lib)	mm="a library function" ;;
152			LIB)	case $2 in
153				"")	mm="a library" ;;
154				*)	ii=$*; mm="a library group" ;;
155				esac
156				;;
157			mac)	mm="a macro" ;;
158			mem)	mm="a member of $2" ;;
159			mth)	mm="a math library symbol" ;;
160			nos)	mm="a non-opaque struct" ;;
161			npt)	mm="a symbol that needs a prototype" ;;
162			num)	mm="a numeric constant or enum" ;;
163			nxt)	mm="an include path for the native header" ;;
164			opt)	mm="set in \$PACKAGE_OPTIONS" ;;
165			pth)	mm="a file" ;;
166			run)	yy="capture output of" mm= ;;
167			siz)	mm="a type with known size" ;;
168			sym)	mm="a typed variable" ;;
169			sys)	mm="a system header" ;;
170			typ)	mm="a type or typedef" ;;
171			val)	yy="determine" mm="value" ;;
172			*)	yy= mm= ;;
173			esac
174			case $ii in
175			[abcdefghijklmnopqrstuvwxyz]*[abcdefghijklmnopqrstuvwxyz]'{') ii="$ii ... }end" ;;
176			esac
177			$show "$command: test:" $yy $ii $mm "...$SHOW" >&$stderr
178			complete=1
179			;;
180		esac
181		;;
182	esac
183}
184
185success()
186{
187	case $1 in
188	-)	shift
189		;;
190	*)	case $result in
191		UNKNOWN)	result=SUCCESS ;;
192		esac
193		case $1 in
194		+)	return ;;
195		esac
196		;;
197	esac
198	case $complete:$verbose in
199	1:1)	case $suspended in
200		1)	suspended=0
201			$show "$command: test:" $yy $ii $mm "...$SHOW" >&$stderr
202			;;
203		esac
204		complete=0
205		case $# in
206		0)	mm="yes" ;;
207		*)	mm="'$*'" ;;
208		esac
209		case $debug in
210		0)	echo " $mm" >&$stderr ;;
211		*)	echo "$command: ... $mm" >&$stderr ;;
212		esac
213		;;
214	esac
215}
216
217failure()
218{
219	case $1 in
220	-)	shift ;;
221	*)	result=FAILURE
222		case $1 in
223		+)	return ;;
224		esac
225		;;
226	esac
227	case $complete:$verbose in
228	1:1)	case $suspended in
229		1)	suspended=0
230			$show "$command: test:" $yy $ii $mm "...$SHOW" >&$stderr
231			;;
232		esac
233		complete=0
234		case $group in
235		'')	case $# in
236			0)	mm="no" ;;
237			*)	mm=$* ;;
238			esac
239			;;
240		*)	mm=
241			;;
242		esac
243		case $debug in
244		0)	echo " $mm" >&$stderr ;;
245		*)	echo "$command: ... $mm" >&$stderr ;;
246		esac
247		;;
248	esac
249}
250
251# report
252#
253#	-	ignore global status
254#	-0	normal sense
255#	-1	inverted sense if ! def
256#	status	test status 0:success *:failure
257#	success	success comment
258#	failure	failure comment
259#	default	default setting comment
260#
261#   globals
262#
263#	$not	invert test sense
264# 	$M	test variable
265#	$m	test macro
266#	$v	default macro
267
268report() # [-] [-0] [-1] status value success failure default
269{
270	case $1 in
271	-)	_report_ignore=$1
272		shift
273		;;
274	*)	_report_ignore=
275		;;
276	esac
277	_report_not=$not
278	case $1 in
279	-0)	shift
280		;;
281	-1)	shift
282		case $def in
283		''|-)	case $_report_not in
284			1)	_report_not= ;;
285			*)	_report_not=1 ;;
286			esac
287			;;
288		esac
289		;;
290	esac
291	_report_status=$1
292	case $_report_ignore:$_report_status in
293	-:*)	;;
294	*:0)	success $_report_ignore
295		;;
296	*)	failure $_report_ignore
297		case $group in
298		?*)	return ;;
299		esac
300		;;
301	esac
302	_report_value=$2
303	case $_report_not in
304	1)	case $_report_status in
305		0)	_report_status=1 ;;
306		*)	_report_status=0 ;;
307		esac
308		_report_success=$4
309		_report_failure=$3
310		;;
311	*)	_report_success=$3
312		_report_failure=$4
313		;;
314	esac
315	_report_default=$5
316	case $_report_status in
317	0)	case $M in
318		*-*)	;;
319		*)	usr="$usr$nl#define $m $_report_value"
320			case $_report_success in
321			''|-)	;;
322			*)	case $define in
323				1)	echo "#define $m	$_report_value	/* $_report_success */" ;;
324				n)	echo "$m=$_report_value"
325				esac
326				;;
327			esac
328			eval $m=\'$_report_value\'
329			;;
330		esac
331		;;
332	*)	case $M in
333		*-*)	;;
334		*)	case $_report_failure in
335			''|-)	;;
336			*)	case $define$all$config$undef in
337				1?1?|1??1)echo "#undef	$m		/* $_report_failure */" ;;
338				11??)	  echo "#define $m	0	/* $_report_failure */" ;;
339				n1?1)	  echo "$m=" ;;
340				n1??)	  echo "$m=0" ;;
341				esac
342				;;
343			esac
344			case $_report_default in
345			''|-)	;;
346			*)	case $define$set in
347				1?*)	echo "#define $v	$set	/* $_report_default */" ;;
348				n?*)	echo "$v=$set" ;;
349				esac
350				;;
351			esac
352			eval $m=0
353			;;
354		esac
355		;;
356	esac
357}
358
359noisy()
360{
361	case $complete:$verbose in
362	1:1)	suspended=1
363		echo >&$stderr
364		;;
365	esac
366}
367
368here_broken=0
369
370copy() # output-file data
371{
372	case $shell in
373	ksh)	case $1 in
374		-)	print -r - "$2" ;;
375		*)	print -r - "$2" > "$1" ;;
376		esac
377		;;
378	*)	case $1 in
379		-)	if	cat <<!
380$2
381!
382			then	: old here doc botch not present
383			else	case $here_broken in
384				0)	here_broken=1
385					echo "$command: your shell botches here documents; this was fixed back in the 80's" >&$stderr
386					;;
387				esac
388				sh -c "cat <<!
389$2
390!
391"
392			fi
393			;;
394		*)	if	cat > "$1" <<!
395$2
396!
397			then	: old here doc botch not present
398			else	case $here_broken in
399				0)	here_broken=1
400					echo "$command: your shell botches here documents; this was fixed back in the 80's" >&$stderr
401					;;
402				esac
403				sh -c "cat > '$1' <<!
404$2
405!
406"
407			fi
408			;;
409		esac
410		;;
411	esac
412}
413
414checkread()
415{
416	case $posix_read in
417	-no)	;;
418	*)	posix_read=`(read -r _checkread_line; echo $_checkread_line) 2>/dev/null <<!
419a z
420!
421`
422		;;
423	esac
424	case $posix_read in
425	"a z")	posix_read=1
426		;;
427	*)	copy ${tmp}r.c "
428		extern int read();
429		extern int write();
430		int main()
431		{
432			char	c;
433			char	r;
434			int	k;
435			char	s[32];
436			k = 0;
437			while (read(0, &c, 1) == 1)
438			{
439				if (k >= 0)
440				{
441					if (c == ' ' || c == '\\t')
442					{
443						if (k < sizeof(s))
444							s[k++] = c;
445						continue;
446					}
447					if (k > 1 && c != '#' && c != '\\n' && c != '\\r')
448						write(1, s + 1, k - 1);
449					k = -1;
450				}
451				if (c == '\\r')
452				{
453					r = c;
454					if (read(0, &c, 1) == 1 && c != '\\n')
455						write(1, &r, 1);
456				}
457				write(1, &c, 1);
458				if (c == '\\n')
459					return 0;
460			}
461			return 1;
462		}"
463		if	compile $cc -o ${tmp}r.exe ${tmp}r.c >&$nullout
464		then	posix_read=${tmp}r.exe
465		else	echo "$command: cannot compile read -r workaround" >&$stderr
466			exit 1
467		fi
468		;;
469	esac
470}
471
472execute()
473{
474	if	test "" != "$cross"
475	then	crossexec $cross "$@"
476		_execute_=$?
477	elif	test -d /NextDeveloper
478	then	"$@" <&$nullin >&$nullout
479		_execute_=$?
480		"$@" <&$nullin | cat
481	else	"$@"
482		_execute_=$?
483	fi
484	return $_execute_
485}
486
487exclude()
488{
489	case $excludes in
490	'')	return 0 ;;
491	esac
492	for _exclude_var
493	do	eval _exclude_old=\$$_exclude_var
494		case $_exclude_old in
495		*" -I"*);;
496		*)	continue ;;
497		esac
498		_exclude_new=
499		_exclude_sep=
500		for _exclude_arg in $_exclude_old
501		do	_exclude_skip=
502			for _exclude_dir in $excludes
503			do	case $_exclude_arg in
504				-I$_exclude_dir|-I*/$_exclude_dir)
505					_exclude_skip=1
506					break;
507					;;
508				esac
509			done
510			case $_exclude_skip in
511			'')	_exclude_new="$_exclude_new$_exclude_sep$_exclude_arg"
512				_exclude_sep=" "
513				;;
514			esac
515		done
516		eval $_exclude_var=\$_exclude_new
517		case $debug in
518		0)	;;
519		*)	echo $command: exclude $_exclude_var: "$_exclude_old => $_exclude_new" >&$stderr
520			;;
521		esac
522	done
523}
524
525all=0
526apis=
527binding="-dy -dn -Bdynamic -Bstatic -Wl,-ashared -Wl,-aarchive -call_shared -non_shared '' -static"
528complete=0
529config=0
530defhdr=
531define=1
532explicit=0
533iff=
534usr=
535cross=
536debug=0
537deflib=
538dir=FEATURE
539excludes=
540executable="test -x"
541exists="test -e"
542gothdr=
543gotlib=
544idno=
545idyes=
546ifs=${IFS-'
547	 '}
548in=
549includes=
550intrinsic=
551libpaths="LD_LIBRARY_PATH LD_LIBRARYN32_PATH LD_LIBRARY64_PATH LIBPATH SHLIB_PATH"
552	LD_LIBRARY_PATH_default=:/lib:/usr/lib
553	LD_LIBRARYN32_PATH_default=:/lib32:/usr/lib32
554	LD_LIBRARY64_PATH_default=:/lib64:/usr/lib64
555	LIBPATH_default=:/lib:/usr/lib
556	SHLIB_PATH_default=:/shlib:/usr/shlib:/lib:/usr/lib
557nl="
558"
559optimize=1
560occ=cc
561one=
562out=
563posix_read=-check
564case `(set -f && set x * && echo $# && set +f) 2>/dev/null` in
5652)	posix_noglob="set -f" posix_glob="set +f" ;;
566*)	case `(set -F && set x * && echo $# && set +F) 2>/dev/null` in
567	2)	posix_noglob="set -F" posix_glob="set +F" ;;
568	*)	posix_noglob=":" posix_glob=":" ;;
569	esac
570	;;
571esac
572protoflags=
573puthdr=
574putlib=
575pragma=
576case $RANDOM in
577$RANDOM)shell=bsh
578	($executable .) 2>/dev/null || executable='test -r'
579	($exists .) 2>/dev/null || exists='test -r'
580	;;
581*)	case $BASH_VERSION in
582	?*)	shell=bash ;;
583	*)	shell=ksh ;;
584	esac
585	;;
586esac
587reallystatic=
588reallystatictest=
589regress=
590static=.
591statictest=
592case $COTEMP in
593"")	case $HOSTNAME in
594	""|?|??|???|????|????)
595		tmp=${HOSTNAME}
596		;;
597	*)	case $shell in
598		bsh)	eval `echo $HOSTNAME | sed 's/\\(....\\).*/tmp=\\1/'` ;;
599		*)	eval 'tmp=${HOSTNAME%${HOSTNAME#????}}' ;;
600		esac
601		;;
602	esac
603	tmp=${tmp}$$
604	;;
605*)	tmp=x${COTEMP}
606	;;
607esac
608COTEMP=${tmp}
609export COTEMP
610case $tmp in
611./*)	;;
612??????????*)
613	case $shell in
614	bsh)	eval `echo $tmp | sed 's/\\(.........\\).*/tmp=\\1/'` ;;
615	*)	eval 'tmp=${tmp%${tmp#?????????}}' ;;
616	esac
617	;;
618?????????)
619	;;
620????????)
621	tmp=F$tmp
622	;;
623esac
624case $tmp in
625./*)	;;
626*)	tmp=./$tmp ;;
627esac
628undef=0
629verbose=0
630vers=
631
632# options -- `-' for output to stdout otherwise usage
633
634case $1 in
635-)	out=-; shift ;;
636esac
637set=
638
639case `(getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null` in
6400123)	USAGE=$'
641[-?
642@(#)$Id: iffe (AT&T Research) 2011-01-07 $
643]
644'$USAGE_LICENSE$'
645[+NAME?iffe - C compilation environment feature probe]
646[+DESCRIPTION?\biffe\b is a command interpreter that probes the C
647	compilation environment for features. A feature is any file, option
648	or symbol that controls or is controlled by the C compiler. \biffe\b
649	tests features by generating and compiling C programs and observing
650	the behavior of the C compiler and generated programs.]
651[+?\biffe\b statements are line oriented. Statements may appear in the
652	operand list with the \b:\b operand or \bnewline\b as the line
653	delimiter. The standard input is read if there are no command
654	line statements or if \afile\a\b.iffe\b is omitted.]
655[+?Though similar in concept to \bautoconf\b(1) and \bconfig\b(1), there
656	are fundamental differences. The latter tend to generate global
657	headers accessed by all components in a package, whereas \biffe\b is
658	aimed at localized, self contained feature testing.]
659[+?Output is generated in \bFEATURE/\b\atest\a by default, where \atest\a is
660	the base name of \afile\a\b.iffe\b or the \biffe\b \brun\b
661	file operand. Output is first generated in a temporary file; the
662	output file is updated if it does not exist or if the temporary file
663	is different. If the first operand is \b-\b then the output is written
664	to the standard output and no update checks are done.]
665[+?Files with suffixes \b.iffe\b and \b.iff\b are assumed to contain
666	\biffe\b statements.]
667[a:all?Define failed test macros \b0\b. By default only successful test macros
668	are defined \b1\b.]
669[c:cc?Sets the C compiler name and flags to be used in the feature
670	tests.]:[C-compiler-name [C-compiler-flags ...]]]
671[C:config?Generate \bconfig\b(1) style \aHAVE_\a* macro names. This implies
672	\b--undef\b. Since \bconfig\b(1) has inconsistent naming conventions,
673	the \bexp\b op may be needed to translate from the (consistent)
674	\biffe\b names. Unless otherwise noted a \bconfig\b macro name
675	is the \biffe\b macro name prefixed with \bHAVE\b and converted to
676	upper case. \b--config\b is set by default if the command arguments
677	contain a \brun\b op on an input file with the base name \bconfig\b.]
678[d:debug?Sets the debug level. Level 0 inhibits most
679	error messages, level 1 shows compiler messages, and
680	level 2 traces internal \biffe\b \bsh\b(1) actions and does
681	not remove core dumps on exit.]#[level]
682[D:define?Successful test macro definitions are emitted. This is the default.]
683[E:explicit?Disable implicit test output.]
684[F:features?Sets the feature test header to \ahdr\a.  This header typically
685        defines *_SOURCE feature test macros.]:[hdr:=NONE]
686[i:input?Sets the input file name to \afile\a, which
687	must contain \biffe\b statements.]:[file]
688[I:include?Adds \b-I\b\adir\a to the C compiler flags.]:[dir]
689[L:library?Adds \b-L\b\adir\a to the C compiler flags.]:[dir]
690[n:name-value?Output \aname\a=\avalue\a assignments only.]
691[N!:optimize?\b--nooptimize\b disables compiler optimization options.]
692[o:output?Sets the output file name to \afile\a.]:[file]
693[O:stdio?Sets the standard io header to \ahdr\a.]:[hdr:=stdio.h]
694[e:package?Sets the \bproto\b(1) package name to \aname\a.]:[name]
695[p:prototyped?Emits \b#pragma prototyped\b at the top of the
696	output file. See \bproto\b(1).]
697[P:pragma?Emits \b#pragma\b \atext\a at the top of the output file.]:[text]
698[r:regress?Massage output for regression testing.]
699[s:shell?Sets the internal shell name to \aname\a. Used for debugging
700	Bourne shell compatibility (otherwise \biffe\b uses \aksh\a constructs
701	if available). The supported names are \bksh\b, \bbsh\b, \bbash\b, and
702	\bosh\b. \bosh\b forces the \bread -r\b compatibility read command to
703	be compiled and used instead of \bread -r\b. The default is determined
704	by probing the shell at startup.]:[name]
705[S:static?Sets the C compiler flags that force static linking. If not set
706	then \biffe\b probes the compiler to determine the flags. \biffe\b
707	must use static linking (no dlls) because on some systems missing
708	library symbols are only detected when referenced at runtime from
709	dynamically linked executables.]:[flags]
710[u:undef?\b#undef\b failed test macros. By default only successful test macros
711	are defined \b1\b.]
712[v:verbose?Produce a message line on the standard error for each test as
713	it is performed.]
714[x:cross?Some tests compile an executable (\ba.out\b) and then run it.
715	If the C compiler is a cross compiler and the executable format is
716	incompatible with the execution environment then the generated
717	executables must be run in a different environment, possibly on
718	another host. \acrosstype\a is the HOSTTYPE for generated executables
719	(the \bpackage\b(1) command generates a consistent HOSTTYPE namespace).
720	Generated executables are run via \bcrossexec\b(1) with \acrosstype\a
721	as the first argument. \bcrossexec\b supports remote execution for
722	cross-compiled executables. See \bcrossexec\b(1) for
723	details.]:[crosstype]
724[X:exclude?Removes \b-I\b\adir\a and \b-I\b*/\adir\a C compiler flags.]:[dir]
725
726[ - ] [ file.iffe | statement [ : statement ... ] ]
727
728[+SYNTAX?\biffe\b input consists of a sequence of statement lines. Statements
729	that span more than one line contain \abegin\a\b{\b as the last
730	operand (where \abegin\a is command specific) and zero
731	or more data lines terminated by a line containing
732	\b}end\b as the first operand. The statement syntax is:
733	[\aname\a \b=\b]] [\b!\b]] \atest\a[,\atest\a...]] [\b-\b]]
734	[\aarg\a[,\aarg\a...]]]] [\aprereq\a ...]]
735	[\abegin\a{ ... |\bend\b ...]] [= [\adefault\a]]]].
736	\atest\as and \aarg\as may be combined, separated by commas, to perform
737	a set of tests on a set of arguments. \aname\a \b=\b before \atest\a
738	overrides the default test variable and macro name, and \b-\b after
739	\atest\a performs the test but does not define the test variable and
740	macro values. \b!\b before \atest\a inverts the test sense for \bif\b,
741	\belif\b, and \byes{\b and \bno{\b blocks.]
742[+?\aprereq\as are used when applying the features tests and may be
743	combinations of:]{
744		[+compiler options?\b-D\b*, \b-L\b*, etc.]
745		[+library references?\b-l\b*, *\b.a\b, etc. \b_LIB_\b\aname\a
746			is defined to be 1 if \b-l\b\aname\a is a library.]
747		[+header references?*\b.h\b. \a_dir_name\a is defined to be 1
748			if \adir/name\a\b.h\b is a header, or if \adir\a is
749			omitted, \b_hdr_\b\aname\a is defined to be 1 if
750			\aname\a\b.h\b is a header.]
751		[+-?Prereq grouping mark; prereqs before the first \b-\b are
752			passed to all feature tests. Subsequent groups
753			are attempted in left-to-right order until the first
754			successful group is found.]
755	}
756[+?\abegin\a\b{\b ... \b}end\b delimit multiline code blocks that override
757	or augment the default code provided by \biffe\b. User supplied code
758	blocks should be compatible with the K&R, ANSI, and C++ C language
759	dialects for maximal portability. In addition to all macro definitions
760	generated by previous tests, all generated code contains the
761	following at the top to hide dialect differences:]{
762		[+#if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)?]
763		[+#define _STD_ 1?]
764		[+#define _ARG_(x) x?]
765		[+#define _VOID_ void?]
766		[+#else?]
767		[+#define _STD_ 0?]
768		[+#define _ARG_(x) ()?]
769		[+#define _VOID_ char?]
770		[+#endif?]
771		[+#if defined(__cplusplus)?]
772		[+#define _BEGIN_EXTERNS_ extern "C" {?]
773		[+#define _END_EXTERNS_ }?]
774		[+#else?]
775		[+#define _BEGIN_EXTERNS_?]
776		[+#define _END_EXTERNS_?]
777		[+#endif?]
778		[+#define _NIL_(x) ((x)0)?]
779		[+#include <stdio.h>?]
780	}
781[+?= \adefault\a may be specified for the \bkey\b, \blib\b, \bmac\b, \bmth\b
782	and \btyp\b tests. If the test fails for \aarg\a then
783	\b#define\b \aarg\a \adefault\a is emitted. \bkey\b accepts multiple
784	\b= \b\adefault\a values; the first valid one is used.]
785[+?Each test statement generates a portion of a C language header that contains
786	macro defintions, comments, and other text corresponding to the feature
787	tests. \b#ifndef _def_\b\aname\a\b_\b\adirectory\a ...
788	\b#endif\b guards the generated header from multiple \b#include\bs,
789	where \aname\a is determined by either the \brun\b statement input file
790	name if any, or the first \atest\a in the first statement, and \adirectory\a
791	is the basename component of either the \brun\b statement file, if any,
792	or the current working directory. The output file name is determined
793	in this order:]{
794		[+-?If the first command line operand is \b-\b then the output
795			is written to the standard output.]
796		[+--output=\afile\a?Output is \afile\a.]
797		[+set out \afile\a?Output is \afile\a.]
798		[+[run]] [\adirectory\a/]]\abase\a[\a.suffix\a]]?Output is
799			\bFEATURE/\b\abase\a.]
800	}
801[+?Generated \biffe\b headers are often referenced in C source as:
802	\b#include "FEATURE/\b\afile\a". The \bnmake\b(1) base rules contain
803	metarules for generating \bFEATURE/\b\afile\a from
804	\bfeatures/\b\afile\a[\asuffix\a]], where \asuffix\a may be omitted,
805	\b.c\b, or \b.sh\b (see the \brun\b test below). Because
806	\b#include\b prerequisites are automatically detected, \bnmake\b(1)
807	ensures that all prerequisite \biffe\b headers are generated before
808	compilation. Note that the directories are deliberately named
809	\bFEATURE\b and \bfeatures\b to keep case-ignorant file systems
810	happy.]
811[+?The feature tests are:]{
812	[+# \acomment\a?Comment line - ignored.]
813	[+api \aname\a \aYYYYMMDD\a \asymbol ...\a?Emit api compatibility tests
814		for \aname\a and \b#define\b \asymbol\a \asymbol\a_\aYYYYMMDD\a
815		when \aNAME\a_API is >= \aYYYYMMDD\a (\aNAME\a is \aname\a
816		converted to upper case.) If \aNAME\a_API is not defined
817		then \asymbol\a maps to the newest \aYYYYMMDD\a for \aname\a.]
818	[+define \aname\a [ (\aarg,...\a) ]] [ \avalue\a ]]?Emit a macro
819		\b#define\b for \aname\a if it is not already defined. The
820		definition is passed to subsequent tests.]
821	[+extern \aname\a \atype\a [ (\aarg,...\a) | [\adimension\a]] ]]?Emit
822		an \bextern\b prototype for \aname\a if one is not already
823		defined. The prototype is passed to subsequent tests.]
824	[+header \aheader\a?Emit \b#include <\b\aheader\a\b>\b if \aheader\a
825		exists. The \b#include\b is passed to subsequent tests.]
826	[+print \atext\a?Copy \atext\a to the output file. \atext\a is passed
827		to subsequent tests.]
828	[+reference \aheader\a?If \aheader\a exists then add \b#include\b
829		\aheader\a to subsequent tests.]
830	[+ver \aname\a \aYYYYMMDD\a?\b#define\b \aNAME\a_VERSION \aYYYYMMDD\a
831		\aNAME\a is \aname\a converted to upper case.)]
832	[+cmd \aname\a?Defines \b_cmd_\b\aname\a if \aname\a is an executable
833		in one of the standard system directories (\b/bin, /etc,
834		/usr/bin, /usr/etc, /usr/ucb\b).
835		\b_\b\adirectory\a\b_\b\aname\a is defined for \adirectory\a
836		in which \aname\a is found (with \b/\b translated to \b_\b).]
837	[+dat \aname\a?Defines \b_dat_\b\aname\a if \aname\a is a data symbol
838		in the default libraries.]
839	[+def \aname\a?Equivalent to \bcmd,dat,hdr,key,lib,mth,sys,typ\b
840		\aname\a.]
841	[+dfn \aname\a?If \aname\a is a macro in the candidate headers then
842		a \b#define\b \aname\a \avalue\a statment is output for the
843		\avalue\a defined in the headers. The definition is \b#ifndef\b
844		guarded.]
845	[+exp \aname\a \aexpression\a?If \aexpression\a is a \"...\" string
846		then \aname\a is defined to be the string, else if the
847		\bexpr\b(1) evaluation of \aexpression\a is not 0 then \aname\a
848		is defined to be 1, otherwise \aname\a is defined to be 0.
849		Identifiers in \aexpression\a may be previously defined names
850		from other \biffe\b tests; undefined names evaluate to 0.
851		If \aname\a was defined in a previous successful test then
852		the current and subsequent \bexp\b test on \aname\a are
853		skipped. If \aname\a is \b-\b then the \aexpression\a is
854		simply evaluated.]
855	[+hdr \aname\a?Defines \b_hdr_\b\aname\a if the header
856		\b<\b\aname\a\b.h>\b exists. The \b--config\b macro name is
857		\bHAVE_\b\aNAME\a\b_H\b.]
858	[+if \astatement\a ... | \belif\b \astatement\a ... | \belse\b | \bendif\b?
859		Nested if-else test control.]
860	[+iff \aname\a?The generated header \b#ifndef-#endif\b macro guard is
861		\b_\b\aname\a\b_H\b.]
862	[+inc \afile\a [ re ]]?Read #define macro names from \afile\a
863		and arrange for those names to evaluate to 1 in \bexp\b
864		expressions. If \are\a is specified then macros not matching
865		\are\a are ignored.]
866	[+key \aname\a?Defines \b_key_\b\aname\a if \aname\a is a reserved
867		word (keyword).]
868	[+lcl \aname\a?Generates a \b#include\b statement for the native version
869		of the header \b<\b\aname\a\b.h>\b if it exists. Defines
870		\b_lcl_\b\aname\a on success. The \b--config\b macro name is
871		\bHAVE_\b\aNAME\a\b_H\b. The default \are\a is \b^HAVE_\b
872		for \b--config\b and \b^_\b otherwise.]
873	[+lib \aname\a?Defines \b_lib_\b\aname\a if \aname\a is an external
874		symbol in the default libraries.]
875	[+mac \aname\a?Defines \b_mac_\b\aname\a if \aname\a is a macro.]
876	[+mem \astruct.member\a?Defines \b_mem_\b\amember\a\b_\b\astruct\a
877		if \amember\a is a member of the structure \astruct\a.]
878	[+mth \aname\a?Defines \b_mth_\b\aname\a if \aname\a is an external
879		symbol in the math library.]
880	[+nop \aname\a?If this is the first test then \aname\a may be used
881		to name the output file and/or the output header guard macro.
882		Otherwise this test is ignored.]
883	[+npt \aname\a?Defines \b_npt_\b\aname\a if the \aname\a symbol
884		requires a prototype. The \b--config\b macro name is
885		\bHAVE_\aNAME\a\b_DECL\b with the opposite sense.]
886	[+num \aname\a?Defines \b_num_\b\aname\a if \aname\a is a numeric
887		constant \aenum\a or \amacro\a.]
888	[+nxt \aname\a?Defines a string macro \b_nxt_\b\aname\a suitable for
889		a \b#include\b statement to include the next (on the include
890		path) or native version of the header \b<\b\aname\a\b.h>\b
891		if it exists. Also defines the \"...\" form
892		\b_nxt_\b\aname\a\b_str\b. The \b--config\b macro name is
893		\bHAVE_\b\aNAME\a\b_NEXT\b.]
894	[+one \aheader\a ...?Generates a \b#include\b statement for the first
895		header found in the \aheader\a list.]
896	[+opt \aname\a?Defines \b_opt_\b\aname\a if \aname\a is a space-separated
897		token in the global environment variable \bPACKAGE_OPTIONS\b.]
898	[+pth \afile\a [ \adir\a ... | { \ag1\a - ... - \agn\a } | < \apkg\a [\aver\a ...]] > ]]?Defines
899		\b_pth_\b\afile\a, with embedded \b/\b chars translated to
900		\b_\b, to the path of the first instance of \afile\a in the
901		\adir\a directories. \b{\b ... \b}\b forms a directory list
902		from the cross-product of \b-\b separated directory groups
903		\ag1\a ... \agn\a. < ... > forms a directory list for the
904		package \apkg\a with optional versions. The \b--config\b macro
905		name is \aNAME\a\b_PATH\b.]
906	[+run \afile\a?Runs the tests in \afile\a based on the \afile\a
907		suffix:]{
908		[+.c?\afile\a is compiled and executed and the output is copied
909			to the \biffe\b output file. Macros and headers supplied
910			to \bbegin{\b ... \b}end\b are also supplied to
911			\afile\a.]
912		[+.sh?\afile\a is executed as a shell script and the output is
913			copied to the \biffe\b output file.]
914		[+.iffe \bor no suffix?\afile\a contains \biffe\b
915			statements.]
916	}
917	[+set \aoption value\a?Sets option values. The options are described
918		above.]
919	[+siz \aname\a?Defines \b_siz_\b\aname\a to be \bsizeof\b(\aname\a) if
920		\aname\a is a type in any of \b<sys/types.h>, <times.h>,
921		<stddef.h>, <stdlib.h>\b. Any \b.\b characters in \aname\a are
922		translated to space before testing and are translated to \b_\b
923		in the output macro name.]
924	[+sym \aname\a?Defines \b_ary_\b\aname\a if \aname\a is an array,
925		\b_fun_\b\aname\a if \aname\a is a function pointer,
926		\b_ptr_\b\aname\a if \aname\a is a pointer, or
927		\b_reg_\b\aname\a if \aname\a is a scalar. In most cases
928		\aname\a is part of a macro expansion.]
929	[+sys \aname\a?Defines \b_sys_\b\aname\a if the header
930		\b<sys/\b\aname\a\b.h>\b exists. The \b--config\b macro name is
931		\bHAVE_SYS_\b\aNAME\a\b_H\b.]
932	[+tst \aname\a?A user defined test on name. A source block must be
933		supplied. Defines \b_\b\aname\a on success. \btst - ...\b is
934		treated as \btst - - ...\b.]
935	[+typ \aname\a?Defines \b_typ_\b\aname\a if \aname\a is a type in any
936		of \b<sys/types.h>, <times.h>, <stddef.h>, <stdlib.h>\b. Any
937		\b.\b characters in \aname\a are translated to space before
938		testing and are translated to \b_\b in the output macro name.]
939	[+val \aname\a?The output of \becho\b \aname\a is written to the
940		output file.]
941	[+var \aname\a?A user defined test on name. A source block must be
942		supplied. Sets the \bexp\b variable \b_\b\aname\a on success
943		but does not define a macro.]
944	[+(\aexpression\a)?Equivalent to \bexp -\b \aexpression\a.]
945}
946[+?Code block names may be prefixed by \bno\b to invert the test sense. The
947	block names are:]{
948	[+cat?The block is copied to the output file.]
949	[+compile?The block is compiled (\bcc -c\b).]
950	[+cross?The block is executed as a shell script using \bcrossexec\b(1)
951		if \b--cross\b is on, or on the local host otherwise, and the
952		output is copied to the output file. Test macros are not
953		exported to the script.]
954	[+execute?The block is compiled, linked, and executed. \b0\b exit
955		status means success.]
956	[+fail?If the test fails then the block text is evaluated by
957		\bsh\b(1).]
958	[+link?The block is compiled and linked (\bcc -o\b).]
959	[+macro?The block is preprocessed (\bcc -E\b) and lines containing
960		text bracketed by \b<<"\b ... \b">>\b (\aless-than less-than
961		double-quote ... double-quote greater-than greater-than\a)
962		are copied to the output file with the brackets omitted.]
963	[+no?If the test fails then the block text is copied to the
964		output file. Deprecated: use { \bif\b \belif\b \belse\b
965		\bendif\b } with unnamed \b{\b ... \b}\b blocks.]
966	[+note?If the test succeeds then the block is copied to the output
967		as a \b/*\b ... \b*/\b comment.]
968	[+output?The block is compiled, linked, and executed, and the output
969		is copied to the output file.]
970	[+pass?If the test succeeds then the block text is evaluated by
971		\bsh\b(1).]
972	[+preprocess?The block is preprocessed (\bcc -E\b).]
973	[+run?The block is executed as a shell script and the output is
974		copied to the output file. Succesful test macros are also
975		defined as shell variables with value \b1\b and are available
976		within the block. Likewise, failed test macros are defined
977		as shell variables with value \b0\b.]
978	[+status?The block is compiled, linked, and executed, and the exit
979		status is the test outcome, 0 for \afailure\a, the value
980		otherwise.]
981	[+yes?If the test succeeds then the block text is copied to the output
982		file. \byes{\b ... \b}end\b is equivalent to the unnamed block
983		\b{\b ... \b}\b.  Deprecated: use { \bif\b \belif\b \belse\b
984		\bendif\b } with unnamed \b{\b ... \b}\b blocks.]
985}
986[+SEE ALSO?\bautoconf\b(1), \bconfig\b(1), \bcrossexec\b(1), \bnmake\b(1),
987	\bpackage\b(1), \bproto\b(1), \bsh\b(1)]
988'
989	while	getopts -a "$command" "$USAGE" OPT
990	do	case $OPT in
991		a)	set="$set set all :" ;;
992		c)	set="$set set cc $OPTARG :" ;;
993		C)	set="$set set config :" ;;
994		d)	set="$set set debug $OPTARG :" ;;
995		D)	set="$set set define :" ;;
996		E)	set="$set set explicit :" ;;
997		F)	set="$set set features $OPTARG :" ;;
998		i)	set="$set set input $OPTARG :" ;;
999		I)	set="$set set include $OPTARG :" ;;
1000		L)	set="$set set library $OPTARG :" ;;
1001		n)	set="$set set namval $OPTARG :" ;;
1002		N)	set="$set set nooptimize $OPTARG :" ;;
1003		o)	set="$set set output $OPTARG :" ;;
1004		e)	set="$set set package $OPTARG :" ;;
1005		p)	set="$set set prototyped :" ;;
1006		P)	set="$set set pragma $OPTARG :" ;;
1007		r)	set="$set set regress :" ;;
1008		s)	set="$set set shell $OPTARG :" ;;
1009		S)	set="$set set static $OPTARG :" ;;
1010		O)	set="$set set stdio $OPTARG :" ;;
1011		u)	set="$set set undef :" ;;
1012		v)	set="$set set verbose :" ;;
1013		x)	set="$set set cross $OPTARG :" ;;
1014		X)	set="$set set exclude $OPTARG :" ;;
1015		esac
1016	done
1017	shift `expr $OPTIND - 1`
1018	;;
1019*)	while	:
1020	do	case $# in
1021		0)	break ;;
1022		esac
1023		case $1 in
1024		-)	break
1025			;;
1026		--)	shift
1027			break
1028			;;
1029		--a|--al|--all)
1030			REM=a
1031			;;
1032		--cc=*)	REM=c`echo X$1 | sed 's,[^=]*=,,'`
1033			;;
1034		--co|--con|--conf|--confi|--config)
1035			REM=C
1036			;;
1037		--cr=*|--cro=*|--cros=*|--cross=*)
1038			REM=x`echo X$1 | sed -e 's,[^=]*=,,'`
1039			;;
1040		--d=*|--de=*|--deb=*|--debu=*|--debug=*)
1041			REM=d`echo X$1 | sed 's,[^=]*=,,'`
1042			;;
1043		--def|--defi|--defin|--define)
1044			REM=D
1045			;;
1046		--e=*|--ex=*|--exc=*|--excl=*|--exclu=*|--exclud=*|--exclude=*)
1047			REM=X`echo X$1 | sed 's,[^=]*=,,'`
1048			;;
1049		--e|--ex|--exp|--expl|--expli|--explic|--explici|--explicit)
1050			REM=E
1051			;;
1052		--f=*|--fe=*|--fea=*|--feat=*|--featu=*|--featur=*|--feature=*|--features=*)
1053			REM=F`echo X$1 | sed 's,[^=]*=,,'`
1054			;;
1055		--inp=*|--inpu=*|--input=*)
1056			REM=i`echo X$1 | sed 's,[^=]*=,,'`
1057			;;
1058		--inc=*|--incl=*|--inclu=*|--includ=*|--include=*)
1059			REM=I`echo X$1 | sed 's,[^=]*=,,'`
1060			;;
1061		--l=*|--li=*|--lib=*|--libr=*|--libra=*|--librar=*|--library=*)
1062			REM=L`echo X$1 | sed 's,[^=]*=,,'`
1063			;;
1064		--n|--na|--nam|--name|--name-v|--name-va|--name-val|--name-valu|--name-value)
1065			REM=n
1066			;;
1067		--o=*|--ou=*|--out=*|--outp=*|--outpu=*|--output=*)
1068			REM=o`echo X$1 | sed 's,[^=]*=,,'`
1069			;;
1070		--pa=*|--pac=*|--pack=*|--packa=*|--packag=*|--package=*)
1071			REM=e`echo X$1 | sed 's,[^=]*=,,'`
1072			;;
1073		--pro|--prot|--proto|--protot|--prototy|--prototyp|--prototype|--prototyped)
1074			REM=p
1075			;;
1076		--pra=*|--prag=*|--pragma=*)
1077			REM=P`echo X$1 | sed 's,[^=]*=,,'`
1078			;;
1079		--r|--re|--reg|--regre|--regres|--regress)
1080			REM=r
1081			;;
1082		--sh=*|--she=*|--shel=*|--shell=*)
1083			REM=s`echo X$1 | sed 's,[^=]*=,,'`
1084			;;
1085		--sta=*|--stat=*|--stati=*|--static=*)
1086			REM=S`echo X$1 | sed 's,[^=]*=,,'`
1087			;;
1088		--std=*|--stdi=*|--stdio=*)
1089			REM=O`echo X$1 | sed 's,[^=]*=,,'`
1090			;;
1091		--u|--un|--und|--unde|--undef)
1092			REM=u
1093			;;
1094		--v|--ve|--ver|--verb|--verbo|--verbos|--verbose)
1095			REM=v
1096			;;
1097		--*)	echo $command: $1: unknown option >&2
1098			exit 2
1099			;;
1100		-*)	REM=`echo X$1 | sed 's,X-,,'`
1101			;;
1102		*)	break
1103			;;
1104		esac
1105		shift
1106		while	:
1107		do	case $REM in
1108			'')	break ;;
1109			esac
1110			eval `echo $REM | sed "s,\(.\)\(.*\),OPT='\1' REM='\2',"`
1111			case $OPT in
1112			[cdFiILoOePsSxX])
1113				case $REM in
1114				'')	case $# in
1115					0)	echo $command: -$OPT: option argument expected >&2
1116						exit 1
1117						;;
1118					esac
1119					OPTARG=$1
1120					shift
1121					;;
1122				*)	OPTARG=$REM
1123					REM=''
1124					;;
1125				esac
1126			esac
1127			case $OPT in
1128			a)	set="$set set all :" ;;
1129			c)	set="$set set cc $OPTARG :" ;;
1130			C)	set="$set set config :" ;;
1131			d)	set="$set set debug $OPTARG :" ;;
1132			D)	set="$set set define :" ;;
1133			E)	set="$set set explicit :" ;;
1134			F)	set="$set set features $OPTARG :" ;;
1135			i)	set="$set set input $OPTARG :" ;;
1136			I)	set="$set set include $OPTARG :" ;;
1137			L)	set="$set set library $OPTARG :" ;;
1138			n)	set="$set set namval $OPTARG :" ;;
1139			N)	set="$set set nooptimize $OPTARG :" ;;
1140			o)	set="$set set output $OPTARG :" ;;
1141			e)	set="$set set package $OPTARG :" ;;
1142			p)	set="$set set prototyped :" ;;
1143			P)	set="$set set pragma $OPTARG :" ;;
1144			r)	set="$set set regress :" ;;
1145			s)	set="$set set shell $OPTARG :" ;;
1146			S)	set="$set set static $OPTARG :" ;;
1147			O)	set="$set set stdio $OPTARG :" ;;
1148			u)	set="$set set undef :" ;;
1149			v)	set="$set set verbose :" ;;
1150			x)	set="$set set cross $OPTARG :" ;;
1151			X)	set="$set set exclude $OPTARG :" ;;
1152			*)	echo "Usage: $command [-aCDEnpruv] [-c C-compiler-name [C-compiler-flags ...]] [-d level]
1153	    [-F features-header] [-i file] [-o file] [-O stdio-header] [-e name] [-P text]
1154	    [-s shell-path] [-S[flags]] [-x cross-exec-prefix] [-I dir] [-L dir] [-X dir] [ - ]
1155	    [ file.iffe | statement [ : statement ... ] ]" >&2
1156				exit 2
1157				;;
1158			esac
1159		done
1160	done
1161	;;
1162esac
1163case $1 in
1164-)	out=-; shift ;;
1165esac
1166case $# in
11670)	in=- ;;
1168esac
1169set -- $set "$@"
1170case " $* " in
1171*' set config '*|*' run config.'*|*' run '*' config.'*|*' run '*'/config.'*)
1172	config=1
1173	;;
1174esac
1175
1176# standard error to /dev/null unless debugging
1177# standard output to the current output file
1178#
1179#	stdout	original standard output
1180#	stderr	original standard error
1181#	nullin	/dev/null input
1182#	nullout	/dev/null output
1183
1184stdout=5 stderr=6 nullin=7 nullout=8
1185eval "exec $nullin</dev/null $nullout>/dev/null $stdout>&1 $stderr>&2"
1186case " $* " in
1187*" set debug "[3456789]*)
1188	;;
1189*)	eval "exec 2>&$nullout"
1190	;;
1191esac
1192
1193# prompt complications
1194
1195case `print -n aha </dev/null 2>/dev/null` in
1196aha)	show='print -n' SHOW='' ;;
1197*)	case `echo -n aha 2>/dev/null` in
1198	-n*)	show=echo SHOW='\c' ;;
1199	*)	show='echo -n' SHOW='' ;;
1200	esac
1201	;;
1202esac
1203
1204# tmp files cleaned up on exit
1205# status: 0:success 1:failure 2:interrupt
1206
1207status=1
1208case $debug in
12092)	core=
1210	;;
1211*)	if	(ulimit -c 0) >/dev/null 2>&1
1212	then	ulimit -c 0
1213		core=
1214	else	core="core core.??*"
1215	fi
1216	;;
1217esac
1218trap "rm -f $core $tmp*.*" EXIT
1219if	(:>$tmp.c) 2>/dev/null
1220then	rm -f $tmp.c
1221else	echo "$command: cannot create tmp files in current dir" >&2
1222	exit 1
1223fi
1224status=2
1225
1226# standard header for c source
1227
1228std='#if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
1229#define _STD_		1
1230#define _ARG_(x)	x
1231#define _VOID_		void
1232#else
1233#define _STD_		0
1234#define _ARG_(x)	()
1235#define _VOID_		char
1236#endif
1237#if defined(__cplusplus)
1238#define _BEGIN_EXTERNS_	extern "C" {
1239#define _END_EXTERNS_	}
1240#else
1241#define _BEGIN_EXTERNS_
1242#define _END_EXTERNS_
1243#endif
1244#define _NIL_(x)	((x)0)'
1245tst=
1246ext="#include <stdio.h>"
1247noext='*[<"][Ss][Tt][Dd][Ii][Oo].[Hh][">]*|*<ast.h>*|*<sfio.h>*'
1248
1249# loop on op [ arg [ ... ] ] [ : op [ arg [ ... ] ] ]
1250
1251argx=0
1252cur=.
1253can=
1254cansep=
1255cctest=
1256file=
1257hdrtest=
1258ifelse=NONE
1259ifstack=
1260ini=
1261init=1
1262line=0
1263nan=
1264prototyped=
1265while	:
1266do	case $in in
1267	"")	case $argx:$* in
1268		1:$argv);;
1269		1:*)	argx=0
1270			set x $argv
1271			shift
1272			;;
1273		esac
1274		;;
1275	*)	case $ini in
1276		'')	if	read lin
1277			then	case $shell in
1278				ksh)	let line=line+1 ;;
1279				*)	line=`expr $line + 1` ;;
1280				esac
1281				$posix_noglob
1282				set x $lin
1283				$posix_glob
1284				case $# in
1285				1)	continue ;;
1286				esac
1287			else	set x
1288			fi
1289			;;
1290		*)	$posix_noglob
1291			set x $ini
1292			$posix_glob
1293			ini=
1294			;;
1295		esac
1296		shift
1297		case $init in
1298		1)	case $1 in
1299			iff)	init=0
1300				;;
1301			print|ref|set)
1302				;;
1303			*)	init=0
1304				ini=$*
1305				set ini
1306				;;
1307			esac
1308		esac
1309		;;
1310	esac
1311	case $# in
1312	0)	case $ifstack in
1313		?*)	echo "$command: $file$line: missing endif" >&$stderr
1314			exit 1
1315			;;
1316		esac
1317		set set out +
1318		;;
1319	esac
1320
1321	# if nesting
1322
1323	while	:
1324	do	case $1 in
1325		"if")	ifstack="$ifelse:$ifstack"
1326			case $ifelse in
1327			KEEP|NONE)
1328				ifelse=TEST
1329				;;
1330			TEST)	;;
1331			*)	ifelse=DONE
1332				;;
1333			esac
1334			shift
1335			case $explicit in
1336			1)	set '' - "$@"; shift ;;
1337			esac
1338			;;
1339		"elif")	case $ifelse in
1340			SKIP)	ifelse=TEST
1341				;;
1342			TEST)	;;
1343			*)	ifelse=DONE
1344				;;
1345			NONE)	echo "$command: $file$line: $1: no matching if" >&$stderr
1346				exit 1
1347				;;
1348			esac
1349			shift
1350			case $explicit in
1351			1)	set '' - "$@"; shift ;;
1352			esac
1353			;;
1354		"else")	case $ifelse in
1355			KEEP)	ifelse=DONE
1356				;;
1357			SKIP|TEST)
1358				ifelse=KEEP
1359				;;
1360			NONE)	echo "$command: $file$line: $1: no matching if" >&$stderr
1361				exit 1
1362				;;
1363			esac
1364			shift
1365			;;
1366		"endif")case $ifelse in
1367			NONE)	echo "$command: $file$line: $1: no matching if" >&$stderr
1368				exit 1
1369				;;
1370			esac
1371			case $shell in
1372			ksh)	ifelse=${ifstack%%:*}
1373				ifstack=${ifstack#*:}
1374				;;
1375			*)	eval `echo $ifstack | sed 's,\([^:]*\):\(.*\),ifelse=\1 ifstack=\2,'`
1376				;;
1377			esac
1378			shift
1379			;;
1380		*)	break
1381			;;
1382		esac
1383	done
1384
1385	# check if "run xxx" is equivalent to "set in xxx"
1386
1387	case $1 in
1388	"("*)		set exp - "$@" ;;
1389	*.iffe|*.iff)	set run "$@" ;;
1390	esac
1391	case $1 in
1392	:)	shift
1393		continue
1394		;;
1395	run)	case $shell in
1396		bsh)	case $2 in
1397			*/*)	x=`echo $2 | sed 's,.*[\\\\/],,'` ;;
1398			*)	x=$2 ;;
1399			esac
1400			;;
1401		*)	eval 'x=${2##*[\\/]}'
1402			;;
1403		esac
1404		case $x in
1405		*.iffe|*.iff)
1406			set set in $2 ;;
1407		*.*)	;;
1408		*)	set set in $2 ;;
1409		esac
1410		;;
1411	esac
1412
1413	# { inc set } drop out early
1414
1415	case $1 in
1416	""|"#"*)continue
1417		;;
1418	inc)	case $ifelse in
1419		DONE|SKIP)	set ''; shift; continue ;;
1420		esac
1421		shift
1422		case $# in
1423		0)	echo "$command: $file$line: path expected" >&$stderr
1424			exit 1
1425			;;
1426		esac
1427		p=$1
1428		shift
1429		if	test ! -f $p
1430		then	echo "$command: $file$line: $p: file not found" >&$stderr
1431			exit 1
1432		fi
1433		case $# in
1434		0)	case $config in
1435			1)	e="^HAVE_" ;;
1436			*)	e="^_" ;;
1437			esac
1438			;;
1439		1)	e=$1
1440			;;
1441		*)	shift
1442			echo "$command: $file$line: warning: $*: operands ignored" >&$stderr
1443			;;
1444		esac
1445		eval `sed -e '/^#define[ 	]/!d' -e 's/#define[ 	]//' -e 's/[ 	(].*//' ${e:+"-e/$e/!d"} -e 's/.*/&=1/' $p | LC_ALL=C sort -u`
1446		continue
1447		;;
1448	set)	case $ifelse in
1449		DONE|SKIP)	set ''; shift; continue ;;
1450		esac
1451		shift
1452		case $1 in
1453		""|"#"*)op=
1454			;;
1455		*)	arg=
1456			op=$1
1457			case $op in
1458			--*)	case $shell in
1459				bsh)	op=`echo X$op | sed 's/X--//'` ;;
1460				*)	op=${op#--} ;;
1461				esac
1462				;;
1463			-*)	case $op in
1464				-??*)	case $shell in
1465					bsh)	arg=`echo X$op | sed 's/X-.//'`
1466						op=`echo X$op | sed 's/X\\(-.\\).*/\\1/'`
1467						;;
1468					*)	arg=${op#-?}
1469						op=${op%$arg}
1470						;;
1471					esac
1472					;;
1473				esac
1474				case $op in
1475				a)	op=all ;;
1476				c)	op=cc ;;
1477				C)	op=config ;;
1478				d)	op=debug ;;
1479				D)	op=define ;;
1480				E)	op=explicit ;;
1481				F)	op=features ;;
1482				i)	op=input ;;
1483				I)	op=include ;;
1484				L)	op=library ;;
1485				n)	op=namval ;;
1486				N)	op=nooptimize ;;
1487				o)	op=output ;;
1488				e)	op=package ;;
1489				p)	op=prototyped ;;
1490				P)	op=pragma ;;
1491				r)	op=regress ;;
1492				s)	op=shell ;;
1493				S)	op=static ;;
1494				O)	op=stdio ;;
1495				u)	op=undef ;;
1496				v)	op=verbose ;;
1497				x)	op=cross ;;
1498				X)	op=exclude ;;
1499				esac
1500				;;
1501			esac
1502			shift
1503			while	:
1504			do	case $# in
1505				0)	break ;;
1506				esac
1507				case $1 in
1508				*" "*)	shift
1509					continue
1510					;;
1511				""|"#"*)break
1512					;;
1513				:)	shift
1514					break
1515					;;
1516				esac
1517				case $arg in
1518				"")	arg=$1 ;;
1519				*)	arg="$arg $1" ;;
1520				esac
1521				shift
1522			done
1523			;;
1524		esac
1525		case $op in
1526		all)	all=1
1527			continue
1528			;;
1529		cc)	occ=
1530			for x in $arg
1531			do	case $occ in
1532				"")	case $x in
1533					*=*)	case $shell in
1534						bsh)	eval $x
1535							export `echo $x | sed 's/=.*//'`
1536							;;
1537						*)	export $x
1538							;;
1539						esac
1540						;;
1541					-O*)	case $optimize in
1542						1)	occ=$x ;;
1543						esac
1544						;;
1545					*)	occ=$x
1546						;;
1547					esac
1548					;;
1549				*)	occ="$occ $x"
1550					;;
1551				esac
1552			done
1553			exclude occ
1554			continue
1555			;;
1556		config)	config=1
1557			continue
1558			;;
1559		cross)	case $arg in
1560			""|-)	cross= ;;
1561			*)	cross="$arg" libpaths= ;;
1562			esac
1563			continue
1564			;;
1565		debug)	debug=$arg
1566			case $arg in
1567			0)	exec 2>&$nullout
1568				set -
1569				show=echo
1570				SHOW=
1571				;;
1572			""|1)	exec 2>&$stderr
1573				set -
1574				show=echo
1575				SHOW=
1576				;;
1577			2|3)	exec 2>&$stderr
1578				case $shell in
1579				ksh)	eval 'PS4="${PS4%+*([ 	])}+\$LINENO+ "'
1580				esac
1581				show=echo
1582				SHOW=
1583				set -x
1584				;;
1585			*)	echo "$command: $arg: debug levels are 0, 1, 2, 3" >&$stderr
1586				;;
1587			esac
1588			continue
1589			;;
1590		define)	define=1
1591			continue
1592			;;
1593		exclude)case $arg in
1594			""|-)	excludes= ;;
1595			*)	excludes="$excludes $arg" ;;
1596			esac
1597			exclude includes occ
1598			continue
1599			;;
1600		explicit)
1601			explicit=1
1602			continue
1603			;;
1604		features)case $arg in
1605			'')	tst= ;;
1606			*)	tst="#include \"$arg\"" ;;
1607			esac
1608			continue
1609			;;
1610		"in"|input)
1611			case $arg in
1612			"")	in=-
1613				;;
1614			*)	in=$arg
1615				if	test ! -r $in
1616				then	echo "$command: $in: not found" >&$stderr
1617					exit 1
1618				fi
1619				exec < $in
1620				file=$in:
1621				case $out in
1622				"")	case $in in
1623					*[.\\/]*)
1624						case $shell in
1625						bsh)	eval `echo $in | sed -e 's,.*[\\\\/],,' -e 's/\\.[^.]*//' -e 's/^/out=/'`
1626							;;
1627						*)	eval 'out=${in##*[\\/]}'
1628							eval 'out=${out%.*}'
1629							;;
1630						esac
1631						;;
1632					*)	out=$in
1633						;;
1634					esac
1635					;;
1636				esac
1637				;;
1638			esac
1639			continue
1640			;;
1641		include)case $arg in
1642			""|-)	includes= ;;
1643			*)	includes="$includes -I$arg" ;;
1644			esac
1645			exclude includes
1646			continue
1647			;;
1648		library)for y in $libpaths
1649			do	eval $y=\"\$$y:\$arg\$${y}_default\"
1650				eval export $y
1651			done
1652			continue
1653			;;
1654		namval)	define=n
1655			continue
1656			;;
1657		nodebug)exec 2>&$nullout
1658			set -
1659			continue
1660			;;
1661		nodefine)
1662			define=0
1663			continue
1664			;;
1665		nooptimize)
1666			optimize=0
1667			case $occ in
1668			*" -O"*)occ=`echo $occ | sed 's/ -O[^ ]*//g'`
1669				cc=$occ
1670				;;
1671			esac
1672			;;
1673		optimize)
1674			optimize=1
1675			;;
1676		out|output)
1677			out=$arg
1678			defhdr=
1679			usr=
1680			deflib=
1681			one=
1682			puthdr=
1683			putlib=
1684			case $op in
1685			output)	continue ;;
1686			esac
1687			def=
1688			test=
1689			;;
1690		package)protoflags="$protoflags -e $arg"
1691			continue
1692			;;
1693		prototyped|noprototyped)
1694			pragma="$pragma $op"
1695			case $op in
1696			prototyped)	prototyped=1 ;;
1697			*)		prototyped= ;;
1698			esac
1699			continue
1700			;;
1701		pragma) pragma="$pragma $arg"
1702			continue
1703			;;
1704		regress)regress=1
1705			version=1995-03-19
1706			continue
1707			;;
1708		shell)	case $arg in
1709			osh)	posix_read=-no
1710				shell=bsh
1711				;;
1712			esac
1713			shell=$arg
1714			continue
1715			;;
1716		static)	static=$arg
1717			continue
1718			;;
1719		stdio)	case $arg in
1720			'')	ext= ;;
1721			*)	ext="#include \"$arg\"" ;;
1722			esac
1723			continue
1724			;;
1725		undef)	undef=1
1726			continue
1727			;;
1728		verbose)verbose=1
1729			continue
1730			;;
1731		*)	echo "$command: $op: unknown option" >&$stderr
1732			exit 1
1733			;;
1734		esac
1735		;;
1736	api|define|extern|header|include|print|reference|ver)
1737		op=$1
1738		shift
1739		arg=
1740		;;
1741	*)	case $2 in
1742		'=')	def=$1
1743			shift
1744			shift
1745			;;
1746		*)	case $1 in
1747			'-'|'?')def=-
1748				shift
1749				;;
1750			*)	def=
1751				;;
1752			esac
1753			;;
1754		esac
1755		case $1 in
1756		'!')	not=1
1757			shift
1758			;;
1759		*)	not=
1760			;;
1761		esac
1762		case $1 in
1763		*'{')	op=-
1764			;;
1765		'('*|'"'*'"'|'<'*'>')
1766			op=exp
1767			case $def in
1768			'')	def=- ;;
1769			esac
1770			;;
1771		*)	op=$1
1772			shift
1773			;;
1774		esac
1775		arg=
1776		cc="$occ $includes"
1777		group=
1778		groups=
1779		fail=
1780		hdr=
1781		lib=
1782		mac=
1783		no=
1784		note=
1785		opt=
1786		pass=
1787		pth=
1788		run=
1789		set=
1790		src=
1791		test=
1792		yes=
1793		case $# in
1794		0)	;;
1795		*)	case $1 in
1796			"#"*)	set x
1797				shift
1798				;;
1799			*)	case $op in
1800				ref)	;;
1801				*)	case $1 in
1802					'-')	case $op:$2 in
1803						tst:*)	arg=$1
1804							case $2 in
1805							-)	shift ;;
1806							esac
1807							;;
1808						*:-*)	arg=$1
1809							shift
1810							;;
1811						*)	def=-
1812							shift
1813							case $1 in
1814							'('*|*'{'|'"'*'"'|'<'*'>')
1815								arg=-
1816								;;
1817							*)	arg=$1
1818								case $# in
1819								0)	;;
1820								*)	shift ;;
1821								esac
1822								;;
1823							esac
1824							;;
1825						esac
1826						;;
1827					-*|+*|'('*|*'{'|'"'*'"'|'<'*'>')
1828						arg=-
1829						;;
1830					*)	arg=$1
1831						shift
1832						;;
1833					esac
1834					;;
1835				esac
1836				;;
1837			esac
1838			case $1 in
1839			'('*|'"'*'"'|'<'*'>')
1840				while	:
1841				do	case $# in
1842					0)	break ;;
1843					esac
1844					case $1 in
1845					*[.{}]*)break ;;
1846					esac
1847					case $test in
1848					'')	test=$1 ;;
1849					*)	test="$test $1" ;;
1850					esac
1851					shift
1852				done
1853				case $arg in
1854				'')	arg=- ;;
1855				esac
1856				case $op in
1857				exp)	case $def in
1858					''|'-')	;;
1859					*)	arg=$def ;;
1860					esac
1861					;;
1862				esac
1863				;;
1864			esac
1865			sline=$line
1866			while	:
1867			do	case $# in
1868				0)	break ;;
1869				esac
1870				case $1 in
1871				"")	;;
1872				"#"*)	set x
1873					;;
1874				"=")	shift
1875					set=$*
1876					case $set in
1877					"")	set=" " ;;
1878					esac
1879					while	:
1880					do	case $# in
1881						0)	break ;;
1882						esac
1883						shift
1884					done
1885					break
1886					;;
1887				[abcdefghijklmnopqrstuvwxyz]*'{'|'{')
1888					v=$1
1889					shift
1890					x=
1891					case $v in
1892					"note{")
1893						sep=" " ;;
1894					*)	sep=$nl ;;
1895					esac
1896					case $v in
1897					'{')	e='}' ;;
1898					*)	e='}end' ;;
1899					esac
1900					n=1
1901					SEP=
1902					while	:
1903					do	case $# in
1904						0)	case $posix_read in
1905							-*)	checkread ;;
1906							esac
1907							case $in in
1908							"")	echo "$command: $file$line: missing }end" >&$stderr
1909								exit 1
1910								;;
1911							esac
1912							while	:
1913							do	case $posix_read in
1914								1)	case $shell in
1915									ksh)	IFS= read -r lin
1916										eof=$?
1917										while	:
1918										do	lin="${lin#[' 	']}"
1919											case $lin in
1920											[' 	']*'#'*);;
1921											*)		break ;;
1922											esac
1923										done
1924										;;
1925									*)	IFS=
1926										read -r lin
1927										eof=$?
1928										IFS=$ifs
1929										case $lin in
1930										[' 	']*) lin=`sed -e 's,^[ 	],,' -e 's,^[ 	]*#,#,' <<!
1931$lin
1932!
1933`
1934											;;
1935										esac
1936										;;
1937									esac
1938									;;
1939								*)	lin=`$posix_read`
1940									eof=$?
1941									;;
1942								esac
1943								case $eof in
1944								0)	case $shell in
1945									ksh)	let line=line+1 ;;
1946									*)	line=`expr $line + 1` ;;
1947									esac
1948									$posix_noglob
1949									set x $lin
1950									$posix_glob
1951									case $2 in
1952									$v)	case $shell in
1953										ksh)	let n=n+1 ;;
1954										*)	n=`expr $n + 1` ;;
1955										esac
1956										;;
1957									$e|$e';')
1958										case $n in
1959										1)	shift
1960											break 2
1961											;;
1962										esac
1963										case $shell in
1964										ksh)	let n=n-1 ;;
1965										*)	n=`expr $n - 1` ;;
1966										esac
1967										;;
1968									esac
1969									x="$x$SEP$lin"
1970									SEP=$sep
1971									;;
1972								*)	echo "$command: $file$line: missing $e" >&$stderr
1973									exit 1
1974									;;
1975								esac
1976							done
1977							;;
1978						esac
1979						case $1 in
1980						$v)	case $shell in
1981							ksh)	let n=n+1 ;;
1982							*)	n=`expr $n + 1` ;;
1983							esac
1984							;;
1985						$e|$e';')
1986							case $n in
1987							1)	break ;;
1988							esac
1989							case $shell in
1990							ksh)	let n=n-1 ;;
1991							*)	n=`expr $n - 1` ;;
1992							esac
1993							;;
1994						esac
1995						x="$x$SEP$1"
1996						SEP=$sep
1997						shift
1998					done
1999					case $v in
2000					'note{');;
2001					*)	x="$x$nl" # \r\n bash needs this barf # ;;
2002					esac
2003					case $v in
2004					'fail{')	fail=$x ;;
2005					'nofail{')	pass=$x v='pass{' ;;
2006					'nopass{')	fail=$x v='fail{' ;;
2007					'no{')		no=$x ;;
2008					'note{')	note=$x ;;
2009					'pass{')	pass=$x ;;
2010					'test{')	test=$x ;;
2011					'yes{'|'{')	yes=$x ;;
2012					*)		src=$x run=$v ;;
2013					esac
2014					;;
2015				:)	shift
2016					break
2017					;;
2018				*[\"\'\(\)\{\}\ \	]*)
2019					case $op in
2020					pth)	pth="$pth $1"
2021						;;
2022					*)	case $test in
2023						'')	test=$1 ;;
2024						*)	test="$test $1" ;;
2025						esac
2026						;;
2027					esac
2028					;;
2029				-)	group=$group$1
2030					case $group in
2031					-)	com_hdr=$hdr
2032						com_lib=$lib
2033						com_mac=$mac
2034						com_opt=$opt
2035						com_pth=$pth
2036						com_test=$test
2037						;;
2038					*)	groups="$groups $1"
2039						;;
2040					esac
2041					;;
2042				-l*)	case $group in
2043					--*)	groups="$groups $1" ;;
2044					*)	lib="$lib $1" ;;
2045					esac
2046					;;
2047				+l*)	case $shell in
2048					bsh)	x=`echo X$1 | sed 's/X+/-/'` ;;
2049					*)	eval 'x=-${1#+}' ;;
2050					esac
2051					case $group in
2052					--*)	groups="$groups $x" ;;
2053					*)	lib="$lib $x" ;;
2054					esac
2055					;;
2056				-*|+*)	case $op in
2057					ref)	cc="$cc $1"
2058						occ="$occ $1"
2059						case $1 in
2060						-L*)	case $shell in
2061							ksh)	x=${1#-L} ;;
2062							*)	x=`echo x$1 | sed 's,^x-L,,'` ;;
2063							esac
2064							for y in $libpaths
2065							do	eval $y=\"\$$y:\$x\$${y}_default\"
2066								eval export $y
2067							done
2068							;;
2069						esac
2070						;;
2071					*)	case $group in
2072						--*)	groups="$groups $1"
2073							;;
2074						*)	case $op in
2075							run)	opt="$opt $1"
2076								;;
2077							*)	case $1 in
2078								-D*)	mac="$mac $1" ;;
2079								*)	cc="$cc $1" ;;
2080								esac
2081								;;
2082							esac
2083							;;
2084						esac
2085						;;
2086					esac
2087					;;
2088				*.[aAxX]|*.[dD][lL][lL]|*.[lL][iI][bB])
2089					case $group in
2090					--*)	groups="$groups $1" ;;
2091					*)	lib="$lib $1" ;;
2092					esac
2093					;;
2094				*[.\\/]*)
2095					case $group in
2096					--*)	groups="$groups $1"
2097						;;
2098					*)	case $op in
2099						pth)	pth="$pth $1" ;;
2100						*)	hdr="$hdr $1" ;;
2101						esac
2102						;;
2103					esac
2104					;;
2105				*)	case $group in
2106					--*)	groups="$groups $1"
2107						;;
2108					*)	case $op in
2109						pth)	pth="$pth $1"
2110							;;
2111						*)	case $test in
2112							'')	test=$1 ;;
2113							*)	test="$test $1" ;;
2114							esac
2115							;;
2116						esac
2117						;;
2118					esac
2119					;;
2120				esac
2121				shift
2122			done
2123			case $group in
2124			-)	group= ;;
2125			esac
2126			;;
2127		esac
2128		;;
2129	esac
2130	case $ifelse in
2131	DONE|SKIP)	continue ;;
2132	esac
2133
2134	# make sure $cc compiles C
2135
2136	case $cc in
2137	"")	cc="$occ $includes" ;;
2138	esac
2139	case $cctest in
2140	"")	# check for local package root directories
2141
2142		case $PACKAGE_PATH in
2143		?*)	for i in `echo $PACKAGE_PATH | sed 's,:, ,g'`
2144			do	if	test -d $i/include
2145				then	cc="$cc -I$i/include"
2146					occ="$occ -I$i/include"
2147				fi
2148				if	test -d $i/lib
2149				then	cc="$cc -L$i/lib"
2150					occ="$occ -L$i/lib"
2151					for y in $libpaths
2152					do	eval $y=\"\$$y:\$i/lib\$${y}_default\"
2153						eval export $y
2154					done
2155				fi
2156			done
2157			;;
2158		esac
2159		echo "int i = 1;" > $tmp.c
2160		if	compile $cc -c $tmp.c <&$nullin >&$nullout
2161		then	echo "(;" > $tmp.c
2162			if	compile $cc -c $tmp.c <&$nullin >&$nullout
2163			then	cctest="should not compile '(;'"
2164			fi
2165		else	cctest="should compile 'int i = 1;'"
2166		fi
2167		case $cctest in
2168		"")	cctest=0
2169			;;
2170		*)	echo "$command: $cc: not a C compiler: $cctest" >&$stderr
2171			exit 1
2172			;;
2173		esac
2174		;;
2175	esac
2176
2177	# some ops allow no args
2178
2179	case $arg in
2180	'')	case $op in
2181		api)	arg=-
2182			case $1:$2 in
2183			[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]*:[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9])
2184				a=$1
2185				shift
2186				case " $apis " in
2187				*" $a "*)
2188					;;
2189				*)	apis="$apis $a"
2190					eval api_sym_${a}= api_ver_${a}=
2191					;;
2192				esac
2193				rel=
2194				while	:
2195				do	case $# in
2196					0)	break ;;
2197					esac
2198					case $1 in
2199					[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9])
2200						rel="$rel $1"
2201						;;
2202					*)	break
2203						;;
2204					esac
2205					shift
2206				done
2207				while	:
2208				do	case $# in
2209					0)	break ;;
2210					esac
2211					case $1 in
2212					:)	break ;;
2213					esac
2214					eval syms='$'api_sym_${a}
2215					case $syms in
2216					'')	sep='' ;;
2217					*)	sep=$nl ;;
2218					esac
2219					for r in $rel
2220					do	syms=$syms$sep${1}:${r}
2221						sep=$nl
2222					done
2223					eval api_sym_${a}='$'syms
2224					shift
2225				done
2226				;;
2227			*)	echo "$command: $op: expected: name YYYYMMDD symbol ..." >&$stderr
2228				;;
2229			esac
2230			while	:
2231			do	case $# in
2232				0)	break ;;
2233				esac
2234				case $1 in
2235				:)	break ;;
2236				esac
2237				shift
2238			done
2239			;;
2240		iff|ini)arg=-
2241			;;
2242		comment)cat <<!
2243/* $* */
2244!
2245			continue
2246			;;
2247		define)	x=$1
2248			shift
2249			case $1 in
2250			'('*')')
2251				arg=$1
2252				shift
2253				;;
2254			esac
2255			case $in in
2256			"")	v=
2257				while	:
2258				do	case $# in
2259					0)	break ;;
2260					esac
2261					t=$1
2262					shift
2263					case $t in
2264					":")	break ;;
2265					esac
2266					v="$v $t"
2267				done
2268				;;
2269			*)	v=$*
2270				;;
2271			esac
2272			is mac $x
2273			copy $tmp.c "$std
2274$usr
2275#ifndef $x
2276(
2277#endif
2278int x;
2279"
2280			if	compile $cc -c $tmp.c <&$nullin >&$nullout
2281			then	success -
2282			else	failure -
2283				cat <<!
2284#define $x$arg	$v
2285!
2286				usr="$usr${nl}#define $x$arg  $v"
2287			fi
2288			continue
2289			;;
2290		extern)	x=$1
2291			shift
2292			t=$1
2293			shift
2294			is npt $x
2295			copy $tmp.c "
2296$std
2297#include <sys/types.h>
2298$usr
2299_BEGIN_EXTERNS_
2300struct _iffe_struct { int _iffe_member; };
2301extern struct _iffe_struct* $x _ARG_((struct _iffe_struct*));
2302_END_EXTERNS_
2303"
2304			# some compilers with -O only warn for invalid intrinsic prototypes
2305			case " $cc " in
2306			*" -O "*)	xx=`echo $cc | sed 's/ -O / /g'` ;;
2307			*)		xx=$cc ;;
2308			esac
2309			if	compile $xx -c $tmp.c <&$nullin >&$nullout
2310			then	success -
2311				while	:
2312				do	case $1 in
2313					''|'('*|'['*)
2314						break
2315						;;
2316					esac
2317					t="$t $1"
2318					shift
2319				done
2320				case $in in
2321				"")	v=
2322					while	:
2323					do	case $# in
2324						0)	break ;;
2325						esac
2326						t=$1
2327						shift
2328						case $t in
2329						":")	break ;;
2330						esac
2331						v="$v $t"
2332					done
2333					;;
2334				*)	v=$*
2335					;;
2336				esac
2337				cat <<!
2338extern $t	$x$v;
2339!
2340				# NOTE: technically if prototyped is on all tests should
2341				#	be run through proto(1), but we'd like iffe to
2342				#	work sans proto -- so we drop the extern's in
2343				#	the test headers
2344				case $prototyped in
2345				'')	usr="$usr${nl}extern $t $x$v;" ;;
2346				esac
2347			else	failure -
2348				case $in in
2349				"")	while	:
2350					do	case $# in
2351						0)	break ;;
2352						esac
2353						case $1 in
2354						":")	break ;;
2355						esac
2356					done
2357					;;
2358				esac
2359			fi
2360			continue
2361			;;
2362		header|include|reference)
2363			while	:
2364			do	case $# in
2365				0)	break ;;
2366				esac
2367				x=$1
2368				shift
2369				case $x in
2370				":")	break ;;
2371				esac
2372				case " $gothdr " in
2373				*" - $x "*)
2374					;;
2375				*" + $x "*)
2376					case $usr in
2377					*"# include <"$x">"*)
2378						;;
2379					*)	case $op in
2380						reference)
2381							;;
2382						*)	cat <<!
2383#include <$x>
2384!
2385							;;
2386						esac
2387						usr="$usr${nl}#include <$x>"
2388						;;
2389					esac
2390					;;
2391				*)	copy $tmp.c "$std
2392$usr
2393#include <$x>
2394int x;
2395"
2396					if	is_hdr - $x
2397					then	gothdr="$gothdr + $x"
2398						case $op in
2399						reference)
2400							;;
2401						*)	cat <<!
2402#include <$x>
2403!
2404							;;
2405						esac
2406						usr="$usr${nl}#include <$x>"
2407					else	gothdr="$gothdr - $x"
2408					fi
2409					;;
2410				esac
2411			done
2412			continue
2413			;;
2414		print)	case $in in
2415			"")	v=
2416				while	:
2417				do	case $# in
2418					0)	break ;;
2419					esac
2420					t=$1
2421					shift
2422					case $t in
2423					":")	break ;;
2424					esac
2425					v="$v $t"
2426				done
2427				;;
2428			*)	v=$*
2429				;;
2430			esac
2431			cat <<!
2432$*
2433!
2434			usr="$usr${nl}$v"
2435			continue
2436			;;
2437		ver)	arg=-
2438			case $1:$2 in
2439			[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]*:[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9])
2440				vers="$vers$nl$1"
2441				eval ver_$1=$2
2442				;;
2443			*)	echo "$command: $op: expected: name YYYYMMDD" >&$stderr
2444				;;
2445			esac
2446			while	:
2447			do	case $# in
2448				0)	break ;;
2449				esac
2450				case $1 in
2451				:)	break ;;
2452				esac
2453				shift
2454			done
2455			;;
2456		esac
2457		;;
2458	esac
2459
2460	# save $* for ancient shells
2461
2462	argx=1
2463	argv=$*
2464
2465	# loop on all candidate groups
2466
2467	while	:
2468	do
2469		# check the candidate macros
2470
2471		cc="$cc $mac"
2472
2473		# check for global default headers (some cc -E insist on compiling)
2474
2475		case $hdrtest in
2476		'')	hdrtest=1
2477			allinc=
2478			for x in types
2479			do	case $config in
2480				0)	c=_sys_${x}
2481					;;
2482				1)	case $shell in
2483					ksh)	typeset -u u=$x ;;
2484					*)	u=`echo $x | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` ;;
2485					esac
2486					c=HAVE_SYS_${u}_H
2487					;;
2488				esac
2489				x=sys/$x.h
2490				echo "${allinc}#include <$x>" > $tmp.c
2491				if	is_hdr $x
2492				then	gothdr="$gothdr + $x"
2493					case $explicit in
2494					0)	can="$can$cansep#define $c	1	/* #include <$x> ok */"
2495						nan="$nan$cansep$c=1"
2496						cansep=$nl
2497						;;
2498					esac
2499					eval $c=1
2500					allinc="${allinc}#include <$x>$nl"
2501				else	gothdr="$gothdr - $x"
2502					case $explicit$all$config$undef in
2503					0?1?|0??1)
2504						can="$can$cansep#undef	$c		/* #include <$x> not ok */"
2505						nan="$nan$cansep$c="
2506						cansep=$nl
2507						;;
2508					01??)	can="$can$cansep#define $c	0	/* #include <$x> not ok */"
2509						nan="$nan$cansep$c=0"
2510						cansep=$nl
2511						;;
2512					esac
2513				fi
2514			done
2515			;;
2516		esac
2517
2518		# add implicit headers/libraries before the checks
2519
2520		case $op in
2521		npt)	hdr="sys/types.h stdlib.h unistd.h $hdr"
2522			;;
2523		siz|typ)hdr="sys/types.h time.h sys/time.h sys/times.h stddef.h stdlib.h $hdr"
2524			;;
2525		esac
2526
2527		# check the candidate headers
2528
2529		case $hdr in
2530		?*)	z=$hdr
2531			hdr=
2532			dis=0
2533			for x in $z
2534			do	case $x in
2535				*.h)	case " $gothdr " in
2536					*" - $x "*)
2537						continue
2538						;;
2539					*" + $x "*)
2540						;;
2541					*)	case $shell in
2542						bsh)	eval `echo $x | sed -e 's,^\\([^\\\\/]*\\).*[\\\\/]\\([^\\\\/]*\\)\$,\\1_\\2,' -e 's/\\..*//' -e 's/^/c=/'`
2543							;;
2544						*)	eval 'c=${x##*[\\/]}'
2545							eval 'c=${c%%.*}'
2546							case $x in
2547							*/*)	eval 'c=${x%%[\\/]*}_${c}' ;;
2548							esac
2549							;;
2550						esac
2551						case $explicit in
2552						0)	dis=0
2553							;;
2554						*)	case $x in
2555							*/*)	dis=$c ;;
2556							*)	dis=hdr ;;
2557							esac
2558							case ${dis}_ in
2559							${op}_*)dis=0 ;;
2560							*)	dis=1 ;;
2561							esac
2562							;;
2563						esac
2564						case $config in
2565						0)	case $x in
2566							*/*)	c=_${c} ;;
2567							*)	c=_hdr_${c} ;;
2568							esac
2569							;;
2570						1)	case $shell in
2571							ksh)	typeset -u u=$c ;;
2572							*)	u=`echo $c | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` ;;
2573							esac
2574							c=HAVE_${u}_H
2575							;;
2576						esac
2577						echo "${allinc}#include <$x>" > $tmp.c
2578						if	is_hdr $x
2579						then	gothdr="$gothdr + $x"
2580							case $dis in
2581							0)	can="$can$cansep#define $c	1	/* #include <$x> ok */"
2582								nan="$nan$cansep$c=1"
2583								cansep=$nl
2584								;;
2585							esac
2586							eval $c=1
2587						else	gothdr="$gothdr - $x"
2588							case $dis$all$config$undef in
2589							0?1?|0??1)
2590								can="$can$cansep#undef	$c		/* #include <$x> not ok */"
2591								nan="$nan$cansep$c="
2592								cansep=$nl
2593								;;
2594							01??)	can="$can$cansep#define $c	0	/* #include <$x> not ok */"
2595								nan="$nan$cansep$c=0"
2596								cansep=$nl
2597								;;
2598							esac
2599							continue
2600						fi
2601						;;
2602					esac
2603					;;
2604				*)	test -r $x || continue
2605					;;
2606				esac
2607				hdr="$hdr $x"
2608			done
2609			;;
2610		esac
2611
2612		# check the candidate libraries
2613
2614		case $lib in
2615		?*)	z=$lib
2616			lib=
2617			p=
2618			hit=0
2619			echo "int main(){return(0);}" > $tmp.c
2620			for x in $z
2621			do	p=$x
2622				case " $gotlib " in
2623				*"- $p "*)
2624					failure +
2625					p=
2626					;;
2627				*"+ $p "*)
2628					success +
2629					lib="$lib $p"
2630					;;
2631				*)	rm -f $tmp.exe
2632					is LIB $p
2633					if	compile $cc -o $tmp.exe $tmp.c $p <&$nullin >&$nullout
2634					then	success
2635						gotlib="$gotlib + $p"
2636						lib="$lib $p"
2637						e=0
2638					else	a=
2639						e=1
2640						for l in $z
2641						do	case $l in
2642							-)	a=
2643								continue
2644								;;
2645							$p)	a=$p
2646								continue
2647								;;
2648							*)	case $gotlib in
2649								*" $l "*)	continue ;;
2650								esac
2651								;;
2652							esac
2653							case $a in
2654							$p)	a="$a $l"
2655								if	compile $cc -o $tmp.exe $tmp.c $a <&$nullin >&$nullout
2656								then	success
2657									gotlib="$gotlib + $p"
2658									lib="$lib $p"
2659									e=0
2660									break
2661								fi
2662								;;
2663							esac
2664						done
2665						case $e in
2666						1)	failure
2667							gotlib="$gotlib - $p"
2668							;;
2669						esac
2670					fi
2671					y=
2672					for x in $p
2673					do	case $shell in
2674						bsh)	c=`echo X$x | sed 's,X-l,,'` ;;
2675						*)	eval 'c=${x#-l}' ;;
2676						esac
2677						case $c in
2678						*[!abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]*)
2679							c=`echo '' $c | sed -e 's,.*[\\\\/],,' -e 's,\.[^.]*$,,' -e 's,[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_],_,g' -e '/^lib./s,^lib,,'`
2680							;;
2681						esac
2682						case $config in
2683						0)	case $e$p in
2684							0*' '*)	case " $gotlib " in
2685								*[-+]" $x "*)
2686									;;
2687								*)	can="$can$cansep#define _LIB_$c	1	/* $x is a library */"
2688									nan="$nan${cansep}_LIB_$c=1"
2689									cansep=$nl
2690									eval _LIB_$c=1
2691									;;
2692								esac
2693								;;
2694							esac
2695							;;
2696						1)	case $shell in
2697							ksh)	typeset -u u=$c ;;
2698							*)	u=`echo $c | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` ;;
2699							esac
2700							c=$u
2701							case $e in
2702							0*' '*)	case " $gotlib " in
2703								*[-+]" $x "*)
2704									;;
2705								*)	can="$can$cansep#define HAVE_${c}_LIB	1	/* $x is a library */"
2706									nan="$nan${cansep}HAVE_${c}_LIB=1"
2707									cansep=$nl
2708									eval HAVE_${c}_LIB=1
2709									;;
2710								esac
2711								;;
2712							esac
2713							;;
2714						esac
2715						y=${y}_$c
2716					done
2717					case $config in
2718					0)	c=_LIB${y} ;;
2719					1)	c=HAVE${y}_LIB ;;
2720					esac
2721					case $p in
2722					*' '*)	q="a library group" ;;
2723					*)	q="a library" ;;
2724					esac
2725					case $e in
2726					0)	can="$can$cansep#define $c	1	/* $p is $q */"
2727						nan="$nan$cansep$c=1"
2728						cansep=$nl
2729						eval $c=1
2730						case $hit in
2731						1)	break ;;
2732						esac
2733						;;
2734					1)	case $all$config$undef in
2735						?1?|??1)can="$can$cansep#undef	$c		/* $p is not $q */"
2736							nan="$nan$cansep$c="
2737							cansep=$nl
2738							;;
2739						1??)	can="$can$cansep#define $c	0	/* $p is not $q */"
2740							nan="$nan$cansep$c=0"
2741							cansep=$nl
2742							;;
2743						esac
2744						eval $c=0
2745						;;
2746					esac
2747					p=
2748					;;
2749				esac
2750			done
2751			;;
2752		esac
2753
2754		# last op precheck
2755
2756		case $op in
2757		ref)	deflib="$deflib $lib"
2758			defhdr="$defhdr $hdr"
2759			break
2760			;;
2761		esac
2762		IFS=" ,"
2763		case $shell in
2764		bash)	op=`echo $op`
2765			arg=`echo $arg`
2766			;;
2767		*)	eval op=\"$op\"
2768			eval arg=\"$arg\"
2769			;;
2770		esac
2771		IFS=$ifs
2772
2773		# check for op aliases
2774
2775		x=
2776		for o in $op
2777		do	case $o in
2778			def|default)	x="$x cmd dat hdr key lib mth sys typ" ;;
2779			*)		x="$x $o" ;;
2780			esac
2781		done
2782
2783		# loop on the ops o and args a
2784
2785		result=UNKNOWN
2786		for o in $x
2787		do	for a in $arg
2788			do	c=
2789				case $a in
2790				*[.\\/]*)
2791					case $o in
2792					hdr|lcl|nxt|pth|sys)
2793						x=$a
2794						case $x in
2795						*.lcl|*.nxt)
2796							case $o in
2797							sys)	x=sys/$x ;;
2798							esac
2799							case $shell in
2800							bsh)	eval `echo $x | sed 's,\\(.*\\)\.\\([^.]*\\),x=\\1 o=\\2,'`
2801								;;
2802							*)	o=${x##*.}
2803								x=${x%.${o}}
2804								;;
2805							esac
2806							v=$x
2807							;;
2808						esac
2809						case $x in
2810						*[\\/]*)case $shell in
2811							bsh)	eval `echo $x | sed 's,\\(.*\\)[\\\\//]\\(.*\\),p=\\1 v=\\2,'`
2812								;;
2813							*)	eval 'p=${x%/*}'
2814								eval 'v=${x##*/}'
2815								;;
2816							esac
2817							;;
2818						*.*)	case $shell in
2819							bsh)	eval `echo $x | sed 's,\\(.*\\)\\.\\(.*\\),p=\\1 v=\\2,'`
2820								;;
2821							*)	eval 'p=${x%.*}'
2822								eval 'v=${x##*.}'
2823								;;
2824							esac
2825							;;
2826						*)	p=
2827							;;
2828						esac
2829						case $o in
2830						lcl|nxt)	c=$v.$o ;;
2831						*)		c=$v ;;
2832						esac
2833						;;
2834					*)	case $shell in
2835						bsh)	eval `echo $a | sed -e 's,.*[\\\\/],,' -e 's/\\(.*\\)\\.\\(.*\\)/p=\\1 v=\\2/'`
2836							;;
2837						*)	eval 'p=${a%.*}'
2838							eval 'p=${p##*[\\/]}'
2839							eval 'v=${a##*.}'
2840							eval 'v=${v##*[\\/]}'
2841							;;
2842						esac
2843						;;
2844					esac
2845					case $p in
2846					'')	f=${v} ;;
2847					*)	f=${p}/${v} ;;
2848					esac
2849					case $o in
2850					run)	v=$p
2851						p=
2852						m=_${v}
2853						;;
2854					mem)	case $p in
2855						*.*)	case $shell in
2856							bsh)	eval `echo $p | sed 's/\\([^.]*\\)\\.\\(.*\\)/p=\\1 m=\\2/'`
2857								;;
2858							*)	eval 'm=${p#*.}'
2859								eval 'p=${p%%.*}'
2860								;;
2861							esac
2862							v=${m}.${v}
2863						esac
2864						case $config in
2865						0)	m=_${v}_${p} ;;
2866						1)	m=_${v}_in_${p} ;;
2867						esac
2868						;;
2869					*)	case $p in
2870						'')	m=_${v} ;;
2871						*)	m=_${p}_${v} ;;
2872						esac
2873						;;
2874					esac
2875					;;
2876				*)	p=
2877					v=$a
2878					f=$a
2879					m=_${v}
2880					;;
2881				esac
2882				case $c in
2883				'')	c=$v ;;
2884				esac
2885				M=$m
2886				case $o in
2887				out)	case $a in
2888					-)	a=-
2889						;;
2890					?*)	test="$a $test"
2891						a=
2892						;;
2893					esac
2894					;;
2895				*)	case " $idyes " in
2896					*" $m "*)
2897						i=1
2898						;;
2899					*)	case " $idno " in
2900						*" $m "*)
2901							i=0
2902							;;
2903						*)	case $m in
2904							*'*')	m=`echo "$m" | sed 's,\*,_ptr,g'` ;;
2905							esac
2906							case $m in
2907							*[-+/\\]*)
2908								i=0
2909								;;
2910							*[!abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]*)
2911								is id $m
2912								copy $tmp.c "int $m = 0;"
2913								if	compile $cc -c $tmp.c
2914								then	success -
2915									idyes="$idyes $m"
2916									i=1
2917								else	failure -
2918									idno="$idno $m"
2919									i=0
2920								fi
2921								;;
2922							*)	i=1
2923								;;
2924							esac
2925							;;
2926						esac
2927						case $i in
2928						0)	case $o in
2929							dat|dfn|key|lib|mac|mth|nos|npt|siz|sym|typ|val)
2930								continue
2931								;;
2932							esac
2933							;;
2934						esac
2935						;;
2936					esac
2937					;;
2938				esac
2939				case $m in
2940				*[!abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]*)
2941					m=`echo "X$m" | sed -e 's,^.,,' -e 's,[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_],_,g'`
2942					;;
2943				esac
2944
2945				# check output redirection
2946
2947				case $out in
2948				$cur)	;;
2949				*)	case $cur in
2950					$a|$c)	;;
2951					*)	case $cur in
2952						.)	;;
2953						*)	case $vers in
2954							?*)	echo
2955								for api in $vers
2956								do	API=`echo $api | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`
2957									eval ver='${'ver_${api}'}'
2958									echo "#define ${API}_VERSION	${ver}"
2959								done
2960							esac
2961							case $apis in
2962							?*)	for api in $apis
2963								do	map=
2964									sep=
2965									eval syms='"${'api_sym_${api}'}"'
2966									# old solaris requires -k<space><junk> #
2967									set x x `echo "$syms" | sort -t: -u -k 1,1 -k 2,2nr | sed 's/\(.*\):\(.*\)/\1 \2/'`
2968									sym=
2969									while	:
2970									do	shift 2
2971										case $# in
2972										[01])	break ;;
2973										esac
2974										prv=$sym
2975										sym=$1
2976										rel=$2
2977										case $prv in
2978										$sym)	echo "#elif _API_${api} >= $rel"
2979											;;
2980										*)	case $prv in
2981											'')	echo
2982												echo "#if !defined(_API_${api}) && defined(_API_DEFAULT)"
2983												echo "#define _API_${api}	_API_DEFAULT"
2984												echo "#endif"
2985												;;
2986											*)	echo "#endif"
2987												;;
2988											esac
2989											echo
2990											echo "#if ( _BLD_${api} || !_API_${api} || _API_${api} >= $rel )"
2991											;;
2992										esac
2993										echo "#undef	${sym}"
2994										echo "#define ${sym}	${sym}_${rel}"
2995										map=$map$sep${sym}_${rel}
2996										sep=' '
2997									done
2998									echo "#endif"
2999									echo
3000									echo "#define _API_${api}_MAP	\"$map\""
3001								done
3002								echo
3003								;;
3004							esac
3005							case $iff in
3006							?*)	echo "#endif" ;;
3007							esac
3008							case $cur in
3009							-)	;;
3010							*)	exec >/dev/null
3011								case $cur in
3012								*[\\/]*|*.h)	x=$cur ;;
3013								*)		x=$dir/$cur ;;
3014								esac
3015								case $define in
3016								n)	sed '/^#/d' $tmp.h > $tmp.c
3017									sed '/^#/d' $x > $tmp.t
3018									;;
3019								*)	(proto -r $protoflags $tmp.h) >/dev/null 2>&1
3020									sed 's,/\*[^/]*\*/, ,g' $tmp.h > $tmp.c
3021									sed 's,/\*[^/]*\*/, ,g' $x > $tmp.t
3022									;;
3023								esac
3024								if	cmp -s $tmp.c $tmp.t
3025								then	rm -f $tmp.h
3026									case $verbose in
3027									1)	echo "$command: $x: unchanged" >&$stderr ;;
3028									esac
3029								else	case $x in
3030									${dir}[\\/]$cur)	test -d $dir || mkdir $dir || exit 1 ;;
3031									esac
3032									mv $tmp.h $x
3033								fi
3034								;;
3035							esac
3036							;;
3037						esac
3038						case $out in
3039						+)	case $status in
3040							1)	;;
3041							*)	status=0 ;;
3042							esac
3043							exit $status
3044							;;
3045						-)	eval "exec >&$stdout"
3046							;;
3047						*)	exec >$tmp.h
3048							;;
3049						esac
3050						case $out in
3051						"")	case $a in
3052							*[\\/]*|???????????????*) cur=$c ;;
3053							*)			cur=$a ;;
3054							esac
3055							;;
3056						*)	cur=$out
3057							;;
3058						esac
3059						case $in in
3060						""|-|+)	case $o in
3061							run)	x=" from $a" ;;
3062							*)	x= ;;
3063							esac
3064							;;
3065						*)	x=" from $in"
3066							;;
3067						esac
3068
3069						# output header comments
3070
3071						case $define in
3072						n)	;;
3073						?)	echo "/* : : generated$x by $command version $version : : */"
3074							for x in $pragma
3075							do	echo "#pragma $x"
3076							done
3077							case $out in
3078							""|-|+)	x=$m
3079								;;
3080							*.*)	case $shell in
3081								bsh)	eval `echo $in | sed -e 's,\\.,_,g' -e 's/^/x=/'`
3082									;;
3083								*)	i=$out
3084									x=_
3085									while	:
3086									do	case $i in
3087										*.*)	eval 'x=$x${i%%.*}_'
3088											eval 'i=${i#*.}'
3089											;;
3090										*)	x=$x$i
3091											break
3092											;;
3093										esac
3094									done
3095									;;
3096								esac
3097								;;
3098							*)	x=_$out
3099								;;
3100							esac
3101							case $o in
3102							iff)	case $M in
3103								""|*-*)	 ;;
3104								*)	iff=${m}_H ;;
3105								esac
3106								;;
3107							*)	case $regress in
3108								'')	case $x in
3109									*-*)	;;
3110									*)	x=`pwd | sed -e 's,.*[\\\\/],,' -e 's,\\..*,,' -e 's,^lib,,' -e 's,^,'${x}_',' -e 's,[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_],_,g'`
3111										# ksh n+ bug workaround
3112										case $x in
3113										*[!_]*)	;;
3114										*)	x=_$$ ;;
3115										esac
3116										iff=_def${x}
3117										;;
3118									esac
3119									;;
3120								*)	case $x in
3121									*-*)	;;
3122									*)	iff=_REGRESS
3123										;;
3124									esac
3125									;;
3126								esac
3127								;;
3128							esac
3129							case $iff in
3130							?*)	echo "#ifndef $iff"
3131								echo "#define $iff	1"
3132								;;
3133							esac
3134							;;
3135						esac
3136						;;
3137					esac
3138					;;
3139				esac
3140				case $can in
3141				?*)	case $define in
3142					1)	echo "$can" ;;
3143					n)	echo "$nan" ;;
3144					esac
3145					can=
3146					nan=
3147					cansep=
3148					;;
3149				esac
3150
3151				# set up the candidate include list
3152
3153				pre=
3154				inc=
3155				for x in $defhdr - $hdr
3156				do	case $x in
3157					-)	case $pre in
3158						?*)	continue ;;
3159						esac
3160						case $v in
3161						*.*)	for x in `echo $v | sed 's,\\., ,g'`
3162							do	pre="$pre
3163#undef	$x"
3164							done
3165							;;
3166						*)	case $o in
3167							siz|typ)case $v in
3168								char|short|int|long)
3169									;;
3170								*)	pre="#undef	$v"
3171									;;
3172								esac
3173								;;
3174							*)	pre="#undef	$v"
3175								;;
3176							esac
3177							;;
3178						esac
3179						;;
3180					*.h)	case $shell in
3181						bsh)	eval `echo $x | sed -e 's,^\\([^\\\\/]*\\).*[\\\\/]\\([^\\\\/]*\\)\$,\\1_\\2,' -e 's/\\..*//' -e 's/^/c=/'`
3182							;;
3183						*)	eval 'c=${x##*[\\/]}'
3184							eval 'c=${c%%.*}'
3185							case $x in
3186							*/*)	eval 'c=${x%%[\\/]*}_${c}' ;;
3187							esac
3188							;;
3189						esac
3190						case $config in
3191						0)	case $x in
3192							*/*)	c=_${c} ;;
3193							*)	c=_hdr_${c} ;;
3194							esac
3195							;;
3196						1)	case $shell in
3197							ksh)	typeset -u u=$c ;;
3198							*)	u=`echo $c | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` ;;
3199							esac
3200							c=HAVE_${u}_H
3201							;;
3202						esac
3203						case " $puthdr " in
3204						*" $c "*)
3205							;;
3206						*)	puthdr="$puthdr $c"
3207							usr="$usr$nl#define $c 1"
3208							;;
3209						esac
3210						inc="$inc
3211#include <$x>"
3212						;;
3213					esac
3214				done
3215
3216				# set up the candidate lib list
3217
3218				for x in $lib $deflib
3219				do	case $shell in
3220					ksh)	eval 'c=${x#-l}' ;;
3221					*)	c=`echo X$x | sed 's,X-l,,'` ;;
3222					esac
3223					case $c in
3224					*[!abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]*)
3225						c=`echo '' $c | sed -e 's,.*[\\\\/],,' -e 's,\.[^.]*$,,' -e 's,[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_],_,g' -e '/^lib./s,^lib,,'`
3226						;;
3227					esac
3228					case $config in
3229					0)	c=_LIB_${c}
3230						;;
3231					1)	case $shell in
3232						ksh)	typeset -u u=$c ;;
3233						*)	u=`echo $c | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` ;;
3234						esac
3235						c=HAVE_${u}_LIB
3236						;;
3237					esac
3238					case " $putlib " in
3239					*" $c "*)
3240						;;
3241					*)	putlib="$putlib $c"
3242						usr="$usr$nl#define $c 1"
3243						;;
3244					esac
3245				done
3246
3247				# src overrides builtin test
3248
3249				case $config:$def in
3250				0:)	case $o in
3251					tst|var);;
3252					*)	m=_${o}${m} ;;
3253					esac
3254					;;
3255				1:)	case $o in
3256					tst|var)m=${v} ;;
3257					esac
3258					case $shell in
3259					ksh)	typeset -u u=$m ;;
3260					*)	u=`echo $m | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` ;;
3261					esac
3262					case $o in
3263					tst|var)case $m in
3264						$u)	;;
3265						*)	case $m in
3266							hdr_*|lib_*|sys_*)
3267								case $shell in
3268								ksh)	u=${u#????} ;;
3269								*)	u=`echo $u | sed 's/....//'` ;;
3270								esac
3271								;;
3272							esac
3273							m=HAVE_${u}
3274							;;
3275						esac
3276						;;
3277					dat)	m=HAVE${u}_DATA ;;
3278					hdr|lcl)m=HAVE${u}_H ;;
3279					key)	m=HAVE${u}_RESERVED ;;
3280					mth)	m=HAVE${u}_MATH ;;
3281					npt)	m=HAVE${u}_DECL ;;
3282					pth)	m=${u}_PATH
3283						case $shell in
3284						ksh)	m=${m#_} ;;
3285						*)	m=`echo $m | sed 's,^_,,'` ;;
3286						esac
3287						;;
3288					nxt)	m=HAVE${u}_NEXT ;;
3289					siz)	m=SIZEOF${u} ;;
3290					sys)	m=HAVE_SYS${u}_H ;;
3291					*)	m=HAVE${u} ;;
3292					esac
3293					;;
3294				*)	m=$def
3295					M=$m
3296					;;
3297				esac
3298				case $src in
3299				?*)	case $src in
3300					$noext)	EXT= ;;
3301					*)	EXT="$tst
3302$ext"
3303						;;
3304					esac
3305					copy $tmp.c "$std
3306$EXT
3307$usr
3308$inc
3309$src
3310"
3311					V=1
3312					e=0
3313					is tst "${note:-$run}"
3314					case $run in
3315					cat*|nocat*)
3316						copy - "$src"
3317						;;
3318					cross*|nocross*)
3319						copy $tmp.sh "$src"
3320						chmod +x $tmp.sh
3321						execute $tmp.sh <&$nullin || e=1
3322						;;
3323					run*|norun*)
3324						(eval "$src") <&$nullin || e=1
3325						;;
3326					mac*|nomac*)
3327						if	compile $cc -E $tmp.c <&$nullin >$tmp.i
3328						then	sed -e '/<<[ 	]*".*"[ 	]*>>/!d' -e 's/<<[ 	]*"//g' -e 's/"[ 	]*>>//g' $tmp.i
3329						else	e=1
3330						fi
3331						;;
3332					p*|nop*)compile $cc -DTEST=$p -DID=$v -E $tmp.c <&$nullin >&$nullout || e=1
3333						;;
3334					c*|noc*)compile $cc -DTEST=$p -DID=$v -c $tmp.c <&$nullin >&$nullout || e=1
3335						;;
3336					*)	case $run in
3337						status*)ccflags=
3338							;;
3339						s*|nos*)case $reallystatictest in
3340							'')	#UNDENT...
3341
3342			reallystatictest=.
3343			echo "$tst
3344$ext
3345int main(){printf("hello");return(0);}" > ${tmp}s.c
3346			rm -f ${tmp}s.exe
3347			if	compile $cc -c ${tmp}s.c <&$nullin >&$nullout &&
3348				compile $cc -o ${tmp}s.exe ${tmp}s.o <&$nullin >&$nullout 2>${tmp}s.e &&
3349				$executable ${tmp}s.exe
3350			then	e=`wc -l ${tmp}s.e`
3351				eval set x x $binding
3352				while	:
3353				do	shift
3354					shift
3355					case $# in
3356					0)	break ;;
3357					esac
3358					rm -f ${tmp}s.exe
3359					compile $cc -o ${tmp}s.exe $1 ${tmp}s.o <&$nullin >&$nullout 2>${tmp}s.e && $executable ${tmp}s.exe || continue
3360					case `wc -l ${tmp}s.e` in
3361					$e)	;;
3362					*)	continue ;;
3363					esac
3364					d=`ls -s ${tmp}s.exe`
3365					rm -f ${tmp}s.exe
3366					compile $cc -o ${tmp}s.exe $2 ${tmp}s.o <&$nullin >&$nullout 2>${tmp}s.e && $executable ${tmp}s.exe || continue
3367					case `wc -l ${tmp}s.e` in
3368					$e)	;;
3369					*)	continue ;;
3370					esac
3371					case `ls -s ${tmp}s.exe` in
3372					$d)	;;
3373					*)	reallystatic=$2
3374						set x
3375						shift
3376						break
3377						;;
3378					esac
3379				done
3380			fi
3381			rm -f ${tmp}s.*
3382								#...INDENT
3383								;;
3384							esac
3385							ccflags=$reallystatic
3386							;;
3387						*)	ccflags=
3388							;;
3389						esac
3390						set x $mac
3391						e=1
3392						while	:
3393						do	o=
3394							shift
3395							while	:
3396							do	case $# in
3397								0)	break ;;
3398								esac
3399								case $1 in
3400								-)	break ;;
3401								esac
3402								o="$o $1"
3403								shift
3404							done
3405							rm -f $tmp.exe
3406							if	compile $cc $ccflags $o -DTEST=$p -DID=$v -o $tmp.exe $tmp.c $lib $deflib <&$nullin >&$nullout && $executable $tmp.exe
3407							then	case $run in
3408
3409				status*)execute $tmp.exe <&$nullin >&$nullout
3410					V=$?
3411					case $V in
3412					0)	e=1 ;;
3413					*)	e=0 ;;
3414					esac
3415					break
3416					;;
3417				no[ls]*);;
3418				[ls]*)	e=0 && break ;;
3419				noo*)	execute $tmp.exe <&$nullin >$tmp.out || break ;;
3420				o*)	execute $tmp.exe <&$nullin >$tmp.out && e=0 && break ;;
3421				no*)	execute $tmp.exe <&$nullin >&$nullout || break ;;
3422				*)	execute $tmp.exe <&$nullin >&$nullout && e=0 && break ;;
3423
3424								esac
3425							else	case $run in
3426								no[els]*)e=1 && break ;;
3427								esac
3428							fi
3429							case $# in
3430							0)	case $run in
3431								no*)	e=0 ;;
3432								esac
3433								break
3434								;;
3435							esac
3436						done
3437						;;
3438					esac
3439					o=1
3440					case $run in
3441					no*)	case $e in
3442						0)	e=1 ;;
3443						*)	e=0 ;;
3444						esac
3445						;;
3446					esac
3447					case $run in
3448					o*|noo*)case $e in
3449						0)	cat $tmp.out ;;
3450						esac
3451						rm -f $tmp.out
3452						;;
3453					esac
3454					report $e $V "${note:-$run\ passed}" "${note:-$run} failed"
3455					continue
3456					;;
3457				esac
3458
3459				# initialize common builtin state
3460
3461				case $o in
3462				dat|lib|mth|run)
3463					case $statictest in
3464					"")	statictest=FoobaR
3465						copy $tmp.c "
3466$tst
3467$ext
3468$std
3469$usr
3470_BEGIN_EXTERNS_
3471extern int $statictest;
3472_END_EXTERNS_
3473int main(){char* i = (char*)&$statictest; return ((unsigned int)i)^0xaaaa;}
3474"
3475						rm -f $tmp.exe
3476						if	compile $cc -o $tmp.exe $tmp.c <&$nullin >&$nullout && $executable $tmp.exe
3477						then	case $static in
3478							.)	static=
3479								copy $tmp.c "
3480$tst
3481$ext
3482int main(){printf("hello");return(0);}
3483"
3484								rm -f $tmp.exe
3485								if	compile $cc -c $tmp.c <&$nullin >&$nullout &&
3486									compile $cc -o $tmp.exe $tmp.o <&$nullin >&$nullout &&
3487									$executable $tmp.exe
3488								then	e=`wc -l $tmp.e`
3489									eval set x x $binding
3490									while	:
3491									do	shift
3492										shift
3493										case $# in
3494										0)	break ;;
3495										esac
3496										rm -f $tmp.exe
3497										compile $cc -o $tmp.exe $1 $tmp.o <&$nullin >&$nullout && $executable $tmp.exe || continue
3498										case `wc -l $tmp.e` in
3499										$e)	;;
3500										*)	continue ;;
3501										esac
3502										d=`ls -s $tmp.exe`
3503										rm -f $tmp.exe
3504										compile $cc -o $tmp.exe $2 $tmp.o <&$nullin >&$nullout && $executable $tmp.exe || continue
3505										case `wc -l $tmp.e` in
3506										$e)	;;
3507										*)	continue ;;
3508										esac
3509										case `ls -s $tmp.exe` in
3510										$d)	;;
3511										*)	static=$2
3512											set x
3513											shift
3514											break
3515											;;
3516										esac
3517									done
3518								fi
3519								;;
3520							esac
3521						else	static=
3522						fi
3523						;;
3524					esac
3525					;;
3526				esac
3527
3528				# builtin tests
3529
3530				case $o in
3531				api)	;;
3532				cmd)	case $p in
3533					?*)	continue ;;
3534					esac
3535					is $o $a
3536					k=1
3537					for j in "" usr
3538					do	case $j in
3539						"")	d= s= ;;
3540						*)	d=/$j s=_$j ;;
3541						esac
3542						for i in bin etc ucb
3543						do	if	test -f $d/$i/$a
3544							then	case $k in
3545								1)	k=0
3546									case $M in
3547									*-*)	;;
3548									*)	usr="$usr$nl#define $m 1"
3549										case $define in
3550										1)	echo "#define $m	1	/* $a in ?(/usr)/(bin|etc|ucb) */" ;;
3551										n)	echo "$m=1" ;;
3552										esac
3553										;;
3554									esac
3555									;;
3556								esac
3557								c=${s}_${i}_${v}
3558								usr="$usr$nl#define $c 1"
3559								case $define in
3560								1)	echo "#define $c	1	/* $d/$i/$a found */" ;;
3561								n)	echo "$c=1" ;;
3562								esac
3563							fi
3564						done
3565					done
3566					case $k in
3567					0)	success ;;
3568					1)	failure ;;
3569					esac
3570					;;
3571				dat)	case $p in
3572					?*)	continue ;;
3573					esac
3574					{
3575					copy - "
3576$tst
3577$ext
3578$std
3579$usr
3580$pre
3581"
3582					case $inc in
3583					?*)	echo "$inc"
3584						;;
3585					*)	echo "_BEGIN_EXTERNS_
3586extern int $v;
3587_END_EXTERNS_"
3588						;;
3589					esac
3590					echo "
3591#ifdef _DLL
3592#define _REF_
3593#else
3594#define _REF_	&
3595#endif
3596int main(){char* i = (char*) _REF_ $v; return ((unsigned int)i)^0xaaaa;}"
3597					} > $tmp.c
3598					is $o $v
3599					rm -f $tmp.exe
3600					compile $cc -c $tmp.c <&$nullin >&$nullout &&
3601					compile $cc $static -o $tmp.exe $tmp.o $lib $deflib <&$nullin >&$nullout &&
3602					$executable $tmp.exe
3603					report $? 1 "$v in default lib(s)" "$v not in default lib(s)"
3604					;;
3605				dfn)	case $p in
3606					?*)	continue ;;
3607					esac
3608					is dfn $v
3609					echo "$pre
3610$tst
3611$ext
3612$inc
3613#ifdef $v
3614<<\"#ifndef $v\">>
3615<<\"#define $v\">>	$v	<<\"/* native $v */\">>
3616<<\"#endif\">>
3617#endif" > $tmp.c
3618					if	compile $cc -E $tmp.c <&$nullin >$tmp.i
3619					then	sed -e '/<<[ 	]*".*"[ 	]*>>/!d' -e 's/<<[ 	]*"//g' -e 's/"[ 	]*>>//g' $tmp.i > $tmp.t
3620						if	test -s $tmp.t
3621						then	success
3622							cat $tmp.t
3623						else	failure
3624						fi
3625					else	failure
3626					fi
3627					;;
3628				exp)	case $test in
3629					'')	echo "$command: $file$sline: test expression expected for $o" >&$stderr
3630						exit 1
3631						;;
3632					esac
3633					case $a in
3634					-|'')	;;
3635					*)	eval x='$'$a
3636						case $x in
3637						1)	result=FAILURE
3638							continue
3639							;;
3640						esac
3641						;;
3642					esac
3643					case $test in
3644					[01]|'"'*'"'|'<'*'>')
3645						case $a in
3646						-|'')	;;
3647						*)	case $define$note in
3648							1)	echo "#define $a	$test" ;;
3649							1*)	echo "#define $a	$test	/* $note */" ;;
3650							n)	echo "$a=$test" ;;
3651							esac
3652							eval $a='$test'
3653							;;
3654						esac
3655						;;
3656					*)	case $note in
3657						'')	note=$test ;;
3658						esac
3659						case $test in
3660						'')	c=1
3661							;;
3662						*)	is exp "$note"
3663							x=
3664							for i in `echo '' $test | sed 's,[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_], & ,g'`
3665							do	case $i in
3666								[\ \	])
3667									;;
3668								[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_]*)
3669									eval i='${'$i'}'
3670									case $i in
3671									'')	i=0
3672										;;
3673									'"'*'"');;
3674									*[!-+0123456789]*)
3675										case $i in
3676										*'"'*)	i=1 ;;
3677										*)	i='"'$i'"' ;;
3678										esac
3679										;;
3680									esac
3681									x="$x $i"
3682									;;
3683								'!')	x="$x 0 ="
3684									;;
3685								'&'|'|')case $x in
3686									*"$i")	;;
3687									*)	x="$x \\$i" ;;
3688									esac
3689									;;
3690								*)	x="$x \\$i"
3691									;;
3692								esac
3693							done
3694							c=`eval expr $x 2>&$stderr`
3695							;;
3696						esac
3697						case $c in
3698						0)	c=1 ;;
3699						*)	c=0 ;;
3700						esac
3701						M=$a
3702						m=$a
3703						report $c 1 "$note is true" "$note is false"
3704						;;
3705					esac
3706					;;
3707				hdr|lcl|nxt|sys)
3708					case $o in
3709					lcl|nxt)case $M in
3710						*-*)	continue ;;
3711						esac
3712						eval x='$'_$m
3713						case $x in
3714						?*)	continue ;;
3715						esac
3716						eval _$m=1
3717						is $o $f
3718						echo "$pre
3719$tst
3720$ext
3721$inc
3722#include <$f.h>" > $tmp.c
3723						case $f in
3724						sys/*)	e= ;;
3725						*)	e='-e /[\\\\\/]sys[\\\\\/]'$f'\\.h"/d' ;;
3726						esac
3727						if	compile $cc -E $tmp.c <&$nullin >$tmp.i
3728						then	i=`sed -e '/^#[line 	]*[0123456789][0123456789]*[ 	][ 	]*"[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ:]*[\\\\\/].*[\\\\\/]'$f'\\.h"/!d' $e -e s'/.*"\\(.*\\)".*/\\1/' -e 's,\\\\,/,g' -e 's,///*,/,g' $tmp.i | sed 1q`
3729							case $i in
3730							[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]:[\\/]*)
3731								;;
3732							*/*/*)	k=`echo "$i" | sed 's,.*/\([^/]*/[^/]*\)$,../\1,'`
3733								echo "$pre
3734$tst
3735$ext
3736$inc
3737#include <$k>" > $tmp.c
3738								if	compile $cc -E $tmp.c <&$nullin >$tmp.i
3739								then	j=`sed -e '/^#[line 	]*[0123456789][0123456789]*[ 	][ 	]*"[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ:]*[\\\\\/].*[\\\\\/]'$f'\\.h"/!d' $e -e s'/.*"\\(.*\\)".*/\\1/' -e 's,\\\\,/,g' -e 's,///*,/,g' $tmp.i | sed 1q`
3740									wi=`wc < "$i"`
3741									wj=`wc < "$j"`
3742									case $wi in
3743									$wj)	i=$k	;;
3744									esac
3745								fi
3746								;;
3747							*)	echo "$pre
3748$tst
3749$ext
3750$inc
3751#include <../include/$f.h>" > $tmp.c
3752								if	compile $cc -E $tmp.c <&$nullin >&$nullout
3753								then	i=../include/$f.h
3754								fi
3755								;;
3756							esac
3757						else	i=
3758						fi
3759						case $i in
3760						[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]:[\\/]*|[\\/]*)
3761							success
3762							case $o in
3763							lcl)	echo "#if defined(__STDPP__directive)"
3764								echo "__STDPP__directive pragma pp:hosted"
3765								echo "#endif"
3766								echo "#include <$i>	/* the native <$f.h> */"
3767								echo "#undef	$m"
3768								usr="$usr$nl#define $m 1"
3769								echo "#define $m	1"
3770								;;
3771							nxt)	echo "#define $m <$i>	/* include path for the native <$f.h> */"
3772								echo "#define ${m}_str \"$i\"	/* include string for the native <$f.h> */"
3773								usr="$usr$nl#define $m <$i>$nl#define ${m}_str \"$i\""
3774								eval $m=\\\<$i\\\>
3775								;;
3776							esac
3777							break
3778							;;
3779						../*/*)	success
3780							case $o in
3781							lcl)	echo "#include <$i>	/* the native <$f.h> */"
3782								echo "#undef	$m"
3783								usr="$usr$nl#define $m 1"
3784								echo "#define $m	1"
3785								eval $m=1
3786								;;
3787							nxt)	echo "#define $m <$i>	/* include path for the native <$f.h> */"
3788								echo "#define ${m}_str \"$i\"	/* include string for the native <$f.h> */"
3789								usr="$usr$nl#define $m <$i>$nl#define ${m}_str \"$i\""
3790								eval $m=\\\<$i\\\>
3791								;;
3792							esac
3793							break
3794							;;
3795						*)	failure
3796							case $o in
3797							lcl)	case $all$config$undef in
3798								?1?|??1)echo "#undef	$m		/* no native <$f.h> */" ;;
3799								1??)	echo "#define $m	0	/* no native <$f.h> */" ;;
3800								esac
3801								eval $m=0
3802								;;
3803							nxt)	case $all$config$undef in
3804								?1?|??1)echo "#undef	$m		/* no include path for the native <$f.h> */" ;;
3805								esac
3806								;;
3807							esac
3808							;;
3809						esac
3810						;;
3811					*)	case $o in
3812						hdr)	x=$f.h ;;
3813						sys)	x=sys/$f.h ;;
3814						esac
3815						case " $gothdr " in
3816						*" - $x "*)
3817							failure +
3818							;;
3819						*" + $x "*)
3820							success +
3821							;;
3822						*)	echo "
3823$tst
3824$ext
3825$allinc
3826$inc
3827#include <$x>" > $tmp.c
3828							if	is_hdr $x
3829							then	gothdr="$gothdr + $x"
3830								case $M in
3831								*-*)	;;
3832								*)	case " $puthdr " in
3833									*" $m "*)
3834										;;
3835									*)	puthdr="$puthdr $m"
3836										usr="$usr$nl#define $m 1"
3837										;;
3838									esac
3839									case $define in
3840									1)	echo "#define $m	1	/* #include <$x> ok */" ;;
3841									n)	echo "$m=1" ;;
3842									esac
3843									eval $m=1
3844									;;
3845								esac
3846							else	gothdr="$gothdr - $x"
3847								case $M in
3848								*-*)	;;
3849								*)	case $define$all$config$undef in
3850									1?1?|1??1)echo "#undef	$m		/* #include <$x> not ok */" ;;
3851									11??)	echo "#define $m	0	/* #include <$x> not ok */" ;;
3852									n1?1)	echo "$m=" ;;
3853									n1??)	echo "$m=0" ;;
3854									esac
3855									eval $m=0
3856									;;
3857								esac
3858							fi
3859							;;
3860						esac
3861						continue
3862						;;
3863					esac
3864					;;
3865				iff)	;;
3866				ini)	;;
3867				key)	case $p in
3868					?*)	continue ;;
3869					esac
3870					w=$v
3871					while	:
3872					do	is $o $w
3873						echo "$pre
3874$tst
3875$ext
3876int f(){int $w = 1;return($w);}" > $tmp.c
3877						if	compile $cc -c $tmp.c <&$nullin >&$nullout
3878						then	failure
3879							case $set in
3880							*" ="|*" = "*)
3881								set x $set
3882								shift
3883								w=
3884								while	:
3885								do	case $# in
3886									0)	break ;;
3887									esac
3888									case $1 in
3889									=)	break ;;
3890									esac
3891									case $w in
3892									'')	w=$1 ;;
3893									*)	w="$w $1" ;;
3894									esac
3895									shift
3896								done
3897								case $1 in
3898								=)	shift
3899									case $# in
3900									0)	set=" " ;;
3901									*)	set=$* ;;
3902									esac
3903									;;
3904								*)	set=
3905									;;
3906								esac
3907								case $shell in
3908								ksh)	typeset -u u=$w ;;
3909								*)	u=`echo $w | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` ;;
3910								esac
3911								u=_$u
3912								M=$w
3913								case $M in
3914								*[!abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]*)
3915									M=`echo "X$m" | sed -e 's,^.,,' -e 's,[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_],_,g'`
3916									;;
3917								esac
3918								case $config in
3919								1)	m=HAVE${u}_RESERVED ;;
3920								*)	m=_key_${w} ;;
3921								esac
3922								continue
3923								;;
3924							esac
3925							report - 1 - - "$w is not a reserved keyword" "default for reserved keyword $v"
3926						else	report 0 1 "$w is a reserved keyword" -
3927							case $M in
3928							*-*)	;;
3929							*)	case $define$w in
3930								1$v)	;;
3931								1*)	echo "#define $v	$w	/* alternate for reserved keyword $v */" ;;
3932								n*)	echo "$v=$w" ;;
3933								esac
3934								;;
3935							esac
3936						fi
3937						break
3938					done
3939					;;
3940				lib|mth)case $p in
3941					?*)	continue ;;
3942					esac
3943					case $v in
3944					-)	continue ;;
3945					esac
3946					is $o $v
3947					copy $tmp.c "
3948$tst
3949$ext
3950$std
3951$usr
3952$pre
3953$inc
3954typedef int (*_IFFE_fun)();
3955#ifdef _IFFE_extern
3956_BEGIN_EXTERNS_
3957extern int $v();
3958_END_EXTERNS_
3959#endif
3960static _IFFE_fun i=(_IFFE_fun)$v;int main(){return ((unsigned int)i)^0xaaaa;}
3961"
3962					d=-D_IFFE_extern
3963					if	compile $cc -c $tmp.c <&$nullin >&$nullout
3964					then	d=
3965					elif	compile $cc $d -c $tmp.c <&$nullin >&$nullout
3966					then	:
3967					else	d=error
3968					fi
3969					if	test error != "$d"
3970					then	rm -f $tmp.exe
3971						if	compile $cc $d $static -o $tmp.exe $tmp.o $lib $deflib <&$nullin >&$nullout &&
3972							$executable $tmp.exe
3973						then	case $o in
3974							lib)	c=0 ;;
3975							*)	c=1 ;;
3976							esac
3977							report $c 1 "$v() in default lib(s)" "$v() not in default lib(s)" "default for function $v()"
3978						else	case $o in
3979							mth)	rm -f $tmp.exe
3980								compile $cc $d $static -o $tmp.exe $tmp.o -lm <&$nullin >&$nullout &&
3981								$executable $tmp.exe
3982								report $? 1 "$v() in math lib" "$v() not in math lib" "default for function $v()"
3983								;;
3984							*)	report 1 1 - "$v() not in default lib(s)" "default for function $v()"
3985								;;
3986							esac
3987						fi
3988					else	case $intrinsic in
3989						'')	copy $tmp.c "
3990$tst
3991$ext
3992$std
3993$usr
3994$pre
3995$inc
3996_BEGIN_EXTERNS_
3997extern int foo();
3998_END_EXTERNS_
3999static int ((*i)())=foo;int main(){return(i==0);}
4000"
4001							compile $cc -c $tmp.c <&$nullin >&$nullout
4002							intrinsic=$?
4003							;;
4004						esac
4005						case $o in
4006						mth)	report $intrinsic 1 "$v() in math lib" "$v() not in math lib" "default for function $v()" ;;
4007						*)	report $intrinsic 1 "$v() in default lib(s)" "$v() not in default lib(s)" "default for function $v()" ;;
4008						esac
4009					fi
4010					;;
4011				mac)	case $p in
4012					?*)	continue ;;
4013					esac
4014					is mac $v
4015					echo "
4016$tst
4017$ext
4018$pre
4019$inc
4020#ifdef $v
4021'$m:$v'
4022#endif" > $tmp.c
4023					compile $cc -E $tmp.c <&$nullin | grep -c "'$m:$v'" >&$nullout
4024					report $? 1 "$v is a macro" "$v is not a macro" "default for macro $v"
4025					;;
4026				mem)	case $p in
4027					?*)	eval i='$'_iffe_typedef_$p
4028						case $i in
4029						0|1)	;;
4030						*)	echo "$pre
4031$tst
4032$ext
4033$inc
4034static $p i;
4035int n = sizeof(i);" > $tmp.c
4036							is typ $p
4037							if	compile $cc -c $tmp.c <&$nullin >&$nullout
4038							then	success -
4039								eval _iffe_typedef_$p=1
4040								i=1
4041							else	failure -
4042								eval _iffe_typedef_$p=0
4043								i=0
4044							fi
4045							;;
4046						esac
4047						case $i in
4048						0)	i="$v is not a member of $p" p="struct $p" ;;
4049						*)	i=- ;;
4050						esac
4051						is mem $v "$p"
4052						echo "$pre
4053$tst
4054$ext
4055$inc
4056static $p i;
4057int n = sizeof(i.$v);" > $tmp.c
4058						compile $cc -c $tmp.c <&$nullin >&$nullout
4059						report $? 1 "$v is a member of $p" "$i"
4060						;;
4061					*)	p=$v
4062						eval i='$'_iffe_typedef_$p
4063						case $i in
4064						0|1)	;;
4065						*)	echo "$pre
4066$tst
4067$ext
4068$inc
4069static $p i;
4070int n = sizeof(i);" > $tmp.c
4071							is typ $p
4072							if	compile $cc -c $tmp.c <&$nullin >&$nullout
4073							then	success -
4074								eval _iffe_typedef_$p=1
4075								i=1
4076							else	failure -
4077								eval _iffe_typedef_$p=0
4078								i=0
4079							fi
4080							;;
4081						esac
4082						case $i in
4083						0)	i="$p is not a non-opaque struct" p="struct $p" ;;
4084						*)	i=- ;;
4085						esac
4086						is nos "$p"
4087						echo "$pre
4088$tst
4089$ext
4090$inc
4091static $p i;
4092int n = sizeof(i);" > $tmp.c
4093						if	compile $cc -c $tmp.c <&$nullin >&$nullout
4094						then	echo "$pre
4095$tst
4096$ext
4097$inc
4098static $p i;
4099unsigned long f() { return (unsigned long)i; }" > $tmp.c
4100							if	compile $cc -c $tmp.c <&$nullin >&$nullout
4101							then	c=1
4102							else	c=0
4103							fi
4104						else	c=1
4105						fi
4106						report $c 1 "$p is a non-opaque struct" "$i"
4107					esac
4108					;;
4109				nop)	;;
4110				npt)	is npt $v
4111					copy $tmp.c "
4112$tst
4113$ext
4114$std
4115$usr
4116$pre
4117$inc
4118_BEGIN_EXTERNS_
4119struct _iffe_struct { int _iffe_member; };
4120extern struct _iffe_struct* $v _ARG_((struct _iffe_struct*));
4121_END_EXTERNS_
4122"
4123					# some compilers with -O only warn for invalid intrinsic prototypes
4124					case " $cc " in
4125					*" -O "*)	xx=`echo $cc | sed 's/ -O / /g'` ;;
4126					*)		xx=$cc ;;
4127					esac
4128					compile $xx -c $tmp.c <&$nullin >&$nullout
4129					report -$config $? 1 "$v() needs a prototype" "$v() does not need a prototype"
4130					;;
4131				num)	is num $v
4132					copy $tmp.c "
4133$tst
4134$ext
4135$std
4136$usr
4137$pre
4138$inc
4139_BEGIN_EXTERNS_
4140int _iffe_int = $v / 2;
4141_END_EXTERNS_
4142"
4143					compile $cc -c $tmp.c <&$nullin >&$nullout
4144					report $? 1 "$v is a numeric constant" "$v is not a numeric constant"
4145					;;
4146				one)	for i in $a $hdr
4147					do	x="#include <$i>"
4148						case " $gothdr " in
4149						*" - $i "*)
4150							continue
4151							;;
4152						*" + $i "*)
4153							;;
4154						*)	echo "$x" > $tmp.c
4155							if	is_hdr $x
4156							then	gothdr="$gothdr + $x"
4157							else	gothdr="$gothdr - $x"
4158								continue
4159							fi
4160							;;
4161						esac
4162						case $one in
4163						"")	one=$x
4164							;;
4165						*"$x"*)	break
4166							;;
4167						*)	echo "$one" > $tmp.c
4168							if	compile $cc -E $tmp.c <&$nullin >$tmp.i
4169							then	c=$i
4170								case $c in
4171								*[\\/]*)	c=`echo $c | sed 's,[\\\\/],[\\\\/],g'` ;;
4172								esac
4173								case `sed -e '/^#[line 	]*1[ 	][ 	]*"[\\\\\/].*[\\\\\/]'$c'"/!d' $tmp.i` in
4174								?*)	break ;;
4175								esac
4176							fi
4177							one="$one$nl$x"
4178							;;
4179						esac
4180						echo "$x"
4181						break
4182					done
4183					;;
4184				opt)	M=$m
4185					is opt $a
4186					case " $PACKAGE_OPTIONS " in
4187					*" $a "*)	c=0 ;;
4188					*)		c=1 ;;
4189					esac
4190					report $c 1 "$a is set in \$PACKAGE_OPTIONS" "$a is not set in \$PACKAGE_OPTIONS"
4191					;;
4192				out|output)
4193					;;
4194				pth)	is pth $a
4195					pkg $pth
4196					tab="  "
4197					e=
4198					f=
4199					for i in $pth
4200					do	case $i in
4201						'{')	e="${nl}}"
4202							l=
4203							x=i
4204							v="\$${x}"
4205							t=${nl}${tab}
4206							b="fnd()${nl}{${t}for ${x} in"
4207							;;
4208						'}')	b="${b}${t}do${tab}if $exists ${v}/\${1}${t}${tab}${tab}then${tab}f=${v}/\${1}${t}${tab}${tab}${tab}return${t}${tab}${tab}fi"
4209							e="${t}done${e}"
4210							eval "${b}${e}"
4211							fnd $a
4212							case $f in
4213							?*)	break ;;
4214							esac
4215							;;
4216						-)	b="${b}${t}do${tab}test \"${v}\" = '' -o -d \"${v}\" &&${t}${tab}${tab}"
4217							x=${x}i
4218							v="${v}\$${x}"
4219							b="${b}for ${x} in"
4220							e="${t}done${e}"
4221							t="${t}${tab}${tab}"
4222							;;
4223						*)	case $e in
4224							'')	if	$exists ${i}/${a}
4225								then	f=${i}/${a}
4226									break
4227								fi
4228								;;
4229							*)	case $i in
4230								/|.)	b="${b} ''" ;;
4231								*)	b="${b} /${i}" ;;
4232								esac
4233								;;
4234							esac
4235							;;
4236						esac
4237					done
4238					case $f in
4239					'')	case $set in
4240						' ')	f=$a ;;
4241						?*)	f=$set ;;
4242						esac
4243						;;
4244					esac
4245					case $f in
4246					'')	c=1
4247						;;
4248					*)	c=0
4249						f="\"$f\""
4250						;;
4251					esac
4252					report $c "$f" "${note:-$a path}" "$a path not found"
4253					;;
4254				run)	is run $a
4255					if	test ! -r $a
4256					then	failure not found
4257						case $verbose in
4258						0)	echo "$command: $file$line: $a: not found" >&$stderr ;;
4259						esac
4260						exit 1
4261					fi
4262					noisy
4263					case $a in
4264					*.c)	rm -f $tmp.exe
4265						{
4266						echo "$tst
4267$ext
4268$std
4269$usr
4270$inc"
4271						cat $a
4272						} > $tmp.c
4273						compile $cc -o $tmp.exe $tmp.c $lib $deflib <&$nullin >&$stderr 2>&$stderr &&
4274						$executable $tmp.exe &&
4275						execute $tmp.exe $opt <&$nullin
4276						;;
4277					*.sh)	{
4278						cat <<!
4279:
4280set "cc='$cc' executable='$executable' id='$m' static='$static' tmp='$tmp'" $opt $hdr $test
4281!
4282						cat $a
4283						} > $tmp.sh
4284						chmod +x $tmp.sh
4285						( . $tmp.sh ) <&$nullin
4286						;;
4287					*)	false
4288						;;
4289					esac
4290					case $? in
4291					0)	success
4292						;;
4293					*)	failure cannot run
4294						case $verbose in
4295						0)	echo "$command: $file$line: $a: cannot run" >&$stderr ;;
4296						esac
4297						exit 1
4298						;;
4299					esac
4300					;;
4301				siz)	case $p in
4302					"")	x= ;;
4303					*)	x="$p " ;;
4304					esac
4305					is siz "$x$v"
4306					{
4307					case $p:$v in
4308					long:*|*:*[_0123456789]int[_0123456789]*)
4309						echo "$pre
4310$tst
4311$ext
4312$inc
4313static $x$v i;
4314$x$v f() {
4315$x$v v; i = 1; v = i;"
4316						echo "i = v * i; i = i / v; v = v + i; i = i - v;"
4317						case $v in
4318						float|double) ;;
4319						*)	echo "v <<= 4; i = v >> 2; i = 10; i = v % i; i |= v; v ^= i; i = 123; v &= i;" ;;
4320						esac
4321						echo "return v; }"
4322						;;
4323					*)	echo "$pre
4324$inc
4325struct xxx { $x$v mem; };
4326static struct xxx v;
4327struct xxx* f() { return &v; }"
4328						;;
4329					esac
4330					case $x in
4331					""|"struct "|"union ")
4332						echo "int g() { return 0; }"
4333						;;
4334					*)	echo "int g() { return sizeof($x$v)<=sizeof($v); }" ;;
4335					esac
4336					copy - "
4337int main() {
4338		f();
4339		g();
4340		printf(\"%u\\n\", sizeof($x$v));
4341		return 0;
4342}"
4343					} > $tmp.c
4344					rm -f $tmp.exe $tmp.dat
4345					if	compile $cc -o $tmp.exe $tmp.c $lib $deflib <&$nullin >&$nullout &&
4346						$executable $tmp.exe &&
4347						execute $tmp.exe > $tmp.dat
4348					then	z=`cat $tmp.dat`
4349						c=0
4350					else	z=0
4351						c=1
4352					fi
4353					report $c "$z" "sizeof($x$v)" "$x$v not a type with known size"
4354					;;
4355				sym)	case $test in
4356					"")	x=$v ;;
4357					*)	x=$test ;;
4358					esac
4359					echo "$pre
4360$tst
4361$ext
4362$inc
4363'=' $x '='" > $tmp.c
4364					compile $cc -E $tmp.c <&$nullin \
4365					| sed \
4366						-e "/'='/!d" \
4367						-e "s/'='//g" \
4368						-e 's/[ 	]//g' \
4369						-e 's/((([^()]*)))->/->/g' \
4370						-e 's/(([^()]*))->/->/g' \
4371						-e 's/([^()]*)->/->/g' \
4372						-e 's/\([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]*\)\[/\
4373ary \1[/g' \
4374						-e 's/\([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]*\)(/\
4375fun \1[/g' \
4376						-e 's/\*->\([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_]\)/->\
4377ptr \1/g' \
4378						-e 's/->\([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_]\)/->\
4379reg \1/g' \
4380						-e "/^$v\$/d" \
4381						-e 's/^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]*$/\
4382nam &/g' \
4383					| sed \
4384						-e '/^... /!d' \
4385					| LC_ALL=C sort \
4386						-u \
4387					| sed \
4388						-e 's/\(...\) \([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]*\).*/#ifndef _\1_'$v'\
4389#define _\1_'$v' \2\
4390#define _\1_'$v'_str "\2"\
4391#endif/'
4392					;;
4393				typ)	case $p in
4394					"")	x= ;;
4395					*)	x="$p " ;;
4396					esac
4397					is typ "$x$v"
4398					{
4399					case $p:$v in
4400					long:*|*:*[_0123456789]int[_0123456789]*)
4401						echo "$pre
4402$tst
4403$ext
4404$inc
4405static $x$v i;
4406$x$v f() {
4407$x$v v; i = 1; v = i;"
4408						echo "i = v * i; i = i / v; v = v + i; i = i - v;"
4409						case $v in
4410						float|double) ;;
4411						*)	echo "v <<= 4; i = v >> 2; i = 10; i = v % i; i |= v; v ^= i; i = 123; v &= i;" ;;
4412						esac
4413						echo "return v; }"
4414						;;
4415					*)	echo "$pre
4416$tst
4417$ext
4418$inc
4419struct xxx { $x$v mem; };
4420static struct xxx v;
4421struct xxx* f() { return &v; }"
4422						;;
4423					esac
4424					case $x in
4425					""|"struct "|"union ")
4426						echo "int main() { f(); return 0; }" ;;
4427					*)	echo "int main() { f(); return sizeof($x$v)<=sizeof($v); }" ;;
4428					esac
4429					} > $tmp.c
4430					rm -f $tmp.exe
4431					compile $cc -o $tmp.exe $tmp.c $lib $deflib <&$nullin >&$nullout &&
4432					$executable $tmp.exe &&
4433					execute $tmp.exe
4434					report $? 1 "$x$v is a type" "$x$v is not a type" "default for type $x$v"
4435					;;
4436				val)	case $arg in
4437					'"'*'"')echo $arg=\'$val\' ;;
4438					*)	echo $arg=\"$val\" ;;
4439					esac
4440					;;
4441				ver)	;;
4442				0)	result=FAILURE
4443					;;
4444				1)	result=SUCCESS
4445					;;
4446				:)	;;
4447				-)	;;
4448				*)	echo "$command: $file$line: $o: unknown feature test" >&$stderr
4449					status=1
4450					;;
4451				esac
4452			done
4453		done
4454		case $not in
4455		1)	case $result in
4456			FAILURE)	result=SUCCESS ;;
4457			*)		result=FAILURE ;;
4458			esac
4459			;;
4460		esac
4461		case $result in
4462		FAILURE)	user_pf=$fail user_yn=$no ;;
4463		*)		user_pf=$pass user_yn=$yes ;;
4464		esac
4465		case $user_pf in
4466		?*)	eval "$user_pf" <&$nullin ;;
4467		esac
4468		case $user_yn in
4469		?*)	case $def in
4470			-)	;;
4471			*)	case $note in
4472				?*)	case $user_yn in
4473					*$nl*)	user_yn="/* $note */$nl$user_yn" ;;
4474					*)	user_yn="$user_yn	/* $note */" ;;
4475					esac
4476					;;
4477				esac
4478				;;
4479			esac
4480			copy - "$user_yn"
4481			;;
4482		esac
4483		case $ifelse:$result in
4484		TEST:SUCCESS)	ifelse=KEEP ;;
4485		TEST:*)		ifelse=SKIP ;;
4486		esac
4487		case $group:$result in
4488		:*|*:SUCCESS)	break ;;
4489		esac
4490		set '' $groups '' "$@"
4491		shift
4492		case $1 in
4493		'')	shift; break ;;
4494		esac
4495		shift
4496
4497		# set up and try the next group
4498
4499		hdr=$com_hdr
4500		lib=$com_lib
4501		mac=$com_mac
4502		opt=$com_opt
4503		pth=$com_pth
4504		test=$com_test
4505		cc="$occ $includes"
4506		group=
4507		groups=
4508		while	:
4509		do	case $1 in
4510			'')	shift; break ;;
4511			esac
4512			case $1 in
4513			*[\"\'\(\)\{\}\ \	]*)
4514				case $op in
4515				pth)	pth="$pth $1"
4516					;;
4517				*)	case $test in
4518					'')	test=$1 ;;
4519					*)	test="$test $1" ;;
4520					esac
4521					;;
4522				esac
4523				;;
4524			-)	group=$group$1
4525				groups="$groups $1"
4526				;;
4527			-l*)	case $group in
4528				-*)	groups="$groups $1" ;;
4529				*)	lib="$lib $1" ;;
4530				esac
4531				;;
4532			+l*)	case $shell in
4533				bsh)	x=`echo X$1 | sed 's/X+/-/'` ;;
4534				*)	eval 'x=-${1#+}' ;;
4535				esac
4536				case $group in
4537				-*)	groups="$groups $x" ;;
4538				*)	lib="$lib $x" ;;
4539				esac
4540				;;
4541			-*|+*)	case $group in
4542				-*)	groups="$groups $1"
4543					;;
4544				*)	case $op in
4545					run)	opt="$opt $1"
4546						;;
4547					*)	case $1 in
4548						-D*)	mac="$mac $1" ;;
4549						*)	cc="$cc $1" ;;
4550						esac
4551						;;
4552					esac
4553					;;
4554				esac
4555				;;
4556			*.[aAxX]|*.[dD][lL][lL]|*.[lL][iI][bB])
4557				case $group in
4558				-*)	groups="$groups $1" ;;
4559				*)	lib="$lib $1" ;;
4560				esac
4561				;;
4562			*[.\\/]*)
4563				case $group in
4564				-*)	groups="$groups $1"
4565					;;
4566				*)	case $op in
4567					pth)	pth="$pth $1" ;;
4568					*)	hdr="$hdr $1" ;;
4569					esac
4570					;;
4571				esac
4572				;;
4573			*)	case $group in
4574				-*)	groups="$groups $1"
4575					;;
4576				*)	case $op in
4577					pth)	pth="$pth $1"
4578						;;
4579					*)	case $test in
4580						'')	test=$1 ;;
4581						*)	test="$test $1" ;;
4582						esac
4583						;;
4584					esac
4585					;;
4586				esac
4587				;;
4588			esac
4589			shift
4590		done
4591	done
4592done
4593