home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume43 / c2man-2.0 / patch28 next >
Encoding:
Internet Message Format  |  1994-06-10  |  44.9 KB

  1. From: greyham@research.canon.oz.au (Graham Stoney)
  2. Newsgroups: comp.sources.misc
  3. Subject: v43i021:  c2man-2.0 - automatic C documentation generator, Patch28
  4. Date: 9 Jun 1994 11:49:14 -0500
  5. Organization: Canon Information Systems Research Australia
  6. Sender: kent@sparky.sterling.com
  7. Approved: kent@sparky.sterling.com
  8. Message-ID: <2t7h6a$34n@sparky.sterling.com>
  9. Summary: This is an official patch for c2man 2.0.  Please apply it.
  10. X-Md4-Signature: 737d58e08651d1cd9c5bceca16cd1191
  11.  
  12. Submitted-by: greyham@research.canon.oz.au (Graham Stoney)
  13. Posting-number: Volume 43, Issue 21
  14. Archive-name: c2man-2.0/patch28
  15. Environment: UNIX, DOS, OS/2, lex, yacc
  16. Patch-To: c2man-2.0: Volume 42, Issue 55-63
  17.  
  18. [ Please note that this package was initially posted at patchlevel 27 ]
  19. [ and as such, patches are being numbered from that point.   -Kent+   ]
  20.  
  21. System: c2man version 2.0
  22. Patch #: 28
  23. Priority: LOW
  24. Subject: Limit enum descriptions to 20 values.
  25. Subject: Use .RE in fixexamp.in; from Diab Jerius.
  26. Subject: Add texinfo-specific options, from Diab Jerius.
  27. Subject: Update the pc Makefile.
  28. Subject: Add pc/updmake, used to regenerate pc/Makefile.pc.
  29. Subject: Add a libc directory for common routines (getopt et al).
  30. Subject: Update Configure with metaconfig 3.0 PL29.
  31. Subject: Change PC installation instructions with new libc dir.
  32. Subject: Add libc/alloca.c, principally for the VMS port.
  33. Subject: Add VMS port, from Rick Flower.
  34. Date: Fri May 20 11:24:56 EST 1994
  35. From: Graham Stoney <greyham@research.canon.oz.au>
  36.  
  37. Description:
  38.     Limit enum descriptions to 20 values.
  39.     enums can sometimes have large numbers of values; particularly for
  40.     uses similar to the traditional errno, or in cases where part of the
  41.     source is automatically generated.  This becomes a pain in the manual
  42.     pages if there is a huge list, so the list is now omitted if the are
  43.     more than 20 possible values.
  44.  
  45.     Use .RE in fixexamp.in; from Diab Jerius.
  46.     Diab reported that the multiple use of .RS caused a problem if .RE was
  47.     used later on; the fix doesn't seem to hurt, so I dropped it in.
  48.  
  49.     Add texinfo-specific options, from Diab Jerius.
  50.     This is a pretty major contribution, documented in the manual page.
  51.  
  52.     Update the pc Makefile; it was somewhat out of date.
  53.  
  54.     Add pc/updmake, used to regenerate pc/Makefile.pc.
  55.     This is the script I use to regenerate pc/Makefile.pc automatically in
  56.     the distribution; I've decided to include it in case anyone ever needs
  57.     to do work on the pc port for any reason.
  58.  
  59.     Add a libc directory for common routines (getopt et al).
  60.     This is a place for generic routines required by various ports; the
  61.     Configure script will move the getopt sources from the pc subdirectory
  62.     to this new libc subdirectory, which is why it must be run after
  63.     applying patch 30.
  64.  
  65.     Update Configure with metaconfig 3.0 PL29.
  66.     More finely handcrafted changes, courtesy Raphael Manfredi & team.
  67.  
  68.     Add VMS port, from Rick Flower.
  69.  
  70.  
  71. Fix:    From rn, say "| patch -p -N -d DIR", where DIR is your c2man source
  72.     directory.  Outside of rn, say "cd DIR; patch -p -N <thisarticle".
  73.     If you don't have the patch program, apply the following by hand,
  74.     or get patch (version 2.0, latest patchlevel).
  75.  
  76.     After patching:
  77.         *** DO NOTHING--INSTALL ALL PATCHES UP THROUGH #30 FIRST ***
  78.         *** NOTE: YOU MUST RUN Configure AFTER APPLYING PATCH 30 ***
  79.  
  80.     If patch indicates that patchlevel is the wrong version, you may need
  81.     to apply one or more previous patches, or the patch may already
  82.     have been applied.  See the patchlevel.h file to find out what has or
  83.     has not been applied.  In any event, don't continue with the patch.
  84.  
  85.     If you are missing previous patches they can be obtained from me:
  86.  
  87.         Graham Stoney <greyham@research.canon.oz.au>
  88.  
  89.     If you send a mail message of the following form it will greatly speed
  90.     processing:
  91.  
  92.         Subject: Command
  93.         @SH mailpatch PATH c2man 2.0 LIST
  94.                ^ note the c
  95.  
  96.     where PATH is a return path FROM ME TO YOU either in Internet notation,
  97.     or in bang notation from some well-known host, and LIST is the number
  98.     of one or more patches you need, separated by spaces, commas, and/or
  99.     hyphens.  Saying 35- says everything from 35 to the end.
  100.  
  101.     To get some more detailed instructions, send me the following mail:
  102.  
  103.         Subject: Command
  104.         @SH mailhelp PATH
  105.  
  106.  
  107. Index: patchlevel.h
  108. Prereq: 27
  109. 2c2
  110. < #define PATCHLEVEL 27
  111. ---
  112. > #define PATCHLEVEL 28
  113.  
  114. Index: Configure
  115. Prereq: 2.0.1.31
  116. *** Configure.old    1994/02/23 07:08:43
  117. --- Configure    1994/05/19 01:46:43
  118. ***************
  119. *** 18,26 ****
  120.   # archive site. Check with Archie if you don't know where that can be.)
  121.   #
  122.   
  123. ! # $Id: Configure,v 2.0.1.31 1994/02/23 07:08:43 greyham Exp $
  124.   #
  125. ! # Generated on Wed Feb 23 17:43:56 EST 1994 [metaconfig 3.0 PL22]
  126.   
  127.   cat >/tmp/c1$$ <<EOF
  128.   ARGGGHHHH!!!!!
  129. --- 18,26 ----
  130.   # archive site. Check with Archie if you don't know where that can be.)
  131.   #
  132.   
  133. ! # $Id: Configure,v 2.0.1.34 1994/05/19 01:46:43 greyham Exp $
  134.   #
  135. ! # Generated on Thu May 19 11:21:25 EST 1994 [metaconfig 3.0 PL29]
  136.   
  137.   cat >/tmp/c1$$ <<EOF
  138.   ARGGGHHHH!!!!!
  139. ***************
  140. *** 91,96 ****
  141. --- 91,97 ----
  142.   awk=''
  143.   bash=''
  144.   bison=''
  145. + byacc=''
  146.   cat=''
  147.   chgrp=''
  148.   chmod=''
  149. ***************
  150. *** 171,176 ****
  151. --- 172,178 ----
  152.   binexp=''
  153.   installbin=''
  154.   cc=''
  155. + gccversion=''
  156.   ccflags=''
  157.   cppflags=''
  158.   ldflags=''
  159. ***************
  160. *** 207,213 ****
  161.   h_fcntl=''
  162.   h_sysfile=''
  163.   i_fcntl=''
  164. - i_stdarg=''
  165.   i_stddef=''
  166.   i_stdlib=''
  167.   i_string=''
  168. --- 209,214 ----
  169. ***************
  170. *** 219,229 ****
  171. --- 220,232 ----
  172.   i_time=''
  173.   timeincl=''
  174.   i_unistd=''
  175. + i_stdarg=''
  176.   i_varargs=''
  177.   i_varhdr=''
  178.   lex=''
  179.   libc=''
  180.   liblex=''
  181. + glibpth=''
  182.   libpth=''
  183.   plibpth=''
  184.   xlibpth=''
  185. ***************
  186. *** 393,399 ****
  187.       -s) shift; silent=true;;
  188.       -E) shift; alldone=exit;;
  189.       -S) shift; extractsh=true;;
  190. !     -V) echo "Configure generated by metaconfig 3.0 PL22." >&2
  191.           exit 0;;
  192.       --) break;;
  193.       -*) echo "Configure: unknown option $1" >&2; shift; error=true;;
  194. --- 396,402 ----
  195.       -s) shift; silent=true;;
  196.       -E) shift; alldone=exit;;
  197.       -S) shift; extractsh=true;;
  198. !     -V) echo "Configure generated by metaconfig 3.0 PL29." >&2
  199.           exit 0;;
  200.       --) break;;
  201.       -*) echo "Configure: unknown option $1" >&2; shift; error=true;;
  202. ***************
  203. *** 467,472 ****
  204. --- 470,476 ----
  205.       eunicefix=/etc/unixtovms.exe
  206.   fi
  207.   
  208. + gccversion='1'
  209.   : no include file wanted by default
  210.   inclwanted=''
  211.   
  212. ***************
  213. *** 475,485 ****
  214.   xlibpth='/usr/lib/386 /lib/386'
  215.   
  216.   : general looking path for locating libraries
  217. ! libpth='/usr/lib/large /lib '$xlibpth' /lib/large'
  218. ! libpth=$libpth' /usr/lib/small /lib/small'
  219.   
  220. ! : no additional library wanted by default
  221. ! libswanted=''
  222.   
  223.   large=''
  224.   : full support for void wanted by default
  225. --- 479,497 ----
  226.   xlibpth='/usr/lib/386 /lib/386'
  227.   
  228.   : general looking path for locating libraries
  229. ! glibpth="/usr/lib/large /lib /usr/lib $xlibpth /lib/large"
  230. ! glibpth="$glibpth /usr/lib/small /lib/small"
  231. ! glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
  232. ! : Private path used by Configure to find libraries.  Its value
  233. ! : is prepended to libpth. This variable takes care of special
  234. ! : machines, like the mips.  Usually, it should be empty.
  235. ! plibpth=''
  236.   
  237. ! : default ordered library list
  238. ! libswanted='net socket inet nsl nm sdbm gdbm ndbm dbm malloc dl'
  239. ! libswanted="$libswanted dld sun m c_s posix cposix ndir dir ucb"
  240. ! libswanted="$libswanted bsd BSD PW x"
  241.   
  242.   large=''
  243.   : full support for void wanted by default
  244. ***************
  245. *** 491,496 ****
  246. --- 503,512 ----
  247.   rm -f ../c2man.man ../fixpre.in ../fixpre.sed ../fixpost.in ../fixpost.sed
  248.   rm -f ../flatten_sed.SH ../fixexample.in ../fixexample.sed
  249.   rm -f ../eg/commentafter.c ../eg/multipledecl.c
  250. + : 2.0pl28 moved some files around - do it without the big patch baggage.
  251. + mv -f ../pc/COPYING ../pc/getopt.[ch] ../pc/getopt1.c ../libc 2>/dev/null
  252.   : Some greps do not return status, grrr.
  253.   echo "grimblepritz" >grimble
  254.   if grep blurfldyick grimble >/dev/null 2>&1 ; then
  255. ***************
  256. *** 868,873 ****
  257. --- 884,890 ----
  258.   trylist="
  259.   Mcc
  260.   bison
  261. + byacc
  262.   cpp
  263.   date
  264.   flex
  265. ***************
  266. *** 1020,1026 ****
  267.   
  268.   : who configured the system
  269.   cf_time=`$date 2>&1`
  270. ! cf_by=`( (logname) 2>/dev/null || whoami) 2>&1`
  271.   
  272.   : determine where manual pages are on this system
  273.   echo " "
  274. --- 1037,1047 ----
  275.   
  276.   : who configured the system
  277.   cf_time=`$date 2>&1`
  278. ! (logname > .temp) >/dev/null 2>&1
  279. ! $test -s .temp || (whoami > .temp) >/dev/null 2>&1
  280. ! $test -s .temp || echo unknown > .temp
  281. ! cf_by=`$cat .temp`
  282. ! $rm -f .temp
  283.   
  284.   : determine where manual pages are on this system
  285.   echo " "
  286. ***************
  287. *** 1164,1170 ****
  288.       cc="$ans"
  289.   fi
  290.   case "$cc" in
  291. ! gcc*) cpp=`./loc gcc-cpp $cpp $pth`;;
  292.   esac
  293.   
  294.   : decide how portable to be
  295. --- 1185,1227 ----
  296.       cc="$ans"
  297.   fi
  298.   case "$cc" in
  299. ! gcc*)
  300. !     echo "Checking out which version of gcc you have..." >&4
  301. !     $cat >gccvers.c <<EOM
  302. ! #include <stdio.h>
  303. ! int main()
  304. ! {
  305. !     char *v;
  306. !     v = "unknown";
  307. ! #ifdef __GNUC__
  308. ! #ifdef __VERSION__
  309. !     v = __VERSION__;
  310. ! #endif
  311. ! #endif
  312. !     switch((int) v[0]) {
  313. !         case '1': printf("1\n"); break;
  314. !         case '2': printf("2\n"); break;
  315. !         case '3': printf("3\n"); break;
  316. !         default: break;
  317. !     }
  318. ! #ifdef __GNUC__
  319. !     return 0;
  320. ! #else
  321. !     return 1;
  322. ! #endif
  323. ! }
  324. ! EOM
  325. !     if $cc -o gccvers gccvers.c >/dev/null 2>&1; then
  326. !         gccversion=`./gccvers`
  327. !         echo "You appear to have version $gccversion."
  328. !     else
  329. !         echo "Doesn't appear to be GNU cc after all."
  330. !     fi
  331. !     $rm -f gccvers*
  332. !     if $test "$gccversion" = '1'; then
  333. !         cpp=`./loc gcc-cpp $cpp $pth`
  334. !     fi
  335. !     ;;
  336.   esac
  337.   
  338.   : decide how portable to be
  339. ***************
  340. *** 1206,1212 ****
  341.    ~*)
  342.       if $test -f /bin/csh; then
  343.           /bin/csh -f -c "glob \$1"
  344. !         failed=$?
  345.           echo ""
  346.           exit \$failed
  347.       else
  348. --- 1263,1269 ----
  349.    ~*)
  350.       if $test -f /bin/csh; then
  351.           /bin/csh -f -c "glob \$1"
  352. !         failed=\$?
  353.           echo ""
  354.           exit \$failed
  355.       else
  356. ***************
  357. *** 1243,1252 ****
  358. --- 1300,1317 ----
  359.   skip=''
  360.   none_ok=''
  361.   exp_file=''
  362. + nopath_ok=''
  363.   orig_rp="$rp"
  364.   orig_dflt="$dflt"
  365.   
  366.   case "$fn" in
  367. + *:*)
  368. +     loc_file=`expr $fn : '.*:\(.*\)'`
  369. +     fn=`expr $fn : '\(.*\):.*'`
  370. +     ;;
  371. + esac
  372. + case "$fn" in
  373.   *~*) tilde=true;;
  374.   esac
  375.   case "$fn" in
  376. ***************
  377. *** 1261,1271 ****
  378.   case "$fn" in
  379.   *e*) exp_file=true;;
  380.   esac
  381.   
  382.   case "$fn" in
  383.   *f*) type='File';;
  384.   *d*) type='Directory';;
  385. ! *l*) type='Locate'; fn=`expr $fn : '.*:\(.*\)'`;;
  386.   esac
  387.   
  388.   what="$type"
  389. --- 1326,1339 ----
  390.   case "$fn" in
  391.   *e*) exp_file=true;;
  392.   esac
  393. + case "$fn" in
  394. + *p*) nopath_ok=true;;
  395. + esac
  396.   
  397.   case "$fn" in
  398.   *f*) type='File';;
  399.   *d*) type='Directory';;
  400. ! *l*) type='Locate';;
  401.   esac
  402.   
  403.   what="$type"
  404. ***************
  405. *** 1362,1373 ****
  406.                   ;;
  407.               Locate)
  408.                   if test -d "$value"; then
  409. !                     echo "(Looking for $fn in directory $value.)"
  410. !                     value="$value/$fn"
  411.                   fi
  412.                   if test -f "$value"; then
  413.                       type=''
  414.                   fi
  415.                   ;;
  416.               esac
  417.   
  418. --- 1430,1450 ----
  419.                   ;;
  420.               Locate)
  421.                   if test -d "$value"; then
  422. !                     echo "(Looking for $loc_file in directory $value.)"
  423. !                     value="$value/$loc_file"
  424.                   fi
  425.                   if test -f "$value"; then
  426.                       type=''
  427.                   fi
  428. +                 case "$nopath_ok" in
  429. +                 true)    case "$value" in
  430. +                     */*) ;;
  431. +                     *)    echo "Assuming $value will be in people's path."
  432. +                         type=''
  433. +                         ;;
  434. +                     esac
  435. +                     ;;
  436. +                 esac
  437.                   ;;
  438.               esac
  439.   
  440. ***************
  441. *** 1406,1415 ****
  442.   : What should the include directory be ?
  443.   echo " "
  444.   $echo $n "Hmm...  $c"
  445. ! case "$usrinc" in
  446. ! '') dflt='/usr/include';;
  447. ! *) dflt=$usrinc;;
  448. ! esac
  449.   incpath=''
  450.   mips_type=''
  451.   if $test -f /bin/mips && /bin/mips; then
  452. --- 1483,1489 ----
  453.   : What should the include directory be ?
  454.   echo " "
  455.   $echo $n "Hmm...  $c"
  456. ! dflt='/usr/include'
  457.   incpath=''
  458.   mips_type=''
  459.   if $test -f /bin/mips && /bin/mips; then
  460. ***************
  461. *** 1435,1449 ****
  462.       $eunicefix mips
  463.   fi
  464.   echo " "
  465.   fn=d/
  466.   rp='Where are the include files you want to use?'
  467.   . ./getfile
  468.   usrinc="$ans"
  469.   
  470.   : determine optimize, if desired, or use for debug flag also
  471.   case "$optimize" in
  472. ! ' ') dflt="none";;
  473. ! '') dflt="-O";;
  474.   *) dflt="$optimize";;
  475.   esac
  476.   $cat <<EOH
  477. --- 1509,1665 ----
  478.       $eunicefix mips
  479.   fi
  480.   echo " "
  481. + case "$usrinc" in
  482. + '') ;;
  483. + *) dflt="$usrinc";;
  484. + esac
  485.   fn=d/
  486.   rp='Where are the include files you want to use?'
  487.   . ./getfile
  488.   usrinc="$ans"
  489.   
  490. + : see how we invoke the C preprocessor
  491. + echo " "
  492. + echo "Now, how can we feed standard input to your C preprocessor..." >&4
  493. + cat <<'EOT' >testcpp.c
  494. + #define ABC abc
  495. + #define XYZ xyz
  496. + ABC.XYZ
  497. + EOT
  498. + cd ..
  499. + echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
  500. + chmod 755 cppstdin
  501. + wrapper=`pwd`/cppstdin
  502. + ok='false'
  503. + cd UU
  504. + if $test "X$cppstdin" != "X" && \
  505. +     $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
  506. +     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
  507. + then
  508. +     echo "You used to use $cppstdin $cppminus so we'll use that again."
  509. +     case "$cpprun" in
  510. +     '') echo "But let's see if we can live without a wrapper..." ;;
  511. +     *)
  512. +         if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
  513. +             $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
  514. +         then
  515. +             echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
  516. +             ok='true'
  517. +         else
  518. +             echo "(However, $cpprun $cpplast does not work, let's see...)"
  519. +         fi
  520. +         ;;
  521. +     esac
  522. + else
  523. +     case "$cppstdin" in
  524. +     '') ;;
  525. +     *)
  526. +         echo "Good old $cppstdin $cppminus does not seem to be of any help..."
  527. +         ;;
  528. +     esac
  529. + fi
  530. + if $ok; then
  531. +     : nothing
  532. + elif echo 'Maybe "'"$cc"' -E" will work...'; \
  533. +     $cc -E <testcpp.c >testcpp.out 2>&1; \
  534. +     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  535. +     echo "Yup, it does."
  536. +     x_cpp="$cc -E"
  537. +     x_minus='';
  538. + elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
  539. +     $cc -E - <testcpp.c >testcpp.out 2>&1; \
  540. +     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  541. +     echo "Yup, it does."
  542. +     x_cpp="$cc -E"
  543. +     x_minus='-';
  544. + elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
  545. +     $cc -P <testcpp.c >testcpp.out 2>&1; \
  546. +     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  547. +     echo "Yipee, that works!"
  548. +     x_cpp="$cc -P"
  549. +     x_minus='';
  550. + elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
  551. +     $cc -P - <testcpp.c >testcpp.out 2>&1; \
  552. +     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  553. +     echo "At long last!"
  554. +     x_cpp="$cc -P"
  555. +     x_minus='-';
  556. + elif echo 'No such luck, maybe "'$cpp'" will work...'; \
  557. +     $cpp <testcpp.c >testcpp.out 2>&1; \
  558. +     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  559. +     echo "It works!"
  560. +     x_cpp="$cpp"
  561. +     x_minus='';
  562. + elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
  563. +     $cpp - <testcpp.c >testcpp.out 2>&1; \
  564. +     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  565. +     echo "Hooray, it works!  I was beginning to wonder."
  566. +     x_cpp="$cpp"
  567. +     x_minus='-';
  568. + elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
  569. +     $wrapper <testcpp.c >testcpp.out 2>&1; \
  570. +     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  571. +     x_cpp="$wrapper"
  572. +     x_minus=''
  573. +     echo "Eureka!"
  574. + else
  575. +     dflt=''
  576. +     rp="No dice.  I can't find a C preprocessor.  Name one:"
  577. +     . ./myread
  578. +     x_cpp="$ans"
  579. +     x_minus=''
  580. +     $x_cpp <testcpp.c >testcpp.out 2>&1
  581. +     if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  582. +         echo "OK, that will do." >&4
  583. +     else
  584. + echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
  585. +         exit 1
  586. +     fi
  587. + fi
  588. + case "$ok" in
  589. + false)
  590. +     cppstdin="$x_cpp"
  591. +     cppminus="$x_minus"
  592. +     cpprun="$x_cpp"
  593. +     cpplast="$x_minus"
  594. +     set X $x_cpp
  595. +     shift
  596. +     case "$1" in
  597. +     "$cpp")
  598. +         echo "Perhaps can we force $cc -E using a wrapper..."
  599. +         if $wrapper <testcpp.c >testcpp.out 2>&1; \
  600. +             $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
  601. +         then
  602. +             echo "Yup, we can."
  603. +             cppstdin="$wrapper"
  604. +             cppminus='';
  605. +         else
  606. +             echo "Nope, we'll have to live without it..."
  607. +         fi
  608. +         ;;
  609. +     esac
  610. +     case "$cpprun" in
  611. +     "$wrapper")
  612. +         cpprun=''
  613. +         cpplast=''
  614. +         ;;
  615. +     esac
  616. +     ;;
  617. + esac
  618. + case "$cppstdin" in
  619. + "$wrapper") ;;
  620. + *) $rm -f $wrapper;;
  621. + esac
  622. + $rm -f testcpp.c testcpp.out
  623.   : determine optimize, if desired, or use for debug flag also
  624.   case "$optimize" in
  625. ! ' ') dflt='none';;
  626. ! '') dflt='-O';;
  627.   *) dflt="$optimize";;
  628.   esac
  629.   $cat <<EOH
  630. ***************
  631. *** 1462,1471 ****
  632.   'none') optimize=" ";;
  633.   esac
  634.   
  635.   case "$ccflags" in
  636.   '')    case "$cc" in
  637. !     *gcc*) dflt='-fpcc-struct-return';;
  638. !     *) dflt='';;
  639.       esac
  640.       case "$optimize" in
  641.       *-g*) dflt="$dflt -DDEBUG";;
  642. --- 1678,1691 ----
  643.   'none') optimize=" ";;
  644.   esac
  645.   
  646. + dflt=''
  647.   case "$ccflags" in
  648.   '')    case "$cc" in
  649. !     *gcc*)
  650. !         if $test "$gccversion" = '1'; then
  651. !             dflt='-fpcc-struct-return'
  652. !         fi
  653. !         ;;
  654.       esac
  655.       case "$optimize" in
  656.       *-g*) dflt="$dflt -DDEBUG";;
  657. ***************
  658. *** 1479,1485 ****
  659.           ;;
  660.       esac
  661.       ;;
  662. - *) dflt="$ccflags" ;;
  663.   esac
  664.   
  665.   case "$mips_type" in
  666. --- 1699,1704 ----
  667. ***************
  668. *** 1523,1528 ****
  669. --- 1742,1751 ----
  670.   case "$dflt" in
  671.   '') dflt=none;;
  672.   esac
  673. + case "$ccflags" in
  674. + '') ;;
  675. + *) dflt="$ccflags";;
  676. + esac
  677.   $cat <<EOH
  678.   
  679.   Your C compiler may want other flags.  For this question you should include
  680. ***************
  681. *** 1545,1551 ****
  682.   : the following weeds options from ccflags that are of no interest to cpp
  683.   cppflags="$ccflags"
  684.   case "$cc" in
  685. ! *gcc*) cppflags="$cppflags -D__GNUC__";;
  686.   esac
  687.   case "$mips_type" in
  688.   '');;
  689. --- 1768,1778 ----
  690.   : the following weeds options from ccflags that are of no interest to cpp
  691.   cppflags="$ccflags"
  692.   case "$cc" in
  693. ! *gcc*)
  694. !     if $test "$gccversion" = "1"; then
  695. !         cppflags="$cppflags -D__GNUC__"
  696. !     fi
  697. !     ;;
  698.   esac
  699.   case "$mips_type" in
  700.   '');;
  701. ***************
  702. *** 1553,1569 ****
  703.   esac
  704.   case "$cppflags" in
  705.   '');;
  706. ! *)  set X $cppflags
  707.       cppflags=''
  708. !     for flag
  709.       do
  710. !         case $flag in
  711. !         -D*|-I*|-traditional|-ansi|-nostdinc) cppflags="$cppflags $flag";;
  712.           esac
  713.       done
  714.       case "$cppflags" in
  715. !     *-*)  echo "(C preprocessor flags: $cppflags)";;
  716.       esac
  717.       ;;
  718.   esac
  719.   
  720. --- 1780,1823 ----
  721.   esac
  722.   case "$cppflags" in
  723.   '');;
  724. ! *)
  725. !     echo " "
  726. !     echo "Let me guess what the preprocessor flags are..." >&4
  727. !     set X $cppflags
  728. !     shift
  729.       cppflags=''
  730. !     $cat >cpp.c <<'EOM'
  731. ! #define BLURFL foo
  732. ! BLURFL xx LFRULB
  733. ! EOM
  734. !     previous=''
  735. !     for flag in $*
  736.       do
  737. !         case "$flag" in
  738. !         -*) ftry="$flag";;
  739. !         *) ftry="$previous $flag";;
  740.           esac
  741. +         if $cppstdin -DLFRULB=bar $ftry $cppminus <cpp.c \
  742. +             >cpp1.out 2>/dev/null && \
  743. +             $cpprun -DLFRULB=bar $ftry $cpplast <cpp.c \
  744. +             >cpp2.out 2>/dev/null && \
  745. +             $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
  746. +             $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
  747. +         then
  748. +             cppflags="$cppflags $ftry"
  749. +             previous=''
  750. +         else
  751. +             previous="$flag"
  752. +         fi
  753.       done
  754. +     set X $cppflags
  755. +     shift
  756. +     cppflags=${1+"$@"}
  757.       case "$cppflags" in
  758. !     *-*)  echo "They appear to be: $cppflags";;
  759.       esac
  760. +     $rm -f cpp.c cpp?.out
  761.       ;;
  762.   esac
  763.   
  764. ***************
  765. *** 1596,1606 ****
  766.   case "$plibpth" in
  767.   '') if mips; then
  768.           plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
  769. -     else
  770. -         plibpth="/usr/ccs/lib /usr/lib /usr/ucblib /usr/local/lib"
  771.       fi;;
  772.   esac
  773. ! libpth="$plibpth $libpth"
  774.   
  775.   : Looking for optional libraries
  776.   echo " "
  777. --- 1850,1895 ----
  778.   case "$plibpth" in
  779.   '') if mips; then
  780.           plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
  781.       fi;;
  782.   esac
  783. ! case "$libpth" in
  784. ! ' ') dlist='';;
  785. ! '') dlist="$plibpth $glibpth";;
  786. ! *) dlist="$libpth";;
  787. ! esac
  788. ! : Now check and see which directories actually exist, avoiding duplicates
  789. ! libpth=''
  790. ! for xxx in $dlist
  791. ! do
  792. !     if $test -d $xxx; then
  793. !         case " $libpth " in
  794. !         *" $xxx "*) ;;
  795. !         *) libpth="$libpth $xxx";;
  796. !         esac
  797. !     fi
  798. ! done
  799. ! $cat <<'EOM'
  800. ! Some systems have incompatible or broken versions of libraries.  Among
  801. ! the directories listed in the question below, please remove the one
  802. ! you know not to be holding relevant libraries.  Say "none" for none.
  803. ! EOM
  804. ! case "$libpth" in
  805. ! '') dflt='none';;
  806. ! *)
  807. !     set X $libpth
  808. !     shift
  809. !     dflt=${1+"$@"}
  810. !     ;;
  811. ! esac
  812. ! rp="Directories to use for library searches?"
  813. ! . ./myread
  814. ! case "$ans" in
  815. ! none) libpth=' ';;
  816. ! *) libpth="$ans";;
  817. ! esac
  818.   
  819.   : Looking for optional libraries
  820.   echo " "
  821. ***************
  822. *** 1617,1651 ****
  823.       dbm) thatlib=ndbm;;
  824.       *_s) thatlib=NONE;;
  825.       *) thatlib="${thislib}_s";;
  826. -     *) thatlib=NONE;;
  827.       esac
  828. !     yyy="$incpath/usr/ccs/lib $incpath/usr/lib $incpath/usr/ucblib"
  829. !     yyy="$yyy $incpath/usr/local/lib $incpath/lib"
  830. !     xxx=`./loc lib$thislib.a X $yyy`
  831.       if $test -f $xxx; then
  832.           echo "Found -l$thislib."
  833. !         case "$dflt" in
  834. !         *-l$thislib*|*-l$thatlib*);;
  835.           *) dflt="$dflt -l$thislib";;
  836.           esac
  837.       else
  838. !         xxx=`./loc lib$thislib.a X $libpth`
  839.           if $test -f $xxx; then
  840. !             echo "Found $xxx."
  841. !             case "$dflt" in
  842. !             *$xxx*);;
  843. !             *) dflt="$dflt $xxx";;
  844.               esac
  845.           else
  846. !             xxx=`./loc Slib$thislib.a X $xlibpth`
  847.               if $test -f $xxx; then
  848. !                 echo "Found -l$thislib."
  849. !                 case "$dflt" in
  850. !                 *-l$thislib*|*-l$thatlib*);;
  851.                   *) dflt="$dflt -l$thislib";;
  852.                   esac
  853.               else
  854. !                 echo "No -l$thislib."
  855.               fi
  856.           fi
  857.       fi
  858. --- 1906,1967 ----
  859.       dbm) thatlib=ndbm;;
  860.       *_s) thatlib=NONE;;
  861.       *) thatlib="${thislib}_s";;
  862.       esac
  863. !     xxx=`./loc lib$thislib.a X $libpth`
  864. !     yyy=`./loc lib$thatlib.a X $libpth`
  865. !     zzz=`./loc lib$thislib.so.[0-9]'*' X $libpth`
  866.       if $test -f $xxx; then
  867.           echo "Found -l$thislib."
  868. !         case " $dflt " in
  869. !         *"-l$thislib "*|*"-l$thatlib "*);;
  870.           *) dflt="$dflt -l$thislib";;
  871.           esac
  872. +     elif $test -f $yyy; then
  873. +         echo "Found -l$thatlib."
  874. +         case " $dflt " in
  875. +         *"-l$thatlib "*);;
  876. +         *) dflt="$dflt -l$thatlib";;
  877. +         esac
  878. +     elif $test -f $zzz; then
  879. +         echo "Found -l$thislib (shared only)."
  880. +         case " $dflt " in
  881. +         *"-l$thislib "*|*"-l$thatlib "*);;
  882. +         *) dflt="$dflt -l$thislib";;
  883. +         esac
  884.       else
  885. !         xxx=`./loc Slib$thislib.a X $xlibpth`
  886. !         yyy=`./loc Slib$thatlib.a X $xlibpth`
  887.           if $test -f $xxx; then
  888. !             echo "Found -l$thislib."
  889. !             case " $dflt " in
  890. !             *"-l$thislib "*|*"-l$thatlib "*);;
  891. !             *) dflt="$dflt -l$thislib";;
  892.               esac
  893. +         elif $test -f $yyy; then
  894. +             echo "Found -l$thatlib."
  895. +             case " $dflt " in
  896. +             *"-l$thatlib "*);;
  897. +             *) dflt="$dflt -l$thatlib";;
  898. +             esac
  899.           else
  900. !             xxx=`./loc lib$thislib.so X $libpth`
  901.               if $test -f $xxx; then
  902. !                 echo "Found -l$thislib (shared only)."
  903. !                 case " $dflt " in
  904. !                 *"-l$thislib "*|*"-l$thatlib "*);;
  905.                   *) dflt="$dflt -l$thislib";;
  906.                   esac
  907.               else
  908. !                 xxx=`./loc lib$thislib.so X $libpth`
  909. !                 if $test -f $xxx; then
  910. !                     echo "Found -l$thislib (shared only)."
  911. !                     case "$dflt" in
  912. !                     *-l$thislib*|*-l$thatlib*);;
  913. !                     *) dflt="$dflt -l$thislib";;
  914. !                     esac
  915. !                 else
  916. !                     echo "No -l$thislib."
  917. !                 fi
  918.               fi
  919.           fi
  920.       fi
  921. ***************
  922. *** 1745,1751 ****
  923.       esac
  924.       ;;
  925.   esac
  926. - libpth="$plibpth $libpth"
  927.   libnames='';
  928.   case "$libs" in
  929.   '') ;;
  930. --- 2061,2066 ----
  931. ***************
  932. *** 1761,1767 ****
  933.                   if test ! -f $try; then
  934.                       try=`./loc Slib$thislib.a blurfl/dyick $xlibpth`
  935.                       if test ! -f $try; then
  936. !                         try=''
  937.                       fi
  938.                   fi
  939.               fi
  940. --- 2076,2088 ----
  941.                   if test ! -f $try; then
  942.                       try=`./loc Slib$thislib.a blurfl/dyick $xlibpth`
  943.                       if test ! -f $try; then
  944. !                         try=`./loc lib$thislib.so.'*' blurfl/dyick $libpth`
  945. !                         if test ! -f $try; then
  946. !                             try=`./loc lib$thislib.so blurfl/dyick $libpth`
  947. !                             if test ! -f $try; then
  948. !                                 try=''
  949. !                             fi
  950. !                         fi
  951.                       fi
  952.                   fi
  953.               fi
  954. ***************
  955. *** 2028,2178 ****
  956.       esac;;
  957.   esac'
  958.   
  959. - : see how we invoke the C preprocessor
  960. - echo " "
  961. - echo "Now, how can we feed standard input to your C preprocessor..." >&4
  962. - cat <<'EOT' >testcpp.c
  963. - #define ABC abc
  964. - #define XYZ xyz
  965. - ABC.XYZ
  966. - EOT
  967. - cd ..
  968. - echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
  969. - chmod 755 cppstdin
  970. - wrapper=`pwd`/cppstdin
  971. - ok='false'
  972. - cd UU
  973. - if $test "X$cppstdin" != "X" && \
  974. -     $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
  975. -     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
  976. - then
  977. -     echo "You used to use $cppstdin $cppminus so we'll use that again."
  978. -     case "$cpprun" in
  979. -     '') echo "But let's see if we can live without a wrapper..." ;;
  980. -     *)
  981. -         if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
  982. -             $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
  983. -         then
  984. -             echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
  985. -             ok='true'
  986. -         else
  987. -             echo "(However, $cpprun $cpplast does not work, let's see...)"
  988. -         fi
  989. -         ;;
  990. -     esac
  991. - else
  992. -     case "$cppstdin" in
  993. -     '') ;;
  994. -     *)
  995. -         echo "Good old $cppstdin $cppminus does not seem to be of any help..."
  996. -         ;;
  997. -     esac
  998. - fi
  999. - if $ok; then
  1000. -     : nothing
  1001. - elif echo 'Maybe "'"$cc"' -E" will work...'; \
  1002. -     $cc -E <testcpp.c >testcpp.out 2>&1; \
  1003. -     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1004. -     echo "Yup, it does."
  1005. -     x_cpp="$cc -E"
  1006. -     x_minus='';
  1007. - elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
  1008. -     $cc -E - <testcpp.c >testcpp.out 2>&1; \
  1009. -     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1010. -     echo "Yup, it does."
  1011. -     x_cpp="$cc -E"
  1012. -     x_minus='-';
  1013. - elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
  1014. -     $cc -P <testcpp.c >testcpp.out 2>&1; \
  1015. -     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1016. -     echo "Yipee, that works!"
  1017. -     x_cpp="$cc -P"
  1018. -     x_minus='';
  1019. - elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
  1020. -     $cc -P - <testcpp.c >testcpp.out 2>&1; \
  1021. -     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1022. -     echo "At long last!"
  1023. -     x_cpp="$cc -P"
  1024. -     x_minus='-';
  1025. - elif echo 'No such luck, maybe "'$cpp'" will work...'; \
  1026. -     $cpp <testcpp.c >testcpp.out 2>&1; \
  1027. -     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1028. -     echo "It works!"
  1029. -     x_cpp="$cpp"
  1030. -     x_minus='';
  1031. - elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
  1032. -     $cpp - <testcpp.c >testcpp.out 2>&1; \
  1033. -     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1034. -     echo "Hooray, it works!  I was beginning to wonder."
  1035. -     x_cpp="$cpp"
  1036. -     x_minus='-';
  1037. - elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
  1038. -     $wrapper <testcpp.c >testcpp.out 2>&1; \
  1039. -     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1040. -     x_cpp="$wrapper"
  1041. -     x_minus=''
  1042. -     echo "Eureka!"
  1043. - else
  1044. -     dflt=''
  1045. -     rp="No dice.  I can't find a C preprocessor.  Name one:"
  1046. -     . ./myread
  1047. -     x_cpp="$ans"
  1048. -     x_minus=''
  1049. -     $x_cpp <testcpp.c >testcpp.out 2>&1
  1050. -     if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  1051. -         echo "OK, that will do." >&4
  1052. -     else
  1053. - echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
  1054. -         exit 1
  1055. -     fi
  1056. - fi
  1057. - case "$ok" in
  1058. - false)
  1059. -     cppstdin="$x_cpp"
  1060. -     cppminus="$x_minus"
  1061. -     cpprun="$x_cpp"
  1062. -     cpplast="$x_minus"
  1063. -     set X $x_cpp
  1064. -     shift
  1065. -     case "$1" in
  1066. -     "$cpp")
  1067. -         echo "Perhaps can we force $cc -E using a wrapper..."
  1068. -         if $wrapper <testcpp.c >testcpp.out 2>&1; \
  1069. -             $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
  1070. -         then
  1071. -             echo "Yup, we can."
  1072. -             cppstdin="$wrapper"
  1073. -             cppminus='';
  1074. -         else
  1075. -             echo "Nope, we'll have to live without it..."
  1076. -         fi
  1077. -         ;;
  1078. -     esac
  1079. -     case "$cpprun" in
  1080. -     "$wrapper")
  1081. -         cpprun=''
  1082. -         cpplast=''
  1083. -         ;;
  1084. -     esac
  1085. -     ;;
  1086. - esac
  1087. - case "$cppstdin" in
  1088. - "$wrapper") ;;
  1089. - *) $rm -f $wrapper;;
  1090. - esac
  1091. - $rm -f testcpp.c testcpp.out
  1092.   : determine filename position in cpp output
  1093.   echo " "
  1094.   echo "Computing filename position in cpp output for #include directives..." >&4
  1095.   echo '#include <stdio.h>' > foo.c
  1096.   $cat >fieldn <<EOF
  1097.   $startsh
  1098. ! $cppstdin $cppminus $cppflags <foo.c 2>/dev/null | \
  1099.   $grep '^[     ]*#.*stdio\.h' | \
  1100.   while read cline; do
  1101.       pos=1
  1102. --- 2349,2361 ----
  1103.       esac;;
  1104.   esac'
  1105.   
  1106.   : determine filename position in cpp output
  1107.   echo " "
  1108.   echo "Computing filename position in cpp output for #include directives..." >&4
  1109.   echo '#include <stdio.h>' > foo.c
  1110.   $cat >fieldn <<EOF
  1111.   $startsh
  1112. ! $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
  1113.   $grep '^[     ]*#.*stdio\.h' | \
  1114.   while read cline; do
  1115.       pos=1
  1116. ***************
  1117. *** 2824,2829 ****
  1118. --- 3007,3013 ----
  1119.   fi
  1120.   . ./myread
  1121.   lex="$ans"
  1122.   : see if we should include -ll
  1123.   echo " "
  1124.   case "$lex" in
  1125. ***************
  1126. *** 2866,2876 ****
  1127.       dflt="$yacc";;
  1128.   esac
  1129.   echo " "
  1130.   if $test -f "$bison"; then
  1131. !     rp='Which compiler compiler (yacc or bison -y) shall I use?'
  1132. ! else
  1133. !     rp='Which compiler compiler shall I use?'
  1134.   fi
  1135.   . ./myread
  1136.   yacc="$ans"
  1137.   case "$yacc" in
  1138. --- 3050,3064 ----
  1139.       dflt="$yacc";;
  1140.   esac
  1141.   echo " "
  1142. + comp='yacc'
  1143. + if $test -f "$byacc"; then
  1144. +     dflt="$byacc"
  1145. +     comp="byacc or $comp"
  1146. + fi
  1147.   if $test -f "$bison"; then
  1148. !     comp="$comp or bison -y"
  1149.   fi
  1150. + rp="Which compiler compiler ($comp) shall I use?"
  1151.   . ./myread
  1152.   yacc="$ans"
  1153.   case "$yacc" in
  1154. ***************
  1155. *** 2888,2893 ****
  1156. --- 3076,3085 ----
  1157.   : see if we should include -ly
  1158.   echo " "
  1159.   case "$yacc" in
  1160. + *byacc*)
  1161. +     echo "You are using byacc, so I won't look for a yacc library." >&4
  1162. +     libyacc=''
  1163. +     ;;
  1164.   *yacc)
  1165.       xxx=`./loc liby.a x $libpth`
  1166.       case "$xxx" in
  1167. ***************
  1168. *** 3188,3194 ****
  1169.   main(int argc, char *argv[]) {
  1170.       exit(0);}
  1171.   EOCP
  1172. ! if $cc -c prototype.c >prototype.out 2>&1 ; then
  1173.       echo "Your C compiler appears to support function prototypes."
  1174.       val="$define"
  1175.   else
  1176. --- 3380,3386 ----
  1177.   main(int argc, char *argv[]) {
  1178.       exit(0);}
  1179.   EOCP
  1180. ! if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
  1181.       echo "Your C compiler appears to support function prototypes."
  1182.       val="$define"
  1183.   else
  1184. ***************
  1185. *** 3261,3299 ****
  1186.   set d_time
  1187.   eval $setvar
  1188.   
  1189. - : define an alternate in-header-list? function
  1190. - inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
  1191. - cont=true; xxf="echo \"<\$1> found.\" >&4";
  1192. - case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
  1193. - *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
  1194. - esac;
  1195. - case $# in 4) instead=instead;; *) instead="at last";; esac;
  1196. - while $test "$cont"; do
  1197. -     xxx=`./findhdr $1`
  1198. -     var=$2; eval "was=\$$2";
  1199. -     if $test "$xxx" && $test -r "$xxx";
  1200. -     then eval $xxf;
  1201. -         eval "case \"\$$var\" in $undef) . whoa; esac"; eval "$var=\$td";
  1202. -         cont="";
  1203. -     else eval $xxnf;
  1204. -         eval "case \"\$$var\" in $define) . whoa; esac"; eval "$var=\$tu"; fi;
  1205. -     set $yyy; shift; shift; yyy=$@;
  1206. -     case $# in 0) cont="";;
  1207. -     2) xxf="echo \"but I found <\$1> $instead.\" >&4";
  1208. -         xxnf="echo \"and I did not find <\$1> either.\" >&4";;
  1209. -     *) xxf="echo \"but I found <\$1\> instead.\" >&4";
  1210. -         xxnf="echo \"there is no <\$1>, ...\" >&4";;
  1211. -     esac;
  1212. - done;
  1213. - while $test "$yyy";
  1214. - do set $yyy; var=$2; eval "was=\$$2";
  1215. -     eval "case \"\$$var\" in $define) . whoa; esac"; eval "$var=\$tu";
  1216. -     set $yyy; shift; shift; yyy=$@;
  1217. - done'
  1218.   : see if stdarg is available
  1219. ! set stdarg.h i_stdarg
  1220. ! eval $inhdr
  1221.   
  1222.   : see if prototypes support variable argument declarations
  1223.   echo " "
  1224. --- 3453,3554 ----
  1225.   set d_time
  1226.   eval $setvar
  1227.   
  1228.   : see if stdarg is available
  1229. ! echo " "
  1230. ! if $test `./findhdr stdarg.h`; then
  1231. !     echo "<stdarg.h> found." >&4
  1232. !     valstd="$define"
  1233. ! else
  1234. !     echo "<stdarg.h> NOT found." >&4
  1235. !     valstd="$undef"
  1236. ! fi
  1237. ! : see if varags is available
  1238. ! echo " "
  1239. ! if $test `./findhdr varargs.h`; then
  1240. !     echo "<varargs.h> found." >&4
  1241. ! else
  1242. !     echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
  1243. ! fi
  1244. ! : set up the varargs testing programs
  1245. ! $cat > varargs.c <<EOP
  1246. ! #ifdef I_STDARG
  1247. ! #include <stdarg.h>
  1248. ! #endif
  1249. ! #ifdef I_VARARGS
  1250. ! #include <varargs.h>
  1251. ! #endif
  1252. ! #ifdef I_STDARG
  1253. ! int f(char *p, ...)
  1254. ! #else
  1255. ! int f(va_alist)
  1256. ! va_dcl
  1257. ! #endif
  1258. ! {
  1259. !     va_list ap;
  1260. ! #ifndef I_STDARG
  1261. !     char *p;
  1262. ! #endif
  1263. ! #ifdef I_STDARG
  1264. !     va_start(ap,p);
  1265. ! #else
  1266. !     va_start(ap);
  1267. !     p = va_arg(ap, char *);
  1268. ! #endif
  1269. !     va_end(ap);
  1270. ! }
  1271. ! EOP
  1272. ! $cat > varargs <<EOP
  1273. ! if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
  1274. !     echo "true"
  1275. ! else
  1276. !     echo "false"
  1277. ! fi
  1278. ! $rm -f varargs.o
  1279. ! EOP
  1280. ! chmod +x varargs
  1281. ! : now check which varargs header should be included
  1282. ! echo " "
  1283. ! i_varhdr=''
  1284. ! case "$valstd" in
  1285. ! "$define")
  1286. !     if `./varargs I_STDARG`; then
  1287. !         val='stdarg.h'
  1288. !     elif `./varargs I_VARARGS`; then
  1289. !         val='varargs.h'
  1290. !     fi
  1291. !     ;;
  1292. ! *)
  1293. !     if `./varargs I_VARARGS`; then
  1294. !         val='varargs.h'
  1295. !     fi
  1296. !     ;;
  1297. ! esac
  1298. ! case "$val" in
  1299. ! '')
  1300. ! echo "I could not find the definition for va_dcl... You have problems..." >&4
  1301. !     val="$undef"; set i_stdarg; eval $setvar
  1302. !     val="$undef"; set i_varargs; eval $setvar
  1303. !     ;;
  1304. ! *) 
  1305. !     set i_varhdr
  1306. !     eval $setvar
  1307. !     case "$i_varhdr" in
  1308. !     stdarg.h)
  1309. !         val="$define"; set i_stdarg; eval $setvar
  1310. !         val="$undef"; set i_varargs; eval $setvar
  1311. !         ;;
  1312. !     varargs.h)
  1313. !         val="$undef"; set i_stdarg; eval $setvar
  1314. !         val="$define"; set i_varargs; eval $setvar
  1315. !         ;;
  1316. !     esac
  1317. !     echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
  1318. ! esac
  1319. ! $rm -f varargs*
  1320.   
  1321.   : see if prototypes support variable argument declarations
  1322.   echo " "
  1323. ***************
  1324. *** 3342,3347 ****
  1325. --- 3597,3632 ----
  1326.   *) warnflags="$ans";;
  1327.   esac
  1328.   
  1329. + : define an alternate in-header-list? function
  1330. + inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
  1331. + cont=true; xxf="echo \"<\$1> found.\" >&4";
  1332. + case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
  1333. + *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
  1334. + esac;
  1335. + case $# in 4) instead=instead;; *) instead="at last";; esac;
  1336. + while $test "$cont"; do
  1337. +     xxx=`./findhdr $1`
  1338. +     var=$2; eval "was=\$$2";
  1339. +     if $test "$xxx" && $test -r "$xxx";
  1340. +     then eval $xxf;
  1341. +         eval "case \"\$$var\" in $undef) . whoa; esac"; eval "$var=\$td";
  1342. +         cont="";
  1343. +     else eval $xxnf;
  1344. +         eval "case \"\$$var\" in $define) . whoa; esac"; eval "$var=\$tu"; fi;
  1345. +     set $yyy; shift; shift; yyy=$@;
  1346. +     case $# in 0) cont="";;
  1347. +     2) xxf="echo \"but I found <\$1> $instead.\" >&4";
  1348. +         xxnf="echo \"and I did not find <\$1> either.\" >&4";;
  1349. +     *) xxf="echo \"but I found <\$1\> instead.\" >&4";
  1350. +         xxnf="echo \"there is no <\$1>, ...\" >&4";;
  1351. +     esac;
  1352. + done;
  1353. + while $test "$yyy";
  1354. + do set $yyy; var=$2; eval "was=\$$2";
  1355. +     eval "case \"\$$var\" in $define) . whoa; esac"; eval "$var=\$tu";
  1356. +     set $yyy; shift; shift; yyy=$@;
  1357. + done'
  1358.   : see if this is a sys/file.h system
  1359.   val=''
  1360.   set sys/file.h val
  1361. ***************
  1362. *** 3493,3576 ****
  1363.   set unistd.h i_unistd
  1364.   eval $inhdr
  1365.   
  1366. - : see if this is a varargs system
  1367. - echo " "
  1368. - if $test `./findhdr varargs.h`; then
  1369. -     val="$define"
  1370. -     echo "<varargs.h> found." >&4
  1371. - else
  1372. -     val="$undef"
  1373. -     echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
  1374. - fi
  1375. - set i_varargs
  1376. - eval $setvar
  1377. - : set up the varargs testing programs
  1378. - $cat > varargs.c <<EOP
  1379. - #ifdef I_STDARG
  1380. - #include <stdarg.h>
  1381. - #endif
  1382. - #ifdef I_VARARGS
  1383. - #include <varargs.h>
  1384. - #endif
  1385. - #ifdef I_STDARG
  1386. - int f(char *p, ...)
  1387. - #else
  1388. - int f(va_alist)
  1389. - va_dcl
  1390. - #endif
  1391. - {
  1392. -     va_list ap;
  1393. - #ifndef I_STDARG
  1394. -     char *p;
  1395. - #endif
  1396. - #ifdef I_STDARG
  1397. -     va_start(ap,p);
  1398. - #else
  1399. -     va_start(ap);
  1400. -     p = va_arg(ap, char *);
  1401. - #endif
  1402. -     va_end(ap);
  1403. - }
  1404. - EOP
  1405. - $cat > varargs <<EOP
  1406. - if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
  1407. -     echo "true"
  1408. - else
  1409. -     echo "false"
  1410. - fi
  1411. - $rm -f varargs.o
  1412. - EOP
  1413. - chmod +x varargs
  1414. - : now check which varargs header should be included
  1415. - echo " "
  1416. - i_varhdr=''
  1417. - case "$i_stdarg" in
  1418. - "$define")
  1419. -     if `./varargs I_STDARG`; then
  1420. -         i_varhdr='stdarg.h'
  1421. -         i_varargs="$undef"
  1422. -     elif `./varargs I_VARARGS`; then
  1423. -         i_varhdr='varargs.h'
  1424. -         i_stdarg="$undef"
  1425. -     fi
  1426. -     ;;
  1427. - *)
  1428. -     if `./varargs I_VARARGS`; then
  1429. -         i_varhdr='varargs.h'
  1430. -     fi
  1431. -     ;;
  1432. - esac
  1433. - case "$i_varhdr" in
  1434. - '')
  1435. - echo "I could not find the definition for va_dcl... You have problems..." >&4
  1436. -     ;;
  1437. - *) echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
  1438. - esac
  1439. - $rm -f varargs*
  1440.   : determine the name of a reasonable mailer
  1441.   case "$mailer" in
  1442.   '')
  1443. --- 3778,3783 ----
  1444. ***************
  1445. *** 3579,3585 ****
  1446.       elif $test -f "$_smail"; then
  1447.           dflt="$_smail"
  1448.       elif $test -f "$_rmail"; then
  1449. !         dflt="$rmail"
  1450.       elif $test -f /bin/mail; then
  1451.           dflt=/bin/mail
  1452.       else
  1453. --- 3786,3792 ----
  1454.       elif $test -f "$_smail"; then
  1455.           dflt="$_smail"
  1456.       elif $test -f "$_rmail"; then
  1457. !         dflt="$_rmail"
  1458.       elif $test -f /bin/mail; then
  1459.           dflt=/bin/mail
  1460.       else
  1461. ***************
  1462. *** 4188,4193 ****
  1463. --- 4395,4401 ----
  1464.   awk='$awk'
  1465.   bash='$bash'
  1466.   bison='$bison'
  1467. + byacc='$byacc'
  1468.   cat='$cat'
  1469.   chgrp='$chgrp'
  1470.   chmod='$chmod'
  1471. ***************
  1472. *** 4268,4273 ****
  1473. --- 4476,4482 ----
  1474.   binexp='$binexp'
  1475.   installbin='$installbin'
  1476.   cc='$cc'
  1477. + gccversion='$gccversion'
  1478.   ccflags='$ccflags'
  1479.   cppflags='$cppflags'
  1480.   ldflags='$ldflags'
  1481. ***************
  1482. *** 4304,4310 ****
  1483.   h_fcntl='$h_fcntl'
  1484.   h_sysfile='$h_sysfile'
  1485.   i_fcntl='$i_fcntl'
  1486. - i_stdarg='$i_stdarg'
  1487.   i_stddef='$i_stddef'
  1488.   i_stdlib='$i_stdlib'
  1489.   i_string='$i_string'
  1490. --- 4513,4518 ----
  1491. ***************
  1492. *** 4316,4326 ****
  1493. --- 4524,4536 ----
  1494.   i_time='$i_time'
  1495.   timeincl='$timeincl'
  1496.   i_unistd='$i_unistd'
  1497. + i_stdarg='$i_stdarg'
  1498.   i_varargs='$i_varargs'
  1499.   i_varhdr='$i_varhdr'
  1500.   lex='$lex'
  1501.   libc='$libc'
  1502.   liblex='$liblex'
  1503. + glibpth='$glibpth'
  1504.   libpth='$libpth'
  1505.   plibpth='$plibpth'
  1506.   xlibpth='$xlibpth'
  1507. ***************
  1508. *** 4465,4468 ****
  1509. --- 4675,4680 ----
  1510.   
  1511.   $rm -f kit*isdone ark*isdone
  1512.   $rm -rf UU
  1513.   : End of Configure
  1514.  
  1515. Index: manpage.c
  1516. Prereq: 2.0.1.41
  1517. *** manpage.c.old    1994/02/23 04:38:28
  1518. --- manpage.c    1994/05/12 02:24:51
  1519. ***************
  1520. *** 1,4 ****
  1521. ! /* $Id: manpage.c,v 2.0.1.41 1994/02/23 04:38:28 greyham Exp $
  1522.    * stuff to do with manual page outputing
  1523.    */
  1524.   
  1525. --- 1,4 ----
  1526. ! /* $Id: manpage.c,v 2.0.1.43 1994/05/12 02:24:51 greyham Exp $
  1527.    * stuff to do with manual page outputing
  1528.    */
  1529.   
  1530. ***************
  1531. *** 326,331 ****
  1532. --- 326,341 ----
  1533.   
  1534.   }
  1535.   
  1536. + /* output the phrase "a[n] <type name>" */
  1537. + void output_conjunction(text)
  1538. + char *text;
  1539. + {
  1540. +     output->character('a');
  1541. +     if (strchr("aAeEiIoOuU",text[0]))    output->character('n');
  1542. +     output->character(' ');
  1543. +     output->code(text);
  1544. + }
  1545.   /* output the description for an identifier; be it return value or param */
  1546.   static void output_identifier_description(comment, outfunc,
  1547.                               decl_spec, declarator)
  1548. ***************
  1549. *** 341,346 ****
  1550. --- 351,357 ----
  1551.       {
  1552.       int maxtaglen = 0;
  1553.       int descriptions = 0;
  1554. +     int entries = 0;
  1555.       Enumerator *e;
  1556.       int is_first = 1;
  1557.       boolean started = FALSE;
  1558. ***************
  1559. *** 359,419 ****
  1560.           int taglen = strlen(e->name);
  1561.           if (taglen > maxtaglen)    maxtaglen = taglen;
  1562.           if (e->comment)    descriptions = 1;
  1563.           }
  1564.   
  1565. !     output->text("Possible values for a");
  1566. !     if (strchr("aAeEiIoOuU",decl_spec->text[0]))    output->character('n');
  1567. !     output->character(' ');
  1568. !     output->code(decl_spec->text);
  1569. !     output->text(" are as follows:\n");
  1570. !     for (e = decl_spec->enum_list->first; e; e = e->next)
  1571.       {
  1572. !         /* don't print names with a leading underscore! */
  1573. !         if (e->name[0] == '_')    continue;
  1574. !         
  1575. !         if (e->group_comment)
  1576.           {
  1577. !         /* break out of table mode for the group comment */
  1578. !         if (started)
  1579.           {
  1580.               if (descriptions)
  1581. !             output->table_end();
  1582.               else
  1583. !             output->list_end();
  1584. !             started = FALSE;
  1585.           }
  1586. !         output->indent();
  1587. !         output_comment(e->group_comment);
  1588. !         }
  1589. !         if (!started)
  1590. !         {
  1591.           if (descriptions)
  1592. !             output->table_start();
  1593.           else
  1594. !             output->list_start();
  1595. !         started = TRUE;
  1596.           }
  1597. !         if (descriptions)
  1598. !         output->table_entry(e->name, maxtaglen, e->comment);
  1599. !         else
  1600.           {
  1601. !         if (!is_first)
  1602. !             output->list_separator();
  1603. !         is_first = 0;
  1604. !         output->list_entry(e->name);
  1605.           }
  1606.       }
  1607. -     if (started)
  1608. -     {
  1609. -         if (descriptions)
  1610. -         output->table_end();
  1611. -         else
  1612. -         output->list_end();
  1613. -     }
  1614.       } 
  1615.       else
  1616.       (*outfunc)(comment);
  1617. --- 370,446 ----
  1618.           int taglen = strlen(e->name);
  1619.           if (taglen > maxtaglen)    maxtaglen = taglen;
  1620.           if (e->comment)    descriptions = 1;
  1621. +         entries++;
  1622.           }
  1623.   
  1624. !     /* if there are a lot of them, the list may be automatically generated,
  1625. !      * and probably isn't wanted in every manual page.
  1626. !      */
  1627. !     if (entries > 20)
  1628.       {
  1629. !         char entries_s[15];
  1630. !         sprintf(entries_s, "%d", entries);
  1631. !         output->text("Since there are ");
  1632. !         output->text(entries_s);
  1633. !         output->text(" possible values for ");
  1634. !         output_conjunction(decl_spec->text);
  1635. !         output->text(", they are not all listed here.\n");
  1636. !     }
  1637. !     else
  1638. !     {
  1639. !         /* the number of possibilities is reasonable; list them all */
  1640. !         output->text("Possible values for ");
  1641. !         output_conjunction(decl_spec->text);
  1642. !         output->text(" are as follows:\n");
  1643. !     
  1644. !         for (e = decl_spec->enum_list->first; e; e = e->next)
  1645.           {
  1646. !         /* don't print names with a leading underscore! */
  1647. !         if (e->name[0] == '_')    continue;
  1648. !         
  1649. !         if (e->group_comment)
  1650. !         {
  1651. !             /* break out of table mode for the group comment */
  1652. !             if (started)
  1653. !             {
  1654. !             if (descriptions)
  1655. !                 output->table_end();
  1656. !             else
  1657. !                 output->list_end();
  1658. !             started = FALSE;
  1659. !             }
  1660. !             output->indent();
  1661. !             output_comment(e->group_comment);
  1662. !         }
  1663. !     
  1664. !         if (!started)
  1665.           {
  1666.               if (descriptions)
  1667. !             output->table_start();
  1668.               else
  1669. !             output->list_start();
  1670. !             started = TRUE;
  1671.           }
  1672. !     
  1673.           if (descriptions)
  1674. !             output->table_entry(e->name, maxtaglen, e->comment);
  1675.           else
  1676. !         {
  1677. !             if (!is_first)
  1678. !             output->list_separator();
  1679. !             is_first = 0;
  1680. !             output->list_entry(e->name);
  1681. !         }
  1682.           }
  1683. !     
  1684. !         if (started)
  1685.           {
  1686. !         if (descriptions)
  1687. !             output->table_end();
  1688. !         else
  1689. !             output->list_end();
  1690.           }
  1691.       }
  1692.       } 
  1693.       else
  1694.       (*outfunc)(comment);
  1695. ***************
  1696. *** 888,893 ****
  1697. --- 915,932 ----
  1698.       }
  1699.   }
  1700.   
  1701. + int exclude_section(section)
  1702. + const char *section;
  1703. + {
  1704. +     ExcludeSection *exclude;
  1705. +     for (exclude = first_excluded_section ; exclude ; exclude = exclude->next)
  1706. +     if (!strcmp(section, exclude->name)) return 1;
  1707. +     return 0;
  1708. + }
  1709.   /* Writes the entire contents of the manual page specified by basepage. */
  1710.   void
  1711.   output_manpage(firstpage, basepage, input_files, title, section)
  1712. ***************
  1713. *** 927,952 ****
  1714.       /* work out what we'll actually print as a terse description */
  1715.       terseout = group_terse ? group_terse : (terse ? terse : "Not Described");
  1716.   
  1717. !     if (!make_embeddable)
  1718. !     {
  1719. !     output->header(basepage, input_files, grouped,
  1720. !             title ? title : basepage->declarator->name, section);
  1721. !     }
  1722. !     output->section("NAME");
  1723.       
  1724.       /* output the names of all the stuff documented on this page */
  1725.       for (page = basepage; page; page = page->next)
  1726.       {
  1727. !     output->text(page->declarator->name);
  1728.   
  1729.       if (!group_together)    break;
  1730.   
  1731.       if (page->next)    output->text(",\n");
  1732.       }
  1733.   
  1734. !     output->character(' ');
  1735. !     output->dash();
  1736. !     output->character(' ');
  1737.       output->text(terseout);
  1738.       output->character('\n');
  1739.       
  1740. --- 966,986 ----
  1741.       /* work out what we'll actually print as a terse description */
  1742.       terseout = group_terse ? group_terse : (terse ? terse : "Not Described");
  1743.   
  1744. !     output->header(basepage, input_files, grouped,
  1745. !             title ? title : basepage->declarator->name, section);
  1746.       
  1747. +     output->name(NULL);
  1748.       /* output the names of all the stuff documented on this page */
  1749.       for (page = basepage; page; page = page->next)
  1750.       {
  1751. !     output->name(page->declarator->name);
  1752.   
  1753.       if (!group_together)    break;
  1754.   
  1755.       if (page->next)    output->text(",\n");
  1756.       }
  1757.   
  1758. !     output->terse_sep();
  1759.       output->text(terseout);
  1760.       output->character('\n');
  1761.       
  1762. ***************
  1763. *** 1090,1096 ****
  1764.       {
  1765.           next = section->next;
  1766.   
  1767. !         if (!section->been_output && section->text)
  1768.           {
  1769.           output->section(section->name);
  1770.           if (grouped) output->sub_section(page->declarator->name);
  1771. --- 1124,1131 ----
  1772.       {
  1773.           next = section->next;
  1774.   
  1775. !         if (!section->been_output && section->text &&
  1776. !          !exclude_section(section->name))
  1777.           {
  1778.           output->section(section->name);
  1779.           if (grouped) output->sub_section(page->declarator->name);
  1780. ***************
  1781. *** 1140,1146 ****
  1782.       for (also = firstpage; also && also == basepage; also = also->next)
  1783.           ;
  1784.       
  1785. !     if (also)    /* did we find at least one? */
  1786.       {
  1787.           int isfirst = 1;
  1788.   
  1789. --- 1175,1181 ----
  1790.       for (also = firstpage; also && also == basepage; also = also->next)
  1791.           ;
  1792.       
  1793. !     if (also && !exclude_section("SEE ALSO"))    /* did we find at least one? */
  1794.       {
  1795.           int isfirst = 1;
  1796.   
  1797.  
  1798. Index: fixexamp.in
  1799. Prereq: 2.0.1.1
  1800. *** fixexamp.in.old    1994/01/02 00:16:47
  1801. --- fixexamp.in    1994/05/12 01:29:35
  1802. ***************
  1803. *** 1,4 ****
  1804. ! # $Id: fixexamp.in,v 2.0.1.1 1994/01/02 00:16:47 greyham Exp $
  1805.   # Fix up c2man output for inclusion of examples in the c2man manual page.
  1806.   # This file gets processed to remove comments because some sed's can't handle
  1807.   # them. Can you believe it?.
  1808. --- 1,4 ----
  1809. ! # $Id: fixexamp.in,v 2.0.1.3 1994/05/12 01:29:35 greyham Exp $
  1810.   # Fix up c2man output for inclusion of examples in the c2man manual page.
  1811.   # This file gets processed to remove comments because some sed's can't handle
  1812.   # them. Can you believe it?.
  1813. ***************
  1814. *** 31,43 ****
  1815.   # surround all the .SH and .SS lines with page offset indents
  1816.   # the .ne line will force a page break before the .po is evaluated, in the case
  1817.   # where a .SH in an example is at the very bottom of the page. Otherwise the .SH
  1818. ! # could case the break, resulting in the wrong .po setting for the new page's
  1819.   # title line.
  1820.   /^\.S[SH] /{
  1821.   i\
  1822.   .br\
  1823.   .ne 3\
  1824. ! .RS -1i\
  1825.   .po +1i
  1826.   a\
  1827.   .po -1i\
  1828. --- 31,43 ----
  1829.   # surround all the .SH and .SS lines with page offset indents
  1830.   # the .ne line will force a page break before the .po is evaluated, in the case
  1831.   # where a .SH in an example is at the very bottom of the page. Otherwise the .SH
  1832. ! # could cause the break, resulting in the wrong .po setting for the new page's
  1833.   # title line.
  1834.   /^\.S[SH] /{
  1835.   i\
  1836.   .br\
  1837.   .ne 3\
  1838. ! .RE\
  1839.   .po +1i
  1840.   a\
  1841.   .po -1i\
  1842. ***************
  1843. *** 56,60 ****
  1844.   # up the line length again at the end of the example file
  1845.   $a\
  1846.   .ll \\n(CLu+0.5i\
  1847. ! .RS -1i
  1848.   
  1849. --- 56,60 ----
  1850.   # up the line length again at the end of the example file
  1851.   $a\
  1852.   .ll \\n(CLu+0.5i\
  1853. ! .RE
  1854.   
  1855.  
  1856. *** End of Patch 28 ***
  1857. -- 
  1858. Graham Stoney, Hardware/Software Engineer
  1859. Canon Information Systems Research Australia
  1860. Ph: + 61 2 805 2909    Fax: + 61 2 805 2929
  1861.  
  1862. exit 0 # Just in case...
  1863.