Added
Link Here
|
1 |
--- files/patch-src_lib_libast_comp_conf.sh.orig 2019-08-04 16:51:09 UTC |
2 |
+++ files/patch-src_lib_libast_comp_conf.sh |
3 |
@@ -0,0 +1,1343 @@ |
4 |
+--- src/lib/libast/comp/conf.sh.orig 2019-04-16 20:04:19 UTC |
5 |
++++ src/lib/libast/comp/conf.sh |
6 |
+@@ -1,1340 +0,0 @@ |
7 |
+-#!/bin/sh |
8 |
+-######################################################################## |
9 |
+-# # |
10 |
+-# This software is part of the ast package # |
11 |
+-# Copyright (c) 1985-2013 AT&T Intellectual Property # |
12 |
+-# and is licensed under the # |
13 |
+-# Eclipse Public License, Version 1.0 # |
14 |
+-# by AT&T Intellectual Property # |
15 |
+-# # |
16 |
+-# A copy of the License is available at # |
17 |
+-# http://www.eclipse.org/org/documents/epl-v10.html # |
18 |
+-# (with md5 checksum b35adb5213ca9657e911e9befb180842) # |
19 |
+-# # |
20 |
+-# Information and Software Systems Research # |
21 |
+-# AT&T Research # |
22 |
+-# Florham Park NJ # |
23 |
+-# # |
24 |
+-# Glenn Fowler <glenn.s.fowler@gmail.com> # |
25 |
+-# David Korn <dgkorn@gmail.com> # |
26 |
+-# Phong Vo <phongvo@gmail.com> # |
27 |
+-# # |
28 |
+-######################################################################## |
29 |
+-# |
30 |
+-# @(#)conf.sh (AT&T Research) 2011-08-26 |
31 |
+-# |
32 |
+-# This script generates these files from the table file: |
33 |
+-# |
34 |
+-# conflim.h supplemental limits.h definitions |
35 |
+-# conftab.h readonly string table definitions |
36 |
+-# conftab.c readonly string table data |
37 |
+-# |
38 |
+-# You may think it should be simpler but you shall be confused anyway. |
39 |
+-# |
40 |
+-export LC_ALL=C |
41 |
+- |
42 |
+-command=`basename $0` |
43 |
+-source_dir="$MESON_SOURCE_ROOT/src/lib/libast/comp" |
44 |
+-target_dir="$MESON_BUILD_ROOT/src/lib/libast/comp" |
45 |
+-table=$source_dir/conf.tab |
46 |
+-test $# -gt 0 || { echo missing expected compiler args >&2; exit 1; } |
47 |
+-cc=$* |
48 |
+- |
49 |
+-PATH="$MESON_SOURCE_ROOT/scripts:$PATH" |
50 |
+- |
51 |
+-# The use of `mktemp -dt` isn't ideal as it has slightly different meaning on BSD and GNU. But for |
52 |
+-# our purposes that doesn't matter. It simply means the temp file name will contain the X's on a BSD |
53 |
+-# system. See https://github.com/att/ast/issues/939 |
54 |
+-tmpdir=$(mktemp -dt ksh.XXXXXX) |
55 |
+-tmp=$tmpdir/conf |
56 |
+-cd $tmpdir || exit |
57 |
+-trap "rm -rf $tmpdir" EXIT |
58 |
+- |
59 |
+-# We need to create the Meson build directory that will contain the |
60 |
+-# dynamically generated source files. |
61 |
+-test -d "$target_dir" || mkdir -p "$target_dir" |
62 |
+- |
63 |
+-# We don't bother doing this test before creating the temp dir because we |
64 |
+-# don't expect this to ever fail unless the project source has been damaged. |
65 |
+-if test ! -f $table |
66 |
+-then |
67 |
+- echo "$command: cannot read: $table" >&2 |
68 |
+- exit 1 |
69 |
+-fi |
70 |
+- |
71 |
+-# Setting the compiler's error-limit to zero (or a number much larger than the usual default of 20) |
72 |
+-# is important to the proper functioning of the `defined()` function below. The default limit can, |
73 |
+-# through pure chance, cause the inner loop of that function to terminate prematurely when it |
74 |
+-# decides it isn't making forward progress in eliminating symbol errors. This also makes that |
75 |
+-# process much more efficient. Unfortunately we can't just assume the compiler supports this so |
76 |
+-# only use the flag if it does. Otherwise hope for the best with the default error limit. |
77 |
+-cat > $tmp.c <<! |
78 |
+-int main() { return 1; } |
79 |
+-! |
80 |
+-error_limit='' |
81 |
+-if $cc -ferror-limit=0 $tmp.c |
82 |
+-then |
83 |
+- error_limit="-ferror-limit=0" |
84 |
+-fi |
85 |
+- |
86 |
+-append=0 |
87 |
+-extra=0 |
88 |
+-keep_call='*' |
89 |
+-keep_name='*' |
90 |
+- |
91 |
+-# Note that header "config_ast.h" is created during the Meson feature detection phase. And this |
92 |
+-# script runs after that has completed. That header contains things like the definition of |
93 |
+-# `_ast_intmax_t` that this script depends upon. |
94 |
+-head=' |
95 |
+-#include "config_ast.h" |
96 |
+- |
97 |
+-#include <stdint.h> |
98 |
+-#include <stdbool.h> |
99 |
+-#include <sys/types.h> |
100 |
+-' |
101 |
+- |
102 |
+-tail=' |
103 |
+-#include <sys/param.h> |
104 |
+-#include <sys/stat.h> |
105 |
+-' |
106 |
+- |
107 |
+-headers= |
108 |
+-ifs=${IFS} |
109 |
+-tab=' ' # this should be the only place a literal tab appears in this script |
110 |
+-nl=' |
111 |
+-' |
112 |
+-sym=[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]* |
113 |
+- |
114 |
+-# determine the intmax_t printf format |
115 |
+- |
116 |
+-cat > $tmp.c <<! |
117 |
+-${head} |
118 |
+- |
119 |
+-int main() { |
120 |
+-#if _ast_intmax_long |
121 |
+- return 1; |
122 |
+-#else |
123 |
+- return 0; |
124 |
+-#endif |
125 |
+-} |
126 |
+-! |
127 |
+- |
128 |
+-if $cc -o $tmp.exe $tmp.c && $tmp.exe |
129 |
+-then |
130 |
+- LL_format='ll' |
131 |
+-else |
132 |
+- LL_format='l' |
133 |
+-fi |
134 |
+- |
135 |
+-# determine the intmax_t constant suffix |
136 |
+- |
137 |
+-cat > $tmp.c <<! |
138 |
+-${head} |
139 |
+- |
140 |
+-int main() { |
141 |
+-#if _ast_intmax_long |
142 |
+- return 1; |
143 |
+-#else |
144 |
+- _ast_intmax_t s = 0x7fffffffffffffffLL; |
145 |
+- unsigned _ast_intmax_t u = 0xffffffffffffffffLL; |
146 |
+- |
147 |
+- return 0; |
148 |
+-#endif |
149 |
+-} |
150 |
+-! |
151 |
+- |
152 |
+-if $cc -o $tmp.exe $tmp.c |
153 |
+-then |
154 |
+- if $tmp.exe |
155 |
+- then |
156 |
+- LL_suffix='LL' |
157 |
+- else |
158 |
+- LL_suffix='L' |
159 |
+- fi |
160 |
+-else |
161 |
+- LL_suffix='' |
162 |
+-fi |
163 |
+- |
164 |
+-# This value was dynamically determined by the legacy IFFE based version of this script. Since we |
165 |
+-# can now safely assume every platform we run on supports this syntax (e.g., `1U`) just hardcode it |
166 |
+-# rather than running a compiler test to see if it works. |
167 |
+-U_suffix='U' |
168 |
+- |
169 |
+-# Set up the names and keys. |
170 |
+- |
171 |
+-keys= |
172 |
+-standards= |
173 |
+- |
174 |
+-case $append$extra in |
175 |
+-00) |
176 |
+- echo "$command: read $table" >&2 |
177 |
+- exec < $table |
178 |
+- while : |
179 |
+- do |
180 |
+- IFS="" |
181 |
+- read line |
182 |
+- eof=$? |
183 |
+- IFS=$ifs |
184 |
+- case $eof in |
185 |
+- 0) ;; |
186 |
+- *) break ;; |
187 |
+- esac |
188 |
+- case $line in |
189 |
+- ""|\#*) ;; |
190 |
+- *) set x $line |
191 |
+- shift; name=$1 |
192 |
+- shift; standard=$1 |
193 |
+- shift; call=$1 |
194 |
+- shift; section=$1 |
195 |
+- shift; flags=$1 |
196 |
+- alternates= |
197 |
+- define= |
198 |
+- values= |
199 |
+- script= |
200 |
+- headers= |
201 |
+- while : |
202 |
+- do shift |
203 |
+- case $# in |
204 |
+- 0) break ;; |
205 |
+- esac |
206 |
+- case $1 in |
207 |
+- ":") shift |
208 |
+- eval script='$'script_$1 |
209 |
+- break |
210 |
+- ;; |
211 |
+- *"{") case $1 in |
212 |
+- "sh{") script="# $name" ;; |
213 |
+- *) script= ;; |
214 |
+- esac |
215 |
+- shift |
216 |
+- args="$*" |
217 |
+- IFS="" |
218 |
+- while read line |
219 |
+- do case $line in |
220 |
+- "}") break ;; |
221 |
+- esac |
222 |
+- script="$script$nl$line" |
223 |
+- done |
224 |
+- IFS=$ifs |
225 |
+- break |
226 |
+- ;; |
227 |
+- *.h) # These conf.tab entries are now ignored. |
228 |
+- # We no longer build or use iffe to detect whether |
229 |
+- # a given header is available. Too, not doing this |
230 |
+- # appears to have no material effect on the build. |
231 |
+- ;; |
232 |
+- *) values="$values $1" |
233 |
+- case $1 in |
234 |
+- $sym) echo "$1" >> $tmp.v ;; |
235 |
+- esac |
236 |
+- ;; |
237 |
+- esac |
238 |
+- done |
239 |
+- case " $standards " in |
240 |
+- *" $standard "*) |
241 |
+- ;; |
242 |
+- *) standards="$standards $standard" |
243 |
+- ;; |
244 |
+- esac |
245 |
+- case $name:$flags in |
246 |
+- *:*S*) ;; |
247 |
+- VERSION)flags="${flags}S" ;; |
248 |
+- esac |
249 |
+- case $name in |
250 |
+- *VERSION*)key=${standard}${section} ;; |
251 |
+- *) key= ;; |
252 |
+- esac |
253 |
+- case $key in |
254 |
+- ''|*_) key=${key}${name} ;; |
255 |
+- *) key=${key}_${name} ;; |
256 |
+- esac |
257 |
+- eval sys='$'CONF_call_${key} |
258 |
+- case $sys in |
259 |
+- ?*) call=$sys ;; |
260 |
+- esac |
261 |
+- case $call in |
262 |
+- SI) sys=CS ;; |
263 |
+- *) sys=$call ;; |
264 |
+- esac |
265 |
+- key=${sys}_${key} |
266 |
+- keys="$keys$nl$key" |
267 |
+- eval CONF_name_${key}='$'name |
268 |
+- eval CONF_standard_${key}='$'standard |
269 |
+- eval CONF_call_${key}='$'call |
270 |
+- eval CONF_section_${key}='$'section |
271 |
+- eval CONF_flags_${key}='$'flags |
272 |
+- eval CONF_define_${key}='$'define |
273 |
+- eval CONF_values_${key}='$'values |
274 |
+- eval CONF_script_${key}='$'script |
275 |
+- eval CONF_args_${key}='$'args |
276 |
+- eval CONF_headers_${key}='$'headers |
277 |
+- eval CONF_keys_${name}=\"'$'CONF_keys_${name} '$'key\" |
278 |
+- ;; |
279 |
+- esac |
280 |
+- done |
281 |
+- ;; |
282 |
+-esac |
283 |
+- |
284 |
+-# ==================== |
285 |
+-# Check for native getconf(1). |
286 |
+-# |
287 |
+-CONF_getconf= |
288 |
+-CONF_getconf_a= |
289 |
+-for d in /usr/bin /bin /usr/sbin /sbin |
290 |
+-do if test -x $d/getconf |
291 |
+- then case `$d/getconf --?-version 2>&1` in |
292 |
+- *"AT&T"*"Research"*) |
293 |
+- : presumably an implementation also configured from conf.tab |
294 |
+- ;; |
295 |
+- *) CONF_getconf=$d/getconf |
296 |
+- if $CONF_getconf -a >/dev/null 2>&1 |
297 |
+- then CONF_getconf_a=-a |
298 |
+- fi |
299 |
+- ;; |
300 |
+- esac |
301 |
+- break |
302 |
+- fi |
303 |
+-done |
304 |
+-export CONF_getconf CONF_getconf_a |
305 |
+- |
306 |
+-echo "$command: check ${CONF_getconf:+$CONF_getconf(1),}confstr(2),pathconf(2),sysconf(2),sysinfo(2) configuration names" >&2 |
307 |
+- |
308 |
+-{ |
309 |
+- echo " |
310 |
+-${head} |
311 |
+-#include <unistd.h> |
312 |
+- |
313 |
+-int i = 0;" > $tmp.c |
314 |
+- $cc -E $tmp.c |
315 |
+-} | |
316 |
+-sed -e '/^#[^0123456789]*1[ '"$tab"']*".*".*/!d' \ |
317 |
+- -e 's/^#[^0123456789]*1[ '"$tab"']*"\(.*\)".*/\1/' | |
318 |
+-sort -u > $tmp.f |
319 |
+- |
320 |
+-{ |
321 |
+- sed -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]/ /g' \ |
322 |
+- -e 's/[ '"$tab"'][ '"$tab"']*/\n/g' \ |
323 |
+- `cat $tmp.f` 2>/dev/null | |
324 |
+- egrep '^(SI|_(CS|PC|SC|SI))_.' |
325 |
+- case $CONF_getconf_a in |
326 |
+- ?*) $CONF_getconf $CONF_getconf_a | sed 's,[=: ].*,,' |
327 |
+- ;; |
328 |
+- *) case $CONF_getconf in |
329 |
+- ?*) for v in `strings $CONF_getconf | grep '^[ABCDEFGHIJKLMNOPQRSTUVWXYZ_][ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]*$'` |
330 |
+- do if $CONF_getconf $v >/dev/null |
331 |
+- then echo $v |
332 |
+- fi |
333 |
+- done |
334 |
+- ;; |
335 |
+- esac |
336 |
+- ;; |
337 |
+- esac 2>/dev/null |
338 |
+-} | |
339 |
+-egrep -v '^_[ABCDEFGHIJKLMNOPQRSTUVWXYZ]+_(COUNT|LAST|N|STR)$' | |
340 |
+-sort -u > $tmp.g |
341 |
+-{ |
342 |
+- grep '^_' $tmp.g |
343 |
+- grep '^[^_]' $tmp.g |
344 |
+-} > $tmp.t |
345 |
+-mv $tmp.t $tmp.g |
346 |
+- |
347 |
+-HOST=`"$MESON_SOURCE_ROOT/bin/hosttype" | sed -e 's,[0123456789.].*,,' | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` |
348 |
+-case $HOST in |
349 |
+-'') HOST=SYSTEM ;; |
350 |
+-esac |
351 |
+- |
352 |
+-exec < $tmp.g |
353 |
+-while read line |
354 |
+-do flags=F |
355 |
+- section= |
356 |
+- underscore= |
357 |
+- define=$line |
358 |
+- IFS=_ |
359 |
+- set $line |
360 |
+- IFS=$ifs |
361 |
+- case $1 in |
362 |
+- '') case $# in |
363 |
+- 0) continue ;; |
364 |
+- esac |
365 |
+- shift |
366 |
+- ;; |
367 |
+- esac |
368 |
+- case $1 in |
369 |
+- CS|PC|SC|SI) |
370 |
+- call=$1 |
371 |
+- shift |
372 |
+- standard=$1 |
373 |
+- ;; |
374 |
+- *) flags=${flags}R |
375 |
+- standard=$1 |
376 |
+- while : |
377 |
+- do case $# in |
378 |
+- 0) continue 2 ;; |
379 |
+- esac |
380 |
+- shift |
381 |
+- case $1 in |
382 |
+- CS|PC|SC|SI) |
383 |
+- call=$1 |
384 |
+- shift |
385 |
+- break |
386 |
+- ;; |
387 |
+- O|o|OLD|old) |
388 |
+- continue 2 |
389 |
+- ;; |
390 |
+- esac |
391 |
+- standard=${standard}_$1 |
392 |
+- done |
393 |
+- ;; |
394 |
+- esac |
395 |
+- case $1 in |
396 |
+- SET) continue ;; |
397 |
+- esac |
398 |
+- case $standard in |
399 |
+- _*) standard=`echo $standard | sed 's,^_*,,'` ;; |
400 |
+- esac |
401 |
+- case " $standards " in |
402 |
+- *" $standard "*) |
403 |
+- ;; |
404 |
+- *) case $standard in |
405 |
+- [0123456789]*) |
406 |
+- section=$standard |
407 |
+- standard=POSIX |
408 |
+- ;; |
409 |
+- *[0123456789]) |
410 |
+- eval `echo $standard | sed 's,\(.*\)\([0123456789]*\),standard=\1 section=\2,'` |
411 |
+- ;; |
412 |
+- esac |
413 |
+- ;; |
414 |
+- esac |
415 |
+- case $flags in |
416 |
+- *R*) case $call in |
417 |
+- SI) ;; |
418 |
+- *) underscore=U ;; |
419 |
+- esac |
420 |
+- ;; |
421 |
+- *) case " $standards " in |
422 |
+- " C ") shift |
423 |
+- ;; |
424 |
+- *" $standard "*) |
425 |
+- case $call in |
426 |
+- SI) ;; |
427 |
+- *) flags=${flags}P |
428 |
+- underscore=U |
429 |
+- ;; |
430 |
+- esac |
431 |
+- shift |
432 |
+- ;; |
433 |
+- *) standard= |
434 |
+- ;; |
435 |
+- esac |
436 |
+- ;; |
437 |
+- esac |
438 |
+- case $standard in |
439 |
+- '') standard=$HOST |
440 |
+- case $call in |
441 |
+- SI) ;; |
442 |
+- *) underscore=U ;; |
443 |
+- esac |
444 |
+- case $call in |
445 |
+- CS|PC|SC) |
446 |
+- case $define in |
447 |
+- _${call}_*) |
448 |
+- standard=POSIX |
449 |
+- ;; |
450 |
+- esac |
451 |
+- ;; |
452 |
+- esac |
453 |
+- ;; |
454 |
+- esac |
455 |
+- part=$section |
456 |
+- case $section in |
457 |
+- '') section=1 |
458 |
+- case $standard in |
459 |
+- POSIX|XOPEN) part=$section ;; |
460 |
+- esac |
461 |
+- ;; |
462 |
+- esac |
463 |
+- name= |
464 |
+- while : |
465 |
+- do case $# in |
466 |
+- 0) break ;; |
467 |
+- esac |
468 |
+- case $name in |
469 |
+- '') name=$1 ;; |
470 |
+- *) name=${name}_$1 ;; |
471 |
+- esac |
472 |
+- shift |
473 |
+- done |
474 |
+- case $name in |
475 |
+- '') ;; |
476 |
+- HOSTTYPE|LIBPATH|LIBPREFIX|LIBSUFFIX|PATH_ATTRIBUTES|PATH_RESOLVE|UNIVERSE) |
477 |
+- ;; |
478 |
+- *) values= |
479 |
+- script= |
480 |
+- args= |
481 |
+- headers= |
482 |
+- case $name in |
483 |
+- V[123456789]_*|V[123456789][0123456789]_*) underscore=VW ;; |
484 |
+- esac |
485 |
+- case $call in |
486 |
+- CS|SI) key=CS ;; |
487 |
+- *) key=$call ;; |
488 |
+- esac |
489 |
+- case $name in |
490 |
+- *VERSION*)key=${key}_${standard}${part} ;; |
491 |
+- esac |
492 |
+- key=${key}_${name} |
493 |
+- eval x='$'CONF_keys_$name |
494 |
+- case $x in |
495 |
+- '') eval x='$'CONF_name_$key |
496 |
+- case $x in |
497 |
+- '') case $call in |
498 |
+- SI) flags=O$flags ;; |
499 |
+- esac |
500 |
+- case $underscore in |
501 |
+- ?*) flags=${flags}${underscore} ;; |
502 |
+- esac |
503 |
+- old=QQ |
504 |
+- case $name in |
505 |
+- *VERSION*)old=${old}_${standard}${part} ;; |
506 |
+- esac |
507 |
+- old=${old}_${name} |
508 |
+- eval x='$'CONF_name_$old |
509 |
+- case $x in |
510 |
+- ?*) eval CONF_name_$old= |
511 |
+- eval flags='$'flags'$'CONF_flags_$old |
512 |
+- eval values='$'CONF_values_$old |
513 |
+- eval script='$'CONF_script_$old |
514 |
+- eval args='$'CONF_args_$old |
515 |
+- eval headers='$'CONF_headers_$old |
516 |
+- ;; |
517 |
+- esac |
518 |
+- keys="$keys$nl$key" |
519 |
+- eval CONF_name_${key}='$'name |
520 |
+- eval CONF_standard_${key}='$'standard |
521 |
+- eval CONF_call_${key}='$'call |
522 |
+- eval CONF_section_${key}='$'section |
523 |
+- eval CONF_flags_${key}=d'$'flags |
524 |
+- eval CONF_define_${key}='$'define |
525 |
+- eval CONF_values_${key}='$'values |
526 |
+- eval CONF_script_${key}='$'script |
527 |
+- eval CONF_args_${key}='$'args |
528 |
+- eval CONF_headers_${key}='$'headers |
529 |
+- ;; |
530 |
+- *) eval x='$'CONF_define_$key |
531 |
+- case $x in |
532 |
+- ?*) case $call in |
533 |
+- CS) eval x='$'CONF_call_$key |
534 |
+- case $x in |
535 |
+- SI) ;; |
536 |
+- *) define= ;; |
537 |
+- esac |
538 |
+- ;; |
539 |
+- *) define= |
540 |
+- ;; |
541 |
+- esac |
542 |
+- ;; |
543 |
+- esac |
544 |
+- case $define in |
545 |
+- ?*) eval CONF_define_${key}='$'define |
546 |
+- eval CONF_call_${key}='$'call |
547 |
+- eval x='$'CONF_call_${key} |
548 |
+- case $x in |
549 |
+- QQ) ;; |
550 |
+- *) case $flags in |
551 |
+- *R*) flags=R ;; |
552 |
+- *) flags= ;; |
553 |
+- esac |
554 |
+- ;; |
555 |
+- esac |
556 |
+- case $call in |
557 |
+- SI) flags=O$flags ;; |
558 |
+- esac |
559 |
+- eval CONF_flags_${key}=d'$'flags'$'CONF_flags_${key} |
560 |
+- ;; |
561 |
+- esac |
562 |
+- old=QQ |
563 |
+- case $name in |
564 |
+- *VERSION*)old=${old}_${standard}${part} ;; |
565 |
+- esac |
566 |
+- old=${old}_${name} |
567 |
+- eval CONF_name_$old= |
568 |
+- esac |
569 |
+- ;; |
570 |
+- *) for key in $x |
571 |
+- do eval x='$'CONF_call_${key} |
572 |
+- case $x in |
573 |
+- XX) eval CONF_call_${key}=QQ |
574 |
+- eval CONF_flags_${key}=S'$'CONF_flags_${key} |
575 |
+- ;; |
576 |
+- esac |
577 |
+- done |
578 |
+- esac |
579 |
+- ;; |
580 |
+- esac |
581 |
+-done |
582 |
+- |
583 |
+-# sort keys by name |
584 |
+- |
585 |
+-keys=`for key in $keys |
586 |
+-do eval echo '$'CONF_name_$key '$'key |
587 |
+-done | sort -u | sed 's,.* ,,'` |
588 |
+- |
589 |
+-# mark the dups CONF_PREFIXED |
590 |
+- |
591 |
+-prev_key= |
592 |
+-prev_name= |
593 |
+-for key in $keys |
594 |
+-do eval name=\"'$'CONF_name_$key\" |
595 |
+- case $name in |
596 |
+- '') continue |
597 |
+- ;; |
598 |
+- $prev_name) |
599 |
+- eval p='$'CONF_flags_${prev_key} |
600 |
+- eval c='$'CONF_flags_${key} |
601 |
+- case $p:$c in |
602 |
+- *L*:*L*);; |
603 |
+- *L*:*) c=L${c} ;; |
604 |
+- *:*L*) p=L${p} ;; |
605 |
+- *) p=P$p c=P$c ;; |
606 |
+- esac |
607 |
+- eval CONF_flags_${prev_key}=$p |
608 |
+- eval CONF_flags_${key}=$c |
609 |
+- ;; |
610 |
+- esac |
611 |
+- prev_name=$name |
612 |
+- prev_key=$key |
613 |
+-done |
614 |
+- |
615 |
+-# collect all the macros/enums |
616 |
+- |
617 |
+-for key in $keys |
618 |
+-do eval name=\"'$'CONF_name_$key\" |
619 |
+- case $name in |
620 |
+- '') continue ;; |
621 |
+- $keep_name) ;; |
622 |
+- *) continue ;; |
623 |
+- esac |
624 |
+- eval call=\"'$'CONF_call_$key\" |
625 |
+- case $call in |
626 |
+- $keep_call) ;; |
627 |
+- *) continue ;; |
628 |
+- esac |
629 |
+- eval standard=\"'$'CONF_standard_$key\" |
630 |
+- eval section=\"'$'CONF_section_$key\" |
631 |
+- eval flags=\"'$'CONF_flags_$key\" |
632 |
+- eval define=\"'$'CONF_define_$key\" |
633 |
+- eval values=\"'$'CONF_values_$key\" |
634 |
+- eval script=\"'$'CONF_script_$key\" |
635 |
+- eval args=\"'$'CONF_args_$key\" |
636 |
+- eval headers=\"'$'CONF_headers_$key\" |
637 |
+- conf_name=$name |
638 |
+- case $call in |
639 |
+- QQ) call=XX |
640 |
+- for c in SC PC CS |
641 |
+- do case $flags in |
642 |
+- *S*) case $section in |
643 |
+- 1) eval x='$'CONF_call_${c}_${standard}_${name} ;; |
644 |
+- *) eval x='$'CONF_call_${c}_${standard}${section}_${name} ;; |
645 |
+- esac |
646 |
+- ;; |
647 |
+- *) eval x='$'CONF_call_${c}_${name} |
648 |
+- ;; |
649 |
+- esac |
650 |
+- case $x in |
651 |
+- ?*) call=$x |
652 |
+- break |
653 |
+- ;; |
654 |
+- esac |
655 |
+- done |
656 |
+- case $call in |
657 |
+- XX) for c in SC PC CS |
658 |
+- do echo "_${c}_${name}" |
659 |
+- case $flags in |
660 |
+- *S*) case $section in |
661 |
+- 1) echo "_${c}_${standard}_${name}" ;; |
662 |
+- *) echo "_${c}_${standard}${section}_${name}" ;; |
663 |
+- esac |
664 |
+- ;; |
665 |
+- esac |
666 |
+- done |
667 |
+- ;; |
668 |
+- esac |
669 |
+- ;; |
670 |
+- esac |
671 |
+- case $call in |
672 |
+- CS|PC|SC|SI|XX) |
673 |
+- ;; |
674 |
+- *) echo "$command: $name: $call: invalid call" >&2 |
675 |
+- exit 1 |
676 |
+- ;; |
677 |
+- esac |
678 |
+- case $flags in |
679 |
+- *[ABEGHIJQTYZabcefghijklmnopqrstuvwxyz_123456789]*) |
680 |
+- echo "$command: $name: $flags: invalid flag(s)" >&2 |
681 |
+- exit 1 |
682 |
+- ;; |
683 |
+- esac |
684 |
+- case $section in |
685 |
+- [01]) ;; |
686 |
+- *) case $flags in |
687 |
+- *N*) ;; |
688 |
+- *) name=${section}_${name} ;; |
689 |
+- esac |
690 |
+- standard=${standard}${section} |
691 |
+- ;; |
692 |
+- esac |
693 |
+- case $call in |
694 |
+- XX) ;; |
695 |
+- *) case $flags in |
696 |
+- *d*) conf_op=${define} ;; |
697 |
+- *O*) conf_op=${call}_${name} ;; |
698 |
+- *R*) conf_op=_${standard}_${call}_${name} ;; |
699 |
+- *S*) conf_op=_${call}_${standard}_${name} ;; |
700 |
+- *) conf_op=_${call}_${name} ;; |
701 |
+- esac |
702 |
+- echo "${conf_op}" |
703 |
+- ;; |
704 |
+- esac |
705 |
+- case $standard:$flags in |
706 |
+- C:*) ;; |
707 |
+- *:*L*) echo "${conf_name}" |
708 |
+- echo "_${standard}_${conf_name}" |
709 |
+- ;; |
710 |
+- *:*M*) case $section in |
711 |
+- 1) echo "_${standard}_${conf_name}" ;; |
712 |
+- *) echo "_${standard}${section}_${conf_name}" ;; |
713 |
+- esac |
714 |
+- ;; |
715 |
+- esac |
716 |
+-done > $tmp.q |
717 |
+-sort -u < $tmp.q > $tmp.t |
718 |
+-mv $tmp.t $tmp.q |
719 |
+-sort -u < $tmp.v > $tmp.t |
720 |
+-mv $tmp.t $tmp.v |
721 |
+- |
722 |
+-# test all the macros in a few batches (some compilers have an error limit) |
723 |
+- |
724 |
+-defined() # list-file |
725 |
+-{ |
726 |
+- : > $tmp.p |
727 |
+- while : |
728 |
+- do { |
729 |
+- cat <<! |
730 |
+-${head} |
731 |
+-#include <sys/types.h> |
732 |
+-#include <limits.h> |
733 |
+-#include <unistd.h> |
734 |
+-${headers} |
735 |
+-${tail} |
736 |
+-#undef conf |
737 |
+-unsigned int conf[] = { |
738 |
+-! |
739 |
+- sed 's/$/,/' $1 |
740 |
+- echo "};" |
741 |
+- } > $tmp.c |
742 |
+- if $cc $error_limit -c $tmp.c > $tmp.e 2>&1 |
743 |
+- then |
744 |
+- break # no compiler error implies all the symbols are valid |
745 |
+- fi |
746 |
+- python.sh sort_symbols.py < $tmp.e > $tmp.n |
747 |
+- cmp -s $tmp.n $tmp.p && break |
748 |
+- fgrep -x -v -f $tmp.n $1 > $tmp.y |
749 |
+- mv $tmp.y $1 |
750 |
+- mv $tmp.n $tmp.p |
751 |
+- done |
752 |
+- { |
753 |
+- cat <<! |
754 |
+-${head} |
755 |
+-#include <sys/types.h> |
756 |
+-#include <limits.h> |
757 |
+-#include <unistd.h> |
758 |
+-${headers} |
759 |
+-${tail} |
760 |
+-#undef conf |
761 |
+-! |
762 |
+- sed 's/.*/conf "&" = &/' $1 |
763 |
+- } > $tmp.c |
764 |
+- $cc -E $error_limit $tmp.c 2>/dev/null | |
765 |
+- sed -e '/conf[ '"$tab"']*".*"[ '"$tab"']*=[ '"$tab"']*/!d' \ |
766 |
+- -e '/[_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789][ '"$tab"']*(/!d' -e 's/.*"\(.*\)".*/\1/' > $tmp.n |
767 |
+- if test -s $tmp.n |
768 |
+- then fgrep -x -v -f $tmp.n $1 > $tmp.y |
769 |
+- mv $tmp.y $1 |
770 |
+- fi |
771 |
+-} |
772 |
+- |
773 |
+-echo "$command: check macros/enums as static initializers" >&2 |
774 |
+- |
775 |
+-defined $tmp.q |
776 |
+-defined $tmp.v |
777 |
+- |
778 |
+-# mark the constant macros/enums |
779 |
+- |
780 |
+-exec < $tmp.q |
781 |
+-while read line |
782 |
+-do eval CONF_const_${line}=1 |
783 |
+-done |
784 |
+- |
785 |
+-exec < $tmp.v |
786 |
+-while read line |
787 |
+-do eval CONF_const_${line}=1 |
788 |
+-done |
789 |
+- |
790 |
+-# mark the string literal values |
791 |
+- |
792 |
+-{ |
793 |
+- cat <<! |
794 |
+-${head} |
795 |
+-#include <sys/types.h> |
796 |
+-#include <limits.h> |
797 |
+-#include <unistd.h> |
798 |
+-${headers} |
799 |
+-${tail} |
800 |
+-#undef conf |
801 |
+-! |
802 |
+- sed 's/.*/conf "&" = &/' $tmp.q |
803 |
+-} > $tmp.c |
804 |
+-$cc -E $tmp.c | |
805 |
+-sed -e '/conf[ '"$tab"']*".*"[ '"$tab"']*=[ '"$tab"']*"/!d' -e 's/.*"\([^"]*\)".*/\1/' > $tmp.e |
806 |
+-exec < $tmp.e |
807 |
+-while read line |
808 |
+-do eval CONF_string_${line}=1 |
809 |
+-done |
810 |
+- |
811 |
+-# Walk through the table. |
812 |
+- |
813 |
+-name_max=1 |
814 |
+-export tmp name standard call cc |
815 |
+- |
816 |
+-exec > $tmp.t |
817 |
+-for key in $keys |
818 |
+-do eval name=\"'$'CONF_name_$key\" |
819 |
+- case $name in |
820 |
+- '') continue ;; |
821 |
+- $keep_name) ;; |
822 |
+- *) continue ;; |
823 |
+- esac |
824 |
+- eval call=\"'$'CONF_call_$key\" |
825 |
+- case $call in |
826 |
+- $keep_call) ;; |
827 |
+- *) continue ;; |
828 |
+- esac |
829 |
+- eval standard=\"'$'CONF_standard_$key\" |
830 |
+- eval section=\"'$'CONF_section_$key\" |
831 |
+- eval flags=\"'$'CONF_flags_$key\" |
832 |
+- eval define=\"'$'CONF_define_$key\" |
833 |
+- eval values=\"'$'CONF_values_$key\" |
834 |
+- eval script=\"'$'CONF_script_$key\" |
835 |
+- eval args=\"'$'CONF_args_$key\" |
836 |
+- eval headers=\"'$'CONF_headers_$key\" |
837 |
+- conf_name=$name |
838 |
+- case $call in |
839 |
+- QQ) call=XX |
840 |
+- for c in SC PC CS |
841 |
+- do case $flags in |
842 |
+- *S*) case $section in |
843 |
+- 1) eval x='$'CONF_call_${c}_${standard}_${name} ;; |
844 |
+- *) eval x='$'CONF_call_${c}_${standard}${section}_${name} ;; |
845 |
+- esac |
846 |
+- ;; |
847 |
+- *) eval x='$'CONF_call_${c}_${name} |
848 |
+- ;; |
849 |
+- esac |
850 |
+- case $x in |
851 |
+- ?*) call=$x |
852 |
+- break |
853 |
+- ;; |
854 |
+- esac |
855 |
+- done |
856 |
+- case $call in |
857 |
+- XX) for c in SC PC CS |
858 |
+- do case $flags in |
859 |
+- *S*) case $section in |
860 |
+- 1) eval x='$'CONF_const__${c}_${standard}_${name} ;; |
861 |
+- *) eval x='$'CONF_const__${c}_${standard}${section}_${name} ;; |
862 |
+- esac |
863 |
+- ;; |
864 |
+- *) eval x='$'CONF_const__${c}_${name} |
865 |
+- ;; |
866 |
+- esac |
867 |
+- case $x in |
868 |
+- 1) call=$c |
869 |
+- break |
870 |
+- ;; |
871 |
+- esac |
872 |
+- done |
873 |
+- ;; |
874 |
+- esac |
875 |
+- case $call in |
876 |
+- XX) case $standard in |
877 |
+- C) standard=POSIX ;; |
878 |
+- esac |
879 |
+- case $flags in |
880 |
+- *L*) flags=lFU ;; |
881 |
+- *) flags=FU ;; |
882 |
+- esac |
883 |
+- ;; |
884 |
+- esac |
885 |
+- ;; |
886 |
+- esac |
887 |
+- case " $standards " in |
888 |
+- *" $standard "*) |
889 |
+- ;; |
890 |
+- *) standards="$standards $standard" |
891 |
+- ;; |
892 |
+- esac |
893 |
+- conf_standard=CONF_${standard} |
894 |
+- case $call in |
895 |
+- CS) conf_call=CONF_confstr |
896 |
+- ;; |
897 |
+- PC) conf_call=CONF_pathconf |
898 |
+- ;; |
899 |
+- SC) conf_call=CONF_sysconf |
900 |
+- ;; |
901 |
+- SI) conf_call=CONF_sysinfo |
902 |
+- ;; |
903 |
+- XX) conf_call=CONF_nop |
904 |
+- ;; |
905 |
+- esac |
906 |
+- conf_op=-1 |
907 |
+- for s in _${call}_${standard}${section}_${name} _${call}_${standard}_${name} _${call}_${section}_${name} _${call}_${name} ${call}_${name} |
908 |
+- do eval x='$'CONF_const_${s} |
909 |
+- case $x in |
910 |
+- 1) conf_op=${s} |
911 |
+- break |
912 |
+- ;; |
913 |
+- esac |
914 |
+- done |
915 |
+- conf_section=$section |
916 |
+- conf_flags=0 |
917 |
+- case $flags in |
918 |
+- *C*) conf_flags="${conf_flags}|CONF_DEFER_CALL" ;; |
919 |
+- esac |
920 |
+- case $flags in |
921 |
+- *D*) conf_flags="${conf_flags}|CONF_DEFER_MM" ;; |
922 |
+- esac |
923 |
+- case $flags in |
924 |
+- *F*) conf_flags="${conf_flags}|CONF_FEATURE" ;; |
925 |
+- esac |
926 |
+- case $flags in |
927 |
+- *L*) conf_flags="${conf_flags}|CONF_LIMIT" ;; |
928 |
+- esac |
929 |
+- case $flags in |
930 |
+- *M*) conf_flags="${conf_flags}|CONF_MINMAX" ;; |
931 |
+- esac |
932 |
+- case $flags in |
933 |
+- *N*) conf_flags="${conf_flags}|CONF_NOSECTION" ;; |
934 |
+- esac |
935 |
+- case $flags in |
936 |
+- *P*) conf_flags="${conf_flags}|CONF_PREFIXED" ;; |
937 |
+- esac |
938 |
+- case $flags in |
939 |
+- *S*) conf_flags="${conf_flags}|CONF_STANDARD" ;; |
940 |
+- esac |
941 |
+- case $flags in |
942 |
+- *U*) conf_flags="${conf_flags}|CONF_UNDERSCORE" ;; |
943 |
+- esac |
944 |
+- case $flags in |
945 |
+- *V*) conf_flags="${conf_flags}|CONF_NOUNDERSCORE" ;; |
946 |
+- esac |
947 |
+- case $flags in |
948 |
+- *W*) conf_flags="${conf_flags}|CONF_PREFIX_ONLY" ;; |
949 |
+- esac |
950 |
+- case $call in |
951 |
+- CS|SI) conf_flags="${conf_flags}|CONF_STRING" |
952 |
+- string=1 |
953 |
+- ;; |
954 |
+- *) eval string='$'CONF_string_${key} |
955 |
+- ;; |
956 |
+- esac |
957 |
+- conf_limit=0 |
958 |
+- case $flags in |
959 |
+- *[Ll]*) d= |
960 |
+- case ${conf_name} in |
961 |
+- LONG_MAX|SSIZE_MAX) |
962 |
+- x= |
963 |
+- ;; |
964 |
+- *) eval x='$'CONF_const_${conf_name} |
965 |
+- ;; |
966 |
+- esac |
967 |
+- case $x in |
968 |
+- '') for s in ${values} |
969 |
+- do case $s in |
970 |
+- $sym) eval x='$'CONF_const_${s} |
971 |
+- case $x in |
972 |
+- 1) eval a='$'CONF_const_${standard}_${s} |
973 |
+- case $a in |
974 |
+- $x) x= ;; |
975 |
+- *) x=$s ;; |
976 |
+- esac |
977 |
+- break |
978 |
+- ;; |
979 |
+- esac |
980 |
+- ;; |
981 |
+- [0123456789]*|[-+][0123456789]*) |
982 |
+- d=$s |
983 |
+- break |
984 |
+- ;; |
985 |
+- esac |
986 |
+- done |
987 |
+- case ${x:+1}:$flags:$conf_op in |
988 |
+- :*:-1|:*X*:*) |
989 |
+- echo "$command: probe for ${conf_name} <limits.h> value" >&2 |
990 |
+- x= |
991 |
+- case $CONF_getconf in |
992 |
+- ?*) if $CONF_getconf $conf_name > $tmp.x 2>/dev/null |
993 |
+- then x=`cat $tmp.x` |
994 |
+- case $x in |
995 |
+- undefined) x= ;; |
996 |
+- esac |
997 |
+- fi |
998 |
+- ;; |
999 |
+- esac |
1000 |
+- case ${x:+1} in |
1001 |
+- '') case $script in |
1002 |
+- '#'*) echo "$script" > $tmp.sh |
1003 |
+- chmod +x $tmp.sh |
1004 |
+- x=`$tmp.sh 2>/dev/null` |
1005 |
+- ;; |
1006 |
+- '') case $conf_name in |
1007 |
+- SIZE_*|U*|*_MAX) |
1008 |
+- f="%${LL_format}u" |
1009 |
+- t="unsigned _ast_intmax_t" |
1010 |
+- ;; |
1011 |
+- *) f="%${LL_format}d" |
1012 |
+- t="_ast_intmax_t" |
1013 |
+- ;; |
1014 |
+- esac |
1015 |
+- cat > $tmp.c <<! |
1016 |
+-${head} |
1017 |
+-#include <stdio.h> |
1018 |
+-#include <sys/types.h> |
1019 |
+-#include <limits.h> |
1020 |
+-#include <unistd.h> |
1021 |
+-${headers} |
1022 |
+-${tail} |
1023 |
+-int |
1024 |
+-main() |
1025 |
+-{ |
1026 |
+- printf("$f\n", ($t)$conf_name); |
1027 |
+- return 0; |
1028 |
+-} |
1029 |
+-! |
1030 |
+- ;; |
1031 |
+- *) cat > $tmp.c <<! |
1032 |
+-${head} |
1033 |
+-#include <stdio.h> |
1034 |
+-#include <sys/types.h> |
1035 |
+-#include <limits.h> |
1036 |
+-#include <unistd.h> |
1037 |
+-${headers} |
1038 |
+-${tail} |
1039 |
+-${script} |
1040 |
+-! |
1041 |
+- ;; |
1042 |
+- esac |
1043 |
+- case $args in |
1044 |
+- '') set "" ;; |
1045 |
+- *) eval set '""' '"'$args'"'; shift ;; |
1046 |
+- esac |
1047 |
+- for a |
1048 |
+- do case $script in |
1049 |
+- '#'*) $tmp.sh $a > $tmp.x |
1050 |
+- x=$? |
1051 |
+- ;; |
1052 |
+- *) $cc $a -o $tmp.exe $tmp.c && $tmp.exe > $tmp.x |
1053 |
+- x=$? |
1054 |
+- ;; |
1055 |
+- esac |
1056 |
+- case $x in |
1057 |
+- 0) x=`cat $tmp.x` |
1058 |
+- case $x in |
1059 |
+- "-") x=$a ;; |
1060 |
+- esac |
1061 |
+- break |
1062 |
+- ;; |
1063 |
+- *) x= |
1064 |
+- ;; |
1065 |
+- esac |
1066 |
+- done |
1067 |
+- ;; |
1068 |
+- esac |
1069 |
+- case $x in |
1070 |
+- '') x=$d ;; |
1071 |
+- esac |
1072 |
+- ;; |
1073 |
+- esac |
1074 |
+- case ${x:+1}:$flags:$conf_op in |
1075 |
+- 1:*:-1|1:*X*:*) |
1076 |
+- conf_limit=$x |
1077 |
+- case $flags in |
1078 |
+- *L*) ;; |
1079 |
+- *) conf_flags="${conf_flags}|CONF_LIMIT" ;; |
1080 |
+- esac |
1081 |
+- conf_flags="${conf_flags}|CONF_LIMIT_DEF" |
1082 |
+- esac |
1083 |
+- ;; |
1084 |
+- esac |
1085 |
+- ;; |
1086 |
+- esac |
1087 |
+- case $section in |
1088 |
+- [01]) ;; |
1089 |
+- *) case $flags in |
1090 |
+- *N*) ;; |
1091 |
+- *) name=${section}_${name} ;; |
1092 |
+- esac |
1093 |
+- standard=${standard}${section} |
1094 |
+- ;; |
1095 |
+- esac |
1096 |
+- conf_minmax=0 |
1097 |
+- case $call:$standard:$flags in |
1098 |
+- *:C:*M*)for s in _${standard}_${conf_name} ${values} |
1099 |
+- do case $s in |
1100 |
+- $sym) ;; |
1101 |
+- *) conf_minmax=$s |
1102 |
+- conf_flags="${conf_flags}|CONF_MINMAX_DEF" |
1103 |
+- break |
1104 |
+- ;; |
1105 |
+- esac |
1106 |
+- done |
1107 |
+- ;; |
1108 |
+- *:C:*) ;; |
1109 |
+- [CPSX][CSX]:*:*[FM]*) |
1110 |
+- x= |
1111 |
+- for s in _${standard}_${conf_name} ${values} |
1112 |
+- do case $s in |
1113 |
+- $sym) eval x='$'CONF_const_${s} ;; |
1114 |
+- *) x=1 ;; |
1115 |
+- esac |
1116 |
+- case $x in |
1117 |
+- 1) conf_minmax=$s |
1118 |
+- case $flags in |
1119 |
+- *M*) conf_flags="${conf_flags}|CONF_MINMAX_DEF" ;; |
1120 |
+- esac |
1121 |
+- case $conf_minmax in |
1122 |
+- [-+0123456789]*) x= ;; |
1123 |
+- esac |
1124 |
+- break |
1125 |
+- ;; |
1126 |
+- esac |
1127 |
+- done |
1128 |
+- case ${x:+1}:${script:+1} in |
1129 |
+- :1) |
1130 |
+- echo "$command: probe for _${standard}_${conf_name} minmax value" >&2 |
1131 |
+- case $CONF_getconf in |
1132 |
+- ?*) if $CONF_getconf _${standard}_${conf_name} > $tmp.x |
1133 |
+- then x=`cat $tmp.x` |
1134 |
+- case $x in |
1135 |
+- undefined) x= ;; |
1136 |
+- esac |
1137 |
+- fi |
1138 |
+- ;; |
1139 |
+- esac |
1140 |
+- case $x in |
1141 |
+- '') case $script in |
1142 |
+- '#'*) echo "$script" > $tmp.sh |
1143 |
+- chmod +x $tmp.sh |
1144 |
+- x=`$tmp.sh` |
1145 |
+- ;; |
1146 |
+- *) cat > $tmp.c <<! |
1147 |
+-${head} |
1148 |
+-#include <sys/types.h> |
1149 |
+-#include <limits.h> |
1150 |
+-#include <unistd.h> |
1151 |
+-${headers} |
1152 |
+-${tail} |
1153 |
+-${script} |
1154 |
+-! |
1155 |
+- ;; |
1156 |
+- esac |
1157 |
+- case $args in |
1158 |
+- '') set "" ;; |
1159 |
+- *) eval set '""' "$args"; shift ;; |
1160 |
+- esac |
1161 |
+- for a |
1162 |
+- do case $script in |
1163 |
+- '#'*) $tmp.sh $a > $tmp.x |
1164 |
+- x=$? |
1165 |
+- ;; |
1166 |
+- *) $cc $a -o $tmp.exe $tmp.c && $tmp.exe > $tmp.x |
1167 |
+- x=$? |
1168 |
+- ;; |
1169 |
+- esac |
1170 |
+- case $x in |
1171 |
+- 0) x=`cat $tmp.x` |
1172 |
+- case $x in |
1173 |
+- "-") x=$a ;; |
1174 |
+- esac |
1175 |
+- break |
1176 |
+- ;; |
1177 |
+- *) x= |
1178 |
+- ;; |
1179 |
+- esac |
1180 |
+- done |
1181 |
+- ;; |
1182 |
+- esac |
1183 |
+- case $x in |
1184 |
+- ?*) conf_minmax=$x |
1185 |
+- case $flags in |
1186 |
+- *M*) case "|$conf_flags|" in |
1187 |
+- *'|CONF_MINMAX_DEF|'*) |
1188 |
+- ;; |
1189 |
+- *) conf_flags="${conf_flags}|CONF_MINMAX_DEF" |
1190 |
+- ;; |
1191 |
+- esac |
1192 |
+- ;; |
1193 |
+- esac |
1194 |
+- ;; |
1195 |
+- esac |
1196 |
+- ;; |
1197 |
+- esac |
1198 |
+- ;; |
1199 |
+- esac |
1200 |
+- case $string in |
1201 |
+- 1) conf_limit="{ 0, $conf_limit }" conf_minmax="{ 0, $conf_minmax }" |
1202 |
+- ;; |
1203 |
+- *) case $conf_limit in |
1204 |
+- 0[xX]*|-*|+*|[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]*) |
1205 |
+- ;; |
1206 |
+- *[!0123456789abcdefABCDEF]*) |
1207 |
+- conf_limit=0 |
1208 |
+- ;; |
1209 |
+- *[!0123456789]*) |
1210 |
+- conf_limit=0x$conf_limit |
1211 |
+- ;; |
1212 |
+- esac |
1213 |
+- case $conf_minmax in |
1214 |
+- 0[xX]*|-*|+*|[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]*) |
1215 |
+- ;; |
1216 |
+- *[!0123456789abcdefABCDEF]*) |
1217 |
+- conf_minmax=0 |
1218 |
+- ;; |
1219 |
+- *[!0123456789]*) |
1220 |
+- conf_minmax=0x$conf_minmax |
1221 |
+- ;; |
1222 |
+- esac |
1223 |
+- case $conf_limit in |
1224 |
+- ?*[-+]*|*['()']*) |
1225 |
+- ;; |
1226 |
+- *[lLuU]) |
1227 |
+- case $LL_suffix in |
1228 |
+- ??) case $conf_limit in |
1229 |
+- *[!lL][lL]|*[!lL][lL][uU]) |
1230 |
+- conf_limit=${conf_limit}L |
1231 |
+- ;; |
1232 |
+- esac |
1233 |
+- ;; |
1234 |
+- esac |
1235 |
+- ;; |
1236 |
+- -*[2468]) |
1237 |
+- eval `echo '' $conf_limit | sed 's/ *\(.*\)\(.\) */p=\1 s=\2/'` |
1238 |
+- s=`expr $s - 1` |
1239 |
+- conf_limit=${p}${s}${LL_suffix}-1${LL_suffix} |
1240 |
+- ;; |
1241 |
+- 0[xX]*[abcdefABCDEF]) |
1242 |
+- conf_limit=${conf_limit}${LL_suffix} |
1243 |
+- ;; |
1244 |
+- -*[0123456789]) |
1245 |
+- conf_limit=${conf_limit}${LL_suffix} |
1246 |
+- ;; |
1247 |
+- *[0123456789]) |
1248 |
+- conf_limit=${conf_limit}${U_suffix}${LL_suffix} |
1249 |
+- ;; |
1250 |
+- esac |
1251 |
+- case $conf_minmax in |
1252 |
+- ?*[-+]*|*['()']*) |
1253 |
+- ;; |
1254 |
+- *[lLuU]) |
1255 |
+- case $LL_suffix in |
1256 |
+- ??) case $conf_minmax in |
1257 |
+- *[!lL][lL]|*[!lL][lL][uU]) |
1258 |
+- conf_minmax=${conf_minmax}L |
1259 |
+- ;; |
1260 |
+- esac |
1261 |
+- ;; |
1262 |
+- esac |
1263 |
+- ;; |
1264 |
+- -*[2468]) |
1265 |
+- eval `echo '' $conf_minmax | sed 's/ *\(.*\)\(.\) */p=\1 s=\2/'` |
1266 |
+- s=`expr $s - 1` |
1267 |
+- conf_minmax=${p}${s}${LL_suffix}-1${LL_suffix} |
1268 |
+- ;; |
1269 |
+- 0[xX]*[abcdefABCDEF]) |
1270 |
+- conf_minmax=${conf_minmax}${LL_suffix} |
1271 |
+- ;; |
1272 |
+- -*[0123456789]) |
1273 |
+- conf_minmax=${conf_minmax}${LL_suffix} |
1274 |
+- ;; |
1275 |
+- *[0123456789]) |
1276 |
+- conf_minmax=${conf_minmax}${U_suffix}${LL_suffix} |
1277 |
+- ;; |
1278 |
+- esac |
1279 |
+- conf_limit="{ $conf_limit, 0 }" conf_minmax="{ $conf_minmax, 0 }" |
1280 |
+- ;; |
1281 |
+- esac |
1282 |
+- |
1283 |
+- case $conf_flags in |
1284 |
+- '0|'*) conf_flags=`echo "$conf_flags" | sed 's/^0.//'` |
1285 |
+- ;; |
1286 |
+- esac |
1287 |
+- |
1288 |
+- echo "{ \"$conf_name\", $conf_limit, $conf_minmax, $conf_flags, $conf_standard, $conf_section, $conf_call, $conf_op }," |
1289 |
+- len=`echo ${conf_name} | wc -c` |
1290 |
+- if expr \( $len - 1 \) \>= ${name_max} >/dev/null |
1291 |
+- then name_max=$len |
1292 |
+- fi |
1293 |
+-done |
1294 |
+- |
1295 |
+-# ==================== |
1296 |
+-# Create the conftab.h header file. |
1297 |
+-# |
1298 |
+-echo "$command: generate conftab.h string table header" >&2 |
1299 |
+- |
1300 |
+-name_max=`expr \( $name_max + 3 \) / 4 \* 4` |
1301 |
+- |
1302 |
+-conf_standards= |
1303 |
+-index=0 |
1304 |
+-for standard in $standards |
1305 |
+-do |
1306 |
+- standard="#define CONF_${standard} ${index}" |
1307 |
+- conf_standards="$conf_standards$nl$standard" |
1308 |
+- index=`expr $index + 1` |
1309 |
+-done |
1310 |
+-conf_standards="$conf_standards$nl#define CONF_call ${index}" |
1311 |
+- |
1312 |
+-getconf= |
1313 |
+-case $CONF_getconf in |
1314 |
+-?*) getconf="$getconf$nl#define _pth_getconf \"$CONF_getconf\"" |
1315 |
+- case $CONF_getconf_a in |
1316 |
+- ?*) getconf="$getconf$nl#define _pth_getconf_a \"$CONF_getconf_a\"" ;; |
1317 |
+- esac |
1318 |
+- ;; |
1319 |
+-esac |
1320 |
+- |
1321 |
+-python.sh fill_template.py < ${source_dir}/conftab.h.in > ${target_dir}/conftab.h \ |
1322 |
+- conf_standards "$conf_standards" \ |
1323 |
+- getconf "$getconf" \ |
1324 |
+- name_max "$name_max" |
1325 |
+-test $? -eq 0 || { rm ${target_dir}/conftab.*; exit 1; } |
1326 |
+- |
1327 |
+-# ==================== |
1328 |
+-# Create the conftab.c source file. |
1329 |
+-# |
1330 |
+-echo "$command: generate conftab.c string table" >&2 |
1331 |
+- |
1332 |
+-prefix_standards= |
1333 |
+-for standard in $standards |
1334 |
+-do |
1335 |
+- len=`echo ${standard} | wc -c`; len=`expr $len - 1` |
1336 |
+- entry=" { \"${standard}\", ${len}, CONF_${standard}, -1 }," |
1337 |
+- prefix_standards="$prefix_standards$nl$entry" |
1338 |
+-done |
1339 |
+- |
1340 |
+-getconf=`cat $tmp.t` |
1341 |
+- |
1342 |
+-python.sh fill_template.py < ${source_dir}/conftab.c.in > ${target_dir}/conftab.c \ |
1343 |
+- getconf "$getconf" \ |
1344 |
+- headers "$headers" \ |
1345 |
+- prefix_standards "$prefix_standards" |
1346 |
+-test $? -eq 0 || { rm ${target_dir}/conftab.*; exit 1; } |