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