1########################################################################
2#                                                                      #
3#               This software is part of the ast package               #
4#          Copyright (c) 1985-2011 AT&T Intellectual Property          #
5#                      and is licensed under the                       #
6#                 Eclipse Public License, Version 1.0                  #
7#                    by AT&T Intellectual Property                     #
8#                                                                      #
9#                A copy of the License is available at                 #
10#          http://www.eclipse.org/org/documents/epl-v10.html           #
11#         (with md5 checksum b35adb5213ca9657e911e9befb180842)         #
12#                                                                      #
13#              Information and Software Systems Research               #
14#                            AT&T Research                             #
15#                           Florham Park NJ                            #
16#                                                                      #
17#                 Glenn Fowler <gsf@research.att.com>                  #
18#                  David Korn <dgk@research.att.com>                   #
19#                   Phong Vo <kpv@research.att.com>                    #
20#                                                                      #
21########################################################################
22: generate getconf and limits info
23#
24# @(#)conf.sh (AT&T Research) 2011-08-26
25#
26# this script generates these files from the table file in the first arg
27# the remaining args are the C compiler name and flags
28#
29#	conflim.h	supplemental limits.h definitions
30#	conftab.h	readonly string table definitions
31#	conftab.c	readonly string table data
32#
33# you may think it should be simpler
34# but you shall be confused anyway
35#
36
37case $-:$BASH_VERSION in
38*x*:[0123456789]*)	: bash set -x is broken :; set +ex ;;
39esac
40
41LC_ALL=C
42export LC_ALL
43
44command=conf
45
46shell=`eval 'x=123&&integer n=\${#x}\${x#1?}&&((n==330/(10)))&&echo ksh' 2>/dev/null`
47
48append=0
49debug=
50extra=0
51keep_call='*'
52keep_name='*'
53trace=
54verbose=0
55while	:
56do	case $1 in
57	-a)	append=1 ;;
58	-c*)	keep_call=${1#-?} ;;
59	-d*)	debug=$1 ;;
60	-l)	extra=1 ;;
61	-n*)	keep_name=${1#-?} ;;
62	-t)	trace=1 ;;
63	-v)	verbose=1 ;;
64	-*)	echo "Usage: $command [-a] [-ccall-pattern] [-dN] [-l] [-nname_pattern] [-t] [-v] conf.tab" >&2; exit 2 ;;
65	*)	break ;;
66	esac
67	shift
68done
69head='#include "FEATURE/standards"
70#include "FEATURE/common"'
71tail='#include "FEATURE/param"'
72generated="/* : : generated by $command from $1 : : */"
73hdr=
74ifs=${IFS-'
75	 '}
76nl='
77'
78sp=' '
79ob='{'
80cb='}'
81sym=[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]*
82tmp=conf.tmp
83case $verbose:$debug$trace in
841:?*)	echo "$command: debug=$debug trace=$trace keep_call=$keep_call keep_name=$keep_name" >&2 ;;
85esac
86case $trace in
871)	PS4='+$LINENO+ '; set -x ;;
88esac
89
90case $# in
910)	case $extra in
92	0)	echo "$command: table argument expected" >&2
93		exit 1
94		;;
95	esac
96	tab=/dev/null
97	;;
98*)	tab=$1
99	shift
100	if	test ! -f $tab
101	then	echo "$command: $tab: cannot read" >&2
102		exit 1
103	fi
104	;;
105esac
106case $# in
1070)	cc=cc ;;
108*)	cc=$* ;;
109esac
110
111rm -f $tmp.*
112case $debug in
113'')	trap "code=\$?; rm -f $tmp.*; exit \$code" 0 1 2 ;;
114esac
115
116# determine the intmax_t printf format
117
118cat > $tmp.c <<!
119${head}
120int
121main()
122{
123#if _ast_intmax_long
124	return 1;
125#else
126	return 0;
127#endif
128}
129!
130if	$cc -o $tmp.exe $tmp.c >/dev/null 2>&1 && ./$tmp.exe
131then	LL_format='ll'
132else	LL_format='l'
133fi
134
135# determine the intmax_t constant suffix
136
137cat > $tmp.c <<!
138${head}
139int
140main()
141{
142#if _ast_intmax_long
143	return 1;
144#else
145	_ast_intmax_t		s = 0x7fffffffffffffffLL;
146	unsigned _ast_intmax_t	u = 0xffffffffffffffffLL;
147
148	return 0;
149#endif
150}
151!
152if	$cc -o $tmp.exe $tmp.c >/dev/null 2>&1
153then	if	./$tmp.exe
154	then	LL_suffix='LL'
155	else	LL_suffix='L'
156	fi
157else	LL_suffix=''
158fi
159
160cat > $tmp.c <<!
161${head}
162int
163main()
164{
165	unsigned int	u = 1U;
166	unsigned int	ul = 1UL;
167
168	return 0;
169}
170!
171if	$cc -o $tmp.exe $tmp.c >/dev/null 2>&1
172then	U_suffix='U'
173else	U_suffix=''
174fi
175
176# set up the names and keys
177
178keys=
179standards=
180
181case $append$extra in
18200)	case $verbose in
183	1)	echo "$command: read $tab" >&2 ;;
184	esac
185	exec < $tab
186	while	:
187	do	IFS=""
188		read line
189		eof=$?
190		IFS=$ifs
191		case $eof in
192		0)	;;
193		*)	break ;;
194		esac
195		case $line in
196		""|\#*)	;;
197		*)	set x $line
198			shift; name=$1
199			shift; standard=$1
200			shift; call=$1
201			shift; section=$1
202			shift; flags=$1
203			alternates=
204			define=
205			values=
206			script=
207			headers=
208			while	:
209			do	shift
210				case $# in
211				0)	break ;;
212				esac
213				case $1 in
214				":")	shift
215					eval script='$'script_$1
216					break
217					;;
218				*"{")	case $1 in
219					"sh{")	script="# $name" ;;
220					*)	script= ;;
221					esac
222					shift
223					args="$*"
224					IFS=""
225					while	read line
226					do	case $line in
227						"}")	break ;;
228						esac
229						script=$script$nl$line
230					done
231					IFS=$ifs
232					break
233					;;
234				*.h)	case $shell in
235					ksh)	f=${1%.h} ;;
236					*)	f=`echo $1 | sed 's,\.h$,,'` ;;
237					esac
238					case " $hdr " in
239					*" $f "*)
240						headers=$headers$nl#include$sp'<'$1'>'
241						;;
242					*" -$f- "*)
243						;;
244					*)	if	iffe -n - hdr $f | grep _hdr_$f >/dev/null
245						then	hdr="$hdr $f"
246							headers=$headers$nl#include$sp'<'$1'>'
247						else	hdr="$hdr -$f-"
248						fi
249						;;
250					esac
251					;;
252				*)	values=$values$sp$1
253					case $1 in
254					$sym)	echo "$1" >> $tmp.v ;;
255					esac
256					;;
257				esac
258			done
259			case " $standards " in
260			*" $standard "*)
261				;;
262			*)	standards="$standards $standard"
263				;;
264			esac
265			case $name:$flags in
266			*:*S*)	;;
267			VERSION)flags="${flags}S" ;;
268			esac
269			case $name in
270			*VERSION*)key=${standard}${section} ;;
271			*)	  key= ;;
272			esac
273			case $key in
274			''|*_)	key=${key}${name} ;;
275			*)	key=${key}_${name} ;;
276			esac
277			eval sys='$'CONF_call_${key}
278			case $sys in
279			?*)	call=$sys ;;
280			esac
281			case $call in
282			SI)	sys=CS ;;
283			*)	sys=$call ;;
284			esac
285			key=${sys}_${key}
286			keys="$keys$nl$key"
287			eval CONF_name_${key}='$'name
288			eval CONF_standard_${key}='$'standard
289			eval CONF_call_${key}='$'call
290			eval CONF_section_${key}='$'section
291			eval CONF_flags_${key}='$'flags
292			eval CONF_define_${key}='$'define
293			eval CONF_values_${key}='$'values
294			eval CONF_script_${key}='$'script
295			eval CONF_args_${key}='$'args
296			eval CONF_headers_${key}='$'headers
297			eval CONF_keys_${name}=\"'$'CONF_keys_${name} '$'key\"
298			;;
299		esac
300	done
301	;;
302esac
303case $debug in
304-d1)	for key in $keys
305	do	eval name=\"'$'CONF_name_$key\"
306		case $name in
307		?*)	eval standard=\"'$'CONF_standard_$key\"
308			eval call=\"'$'CONF_call_$key\"
309			eval section=\"'$'CONF_section_$key\"
310			eval flags=\"'$'CONF_flags_$key\"
311			eval define=\"'$'CONF_define_$key\"
312			eval values=\"'$'CONF_values_$key\"
313			eval script=\"'$'CONF_script_$key\"
314			eval args=\"'$'CONF_args_$key\"
315			eval headers=\"'$'CONF_headers_$key\"
316			printf "%29s %35s %8s %2s %1d %5s %s$nl" "$name" "$key" "$standard" "$call" "$section" "$flags" "$define${values:+$sp=$values}${headers:+$sp$headers$nl}${script:+$sp$ob$script$nl$cb}"
317			;;
318		esac
319	done
320	exit
321	;;
322esac
323
324systeminfo='
325#if !defined(SYS_NMLEN)
326#define SYS_NMLEN	9
327#endif
328#include <sys/systeminfo.h>'
329echo "$systeminfo" > $tmp.c
330$cc -E $tmp.c >/dev/null 2>&1 || systeminfo=
331
332# check for native getconf(1)
333
334CONF_getconf=
335CONF_getconf_a=
336for d in /usr/bin /bin /usr/sbin /sbin
337do	if	test -x $d/getconf
338	then	case `$d/getconf --?-version 2>&1` in
339		*"AT&T"*"Research"*)
340			: presumably an implementation also configured from conf.tab
341			;;
342		*)	CONF_getconf=$d/getconf
343			if	$CONF_getconf -a >/dev/null 2>&1
344			then	CONF_getconf_a=-a
345			fi
346			;;
347		esac
348		break
349	fi
350done
351export CONF_getconf CONF_getconf_a
352
353case $verbose in
3541)	echo "$command: check ${CONF_getconf:+$CONF_getconf(1),}confstr(2),pathconf(2),sysconf(2),sysinfo(2) configuration names" >&2 ;;
355esac
356{
357	echo "#include <unistd.h>$systeminfo
358int i = 0;" > $tmp.c
359	$cc -E $tmp.c
360} |
361sed \
362	-e '/^#[^0123456789]*1[ 	]*".*".*/!d' \
363	-e 's/^#[^0123456789]*1[ 	]*"\(.*\)".*/\1/' |
364sort -u > $tmp.f
365{
366sed \
367	-e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]/ /g' \
368	-e 's/[ 	][ 	]*/\n/g' \
369	`cat $tmp.f` 2>/dev/null |
370	egrep '^(SI|_(CS|PC|SC|SI))_.'
371	case $CONF_getconf_a in
372	?*)	$CONF_getconf $CONF_getconf_a | sed 's,[=:    ].*,,'
373		;;
374	*)	case $CONF_getconf in
375		?*)	for v in `strings $CONF_getconf | grep '^[ABCDEFGHIJKLMNOPQRSTUVWXYZ_][ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]*$'`
376			do	if	$CONF_getconf $v >/dev/null
377				then	echo $v
378				fi
379			done
380			;;
381		esac
382		;;
383	esac 2>/dev/null
384} |
385egrep -v '^_[ABCDEFGHIJKLMNOPQRSTUVWXYZ]+_(COUNT|LAST|N|STR)$' |
386sort -u > $tmp.g
387{
388	grep '^_' $tmp.g
389	grep '^[^_]' $tmp.g
390} > $tmp.t
391mv $tmp.t $tmp.g
392case $debug in
393-d2)	exit ;;
394esac
395
396HOST=`package | sed -e 's,[0123456789.].*,,' | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`
397case $HOST in
398'')	HOST=SYSTEM ;;
399esac
400
401exec < $tmp.g
402
403while	read line
404do	flags=F
405	section=
406	underscore=
407	define=$line
408	IFS=_
409	set $line
410	IFS=$ifs
411	case $1 in
412	'')	case $# in
413		0)	continue ;;
414		esac
415		shift
416		;;
417	esac
418	case $1 in
419	CS|PC|SC|SI)
420		call=$1
421		shift
422		standard=$1
423		;;
424	*)	flags=${flags}R
425		standard=$1
426		while	:
427		do	case $# in
428			0)	continue 2 ;;
429			esac
430			shift
431			case $1 in
432			CS|PC|SC|SI)
433				call=$1
434				shift
435				break
436				;;
437			O|o|OLD|old)
438				continue 2
439				;;
440			esac
441			standard=${standard}_$1
442		done
443		;;
444	esac
445	case $1 in
446	SET)	continue ;;
447	esac
448	case $standard in
449	_*)	standard=`echo $standard | sed 's,^_*,,'` ;;
450	esac
451	case " $standards " in
452	*" $standard "*)
453		;;
454	*)	case $standard in
455		[0123456789]*)
456			section=$standard
457			standard=POSIX
458			;;
459		*[0123456789])
460			eval `echo $standard | sed 's,\(.*\)\([0123456789]*\),standard=\1 section=\2,'`
461			;;
462		esac
463		;;
464	esac
465	case $flags in
466	*R*)	case $call in
467		SI)	;;
468		*)	underscore=U ;;
469		esac
470		;;
471	*)	case " $standards " in
472		" C ")	shift
473			;;
474		*" $standard "*)
475			case $call in
476			SI)	;;
477			*)	flags=${flags}P
478				underscore=U
479				;;
480			esac
481			shift
482			;;
483		*)	standard=
484			;;
485		esac
486		;;
487	esac
488	case $standard in
489	'')	standard=$HOST
490		case $call in
491		SI)	;;
492		*)	underscore=U ;;
493		esac
494		case $call in
495		CS|PC|SC)
496			case $define in
497			_${call}_*)
498				standard=POSIX
499				;;
500			esac
501			;;
502		esac
503		;;
504	esac
505	part=$section
506	case $section in
507	'')	section=1
508		case $standard in
509		POSIX|XOPEN) part=$section ;;
510		esac
511		;;
512	esac
513	name=
514	while	:
515	do	case $# in
516		0)	break ;;
517		esac
518		case $name in
519		'')	name=$1 ;;
520		*)	name=${name}_$1 ;;
521		esac
522		shift
523	done
524	case $name in
525	'')	;;
526	CONFORMANCE|FS_3D|HOSTTYPE|LIBPATH|LIBPREFIX|LIBSUFFIX|PATH_ATTRIBUTES|PATH_RESOLVE|UNIVERSE)
527		;;
528	*)	values=
529		script=
530		args=
531		headers=
532		case $name in
533		V[123456789]_*|V[123456789][0123456789]_*)	underscore=VW ;;
534		esac
535		case $call in
536		CS|SI)	key=CS ;;
537		*)	key=$call ;;
538		esac
539		case $name in
540		*VERSION*)key=${key}_${standard}${part} ;;
541		esac
542		key=${key}_${name}
543		eval x='$'CONF_keys_$name
544		case $x in
545		'')	eval x='$'CONF_name_$key
546			case $x in
547			'')	case $call in
548				SI)	flags=O$flags ;;
549				esac
550				case $underscore in
551				?*)	flags=${flags}${underscore} ;;
552				esac
553				old=QQ
554				case $name in
555				*VERSION*)old=${old}_${standard}${part} ;;
556				esac
557				old=${old}_${name}
558				eval x='$'CONF_name_$old
559				case $x in
560				?*)	eval CONF_name_$old=
561					eval flags='$'flags'$'CONF_flags_$old
562					eval values='$'CONF_values_$old
563					eval script='$'CONF_script_$old
564					eval args='$'CONF_args_$old
565					eval headers='$'CONF_headers_$old
566					;;
567				esac
568				keys="$keys$nl$key"
569				eval CONF_name_${key}='$'name
570				eval CONF_standard_${key}='$'standard
571				eval CONF_call_${key}='$'call
572				eval CONF_section_${key}='$'section
573				eval CONF_flags_${key}=d'$'flags
574				eval CONF_define_${key}='$'define
575				eval CONF_values_${key}='$'values
576				eval CONF_script_${key}='$'script
577				eval CONF_args_${key}='$'args
578				eval CONF_headers_${key}='$'headers
579				;;
580			*)	eval x='$'CONF_define_$key
581				case $x in
582				?*)	case $call in
583					CS)	eval x='$'CONF_call_$key
584						case $x in
585						SI)	;;
586						*)	define= ;;
587						esac
588						;;
589					*)	define=
590						;;
591					esac
592					;;
593				esac
594				case $define in
595				?*)	eval CONF_define_${key}='$'define
596					eval CONF_call_${key}='$'call
597					eval x='$'CONF_call_${key}
598					case $x in
599					QQ)	;;
600					*)	case $flags in
601						*R*)	flags=R ;;
602						*)	flags= ;;
603						esac
604						;;
605					esac
606					case $call in
607					SI)	flags=O$flags ;;
608					esac
609					eval CONF_flags_${key}=d'$'flags'$'CONF_flags_${key}
610					;;
611				esac
612				old=QQ
613				case $name in
614				*VERSION*)old=${old}_${standard}${part} ;;
615				esac
616				old=${old}_${name}
617				eval CONF_name_$old=
618			esac
619			;;
620		*)	for key in $x
621			do	eval x='$'CONF_call_${key}
622				case $x in
623				XX)	eval CONF_call_${key}=QQ
624					eval CONF_flags_${key}=S'$'CONF_flags_${key}
625					;;
626				esac
627			done
628		esac
629		;;
630	esac
631done
632
633# sort keys by name
634
635keys=`for key in $keys
636do	eval echo '$'CONF_name_$key '$'key
637done | sort -u | sed 's,.* ,,'`
638case $debug in
639-d3)	for key in $keys
640	do	eval name=\"'$'CONF_name_$key\"
641		case $name in
642		?*)	eval standard=\"'$'CONF_standard_$key\"
643			eval call=\"'$'CONF_call_$key\"
644			eval section=\"'$'CONF_section_$key\"
645			eval flags=\"'$'CONF_flags_$key\"
646			eval define=\"'$'CONF_define_$key\"
647			eval values=\"'$'CONF_values_$key\"
648			eval script=\"'$'CONF_script_$key\"
649			eval headers=\"'$'CONF_headers_$key\"
650			printf "%29s %35s %8s %2s %1d %5s %s$nl" "$name" "$key" "$standard" "$call" "$section" "$flags" "$define${values:+$sp=$values}${headers:+$sp$headers$nl}${script:+$sp$ob$script$nl$cb}"
651			;;
652		esac
653	done
654	exit
655	;;
656esac
657
658# mark the dups CONF_PREFIXED
659
660prev_key=
661prev_name=
662for key in $keys
663do	eval name=\"'$'CONF_name_$key\"
664	case $name in
665	'')	continue
666		;;
667	$prev_name)
668		eval p='$'CONF_flags_${prev_key}
669		eval c='$'CONF_flags_${key}
670		case $p:$c in
671		*L*:*L*);;
672		*L*:*)	c=L${c} ;;
673		*:*L*)	p=L${p} ;;
674		*)	p=P$p c=P$c ;;
675		esac
676		eval CONF_flags_${prev_key}=$p
677		eval CONF_flags_${key}=$c
678		;;
679	esac
680	prev_name=$name
681	prev_key=$key
682done
683
684# collect all the macros/enums
685
686for key in $keys
687do	eval name=\"'$'CONF_name_$key\"
688	case $name in
689	'')		continue ;;
690	$keep_name)	;;
691	*)		continue ;;
692	esac
693	eval call=\"'$'CONF_call_$key\"
694	case $call in
695	$keep_call)	;;
696	*)		continue ;;
697	esac
698	eval standard=\"'$'CONF_standard_$key\"
699	eval section=\"'$'CONF_section_$key\"
700	eval flags=\"'$'CONF_flags_$key\"
701	eval define=\"'$'CONF_define_$key\"
702	eval values=\"'$'CONF_values_$key\"
703	eval script=\"'$'CONF_script_$key\"
704	eval args=\"'$'CONF_args_$key\"
705	eval headers=\"'$'CONF_headers_$key\"
706	conf_name=$name
707	case $call in
708	QQ)	call=XX
709		for c in SC PC CS
710		do	case $flags in
711			*S*)	case $section in
712				1)	eval x='$'CONF_call_${c}_${standard}_${name} ;;
713				*)	eval x='$'CONF_call_${c}_${standard}${section}_${name} ;;
714				esac
715				;;
716			*)	eval x='$'CONF_call_${c}_${name}
717				;;
718			esac
719			case $x in
720			?*)	call=$x
721				break
722				;;
723			esac
724		done
725		case $call in
726		XX)	for c in SC PC CS
727			do	echo "_${c}_${name}"
728				case $flags in
729				*S*)	case $section in
730					1)	echo "_${c}_${standard}_${name}" ;;
731					*)	echo "_${c}_${standard}${section}_${name}" ;;
732					esac
733					;;
734				esac
735			done
736			;;
737		esac
738		;;
739	esac
740	case $call in
741	CS|PC|SC|SI|XX)
742		;;
743	*)	echo "$command: $name: $call: invalid call" >&2
744		exit 1
745		;;
746	esac
747	case $flags in
748	*[ABEGHIJQTYZabcefghijklmnopqrstuvwxyz_123456789]*)
749		echo "$command: $name: $flags: invalid flag(s)" >&2
750		exit 1
751		;;
752	esac
753	case $section in
754	[01])	;;
755	*)	case $flags in
756		*N*)	;;
757		*)	name=${section}_${name} ;;
758		esac
759		standard=${standard}${section}
760		;;
761	esac
762	case $call in
763	XX)	;;
764	*)	case $flags in
765		*d*)	conf_op=${define} ;;
766		*O*)	conf_op=${call}_${name} ;;
767		*R*)	conf_op=_${standard}_${call}_${name} ;;
768		*S*)	conf_op=_${call}_${standard}_${name} ;;
769		*)	conf_op=_${call}_${name} ;;
770		esac
771		echo "${conf_op}"
772		;;
773	esac
774	case $standard:$flags in
775	C:*)	;;
776	*:*L*)	echo "${conf_name}"
777		echo "_${standard}_${conf_name}"
778		;;
779	*:*M*)	case $section in
780		1)	echo "_${standard}_${conf_name}" ;;
781		*)	echo "_${standard}${section}_${conf_name}" ;;
782		esac
783		;;
784	esac
785done > $tmp.q
786sort -u < $tmp.q > $tmp.t
787mv $tmp.t $tmp.q
788sort -u < $tmp.v > $tmp.t
789mv $tmp.t $tmp.v
790case $debug in
791-d4)	exit ;;
792esac
793
794# test all the macros in a few batches (some compilers have an error limit)
795
796defined() # list-file
797{
798	: > $tmp.p
799	while	:
800	do	{
801			cat <<!
802${head}
803#include <sys/types.h>
804#include <limits.h>
805#include <unistd.h>$systeminfo$headers
806${tail}
807#undef conf
808unsigned int conf[] = {
809!
810			sed 's/$/,/' $1
811			echo "};"
812		} > $tmp.c
813		[ -f $tmp.1.c ] || cp $tmp.c $tmp.1.c
814		if	$cc -c $tmp.c > $tmp.e 2>&1
815		then	break
816		fi
817		[ -f $tmp.1.e ] || cp $tmp.e $tmp.1.e
818		snl='\
819'
820		sed "s/[^_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789][^_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789]*/${snl}/g" $tmp.e |
821		grep '^[_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz][_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789]*$' |
822		sort -u > $tmp.n
823		cmp -s $tmp.n $tmp.p && break
824		fgrep -x -v -f $tmp.n $1 > $tmp.y
825		mv $tmp.y $1
826		mv $tmp.n $tmp.p
827	done
828	{
829		cat <<!
830${head}
831#include <sys/types.h>
832#include <limits.h>
833#include <unistd.h>$systeminfo$headers
834${tail}
835#undef conf
836!
837		sed 's/.*/conf "&" = &/' $1
838	} > $tmp.c
839	$cc -E $tmp.c 2>/dev/null |
840	sed -e '/conf[ 	]*".*"[ 	]*=[ 	]*/!d' -e '/[_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789][ 	]*(/!d' -e 's/.*"\(.*\)".*/\1/' > $tmp.n
841	if	test -s $tmp.n
842	then	fgrep -x -v -f $tmp.n $1 > $tmp.y
843		mv $tmp.y $1
844	fi
845}
846
847case $verbose in
8481)	echo "$command: check macros/enums as static initializers" >&2 ;;
849esac
850defined $tmp.q
851defined $tmp.v
852case $debug in
853-d5)	exit ;;
854esac
855
856# mark the constant macros/enums
857
858exec < $tmp.q
859while	read line
860do	eval CONF_const_${line}=1
861done
862exec < $tmp.v
863while	read line
864do	eval CONF_const_${line}=1
865done
866
867# mark the string literal values
868
869{
870	cat <<!
871${head}
872#include <sys/types.h>
873#include <limits.h>
874#include <unistd.h>$systeminfo$headers
875${tail}
876#undef conf
877!
878	sed 's/.*/conf "&" = &/' $tmp.q
879} > $tmp.c
880$cc -E $tmp.c 2>/dev/null |
881sed -e '/conf[ 	]*".*"[ 	]*=[ 	]*"/!d' -e 's/.*"\([^"]*\)".*/\1/' > $tmp.e
882exec < $tmp.e
883while	read line
884do	eval CONF_string_${line}=1
885done
886
887# walk through the table
888
889case $shell in
890ksh)	integer len name_max ;;
891esac
892name_max=1
893export tmp name standard call cc
894
895exec > $tmp.t
896for key in $keys
897do	eval name=\"'$'CONF_name_$key\"
898	case $name in
899	'')		continue ;;
900	$keep_name)	;;
901	*)		continue ;;
902	esac
903	eval call=\"'$'CONF_call_$key\"
904	case $call in
905	$keep_call)	;;
906	*)		continue ;;
907	esac
908	eval standard=\"'$'CONF_standard_$key\"
909	eval section=\"'$'CONF_section_$key\"
910	eval flags=\"'$'CONF_flags_$key\"
911	eval define=\"'$'CONF_define_$key\"
912	eval values=\"'$'CONF_values_$key\"
913	eval script=\"'$'CONF_script_$key\"
914	eval args=\"'$'CONF_args_$key\"
915	eval headers=\"'$'CONF_headers_$key\"
916	conf_name=$name
917	case $call in
918	QQ)	call=XX
919		for c in SC PC CS
920		do	case $flags in
921			*S*)	case $section in
922				1)	eval x='$'CONF_call_${c}_${standard}_${name} ;;
923				*)	eval x='$'CONF_call_${c}_${standard}${section}_${name} ;;
924				esac
925				;;
926			*)	eval x='$'CONF_call_${c}_${name}
927				;;
928			esac
929			case $x in
930			?*)	call=$x
931				break
932				;;
933			esac
934		done
935		case $call in
936		XX)	for c in SC PC CS
937			do	case $flags in
938				*S*)	case $section in
939					1)	eval x='$'CONF_const__${c}_${standard}_${name} ;;
940					*)	eval x='$'CONF_const__${c}_${standard}${section}_${name} ;;
941					esac
942					;;
943				*)	eval x='$'CONF_const__${c}_${name}
944					;;
945				esac
946				case $x in
947				1)	call=$c
948					break
949					;;
950				esac
951			done
952			;;
953		esac
954		case $call in
955		XX)	case $standard in
956			C)	standard=POSIX ;;
957			esac
958			case $flags in
959			*L*)	flags=lFU ;;
960			*)	flags=FU ;;
961			esac
962			;;
963		esac
964		;;
965	esac
966	case " $standards " in
967	*" $standard "*)
968		;;
969	*)	standards="$standards $standard"
970		;;
971	esac
972	conf_standard=CONF_${standard}
973	case $call in
974	CS)	conf_call=CONF_confstr
975		;;
976	PC)	conf_call=CONF_pathconf
977		;;
978	SC)	conf_call=CONF_sysconf
979		;;
980	SI)	conf_call=CONF_sysinfo
981		;;
982	XX)	conf_call=CONF_nop
983		;;
984	esac
985	conf_op=-1
986	for s in _${call}_${standard}${section}_${name} _${call}_${standard}_${name} _${call}_${section}_${name} _${call}_${name} ${call}_${name}
987	do	eval x='$'CONF_const_${s}
988		case $x in
989		1)	conf_op=${s}
990			break
991			;;
992		esac
993	done
994	conf_section=$section
995	conf_flags=0
996	case $flags in
997	*C*)	conf_flags="${conf_flags}|CONF_DEFER_CALL" ;;
998	esac
999	case $flags in
1000	*D*)	conf_flags="${conf_flags}|CONF_DEFER_MM" ;;
1001	esac
1002	case $flags in
1003	*F*)	conf_flags="${conf_flags}|CONF_FEATURE" ;;
1004	esac
1005	case $flags in
1006	*L*)	conf_flags="${conf_flags}|CONF_LIMIT" ;;
1007	esac
1008	case $flags in
1009	*M*)	conf_flags="${conf_flags}|CONF_MINMAX" ;;
1010	esac
1011	case $flags in
1012	*N*)	conf_flags="${conf_flags}|CONF_NOSECTION" ;;
1013	esac
1014	case $flags in
1015	*P*)	conf_flags="${conf_flags}|CONF_PREFIXED" ;;
1016	esac
1017	case $flags in
1018	*S*)	conf_flags="${conf_flags}|CONF_STANDARD" ;;
1019	esac
1020	case $flags in
1021	*U*)	conf_flags="${conf_flags}|CONF_UNDERSCORE" ;;
1022	esac
1023	case $flags in
1024	*V*)	conf_flags="${conf_flags}|CONF_NOUNDERSCORE" ;;
1025	esac
1026	case $flags in
1027	*W*)	conf_flags="${conf_flags}|CONF_PREFIX_ONLY" ;;
1028	esac
1029	case $debug in
1030	?*)	case $standard in
1031		????)	sep=" " ;;
1032		???)	sep="  " ;;
1033		??)	sep="   " ;;
1034		?)	sep="    " ;;
1035		*)	sep="" ;;
1036		esac
1037		echo "$command: test: $sep$standard $call $name" >&2
1038		;;
1039	esac
1040	case $call in
1041	CS|SI)	conf_flags="${conf_flags}|CONF_STRING"
1042		string=1
1043		;;
1044	*)	eval string='$'CONF_string_${key}
1045		;;
1046	esac
1047	conf_limit=0
1048	case $flags in
1049	*[Ll]*)	d=
1050		case ${conf_name} in
1051		LONG_MAX|SSIZE_MAX)
1052			x=
1053			;;
1054		*)	eval x='$'CONF_const_${conf_name}
1055			;;
1056		esac
1057		case $x in
1058		'')	for s in ${values}
1059			do	case $s in
1060				$sym)	eval x='$'CONF_const_${s}
1061					case $x in
1062					1)	eval a='$'CONF_const_${standard}_${s}
1063						case $a in
1064						$x)	x= ;;
1065						*)	x=$s ;;
1066						esac
1067						break
1068						;;
1069					esac
1070					;;
1071				[0123456789]*|[-+][0123456789]*)
1072					d=$s
1073					break
1074					;;
1075				esac
1076			done
1077			case ${x:+1}:$flags:$conf_op in
1078			:*:-1|:*X*:*)
1079				case $verbose in
1080				1)	echo "$command: probe for ${conf_name} <limits.h> value" >&2 ;;
1081				esac
1082				x=
1083				case $CONF_getconf in
1084				?*)	if	$CONF_getconf $conf_name > $tmp.x 2>/dev/null
1085					then	x=`cat $tmp.x`
1086						case $x in
1087						undefined)	x= ;;
1088						esac
1089					fi
1090					;;
1091				esac
1092				case ${x:+1} in
1093				'')	case $script in
1094					'#'*)	echo "$script" > $tmp.sh
1095						chmod +x $tmp.sh
1096						x=`./$tmp.sh 2>/dev/null`
1097						;;
1098					'')	case $conf_name in
1099						SIZE_*|U*|*_MAX)
1100							f="%${LL_format}u"
1101							t="unsigned _ast_intmax_t"
1102							;;
1103						*)	f="%${LL_format}d"
1104							t="_ast_intmax_t"
1105							;;
1106						esac
1107						cat > $tmp.c <<!
1108${head}
1109#include <stdio.h>
1110#include <sys/types.h>
1111#include <limits.h>
1112#include <unistd.h>$systeminfo$headers
1113${tail}
1114int
1115main()
1116{
1117	printf("$f\n", ($t)$conf_name);
1118	return 0;
1119}
1120!
1121						;;
1122					*)	cat > $tmp.c <<!
1123${head}
1124#include <stdio.h>
1125#include <sys/types.h>
1126#include <limits.h>
1127#include <unistd.h>$systeminfo$headers
1128${tail}
1129${script}
1130!
1131						;;
1132					esac
1133					case $args in
1134					'')	set "" ;;
1135					*)	eval set '""' '"'$args'"'; shift ;;
1136					esac
1137					for a
1138					do	case $script in
1139						'#'*)	./$tmp.sh $a > $tmp.x 2>/dev/null
1140							x=$?
1141							;;
1142						*)	$cc $a -o $tmp.exe $tmp.c >/dev/null 2>&1 && ./$tmp.exe > $tmp.x 2>/dev/null
1143							x=$?
1144							;;
1145						esac
1146						case $x in
1147						0)	x=`cat $tmp.x`
1148							case $x in
1149							"-")	x=$a ;;
1150							esac
1151							break
1152							;;
1153						*)	x=
1154							;;
1155						esac
1156					done
1157					;;
1158				esac
1159				case $x in
1160				'')	x=$d ;;
1161				esac
1162				;;
1163			esac
1164			case ${x:+1}:$flags:$conf_op in
1165			1:*:-1|1:*X*:*)
1166				conf_limit=$x
1167				case $flags in
1168				*L*)	;;
1169				*)	conf_flags="${conf_flags}|CONF_LIMIT" ;;
1170				esac
1171				conf_flags="${conf_flags}|CONF_LIMIT_DEF"
1172				case $string:$x in
1173				1:*)	cat >> $tmp.l <<!
1174printf("#ifndef ${conf_name}\n");
1175printf("#define ${conf_name} \"${x}\"\n");
1176printf("#endif\n");
1177!
1178					;;
1179				*:U*)	cat >> $tmp.l <<!
1180printf("#ifndef ${conf_name}\n");
1181printf("#ifndef ${x}\n");
1182printf("#define ${x} %lu\n", ${x});
1183printf("#endif\n");
1184printf("#define ${conf_name} ${x}\n");
1185printf("#endif\n");
1186!
1187					;;
1188				*:$sym)	cat >> $tmp.l <<!
1189printf("#ifndef ${conf_name}\n");
1190printf("#ifndef ${x}\n");
1191printf("#define ${x} %ld\n", ${x});
1192printf("#endif\n");
1193printf("#define ${conf_name} ${x}\n");
1194printf("#endif\n");
1195!
1196					;;
1197				*)	cat >> $tmp.l <<!
1198printf("#ifndef ${conf_name}\n");
1199printf("#define ${conf_name} ${x}\n");
1200printf("#endif\n");
1201!
1202					;;
1203				esac
1204				;;
1205			esac
1206			;;
1207		esac
1208		;;
1209	esac
1210	case $section in
1211	[01])	;;
1212	*)	case $flags in
1213		*N*)	;;
1214		*)	name=${section}_${name} ;;
1215		esac
1216		standard=${standard}${section}
1217		;;
1218	esac
1219	conf_minmax=0
1220	case $call:$standard:$flags in
1221	*:C:*M*)for s in _${standard}_${conf_name} ${values}
1222		do	case $s in
1223			$sym)	;;
1224			*)	conf_minmax=$s
1225				conf_flags="${conf_flags}|CONF_MINMAX_DEF"
1226				break
1227				;;
1228			esac
1229		done
1230		;;
1231	*:C:*)	;;
1232	[CPSX][CSX]:*:*[FM]*)
1233		x=
1234		for s in _${standard}_${conf_name} ${values}
1235		do	case $s in
1236			$sym)	eval x='$'CONF_const_${s} ;;
1237			*)	x=1 ;;
1238			esac
1239			case $x in
1240			1)	conf_minmax=$s
1241				case $flags in
1242				*M*)	conf_flags="${conf_flags}|CONF_MINMAX_DEF" ;;
1243				esac
1244				case $conf_minmax in
1245				[-+0123456789]*)	x= ;;
1246				esac
1247				break
1248				;;
1249			esac
1250		done
1251		case ${x:+1}:${script:+1} in
1252		:1)	case $verbose in
1253			1)	echo "$command: probe for _${standard}_${conf_name} minmax value" >&2 ;;
1254			esac
1255			case $CONF_getconf in
1256			?*)	if	$CONF_getconf _${standard}_${conf_name} > $tmp.x 2>/dev/null
1257				then	x=`cat $tmp.x`
1258					case $x in
1259					undefined)	x= ;;
1260					esac
1261				fi
1262				;;
1263			esac
1264			case $x in
1265			'')	case $script in
1266				'#'*)	echo "$script" > $tmp.sh
1267					chmod +x $tmp.sh
1268					x=`./$tmp.sh 2>/dev/null`
1269					;;
1270				*)	cat > $tmp.c <<!
1271${head}
1272#include <sys/types.h>
1273#include <limits.h>
1274#include <unistd.h>$systeminfo$headers
1275${tail}
1276${script}
1277!
1278					;;
1279				esac
1280				case $args in
1281				'')	set "" ;;
1282				*)	eval set '""' "$args"; shift ;;
1283				esac
1284				for a
1285				do	case $script in
1286					'#'*)	./$tmp.sh $a > $tmp.x 2>/dev/null
1287						x=$?
1288						;;
1289					*)	$cc $a -o $tmp.exe $tmp.c >/dev/null 2>&1 && ./$tmp.exe > $tmp.x 2>/dev/null
1290						x=$?
1291						;;
1292					esac
1293					case $x in
1294					0)	x=`cat $tmp.x`
1295						case $x in
1296						"-")	x=$a ;;
1297						esac
1298						break
1299						;;
1300					*)	x=
1301						;;
1302					esac
1303				done
1304				;;
1305			esac
1306			case $x in
1307			?*)	conf_minmax=$x
1308				case $flags in
1309				*M*)	case "|$conf_flags|" in
1310					*'|CONF_MINMAX_DEF|'*)
1311						;;
1312					*)	conf_flags="${conf_flags}|CONF_MINMAX_DEF"
1313						;;
1314					esac
1315					;;
1316				esac
1317				;;
1318			esac
1319			;;
1320		esac
1321		;;
1322	esac
1323	case $string in
1324	1)	conf_limit="{ 0, $conf_limit }" conf_minmax="{ 0, $conf_minmax }"
1325		;;
1326	*)	case $conf_limit in
1327		0[xX]*|-*|+*|[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]*)
1328			;;
1329		*[!0123456789abcdefABCDEF]*)
1330			conf_limit=0
1331			;;
1332		*[!0123456789]*)
1333			conf_limit=0x$conf_limit
1334			;;
1335		esac
1336		case $conf_minmax in
1337		0[xX]*|-*|+*|[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]*)
1338			;;
1339		*[!0123456789abcdefABCDEF]*)
1340			conf_minmax=0
1341			;;
1342		*[!0123456789]*)
1343			conf_minmax=0x$conf_minmax
1344			;;
1345		esac
1346		case $conf_limit in
1347		?*[-+]*|*['()']*)
1348			;;
1349		*[lLuU])
1350			case $LL_suffix in
1351			??)	case $conf_limit in
1352				*[!lL][lL]|*[!lL][lL][uU])
1353					conf_limit=${conf_limit}L
1354					;;
1355				esac
1356				;;
1357			esac
1358			;;
1359		-*[2468])
1360			case $shell in
1361			ksh)	p=${conf_limit%?}
1362				s=${conf_limit#$p}
1363				((s=s-1))
1364				;;
1365			*)	eval `echo '' $conf_limit | sed 's/ *\(.*\)\(.\) */p=\1 s=\2/'`
1366				s=`expr $s - 1`
1367				;;
1368			esac
1369			conf_limit=${p}${s}${LL_suffix}-1${LL_suffix}
1370			;;
1371		0[xX]*[abcdefABCDEF])
1372			conf_limit=${conf_limit}${LL_suffix}
1373			;;
1374		-*[0123456789])
1375			conf_limit=${conf_limit}${LL_suffix}
1376			;;
1377		*[0123456789])
1378			conf_limit=${conf_limit}${U_suffix}${LL_suffix}
1379			;;
1380		esac
1381		case $conf_minmax in
1382		?*[-+]*|*['()']*)
1383			;;
1384		*[lLuU])
1385			case $LL_suffix in
1386			??)	case $conf_minmax in
1387				*[!lL][lL]|*[!lL][lL][uU])
1388					conf_minmax=${conf_minmax}L
1389					;;
1390				esac
1391				;;
1392			esac
1393			;;
1394		-*[2468])
1395			case $shell in
1396			ksh)	p=${conf_minmax%?}
1397				s=${conf_minmax#$p}
1398				((s=s-1))
1399				;;
1400			*)	eval `echo '' $conf_minmax | sed 's/ *\(.*\)\(.\) */p=\1 s=\2/'`
1401				s=`expr $s - 1`
1402				;;
1403			esac
1404			conf_minmax=${p}${s}${LL_suffix}-1${LL_suffix}
1405			;;
1406		0[xX]*[abcdefABCDEF])
1407			conf_minmax=${conf_minmax}${LL_suffix}
1408			;;
1409		-*[0123456789])
1410			conf_minmax=${conf_minmax}${LL_suffix}
1411			;;
1412		*[0123456789])
1413			conf_minmax=${conf_minmax}${U_suffix}${LL_suffix}
1414			;;
1415		esac
1416		conf_limit="{ $conf_limit, 0 }" conf_minmax="{ $conf_minmax, 0 }"
1417		;;
1418	esac
1419	case $conf_flags in
1420	'0|'*)	case $shell in
1421		ksh)	conf_flags=${conf_flags#0?} ;;
1422		*)	conf_flags=`echo "$conf_flags" | sed 's/^0.//'` ;;
1423		esac
1424		;;
1425	esac
1426	echo "{ \"$conf_name\", $conf_limit, $conf_minmax, $conf_flags, $conf_standard, $conf_section, $conf_call, $conf_op },"
1427	case $shell in
1428	ksh)	len=${#conf_name}
1429		if	((len>=name_max))
1430		then	((name_max=len+1))
1431		fi
1432		;;
1433	*)	len=`echo ${conf_name} | wc -c`
1434		if	expr \( $len - 1 \) \>= ${name_max} >/dev/null
1435		then	name_max=$len
1436		fi
1437		;;
1438	esac
1439done
1440exec > /dev/null
1441case $debug in
1442-d6)	exit ;;
1443esac
1444
1445# conf string table
1446
1447base=conftab
1448case $verbose in
14491)	echo "$command: generate ${base}.h string table header" >&2 ;;
1450esac
1451case $shell in
1452ksh)	((name_max=name_max+3)); ((name_max=name_max/4*4)) ;; # bsd /bin/sh !
1453*)	name_max=`expr \( $name_max + 3 \) / 4 \* 4` ;;
1454esac
1455{
1456cat <<!
1457#ifndef _CONFTAB_H
1458#define _CONFTAB_H
1459$systeminfo
1460
1461${generated}
1462
1463#if !defined(const) && !defined(__STDC__) && !defined(__cplusplus) && !defined(c_plusplus)
1464#define const
1465#endif
1466
1467#define conf		_ast_conf_data
1468#define conf_elements	_ast_conf_ndata
1469
1470#define prefix		_ast_conf_prefix
1471#define prefix_elements	_ast_conf_nprefix
1472
1473#define CONF_nop	0
1474#define	CONF_confstr	1
1475#define CONF_pathconf	2
1476#define CONF_sysconf	3
1477#define CONF_sysinfo	4
1478
1479!
1480index=0
1481for standard in $standards
1482do	echo "#define CONF_${standard}	${index}"
1483	case $shell in
1484	ksh)	((index=index+1)) ;;
1485	*)	index=`expr ${index} + 1` ;;
1486	esac
1487done
1488echo "#define CONF_call	${index}"
1489case $CONF_getconf in
1490?*)	echo
1491	echo "#define _pth_getconf	\"$CONF_getconf\""
1492	case $CONF_getconf_a in
1493	?*)	echo "#define _pth_getconf_a	\"$CONF_getconf_a\"" ;;
1494	esac
1495	;;
1496esac
1497cat <<!
1498
1499#define CONF_DEFER_CALL		0x0001
1500#define CONF_DEFER_MM		0x0002
1501#define CONF_FEATURE		0x0004
1502#define CONF_LIMIT		0x0008
1503#define CONF_LIMIT_DEF		0x0010
1504#define CONF_MINMAX		0x0020
1505#define CONF_MINMAX_DEF		0x0040
1506#define CONF_NOSECTION		0x0080
1507#define CONF_NOUNDERSCORE	0x0100
1508#define CONF_PREFIX_ONLY	0x0200
1509#define CONF_PREFIXED		0x0400
1510#define CONF_STANDARD		0x0800
1511#define CONF_STRING		0x1000
1512#define CONF_UNDERSCORE		0x2000
1513#define CONF_USER		0x4000
1514
1515struct Conf_s; typedef struct Conf_s Conf_t;
1516
1517typedef struct Value_s
1518{
1519	intmax_t	number;
1520	const char*	string;
1521} Value_t;
1522
1523struct Conf_s
1524{
1525	const char	name[${name_max}];
1526	Value_t		limit;
1527	Value_t		minmax;
1528	unsigned int	flags;
1529	short		standard;
1530	short		section;
1531	short		call;
1532	short		op;
1533};
1534
1535typedef struct Prefix_s
1536{
1537	const char	name[16];
1538	short		length;
1539	short		standard;
1540	short		call;
1541} Prefix_t;
1542
1543extern const Conf_t	conf[];
1544extern const int	conf_elements;
1545
1546extern const Prefix_t	prefix[];
1547extern const int	prefix_elements;
1548
1549#endif
1550!
1551} > $tmp.2
1552case $debug in
1553-d7)	echo $command: $tmp.2 ${base}.h ;;
1554*)	cmp -s $tmp.2 ${base}.h 2>/dev/null || mv $tmp.2 ${base}.h ;;
1555esac
1556
1557case $verbose in
15581)	echo "$command: generate ${base}.c string table" >&2 ;;
1559esac
1560{
1561cat <<!
1562${head}
1563#include <sys/types.h>
1564#include <limits.h>
1565#include <unistd.h>$systeminfo$headers
1566${tail}
1567#include "${base}.h"
1568
1569${generated}
1570
1571/*
1572 * prefix strings -- the first few are indexed by Conf_t.standard
1573 */
1574
1575const Prefix_t prefix[] =
1576{
1577!
1578for standard in $standards
1579do	case $shell in
1580	ksh)	len=${#standard} ;;
1581	*)	len=`echo ${standard} | wc -c`; len=`expr $len - 1` ;;
1582	esac
1583	echo "	\"${standard}\",	${len},	CONF_${standard},	-1,"
1584done
1585cat <<!
1586	"XX",		2,	CONF_POSIX,	CONF_nop,
1587	"CS",		2,	CONF_POSIX,	CONF_confstr,
1588	"PC",		2,	CONF_POSIX,	CONF_pathconf,
1589	"SC",		2,	CONF_POSIX,	CONF_sysconf,
1590	"SI",		2,	CONF_SVID,	CONF_sysinfo,
1591};
1592
1593const int	prefix_elements = (int)sizeof(prefix) / (int)sizeof(prefix[0]);
1594
1595/*
1596 * conf strings sorted in ascending order
1597 */
1598
1599const Conf_t conf[] =
1600{
1601!
1602cat $tmp.t
1603cat <<!
1604};
1605
1606const int	conf_elements = (int)sizeof(conf) / (int)sizeof(conf[0]);
1607!
1608} > $tmp.4
1609case $debug in
1610-d7)	echo $command: $tmp.4 ${base}.c ;;
1611*)	cmp -s $tmp.4 ${base}.c 2>/dev/null || mv $tmp.4 ${base}.c ;;
1612esac
1613
1614# limits.h generation code
1615
1616base=conflim
1617case $verbose in
16181)	echo "$command: generate ${base}.h supplemental <limits.h> values" >&2 ;;
1619esac
1620{
1621cat <<!
1622${generated}
1623
1624/*
1625 * supplemental <limits.h> values
1626 */
1627
1628!
1629test -f $tmp.l && cat $tmp.l
1630} > $tmp.5
1631case $debug in
1632-d7)	echo $command: $tmp.5 ${base}.h ;;
1633*)	cmp -s $tmp.5 ${base}.h 2>/dev/null || mv $tmp.5 ${base}.h ;;
1634esac
1635exit 0
1636