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