home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume42 / c2man-2.0 / part03 < prev    next >
Internet Message Format  |  1994-05-06  |  52KB

  1. From: greyham@research.canon.oz.au (Graham Stoney)
  2. Newsgroups: comp.sources.misc
  3. Subject: v42i057:  c2man-2.0 - automatic C documentation generator, Part03/09
  4. Date: 25 Apr 1994 22:30:12 -0500
  5. Organization: Canon Information Systems Research Australia
  6. Sender: kent@sparky.sterling.com
  7. Approved: kent@sparky.sterling.com
  8. Message-ID: <2pi1s4$jl4@sparky.sterling.com>
  9. References: <csm-v42i055=c2man-2.0.222803@sparky.sterling.com>
  10. Summary: a complete posting of the latest c2man: version 2.0 patchlevel 27
  11. X-Md4-Signature: efdbf00c3993eb95c3f9608678c2bf23
  12.  
  13. Submitted-by: greyham@research.canon.oz.au (Graham Stoney)
  14. Posting-number: Volume 42, Issue 57
  15. Archive-name: c2man-2.0/part03
  16. Environment: UNIX, DOS, OS/2, lex, yacc
  17.  
  18. #! /bin/sh
  19. #
  20. # This is c2man version 2.0 at patchlevel 27.
  21. # Make a new directory for the c2man sources, cd to it, and run kits 1 up
  22. # to 9 through sh.  When all 9 kits have been run, read README.
  23. #
  24. echo " "
  25. cat <<EOM
  26. This is c2man 2.0 at patchlevel 27, kit 3 (of 9):
  27. If this shell archive is complete, the line "End of kit 3 (of 9)"
  28. will echo at the end.
  29. EOM
  30. export PATH || (echo "Please use sh to unpack this archive." ; kill $$)
  31. mkdir  2>/dev/null
  32. echo Extracting Configure:AB
  33. sed >Configure:AB <<'!STUFFY!FUNK!' -e 's/X//'
  34. Xset access d_access
  35. Xeval $inlibc
  36. X
  37. X: locate the flags for 'access()'
  38. Xcase "$d_access" in
  39. X"$define")
  40. X    echo " "
  41. X    $cat >access.c <<'EOCP'
  42. X#include <sys/types.h>
  43. X#ifdef I_FCNTL
  44. X#include <fcntl.h>
  45. X#endif
  46. X#ifdef I_SYS_FILE
  47. X#include <sys/file.h>
  48. X#endif
  49. X#ifdef I_UNISTD
  50. X#include <unistd.h>
  51. X#endif
  52. Xmain() {
  53. X    exit(R_OK);
  54. X}
  55. XEOCP
  56. X    : check sys/file.h first, no particular reason here
  57. X    if $test `./findhdr sys/file.h` && \
  58. X        $cc $cppflags -DI_SYS_FILE access.c -o access >/dev/null 2>&1 ; then
  59. X        h_sysfile=true;
  60. X        echo "<sys/file.h> defines the *_OK access constants." >&4
  61. X    elif $test `./findhdr fcntl.h` && \
  62. X        $cc $cppflags -DI_FCNTL access.c -o access >/dev/null 2>&1 ; then
  63. X        h_fcntl=true;
  64. X        echo "<fcntl.h> defines the *_OK access constants." >&4
  65. X    elif $test `./findhdr unistd.h` && \
  66. X        $cc $cppflags -DI_UNISTD access.c -o access >/dev/null 2>&1 ; then
  67. X        echo "<unistd.h> defines the *_OK access constants." >&4
  68. X    else
  69. X        echo "I can't find the four *_OK access constants--I'll use mine." >&4
  70. X    fi
  71. X    ;;
  72. Xesac
  73. X$rm -f access*
  74. X
  75. X: function used to set $1 to $val
  76. Xsetvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
  77. Xcase "$val$was" in
  78. X$define$undef) . whoa; eval "$var=\$td";;
  79. X$undef$define) . whoa; eval "$var=\$tu";;
  80. X*) eval "$var=$val";;
  81. Xesac'
  82. X
  83. X: check for const keyword
  84. Xecho " "
  85. Xecho 'Checking to see if your C compiler knows about "const"...' >&4
  86. X$cat >const.c <<'EOCP'
  87. Xtypedef struct spug { int drokk; } spug;
  88. Xmain()
  89. X{
  90. X    const char *foo;
  91. X    const spug y;
  92. X}
  93. XEOCP
  94. Xif $cc -c $ccflags const.c >/dev/null 2>&1 ; then
  95. X    val="$define"
  96. X    echo "Yup, it does."
  97. Xelse
  98. X    val="$undef"
  99. X    echo "Nope, it doesn't."
  100. Xfi
  101. Xset d_const
  102. Xeval $setvar
  103. X
  104. X: see how we invoke the C preprocessor
  105. X$cat <<EOM
  106. X
  107. X$package needs to be able to preprocess its input files in a mode which
  108. Xpreserves comments, which is often not the default behaviour.  It should run
  109. Xthe C preprocessor you will use when compiling your own source code, which
  110. Xshould be ISO/ANSI C compliant if you want $package to handle the latest
  111. Xstandard C.  I will try to guess, but I might guess wrongly because it is not
  112. Xnecessarily the same preprocessor used to build $package.
  113. X
  114. XEOM
  115. X$cat <<'EOT' >testcpp.c
  116. X#define ABC abc
  117. X#define XYZ xyz
  118. XABC.XYZ
  119. X/* comment */
  120. XEOT
  121. X:
  122. Xif $test "X$cppfilecom" != "X" && \
  123. X    $cppfilecom testcpp.c </dev/null >testcpp.out 2>/dev/null && \
  124. X    $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 && \
  125. X    $contains comment testcpp.out >/dev/null 2>&1
  126. Xthen
  127. X    echo "You used to use $cppfilecom so we'll use that again."
  128. Xelif echo 'Maybe "'$cc' -E -C" will work...' && \
  129. X    $cc -E -C testcpp.c </dev/null >testcpp.out 2>/dev/null && \
  130. X    $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 && \
  131. X    $contains comment testcpp.out >/dev/null 2>&1
  132. Xthen
  133. X    echo "It works!"
  134. X    cppfilecom="$cc -E -C"
  135. Xelif echo 'Nope...maybe "'"$cc"' -P -C" will work...' && \
  136. X    $cc -P -C testcpp.c </dev/null >testcpp.out 2>/dev/null && \
  137. X    $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 && \
  138. X    $contains comment testcpp.out >/dev/null 2>&1
  139. Xthen
  140. X    echo "Yup, that does."
  141. X    cppfilecom="$cc -P -C"
  142. Xelif echo 'No such luck, maybe "'"$cpp"' -C" will work...' && \
  143. X    $cpp -C testcpp.c </dev/null >testcpp.out 2>/dev/null && \
  144. X    $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 && \
  145. X    $contains comment testcpp.out >/dev/null 2>&1
  146. Xthen
  147. X    echo "Yup, it does."
  148. X    cppfilecom="$cpp -C"
  149. Xelse
  150. X    cppfilecom=''
  151. X    $cat <<'EOM'
  152. XI can't find a C preprocessor that will preserve comments. Please name one.
  153. XEOM
  154. Xfi
  155. X:
  156. Xdflt="$cppfilecom"
  157. Xcont=true
  158. Xwhile $test "$cont" ; do
  159. X    echo " "
  160. X    rp="How should $package run your preprocessor preserving comments?"
  161. X    . ./myread
  162. X    cppfilecom="$ans"
  163. X    $cppfilecom testcpp.c >testcpp.out 2>&1
  164. X    if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 && \
  165. X        $contains comment testcpp.out >/dev/null 2>&1
  166. X    then
  167. X        echo "OK, that will do."
  168. X        cont=''
  169. X    else
  170. X        echo "Sorry, I can't get that to work."
  171. X    fi
  172. Xdone
  173. X
  174. X: Now see if it ignores header files.
  175. Xcp testcpp.c testcpp.h
  176. X$cppfilecom testcpp.h >testcpp.out 2>&1
  177. Xif $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 && \
  178. X    $contains comment testcpp.out >/dev/null 2>&1
  179. Xthen
  180. X    echo "Terrific; it processes .h files passed on the command line too."
  181. X    val="$undef"
  182. Xelse
  183. X    echo "It ignores .h files on the command line; pity."
  184. X    val="$define"
  185. Xfi
  186. Xset d_cppignhdrs
  187. Xeval $setvar
  188. X
  189. X: Now see how to send stdin to it.
  190. Xecho " "
  191. Xcp testcpp.c testcpp.h
  192. X$cppfilecom <testcpp.h >testcpp.out 2>&1
  193. Xif $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 && \
  194. X    $contains comment testcpp.out >/dev/null 2>&1
  195. Xthen
  196. X    echo "Great; and it will read stdin if passed no arguments."
  197. X    val="$define"
  198. X    cppstdinflags=''
  199. Xelse
  200. X    $cppfilecom - <testcpp.h >testcpp.out 2>&1
  201. X    if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 && \
  202. X        $contains comment testcpp.out >/dev/null 2>&1
  203. X    then
  204. X        echo "Great; and it can read stdin by passing it '-'."
  205. X        val="$define"
  206. X        cppstdinflags='-'
  207. X    else
  208. X        $cat <<FOO
  209. XUnfortunately, I can't find an easy way to get that preprocessor to read from
  210. Xstandard input. Do you know any flags I can pass it to get it to do so?
  211. XIf that preprocessor can't read directly form standard input, answer 'none'.
  212. X
  213. XFOO
  214. X    val='dunno'
  215. X    while $test "$val" = "dunno"; do
  216. X        rp='Flags to get preprocessor to read stdin?'
  217. X        dflt='none'
  218. X        . ./myread
  219. X        if $test $ans = 'none'; then
  220. X            echo "Oh well, if $package wants it done, it will do it for itself."
  221. X            val="$undef"
  222. X        else
  223. X            $cppfilecom $ans <testcpp.h >testcpp.out 2>&1
  224. X            if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 && \
  225. X                $contains comment testcpp.out >/dev/null 2>&1
  226. X            then
  227. X                echo "Good; that works fine."
  228. X                val="$define"
  229. X                cppstdinflags="$ans"
  230. X            else
  231. X                echo "Sorry, I couldn't get that to work."
  232. X            fi
  233. X        fi
  234. X    done
  235. X    fi
  236. Xfi
  237. Xset d_cppcanstdin
  238. Xeval $setvar
  239. X
  240. X: cleanup cpp test files anyway
  241. X$rm -f testcpp.*
  242. X
  243. X: see if we can have long filenames
  244. Xecho " "
  245. Xrmlist="$rmlist /tmp/cf$$"
  246. X$test -d /tmp/cf$$ || mkdir /tmp/cf$$
  247. Xfirst=123456789abcdef
  248. Xsecond=/tmp/cf$$/$first
  249. X$rm -f $first $second
  250. Xif (echo hi >$first) 2>/dev/null; then
  251. X    if $test -f 123456789abcde; then
  252. X        echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
  253. X        val="$undef"
  254. X    else
  255. X        if (echo hi >$second) 2>/dev/null; then
  256. X            if $test -f /tmp/cf$$/123456789abcde; then
  257. X                $cat <<'EOM'
  258. XThat's peculiar... You can have filenames longer than 14 characters, but only
  259. Xon some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
  260. XI shall consider your system cannot support long filenames at all.
  261. XEOM
  262. X                val="$undef"
  263. X            else
  264. X                echo 'You can have filenames longer than 14 characters.' >&4
  265. X                val="$define"
  266. X            fi
  267. X        else
  268. X            $cat <<'EOM'
  269. XHow confusing! Some of your filesystems are sane enough to allow filenames
  270. Xlonger than 14 characters but some others like /tmp can't even think about them.
  271. XSo, for now on, I shall assume your kernel does not allow them at all.
  272. XEOM
  273. X            val="$undef"
  274. X        fi
  275. X    fi
  276. Xelse
  277. X    $cat <<'EOM'
  278. XYou can't have filenames longer than 14 chars.  You can't even think about them!
  279. XEOM
  280. X    val="$undef"
  281. Xfi 
  282. Xset d_flexfnam
  283. Xeval $setvar
  284. X$rm -rf /tmp/cf$$ 123456789abcde*
  285. X
  286. X: see which of string.h or strings.h is needed
  287. Xecho " "
  288. Xstrings=`./findhdr string.h`
  289. Xif $test "$strings" && $test -r "$strings"; then
  290. X    echo "Using <string.h> instead of <strings.h>." >&4
  291. X    val="$define"
  292. Xelse
  293. X    val="$undef"
  294. X    strings=`./findhdr strings.h`
  295. X    if $test "$strings" && $test -r "$strings"; then
  296. X        echo "Using <strings.h> instead of <string.h>." >&4
  297. X    else
  298. X        echo "No string header found -- You'll surely have problems." >&4
  299. X    fi
  300. Xfi
  301. Xset i_string
  302. Xeval $setvar
  303. Xcase "$i_string" in
  304. X"$undef") strings=`./findhdr strings.h`;;
  305. X*)      strings=`./findhdr string.h`;;
  306. Xesac
  307. X
  308. X: index or strchr
  309. Xecho " "
  310. Xif set index val -f; eval $csym; $val; then
  311. X    if set strchr val -f d_strchr; eval $csym; $val; then
  312. X        if $contains strchr "$strings" >/dev/null 2>&1 ; then
  313. X            val="$define"
  314. X            vali="$undef"
  315. X            echo "strchr() found." >&4
  316. X        else
  317. X            val="$undef"
  318. X            vali="$define"
  319. X            echo "index() found." >&4
  320. X        fi
  321. X    else
  322. X        val="$undef"
  323. X        vali="$define"
  324. X        echo "index() found." >&4
  325. X    fi
  326. Xelse
  327. X    if set strchr val -f d_strchr; eval $csym; $val; then
  328. X        val="$define"
  329. X        vali="$undef"
  330. X        echo "strchr() found." >&4
  331. X    else
  332. X        echo "No index() or strchr() found!" >&4
  333. X        val="$undef"
  334. X        vali="$undef"
  335. X    fi
  336. Xfi
  337. Xset d_strchr; eval $setvar
  338. Xval="$vali"
  339. Xset d_index; eval $setvar
  340. X
  341. X: see if link exists
  342. Xset link d_link
  343. Xeval $inlibc
  344. X
  345. X: Locate the flags for 'open()'
  346. Xecho " "
  347. X$cat >open3.c <<'EOCP'
  348. X#include <sys/types.h>
  349. X#ifdef I_FCNTL
  350. X#include <fcntl.h>
  351. X#endif
  352. X#ifdef I_SYS_FILE
  353. X#include <sys/file.h>
  354. X#endif
  355. Xmain() {
  356. X    if(O_RDONLY);
  357. X#ifdef O_TRUNC
  358. X    exit(0);
  359. X#else
  360. X    exit(1);
  361. X#endif
  362. X}
  363. XEOCP
  364. X: check sys/file.h first to get FREAD on Sun
  365. Xif $test `./findhdr sys/file.h` && \
  366. X        $cc $cppflags "-DI_SYS_FILE" open3.c -o open3 >/dev/null 2>&1 ; then
  367. X    h_sysfile=true;
  368. X    echo "<sys/file.h> defines the O_* constants..." >&4
  369. X    if ./open3; then
  370. X        echo "and you have the 3 argument form of open()." >&4
  371. X        val="$define"
  372. X    else
  373. X        echo "but not the 3 argument form of open().  Oh, well." >&4
  374. X        val="$undef"
  375. X    fi
  376. Xelif $test `./findhdr fcntl.h` && \
  377. X        $cc "-DI_FCNTL" open3.c -o open3 >/dev/null 2>&1 ; then
  378. X    h_fcntl=true;
  379. X    echo "<fcntl.h> defines the O_* constants..." >&4
  380. X    if ./open3; then
  381. X        echo "and you have the 3 argument form of open()." >&4
  382. X        val="$define"
  383. X    else
  384. X        echo "but not the 3 argument form of open().  Oh, well." >&4
  385. X        val="$undef"
  386. X    fi
  387. Xelse
  388. X    val="$undef"
  389. X    echo "I can't find the O_* constant definitions!  You got problems." >&4
  390. Xfi
  391. Xset d_open3
  392. Xeval $setvar
  393. X$rm -f open3*
  394. X
  395. X: see if strftime exists
  396. Xset strftime d_strftime
  397. Xeval $inlibc
  398. X
  399. X: see if strstr exists
  400. Xset strstr d_strstr
  401. Xeval $inlibc
  402. X
  403. X: see if symlink exists
  404. Xset symlink d_symlink
  405. Xeval $inlibc
  406. X
  407. X: check for volatile keyword
  408. Xecho " "
  409. Xecho 'Checking to see if your C compiler knows about "volatile"...' >&4
  410. X$cat >try.c <<'EOCP'
  411. Xmain()
  412. X{
  413. X    typedef struct _goo_struct goo_struct;
  414. X    goo_struct * volatile goo = ((goo_struct *)0);
  415. X    struct _goo_struct {
  416. X        long long_int;
  417. X        int reg_int;
  418. X        char char_var;
  419. X    };
  420. X    typedef unsigned short foo_t;
  421. X    char *volatile foo;
  422. X    volatile int bar;
  423. X    volatile foo_t blech;
  424. X    foo = foo;
  425. X}
  426. XEOCP
  427. Xif $cc -c $ccflags try.c >/dev/null 2>&1 ; then
  428. X    val="$define"
  429. X    echo "Yup, it does."
  430. Xelse
  431. X    val="$undef"
  432. X    echo "Nope, it doesn't."
  433. Xfi
  434. Xset d_volatile
  435. Xeval $setvar
  436. X$rm -f try.*
  437. X
  438. X: preserve RCS keywords in files with variable substitution, grrr
  439. XId='$Id'
  440. X
  441. X: is AFS running?
  442. Xecho " "
  443. Xif test -d /afs; then
  444. X    echo "AFS may be running... I'll be extra cautious then..." >&4
  445. X    afs=true
  446. Xelse
  447. X    echo "AFS does not seem to be running..." >&4
  448. X    afs=false
  449. Xfi
  450. X
  451. X: determine where public executables go
  452. Xecho " "
  453. Xcase "$bin" in
  454. X'')
  455. X    dflt=`./loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin`
  456. X    ;;
  457. X*)
  458. X    dflt="$bin"
  459. X    ;;
  460. Xesac
  461. Xfn=d~
  462. Xrp='Pathname where the public executables will reside?'
  463. X. ./getfile
  464. Xbin="$ans"
  465. Xbinexp="$ansexp"
  466. Xif $afs; then
  467. X    $cat <<EOM
  468. X
  469. XSince you are running AFS, I need to distinguish the directory in which
  470. Xexecutables reside from the directory in which they are installed (and from
  471. Xwhich they are presumably copied to the former directory by occult means).
  472. X
  473. XEOM
  474. X    case "$installbin" in
  475. X    '') dflt=`echo $binexp | sed 's#^/afs/#/afs/.#'`;;
  476. X    *) dflt="$installbin";;
  477. X    esac
  478. X    fn=de~
  479. X    rp='Where will public executables be installed?'
  480. X    . ./getfile
  481. X    installbin="$ans"
  482. Xelse
  483. X    installbin="$binexp"
  484. Xfi
  485. X
  486. X: check for void type
  487. Xecho " "
  488. X$cat >&4 <<EOM
  489. XChecking to see how well your C compiler groks the void type...
  490. X
  491. X  Support flag bits are:
  492. X    1: basic void declarations.
  493. X    2: arrays of pointers to functions returning void.
  494. X    4: operations between pointers to and addresses of void functions.
  495. X    8: generic void pointers.
  496. X
  497. XEOM
  498. Xcase "$voidflags" in
  499. X'')
  500. X    $cat >try.c <<'EOCP'
  501. X#if TRY & 1
  502. Xvoid main() {
  503. X#else
  504. Xmain() {
  505. X#endif
  506. X    extern void moo();    /* function returning void */
  507. X    void (*goo)();        /* ptr to func returning void */
  508. X#if TRY & 8
  509. X    void *hue;        /* generic ptr */
  510. X#endif
  511. X#if TRY & 2
  512. X    void (*foo[10])();
  513. X#endif
  514. X
  515. X#if TRY & 4
  516. X    if(goo == moo) {
  517. X        exit(0);
  518. X    }
  519. X#endif
  520. X    exit(0);
  521. X}
  522. XEOCP
  523. X    if $cc -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
  524. X        voidflags=$defvoidused
  525. X    echo "It appears to support void to the level $package wants ($defvoidused)."
  526. X        if $contains warning .out >/dev/null 2>&1; then
  527. X            echo "However, you might get some warnings that look like this:"
  528. X            $cat .out
  529. X        fi
  530. X    else
  531. Xecho "Hmm, your compiler has some difficulty with void. Checking further..." >&4
  532. X        if $cc -c -DTRY=1 try.c >/dev/null 2>&1 ; then
  533. X            echo "It supports 1..."
  534. X            if $cc -c -DTRY=3 try.c >/dev/null 2>&1 ; then
  535. X                echo "It also supports 2..."
  536. X                if $cc -c -DTRY=7 try.c >/dev/null 2>&1 ; then
  537. X                    voidflags=7
  538. X                    echo "And it supports 4 but not 8 definitely."
  539. X                else
  540. X                    echo "It doesn't support 4..."
  541. X                    if $cc -c -DTRY=11 try.c >/dev/null 2>&1 ; then
  542. X                        voidflags=11
  543. X                        echo "But it supports 8."
  544. X                    else
  545. X                        voidflags=3
  546. X                        echo "Neither does it support 8."
  547. X                    fi
  548. X                fi
  549. X            else
  550. X                echo "It does not support 2..."
  551. X                if $cc -c -DTRY=13 try.c >/dev/null 2>&1 ; then
  552. X                    voidflags=13
  553. X                    echo "But it supports 4 and 8."
  554. X                else
  555. X                    if $cc -c -DTRY=5 try.c >/dev/null 2>&1 ; then
  556. X                        voidflags=5
  557. X                        echo "And it supports 4 but has not heard about 8."
  558. X                    else
  559. X                        echo "However it supports 8 but not 4."
  560. X                    fi
  561. X                fi
  562. X            fi
  563. X        else
  564. X            echo "There is no support at all for void."
  565. X            voidflags=0
  566. X        fi
  567. X    fi
  568. Xesac
  569. Xdflt="$voidflags";
  570. Xrp="Your void support flags add up to what?"
  571. X. ./myread
  572. Xvoidflags="$ans"
  573. X$rm -f try.* .out
  574. X
  575. X: determine where private executables go
  576. Xcase "$privlib" in
  577. X'')
  578. X    dflt=/usr/lib/$package
  579. X    $test -d /usr/local/lib && dflt=/usr/local/lib/$package
  580. X    $test -d /local/lib && dflt=/local/lib/$package
  581. X    ;;
  582. X*)  dflt="$privlib"
  583. X    ;;
  584. Xesac
  585. X$cat <<EOM
  586. X
  587. XThere are some auxiliary files for $package that need to be put into a
  588. Xprivate library directory that is accessible by everyone.
  589. X
  590. XEOM
  591. Xfn=d~+
  592. Xrp='Pathname where private library files will reside?'
  593. X. ./getfile
  594. Xprivlib="$ans"
  595. Xprivlibexp="$ansexp"
  596. Xif $afs; then
  597. X    $cat <<EOM
  598. X
  599. XSince you are running AFS, I need to distinguish the directory in which
  600. Xprivate files reside from the directory in which they are installed (and from
  601. Xwhich they are presumably copied to the former directory by occult means).
  602. X
  603. XEOM
  604. X    case "$installprivlib" in
  605. X    '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;;
  606. X    *) dflt="$installprivlib";;
  607. X    esac
  608. X    fn=de~
  609. X    rp='Where will private files be installed?'
  610. X    . ./getfile
  611. X    installprivlib="$ans"
  612. Xelse
  613. X    installprivlib="$privlibexp"
  614. Xfi
  615. X
  616. X: determine lexical analyser generator
  617. Xcase "$lex" in
  618. X'')
  619. X    dflt=lex;;
  620. X*)
  621. X    dflt="$lex";;
  622. Xesac
  623. Xecho " "
  624. Xif $test -f "$flex"; then
  625. X    rp='Which lexical analyser generator (lex or flex) shall I use?'
  626. Xelse
  627. X    rp='Which lexical analyser generator shall I use?'
  628. Xfi
  629. X. ./myread
  630. Xlex="$ans"
  631. X: see if we should include -ll
  632. Xecho " "
  633. Xcase "$lex" in
  634. X*flex*)
  635. X    xxx=`./loc libfl.a x $libpth`
  636. X    case "$xxx" in
  637. X    x)
  638. X        echo "No flex library found." >&4
  639. X        liblex=''
  640. X        ;;
  641. X    *)
  642. X        echo "flex library found in $xxx." >&4
  643. X        liblex="$xxx"
  644. X        ;;
  645. X    esac
  646. X    ;;
  647. X*lex)
  648. X    xxx=`./loc libl.a x $libpth`
  649. X    case "$xxx" in
  650. X    x)
  651. X        echo "No lex library found." >&4
  652. X        liblex=''
  653. X        ;;
  654. X    *)
  655. X        echo "lex library found in $xxx." >&4
  656. X        liblex="$xxx"
  657. X        ;;
  658. X    esac
  659. X    ;;
  660. X*)
  661. Xecho "You don't seem to have lex, so I won't look for the lex library." >&4
  662. X    liblex=''
  663. X    ;;
  664. Xesac
  665. X: determine compiler compiler
  666. Xcase "$yacc" in
  667. X'')
  668. X    dflt=yacc;;
  669. X*)
  670. X    dflt="$yacc";;
  671. Xesac
  672. Xecho " "
  673. Xif $test -f "$bison"; then
  674. X    rp='Which compiler compiler (yacc or bison -y) shall I use?'
  675. Xelse
  676. X    rp='Which compiler compiler shall I use?'
  677. Xfi
  678. X. ./myread
  679. Xyacc="$ans"
  680. Xcase "$yacc" in
  681. X*bis*)
  682. X    case "$yacc" in
  683. X    *-y*) ;;
  684. X    *)
  685. X        yacc="$yacc -y"
  686. X        echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
  687. X        ;;
  688. X    esac
  689. X    ;;
  690. Xesac
  691. X
  692. X: see if we should include -ly
  693. Xecho " "
  694. Xcase "$yacc" in
  695. X*yacc)
  696. X    xxx=`./loc liby.a x $libpth`
  697. X    case "$xxx" in
  698. X    x)
  699. X        echo "No yacc library found." >&4
  700. X        libyacc=''
  701. X        ;;
  702. X    *)
  703. X        echo "yacc library found in $xxx." >&4
  704. X        libyacc="$xxx"
  705. X        ;;
  706. X    esac
  707. X    ;;
  708. X*bison*)
  709. X    echo "You are using bison, so I won't look for a yacc library." >&4
  710. X    libyacc=''
  711. X    ;;
  712. X*)
  713. Xecho "You don't seem to have yacc, so I won't look for the yacc library." >&4
  714. X    libyacc=''
  715. X    ;;
  716. Xesac
  717. X
  718. X: determine where manual pages go
  719. X$cat <<EOM
  720. X
  721. X$package has manual pages available in source form.
  722. XEOM
  723. Xcase "$_nroff" in
  724. Xnroff)
  725. X    echo "However, you don't have nroff, so they're probably useless to you."
  726. X    case "$mansrc" in
  727. X    '') mansrc="none";;
  728. X    esac;;
  729. Xesac
  730. Xecho "If you don't want the manual sources installed, answer 'none'."
  731. Xcase "$mansrc" in
  732. X'')
  733. X    lookpath='/usr/local/man/man1 /usr/local/man/man1 /usr/man/manl'
  734. X    lookpath="$lookpath /usr/man/local/man1 /usr/man/l_man/man1"
  735. X    lookpath="$lookpath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
  736. X    lookpath="$lookpath /usr/man/man.L"
  737. X    mansrc=`./loc . $lookpath`
  738. X    if $test -d "$mansrc"; then
  739. X        dflt="$mansrc"
  740. X    else
  741. X        dflt="$sysman"
  742. X    fi
  743. X    ;;
  744. X*)  dflt="$mansrc"
  745. X    ;;
  746. Xesac
  747. Xecho " "
  748. Xfn=dn~
  749. Xrp='Where do the manual pages (source) go?'
  750. X. ./getfile
  751. Xmansrc="$ans"
  752. Xmansrcexp="$ansexp"
  753. Xif $afs; then
  754. X    $cat <<EOM
  755. X
  756. XSince you are running AFS, I need to distinguish the directory in which
  757. Xmanual pages reside from the directory in which they are installed (and from
  758. Xwhich they are presumably copied to the former directory by occult means).
  759. X
  760. XEOM
  761. X    case "$installmansrc" in
  762. X    '') dflt=`echo $mansrcexp | sed 's#^/afs/#/afs/.#'`;;
  763. X    *) dflt="$installmansrc";;
  764. X    esac
  765. X    fn=de~
  766. X    rp='Where will man pages be installed?'
  767. X    . ./getfile
  768. X    installmansrc="$ans"
  769. Xelse
  770. X    installmansrc="$mansrcexp"
  771. Xfi
  772. X
  773. X
  774. Xcase "$mansrc" in
  775. X'') manext='0';;
  776. X*l) manext=l;;
  777. X*n) manext=n;;
  778. X*o) manext=l;;
  779. X*p) manext=n;;
  780. X*C) manext=C;;
  781. X*L) manext=L;;
  782. X*L1) manext=L1;;
  783. X*) manext=1;;
  784. Xesac
  785. X
  786. X: find out how to generate dependencies
  787. Xecho " "
  788. Xecho "Checking how to generate makefile dependencies on your machine..." >&4
  789. Xtoplev=`cd ..;pwd`
  790. X$cat >dep.c <<'EOCP'
  791. X#include "dep.h"
  792. XEOCP
  793. X$cat >dep.h <<'EOCP'
  794. X
  795. XEOCP
  796. Xtakeflags='flags=""
  797. Xcase "$@" in
  798. X*--*)
  799. X    for arg
  800. X    do
  801. X        shift
  802. X        case "$arg" in
  803. X        --) break;;
  804. X        *) flags="$flags $arg";;
  805. X        esac
  806. X    done;;
  807. Xesac'
  808. Xcase "$mkdep" in
  809. X'')
  810. X    ;;
  811. X*)
  812. X    if test -x "$mkdep" &&
  813. X        $mkdep dep.c >dep.out 2>/dev/null &&
  814. X        $contains 'dep\.o:.*dep\.h' dep.out >/dev/null 2>&1
  815. X    then
  816. X        echo "$mkdep works."
  817. X    else
  818. X        mkdep=
  819. X    fi
  820. Xesac
  821. X
  822. Xcase "$mkdep" in
  823. X'')
  824. X    $spitshell > ../mkdep <<EOM
  825. X$startsh
  826. X$takeflags
  827. Xfor srcfile
  828. Xdo
  829. X    $cpp -M -I. $cppflags \$flags \$srcfile 2>/dev/null
  830. Xdone
  831. Xexit 0
  832. XEOM
  833. X    mkdep=$toplev/mkdep
  834. X    chmod +x $mkdep
  835. X    $eunicefix $mkdep
  836. X    if $mkdep dep.c >dep.out 2>/dev/null &&
  837. X        $contains 'dep\.o:.*dep\.h' dep.out >/dev/null 2>&1
  838. X    then
  839. X        echo "Looks like we can use $cpp -M."
  840. X    else
  841. X        mkdep=
  842. X    fi
  843. X    ;;
  844. Xesac
  845. X
  846. Xcase "$mkdep" in
  847. X'')
  848. X    $spitshell > ../mkdep <<EOM
  849. X$startsh
  850. X$takeflags
  851. Xfor srcfile
  852. Xdo
  853. X    $cc -MM -I. $cppflags \$flags \$srcfile 2>/dev/null
  854. Xdone
  855. Xexit 0
  856. XEOM
  857. X    mkdep=$toplev/mkdep
  858. X    chmod +x $mkdep
  859. X    $eunicefix $mkdep
  860. X    if $mkdep dep.c >dep.out 2>/dev/null &&
  861. X        $contains 'dep.o: dep.h' dep.out >/dev/null 2>&1
  862. X    then
  863. X        echo "Looks like we can use $cc -MM."
  864. X    else
  865. X        mkdep=
  866. X    fi
  867. X    ;;
  868. Xesac
  869. X
  870. Xcase "$mkdep" in
  871. X'')
  872. X    $spitshell >../mkdep <<EOS
  873. X$startsh
  874. X$takeflags
  875. Xfor srcfile
  876. Xdo
  877. X    case "\$srcfile" in
  878. X    *.c) c='.c';;
  879. X    *.y) c='.y';;
  880. X    *.l) c='.l';;
  881. X    esac
  882. X    filebase=\`basename \$srcfile \$c\`
  883. X    <\$srcfile $cpp $cppminus $cppflags -I. \$flags 2>/dev/null | \\
  884. X    $sed -e '/^# *[0-9]/!d' \\
  885. X        -e 's/^.*"\(.*\)".*\$/'\$filebase'.o: \1/' \\
  886. X        -e 's|: \./|: |' \\
  887. X        -e 's|: *$|: '\$srcfile'|' | \\
  888. X    $grep -v '^#' | $sort | $uniq
  889. Xdone
  890. Xexit 0
  891. XEOS
  892. X    mkdep=$toplev/mkdep
  893. X    chmod +x $mkdep
  894. X    $eunicefix $mkdep
  895. X    if $mkdep dep.c >dep.out 2>/dev/null &&
  896. X        $contains 'dep\.o:.*dep\.h' dep.out >/dev/null 2>&1
  897. X    then
  898. X        echo "A shell script using $cpp does the trick."
  899. X    else
  900. X        echo "$cpp doesn't seem to be any use at all."
  901. X        $spitshell >../mkdep <<EOS
  902. X$startsh
  903. X$takeflags
  904. Xfiles="\$@"
  905. Xset X \$flags
  906. Xshift
  907. Xinc='.'
  908. Xwhile test \$# -gt 0
  909. Xdo
  910. X    case "\$1" in
  911. X    -I) 
  912. X        shift
  913. X        inc="\$inc:\$1"
  914. X        ;;
  915. X    -I*)
  916. X        dir=\`echo \$1 | sed -e 's/^-I//'\`
  917. X        inc="\$inc:\$dir"
  918. X        ;;
  919. X    esac
  920. X    shift
  921. Xdone
  922. Xset X \$files
  923. Xshift
  924. Xtrap "$rm -f /tmp/mkdep\$\$; exit 1" 1 2 3 15
  925. Xfor srcfile
  926. Xdo
  927. X    case "\$srcfile" in
  928. X    *.c) c='.c';;
  929. X    *.y) c='.y';;
  930. X    *.l) c='.l';;
  931. X    esac
  932. X    filebase=\`basename \$srcfile \$c\`
  933. X    echo \$filebase.o: \$srcfile
  934. X    $grep '^#[  ]*include' \$srcfile /dev/null | \
  935. X    $sed -n -e 's/#[   ]*include[  ]*//' \\
  936. X        -e '/<\(.*\)>/ d' \\
  937. X        -e 's/:[^"]*"\([^"]*\)".*/: \1/' \\
  938. X        -e 's/\.c:/\.o:/p' > /tmp/mkdep\$\$
  939. X    IFS=': '
  940. X    while read file dep; do
  941. X        for dir in \$inc; do
  942. X            if $test -f "\$dir/\$dep"; then
  943. X                dep="\$dir/\$dep"
  944. X                break
  945. X            fi
  946. X        done
  947. X        echo "\$file: \$dep" | $sed -e 's,: \./,: ,'
  948. X    done </tmp/mkdep\$\$
  949. X    IFS=' '
  950. X    $rm -f /tmp/mkdep\$\$
  951. Xdone
  952. Xexit 0
  953. XEOS
  954. X        mkdep=$toplev/mkdep
  955. X        chmod +x $mkdep
  956. X        $eunicefix $mkdep
  957. X        if $mkdep dep.c >dep.out 2>/dev/null &&
  958. X            $contains 'dep\.o:.*dep\.h' dep.out >/dev/null 2>&1
  959. X        then
  960. X            cat << EOM
  961. X
  962. XI can use a script with grep instead, but it will make some incorrect
  963. Xdependencies, since it doesn't understand about conditional compilation.
  964. XMoreover, some dependencies may be missing, because scanning won't be
  965. Xa recursive process.
  966. XIf you have a program which generates makefile dependencies, you may want
  967. Xto use it.  If not, you can use the script and edit the Makefile by hand
  968. Xif you need to.
  969. XEOM
  970. X        else
  971. X            mkdep=
  972. X            cat << EOM
  973. X
  974. XI can't seem to generate makefile dependencies at all!  Perhaps you have a
  975. Xprogram that does?  If you don't, you might look at the mkdep script to
  976. Xsee if you can create one which works.
  977. XEOM
  978. X        fi
  979. X    fi
  980. Xesac
  981. Xdflt="$mkdep"
  982. Xfn=f~/
  983. Xrp="Name of program to make makefile dependencies?"
  984. X. ./getfile
  985. Xmkdep="$ans"
  986. X$rm -f dep.c dep.h dep.o dep.out
  987. X
  988. X: Cruising for prototypes
  989. Xecho " "
  990. Xecho "Checking out function prototypes..." >&4
  991. X$cat >prototype.c <<'EOCP'
  992. Xmain(int argc, char *argv[]) {
  993. X    exit(0);}
  994. XEOCP
  995. Xif $cc -c prototype.c >prototype.out 2>&1 ; then
  996. X    echo "Your C compiler appears to support function prototypes."
  997. X    val="$define"
  998. Xelse
  999. X    echo "Your C compiler doesn't seem to understand function prototypes."
  1000. X    val="$undef"
  1001. Xfi
  1002. Xset prototype
  1003. Xeval $setvar
  1004. X$rm -f prototype*
  1005. X
  1006. X: see if signal is declared as pointer to function returning int or void
  1007. Xecho " "
  1008. Xxxx=`./findhdr signal.h`
  1009. X$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
  1010. Xif $contains 'int.*\*[     ]*signal' $$.tmp >/dev/null 2>&1 ; then
  1011. X    echo "You have int (*signal())() instead of void." >&4
  1012. X    val="$undef"
  1013. X    signal_t="int"
  1014. Xelif $contains 'void.*\*[     ]*signal' $$.tmp >/dev/null 2>&1 ; then
  1015. X    echo "You have void (*signal())() instead of int." >&4
  1016. X    val="$define"
  1017. X    signal_t="void"
  1018. Xelif $contains 'extern[     ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
  1019. X    echo "You have int (*signal())() instead of void." >&4
  1020. X    val="$undef"
  1021. X    signal_t="int"
  1022. Xelse
  1023. X    case "$d_voidsig" in
  1024. X    '')
  1025. X    echo "I can't determine whether signal handler returns void or int..." >&4
  1026. X        dflt=void
  1027. X        rp="What type does your signal handler returns?"
  1028. X        . ./myread
  1029. X        case "$ans" in
  1030. X        void) val="$define"; signal_t="void";;
  1031. X        *) val="$undef"; signal_t="int";;
  1032. X        esac;;
  1033. X    *) echo "As you already told me, signal handler returns $signal_t." >&4;;
  1034. X    esac
  1035. Xfi
  1036. Xset d_voidsig
  1037. Xeval $setvar
  1038. X$rm -f $$.tmp
  1039. X
  1040. X: see if time exists
  1041. Xecho " "
  1042. Xif set time val -f d_time; eval $csym; $val; then
  1043. X    echo 'time() found.' >&4
  1044. X    val="$define"
  1045. X    case "$timetype" in
  1046. X    '')
  1047. X        if $contains 'time_t;' `./findhdr sys/types.h` >/dev/null 2>&1 ; then
  1048. X            dflt='time_t';
  1049. X        else
  1050. X            dflt='long';
  1051. X        fi
  1052. X        ;;
  1053. X    *)  dflt="$timetype"
  1054. X        ;;
  1055. X    esac
  1056. X    echo " "
  1057. X    rp="What type is returned by time() on this sytem?"
  1058. X    . ./myread
  1059. X    timetype="$ans"
  1060. Xelse
  1061. X    echo 'time() not found, hope that will do.' >&4
  1062. X    val="$undef"
  1063. X    timetype='int';
  1064. Xfi
  1065. Xset d_time
  1066. Xeval $setvar
  1067. X
  1068. X: define an alternate in-header-list? function
  1069. Xinhdr='echo " "; td=$define; tu=$undef; yyy=$@;
  1070. Xcont=true; xxf="echo \"<\$1> found.\" >&4";
  1071. Xcase $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
  1072. X*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
  1073. Xesac;
  1074. Xcase $# in 4) instead=instead;; *) instead="at last";; esac;
  1075. Xwhile $test "$cont"; do
  1076. X    xxx=`./findhdr $1`
  1077. X    var=$2; eval "was=\$$2";
  1078. X    if $test "$xxx" && $test -r "$xxx";
  1079. X    then eval $xxf;
  1080. X        eval "case \"\$$var\" in $undef) . whoa; esac"; eval "$var=\$td";
  1081. X        cont="";
  1082. X    else eval $xxnf;
  1083. X        eval "case \"\$$var\" in $define) . whoa; esac"; eval "$var=\$tu"; fi;
  1084. X    set $yyy; shift; shift; yyy=$@;
  1085. X    case $# in 0) cont="";;
  1086. X    2) xxf="echo \"but I found <\$1> $instead.\" >&4";
  1087. X        xxnf="echo \"and I did not find <\$1> either.\" >&4";;
  1088. X    *) xxf="echo \"but I found <\$1\> instead.\" >&4";
  1089. X        xxnf="echo \"there is no <\$1>, ...\" >&4";;
  1090. X    esac;
  1091. Xdone;
  1092. Xwhile $test "$yyy";
  1093. Xdo set $yyy; var=$2; eval "was=\$$2";
  1094. X    eval "case \"\$$var\" in $define) . whoa; esac"; eval "$var=\$tu";
  1095. X    set $yyy; shift; shift; yyy=$@;
  1096. Xdone'
  1097. X
  1098. X: see if stdarg is available
  1099. Xset stdarg.h i_stdarg
  1100. Xeval $inhdr
  1101. X
  1102. X: see if prototypes support variable argument declarations
  1103. Xecho " "
  1104. Xcase "$prototype$i_stdarg" in
  1105. X$define$define)
  1106. X    echo "It appears we'll be able to prototype varargs functions." >&4
  1107. X    val="$define"
  1108. X    ;;
  1109. X*)
  1110. X    echo "Too bad... We won't be using prototyped varargs functions..." >&4
  1111. X    val="$undef"
  1112. X    ;;
  1113. Xesac
  1114. Xset vaproto
  1115. Xeval $setvar
  1116. X
  1117. X$cat <<EOH
  1118. X
  1119. XYou may wish to compile with extra compiler warnings enabled.
  1120. XNote that doing so enhances your chance of receiving your free set of steak
  1121. Xknives, particularly if you find any bugs and report them.
  1122. XIf you don't want extra warnings, answer "none".
  1123. X  
  1124. XEOH
  1125. Xcase "$warnflags" in
  1126. X'') case "$cc" in
  1127. X    *gcc*)
  1128. X        dflt="-Wall -Wno-comment"
  1129. X        if $contains 'fprintf' `./findhdr stdio.h` >/dev/null 2>&1; then
  1130. X            :
  1131. X        else
  1132. X            dflt="$dflt -Wno-implicit"
  1133. X        fi
  1134. X        ;;
  1135. X    *) dflt="none";;
  1136. X    esac
  1137. X    ;;
  1138. X' ') dflt="none";;
  1139. X*) dflt="$warnflags";;
  1140. Xesac
  1141. X
  1142. Xrp="Any $cc flags to enable warnings?"
  1143. X. ./myread
  1144. Xcase "$ans" in
  1145. Xnone) warnflags=' ';;
  1146. X*) warnflags="$ans";;
  1147. Xesac
  1148. X
  1149. X: see if this is a sys/file.h system
  1150. Xval=''
  1151. Xset sys/file.h val
  1152. Xeval $inhdr
  1153. X
  1154. X: do we need to #include <sys/file.h> ?
  1155. Xcase "$val" in
  1156. X"$define")
  1157. X    echo " "
  1158. X    if $h_sysfile; then
  1159. X        val="$define"
  1160. X        echo "We'll be including <sys/file.h>." >&4
  1161. X    else
  1162. X        val="$undef"
  1163. X        echo "We won't be including <sys/file.h>." >&4
  1164. X    fi
  1165. X    ;;
  1166. X*)
  1167. X    h_sysfile=false
  1168. X    ;;
  1169. Xesac
  1170. Xset i_sysfile
  1171. Xeval $setvar
  1172. X
  1173. X: see if fcntl.h is there
  1174. Xval=''
  1175. Xset fcntl.h val
  1176. Xeval $inhdr
  1177. X
  1178. X: see if we can include fcntl.h
  1179. Xcase "$val" in
  1180. X"$define")
  1181. X    echo " "
  1182. X    if $h_fcntl; then
  1183. X        val="$define"
  1184. X        echo "We'll be including <fcntl.h>." >&4
  1185. X    else
  1186. X        val="$undef"
  1187. X        if $h_sysfile; then
  1188. X    echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
  1189. X        else
  1190. X            echo "We won't be including <fcntl.h>." >&4
  1191. X        fi
  1192. X    fi
  1193. X    ;;
  1194. X*)
  1195. X    h_fcntl=false
  1196. X    val="$undef"
  1197. X    ;;
  1198. Xesac
  1199. Xset i_fcntl
  1200. Xeval $setvar
  1201. X
  1202. X: see if stddef is available
  1203. Xset stddef.h i_stddef
  1204. Xeval $inhdr
  1205. X
  1206. X: see if stdlib is available
  1207. Xset stdlib.h i_stdlib
  1208. Xeval $inhdr
  1209. X
  1210. X: see if we should include time.h, sys/time.h, or both
  1211. Xecho " "
  1212. Xecho "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
  1213. X$echo $n "I'm now running the test program...$c"
  1214. X$cat >try.c <<'EOCP'
  1215. X#include <sys/types.h>
  1216. X#ifdef I_TIME
  1217. X#include <time.h>
  1218. X#endif
  1219. X#ifdef I_SYSTIME
  1220. X#ifdef SYSTIMEKERNEL
  1221. X#define KERNEL
  1222. X#endif
  1223. X#include <sys/time.h>
  1224. X#endif
  1225. X#ifdef I_SYSSELECT
  1226. X#include <sys/select.h>
  1227. X#endif
  1228. Xmain()
  1229. X{
  1230. X    struct tm foo;
  1231. X#ifdef S_TIMEVAL
  1232. X    struct timeval bar;
  1233. X#endif
  1234. X#ifdef S_TIMEZONE
  1235. X    struct timezone tzp;
  1236. X#endif
  1237. X    if (foo.tm_sec == foo.tm_sec)
  1238. X        exit(0);
  1239. X#ifdef S_TIMEVAL
  1240. X    if (bar.tv_sec == bar.tv_sec)
  1241. X        exit(0);
  1242. X#endif
  1243. X    exit(1);
  1244. X}
  1245. XEOCP
  1246. Xflags=''
  1247. Xs_timezone=''
  1248. Xsysselect=''
  1249. Xfor s_timeval in '-DS_TIMEVAL' ''; do
  1250. Xfor i_systimek in '' '-DSYSTIMEKERNEL'; do
  1251. Xfor i_time in '' '-DI_TIME'; do
  1252. Xfor i_systime in '-DI_SYSTIME' ''; do
  1253. X    case "$flags" in
  1254. X    '') $echo $n ".$c"
  1255. X        if $cc $ccflags \
  1256. X        $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone \
  1257. X        try.c -o try >/dev/null 2>&1 ; then
  1258. X            set X $i_time $i_systime $i_systimek $sysselect $s_timeval
  1259. X            shift
  1260. X            flags="$*"
  1261. X            echo " "
  1262. X            $echo $n "Succeeded with $flags$c"
  1263. X        fi
  1264. X        ;;
  1265. X    esac
  1266. Xdone
  1267. Xdone
  1268. Xdone
  1269. Xdone
  1270. Xtimeincl=''
  1271. Xecho " "
  1272. Xcase "$flags" in
  1273. X*SYSTIMEKERNEL*) i_systimek="$define"
  1274. X    timeincl=`./findhdr sys/time.h`
  1275. X    echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
  1276. X*) i_systimek="$undef";;
  1277. Xesac
  1278. Xcase "$flags" in
  1279. X*I_TIME*) i_time="$define"
  1280. X    timeincl=`./findhdr time.h`" $timeincl"
  1281. X    echo "We'll include <time.h>." >&4;;
  1282. X*) i_time="$undef";;
  1283. Xesac
  1284. Xcase "$flags" in
  1285. X*I_SYSTIME*) i_systime="$define"
  1286. X    timeincl=`./findhdr sys/time.h`" $timeincl"
  1287. X    echo "We'll include <sys/time.h>." >&4;;
  1288. X*) i_systime="$undef";;
  1289. Xesac
  1290. X$rm -f try.c try
  1291. X
  1292. X: see if sys/types.h has to be included
  1293. Xset sys/types.h i_systypes
  1294. Xeval $inhdr
  1295. X
  1296. X: see if this is a unistd.h system
  1297. Xset unistd.h i_unistd
  1298. Xeval $inhdr
  1299. X
  1300. X: see if this is a varargs system
  1301. Xecho " "
  1302. Xif $test `./findhdr varargs.h`; then
  1303. X    val="$define"
  1304. X    echo "<varargs.h> found." >&4
  1305. Xelse
  1306. X    val="$undef"
  1307. X    echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
  1308. Xfi
  1309. Xset i_varargs
  1310. Xeval $setvar
  1311. X
  1312. X: set up the varargs testing programs
  1313. X$cat > varargs.c <<EOP
  1314. X#ifdef I_STDARG
  1315. X#include <stdarg.h>
  1316. X#endif
  1317. X#ifdef I_VARARGS
  1318. X#include <varargs.h>
  1319. X#endif
  1320. X
  1321. X#ifdef I_STDARG
  1322. Xint f(char *p, ...)
  1323. X#else
  1324. Xint f(va_alist)
  1325. Xva_dcl
  1326. X#endif
  1327. X{
  1328. X    va_list ap;
  1329. X#ifndef I_STDARG
  1330. X    char *p;
  1331. X#endif
  1332. X#ifdef I_STDARG
  1333. X    va_start(ap,p);
  1334. X#else
  1335. X    va_start(ap);
  1336. X    p = va_arg(ap, char *);
  1337. X#endif
  1338. X    va_end(ap);
  1339. X}
  1340. XEOP
  1341. X$cat > varargs <<EOP
  1342. Xif $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
  1343. X    echo "true"
  1344. Xelse
  1345. X    echo "false"
  1346. Xfi
  1347. X$rm -f varargs.o
  1348. XEOP
  1349. Xchmod +x varargs
  1350. X
  1351. X: now check which varargs header should be included
  1352. Xecho " "
  1353. Xi_varhdr=''
  1354. Xcase "$i_stdarg" in
  1355. X"$define")
  1356. X    if `./varargs I_STDARG`; then
  1357. X        i_varhdr='stdarg.h'
  1358. X        i_varargs="$undef"
  1359. X    elif `./varargs I_VARARGS`; then
  1360. X        i_varhdr='varargs.h'
  1361. X        i_stdarg="$undef"
  1362. X    fi
  1363. X    ;;
  1364. X*)
  1365. X    if `./varargs I_VARARGS`; then
  1366. X        i_varhdr='varargs.h'
  1367. X    fi
  1368. X    ;;
  1369. Xesac
  1370. Xcase "$i_varhdr" in
  1371. X'')
  1372. Xecho "I could not find the definition for va_dcl... You have problems..." >&4
  1373. X    ;;
  1374. X*) echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
  1375. Xesac
  1376. X$rm -f varargs*
  1377. X
  1378. X: determine the name of a reasonable mailer
  1379. Xcase "$mailer" in
  1380. X'')
  1381. X    if $test -f "$_sendmail"; then
  1382. X        dflt="$_sendmail"
  1383. X    elif $test -f "$_smail"; then
  1384. X        dflt="$_smail"
  1385. X    elif $test -f "$_rmail"; then
  1386. X        dflt="$rmail"
  1387. X    elif $test -f /bin/mail; then
  1388. X        dflt=/bin/mail
  1389. X    else
  1390. X        dflt=$mail
  1391. X    fi
  1392. X    ;;
  1393. X*)  dflt="$mailer";;
  1394. Xesac
  1395. X$cat <<EOM
  1396. X
  1397. XI need the full pathname of the program used to deliver mail on your system.
  1398. XA typical answer would be /usr/lib/sendmail or /bin/rmail, but you may choose
  1399. Xany other program, as long as it can be fed from standard input and will
  1400. Xhonour any user-supplied headers.
  1401. X
  1402. XEOM
  1403. Xfn=f
  1404. Xrp='Mail transport agent to be used?'
  1405. X. ./getfile
  1406. Xmailer="$ans"
  1407. X
  1408. X: set the base revision
  1409. Xbaserev=2.0
  1410. X
  1411. X: get the patchlevel
  1412. Xecho " "
  1413. Xecho "Getting the current patchlevel..." >&4
  1414. Xif $test -r ../patchlevel.h;then
  1415. X    patchlevel=`awk '/PATCHLEVEL/ {print $3}' < ../patchlevel.h`
  1416. Xelse
  1417. X    patchlevel=0
  1418. Xfi
  1419. Xecho "(You have $package $baserev PL$patchlevel.)"
  1420. X
  1421. X: notify author that his package is used
  1422. Xif $test -f ../.config/mailauthor &&
  1423. X    cmp ../patchlevel.h ../.config/mailauthor >/dev/null 2>&1
  1424. Xthen
  1425. X    status="say that you're using $package";
  1426. X    case "$mailpatches" in
  1427. X    true) status='have patches mailed to you as they are issued';;
  1428. X    esac
  1429. X    case "$notifypatches" in
  1430. X    true) status='be notified when new patches are issued';;
  1431. X    esac
  1432. X    $cat <<EOM
  1433. X
  1434. XYou have already sent the author of $package (greyham@research.canon.oz.au) mail to
  1435. X$status. If you wish, you may modify
  1436. Xyour previous request by sending a new mail with different options.
  1437. X
  1438. XEOM
  1439. X    rp='Should I send a status update to greyham@research.canon.oz.au?'
  1440. X    dflt=n
  1441. Xelse
  1442. X    $cat <<EOM
  1443. X
  1444. XIf you are able to send mail to the Internet, the author of $package would
  1445. Xreally appreciate you letting me send off a quick note, just to say that you've
  1446. Xtried it. The author is more likely to spend time maintaining $package if it's
  1447. Xknown that many people are using it, and you can even ask to get sent new
  1448. Xpatches automagically this way if you wish. To protect your privacy, all I'll
  1449. Xsay in the mail is the version of $package that you're using.
  1450. X
  1451. XEOM
  1452. X    rp='Should I send mail to greyham@research.canon.oz.au?'
  1453. X    dflt=y
  1454. Xfi
  1455. X. ./myread
  1456. Xcase "$ans" in
  1457. X[yY]*)
  1458. X    echo " "
  1459. X    echo "Great!. You cooperation is really appreciated."
  1460. X    $cat <<EOM
  1461. X
  1462. XSome braindead sites do not set a proper return address in the From: header of
  1463. Xtheir outgoing mail, making it impossible to reply to mail they generate.
  1464. XIf your site is broken in this way, write to your system administrator and get
  1465. Xit fixed!!! In the mean time, you can manually specify the Internet e-mail
  1466. Xaddress by which the author can get back to you, should there be a need to do
  1467. Xso. If manually specified, it should be something like "user@domain.top".
  1468. XIf your mail system generates addresses correctly, specify "none".
  1469. X
  1470. XEOM
  1471. X    case "$usermail" in
  1472. X    '-'|'') dflt=none;;
  1473. X    *) dflt="$usermail";;
  1474. X    esac
  1475. X    rp='Manually specify a return address to use:'
  1476. X    . ./myread
  1477. X    case "$ans" in
  1478. X    none|*@*.*)
  1479. X        case "$ans" in
  1480. X        none) usermail='-';;
  1481. X        *) usermail="$ans";;
  1482. X        esac
  1483. X        ;;
  1484. X    *)
  1485. X        echo "(Address does not look like an Internet one -- ignoring it.)"
  1486. X        usermail='-'
  1487. X        mailpatches=false
  1488. X        notifypatches=false
  1489. X        ;;
  1490. X    esac
  1491. X    echo " "
  1492. X    opt=''
  1493. X    rp='Would you like to have new patches automatically mailed to you?'
  1494. X    case "$mailpatches" in
  1495. X    true) dflt=y;;
  1496. X    *) dflt=n;;
  1497. X    esac
  1498. X    . ./myread
  1499. X    case "$ans" in
  1500. X    [yY]*) opt=' mailpatches'; mailpatches=true;;
  1501. X    *)
  1502. X        mailpatches=false
  1503. X        echo " "
  1504. X        rp='Ok, would you like to simply be notified of new patches?'
  1505. X        case "$notifypatches" in
  1506. X        false) dflt=n;;
  1507. X        *) dflt=y;;
  1508. X        esac
  1509. X        . ./myread
  1510. X        echo " "
  1511. X        case "$ans" in
  1512. X        [yY]*) opt=' notifypatches'; notifypatches=true;;
  1513. X        *)
  1514. X            echo "Fine, I'll simply say that you've tried it then."
  1515. X            notifypatches=false
  1516. X            ;;
  1517. X        esac
  1518. X        ;;
  1519. X    esac
  1520. X    echo "Sending mail to greyham@research.canon.oz.au..." >&4
  1521. X    atsh='@SH'
  1522. X    $mailer greyham@research.canon.oz.au <<EOM >/dev/null 2>&1
  1523. XSubject: Command
  1524. XPrecedence: junk
  1525. XTo: greyham@research.canon.oz.au
  1526. X
  1527. X$atsh package $usermail $package $baserev $patchlevel$opt
  1528. XEOM
  1529. X    $rm -f ../.config/mailauthor
  1530. X    cp ../patchlevel.h ../.config/mailauthor
  1531. X    ;;
  1532. X*)
  1533. X    case "$dflt" in
  1534. X    "y") echo "Oh well, maybe next time.";;
  1535. X    esac
  1536. X    ;;
  1537. Xesac
  1538. X
  1539. X: see if we have to deal with yellow pages, now NIS.
  1540. Xif $test -d /usr/etc/yp || $test -d /etc/yp; then
  1541. X    if $test -f /usr/etc/nibindd; then
  1542. X        echo " "
  1543. X        echo "I'm fairly confident you're on a NeXT."
  1544. X        echo " "
  1545. X        rp='Do you get the passwd file via NetInfo?'
  1546. X        dflt=y
  1547. X        case "$passcat" in
  1548. X        nidump*) ;;
  1549. X        '') ;;
  1550. X        *) dflt=n;;
  1551. X        esac
  1552. X        . ./myread
  1553. X        case "$ans" in
  1554. X        y*) passcat='nidump passwd .'
  1555. X            ;;
  1556. X        *)    echo "You told me, so don't blame me."
  1557. X            passcat='cat /etc/passwd'
  1558. X            ;;
  1559. X        esac
  1560. X        echo " "
  1561. X        rp='Do you get the hosts file via NetInfo?'
  1562. X        dflt=y
  1563. X        case "$hostcat" in
  1564. X        nidump*) ;;
  1565. X        '') ;;
  1566. X        *) dflt=n;;
  1567. X        esac
  1568. X        . ./myread
  1569. X        case "$ans" in
  1570. X        y*) hostcat='nidump hosts .';;
  1571. X        *) hostcat='cat /etc/hosts';;
  1572. X        esac
  1573. X    fi
  1574. X    case "$passcat" in
  1575. X    nidump*) ;;
  1576. X    *)
  1577. X        case "$passcat" in
  1578. X        *ypcat*) dflt=y;;
  1579. X        '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
  1580. X                dflt=y
  1581. X            else
  1582. X                dflt=n
  1583. X            fi;;
  1584. X        *) dflt=n;;
  1585. X        esac
  1586. X        echo " "
  1587. X        rp='Are you getting the passwd file via yellow pages?'
  1588. X        . ./myread
  1589. X        case "$ans" in
  1590. X        y*) passcat='ypcat passwd'
  1591. X            ;;
  1592. X        *)    passcat='cat /etc/passwd'
  1593. X            ;;
  1594. X        esac
  1595. X        ;;
  1596. X    esac
  1597. X    case "$hostcat" in
  1598. X    nidump*) ;;
  1599. X    *)
  1600. X        case "$hostcat" in
  1601. X        *ypcat*) dflt=y;;
  1602. X        '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
  1603. X                dflt=y
  1604. X            else
  1605. X                dflt=n
  1606. X            fi;;
  1607. X        *) dflt=n;;
  1608. X        esac
  1609. X        echo " "
  1610. X        rp='Are you getting the hosts file via yellow pages?'
  1611. X        . ./myread
  1612. X        case "$ans" in
  1613. X        y*) hostcat='ypcat hosts';;
  1614. X        *) hostcat='cat /etc/hosts';;
  1615. X        esac
  1616. X        ;;
  1617. X    esac
  1618. Xfi
  1619. X
  1620. X: find out how to find out full name
  1621. Xcase "$d_berknames" in
  1622. X"$define")
  1623. X    dflt=y;;
  1624. X"$undef")
  1625. X    dflt=n;;
  1626. X*)
  1627. X    if bsd; then
  1628. X        dflt=y
  1629. X    elif xenix; then
  1630. X        dflt=y
  1631. X    else
  1632. X        dflt=n
  1633. X    fi
  1634. X    ;;
  1635. Xesac
  1636. X$cat <<'EOM'
  1637. X
  1638. XDoes your /etc/passwd file keep full names in Berkeley/V7 format (name first
  1639. Xthing after ':' in GCOS field)?  In that case, a typical entry in the password
  1640. Xfile looks like this:
  1641. X
  1642. X    guest:**paswword**:10:100:Mister Guest User:/usr/users:/bin/sh
  1643. X                              ^^^^^^^^^^^^^^^^^
  1644. XEOM
  1645. Xrp="Berkeley/V7 format for full name in /etc/password?"
  1646. X. ./myread
  1647. Xcase "$ans" in
  1648. Xy*) d_passnames="$define"
  1649. X    d_berknames="$define"
  1650. X    d_usgnames="$undef"
  1651. X    nametype=bsd
  1652. X    ;;
  1653. X*)
  1654. X    case "$d_usgnames" in
  1655. X    "$define") dflt=y;;
  1656. X    "$undef") dflt=n;;
  1657. X    *)
  1658. X        if usg; then
  1659. X            dflt=y
  1660. X        else
  1661. X            dflt=n
  1662. X        fi
  1663. X        ;;
  1664. X    esac
  1665. X$cat <<'EOM'
  1666. X
  1667. XDoes your passwd file keep full names in USG format (name sandwiched between a
  1668. X'-' and a '(')?  In that case, a typical entry in the password file looks like
  1669. Xthis:
  1670. X
  1671. X    guest:**paswword**:10:100:000-Mister Guest User(000):/usr/users:/bin/sh
  1672. X                                  ^^^^^^^^^^^^^^^^^
  1673. XEOM
  1674. X    rp="USG format for full name in /etc/passwd?"
  1675. X    . ./myread
  1676. X    case "$ans" in
  1677. X    n*) echo "Full name will be taken from ~/.fullname"
  1678. X        d_passnames="$undef"
  1679. X        d_berknames="$undef"
  1680. X        d_usgnames="$undef"
  1681. X        nametype=other
  1682. X        ;;
  1683. X    *)
  1684. X        d_passnames="$define"
  1685. X        d_berknames="$undef"
  1686. X        d_usgnames="$define"
  1687. X        nametype=usg
  1688. X        ;;
  1689. X    esac;;
  1690. Xesac
  1691. X
  1692. X: figure out their full name
  1693. Xcase "$NAME" in
  1694. X'') case "$nametype" in
  1695. X    other)
  1696. X        fn=`./filexp ~/.fullname`
  1697. X        xxx=usg
  1698. X        $test -f $fn && xxx=other
  1699. X        ;;
  1700. X    *)
  1701. X        xxx="$nametype"
  1702. X        ;;
  1703. X    esac
  1704. X
  1705. X    case "$xxx" in
  1706. X    bsd)
  1707. X        cf_name=`$passcat | grep "^$cf_by:" | \
  1708. X            sed -e 's/^[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\):.*/\1/' \
  1709. X            -e 's/,.*//'`
  1710. X        ;;
  1711. X    usg)
  1712. X        cf_name=`$passcat | grep "^$cf_by:" | \
  1713. X            sed -e 's/^[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\):.*/\1/' \
  1714. X            -e 's/[^-]*-\(.*\)(.*)/\1/'`
  1715. X        ;;
  1716. X    *)
  1717. X        cf_name=`$cat $fn`
  1718. X        ;;
  1719. X    esac
  1720. X    ;;
  1721. X*)
  1722. X    cf_name="$NAME"
  1723. X    ;;
  1724. Xesac
  1725. Xecho " "
  1726. Xecho "Pleased to meet you, $cf_name."
  1727. X
  1728. X: now get the host name
  1729. Xecho " "
  1730. Xecho "Figuring out host name..." >&4
  1731. Xcase "$myhostname" in
  1732. X'') cont=true
  1733. X    echo 'Maybe "hostname" will work...'
  1734. X    if tans=`sh -c hostname 2>&1` ; then
  1735. X        myhostname=$tans
  1736. X        phostname=hostname
  1737. X        cont=''
  1738. X    fi
  1739. X    ;;
  1740. X*) cont='';;
  1741. Xesac
  1742. Xif $test "$cont"; then
  1743. X    if xenix; then
  1744. X        echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
  1745. X        if tans=`cat /etc/systemid 2>&1` ; then
  1746. X            myhostname=$tans
  1747. X            phostname='cat /etc/systemid'
  1748. X            echo "Whadyaknow.  Xenix always was a bit strange..."
  1749. X            cont=''
  1750. X        fi
  1751. X    elif $test -r /etc/systemid; then
  1752. X        echo "(What is a non-Xenix system doing with /etc/systemid?)"
  1753. X    fi
  1754. Xfi
  1755. Xif $test "$cont"; then
  1756. X    echo 'No, maybe "uuname -l" will work...'
  1757. X    if tans=`sh -c 'uuname -l' 2>&1` ; then
  1758. X        myhostname=$tans
  1759. X        phostname='uuname -l'
  1760. X    else
  1761. X        echo 'Strange.  Maybe "uname -n" will work...'
  1762. X        if tans=`sh -c 'uname -n' 2>&1` ; then
  1763. X            myhostname=$tans
  1764. X            phostname='uname -n'
  1765. X        else
  1766. X            echo 'Oh well, maybe I can mine it out of whoami.h...'
  1767. X            if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
  1768. X                myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
  1769. X                phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
  1770. X            else
  1771. X                case "$myhostname" in
  1772. X                '') echo "Does this machine have an identity crisis or something?"
  1773. X                    phostname='';;
  1774. X                *)
  1775. X                    echo "Well, you said $myhostname before..."
  1776. X                    phostname='echo $myhostname';;
  1777. X                esac
  1778. X            fi
  1779. X        fi
  1780. X    fi
  1781. Xfi
  1782. X: you do not want to know about this
  1783. Xset $myhostname
  1784. Xmyhostname=$1
  1785. X
  1786. X: translate upper to lower if necessary
  1787. Xcase "$myhostname" in
  1788. X*[A-Z]*)
  1789. X    myhostname=`echo $myhostname | tr '[A-Z]' '[a-z]'`
  1790. X    echo "(Normalizing case in your host name)"
  1791. X    ;;
  1792. Xesac
  1793. X
  1794. X: verify guess
  1795. Xif $test "$myhostname" ; then
  1796. X    dflt=y
  1797. X    rp='Your host name appears to be "'$myhostname'".'" Right?"
  1798. X    . ./myread
  1799. X    case "$ans" in
  1800. X    y*) ;;
  1801. X    *) myhostname='';;
  1802. X    esac
  1803. Xfi
  1804. X
  1805. X: bad guess or no guess
  1806. Xwhile $test "X$myhostname" = X ; do
  1807. X    dflt=''
  1808. X    rp="Please type the (one word) name of your host:"
  1809. X    . ./myread
  1810. X    myhostname="$ans"
  1811. Xdone
  1812. X
  1813. Xcase "$myhostname" in
  1814. X*.*)
  1815. X    dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
  1816. X    myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
  1817. X    echo "(Trimming domain name from host name--host name is now $myhostname)"
  1818. X    ;;
  1819. X*) case "$mydomain" in
  1820. X    '')
  1821. X        $hostcat >hosts
  1822. X        dflt=.`$awk "/[0-9].*$myhostname/ {for(i=2; i<=NF;i++) print \\\$i}" \
  1823. X            hosts | $sort | $uniq | \
  1824. X            $sed -n -e "s/$myhostname\.\([a-zA-Z_.]\)/\1/p"`
  1825. X        case "$dflt" in
  1826. X        .) echo "(You do not have fully-qualified names in /etc/hosts)"
  1827. X            dflt='.uucp';;
  1828. X        esac
  1829. X        $rm -f hosts
  1830. X        ;;
  1831. X    *) dflt="$mydomain";;
  1832. X    esac;;
  1833. Xesac
  1834. Xecho " "
  1835. Xrp="What is your domain name?"
  1836. X. ./myread
  1837. Xtans="$ans"
  1838. Xcase "$ans" in
  1839. X'') ;;
  1840. X.*) ;;
  1841. X*) tans=".$tans";;
  1842. Xesac
  1843. Xmydomain="$tans"
  1844. X
  1845. X: a little sanity check here
  1846. Xcase "$phostname" in
  1847. X'') ;;
  1848. X*)
  1849. X    case `$phostname` in
  1850. X    $myhostname$mydomain|$myhostname) ;;
  1851. X    *)
  1852. X        case "$phostname" in
  1853. X        sed*)
  1854. X            echo "(That doesn't agree with your whoami.h file, by the way.)"
  1855. X            ;;
  1856. X        *)
  1857. X            echo "(That doesn't agree with your $phostname command, by the way.)"
  1858. X            ;;
  1859. X        esac
  1860. X    ;;
  1861. X    esac
  1862. X    ;;
  1863. Xesac
  1864. X
  1865. X$cat <<EOM
  1866. X
  1867. XI need to get your e-mail address in Internet format if possible, i.e.
  1868. Xsomething like user@host.domain. Please answer accurately since I have
  1869. Xno easy means to double check it. The default value provided below
  1870. Xis most probably close to the reality but may not be valid from outside
  1871. Xyour organization...
  1872. X
  1873. XEOM
  1874. Xcont=x
  1875. Xwhile test "$cont"; do
  1876. X    case "$cf_email" in
  1877. X    '') dflt="$cf_by@$myhostname$mydomain";;
  1878. X    *) dflt="$cf_email";;
  1879. X    esac
  1880. X    rp='What is your e-mail address?'
  1881. X    . ./myread
  1882. X    cf_email="$ans"
  1883. X    case "$cf_email" in
  1884. X    *@*.*) cont='' ;;
  1885. X    *)
  1886. X        rp='Address does not look like an Internet one.  Use it anyway?'
  1887. X        case "$fastread" in
  1888. X        yes) dflt=y ;;
  1889. X        *) dflt=n ;;
  1890. X        esac
  1891. X        . ./myread
  1892. X        case "$ans" in
  1893. X        y*) cont='' ;;
  1894. X        *) echo " " ;;
  1895. X        esac
  1896. X        ;;
  1897. X    esac
  1898. Xdone
  1899. X
  1900. X: offer to join the mailing list
  1901. Xlist_request='listserv@research.canon.oz.au'
  1902. Xlist_sub="SUBSCRIBE c2man $cf_name"
  1903. Xlist_unsub="UNSUBSCRIBE c2man"
  1904. Xlist_name="c2man"
  1905. X$cat <<EOM
  1906. X
  1907. XThere is a mailing list for discussion about $package and related issues.
  1908. XThis is the preferred place to ask questions about the program and discuss
  1909. Xmodifications and additions with the author and other users.  If you are able
  1910. Xto send mail to the Internet, you are encouraged to subscribe.  You need only
  1911. Xever subscribe once, and you can unsubscribe automatically at any time in the
  1912. Xfuture.  If you have already subscribed and you wish to unsubscribe now, you
  1913. Xmay do so by answering "unsubscribe".  Answer "subscribe" to subscribe to the
  1914. Xlist.
  1915. X
  1916. XEOM
  1917. Xrp="Subscribe to or unsubscribe from the $list_name mailing list?"
  1918. Xdflt=neither
  1919. X. ./myread
  1920. Xcase "$ans" in
  1921. X[sS]*)    $cat <<EOM
  1922. X
  1923. XYou will be sent a message from the list server to let you know when your
  1924. Xsubscription has been successful and telling you how to submit articles and
  1925. Xhow to unsubscribe again when necessary. You may also unsubscribe by running
  1926. Xthis script again and asking it to do so for you.
  1927. X
  1928. XEOM
  1929. X    echo "Sending mail to subscribe you to the $list_name list..." >&4
  1930. X    $mailer $list_request <<EOM >/dev/null 2>&1
  1931. XPrecedence: junk
  1932. XTo: $list_request
  1933. X
  1934. X$list_sub
  1935. XEOM
  1936. X    ;;
  1937. X[uU]*)    echo "Sending mail to unsubscribe you from the $list_name list..." >&4
  1938. X    $mailer $list_request <<EOM >/dev/null 2>&1
  1939. XPrecedence: junk
  1940. XTo: $list_request
  1941. X
  1942. X$list_unsub
  1943. XEOM
  1944. X    ;;
  1945. Xesac
  1946. X
  1947. X: end of configuration questions
  1948. Xecho " "
  1949. Xecho "End of configuration questions."
  1950. Xecho " "
  1951. X
  1952. X: back to where it started
  1953. Xif test -d ../UU; then
  1954. X    cd ..
  1955. Xfi
  1956. X
  1957. X: configuration may be patched via a 'config.over' file
  1958. Xif $test -f config.over; then
  1959. X    echo " "
  1960. X    dflt=y
  1961. X    rp='I see a config.over file.  Do you wish to load it?'
  1962. X    . UU/myread
  1963. X    case "$ans" in
  1964. X    n*) echo "OK, I'll ignore it.";;
  1965. X    *)    . ./config.over
  1966. X        echo "Configuration override changes have been loaded."
  1967. X        ;;
  1968. X    esac
  1969. Xfi
  1970. X
  1971. X: create config.sh file
  1972. Xecho " "
  1973. Xecho "Creating config.sh..." >&4
  1974. X$spitshell <<EOT >config.sh
  1975. X$startsh
  1976. X#
  1977. X# This file was produced by running the Configure script. It holds all the
  1978. X# definitions figured out by Configure. Should you modify one of these values,
  1979. X# do not forget to propagate your changes by running "Configure -der". You may
  1980. X# instead choose to run each of the .SH files by yourself, or "Configure -S".
  1981. X#
  1982. X
  1983. X# Configuration time: $cf_time
  1984. X# Configured by: $cf_by
  1985. X# Target system: $myuname
  1986. X
  1987. Xd_bsd='$d_bsd'
  1988. Xd_eunice='$d_eunice'
  1989. Xd_xenix='$d_xenix'
  1990. Xeunicefix='$eunicefix'
  1991. XMcc='$Mcc'
  1992. Xawk='$awk'
  1993. Xbash='$bash'
  1994. Xbison='$bison'
  1995. Xcat='$cat'
  1996. Xchgrp='$chgrp'
  1997. Xchmod='$chmod'
  1998. Xchown='$chown'
  1999. Xcompress='$compress'
  2000. Xcp='$cp'
  2001. Xcpio='$cpio'
  2002. Xcpp='$cpp'
  2003. Xcsh='$csh'
  2004. Xdate='$date'
  2005. Xecho='$echo'
  2006. Xegrep='$egrep'
  2007. Xemacs='$emacs'
  2008. Xexpr='$expr'
  2009. Xflex='$flex'
  2010. Xgcc='$gcc'
  2011. Xgrep='$grep'
  2012. Xinews='$inews'
  2013. Xksh='$ksh'
  2014. Xless='$less'
  2015. Xline='$line'
  2016. Xlint='$lint'
  2017. Xln='$ln'
  2018. Xlp='$lp'
  2019. Xlpr='$lpr'
  2020. Xls='$ls'
  2021. Xmail='$mail'
  2022. Xmailx='$mailx'
  2023. Xmake='$make'
  2024. Xmkdir='$mkdir'
  2025. Xmore='$more'
  2026. Xmv='$mv'
  2027. Xnroff='$nroff'
  2028. Xperl='$perl'
  2029. Xpg='$pg'
  2030. Xpmake='$pmake'
  2031. Xpr='$pr'
  2032. Xrm='$rm'
  2033. Xrmail='$rmail'
  2034. Xsed='$sed'
  2035. Xsendmail='$sendmail'
  2036. Xsh='$sh'
  2037. Xshar='$shar'
  2038. Xsleep='$sleep'
  2039. Xsmail='$smail'
  2040. Xsort='$sort'
  2041. Xsubmit='$submit'
  2042. Xtail='$tail'
  2043. Xtar='$tar'
  2044. Xtbl='$tbl'
  2045. Xtest='$test'
  2046. Xtouch='$touch'
  2047. Xtr='$tr'
  2048. Xtroff='$troff'
  2049. Xuname='$uname'
  2050. Xuniq='$uniq'
  2051. Xuuname='$uuname'
  2052. Xvi='$vi'
  2053. Xzcat='$zcat'
  2054. Xmailpatches='$mailpatches'
  2055. Xnotifypatches='$notifypatches'
  2056. Xusermail='$usermail'
  2057. Xhint='$hint'
  2058. Xmyuname='$myuname'
  2059. XAuthor='$Author'
  2060. XDate='$Date'
  2061. XHeader='$Header'
  2062. XId='$Id'
  2063. XLocker='$Locker'
  2064. XLog='$Log'
  2065. XRCSfile='$RCSfile'
  2066. XRevision='$Revision'
  2067. XSource='$Source'
  2068. XState='$State'
  2069. Xafs='$afs'
  2070. Xbaserev='$baserev'
  2071. Xbin='$bin'
  2072. Xbinexp='$binexp'
  2073. Xinstallbin='$installbin'
  2074. Xcc='$cc'
  2075. Xccflags='$ccflags'
  2076. Xcppflags='$cppflags'
  2077. Xldflags='$ldflags'
  2078. Xlkflags='$lkflags'
  2079. Xoptimize='$optimize'
  2080. Xcf_email='$cf_email'
  2081. Xcf_by='$cf_by'
  2082. Xcf_time='$cf_time'
  2083. Xcontains='$contains'
  2084. Xcppfilecom='$cppfilecom'
  2085. Xcppstdinflags='$cppstdinflags'
  2086. Xd_cppcanstdin='$d_cppcanstdin'
  2087. Xd_cppignhdrs='$d_cppignhdrs'
  2088. Xcpplast='$cpplast'
  2089. Xcppminus='$cppminus'
  2090. Xcpprun='$cpprun'
  2091. Xcppstdin='$cppstdin'
  2092. Xd_access='$d_access'
  2093. Xd_const='$d_const'
  2094. Xd_flexfnam='$d_flexfnam'
  2095. Xd_link='$d_link'
  2096. Xd_open3='$d_open3'
  2097. Xd_portable='$d_portable'
  2098. Xd_index='$d_index'
  2099. Xd_strchr='$d_strchr'
  2100. Xd_strftime='$d_strftime'
  2101. Xd_strstr='$d_strstr'
  2102. Xd_symlink='$d_symlink'
  2103. Xd_time='$d_time'
  2104. Xtimetype='$timetype'
  2105. Xd_voidsig='$d_voidsig'
  2106. Xsignal_t='$signal_t'
  2107. Xd_volatile='$d_volatile'
  2108. Xh_fcntl='$h_fcntl'
  2109. Xh_sysfile='$h_sysfile'
  2110. Xi_fcntl='$i_fcntl'
  2111. Xi_stdarg='$i_stdarg'
  2112. Xi_stddef='$i_stddef'
  2113. Xi_stdlib='$i_stdlib'
  2114. Xi_string='$i_string'
  2115. Xstrings='$strings'
  2116. Xi_sysfile='$i_sysfile'
  2117. Xi_systypes='$i_systypes'
  2118. Xi_systime='$i_systime'
  2119. Xi_systimek='$i_systimek'
  2120. Xi_time='$i_time'
  2121. Xtimeincl='$timeincl'
  2122. Xi_unistd='$i_unistd'
  2123. Xi_varargs='$i_varargs'
  2124. Xi_varhdr='$i_varhdr'
  2125. Xlex='$lex'
  2126. Xlibc='$libc'
  2127. Xliblex='$liblex'
  2128. Xlibpth='$libpth'
  2129. Xplibpth='$plibpth'
  2130. Xxlibpth='$xlibpth'
  2131. Xlibs='$libs'
  2132. Xlibyacc='$libyacc'
  2133. Xmailer='$mailer'
  2134. Xinstallmansrc='$installmansrc'
  2135. Xmanext='$manext'
  2136. Xmansrc='$mansrc'
  2137. Xmansrcexp='$mansrcexp'
  2138. Xmkdep='$mkdep'
  2139. Xmydomain='$mydomain'
  2140. Xmyhostname='$myhostname'
  2141. Xphostname='$phostname'
  2142. Xc='$c'
  2143. Xn='$n'
  2144. Xd_berknames='$d_berknames'
  2145. Xd_passnames='$d_passnames'
  2146. Xd_usgnames='$d_usgnames'
  2147. Xnametype='$nametype'
  2148. Xgroupcat='$groupcat'
  2149. Xhostcat='$hostcat'
  2150. Xpasscat='$passcat'
  2151. Xpackage='$package'
  2152. Xspackage='$spackage'
  2153. Xpatchlevel='$patchlevel'
  2154. Xinstallprivlib='$installprivlib'
  2155. Xprivlib='$privlib'
  2156. Xprivlibexp='$privlibexp'
  2157. Xprototype='$prototype'
  2158. Xsharpbang='$sharpbang'
  2159. Xshsharp='$shsharp'
  2160. Xspitshell='$spitshell'
  2161. Xstartsh='$startsh'
  2162. Xsysman='$sysman'
  2163. Xnm_opt='$nm_opt'
  2164. Xrunnm='$runnm'
  2165. Xusenm='$usenm'
  2166. Xincpath='$incpath'
  2167. Xmips='$mips'
  2168. Xmips_type='$mips_type'
  2169. Xusrinc='$usrinc'
  2170. Xvaproto='$vaproto'
  2171. Xdefvoidused='$defvoidused'
  2172. Xvoidflags='$voidflags'
  2173. Xwarnflags='$warnflags'
  2174. Xyacc='$yacc'
  2175. Xyaccflags='$yaccflags'
  2176. XEOT
  2177. X
  2178. X: add special variables
  2179. X$test -f patchlevel.h && \
  2180. Xawk '/^#define/ {printf "%s=%s\n",$2,$3}' patchlevel.h >>config.sh
  2181. Xecho "CONFIG=true" >>config.sh
  2182. X
  2183. X: propagate old symbols
  2184. Xif $test -f UU/config.sh; then
  2185. X    <UU/config.sh sort | uniq >UU/oldconfig.sh
  2186. X    sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
  2187. X    sort | uniq -u >UU/oldsyms
  2188. X    set X `cat UU/oldsyms`
  2189. X    shift
  2190. X    case $# in
  2191. X    0) ;;
  2192. X    *)
  2193. X        cat <<EOM
  2194. XHmm...You had some extra variables I don't know about...I'll try to keep 'em...
  2195. XEOM
  2196. X        echo "# Variables propagated from previous config.sh file." >>config.sh
  2197. X        for sym in `cat UU/oldsyms`; do
  2198. X            echo "    Propagating $hint variable "'$'"$sym..."
  2199. X            eval 'tmp="$'"${sym}"'"'
  2200. X            echo "$tmp" | \
  2201. X                sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
  2202. X        done
  2203. X        ;;
  2204. X    esac
  2205. Xfi
  2206. X
  2207. X: Finish up by extracting the .SH files
  2208. Xcase "$alldone" in
  2209. Xexit)
  2210. X    $rm -rf UU
  2211. X    echo "Done."
  2212. X    exit 0
  2213. X    ;;
  2214. Xcont)
  2215. X    ;;
  2216. X'')
  2217. X    echo " "
  2218. X    dflt=''
  2219. X    nostick=true
  2220. Xecho "If you didn't make any mistakes, then just type a carriage return here."
  2221. X    rp="If you need to edit config.sh, do it as a shell escape here:"
  2222. X    . UU/myread
  2223. X    nostick=''
  2224. X    case "$ans" in
  2225. X    '') ;;
  2226. X    *) : in case they cannot read
  2227. X        sh 1>&4 -c "$ans";;
  2228. X    esac
  2229. X    ;;
  2230. Xesac
  2231. X
  2232. X: if this fails, just run all the .SH files by hand
  2233. X. ./config.sh
  2234. X
  2235. Xecho " "
  2236. Xexec 1>&4
  2237. X. ./UU/extract
  2238. X
  2239. !STUFFY!FUNK!
  2240. echo "End of kit 3 (of 9)"
  2241. echo " "
  2242. cat /dev/null >kit3isdone
  2243. run=''
  2244. config=''
  2245. for iskit in 1 2 3 4 5 6 7 8 9; do
  2246.     if test -f kit${iskit}isdone; then
  2247.         run="$run $iskit"
  2248.     else
  2249.         todo="$todo $iskit"
  2250.     fi
  2251. done
  2252. case $todo in
  2253.     '')
  2254.         echo "You have run all your kits."
  2255.         if test -f PACKNOTES; then
  2256.             sh PACKNOTES
  2257.         else
  2258.             echo "You have to rebuild split files by hand (see PACKLIST)."
  2259.         fi
  2260.         echo "Please read README and then type Configure."
  2261.         chmod 755 Configure
  2262.         rm -f kit*isdone
  2263.         ;;
  2264.     *)  echo "You have run$run."
  2265.         echo "You still need to run$todo."
  2266.         ;;
  2267. esac
  2268. : Someone might mail this, so exit before signature...
  2269. exit 0
  2270. -- 
  2271. Graham Stoney, Hardware/Software Engineer
  2272. Canon Information Systems Research Australia
  2273. Ph: + 61 2 805 2909    Fax: + 61 2 805 2929
  2274.  
  2275. exit 0 # Just in case...
  2276.