home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume15 / perl2 / part06 / text0000.txt < prev   
Encoding:
Text File  |  1989-01-05  |  49.0 KB  |  2,247 lines

  1. #! /bin/sh
  2.  
  3. # Make a new directory for the perl sources, cd to it, and run kits 1
  4. # thru 15 through sh.  When all 15 kits have been run, read README.
  5.  
  6. echo "This is perl 2.0 kit 6 (of 15).  If kit 6 is complete, the line"
  7. echo '"'"End of kit 6 (of 15)"'" will echo at the end.'
  8. echo ""
  9. export PATH || (echo "You didn't use sh, you clunch." ; kill $$)
  10. mkdir t 2>/dev/null
  11. echo Extracting Configure
  12. sed >Configure <<'!STUFFY!FUNK!' -e 's/X//'
  13. X#! /bin/sh
  14. X#
  15. X# If these # comments don't work, trim them.  Don't worry about any other
  16. X# shell scripts, Configure will trim # comments from them for you.
  17. X#
  18. X# (If you are trying to port this package to a machine without sh, I would
  19. X# suggest you cut out the prototypical config.h from the end of Configure
  20. X# and edit it to reflect your system.  Some packages may include samples
  21. X# of config.h for certain machines, so you might look for one of those.)
  22. X#
  23. X# $Header: Configure,v 2.0 88/06/05 00:07:37 root Exp $
  24. X#
  25. X# Yes, you may rip this off to use in other distribution packages.
  26. X# (Note: this Configure script was generated automatically.  Rather than
  27. X# working with this copy of Configure, you may wish to get metaconfig.)
  28. X
  29. X: sanity checks
  30. XPATH='.:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc:/usr/new:/usr/new/bin:/usr/nbin'
  31. Xexport PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0; kill $$)
  32. X
  33. Xif test ! -t 0; then
  34. X    echo "Say 'sh Configure', not 'sh <Configure'"
  35. X    exit 1
  36. Xfi
  37. X
  38. X(alias) >/dev/null 2>&1 && \
  39. X    echo "(I see you are using the Korn shell.  Some ksh's blow up on Configure," && \
  40. X    echo "especially on exotic machines.  If yours does, try the Bourne shell instead.)"
  41. X
  42. Xif test ! -d ../UU; then
  43. X    if test ! -d UU; then
  44. X    mkdir UU
  45. X    fi
  46. X    cd UU
  47. Xfi
  48. X
  49. Xcase "$1" in
  50. X-d) shift; fastread='yes';;
  51. Xesac
  52. X
  53. Xd_eunice=''
  54. Xeunicefix=''
  55. Xdefine=''
  56. Xloclist=''
  57. Xexpr=''
  58. Xsed=''
  59. Xecho=''
  60. Xcat=''
  61. Xrm=''
  62. Xmv=''
  63. Xcp=''
  64. Xtail=''
  65. Xtr=''
  66. Xmkdir=''
  67. Xsort=''
  68. Xuniq=''
  69. Xgrep=''
  70. Xtrylist=''
  71. Xtest=''
  72. Xinews=''
  73. Xegrep=''
  74. Xmore=''
  75. Xpg=''
  76. XMcc=''
  77. Xvi=''
  78. Xmailx=''
  79. Xmail=''
  80. Xcpp=''
  81. XLog=''
  82. XHeader=''
  83. Xbin=''
  84. Xcc=''
  85. Xcontains=''
  86. Xcppstdin=''
  87. Xcppminus=''
  88. Xd_bcopy=''
  89. Xd_charsprf=''
  90. Xd_crypt=''
  91. Xd_fchmod=''
  92. Xd_fchown=''
  93. Xd_getgrps=''
  94. Xd_index=''
  95. Xd_killpg=''
  96. Xd_memcpy=''
  97. Xd_rename=''
  98. Xd_setegid=''
  99. Xd_seteuid=''
  100. Xd_setrgid=''
  101. Xd_setruid=''
  102. Xd_statblks=''
  103. Xd_stdstdio=''
  104. Xd_strcspn=''
  105. Xd_strctcpy=''
  106. Xd_symlink=''
  107. Xd_tminsys=''
  108. Xd_vfork=''
  109. Xd_voidsig=''
  110. Xgidtype=''
  111. Xlibc=''
  112. Xlibnm=''
  113. Xmallocsrc=''
  114. Xmallocobj=''
  115. Xusemymalloc=''
  116. Xmansrc=''
  117. Xmanext=''
  118. Xmodels=''
  119. Xsplit=''
  120. Xsmall=''
  121. Xmedium=''
  122. Xlarge=''
  123. Xhuge=''
  124. Xccflags=''
  125. Xldflags=''
  126. Xn=''
  127. Xc=''
  128. Xpackage=''
  129. Xspitshell=''
  130. Xshsharp=''
  131. Xsharpbang=''
  132. Xstartsh=''
  133. Xstdchar=''
  134. Xuidtype=''
  135. Xvoidflags=''
  136. Xdefvoidused=''
  137. Xprivlib=''
  138. XCONFIG=''
  139. X
  140. X: set package name
  141. Xpackage=perl
  142. X
  143. Xecho " "
  144. Xecho "Beginning of configuration questions for $package kit."
  145. X: Eunice requires " " instead of "", can you believe it
  146. Xecho " "
  147. X
  148. Xdefine='define'
  149. Xundef='/*undef'
  150. Xlibpth='/usr/lib /usr/local/lib /lib'
  151. Xsmallmach='pdp11 i8086 z8000 i80286 iAPX286'
  152. Xrmlist='kit[1-9]isdone kit[1-9][0-9]isdone'
  153. Xtrap 'echo " "; rm -f $rmlist; exit 1' 1 2 3
  154. X
  155. X: We must find out about Eunice early
  156. Xeunicefix=':'
  157. Xif test -f /etc/unixtovms; then
  158. X    eunicefix=/etc/unixtovms
  159. Xfi
  160. Xif test -f /etc/unixtovms.exe; then
  161. X    eunicefix=/etc/unixtovms.exe
  162. Xfi
  163. X
  164. Xattrlist="mc68000 sun gcos unix ibm gimpel interdata tss os mert pyr"
  165. Xattrlist="$attrlist vax pdp11 i8086 z8000 u3b2 u3b5 u3b20 u3b200"
  166. Xattrlist="$attrlist ns32000 ns16000 iAPX286 mc300 mc500 mc700 sparc"
  167. Xattrlist="$attrlist nsc32000 sinix xenix venix posix ansi M_XENIX"
  168. Xattrlist="$attrlist $mc68k __STDC__"
  169. Xpth="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/lbin /etc /usr/lib /lib"
  170. Xd_newshome="../../NeWS"
  171. Xdefvoidused=7
  172. X
  173. X: some greps do not return status, grrr.
  174. Xecho "grimblepritz" >grimble
  175. Xif grep blurfldyick grimble >/dev/null 2>&1 ; then
  176. X    contains=contains
  177. Xelif grep grimblepritz grimble >/dev/null 2>&1 ; then
  178. X    contains=grep
  179. Xelse
  180. X    contains=contains
  181. Xfi
  182. Xrm -f grimble
  183. X: the following should work in any shell
  184. Xcase "$contains" in
  185. Xcontains*)
  186. X    echo " "
  187. X    echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
  188. X    cat >contains <<'EOSS'
  189. Xgrep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
  190. XEOSS
  191. Xchmod +x contains
  192. Xesac
  193. X
  194. X: first determine how to suppress newline on echo command
  195. Xecho "Checking echo to see how to suppress newlines..."
  196. X(echo "hi there\c" ; echo " ") >.echotmp
  197. Xif $contains c .echotmp >/dev/null 2>&1 ; then
  198. X    echo "...using -n."
  199. X    n='-n'
  200. X    c=''
  201. Xelse
  202. X    cat <<'EOM'
  203. X...using \c
  204. XEOM
  205. X    n=''
  206. X    c='\c'
  207. Xfi
  208. Xecho $n "Type carriage return to continue.  Your cursor should be here-->$c"
  209. Xread ans
  210. Xrm -f .echotmp
  211. X
  212. X: now set up to do reads with possible shell escape and default assignment
  213. Xcat <<EOSC >myread
  214. Xcase "\$fastread" in
  215. Xyes) ans=''; echo " " ;;
  216. X*) ans='!';;
  217. Xesac
  218. Xwhile expr "X\$ans" : "X!" >/dev/null; do
  219. X    read ans
  220. X    case "\$ans" in
  221. X    !)
  222. X    sh
  223. X    echo " "
  224. X    echo $n "\$rp $c"
  225. X    ;;
  226. X    !*)
  227. X    set \`expr "X\$ans" : "X!\(.*\)\$"\`
  228. X    sh -c "\$*"
  229. X    echo " "
  230. X    echo $n "\$rp $c"
  231. X    ;;
  232. X    esac
  233. Xdone
  234. Xrp='Your answer:'
  235. Xcase "\$ans" in
  236. X'') ans="\$dflt";;
  237. Xesac
  238. XEOSC
  239. X
  240. X: general instructions
  241. Xcat <<EOH
  242. XThis installation shell script will examine your system and ask you questions
  243. Xto determine how the $package package should be installed.  If you get stuck
  244. Xon a question, you may use a ! shell escape to start a subshell or execute
  245. Xa command.  Many of the questions will have default answers in square
  246. Xbrackets--typing carriage return will give you the default.
  247. X
  248. XOn some of the questions which ask for file or directory names you are
  249. Xallowed to use the ~name construct to specify the login directory belonging
  250. Xto "name", even if you don't have a shell which knows about that.  Questions
  251. Xwhere this is allowed will be marked "(~name ok)".
  252. X
  253. XEOH
  254. Xrp="[Type carriage return to continue]"
  255. Xecho $n "$rp $c"
  256. X. myread
  257. Xcat <<EOH
  258. X
  259. XMuch effort has been expended to ensure that this shell script will run
  260. Xon any Unix system.  If despite that it blows up on you, your best bet is
  261. Xto edit Configure and run it again. Also, let me (lwall@jpl-devvax.jpl.nasa.gov)
  262. Xknow how I blew it.  If you can't run Configure for some reason, you'll have
  263. Xto generate a config.sh file by hand.
  264. X
  265. XThis installation script affects things in two ways: 1) it may do direct
  266. Xvariable substitutions on some of the files included in this kit, and
  267. X2) it builds a config.h file for inclusion in C programs.  You may edit
  268. Xany of these files as the need arises after running this script.
  269. X
  270. XIf you make a mistake on a question, there is no easy way to back up to it
  271. Xcurrently.  The easiest thing to do is to edit config.sh and rerun all the
  272. XSH files.  Configure will offer to let you do this before it runs the SH files.
  273. X
  274. XEOH
  275. Xrp="[Type carriage return to continue]"
  276. Xecho $n "$rp $c"
  277. X. myread
  278. X
  279. X: get old answers, if there is a config file out there
  280. Xif test -f ../config.sh; then
  281. X    echo " "
  282. X    dflt=y
  283. X    rp="I see a config.sh file.  Did Configure make it on THIS system? [$dflt]"
  284. X    echo $n "$rp $c"
  285. X    . myread
  286. X    case "$ans" in
  287. X    n*) echo "OK, I'll ignore it.";;
  288. X    *)  echo "Fetching default answers from your old config.sh file..."
  289. X    tmp="$n"
  290. X    ans="$c"
  291. X        . ../config.sh
  292. X    n="$tmp"
  293. X    c="$ans"
  294. X    ;;
  295. X    esac
  296. Xfi
  297. X
  298. X: find out where common programs are
  299. Xecho " "
  300. Xecho "Locating common programs..."
  301. Xcat <<EOSC >loc
  302. X$startsh
  303. Xcase \$# in
  304. X0) exit 1;;
  305. Xesac
  306. Xthing=\$1
  307. Xshift
  308. Xdflt=\$1
  309. Xshift
  310. Xfor dir in \$*; do
  311. X    case "\$thing" in
  312. X    .)
  313. X    if test -d \$dir/\$thing; then
  314. X        echo \$dir
  315. X        exit 0
  316. X    fi
  317. X    ;;
  318. X    *)
  319. X    if test -f \$dir/\$thing; then
  320. X        echo \$dir/\$thing
  321. X        exit 0
  322. X    elif test -f \$dir/\$thing.exe; then
  323. X        : on Eunice apparently
  324. X        echo \$dir/\$thing
  325. X        exit 0
  326. X    fi
  327. X    ;;
  328. X    esac
  329. Xdone
  330. Xecho \$dflt
  331. Xexit 1
  332. XEOSC
  333. Xchmod +x loc
  334. X$eunicefix loc
  335. Xloclist="
  336. Xexpr
  337. Xsed
  338. Xecho
  339. Xcat
  340. Xrm
  341. Xmv
  342. Xcp
  343. Xtr
  344. Xmkdir
  345. Xsort
  346. Xuniq
  347. Xgrep
  348. X"
  349. Xtrylist="
  350. Xtest
  351. Xegrep
  352. XMcc
  353. Xcpp
  354. X"
  355. Xfor file in $loclist; do
  356. X    xxx=`loc $file $file $pth`
  357. X    eval $file=$xxx
  358. X    eval _$file=$xxx
  359. X    case "$xxx" in
  360. X    /*)
  361. X    echo $file is in $xxx.
  362. X    ;;
  363. X    *)
  364. X    echo "I don't know where $file is.  I hope it's in everyone's PATH."
  365. X    ;;
  366. X    esac
  367. Xdone
  368. Xecho " "
  369. Xecho "Don't worry if any of the following aren't found..."
  370. Xans=offhand
  371. Xfor file in $trylist; do
  372. X    xxx=`loc $file $file $pth`
  373. X    eval $file=$xxx
  374. X    eval _$file=$xxx
  375. X    case "$xxx" in
  376. X    /*)
  377. X    echo $file is in $xxx.
  378. X    ;;
  379. X    *)
  380. X    echo "I don't see $file out there, $ans."
  381. X    ans=either
  382. X    ;;
  383. X    esac
  384. Xdone
  385. Xcase "$egrep" in
  386. Xegrep)
  387. X    echo "Substituting grep for egrep."
  388. X    egrep=$grep
  389. X    ;;
  390. Xesac
  391. Xcase "$test" in
  392. Xtest)
  393. X    echo "Hopefully test is built into your sh."
  394. X    ;;
  395. X/bin/test)
  396. X    echo " "
  397. X    dflt=n
  398. X    rp="Is your "'"'"test"'"'" built into sh? [$dflt] (OK to guess)"
  399. X    echo $n "$rp $c"
  400. X    . myread
  401. X    case "$ans" in
  402. X    y*) test=test ;;
  403. X    esac
  404. X    ;;
  405. X*)
  406. X    test=test
  407. X    ;;
  408. Xesac
  409. Xcase "$echo" in
  410. Xecho)
  411. X    echo "Hopefully echo is built into your sh."
  412. X    ;;
  413. X/bin/echo)
  414. X    echo " "
  415. X    echo "Checking compatibility between /bin/echo and builtin echo (if any)..."
  416. X    $echo $n "hi there$c" >foo1
  417. X    echo $n "hi there$c" >foo2
  418. X    if cmp foo1 foo2 >/dev/null 2>&1; then
  419. X    echo "They are compatible.  In fact, they may be identical."
  420. X    else
  421. X    case "$n" in
  422. X    '-n') n='' c='\c' ans='\c' ;;
  423. X    *) n='-n' c='' ans='-n' ;;
  424. X    esac
  425. X    cat <<FOO
  426. XThey are not compatible!  You are probably running ksh on a non-USG system.
  427. XI'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't
  428. Xhave echo built in and we may have to run some Bourne shell scripts.  That
  429. Xmeans I'll have to use $ans to suppress newlines now.  Life is ridiculous.
  430. X
  431. XFOO
  432. X    rp="Your cursor should be here-->"
  433. X    $echo $n "$rp$c"
  434. X    . myread
  435. X    fi
  436. X    $rm -f foo1 foo2
  437. X    ;;
  438. X*)
  439. X    : cross your fingers
  440. X    echo=echo
  441. X    ;;
  442. Xesac
  443. Xrmlist="$rmlist loc"
  444. X
  445. X: get list of predefined functions in a handy place
  446. Xecho " "
  447. Xif test -f /lib/libc.a; then
  448. X    echo "Your C library is in /lib/libc.a.  You're normal."
  449. X    libc=/lib/libc.a
  450. Xelse
  451. X    ans=`loc libc.a blurfl/dyick $libpth`
  452. X    if test ! -f $ans; then
  453. X    ans=`loc clib blurfl/dyick $libpth`
  454. X    fi
  455. X    if test ! -f $ans; then
  456. X    ans=`loc libc blurfl/dyick $libpth`
  457. X    fi
  458. X    if test -f $ans; then
  459. X    echo "Your C library is in $ans, of all places."
  460. X    libc=$ans
  461. X    else
  462. X    if test -f "$libc"; then
  463. X        echo "Your C library is in $libc, like you said before."
  464. X    else
  465. X        cat <<EOM
  466. XI can't seem to find your C library.  I've looked in the following places:
  467. X
  468. X    $libpth
  469. X
  470. XNone of these seems to contain your C library.  What is the full name
  471. XEOM
  472. X        dflt=None
  473. X        $echo $n "of your C library? $c"
  474. X        rp='C library full name?'
  475. X        . myread
  476. X        libc="$ans"
  477. X    fi
  478. X    fi
  479. Xfi
  480. Xecho " "
  481. X$echo $n "Extracting names from $libc for later perusal...$c"
  482. Xnm $libc 2>/dev/null | sed -n -e 's/^.* T _//p' -e 's/^.* T //p' > libc.list
  483. Xif $contains '^printf$' libc.list >/dev/null 2>&1; then
  484. X    echo "done"
  485. Xelse
  486. X    nm $libc 2>/dev/null | sed -n -e 's/^.* D _//p' -e 's/^.* D //p' > libc.list
  487. X    if $contains '^printf$' libc.list >/dev/null 2>&1; then
  488. X    echo "done"
  489. X    else
  490. X    echo " "
  491. X    echo "nm didn't seem to work right."
  492. X    echo "Trying ar instead..."
  493. X    if ar t $libc | sed -e 's/\.o$//' > libc.list; then
  494. X        echo "Ok."
  495. X    else
  496. X        echo "That didn't work either.  Giving up."
  497. X        exit 1
  498. X    fi
  499. X    fi
  500. Xfi
  501. Xrmlist="$rmlist libc.list"
  502. X
  503. X: make some quick guesses about what we are up against
  504. Xecho " "
  505. X$echo $n "Hmm...  $c"
  506. Xif $contains SIGTSTP /usr/include/signal.h >/dev/null 2>&1 ; then
  507. X    echo "Looks kind of like a BSD system, but we'll see..."
  508. X    echo exit 0 >bsd
  509. X    echo exit 1 >usg
  510. X    echo exit 1 >v7
  511. Xelif $contains '^fcntl$' libc.list >/dev/null 2>&1 ; then
  512. X    echo "Looks kind of like a USG system, but we'll see..."
  513. X    echo exit 1 >bsd
  514. X    echo exit 0 >usg
  515. X    echo exit 1 >v7
  516. Xelse
  517. X    echo "Looks kind of like a version 7 system, but we'll see..."
  518. X    echo exit 1 >bsd
  519. X    echo exit 1 >usg
  520. X    echo exit 0 >v7
  521. Xfi
  522. Xif $contains '^vmssystem$' libc.list >/dev/null 2>&1 ; then
  523. X    cat <<'EOI'
  524. XThere is, however, a strange, musty smell in the air that reminds me of
  525. Xsomething...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
  526. XEOI
  527. X    echo "exit 0" >eunice
  528. X    eunicefix=unixtovms
  529. X    d_eunice="$define"
  530. X: it so happens the Eunice I know will not run shell scripts in Unix format
  531. Xelse
  532. X    echo " "
  533. X    echo "Congratulations.  You aren't running Eunice."
  534. X    eunicefix=':'
  535. X    d_eunice="$undef"
  536. X    echo "exit 1" >eunice
  537. Xfi
  538. Xif test -f /xenix; then
  539. X    echo "Actually, this looks more like a XENIX system..."
  540. X    echo "exit 0" >xenix
  541. Xelse
  542. X    echo " "
  543. X    echo "It's not Xenix..."
  544. X    echo "exit 1" >xenix
  545. Xfi
  546. Xchmod +x xenix
  547. X$eunicefix xenix
  548. Xif test -f /venix; then
  549. X    echo "Actually, this looks more like a VENIX system..."
  550. X    echo "exit 0" >venix
  551. Xelse
  552. X    echo " "
  553. X    if xenix; then
  554. X    : null
  555. X    else
  556. X    echo "Nor is it Venix..."
  557. X    fi
  558. X    echo "exit 1" >venix
  559. Xfi
  560. Xchmod +x bsd usg v7 eunice venix
  561. X$eunicefix bsd usg v7 eunice venix
  562. Xrmlist="$rmlist bsd usg v7 eunice venix xenix"
  563. X
  564. X: see if sh knows # comments
  565. Xecho " "
  566. Xecho "Checking your sh to see if it knows about # comments..."
  567. Xif sh -c '#' >/dev/null 2>&1 ; then
  568. X    echo "Your sh handles # comments correctly."
  569. X    shsharp=true
  570. X    spitshell=cat
  571. X    echo " "
  572. X    echo "Okay, let's see if #! works on this system..."
  573. X    echo "#!/bin/echo hi" > try
  574. X    $eunicefix try
  575. X    chmod +x try
  576. X    try > today
  577. X    if $contains hi today >/dev/null 2>&1; then
  578. X    echo "It does."
  579. X    sharpbang='#!'
  580. X    else
  581. X    echo "#! /bin/echo hi" > try
  582. X    $eunicefix try
  583. X    chmod +x try
  584. X    try > today
  585. X    if test -s today; then
  586. X        echo "It does."
  587. X        sharpbang='#! '
  588. X    else
  589. X        echo "It doesn't."
  590. X        sharpbang=': use '
  591. X    fi
  592. X    fi
  593. Xelse
  594. X    echo "Your sh doesn't grok # comments--I will strip them later on."
  595. X    shsharp=false
  596. X    echo "exec grep -v '^#'" >spitshell
  597. X    chmod +x spitshell
  598. X    $eunicefix spitshell
  599. X    spitshell=`pwd`/spitshell
  600. X    echo "I presume that if # doesn't work, #! won't work either!"
  601. X    sharpbang=': use '
  602. Xfi
  603. X
  604. X: figure out how to guarantee sh startup
  605. Xecho " "
  606. Xecho "Checking out how to guarantee sh startup..."
  607. Xstartsh=$sharpbang'/bin/sh'
  608. Xecho "Let's see if '$startsh' works..."
  609. Xcat >try <<EOSS
  610. X$startsh
  611. Xset abc
  612. Xtest "$?abc" != 1
  613. XEOSS
  614. X
  615. Xchmod +x try
  616. X$eunicefix try
  617. Xif try; then
  618. X    echo "Yup, it does."
  619. Xelse
  620. X    echo "Nope.  You may have to fix up the shell scripts to make sure sh runs them."
  621. Xfi
  622. Xrm -f try today
  623. X
  624. X: see how we invoke the C preprocessor
  625. Xecho " "
  626. Xecho "Now, how can we feed standard input to your C preprocessor..."
  627. Xcat <<'EOT' >testcpp.c
  628. X#define ABC abc
  629. X#define XYZ xyz
  630. XABC.XYZ
  631. XEOT
  632. Xecho 'Maybe "'$cpp'" will work...'
  633. X$cpp <testcpp.c >testcpp.out 2>&1
  634. Xif $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then
  635. X    echo "Yup, it does."
  636. X    cppstdin="$cpp"
  637. X    cppminus='';
  638. Xelse
  639. X    echo 'Nope, maybe "'$cpp' -" will work...'
  640. X    $cpp - <testcpp.c >testcpp.out 2>&1
  641. X    if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then
  642. X    echo "Yup, it does."
  643. X    cppstdin="$cpp"
  644. X    cppminus='-';
  645. X    else
  646. X    echo 'No such luck...maybe "cc -E" will work...'
  647. X    cc -E <testcpp.c >testcpp.out 2>&1
  648. X    if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then
  649. X        echo "It works!"
  650. X        cppstdin='cc -E'
  651. X        cppminus='';
  652. X    else
  653. X        echo 'Nixed again...maybe "cc -E -" will work...'
  654. X        cc -E - <testcpp.c >testcpp.out 2>&1
  655. X        if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then
  656. X        echo "Hooray, it works!  I was beginning to wonder."
  657. X        cppstdin='cc -E'
  658. X        cppminus='-';
  659. X        else
  660. X        echo 'Nope...maybe "cc -P" will work...'
  661. X        cc -P <testcpp.c >testcpp.out 2>&1
  662. X        if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then
  663. X            echo "Yup, that does."
  664. X            cppstdin='cc -P'
  665. X            cppminus='';
  666. X        else
  667. X            echo 'Nope...maybe "cc -P -" will work...'
  668. X            cc -P - <testcpp.c >testcpp.out 2>&1
  669. X            if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then
  670. X            echo "Yup, that does."
  671. X            cppstdin='cc -P'
  672. X            cppminus='-';
  673. X            else
  674. X            echo 'Hmm...perhaps you already told me...'
  675. X            case "$cppstdin" in
  676. X            '') ;;
  677. X            *) $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1;;
  678. X            esac
  679. X            if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then
  680. X                echo "Hooray, you did!  I was beginning to wonder."
  681. X            else
  682. X                echo 'Uh-uh.  Time to get fancy...'
  683. X                echo 'Trying (cat >/tmp/$$.c; cc -E /tmp/$$.c; rm /tmp/$$.c)'
  684. X                cppstdin='(cat >/tmp/$$.c; cc -E /tmp/$$.c; rm /tmp/$$.c)'
  685. X                cppminus='';
  686. X                $cppstdin <testcpp.c >testcpp.out 2>&1
  687. X                if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then
  688. X                echo "Eureka!."
  689. X                else
  690. X                dflt=blurfl
  691. X                $echo $n "No dice.  I can't find a C preprocessor.  Name one: $c"
  692. X                rp='Name a C preprocessor:'
  693. X                . myread
  694. X                cppstdin="$ans"
  695. X                $cppstdin <testcpp.c >testcpp.out 2>&1
  696. X                if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then
  697. X                    echo "OK, that will do."
  698. X                else
  699. X                    echo "Sorry, I can't get that to work.  Go find one."
  700. X                    exit 1
  701. X                fi
  702. X                fi
  703. X            fi
  704. X            fi
  705. X        fi
  706. X        fi
  707. X    fi
  708. X    fi
  709. Xfi
  710. Xrm -f testcpp.c testcpp.out
  711. X
  712. X: see if bcopy exists
  713. Xecho " "
  714. Xif $contains '^bcopy$' libc.list >/dev/null 2>&1; then
  715. X    echo 'bcopy() found.'
  716. X    d_bcopy="$define"
  717. Xelse
  718. X    echo 'bcopy() not found.'
  719. X    d_bcopy="$undef"
  720. Xfi
  721. X
  722. X: see if sprintf is declared as int or pointer to char
  723. Xecho " "
  724. Xcat >.ucbsprf.c <<'EOF'
  725. Xmain() { char buf[10]; exit((unsigned long)sprintf(buf,"%s","foo") > 10L); }
  726. XEOF
  727. Xif cc .ucbsprf.c -o .ucbsprf >/dev/null 2>&1 && .ucbsprf; then
  728. X    echo "Your sprintf() returns (int)."
  729. X    d_charsprf="$undef"
  730. Xelse
  731. X    echo "Your sprintf() returns (char*)."
  732. X    d_charsprf="$define"
  733. Xfi
  734. X/bin/rm -f .ucbsprf.c .ucbsprf
  735. X
  736. X: see if crypt exists
  737. Xecho " "
  738. Xif $contains '^crypt$' libc.list >/dev/null 2>&1; then
  739. X    echo 'crypt() found.'
  740. X    d_crypt="$define"
  741. Xelse
  742. X    echo 'crypt() not found.'
  743. X    d_crypt="$undef"
  744. Xfi
  745. X
  746. X: see if fchmod exists
  747. Xecho " "
  748. Xif $contains '^fchmod$' libc.list >/dev/null 2>&1; then
  749. X    echo 'fchmod() found.'
  750. X    d_fchmod="$define"
  751. Xelse
  752. X    echo 'fchmod() not found.'
  753. X    d_fchmod="$undef"
  754. Xfi
  755. X
  756. X: see if fchown exists
  757. Xecho " "
  758. Xif $contains '^fchown$' libc.list >/dev/null 2>&1; then
  759. X    echo 'fchown() found.'
  760. X    d_fchown="$define"
  761. Xelse
  762. X    echo 'fchown() not found.'
  763. X    d_fchown="$undef"
  764. Xfi
  765. X
  766. X: see if getgroups exists
  767. Xecho " "
  768. Xif $contains '^getgroups$' libc.list >/dev/null 2>&1; then
  769. X    echo 'getgroups() found.'
  770. X    d_getgrps="$define"
  771. Xelse
  772. X    echo 'getgroups() not found.'
  773. X    d_getgrps="$undef"
  774. Xfi
  775. X
  776. X: index or strcpy
  777. Xecho " "
  778. Xcase "$d_index" in
  779. Xn) dflt=n;;
  780. X*) dflt=y;;
  781. Xesac
  782. Xif $contains '^index$' libc.list >/dev/null 2>&1 ; then
  783. X    if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
  784. X    echo "Your system has both index() and strchr().  Shall I use"
  785. X    rp="index() rather than strchr()? [$dflt]"
  786. X    $echo $n "$rp $c"
  787. X    . myread
  788. X    case "$ans" in
  789. X        n*) d_index="$define" ;;
  790. X        *)  d_index="$undef" ;;
  791. X    esac
  792. X    else
  793. X    d_index="$undef"
  794. X    echo "index() found."
  795. X    fi
  796. Xelse
  797. X    if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
  798. X    d_index="$define"
  799. X    echo "strchr() found."
  800. X    else
  801. X    echo "No index() or strchr() found!"
  802. X    d_index="$undef"
  803. X    fi
  804. Xfi
  805. X
  806. X: see if killpg exists
  807. Xecho " "
  808. Xif $contains '^killpg$' libc.list >/dev/null 2>&1; then
  809. X    echo 'killpg() found.'
  810. X    d_killpg="$define"
  811. Xelse
  812. X    echo 'killpg() not found.'
  813. X    d_killpg="$undef"
  814. Xfi
  815. X
  816. X: see if memcpy exists
  817. Xecho " "
  818. Xif $contains '^memcpy$' libc.list >/dev/null 2>&1; then
  819. X    echo 'memcpy() found.'
  820. X    d_memcpy="$define"
  821. Xelse
  822. X    echo 'memcpy() not found.'
  823. X    d_memcpy="$undef"
  824. Xfi
  825. X
  826. X: see if rename exists
  827. Xecho " "
  828. Xif $contains '^rename$' libc.list >/dev/null 2>&1; then
  829. X    echo 'rename() found.'
  830. X    d_rename="$define"
  831. Xelse
  832. X    echo 'rename() not found.'
  833. X    d_rename="$undef"
  834. Xfi
  835. X
  836. X: see if setegid exists
  837. Xecho " "
  838. Xif $contains '^setegid$' libc.list >/dev/null 2>&1; then
  839. X    echo 'setegid() found.'
  840. X    d_setegid="$define"
  841. Xelse
  842. X    echo 'setegid() not found.'
  843. X    d_setegid="$undef"
  844. Xfi
  845. X
  846. X: see if seteuid exists
  847. Xecho " "
  848. Xif $contains '^seteuid$' libc.list >/dev/null 2>&1; then
  849. X    echo 'seteuid() found.'
  850. X    d_seteuid="$define"
  851. Xelse
  852. X    echo 'seteuid() not found.'
  853. X    d_seteuid="$undef"
  854. Xfi
  855. X
  856. X: see if setrgid exists
  857. Xecho " "
  858. Xif $contains '^setrgid$' libc.list >/dev/null 2>&1; then
  859. X    echo 'setrgid() found.'
  860. X    d_setrgid="$define"
  861. Xelse
  862. X    echo 'setrgid() not found.'
  863. X    d_setrgid="$undef"
  864. Xfi
  865. X
  866. X: see if setruid exists
  867. Xecho " "
  868. Xif $contains '^setruid$' libc.list >/dev/null 2>&1; then
  869. X    echo 'setruid() found.'
  870. X    d_setruid="$define"
  871. Xelse
  872. X    echo 'setruid() not found.'
  873. X    d_setruid="$undef"
  874. Xfi
  875. X
  876. X: see if stat knows about block sizes
  877. Xecho " "
  878. Xif $contains 'st_blocks;' /usr/include/sys/stat.h >/dev/null 2>&1 ; then
  879. X    if $contains 'st_blksize;' /usr/include/sys/stat.h >/dev/null 2>&1 ; then
  880. X    echo "Your stat knows about block sizes."
  881. X    d_statblks="$define"
  882. X    else
  883. X    echo "Your stat doesn't know about block sizes."
  884. X    d_statblks="$undef"
  885. X    fi
  886. Xelse
  887. X    echo "Your stat doesn't know about block sizes."
  888. X    d_statblks="$undef"
  889. Xfi
  890. X
  891. X: see if stdio is really std
  892. Xecho " "
  893. Xif $contains 'char.*_ptr;' /usr/include/stdio.h >/dev/null 2>&1 ; then
  894. X    if $contains '_cnt;' /usr/include/stdio.h >/dev/null 2>&1 ; then
  895. X    echo "Your stdio is pretty std."
  896. X    d_stdstdio="$define"
  897. X    else
  898. X    echo "Your stdio isn't very std."
  899. X    d_stdstdio="$undef"
  900. X    fi
  901. Xelse
  902. X    echo "Your stdio isn't very std."
  903. X    d_stdstdio="$undef"
  904. Xfi
  905. X
  906. X: see if strcspn exists
  907. Xecho " "
  908. Xif $contains '^strcspn$' libc.list >/dev/null 2>&1; then
  909. X    echo 'strcspn() found.'
  910. X    d_strcspn="$define"
  911. Xelse
  912. X    echo 'strcspn() not found.'
  913. X    d_strcspn="$undef"
  914. Xfi
  915. X
  916. X: check for structure copying
  917. Xecho " "
  918. Xecho "Checking to see if your C compiler can copy structs..."
  919. X$cat >try.c <<'EOCP'
  920. Xmain()
  921. X{
  922. X    struct blurfl {
  923. X        int dyick;
  924. X    } foo, bar;
  925. X
  926. X    foo = bar;
  927. X}
  928. XEOCP
  929. Xif cc -c try.c >/dev/null 2>&1 ; then
  930. X    d_strctcpy="$define"
  931. X    echo "Yup, it can."
  932. Xelse
  933. X    d_strctcpy="$undef"
  934. X    echo "Nope, it can't."
  935. Xfi
  936. X$rm -f try.*
  937. X
  938. X: see if symlink exists
  939. Xecho " "
  940. Xif $contains '^symlink$' libc.list >/dev/null 2>&1; then
  941. X    echo 'symlink() found.'
  942. X    d_symlink="$define"
  943. Xelse
  944. X    echo 'symlink() not found.'
  945. X    d_symlink="$undef"
  946. Xfi
  947. X
  948. X: see if struct tm is defined in sys/time.h
  949. Xecho " "
  950. Xif $contains 'struct tm' /usr/include/time.h >/dev/null 2>&1 ; then
  951. X    echo "You have struct tm defined in <time.h> rather than <sys/time.h>."
  952. X    d_tminsys="$undef"
  953. Xelse
  954. X    echo "You have struct tm defined in <sys/time.h> rather than <time.h>."
  955. X    d_tminsys="$define"
  956. Xfi
  957. X
  958. X: see if there is a vfork
  959. Xecho " "
  960. Xif $contains '^vfork$' libc.list >/dev/null 2>&1 ; then
  961. X    echo "vfork() found."
  962. X    d_vfork="$undef"
  963. Xelse
  964. X    echo "No vfork() found--will use fork() instead."
  965. X    d_vfork="$define"
  966. Xfi
  967. X
  968. X: see if signal is declared as pointer to function returning int or void
  969. Xecho " "
  970. Xif $contains 'void.*signal' /usr/include/signal.h >/dev/null 2>&1 ; then
  971. X    echo "You have void (*signal())() instead of int."
  972. X    d_voidsig="$define"
  973. Xelse
  974. X    echo "You have int (*signal())() instead of void."
  975. X    d_voidsig="$undef"
  976. Xfi
  977. X
  978. X: check for void type
  979. Xecho " "
  980. X$cat <<EOM
  981. XChecking to see how well your C compiler groks the void type...
  982. X
  983. X  Support flag bits are:
  984. X    1: basic void declarations.
  985. X    2: arrays of pointers to functions returning void.
  986. X    4: operations between pointers to and addresses of void functions.
  987. X
  988. XEOM
  989. Xcase "$voidflags" in
  990. X'')
  991. X    $cat >try.c <<'EOCP'
  992. X#if TRY & 1
  993. Xvoid main() {
  994. X#else
  995. Xmain() {
  996. X#endif
  997. X    extern void *moo();
  998. X    void *(*goo)();
  999. X#if TRY & 2
  1000. X    void (*foo[10])();
  1001. X#endif
  1002. X
  1003. X#if TRY & 4
  1004. X    if(*goo == moo) {
  1005. X        exit(0);
  1006. X    }
  1007. X#endif
  1008. X    exit(0);
  1009. X}
  1010. XEOCP
  1011. X    if cc -S -DTRY=7 try.c >.out 2>&1 ; then
  1012. X    voidflags=7
  1013. X    echo "It appears to support void fully."
  1014. X    if $contains warning .out >/dev/null 2>&1; then
  1015. X        echo "However, you might get some warnings that look like this:"
  1016. X        $cat .out
  1017. X    fi
  1018. X    else
  1019. X    echo "Hmm, you compiler has some difficulty with void.  Checking further..."
  1020. X    if cc -S -DTRY=1 try.c >/dev/null 2>&1 ; then
  1021. X        echo "It supports 1..."
  1022. X        if cc -S -DTRY=3 try.c >/dev/null 2>&1 ; then
  1023. X        voidflags=3
  1024. X        echo "And it supports 2 but not 4."
  1025. X        else
  1026. X        echo "It doesn't support 2..."
  1027. X        if cc -S -DTRY=3 try.c >/dev/null 2>&1 ; then
  1028. X            voidflags=5
  1029. X            echo "But it supports 4."
  1030. X        else
  1031. X            voidflags=1
  1032. X            echo "And it doesn't support 4."
  1033. X        fi
  1034. X        fi
  1035. X    else
  1036. X        echo "There is no support at all for void."
  1037. X        voidflags=0
  1038. X    fi
  1039. X    fi
  1040. Xesac
  1041. Xdflt="$voidflags";
  1042. Xrp="Your void support flags add up to what? [$dflt]"
  1043. X$echo $n "$rp $c"
  1044. X. myread
  1045. Xvoidflags="$ans"
  1046. X$rm -f try.* .out
  1047. X
  1048. X: see what type gids are declared as in the kernel
  1049. Xcase "$gidtype" in
  1050. X'')
  1051. X    if $contains 'gid_t;' /usr/include/sys/types.h >/dev/null 2>&1 ; then
  1052. X    dflt='gid_t';
  1053. X    else
  1054. X    set `grep 'groups\[NGROUPS\];' /usr/include/sys/user.h 2>/dev/null` unsigned short
  1055. X    case $1 in
  1056. X    unsigned) dflt="$1 $2" ;;
  1057. X    *) dflt="$1" ;;
  1058. X    esac
  1059. X    fi
  1060. X    ;;
  1061. X*)  dflt="$gidtype"
  1062. X    ;;
  1063. Xesac
  1064. Xcont=true
  1065. Xecho " "
  1066. Xrp="What type are group ids on this system declared as? [$dflt]"
  1067. X$echo $n "$rp $c"
  1068. X. myread
  1069. Xgidtype="$ans"
  1070. X
  1071. X: set up shell script to do ~ expansion
  1072. Xcat >filexp <<EOSS
  1073. X$startsh
  1074. X: expand filename
  1075. Xcase "\$1" in
  1076. X ~/*|~)
  1077. X    echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
  1078. X    ;;
  1079. X ~*)
  1080. X    if $test -f /bin/csh; then
  1081. X    /bin/csh -f -c "glob \$1"
  1082. X    echo ""
  1083. X    else
  1084. X    name=\`$expr x\$1 : '..\([^/]*\)'\`
  1085. X    dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
  1086. X    if $test ! -d "\$dir"; then
  1087. X        me=\`basename \$0\`
  1088. X        echo "\$me: can't locate home directory for: \$name" >&2
  1089. X        exit 1
  1090. X    fi
  1091. X    case "\$1" in
  1092. X    */*)
  1093. X        echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
  1094. X        ;;
  1095. X    *)
  1096. X        echo \$dir
  1097. X        ;;
  1098. X    esac
  1099. X    fi
  1100. X    ;;
  1101. X*)
  1102. X    echo \$1
  1103. X    ;;
  1104. Xesac
  1105. XEOSS
  1106. Xchmod +x filexp
  1107. X$eunicefix filexp
  1108. X
  1109. X: determine where private executables go
  1110. Xcase "$privlib" in
  1111. X'')
  1112. X    dflt=/usr/lib/perl
  1113. X    test -d /usr/local/lib && dflt=/usr/local/lib/perl
  1114. X    ;;
  1115. X*)  dflt="$privlib"
  1116. X    ;;
  1117. Xesac
  1118. X$cat <<EOM
  1119. X
  1120. XThe perl package has some perl subroutine libraries that should be put in
  1121. Xa directory that is accessible by everyone.  Where do you want to put these
  1122. XEOM
  1123. X$echo $n "libraries? [$dflt] $c"
  1124. Xrp="Put perl libraries where? [$dflt]"
  1125. X. myread
  1126. Xprivlib=`filexp $ans`
  1127. X
  1128. X: see what type of char stdio uses.
  1129. Xecho " "
  1130. Xif $contains 'unsigned.*char.*_ptr;' /usr/include/stdio.h >/dev/null 2>&1 ; then
  1131. X    echo "Your stdio uses unsigned chars."
  1132. X    stdchar="unsigned char"
  1133. Xelse
  1134. X    echo "Your stdio uses signed chars."
  1135. X    stdchar="char"
  1136. Xfi
  1137. X
  1138. X: see what type uids are declared as in the kernel
  1139. Xcase "$uidtype" in
  1140. X'')
  1141. X    if $contains 'uid_t;' /usr/include/sys/types.h >/dev/null 2>&1 ; then
  1142. X    dflt='uid_t';
  1143. X    else
  1144. X    set `grep '_ruid;' /usr/include/sys/user.h 2>/dev/null` unsigned short
  1145. X    case $1 in
  1146. X    unsigned) dflt="$1 $2" ;;
  1147. X    *) dflt="$1" ;;
  1148. X    esac
  1149. X    fi
  1150. X    ;;
  1151. X*)  dflt="$uidtype"
  1152. X    ;;
  1153. Xesac
  1154. Xcont=true
  1155. Xecho " "
  1156. Xrp="What type are user ids on this system declared as? [$dflt]"
  1157. X$echo $n "$rp $c"
  1158. X. myread
  1159. Xuidtype="$ans"
  1160. X
  1161. X: preserve RCS keywords in files with variable substitution, grrr
  1162. XLog='$Log'
  1163. XHeader='$Header'
  1164. X
  1165. X: determine where public executables go
  1166. Xcase "$bin" in
  1167. X'')
  1168. X    dflt=`loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin`
  1169. X    ;;
  1170. X*)  dflt="$bin"
  1171. X    ;;
  1172. Xesac
  1173. Xcont=true
  1174. Xwhile $test "$cont" ; do
  1175. X    echo " "
  1176. X    rp="Where do you want to put the public executables? [$dflt]"
  1177. X    $echo $n "$rp $c"
  1178. X    . myread
  1179. X    bin="$ans"
  1180. X    bin=`filexp $bin`
  1181. X    if test -d $bin; then
  1182. X    cont=''
  1183. X    else
  1184. X    dflt=n
  1185. X    rp="Directory $bin doesn't exist.  Use that name anyway? [$dflt]"
  1186. X    $echo $n "$rp $c"
  1187. X    . myread
  1188. X    dflt=''
  1189. X    case "$ans" in
  1190. X    y*) cont='';;
  1191. X    esac
  1192. X    fi
  1193. Xdone
  1194. X
  1195. X: determine where manual pages go
  1196. Xcase "$mansrc" in
  1197. X'')
  1198. X    dflt=`loc . /usr/man/man1 /usr/man/mann /usr/man/local/man1 /usr/man/u_man/man1 /usr/man/man1`
  1199. X    ;;
  1200. X*)  dflt="$mansrc"
  1201. X    ;;
  1202. Xesac
  1203. Xcont=true
  1204. Xwhile $test "$cont" ; do
  1205. X    echo " "
  1206. X    rp="Where do the manual pages (source) go? [$dflt]"
  1207. X    $echo $n "$rp $c"
  1208. X    . myread
  1209. X    mansrc=`filexp "$ans"`
  1210. X    if test -d $mansrc; then
  1211. X    cont=''
  1212. X    else
  1213. X    dflt=n
  1214. X    rp="Directory $mansrc doesn't exist.  Use that name anyway? [$dflt]"
  1215. X    $echo $n "$rp $c"
  1216. X    . myread
  1217. X    dflt=''
  1218. X    case "$ans" in
  1219. X    y*) cont='';;
  1220. X    esac
  1221. X    fi
  1222. Xdone
  1223. Xcase "$mansrc" in
  1224. X*l)
  1225. X    manext=l
  1226. X    ;;
  1227. X*n)
  1228. X    manext=n
  1229. X    ;;
  1230. X*C)
  1231. X    manext=C
  1232. X    ;;
  1233. X*)
  1234. X    manext=1
  1235. X    ;;
  1236. Xesac
  1237. X
  1238. X: get C preprocessor symbols handy
  1239. Xecho " "
  1240. Xecho $attrlist | $tr '[ - ]' '[\012-\012]' >Cppsym.know
  1241. X$cat <<EOSS >Cppsym
  1242. X$startsh
  1243. Xcase "\$1" in
  1244. X-l) list=true
  1245. X    shift
  1246. X    ;;
  1247. Xesac
  1248. Xunknown=''
  1249. Xcase "\$list\$#" in
  1250. X1|2)
  1251. X    for sym do
  1252. X    if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
  1253. X        exit 0
  1254. X    elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
  1255. X        :
  1256. X    else
  1257. X        unknown="\$unknown \$sym"
  1258. X    fi
  1259. X    done
  1260. X    set X \$unknown
  1261. X    shift
  1262. X    ;;
  1263. Xesac
  1264. Xcase \$# in
  1265. X0) exit 1;;
  1266. Xesac
  1267. Xecho \$* | $tr '[ - ]' '[\012-\012]' | $sed -e 's/\(.*\)/\\
  1268. X#ifdef \1\\
  1269. Xexit 0; _ _ _ _\1\\     \1\\
  1270. X#endif\\
  1271. X/' >/tmp/Cppsym\$\$
  1272. Xecho exit 1 >>/tmp/Cppsym\$\$
  1273. X$cppstdin $cppminus </tmp/Cppsym\$\$ >/tmp/Cppsym2\$\$
  1274. Xcase "\$list" in
  1275. Xtrue) awk 'NF > 5 {print substr(\$6,2,100)}' </tmp/Cppsym2\$\$ ;;
  1276. X*)
  1277. X    sh /tmp/Cppsym2\$\$
  1278. X    status=\$?
  1279. X    ;;
  1280. Xesac
  1281. X$rm -f /tmp/Cppsym\$\$ /tmp/Cppsym2\$\$
  1282. Xexit \$status
  1283. XEOSS
  1284. Xchmod +x Cppsym
  1285. X$eunicefix Cppsym
  1286. Xecho "Your C preprocessor defines the following symbols:"
  1287. XCppsym -l $attrlist >Cppsym.true
  1288. Xcat Cppsym.true
  1289. Xrmlist="$rmlist Cppsym Cppsym.know Cppsym.true"
  1290. X
  1291. X: see what memory models we can support
  1292. Xcase "$models" in
  1293. X'')
  1294. X    if Cppsym pdp11; then
  1295. X    dflt='unsplit split'
  1296. X    else
  1297. X    ans=`loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
  1298. X    case "$ans" in
  1299. X    X) dflt='none';;
  1300. X    *)  if $test -d /lib/small || $test -d /usr/lib/small; then
  1301. X        dflt='small'
  1302. X        else
  1303. X        dflt=''
  1304. X        fi
  1305. X        if $test -d /lib/medium || $test -d /usr/lib/medium; then
  1306. X        dflt="$dflt medium"
  1307. X        fi
  1308. X        if $test -d /lib/large || $test -d /usr/lib/large; then
  1309. X        dflt="$dflt large"
  1310. X        fi
  1311. X        if $test -d /lib/huge || $test -d /usr/lib/huge; then
  1312. X        dflt="$dflt huge"
  1313. X        fi
  1314. X    esac
  1315. X    fi
  1316. X    ;;
  1317. X*)  dflt="$models" ;;
  1318. Xesac
  1319. X$cat <<EOM
  1320. XSome systems have different model sizes.  On most systems they are called
  1321. Xsmall, medium, large, and huge.  On the PDP11 they are called unsplit and
  1322. Xsplit.  If your system doesn't support different memory models, say "none".
  1323. XIf you wish to force everything to one memory model, say "none" here and
  1324. Xput the appropriate flags later when it asks you for other cc and ld flags.
  1325. XVenix systems may wish to put "none" and let the compiler figure things out.
  1326. X(In the following question multiple model names should be space separated.)
  1327. X
  1328. XEOM
  1329. Xrp="Which models are supported? [$dflt]"
  1330. X$echo $n "$rp $c"
  1331. X. myread
  1332. Xmodels="$ans"
  1333. X
  1334. Xcase "$models" in
  1335. Xnone)
  1336. X    small=''
  1337. X    medium=''
  1338. X    large=''
  1339. X    huge=''
  1340. X    unsplit=''
  1341. X    split=''
  1342. X    ;;
  1343. X*split)
  1344. X    case "$split" in
  1345. X    '') 
  1346. X    if $contains '-i' $mansrc/ld.1 >/dev/null 2>&1 || \
  1347. X       $contains '-i' $mansrc/cc.1 >/dev/null 2>&1; then
  1348. X        dflt='-i'
  1349. X    else
  1350. X        dflt='none'
  1351. X    fi
  1352. X    ;;
  1353. X    *) dflt="$split";;
  1354. X    esac
  1355. X    rp="What flag indicates separate I and D space? [$dflt]"
  1356. X    $echo $n "$rp $c"
  1357. X    . myread
  1358. X    case "$ans" in
  1359. X    none) ans='';;
  1360. X    esac
  1361. X    split="$ans"
  1362. X    unsplit=''
  1363. X    ;;
  1364. X*large*|*small*|*medium*|*huge*)
  1365. X    case "$model" in
  1366. X    *large*)
  1367. X    case "$large" in
  1368. X    '') dflt='-Ml';;
  1369. X    *) dflt="$large";;
  1370. X    esac
  1371. X    rp="What flag indicates large model? [$dflt]"
  1372. X    $echo $n "$rp $c"
  1373. X    . myread
  1374. X    case "$ans" in
  1375. X    none) ans='';
  1376. X    esac
  1377. X    large="$ans"
  1378. X    ;;
  1379. X    *) large='';;
  1380. X    esac
  1381. X    case "$model" in
  1382. X    *huge*)
  1383. X    case "$huge" in
  1384. X    '') dflt='-Mh';;
  1385. X    *) dflt="$huge";;
  1386. X    esac
  1387. X    rp="What flag indicates huge model? [$dflt]"
  1388. X    $echo $n "$rp $c"
  1389. X    . myread
  1390. X    case "$ans" in
  1391. X    none) ans='';
  1392. X    esac
  1393. X    huge="$ans"
  1394. X    ;;
  1395. X    *) huge="$large";;
  1396. X    esac
  1397. X    case "$model" in
  1398. X    *medium*)
  1399. X    case "$medium" in
  1400. X    '') dflt='-Mm';;
  1401. X    *) dflt="$medium";;
  1402. X    esac
  1403. X    rp="What flag indicates medium model? [$dflt]"
  1404. X    $echo $n "$rp $c"
  1405. X    . myread
  1406. X    case "$ans" in
  1407. X    none) ans='';
  1408. X    esac
  1409. X    medium="$ans"
  1410. X    ;;
  1411. X    *) medium="$large";;
  1412. X    esac
  1413. X    case "$model" in
  1414. X    *small*)
  1415. X    case "$small" in
  1416. X    '') dflt='none';;
  1417. X    *) dflt="$small";;
  1418. X    esac
  1419. X    rp="What flag indicates small model? [$dflt]"
  1420. X    $echo $n "$rp $c"
  1421. X    . myread
  1422. X    case "$ans" in
  1423. X    none) ans='';
  1424. X    esac
  1425. X    small="$ans"
  1426. X    ;;
  1427. X    *) small='';;
  1428. X    esac
  1429. X    ;;
  1430. X*)
  1431. X    echo "Unrecognized memory models--you may have to edit Makefile.SH"
  1432. X    ;;
  1433. Xesac
  1434. X
  1435. Xcase "$ccflags" in
  1436. X'') dflt='none';;
  1437. X*) dflt="$ccflags";;
  1438. Xesac
  1439. Xecho " "
  1440. Xrp="Any additional cc flags? [$dflt]"
  1441. X$echo $n "$rp $c"
  1442. X. myread
  1443. Xcase "$ans" in
  1444. Xnone) ans='';
  1445. Xesac
  1446. Xccflags="$ans"
  1447. X
  1448. Xcase "$ldflags" in
  1449. X'') if venix; then
  1450. X    dflt='-i -z'
  1451. X    else
  1452. X    dflt='none'
  1453. X    fi
  1454. X    ;;
  1455. X*) dflt="$ldflags";;
  1456. Xesac
  1457. Xecho " "
  1458. Xrp="Any additional ld flags? [$dflt]"
  1459. X$echo $n "$rp $c"
  1460. X. myread
  1461. Xcase "$ans" in
  1462. Xnone) ans='';
  1463. Xesac
  1464. Xldflags="$ans"
  1465. X
  1466. X: see if we need a special compiler
  1467. Xecho " "
  1468. Xif usg; then
  1469. X    case "$cc" in
  1470. X    '')
  1471. X    case "$Mcc" in
  1472. X    /*) dflt='Mcc'
  1473. X        ;;
  1474. X    *)
  1475. X        case "$large" in
  1476. X        -M*)
  1477. X        dflt='cc'
  1478. X        ;;
  1479. X        *)
  1480. X        if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then
  1481. X            dflt='cc -M'
  1482. X        else
  1483. X            dflt='cc'
  1484. X        fi
  1485. X        ;;
  1486. X        esac
  1487. X        ;;
  1488. X    esac
  1489. X    ;;
  1490. X    *)  dflt="$cc";;
  1491. X    esac
  1492. X    $cat <<'EOM'
  1493. XOn some systems the default C compiler will not resolve multiple global
  1494. Xreferences that happen to have the same name.  On some such systems the
  1495. X"Mcc" command may be used to force these to be resolved.  On other systems
  1496. Xa "cc -M" command is required.  (Note that the -M flag on other systems
  1497. Xindicates a memory model to use!)  What command will force resolution on
  1498. XEOM
  1499. X    $echo $n "this system? [$dflt] $c"
  1500. X    rp="Command to resolve multiple refs? [$dflt]"
  1501. X    . myread
  1502. X    cc="$ans"
  1503. Xelse
  1504. X    echo "Not a USG system--assuming cc can resolve multiple definitions."
  1505. X    cc=cc
  1506. Xfi
  1507. X
  1508. X: see if we should include -lnm
  1509. Xecho " "
  1510. Xif $test -r /usr/lib/libnm.a || $test -r /usr/local/lib/libnm.a ; then
  1511. X    echo "New math library found."
  1512. X    libnm='-lnm'
  1513. Xelse
  1514. X    ans=`loc libnm.a x $libpth`
  1515. X    case "$ans" in
  1516. X    x)
  1517. X    echo "No nm library found--the normal math library will have to do."
  1518. X    libnm=''
  1519. X    ;;
  1520. X    *)
  1521. X    echo "New math library found in $ans."
  1522. X    libnm="$ans"
  1523. X    ;;
  1524. X    esac
  1525. Xfi
  1526. X
  1527. X: determine which malloc to compile in
  1528. Xecho " "
  1529. Xcase "$usemymalloc" in
  1530. X'')
  1531. X    if bsd || v7; then
  1532. X    dflt='y'
  1533. X    else
  1534. X    dflt='n'
  1535. X    fi
  1536. X    ;;
  1537. X*)  dflt="$usemymalloc"
  1538. X    ;;
  1539. Xesac
  1540. Xrp="Do you wish to attempt to use the malloc that comes with $package? [$dflt]"
  1541. X$echo $n "$rp $c"
  1542. X. myread
  1543. Xcase "$ans" in
  1544. X'') ans=$dflt;;
  1545. Xesac
  1546. Xusemymalloc="$ans"
  1547. Xcase "$ans" in
  1548. Xy*) mallocsrc='malloc.c'; mallocobj='malloc.o';;
  1549. X*) mallocsrc=''; mallocobj='';;
  1550. Xesac
  1551. X
  1552. Xecho " "
  1553. Xecho "End of configuration questions."
  1554. Xecho " "
  1555. X
  1556. X: create config.sh file
  1557. Xecho " "
  1558. Xif test -d ../UU; then
  1559. X    cd ..
  1560. Xfi
  1561. Xecho "Creating config.sh..."
  1562. X$spitshell <<EOT >config.sh
  1563. X$startsh
  1564. X# config.sh
  1565. X# This file was produced by running the Configure script.
  1566. X
  1567. Xd_eunice='$d_eunice'
  1568. Xeunicefix='$eunicefix'
  1569. Xdefine='$define'
  1570. Xloclist='$loclist'
  1571. Xexpr='$expr'
  1572. Xsed='$sed'
  1573. Xecho='$echo'
  1574. Xcat='$cat'
  1575. Xrm='$rm'
  1576. Xmv='$mv'
  1577. Xcp='$cp'
  1578. Xtail='$tail'
  1579. Xtr='$tr'
  1580. Xmkdir='$mkdir'
  1581. Xsort='$sort'
  1582. Xuniq='$uniq'
  1583. Xgrep='$grep'
  1584. Xtrylist='$trylist'
  1585. Xtest='$test'
  1586. Xinews='$inews'
  1587. Xegrep='$egrep'
  1588. Xmore='$more'
  1589. Xpg='$pg'
  1590. XMcc='$Mcc'
  1591. Xvi='$vi'
  1592. Xmailx='$mailx'
  1593. Xmail='$mail'
  1594. Xcpp='$cpp'
  1595. XLog='$Log'
  1596. XHeader='$Header'
  1597. Xbin='$bin'
  1598. Xcc='$cc'
  1599. Xcontains='$contains'
  1600. Xcppstdin='$cppstdin'
  1601. Xcppminus='$cppminus'
  1602. Xd_bcopy='$d_bcopy'
  1603. Xd_charsprf='$d_charsprf'
  1604. Xd_crypt='$d_crypt'
  1605. Xd_fchmod='$d_fchmod'
  1606. Xd_fchown='$d_fchown'
  1607. Xd_getgrps='$d_getgrps'
  1608. Xd_index='$d_index'
  1609. Xd_killpg='$d_killpg'
  1610. Xd_memcpy='$d_memcpy'
  1611. Xd_rename='$d_rename'
  1612. Xd_setegid='$d_setegid'
  1613. Xd_seteuid='$d_seteuid'
  1614. Xd_setrgid='$d_setrgid'
  1615. Xd_setruid='$d_setruid'
  1616. Xd_statblks='$d_statblks'
  1617. Xd_stdstdio='$d_stdstdio'
  1618. Xd_strcspn='$d_strcspn'
  1619. Xd_strctcpy='$d_strctcpy'
  1620. Xd_symlink='$d_symlink'
  1621. Xd_tminsys='$d_tminsys'
  1622. Xd_vfork='$d_vfork'
  1623. Xd_voidsig='$d_voidsig'
  1624. Xgidtype='$gidtype'
  1625. Xlibc='$libc'
  1626. Xlibnm='$libnm'
  1627. Xmallocsrc='$mallocsrc'
  1628. Xmallocobj='$mallocobj'
  1629. Xusemymalloc='$usemymalloc'
  1630. Xmansrc='$mansrc'
  1631. Xmanext='$manext'
  1632. Xmodels='$models'
  1633. Xsplit='$split'
  1634. Xsmall='$small'
  1635. Xmedium='$medium'
  1636. Xlarge='$large'
  1637. Xhuge='$huge'
  1638. Xccflags='$ccflags'
  1639. Xldflags='$ldflags'
  1640. Xn='$n'
  1641. Xc='$c'
  1642. Xpackage='$package'
  1643. Xspitshell='$spitshell'
  1644. Xshsharp='$shsharp'
  1645. Xsharpbang='$sharpbang'
  1646. Xstartsh='$startsh'
  1647. Xstdchar='$stdchar'
  1648. Xuidtype='$uidtype'
  1649. Xvoidflags='$voidflags'
  1650. Xdefvoidused='$defvoidused'
  1651. Xprivlib='$privlib'
  1652. XCONFIG=true
  1653. XEOT
  1654. XCONFIG=true
  1655. X
  1656. Xecho " "
  1657. Xdflt=''
  1658. Xfastread=''
  1659. Xecho "If you didn't make any mistakes, then just type a carriage return here."
  1660. Xrp="If you need to edit config.sh, do it as a shell escape here:"
  1661. X$echo $n "$rp $c"
  1662. X. UU/myread
  1663. Xcase "$ans" in
  1664. X'') ;;
  1665. X*) : in case they cannot read
  1666. X    eval $ans;;
  1667. Xesac
  1668. X. ./config.sh
  1669. X
  1670. Xecho " "
  1671. Xecho "Doing variable substitutions on .SH files..."
  1672. Xset x `awk '{print $1}' <MANIFEST | $grep '\.SH'`
  1673. Xshift
  1674. Xcase $# in
  1675. X0) set x *.SH; shift;;
  1676. Xesac
  1677. Xif test ! -f $1; then
  1678. X    shift
  1679. Xfi
  1680. Xfor file in $*; do
  1681. X    case "$file" in
  1682. X    */*)
  1683. X    dir=`$expr X$file : 'X\(.*\)/'`
  1684. X    file=`$expr X$file : 'X.*/\(.*\)'`
  1685. X    (cd $dir && . $file)
  1686. X    ;;
  1687. X    *)
  1688. X    . $file
  1689. X    ;;
  1690. X    esac
  1691. Xdone
  1692. Xif test -f config.h.SH; then
  1693. X    if test ! -f config.h; then
  1694. X    : oops, they left it out of MANIFEST, probably, so do it anyway.
  1695. X    . config.h.SH
  1696. X    fi
  1697. Xfi
  1698. X
  1699. Xif $contains '^depend:' Makefile >/dev/null 2>&1; then
  1700. X    dflt=n
  1701. X    $cat <<EOM
  1702. X
  1703. XNow you need to generate make dependencies by running "make depend".
  1704. XYou might prefer to run it in background: "make depend > makedepend.out &"
  1705. XIt can take a while, so you might not want to run it right now.
  1706. X
  1707. XEOM
  1708. X    rp="Run make depend now? [$dflt]"
  1709. X    $echo $n "$rp $c"
  1710. X    . UU/myread
  1711. X    case "$ans" in
  1712. X    y*) make depend
  1713. X    echo "Now you must run a make."
  1714. X    ;;
  1715. X    *)  echo "You must run 'make depend' then 'make'."
  1716. X    ;;
  1717. X    esac
  1718. Xelif test -f Makefile; then
  1719. X    echo " "
  1720. X    echo "Now you must run a make."
  1721. Xelse
  1722. X    echo "Done."
  1723. Xfi
  1724. X
  1725. X$rm -f kit*isdone
  1726. Xcd UU && $rm -f $rmlist
  1727. X: end of Configure
  1728. !STUFFY!FUNK!
  1729. echo Extracting stab.c
  1730. sed >stab.c <<'!STUFFY!FUNK!' -e 's/X//'
  1731. X/* $Header: stab.c,v 2.0 88/06/05 00:11:01 root Exp $
  1732. X *
  1733. X * $Log:    stab.c,v $
  1734. X * Revision 2.0  88/06/05  00:11:01  root
  1735. X * Baseline version 2.0.
  1736. X * 
  1737. X */
  1738. X
  1739. X#include "EXTERN.h"
  1740. X#include "perl.h"
  1741. X
  1742. X#include <signal.h>
  1743. X
  1744. Xstatic char *sig_name[] = {
  1745. X    "",
  1746. X    "HUP",
  1747. X    "INT",
  1748. X    "QUIT",
  1749. X    "ILL",
  1750. X    "TRAP",
  1751. X    "IOT",
  1752. X    "EMT",
  1753. X    "FPE",
  1754. X    "KILL",
  1755. X    "BUS",
  1756. X    "SEGV",
  1757. X    "SYS",
  1758. X    "PIPE",
  1759. X    "ALRM",
  1760. X    "TERM",
  1761. X    "???"
  1762. X#ifdef SIGTSTP
  1763. X    ,"STOP",
  1764. X    "TSTP",
  1765. X    "CONT",
  1766. X    "CHLD",
  1767. X    "TTIN",
  1768. X    "TTOU",
  1769. X    "TINT",
  1770. X    "XCPU",
  1771. X    "XFSZ"
  1772. X#ifdef SIGPROF
  1773. X    ,"VTALARM",
  1774. X    "PROF"
  1775. X#ifdef SIGWINCH
  1776. X    ,"WINCH"
  1777. X#ifdef SIGLOST
  1778. X    ,"LOST"
  1779. X#ifdef SIGUSR1
  1780. X    ,"USR1"
  1781. X#endif
  1782. X#ifdef SIGUSR2
  1783. X    ,"USR2"
  1784. X#endif /* SIGUSR2 */
  1785. X#endif /* SIGLOST */
  1786. X#endif /* SIGWINCH */
  1787. X#endif /* SIGPROF */
  1788. X#endif /* SIGTSTP */
  1789. X    ,0
  1790. X    };
  1791. X
  1792. Xextern int errno;
  1793. Xextern int sys_nerr;
  1794. Xextern char *sys_errlist[];
  1795. X
  1796. XSTR *
  1797. Xstab_str(stab)
  1798. XSTAB *stab;
  1799. X{
  1800. X    register int paren;
  1801. X    register char *s;
  1802. X    register int i;
  1803. X
  1804. X    switch (*stab->stab_name) {
  1805. X    case '0': case '1': case '2': case '3': case '4':
  1806. X    case '5': case '6': case '7': case '8': case '9': case '&':
  1807. X    if (curspat) {
  1808. X        paren = atoi(stab->stab_name);
  1809. X      getparen:
  1810. X        if (curspat->spat_regexp &&
  1811. X          paren <= curspat->spat_regexp->nparens &&
  1812. X          (s = curspat->spat_regexp->startp[paren]) ) {
  1813. X        i = curspat->spat_regexp->endp[paren] - s;
  1814. X        if (i >= 0)
  1815. X            str_nset(stab->stab_val,s,i);
  1816. X        else
  1817. X            str_nset(stab->stab_val,"",0);
  1818. X        }
  1819. X        else
  1820. X        str_nset(stab->stab_val,"",0);
  1821. X    }
  1822. X    break;
  1823. X    case '+':
  1824. X    if (curspat) {
  1825. X        paren = curspat->spat_regexp->lastparen;
  1826. X        goto getparen;
  1827. X    }
  1828. X    break;
  1829. X    case '.':
  1830. X    if (last_in_stab) {
  1831. X        str_numset(stab->stab_val,(double)last_in_stab->stab_io->lines);
  1832. X    }
  1833. X    break;
  1834. X    case '?':
  1835. X    str_numset(stab->stab_val,(double)statusvalue);
  1836. X    break;
  1837. X    case '^':
  1838. X    s = curoutstab->stab_io->top_name;
  1839. X    str_set(stab->stab_val,s);
  1840. X    break;
  1841. X    case '~':
  1842. X    s = curoutstab->stab_io->fmt_name;
  1843. X    str_set(stab->stab_val,s);
  1844. X    break;
  1845. X    case '=':
  1846. X    str_numset(stab->stab_val,(double)curoutstab->stab_io->page_len);
  1847. X    break;
  1848. X    case '-':
  1849. X    str_numset(stab->stab_val,(double)curoutstab->stab_io->lines_left);
  1850. X    break;
  1851. X    case '%':
  1852. X    str_numset(stab->stab_val,(double)curoutstab->stab_io->page);
  1853. X    break;
  1854. X    case '/':
  1855. X    *tokenbuf = record_separator;
  1856. X    tokenbuf[1] = '\0';
  1857. X    str_set(stab->stab_val,tokenbuf);
  1858. X    break;
  1859. X    case '[':
  1860. X    str_numset(stab->stab_val,(double)arybase);
  1861. X    break;
  1862. X    case '|':
  1863. X    str_numset(stab->stab_val,
  1864. X       (double)((curoutstab->stab_io->flags & IOF_FLUSH) != 0) );
  1865. X    break;
  1866. X    case ',':
  1867. X    str_set(stab->stab_val,ofs);
  1868. X    break;
  1869. X    case '\\':
  1870. X    str_set(stab->stab_val,ors);
  1871. X    break;
  1872. X    case '#':
  1873. X    str_set(stab->stab_val,ofmt);
  1874. X    break;
  1875. X    case '!':
  1876. X    str_numset(stab->stab_val, (double)errno);
  1877. X    str_set(stab->stab_val,
  1878. X      errno < 0 || errno > sys_nerr ? "(unknown)" : sys_errlist[errno]);
  1879. X    stab->stab_val->str_nok = 1;    /* what a wonderful hack! */
  1880. X    break;
  1881. X    case '<':
  1882. X    str_numset(stab->stab_val,(double)uid);
  1883. X    break;
  1884. X    case '>':
  1885. X    str_numset(stab->stab_val,(double)euid);
  1886. X    break;
  1887. X    case '(':
  1888. X    s = tokenbuf;
  1889. X    sprintf(s,"%d",(int)getgid());
  1890. X    goto add_groups;
  1891. X    case ')':
  1892. X    s = tokenbuf;
  1893. X    sprintf(s,"%d",(int)getegid());
  1894. X      add_groups:
  1895. X    while (*s) s++;
  1896. X#ifdef GETGROUPS
  1897. X#ifndef NGROUPS
  1898. X#define NGROUPS 32
  1899. X#endif
  1900. X    {
  1901. X        GIDTYPE gary[NGROUPS];
  1902. X
  1903. X        i = getgroups(NGROUPS,gary);
  1904. X        while (--i >= 0) {
  1905. X        sprintf(s," %ld", (long)gary[i]);
  1906. X        while (*s) s++;
  1907. X        }
  1908. X    }
  1909. X#endif
  1910. X    str_set(stab->stab_val,tokenbuf);
  1911. X    break;
  1912. X    }
  1913. X    return stab->stab_val;
  1914. X}
  1915. X
  1916. Xstabset(stab,str)
  1917. Xregister STAB *stab;
  1918. XSTR *str;
  1919. X{
  1920. X    char *s;
  1921. X    int i;
  1922. X    int sighandler();
  1923. X
  1924. X    if (stab->stab_flags & SF_VMAGIC) {
  1925. X    switch (stab->stab_name[0]) {
  1926. X    case '^':
  1927. X        safefree(curoutstab->stab_io->top_name);
  1928. X        curoutstab->stab_io->top_name = s = savestr(str_get(str));
  1929. X        curoutstab->stab_io->top_stab = stabent(s,TRUE);
  1930. X        break;
  1931. X    case '~':
  1932. X        safefree(curoutstab->stab_io->fmt_name);
  1933. X        curoutstab->stab_io->fmt_name = s = savestr(str_get(str));
  1934. X        curoutstab->stab_io->fmt_stab = stabent(s,TRUE);
  1935. X        break;
  1936. X    case '=':
  1937. X        curoutstab->stab_io->page_len = (long)str_gnum(str);
  1938. X        break;
  1939. X    case '-':
  1940. X        curoutstab->stab_io->lines_left = (long)str_gnum(str);
  1941. X        break;
  1942. X    case '%':
  1943. X        curoutstab->stab_io->page = (long)str_gnum(str);
  1944. X        break;
  1945. X    case '|':
  1946. X        curoutstab->stab_io->flags &= ~IOF_FLUSH;
  1947. X        if (str_gnum(str) != 0.0) {
  1948. X        curoutstab->stab_io->flags |= IOF_FLUSH;
  1949. X        }
  1950. X        break;
  1951. X    case '*':
  1952. X        multiline = (int)str_gnum(str) != 0;
  1953. X        break;
  1954. X    case '/':
  1955. X        record_separator = *str_get(str);
  1956. X        break;
  1957. X    case '\\':
  1958. X        if (ors)
  1959. X        safefree(ors);
  1960. X        ors = savestr(str_get(str));
  1961. X        break;
  1962. X    case ',':
  1963. X        if (ofs)
  1964. X        safefree(ofs);
  1965. X        ofs = savestr(str_get(str));
  1966. X        break;
  1967. X    case '#':
  1968. X        if (ofmt)
  1969. X        safefree(ofmt);
  1970. X        ofmt = savestr(str_get(str));
  1971. X        break;
  1972. X    case '[':
  1973. X        arybase = (int)str_gnum(str);
  1974. X        break;
  1975. X    case '?':
  1976. X        statusvalue = (unsigned short)str_gnum(str);
  1977. X        break;
  1978. X    case '!':
  1979. X        errno = (int)str_gnum(str);        /* will anyone ever use this? */
  1980. X        break;
  1981. X    case '<':
  1982. X#ifdef SETRUID
  1983. X        uid = (int)str_gnum(str);
  1984. X        if (setruid(uid) < 0)
  1985. X        uid = (int)getuid();
  1986. X#else
  1987. X        fatal("setruid() not implemented");
  1988. X#endif
  1989. X        break;
  1990. X    case '>':
  1991. X#ifdef SETEUID
  1992. X        euid = (int)str_gnum(str);
  1993. X        if (seteuid(euid) < 0)
  1994. X        euid = (int)geteuid();
  1995. X#else
  1996. X        fatal("seteuid() not implemented");
  1997. X#endif
  1998. X        break;
  1999. X    case '(':
  2000. X#ifdef SETRGID
  2001. X        setrgid((int)str_gnum(str));
  2002. X#else
  2003. X        fatal("setrgid() not implemented");
  2004. X#endif
  2005. X        break;
  2006. X    case ')':
  2007. X#ifdef SETEGID
  2008. X        setegid((int)str_gnum(str));
  2009. X#else
  2010. X        fatal("setegid() not implemented");
  2011. X#endif
  2012. X        break;
  2013. X    case '.':
  2014. X    case '+':
  2015. X    case '&':
  2016. X    case '0':
  2017. X    case '1':
  2018. X    case '2':
  2019. X    case '3':
  2020. X    case '4':
  2021. X    case '5':
  2022. X    case '6':
  2023. X    case '7':
  2024. X    case '8':
  2025. X    case '9':
  2026. X        break;        /* "read-only" registers */
  2027. X    }
  2028. X    }
  2029. X    else if (stab == envstab && envname) {
  2030. X    setenv(envname,str_get(str));
  2031. X                /* And you'll never guess what the dog had */
  2032. X    safefree(envname);    /*   in its mouth... */
  2033. X    envname = Nullch;
  2034. X    }
  2035. X    else if (stab == sigstab && signame) {
  2036. X    s = str_get(str);
  2037. X    i = whichsig(signame);    /* ...no, a brick */
  2038. X    if (strEQ(s,"IGNORE"))
  2039. X        signal(i,SIG_IGN);
  2040. X    else if (strEQ(s,"DEFAULT") || !*s)
  2041. X        signal(i,SIG_DFL);
  2042. X    else
  2043. X        signal(i,sighandler);
  2044. X    safefree(signame);
  2045. X    signame = Nullch;
  2046. X    }
  2047. X    else if (stab->stab_array) {
  2048. X    afill(stab->stab_array, (int)str_gnum(str) - arybase);
  2049. X    }
  2050. X}
  2051. X
  2052. Xwhichsig(sig)
  2053. Xchar *sig;
  2054. X{
  2055. X    register char **sigv;
  2056. X
  2057. X    for (sigv = sig_name+1; *sigv; sigv++)
  2058. X    if (strEQ(sig,*sigv))
  2059. X        return sigv - sig_name;
  2060. X    return 0;
  2061. X}
  2062. X
  2063. Xsighandler(sig)
  2064. Xint sig;
  2065. X{
  2066. X    STAB *stab;
  2067. X    ARRAY *savearray;
  2068. X    STR *str;
  2069. X    char *oldfile = filename;
  2070. X    int oldsave = savestack->ary_fill;
  2071. X    SUBR *sub;
  2072. X
  2073. X    stab = stabent(str_get(hfetch(sigstab->stab_hash,sig_name[sig])),TRUE);
  2074. X    sub = stab->stab_sub;
  2075. X    if (!sub) {
  2076. X    if (dowarn)
  2077. X        warn("SIG%s handler \"%s\" not defined.\n",
  2078. X        sig_name[sig], stab->stab_name );
  2079. X    return;
  2080. X    }
  2081. X    savearray = defstab->stab_array;
  2082. X    defstab->stab_array = anew(defstab);
  2083. X    str = str_new(0);
  2084. X    str_set(str,sig_name[sig]);
  2085. X    apush(defstab->stab_array,str);
  2086. X    sub->depth++;
  2087. X    if (sub->depth >= 2) {    /* save temporaries on recursion? */
  2088. X    if (sub->depth == 100 && dowarn)
  2089. X        warn("Deep recursion on subroutine \"%s\"",stab->stab_name);
  2090. X    savelist(sub->tosave->ary_array,sub->tosave->ary_fill);
  2091. X    }
  2092. X    filename = sub->filename;
  2093. X
  2094. X    str = cmd_exec(sub->cmd);        /* so do it already */
  2095. X
  2096. X    sub->depth--;    /* assuming no longjumps out of here */
  2097. X    afree(defstab->stab_array);  /* put back old $_[] */
  2098. X    defstab->stab_array = savearray;
  2099. X    filename = oldfile;
  2100. X    if (savestack->ary_fill > oldsave)
  2101. X    restorelist(oldsave);
  2102. X}
  2103. X
  2104. Xchar *
  2105. Xreg_get(name)
  2106. Xchar *name;
  2107. X{
  2108. X    return STAB_GET(stabent(name,TRUE));
  2109. X}
  2110. X
  2111. X#ifdef NOTUSED
  2112. Xreg_set(name,value)
  2113. Xchar *name;
  2114. Xchar *value;
  2115. X{
  2116. X    str_set(STAB_STR(stabent(name,TRUE)),value);
  2117. X}
  2118. X#endif
  2119. X
  2120. XSTAB *
  2121. Xaadd(stab)
  2122. Xregister STAB *stab;
  2123. X{
  2124. X    if (!stab->stab_array)
  2125. X    stab->stab_array = anew(stab);
  2126. X    return stab;
  2127. X}
  2128. X
  2129. XSTAB *
  2130. Xhadd(stab)
  2131. Xregister STAB *stab;
  2132. X{
  2133. X    if (!stab->stab_hash)
  2134. X    stab->stab_hash = hnew();
  2135. X    return stab;
  2136. X}
  2137. X
  2138. XSTAB *
  2139. Xstabent(name,add)
  2140. Xregister char *name;
  2141. Xint add;
  2142. X{
  2143. X    register STAB *stab;
  2144. X
  2145. X    for (stab = stab_index[*name]; stab; stab = stab->stab_next) {
  2146. X    if (strEQ(name,stab->stab_name)) {
  2147. X        stab->stab_flags |= SF_MULTI;    /* is okay, probably */
  2148. X        return stab;
  2149. X    }
  2150. X    }
  2151. X    
  2152. X    /* no entry--should we add one? */
  2153. X
  2154. X    if (add) {
  2155. X    stab = (STAB *) safemalloc(sizeof(STAB));
  2156. X    bzero((char*)stab, sizeof(STAB));
  2157. X    stab->stab_name = savestr(name);
  2158. X    stab->stab_val = str_new(0);
  2159. X    stab->stab_next = stab_index[*name];
  2160. X    stab_index[*name] = stab;
  2161. X    return stab;
  2162. X    }
  2163. X    return Nullstab;
  2164. X}
  2165. X
  2166. XSTIO *
  2167. Xstio_new()
  2168. X{
  2169. X    STIO *stio = (STIO *) safemalloc(sizeof(STIO));
  2170. X
  2171. X    bzero((char*)stio, sizeof(STIO));
  2172. X    stio->page_len = 60;
  2173. X    return stio;
  2174. X}
  2175. X
  2176. Xstab_check(min,max)
  2177. Xint min;
  2178. Xregister int max;
  2179. X{
  2180. X    register int i;
  2181. X    register STAB *stab;
  2182. X
  2183. X    for (i = min; i <= max; i++) {
  2184. X    for (stab = stab_index[i]; stab; stab = stab->stab_next) {
  2185. X        if (stab->stab_flags & SF_MULTI)
  2186. X        continue;
  2187. X        if (i == 'A' && strEQ(stab->stab_name, "ARGV"))
  2188. X        continue;
  2189. X        if (i == 'E' && strEQ(stab->stab_name, "ENV"))
  2190. X        continue;
  2191. X        if (i == 'S' && strEQ(stab->stab_name, "SIG"))
  2192. X        continue;
  2193. X        if (i == 'I' && strEQ(stab->stab_name, "INC"))
  2194. X        continue;
  2195. X        warn("Possible typo: %s,", stab->stab_name);
  2196. X    }
  2197. X    }
  2198. X}
  2199. !STUFFY!FUNK!
  2200. echo Extracting EXTERN.h
  2201. sed >EXTERN.h <<'!STUFFY!FUNK!' -e 's/X//'
  2202. X/* $Header: EXTERN.h,v 2.0 88/06/05 00:07:46 root Exp $
  2203. X *
  2204. X * $Log:    EXTERN.h,v $
  2205. X * Revision 2.0  88/06/05  00:07:46  root
  2206. X * Baseline version 2.0.
  2207. X * 
  2208. X */
  2209. X
  2210. X#undef EXT
  2211. X#define EXT extern
  2212. X
  2213. X#undef INIT
  2214. X#define INIT(x)
  2215. X
  2216. X#undef DOINIT
  2217. !STUFFY!FUNK!
  2218. echo ""
  2219. echo "End of kit 6 (of 15)"
  2220. cat /dev/null >kit6isdone
  2221. run=''
  2222. config=''
  2223. for iskit in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
  2224.     if test -f kit${iskit}isdone; then
  2225.     run="$run $iskit"
  2226.     else
  2227.     todo="$todo $iskit"
  2228.     fi
  2229. done
  2230. case $todo in
  2231.     '')
  2232.     echo "You have run all your kits.  Please read README and then type Configure."
  2233.     chmod 755 Configure
  2234.     ;;
  2235.     *)  echo "You have run$run."
  2236.     echo "You still need to run$todo."
  2237.     ;;
  2238. esac
  2239. : Someone might mail this, so...
  2240. exit
  2241.  
  2242.