home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume41 / mailagnt / part06 < prev    next >
Encoding:
Text File  |  1993-12-02  |  55.7 KB  |  2,469 lines

  1. Newsgroups: comp.sources.misc
  2. From: Raphael Manfredi <ram@acri.fr>
  3. Subject: v41i006:  mailagent - Flexible mail filtering and processing package, v3.0, Part06/26
  4. Message-ID: <1993Dec2.133648.18179@sparky.sterling.com>
  5. X-Md4-Signature: a472bb074f9cf7f347299930581b7a53
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Advanced Computer Research Institute, Lyon, France.
  8. Date: Thu, 2 Dec 1993 13:36:48 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: Raphael Manfredi <ram@acri.fr>
  12. Posting-number: Volume 41, Issue 6
  13. Archive-name: mailagent/part06
  14. Environment: UNIX, Perl
  15. Supersedes: mailagent: Volume 33, Issue 93-109
  16.  
  17. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then feed it
  19. # into a shell via "sh file" or similar.  To overwrite existing files,
  20. # type "sh file -c".
  21. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  22. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  23. # Contents:  Configure.01 agent/test/misc/compress.t
  24. # Wrapped by ram@soft208 on Mon Nov 29 16:49:55 1993
  25. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  26. echo If this archive is complete, you will see the following message:
  27. echo '          "shar: End of archive 6 (of 26)."'
  28. if test -f 'Configure.01' -a "${1}" != "-c" ; then 
  29.   echo shar: Will not clobber existing file \"'Configure.01'\"
  30. else
  31.   echo shar: Extracting \"'Configure.01'\" \(49998 characters\)
  32.   sed "s/^X//" >'Configure.01' <<'END_OF_FILE'
  33. X#! /bin/sh
  34. X#
  35. X# If these # comments don't work, trim them. Don't worry about any other
  36. X# shell scripts, Configure will trim # comments from them for you.
  37. X#
  38. X# (If you are trying to port this package to a machine without sh,
  39. X# I would suggest you have a look at the prototypical config_h.SH file
  40. X# and edit it to reflect your system. Some packages may include samples
  41. X# of config.h for certain machines, so you might look for one of those.)
  42. X#
  43. X# Yes, you may rip this off to use in other distribution packages. This
  44. X# script belongs to the public domain and cannot be copyrighted.
  45. X#
  46. X# (Note: this Configure script was generated automatically. Rather than
  47. X# working with this copy of Configure, you may wish to get metaconfig.
  48. X# The dist-3.0 package (which contains metaconfig) was posted in
  49. X# comp.sources.misc so you may fetch it yourself from your nearest
  50. X# archive site. Check with Archie if you don't know where that can be.)
  51. X#
  52. X
  53. X# $Id: Configure,v 3.0 1993/11/29 13:47:32 ram Exp ram $
  54. X#
  55. X# Generated on Fri Nov 26 17:29:12 MET 1993 [metaconfig 3.0 PL14]
  56. X
  57. Xcat >/tmp/c1$$ <<EOF
  58. XARGGGHHHH!!!!!
  59. X
  60. XSCO csh still thinks true is false.  Write to SCO today and tell them that next
  61. Xyear Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
  62. X
  63. X(Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
  64. Xwe'd have to do is go in and swap the && and || tokens, wherever they are.)
  65. X
  66. X[End of diatribe. We now return you to your regularly scheduled programming...]
  67. XEOF
  68. Xcat >/tmp/c2$$ <<EOF
  69. X
  70. XOOPS!  You naughty creature!  You didn't run Configure with sh!
  71. XI will attempt to remedy the situation by running sh for you...
  72. XEOF
  73. X
  74. Xtrue || cat /tmp/c1$$ /tmp/c2$$
  75. Xtrue || exec sh $0 $argv:q
  76. X
  77. X(exit $?0) || cat /tmp/c2$$
  78. X(exit $?0) || exec sh $0 $argv:q
  79. Xrm -f /tmp/c1$$ /tmp/c2$$
  80. X
  81. X: Sanity checks
  82. XPATH=".:$PATH:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin"
  83. XPATH=$PATH:'/usr/5bin:/etc:/usr/gnu/bin:/usr/new:/usr/new/bin:/usr/nbin'
  84. XPATH=$PATH:'/sys5.3/bin:/sys5.3/usr/bin:/bsd4.3/bin:/bsd4.3/usr/ucb'
  85. XPATH=$PATH:'/bsd4.3/usr/bin:/usr/bsd:/bsd43/bin:/usr/ccs/bin'
  86. XPATH=$PATH:'/etc:/usr/lib:/usr/ucblib:/lib:/usr/ccs/lib'
  87. Xexport PATH
  88. X
  89. Xif test ! -t 0; then
  90. X    echo "Say 'sh Configure', not 'sh <Configure'"
  91. X    exit 1
  92. Xfi
  93. X
  94. X: On HP-UX, large Configure scripts may exercise a bug in /bin/sh
  95. Xif test -f /hp-ux -a -f /bin/ksh; then
  96. X    if (PATH=.; alias -x) >/dev/null 2>&1; then
  97. X        : already under /bin/ksh
  98. X    else
  99. X        cat <<'EOM'
  100. X(Feeding myself to ksh to avoid nasty sh bug in "here document" expansion.)
  101. XEOM
  102. X        exec /bin/ksh $0 "$@"
  103. X    fi
  104. Xelse
  105. X    : Warn them if they use ksh on other systems
  106. X    (PATH=.; alias -x) >/dev/null 2>&1 && \
  107. X        cat <<'EOM'
  108. X(I see you are using the Korn shell.  Some ksh's blow up on Configure,
  109. Xespecially on exotic machines.  If yours does, try the Bourne shell instead.)
  110. XEOM
  111. Xfi
  112. X
  113. X: Configure runs within the UU subdirectory
  114. Xtest -d UU || mkdir UU
  115. Xcd UU && rm -f *
  116. X
  117. Xd_bsd=''
  118. Xd_eunice=''
  119. Xd_xenix=''
  120. Xeunicefix=''
  121. XMcc=''
  122. Xawk=''
  123. Xbash=''
  124. Xbison=''
  125. Xcat=''
  126. Xchgrp=''
  127. Xchmod=''
  128. Xchown=''
  129. Xcompress=''
  130. Xcp=''
  131. Xcpio=''
  132. Xcpp=''
  133. Xcsh=''
  134. Xdate=''
  135. Xecho=''
  136. Xegrep=''
  137. Xemacs=''
  138. Xexpr=''
  139. Xflex=''
  140. Xgcc=''
  141. Xgrep=''
  142. Xinews=''
  143. Xksh=''
  144. Xless=''
  145. Xline=''
  146. Xlint=''
  147. Xln=''
  148. Xlp=''
  149. Xlpr=''
  150. Xls=''
  151. Xmail=''
  152. Xmailx=''
  153. Xmake=''
  154. Xmkdir=''
  155. Xmore=''
  156. Xmv=''
  157. Xnroff=''
  158. Xperl=''
  159. Xpg=''
  160. Xpmake=''
  161. Xpr=''
  162. Xrm=''
  163. Xrmail=''
  164. Xsed=''
  165. Xsendmail=''
  166. Xsh=''
  167. Xshar=''
  168. Xsleep=''
  169. Xsmail=''
  170. Xsort=''
  171. Xsubmit=''
  172. Xtail=''
  173. Xtar=''
  174. Xtbl=''
  175. Xtest=''
  176. Xtouch=''
  177. Xtr=''
  178. Xtroff=''
  179. Xuname=''
  180. Xuniq=''
  181. Xuuname=''
  182. Xvi=''
  183. Xzcat=''
  184. Xmailpatches=''
  185. Xnotifypatches=''
  186. Xusermail=''
  187. Xhint=''
  188. Xmyuname=''
  189. XAuthor=''
  190. XDate=''
  191. XHeader=''
  192. XId=''
  193. XLocker=''
  194. XLog=''
  195. XRCSfile=''
  196. XRevision=''
  197. XSource=''
  198. XState=''
  199. Xafs=''
  200. Xbaserev=''
  201. Xbin=''
  202. Xbinexp=''
  203. Xinstallbin=''
  204. Xcc=''
  205. Xccflags=''
  206. Xcppflags=''
  207. Xldflags=''
  208. Xlkflags=''
  209. Xoptimize=''
  210. Xcf_by=''
  211. Xcf_time=''
  212. Xcontains=''
  213. Xcppminus=''
  214. Xcppstdin=''
  215. Xd_bcopy=''
  216. Xd_flock=''
  217. Xaphostname=''
  218. Xd_gethname=''
  219. Xd_phostname=''
  220. Xd_uname=''
  221. Xd_hidnet=''
  222. Xhiddennet=''
  223. Xd_open3=''
  224. Xd_portable=''
  225. Xd_rename=''
  226. Xd_index=''
  227. Xd_strchr=''
  228. Xd_strerrm=''
  229. Xd_strerror=''
  230. Xd_sysernlst=''
  231. Xd_syserrlst=''
  232. Xd_time=''
  233. Xtimetype=''
  234. Xd_uwait=''
  235. Xd_vfork=''
  236. Xd_voidsig=''
  237. Xsignal_t=''
  238. Xh_fcntl=''
  239. Xh_sysfile=''
  240. Xi_fcntl=''
  241. Xi_string=''
  242. Xstrings=''
  243. Xi_sysfile=''
  244. Xi_syswait=''
  245. Xi_systime=''
  246. Xi_systimek=''
  247. Xi_time=''
  248. Xtimeincl=''
  249. Xintsize=''
  250. Xlibc=''
  251. Xlibpth=''
  252. Xplibpth=''
  253. Xxlibpth=''
  254. Xlibs=''
  255. Xmaildir=''
  256. Xmaildirexp=''
  257. Xmailer=''
  258. Xmailfile=''
  259. Xinstallmansrc=''
  260. Xmanext=''
  261. Xmansrc=''
  262. Xmansrcexp=''
  263. Xd_flockonly=''
  264. Xd_lockflock=''
  265. Xflock_only=''
  266. Xlock_by_flock=''
  267. Xmkdep=''
  268. Xhuge=''
  269. Xlarge=''
  270. Xmedium=''
  271. Xmodels=''
  272. Xsmall=''
  273. Xsplit=''
  274. Xmydomain=''
  275. Xmyhostname=''
  276. Xphostname=''
  277. Xc=''
  278. Xn=''
  279. Xgroupcat=''
  280. Xhostcat=''
  281. Xpasscat=''
  282. Xorgname=''
  283. Xpackage=''
  284. Xspackage=''
  285. Xpatchlevel=''
  286. Xperlpath=''
  287. Xpidtype=''
  288. Xinstallprivlib=''
  289. Xprivlib=''
  290. Xprivlibexp=''
  291. Xprototype=''
  292. Xreg10=''
  293. Xreg11=''
  294. Xreg12=''
  295. Xreg13=''
  296. Xreg14=''
  297. Xreg15=''
  298. Xreg16=''
  299. Xreg1=''
  300. Xreg2=''
  301. Xreg3=''
  302. Xreg4=''
  303. Xreg5=''
  304. Xreg6=''
  305. Xreg7=''
  306. Xreg8=''
  307. Xreg9=''
  308. Xregisters=''
  309. Xinstallscript=''
  310. Xscriptdir=''
  311. Xscriptdirexp=''
  312. Xsharpbang=''
  313. Xshsharp=''
  314. Xspitshell=''
  315. Xstartperl=''
  316. Xstartsh=''
  317. Xsysman=''
  318. Xuidtype=''
  319. Xnm_opt=''
  320. Xrunnm=''
  321. Xusenm=''
  322. Xincpath=''
  323. Xmips=''
  324. Xmips_type=''
  325. Xusrinc=''
  326. Xdefvoidused=''
  327. Xvoidflags=''
  328. XCONFIG=''
  329. X
  330. X: script used to extract .SH files with variable substitutions
  331. Xcat >extract <<'EOS'
  332. XCONFIG=true
  333. Xecho "Doing variable substitutions on .SH files..."
  334. Xif test -f MANIFEST; then
  335. X    set x `awk '{print $1}' <MANIFEST | grep '\.SH'`
  336. Xelse
  337. X    echo "(Looking for .SH files under the current directory.)"
  338. X    set x `find . -name "*.SH" -print`
  339. Xfi
  340. Xshift
  341. Xcase $# in
  342. X0) set x *.SH; shift;;
  343. Xesac
  344. Xif test ! -f $1; then
  345. X    shift
  346. Xfi
  347. Xfor file in $*; do
  348. X    case "$file" in
  349. X    */*)
  350. X        dir=`expr X$file : 'X\(.*\)/'`
  351. X        file=`expr X$file : 'X.*/\(.*\)'`
  352. X        (cd $dir && . ./$file)
  353. X        ;;
  354. X    *)
  355. X        . ./$file
  356. X        ;;
  357. X    esac
  358. Xdone
  359. Xif test -f config_h.SH; then
  360. X    if test ! -f config.h; then
  361. X    : oops, they left it out of MANIFEST, probably, so do it anyway.
  362. X    . ./config_h.SH
  363. X    fi
  364. Xfi
  365. XEOS
  366. X
  367. X: produce awk script to parse command line options
  368. Xcat >options.awk <<'EOF'
  369. XBEGIN {
  370. X    optstr = "deEf:hrsSV";    # getopt-style specification
  371. X
  372. X    len = length(optstr);
  373. X    for (i = 1; i <= len; i++) {
  374. X        c = substr(optstr, i, 1);
  375. X        if (i < len) a = substr(optstr, i + 1, 1); else a = "";
  376. X        if (a == ":") {
  377. X            arg[c] = 1;
  378. X            i++;
  379. X        }
  380. X        opt[c] = 1;
  381. X    }
  382. X}
  383. X{
  384. X    expect = 0;
  385. X    str = $0;
  386. X    if (substr(str, 1, 1) != "-") {
  387. X        printf("'%s'\n", str);
  388. X        next;
  389. X    }
  390. X    len = length($0);
  391. X    for (i = 2; i <= len; i++) {
  392. X        c = substr(str, i, 1);
  393. X        if (!opt[c]) {
  394. X            printf("-%s\n", substr(str, i));
  395. X            next;
  396. X        }
  397. X        printf("-%s\n", c);
  398. X        if (arg[c]) {
  399. X            if (i < len)
  400. X                printf("'%s'\n", substr(str, i + 1));
  401. X            else
  402. X                expect = 1;
  403. X            next;
  404. X        }
  405. X    }
  406. X}
  407. XEND {
  408. X    if (expect)
  409. X        print "?";
  410. X}
  411. XEOF
  412. X
  413. X: process the command line options
  414. Xset X `for arg in "$@"; do echo $arg; done | awk -f options.awk`
  415. Xeval "set $*"
  416. Xshift
  417. Xrm -f options.awk
  418. X
  419. X: set up default values
  420. Xfastread=''
  421. Xreuseval=false
  422. Xconfig_sh=''
  423. Xalldone=''
  424. Xerror=''
  425. Xsilent=''
  426. Xextractsh=''
  427. X
  428. X: option parsing
  429. Xwhile test $# -gt 0; do
  430. X    case "$1" in
  431. X    -d) shift; fastread=yes;;
  432. X    -e) shift; alldone=cont;;
  433. X    -f)
  434. X        shift
  435. X        cd ..
  436. X        if test -r "$1"; then
  437. X            config_sh="$1"
  438. X        else
  439. X            echo "Configure: cannot read config file $1." >&2
  440. X            error=true
  441. X        fi
  442. X        cd UU
  443. X        shift;;
  444. X    -h) shift; error=true;;
  445. X    -r) shift; reuseval=true;;
  446. X    -s) shift; silent=true;;
  447. X    -E) shift; alldone=exit;;
  448. X    -S) shift; extractsh=true;;
  449. X    -V) echo "Configure generated by metaconfig 3.0 PL14." >&2
  450. X        exit 0;;
  451. X    --) break;;
  452. X    -*) echo "Configure: unknown option $1" >&2; shift; error=true;;
  453. X    *) break;;
  454. X    esac
  455. Xdone
  456. X
  457. Xcase "$error" in
  458. Xtrue)
  459. X    cat >&2 <<EOM
  460. XUsage: Configure [-dehrESV] [-f config.sh]
  461. X  -d : use defaults for all answers.
  462. X  -e : go on without questioning past the production of config.sh.
  463. X  -f : specify an alternate default configuration file.
  464. X  -h : print this help message and exit (with an error status).
  465. X  -r : reuse C symbols value if possible (skips costly nm extraction).
  466. X  -s : silent mode, only echoes questions and essential information.
  467. X  -E : stop at the end of questions, after having produced config.sh.
  468. X  -S : perform variable substitutions on all .SH files (can mix with -f)
  469. X  -V : print version number and exit (with a zero status).
  470. XEOM
  471. X    exit 1
  472. X    ;;
  473. Xesac
  474. X
  475. Xexec 4>&1
  476. Xcase "$silent" in
  477. Xtrue) exec 1>/dev/null;;
  478. Xesac
  479. X
  480. Xcase "$extractsh" in
  481. Xtrue)
  482. X    case "$config_sh" in
  483. X    '') config_sh='config.sh'; config='./config.sh';;
  484. X    /*) config="$config_sh";;
  485. X    *) config="./$config_sh";;
  486. X    esac
  487. X    echo " "
  488. X    echo "Fetching answers from $config_sh..."
  489. X    cd ..
  490. X    . $config
  491. X    echo " "
  492. X    . ./UU/extract
  493. X    rm -rf UU
  494. X    echo "Done."
  495. X    exit 0
  496. X    ;;
  497. Xesac
  498. X
  499. X: set package name
  500. Xpackage=mailagent
  501. X
  502. X: Eunice requires " " instead of "", can you believe it
  503. Xecho " "
  504. X: Here we go...
  505. Xecho "Beginning of configuration questions for $package."
  506. X
  507. Xdefine='define'
  508. Xundef='undef'
  509. Xsmallmach='pdp11 i8086 z8000 i80286 iAPX286'
  510. Xrmlist=''
  511. X
  512. Xtrap 'echo " "; rm -rf $rmlist; exit 1' 1 2 3 15
  513. X
  514. X: We must find out about Eunice early
  515. Xeunicefix=':'
  516. Xif test -f /etc/unixtovms; then
  517. X    eunicefix=/etc/unixtovms
  518. Xfi
  519. Xif test -f /etc/unixtovms.exe; then
  520. X    eunicefix=/etc/unixtovms.exe
  521. Xfi
  522. X
  523. X: list of known cpp symbols
  524. Xattrlist="__alpha DGUX M_I186 M_I286 M_I386 M_I8086 M_XENIX UTS __DGUX__"
  525. Xattrlist="$attrlist _AIX __STDC__ __m88k__ ansi bsd4_2 gcos gimpel"
  526. Xattrlist="$attrlist hp9000s300 hp9000s400 hp9000s500 hp9000s700"
  527. Xattrlist="$attrlist hp9000s800 hpux"
  528. Xattrlist="$attrlist i186 i386 i486 i8086 iAPX286 ibm interdata"
  529. Xattrlist="$attrlist m88k mc300 mc500 mc68000 mc68k mc700 mert"
  530. Xattrlist="$attrlist mips NeXT ns16000 ns32000 nsc32000 os"
  531. Xattrlist="$attrlist __osf__ pdp11 posix"
  532. Xattrlist="$attrlist pyr sinix sony sparc sun tower tower32 tower32_600"
  533. Xattrlist="$attrlist tower32_800 tss u3b2 u3b20 u3b200 u3b5 ultrix unix"
  534. Xattrlist="$attrlist __unix__ vax venix xenix z8000"
  535. X
  536. X: no include file wanted by default
  537. Xinclwanted=''
  538. X
  539. Xi_sysselct=''
  540. Xi_whoami=''
  541. X: change the next line if compiling for Xenix/286 on Xenix/386
  542. Xxlibpth='/usr/lib/386 /lib/386'
  543. X
  544. X: general looking path for locating libraries
  545. Xlibpth='/usr/lib/large /lib '$xlibpth' /lib/large'
  546. Xlibpth=$libpth' /usr/lib/small /lib/small'
  547. X
  548. X: no additional library wanted by default
  549. Xlibswanted=''
  550. X
  551. X: full support for void wanted by default
  552. Xdefvoidused=15
  553. X
  554. X
  555. X: Some greps do not return status, grrr.
  556. Xecho "grimblepritz" >grimble
  557. Xif grep blurfldyick grimble >/dev/null 2>&1 ; then
  558. X    contains=contains
  559. Xelif grep grimblepritz grimble >/dev/null 2>&1 ; then
  560. X    contains=grep
  561. Xelse
  562. X    contains=contains
  563. Xfi
  564. Xrm -f grimble
  565. X: the following should work in any shell
  566. Xcase "$contains" in
  567. Xcontains*)
  568. X    echo " "
  569. X    echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
  570. X    cat >contains <<'EOSS'
  571. Xgrep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
  572. XEOSS
  573. Xchmod +x contains
  574. Xesac
  575. X
  576. X: first determine how to suppress newline on echo command
  577. Xecho " "
  578. Xecho "Checking echo to see how to suppress newlines..."
  579. X(echo "hi there\c" ; echo " ") >.echotmp
  580. Xif $contains c .echotmp >/dev/null 2>&1 ; then
  581. X    echo "...using -n."
  582. X    n='-n'
  583. X    c=''
  584. Xelse
  585. X    cat <<'EOM'
  586. X...using \c
  587. XEOM
  588. X    n=''
  589. X    c='\c'
  590. Xfi
  591. Xecho $n "The star should be here-->$c"
  592. Xecho '*'
  593. Xrm -f .echotmp
  594. X
  595. X: Now test for existence of everything in MANIFEST
  596. Xecho " "
  597. Xif test -f ../MANIFEST; then
  598. X    echo "First let's make sure your kit is complete.  Checking..." >&4
  599. X    awk '$1 !~ /PACK[A-Z]+/ {print $1}' ../MANIFEST | split -50
  600. X    rm -f missing
  601. X    for filelist in x??; do
  602. X        (cd ..; ls `cat UU/$filelist` >/dev/null 2>>UU/missing)
  603. X    done
  604. X    if test -s missing; then
  605. X        cat missing >&4
  606. X        cat >&4 <<'EOM'
  607. X
  608. XTHIS PACKAGE SEEMS TO BE INCOMPLETE.
  609. X
  610. XYou have the option of continuing the configuration process, despite the
  611. Xdistinct possibility that your kit is damaged, by typing 'y'es.  If you
  612. Xdo, don't blame me if something goes wrong.  I advise you to type 'n'o
  613. Xand contact the author (ram@acri.fr).
  614. X
  615. XEOM
  616. X        echo $n "Continue? [n] $c" >&4
  617. X        read ans
  618. X        case "$ans" in
  619. X        y*)
  620. X            echo "Continuing..." >&4
  621. X            rm -f missing
  622. X            ;;
  623. X        *)
  624. X            echo "ABORTING..." >&4
  625. X            kill $$
  626. X            ;;
  627. X        esac
  628. X    else
  629. X        echo "Looks good..." >&4
  630. X    fi
  631. Xelse
  632. X    echo "There is no MANIFEST file.  I hope your kit is complete !"
  633. Xfi
  634. Xrm -f missing x??
  635. X
  636. X: compute the number of columns on the terminal for proper question formatting
  637. Xcase "$COLUMNS" in
  638. X'') COLUMNS='80';;
  639. Xesac
  640. X
  641. X: set up the echo used in my read
  642. Xmyecho="case \"\$xxxm\" in
  643. X'') echo $n \"\$rp $c\" >&4;;
  644. X*) case \"\$rp\" in
  645. X    '') echo $n \"[\$xxxm] $c\";;
  646. X    *)
  647. X        if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
  648. X            echo \"\$rp\" >&4
  649. X            echo $n \"[\$xxxm] $c\" >&4
  650. X        else
  651. X            echo $n \"\$rp [\$xxxm] $c\" >&4
  652. X        fi
  653. X        ;;
  654. X    esac;;
  655. Xesac"
  656. X
  657. X: now set up to do reads with possible shell escape and default assignment
  658. Xcat <<EOSC >myread
  659. Xxxxm=\$dflt
  660. X$myecho
  661. Xans='!'
  662. Xcase "\$fastread" in
  663. Xyes) case "\$dflt" in
  664. X    '') ;;
  665. X    *) ans='';
  666. X        case "\$silent-\$rp" in
  667. X        true-) ;;
  668. X        *) echo " " >&4;;
  669. X        esac;;
  670. X    esac;;
  671. X*) case "\$silent" in
  672. X    true) case "\$rp" in
  673. X        '') ans='';;
  674. X        esac;;
  675. X    esac;;
  676. Xesac
  677. Xwhile expr "X\$ans" : "X!" >/dev/null; do
  678. X    read answ
  679. X    set x \$xxxm
  680. X    shift
  681. X    aok=''; eval "ans=\"\$answ\"" && aok=y
  682. X    case  "\$answ" in
  683. X    "\$ans")
  684. X        case "\$ans" in
  685. X        "!")
  686. X            sh 1>&4
  687. X            echo " "
  688. X            $myecho
  689. X            ;;
  690. X        !*)
  691. X            set x \`expr "X\$ans" : "X!\(.*\)\$"\`
  692. X            shift
  693. X            sh 1>&4 -c "\$*"
  694. X            echo " "
  695. X            $myecho
  696. X            ;;
  697. X        esac;;
  698. X    *)
  699. X        case "\$aok" in
  700. X        y)
  701. X            echo "*** Substitution done -- please confirm."
  702. X            xxxm="\$ans"
  703. X            ans=\`echo $n "\$ans$c" | tr '\012' ' '\`
  704. X            xxxm="\$ans"
  705. X            ans=!
  706. X            ;;
  707. X        *)
  708. X            echo "*** Error -- try again."
  709. X            ans=!
  710. X            ;;
  711. X        esac
  712. X        $myecho
  713. X        ;;
  714. X    esac
  715. X    case "\$ans\$xxxm\$nostick" in
  716. X    '')
  717. X        ans=!
  718. X        $myecho
  719. X        ;;
  720. X    esac
  721. Xdone
  722. Xcase "\$ans" in
  723. X'') ans="\$xxxm";;
  724. Xesac
  725. XEOSC
  726. X
  727. X: create .config dir to save info across Configure sessions
  728. Xtest -d ../.config || mkdir ../.config
  729. Xcat >../.config/README <<EOF
  730. XThis directory created by Configure to save information that should
  731. Xpersist across sessions.
  732. X
  733. XYou may safely delete it if you wish.
  734. XEOF
  735. X
  736. X: general instructions
  737. Xneedman=true
  738. Xfirsttime=true
  739. Xuser=`( (logname) 2>/dev/null || whoami) 2>&1`
  740. Xif $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
  741. X    firsttime=false
  742. X    echo " "
  743. X    rp='Would you like to see the instructions?'
  744. X    dflt=n
  745. X    . ./myread
  746. X    case "$ans" in
  747. X    [yY]*) ;;
  748. X    *) needman=false;;
  749. X    esac
  750. Xfi
  751. Xif $needman; then
  752. X    cat <<EOH
  753. XThis installation shell script will examine your system and ask you questions
  754. Xto determine how the mailagent package should be installed. If you get
  755. Xstuck on a question, you may use a ! shell escape to start a subshell or
  756. Xexecute a command.  Many of the questions will have default answers in square
  757. Xbrackets; typing carriage return will give you the default.
  758. X
  759. XOn some of the questions which ask for file or directory names you are allowed
  760. Xto use the ~name construct to specify the login directory belonging to "name",
  761. Xeven if you don't have a shell which knows about that.  Questions where this is
  762. Xallowed will be marked "(~name ok)".
  763. X
  764. XEOH
  765. X    rp=''
  766. X    dflt='Type carriage return to continue'
  767. X    . ./myread
  768. X    cat <<'EOH'
  769. X
  770. XThe prompter used in this script allows you to use shell variables and
  771. Xbackticks in your answers.  You may use $1, $2, etc...  to refer to the words
  772. Xin the default answer, as if the default line was a set of arguments given to a
  773. Xscript shell.  This means you may also use $* to repeat the whole default line,
  774. Xso you do not have to re-type everything to add something to the default.
  775. X
  776. XEverytime there is a substitution, you will have to confirm.  If there is an
  777. Xerror (e.g. an unmatched backtick), the default answer will remain unchanged
  778. Xand you will be prompted again.
  779. X
  780. XIf you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
  781. Xthe questions and use the computed defaults (or the previous answers if there
  782. Xwas already a config.sh file). Type 'Configure -h' for a list of options.
  783. X
  784. XEOH
  785. X    . ./myread
  786. X    cat <<EOH
  787. X
  788. XMuch effort has been expended to ensure that this shell script will run on any
  789. XUnix system.  If despite that it blows up on yours, your best bet is to edit
  790. XConfigure and run it again.  Also, let me (ram@acri.fr)
  791. Xknow how I blew it.  If you can't run Configure for some reason, you'll have to
  792. Xgenerate a config.sh file by hand.
  793. X
  794. XThis installation script affects things in two ways:
  795. X
  796. X1) it may do direct variable substitutions on some of the files included
  797. X   in this kit.
  798. X2) it builds a config.h file for inclusion in C programs.  You may edit
  799. X   any of these files as the need arises after running this script.
  800. X
  801. XIf you make a mistake on a question, there is no easy way to back up to it
  802. Xcurrently.  The easiest thing to do is to edit config.sh and rerun all the SH
  803. Xfiles.  Configure will offer to let you do this before it runs the SH files.
  804. X
  805. XEOH
  806. X    dflt='Type carriage return to continue'
  807. X    . ./myread
  808. X    case "$firsttime" in
  809. X    true) echo $user >>../.config/instruct;;
  810. X    esac
  811. Xfi
  812. X
  813. X: see if sh knows # comments
  814. Xecho " "
  815. Xecho "Checking your sh to see if it knows about # comments..." >&4
  816. Xif sh -c '#' >/dev/null 2>&1 ; then
  817. X    echo "Your sh handles # comments correctly."
  818. X    shsharp=true
  819. X    spitshell=cat
  820. X    echo " "
  821. X    echo "Okay, let's see if #! works on this system..."
  822. X    echo "#!/bin/cat" >try
  823. X    $eunicefix try
  824. X    chmod +x try
  825. X    ./try > today
  826. X    if test -s today; then
  827. X        echo "It does."
  828. X        sharpbang='#!'
  829. X    else
  830. X        echo "#! /bin/cat" > try
  831. X        $eunicefix try
  832. X        chmod +x try
  833. X        ./try > today
  834. X        if test -s today; then
  835. X            echo "It does."
  836. X            sharpbang='#! '
  837. X        else
  838. X            echo "It's just a comment."
  839. X            sharpbang=': use '
  840. X        fi
  841. X    fi
  842. Xelse
  843. X    echo "Your sh doesn't grok # comments--I will strip them later on."
  844. X    shsharp=false
  845. X    echo "exec grep -v '^[     ]*#'" >spitshell
  846. X    chmod +x spitshell
  847. X    $eunicefix spitshell
  848. X    spitshell=`pwd`/spitshell
  849. X    echo "I presume that if # doesn't work, #! won't work either!"
  850. X    sharpbang=': use '
  851. Xfi
  852. Xrm -f try today
  853. X
  854. X: figure out how to guarantee sh startup
  855. Xecho " "
  856. Xecho "Checking out how to guarantee sh startup..." >&4
  857. Xcase "$SYSTYPE" in
  858. X*bsd*|sys5*) startsh=$sharpbang"/$SYSTYPE/bin/sh";;
  859. X*) startsh=$sharpbang'/bin/sh';;
  860. Xesac
  861. Xecho "Let's see if '$startsh' works..."
  862. Xcat >try <<EOSS
  863. X$startsh
  864. Xset abc
  865. Xtest "$?abc" != 1
  866. XEOSS
  867. X
  868. Xchmod +x try
  869. X$eunicefix try
  870. Xif ./try; then
  871. X    echo "Yup, it does."
  872. Xelse
  873. Xecho "Nope.  You may have to fix up the shell scripts to make sure sh runs them."
  874. Xfi
  875. Xrm -f try
  876. X
  877. X: find out where common programs are
  878. Xecho " "
  879. Xecho "Locating common programs..." >&4
  880. Xcat <<EOSC >loc
  881. X$startsh
  882. Xcase \$# in
  883. X0) exit 1;;
  884. Xesac
  885. Xthing=\$1
  886. Xshift
  887. Xdflt=\$1
  888. Xshift
  889. Xfor dir in \$*; do
  890. X    case "\$thing" in
  891. X    .)
  892. X    if test -d \$dir/\$thing; then
  893. X        echo \$dir
  894. X        exit 0
  895. X    fi
  896. X    ;;
  897. X    *)
  898. X    if test -f \$dir/\$thing; then
  899. X        echo \$dir/\$thing
  900. X        exit 0
  901. X    elif test -f \$dir/\$thing.exe; then
  902. X        : on Eunice apparently
  903. X        echo \$dir/\$thing
  904. X        exit 0
  905. X    fi
  906. X    ;;
  907. X    esac
  908. Xdone
  909. Xecho \$dflt
  910. Xexit 1
  911. XEOSC
  912. Xchmod +x loc
  913. X$eunicefix loc
  914. Xloclist="
  915. Xawk
  916. Xcat
  917. Xchgrp
  918. Xchmod
  919. Xchown
  920. Xecho
  921. Xexpr
  922. Xgrep
  923. Xmv
  924. Xrm
  925. Xsed
  926. Xsleep
  927. Xsort
  928. Xtr
  929. Xuniq
  930. X"
  931. Xtrylist="
  932. XMcc
  933. Xcpp
  934. Xdate
  935. Xinews
  936. Xmail
  937. Xnroff
  938. Xperl
  939. Xrmail
  940. Xsendmail
  941. Xsmail
  942. Xtest
  943. Xuname
  944. Xzcat
  945. X"
  946. Xpth=`echo $PATH | sed -e 's/:/ /g'`
  947. Xpth="$pth /lib /usr/lib"
  948. Xfor file in $loclist; do
  949. X    xxx=`./loc $file $file $pth`
  950. X    eval $file=$xxx
  951. X    eval _$file=$xxx
  952. X    case "$xxx" in
  953. X    /*)
  954. X        echo $file is in $xxx.
  955. X        ;;
  956. X    *)
  957. X        echo "I don't know where $file is.  I hope it's in everyone's PATH."
  958. X        ;;
  959. X    esac
  960. Xdone
  961. Xecho " "
  962. Xecho "Don't worry if any of the following aren't found..."
  963. Xsay=offhand
  964. Xfor file in $trylist; do
  965. X    xxx=`./loc $file $file $pth`
  966. X    eval $file=$xxx
  967. X    eval _$file=$xxx
  968. X    case "$xxx" in
  969. X    /*)
  970. X        echo $file is in $xxx.
  971. X        ;;
  972. X    *)
  973. X        echo "I don't see $file out there, $say."
  974. X        say=either
  975. X        ;;
  976. X    esac
  977. Xdone
  978. Xcase "$egrep" in
  979. Xegrep)
  980. X    echo "Substituting grep for egrep."
  981. X    egrep=$grep
  982. X    ;;
  983. Xesac
  984. Xcase "$test" in
  985. Xtest)
  986. X    echo "Hopefully test is built into your sh."
  987. X    ;;
  988. X*)
  989. X    if sh -c "PATH= test true" >/dev/null 2>&1; then
  990. X        echo "Using the test built into your sh."
  991. X        test=test
  992. X        _test=test
  993. X    fi
  994. X    ;;
  995. Xesac
  996. Xcase "$echo" in
  997. Xecho)
  998. X    echo "Hopefully echo is built into your sh."
  999. X    ;;
  1000. X'') ;;
  1001. X*)
  1002. X    echo " "
  1003. Xecho "Checking compatibility between $echo and builtin echo (if any)..." >&4
  1004. X    $echo $n "hi there$c" >foo1
  1005. X    echo $n "hi there$c" >foo2
  1006. X    if cmp foo1 foo2 >/dev/null 2>&1; then
  1007. X        echo "They are compatible.  In fact, they may be identical."
  1008. X    else
  1009. X        case "$n" in
  1010. X        '-n') n='' c='\c';;
  1011. X        *) n='-n' c='';;
  1012. X        esac
  1013. X        cat <<FOO
  1014. XThey are not compatible!  You are probably running ksh on a non-USG system.
  1015. XI'll have to use $echo instead of the builtin, since Bourne shell doesn't
  1016. Xhave echo built in and we may have to run some Bourne shell scripts.  That
  1017. Xmeans I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
  1018. X
  1019. XFOO
  1020. X        $echo $n "The star should be here-->$c"
  1021. X        $echo "*"
  1022. X    fi
  1023. X    $rm -f foo1 foo2
  1024. X    ;;
  1025. Xesac
  1026. X
  1027. X: Try to determine whether config.sh was made on this system
  1028. Xcase "$config_sh" in
  1029. X'')
  1030. Xmyuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
  1031. Xdflt=n
  1032. Xif test "$fastread" = yes; then
  1033. X    dflt=y
  1034. Xelif test -f ../config.sh; then
  1035. X    oldmyuname=''
  1036. X    if $contains myuname= ../config.sh >/dev/null 2>&1; then
  1037. X        eval "old`grep myuname= ../config.sh`"
  1038. X    fi
  1039. X    if test "X$myuname" = "X$oldmyuname"; then
  1040. X        dflt=y
  1041. X    fi
  1042. Xfi
  1043. X
  1044. X: Get old answers, if there is a config file out there
  1045. Xhint=default
  1046. Xif test -f ../config.sh; then
  1047. X    echo " "
  1048. X    rp="I see a config.sh file.  Did Configure make it on THIS system?"
  1049. X    . ./myread
  1050. X    case "$ans" in
  1051. X    n*|N*) echo "OK, I'll ignore it.";;
  1052. X    *)  echo "Fetching default answers from your old config.sh file..." >&4
  1053. X        tmp="$n"
  1054. X        tans="$c"
  1055. X        . ../config.sh
  1056. X        cp ../config.sh .
  1057. X        n="$tmp"
  1058. X        c="$tans"
  1059. X        hint=previous
  1060. X        ;;
  1061. X    esac
  1062. Xfi
  1063. X;;
  1064. X*)
  1065. X    echo " "
  1066. X    echo "Fetching default answers from $config_sh..." >&4
  1067. X    tmp="$n"
  1068. X    tans="$c"
  1069. X    cd ..
  1070. X    cp $config_sh config.sh 2>/dev/null
  1071. X    . ./config.sh
  1072. X    cd UU
  1073. X    cp ../config.sh .
  1074. X    n="$tmp"
  1075. X    c="$tans"
  1076. X    hint=previous
  1077. X    ;;
  1078. Xesac
  1079. X
  1080. X: Restore computed paths
  1081. Xfor file in $loclist $trylist; do
  1082. X    eval $file="\$_$file"
  1083. Xdone
  1084. X
  1085. X: who configured the system
  1086. Xcf_time=`$date 2>&1`
  1087. Xcf_by=`( (logname) 2>/dev/null || whoami) 2>&1`
  1088. X
  1089. X: decide how portable to be
  1090. Xcase "$d_portable" in
  1091. X"$define") dflt=y;;
  1092. X*)    dflt=n;;
  1093. Xesac
  1094. X$cat <<'EOH'
  1095. XI can set things up so that your shell scripts and binaries are more portable,
  1096. Xat what may be a noticable cost in performance.  In particular, if you
  1097. Xask to be portable, the following happens:
  1098. X
  1099. X     1) Shell scripts will rely on the PATH variable rather than using
  1100. X    the paths derived above.
  1101. X     2) ~username interpretations will be done at run time rather than
  1102. X    by Configure.
  1103. X     3) The system name will be determined at run time, if at all possible.
  1104. X
  1105. XEOH
  1106. Xrp="Do you expect to run these scripts and binaries on multiple machines?"
  1107. X. ./myread
  1108. Xcase "$ans" in
  1109. X    y*) d_portable="$define"
  1110. X    for file in $loclist $trylist; do
  1111. X        eval $file=$_file
  1112. X    done
  1113. X    ;;
  1114. X    *)  d_portable="$undef" ;;
  1115. Xesac
  1116. X
  1117. X: set up shell script to do ~ expansion
  1118. Xcat >filexp <<EOSS
  1119. X$startsh
  1120. X: expand filename
  1121. Xcase "\$1" in
  1122. X ~/*|~)
  1123. X    echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
  1124. X    ;;
  1125. X ~*)
  1126. X    if $test -f /bin/csh; then
  1127. X        /bin/csh -f -c "glob \$1"
  1128. X        failed=$?
  1129. X        echo ""
  1130. X        exit \$failed
  1131. X    else
  1132. X        name=\`$expr x\$1 : '..\([^/]*\)'\`
  1133. X        dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
  1134. X        if $test ! -d "\$dir"; then
  1135. X            me=\`basename \$0\`
  1136. X            echo "\$me: can't locate home directory for: \$name" >&2
  1137. X            exit 1
  1138. X        fi
  1139. X        case "\$1" in
  1140. X        */*)
  1141. X            echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
  1142. X            ;;
  1143. X        *)
  1144. X            echo \$dir
  1145. X            ;;
  1146. X        esac
  1147. X    fi
  1148. X    ;;
  1149. X*)
  1150. X    echo \$1
  1151. X    ;;
  1152. Xesac
  1153. XEOSS
  1154. Xchmod +x filexp
  1155. X$eunicefix filexp
  1156. X
  1157. X: now set up to get a file name
  1158. Xcat <<'EOSC' >getfile
  1159. Xtilde=''
  1160. Xfullpath=''
  1161. Xalready=''
  1162. Xskip=''
  1163. Xnone_ok=''
  1164. Xexp_file=''
  1165. Xorig_rp="$rp"
  1166. Xorig_dflt="$dflt"
  1167. X
  1168. Xcase "$fn" in
  1169. X*~*) tilde=true;;
  1170. Xesac
  1171. Xcase "$fn" in
  1172. X*/*) fullpath=true;;
  1173. Xesac
  1174. Xcase "$fn" in
  1175. X*+*) skip=true;;
  1176. Xesac
  1177. Xcase "$fn" in
  1178. X*n*) none_ok=true;;
  1179. Xesac
  1180. Xcase "$fn" in
  1181. X*e*) exp_file=true;;
  1182. Xesac
  1183. X
  1184. Xcase "$fn" in
  1185. X*f*) type='File';;
  1186. X*d*) type='Directory';;
  1187. X*l*) type='Locate'; fn=`expr $fn : '.*:\(.*\)'`;;
  1188. Xesac
  1189. X
  1190. Xwhat="$type"
  1191. Xcase "$what" in
  1192. XLocate) what='File';;
  1193. Xesac
  1194. X
  1195. Xcase "$exp_file" in
  1196. X'')
  1197. X    case "$d_portable" in
  1198. X    "$define") ;;
  1199. X    *) exp_file=true;;
  1200. X    esac
  1201. X    ;;
  1202. Xesac
  1203. X
  1204. Xcd ..
  1205. Xwhile test "$type"; do
  1206. X    redo=''
  1207. X    rp="$orig_rp"
  1208. X    dflt="$orig_dflt"
  1209. X    case "$tilde" in
  1210. X    true) rp="$rp (~name ok)";;
  1211. X    esac
  1212. X    . UU/myread
  1213. X    case "$ans" in
  1214. X    none)
  1215. X        value=''
  1216. X        ansexp=''
  1217. X        case "$none_ok" in
  1218. X        true) type='';;
  1219. X        esac
  1220. X        ;;
  1221. X    *)
  1222. X        case "$tilde" in
  1223. X        '') value="$ans"
  1224. X            ansexp="$ans";;
  1225. X        *)
  1226. X            value=`UU/filexp $ans`
  1227. X            case $? in
  1228. X            0)
  1229. X                if test "$ans" != "$value"; then
  1230. X                    echo "(That is $value on this particular system.)"
  1231. X                fi
  1232. X                ;;
  1233. X            *) value="$ans";;
  1234. X            esac
  1235. X            ansexp="$value"
  1236. X            case "$exp_file" in
  1237. X            '') value="$ans";;
  1238. X            esac
  1239. X            ;;
  1240. X        esac
  1241. X        case "$fullpath" in
  1242. X        true)
  1243. X            case "$ansexp" in
  1244. X            /*) value="$ansexp" ;;
  1245. X            *)
  1246. X                redo=true
  1247. X                case "$already" in
  1248. X                true)
  1249. X                echo "I shall only accept a full path name, as in /bin/ls." >&4
  1250. X                echo "Use a ! shell escape if you wish to check pathnames." >&4
  1251. X                    ;;
  1252. X                *)
  1253. X                echo "Please give a full path name, starting with slash." >&4
  1254. X                    case "$tilde" in
  1255. X                    true)
  1256. X                echo "Note that using ~name is ok provided it expands well." >&4
  1257. X                        already=true
  1258. X                        ;;
  1259. X                    esac
  1260. X                esac
  1261. X                ;;
  1262. X            esac
  1263. X            ;;
  1264. X        esac
  1265. X        case "$redo" in
  1266. X        '')
  1267. X            case "$type" in
  1268. X            File)
  1269. X                if test -f "$ansexp"; then
  1270. X                    type=''
  1271. X                elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1
  1272. X                then
  1273. X                    echo "($value is not a plain file, but that's ok.)"
  1274. X                    type=''
  1275. X                fi
  1276. X                ;;
  1277. X            Directory)
  1278. X                if test -d "$ansexp"; then
  1279. X                    type=''
  1280. X                fi
  1281. X                ;;
  1282. X            Locate)
  1283. X                if test -d "$value"; then
  1284. X                    echo "(Looking for $fn in directory $value.)"
  1285. X                    value="$value/$fn"
  1286. X                fi
  1287. X                if test -f "$value"; then
  1288. X                    type=''
  1289. X                fi
  1290. X                ;;
  1291. X            esac
  1292. X
  1293. X            case "$skip" in
  1294. X            true) type='';
  1295. X            esac
  1296. X
  1297. X            case "$type" in
  1298. X            '') ;;
  1299. X            *)
  1300. X                if test "$fastread" = yes; then
  1301. X                    dflt=y
  1302. X                else
  1303. X                    dflt=n
  1304. X                fi
  1305. X                rp="$what $value doesn't exist.  Use that name anyway?"
  1306. X                . UU/myread
  1307. X                dflt=''
  1308. X                case "$ans" in
  1309. X                y*) type='';;
  1310. X                *) echo " ";;
  1311. X                esac
  1312. X                ;;
  1313. X            esac
  1314. X            ;;
  1315. X        esac
  1316. X        ;;
  1317. X    esac
  1318. Xdone
  1319. Xcd UU
  1320. Xans="$value"
  1321. Xrp="$orig_rp"
  1322. Xdflt="$orig_dflt"
  1323. XEOSC
  1324. X
  1325. X: determine where manual pages are on this system
  1326. Xecho " "
  1327. Xcase "$sysman" in
  1328. X'') 
  1329. X    syspath='/usr/man/man1 /usr/man/man1 /usr/man/mann'
  1330. X    syspath="$syspath /usr/man/manl /usr/man/local/man1"
  1331. X    syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
  1332. X    syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
  1333. X    syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
  1334. X    syspath="$syspath /usr/man/man.L /local/man/man1"
  1335. X    sysman=`./loc . $syspath`
  1336. X    ;;
  1337. Xesac
  1338. Xif $test -d "$sysman"; then
  1339. X    echo "System manual is in $sysman." >&4
  1340. Xelse
  1341. X    echo "Could not find manual pages in source form." >&4
  1342. Xfi
  1343. X
  1344. X: see what memory models we can support
  1345. Xcase "$models" in
  1346. X'')
  1347. X    $cat >pdp11.c <<'EOP'
  1348. Xmain() {
  1349. X#ifdef pdp11
  1350. X    exit(0);
  1351. X#else
  1352. X    exit(1);
  1353. X#endif
  1354. X}
  1355. XEOP
  1356. X    cc -o pdp11 pdp11.c >/dev/null 2>&1
  1357. X    if ./pdp11 2>/dev/null; then
  1358. X        dflt='unsplit split'
  1359. X    else
  1360. X        tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
  1361. X        case "$tans" in
  1362. X        X) dflt='none';;
  1363. X        *) if $test -d /lib/small || $test -d /usr/lib/small; then
  1364. X                dflt='small'
  1365. X            else
  1366. X                dflt=''
  1367. X            fi
  1368. X            if $test -d /lib/medium || $test -d /usr/lib/medium; then
  1369. X                dflt="$dflt medium"
  1370. X            fi
  1371. X            if $test -d /lib/large || $test -d /usr/lib/large; then
  1372. X                dflt="$dflt large"
  1373. X            fi
  1374. X            if $test -d /lib/huge || $test -d /usr/lib/huge; then
  1375. X                dflt="$dflt huge"
  1376. X            fi
  1377. X        esac
  1378. X    fi;;
  1379. X*) dflt="$models";;
  1380. Xesac
  1381. X$cat <<EOM
  1382. XSome systems have different model sizes.  On most systems they are called
  1383. Xsmall, medium, large, and huge.  On the PDP11 they are called unsplit and
  1384. Xsplit.  If your system doesn't support different memory models, say "none".
  1385. XIf you wish to force everything to one memory model, say "none" here and
  1386. Xput the appropriate flags later when it asks you for other cc and ld flags.
  1387. XVenix systems may wish to put "none" and let the compiler figure things out.
  1388. X(In the following question multiple model names should be space separated.)
  1389. X
  1390. XEOM
  1391. Xrp="Which memory models are supported?"
  1392. X. ./myread
  1393. Xmodels="$ans"
  1394. X
  1395. Xcase "$models" in
  1396. Xnone)
  1397. X    small=''
  1398. X    medium=''
  1399. X    large=''
  1400. X    huge=''
  1401. X    unsplit=''
  1402. X    split=''
  1403. X    ;;
  1404. X*split)
  1405. X    case "$split" in
  1406. X    '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
  1407. X             $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
  1408. X            dflt='-i'
  1409. X        else
  1410. X            dflt='none'
  1411. X        fi;;
  1412. X    *) dflt="$split";;
  1413. X    esac
  1414. X    rp="What flag indicates separate I and D space?"
  1415. X    . ./myread
  1416. X    tans="$ans"
  1417. X    case "$tans" in
  1418. X    none) tans='';;
  1419. X    esac
  1420. X    split="$tans"
  1421. X    unsplit='';;
  1422. X*large*|*small*|*medium*|*huge*)
  1423. X    case "$models" in
  1424. X    *large*)
  1425. X        case "$large" in
  1426. X        '') dflt='-Ml';;
  1427. X        *) dflt="$large";;
  1428. X        esac
  1429. X    rp="What flag indicates large model?"
  1430. X    . ./myread
  1431. X    tans="$ans"
  1432. X    case "$tans" in
  1433. X    none) tans='';
  1434. X    esac
  1435. X    large="$tans";;
  1436. X    *) large='';;
  1437. X    esac
  1438. X    case "$models" in
  1439. X    *huge*) case "$huge" in
  1440. X        '') dflt='-Mh';;
  1441. X        *) dflt="$huge";;
  1442. X        esac
  1443. X        rp="What flag indicates huge model?"
  1444. X        . ./myread
  1445. X        tans="$ans"
  1446. X        case "$tans" in
  1447. X        none) tans='';
  1448. X        esac
  1449. X        huge="$tans";;
  1450. X    *) huge="$large";;
  1451. X    esac
  1452. X    case "$models" in
  1453. X    *medium*) case "$medium" in
  1454. X        '') dflt='-Mm';;
  1455. X        *) dflt="$medium";;
  1456. X        esac
  1457. X        rp="What flag indicates medium model?"
  1458. X        . ./myread
  1459. X        tans="$ans"
  1460. X        case "$tans" in
  1461. X        none) tans='';
  1462. X        esac
  1463. X        medium="$tans";;
  1464. X    *) medium="$large";;
  1465. X    esac
  1466. X    case "$models" in
  1467. X    *small*) case "$small" in
  1468. X        '') dflt='none';;
  1469. X        *) dflt="$small";;
  1470. X        esac
  1471. X        rp="What flag indicates small model?"
  1472. X        . ./myread
  1473. X        tans="$ans"
  1474. X        case "$tans" in
  1475. X        none) tans='';
  1476. X        esac
  1477. X        small="$tans";;
  1478. X    *) small='';;
  1479. X    esac
  1480. X    ;;
  1481. X*)
  1482. X    echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
  1483. X    ;;
  1484. Xesac
  1485. X
  1486. X: make some quick guesses about what we are up against
  1487. Xecho " "
  1488. X$echo $n "Hmm...  $c"
  1489. Xecho exit 1 >bsd
  1490. Xecho exit 1 >usg
  1491. Xecho exit 1 >v7
  1492. Xecho exit 1 >osf1
  1493. Xecho exit 1 >eunice
  1494. Xecho exit 1 >xenix
  1495. Xecho exit 1 >venix
  1496. Xd_bsd="$undef"
  1497. X$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
  1498. Xif test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
  1499. Xthen
  1500. X    echo "Looks kind of like an OSF/1 system, but we'll see..."
  1501. X    echo exit 0 >osf1
  1502. Xelif test `echo abc | tr a-z A-Z` = Abc ; then
  1503. X    xxx=`./loc addbib blurfl $pth`
  1504. X    if $test -f $xxx; then
  1505. X    echo "Looks kind of like a USG system with BSD features, but we'll see..."
  1506. X        echo exit 0 >bsd
  1507. X        echo exit 0 >usg
  1508. X    else
  1509. X        if $contains SIGTSTP foo >/dev/null 2>&1 ; then
  1510. X            echo "Looks kind of like an extended USG system, but we'll see..."
  1511. X        else
  1512. X            echo "Looks kind of like a USG system, but we'll see..."
  1513. X        fi
  1514. X        echo exit 0 >usg
  1515. X    fi
  1516. Xelif $contains SIGTSTP foo >/dev/null 2>&1 ; then
  1517. X    echo "Looks kind of like a BSD system, but we'll see..."
  1518. X    d_bsd="$define"
  1519. X    echo exit 0 >bsd
  1520. Xelse
  1521. X    echo "Looks kind of like a Version 7 system, but we'll see..."
  1522. X    echo exit 0 >v7
  1523. Xfi
  1524. Xcase "$eunicefix" in
  1525. X*unixtovms*)
  1526. X    $cat <<'EOI'
  1527. XThere is, however, a strange, musty smell in the air that reminds me of
  1528. Xsomething...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
  1529. XEOI
  1530. X    echo exit 0 >eunice
  1531. X    d_eunice="$define"
  1532. X: it so happens the Eunice I know will not run shell scripts in Unix format
  1533. X    ;;
  1534. X*)
  1535. X    echo " "
  1536. X    echo "Congratulations.  You aren't running Eunice."
  1537. X    d_eunice="$undef"
  1538. X    ;;
  1539. Xesac
  1540. Xif test -f /xenix; then
  1541. X    echo "Actually, this looks more like a XENIX system..."
  1542. X    echo exit 0 >xenix
  1543. X    d_xenix="$define"
  1544. Xelse
  1545. X    echo " "
  1546. X    echo "It's not Xenix..."
  1547. X    d_xenix="$undef"
  1548. Xfi
  1549. Xchmod +x xenix
  1550. X$eunicefix xenix
  1551. Xif test -f /venix; then
  1552. X    echo "Actually, this looks more like a VENIX system..."
  1553. X    echo exit 0 >venix
  1554. Xelse
  1555. X    echo " "
  1556. X    if xenix; then
  1557. X        : null
  1558. X    else
  1559. X        echo "Nor is it Venix..."
  1560. X    fi
  1561. Xfi
  1562. Xchmod +x bsd usg v7 osf1 eunice xenix venix
  1563. X$eunicefix bsd usg v7 osf1 eunice xenix venix
  1564. X$rm -f foo
  1565. X
  1566. X: see if we need a special compiler
  1567. Xecho " "
  1568. Xif usg; then
  1569. X    case "$cc" in
  1570. X    '') case "$Mcc" in
  1571. X        /*) dflt='Mcc';;
  1572. X        *) case "$large" in
  1573. X            -M*) dflt='cc';;
  1574. X            *)    if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
  1575. X                    if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
  1576. X                        dflt='cc'
  1577. X                    else
  1578. X                        dflt='cc -M'
  1579. X                    fi
  1580. X                else
  1581. X                    dflt='cc'
  1582. X                fi;;
  1583. X            esac;;
  1584. X        esac;;
  1585. X    *)  dflt="$cc";;
  1586. X    esac
  1587. X    $cat <<'EOM'
  1588. XOn some systems the default C compiler will not resolve multiple global
  1589. Xreferences that happen to have the same name.  On some such systems the "Mcc"
  1590. Xcommand may be used to force these to be resolved.  On other systems a "cc -M"
  1591. Xcommand is required.  (Note that the -M flag on other systems indicates a
  1592. Xmemory model to use!) If you have the Gnu C compiler, you might wish to use
  1593. Xthat instead.
  1594. X
  1595. XEOM
  1596. X    rp="What command will force resolution on this system?"
  1597. X    . ./myread
  1598. X    cc="$ans"
  1599. Xelse
  1600. X    case "$cc" in
  1601. X    '') dflt=cc;;
  1602. X    *) dflt="$cc";;
  1603. X    esac
  1604. X    rp="Use which C compiler?"
  1605. X    . ./myread
  1606. X    cc="$ans"
  1607. Xfi
  1608. Xcase "$cc" in
  1609. Xgcc*) cpp=`./loc gcc-cpp $cpp $pth`;;
  1610. Xesac
  1611. X
  1612. X: What should the include directory be ?
  1613. Xecho " "
  1614. X$echo $n "Hmm...  $c"
  1615. Xcase "$usrinc" in
  1616. X'') dflt='/usr/include';;
  1617. X*) dflt=$usrinc;;
  1618. Xesac
  1619. Xincpath=''
  1620. Xmips_type=''
  1621. Xif $test -f /bin/mips && /bin/mips; then
  1622. X    echo "Looks like a MIPS system..."
  1623. X    $cat >usr.c <<'EOCP'
  1624. X#ifdef SYSTYPE_BSD43
  1625. X/bsd43
  1626. X#endif
  1627. XEOCP
  1628. X    if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
  1629. X        dflt='/bsd43/usr/include'
  1630. X        incpath='/bsd43'
  1631. X        mips_type='BSD 4.3'
  1632. X    else
  1633. X        mips_type='System V'
  1634. X    fi
  1635. X    $rm -f usr.c usr.out
  1636. X    echo "and you're compiling with the $mips_type compiler and libraries."
  1637. Xelse
  1638. X    echo "Doesn't look like a MIPS system."
  1639. X    echo "exit 1" >mips
  1640. X    chmod +x mips
  1641. X    $eunicefix mips
  1642. Xfi
  1643. Xecho " "
  1644. Xfn=d/
  1645. Xrp='Where are the include files you want to use?'
  1646. X. ./getfile
  1647. Xusrinc="$ans"
  1648. X
  1649. X: Set private lib path
  1650. Xcase "$plibpth" in
  1651. X'') if mips; then
  1652. X        plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
  1653. X    else
  1654. X        plibpth="/usr/ccs/lib /usr/lib /usr/ucblib /usr/local/lib"
  1655. X    fi;;
  1656. Xesac
  1657. Xlibpth="$plibpth $libpth"
  1658. X
  1659. X: Looking for optional libraries
  1660. Xecho " "
  1661. Xecho "Checking for optional libraries..." >&4
  1662. Xcase "$libs" in
  1663. X' '|'') dflt='';;
  1664. X*) dflt="$libs";;
  1665. Xesac
  1666. Xcase "$libswanted" in
  1667. X'') libswanted='c_s';;
  1668. Xesac
  1669. Xfor thislib in $libswanted; do
  1670. X    case "$thislib" in
  1671. X    dbm) thatlib=ndbm;;
  1672. X    *_s) thatlib=NONE;;
  1673. X    *) thatlib="${thislib}_s";;
  1674. X    *) thatlib=NONE;;
  1675. X    esac
  1676. X    yyy="$incpath/usr/ccs/lib $incpath/usr/lib $incpath/usr/ucblib"
  1677. X    yyy="$yyy $incpath/usr/local/lib $incpath/lib"
  1678. X    xxx=`./loc lib$thislib.a X $yyy`
  1679. X    if $test -f $xxx; then
  1680. X        echo "Found -l$thislib."
  1681. X        case "$dflt" in
  1682. X        *-l$thislib*|*-l$thatlib*);;
  1683. X        *) dflt="$dflt -l$thislib";;
  1684. X        esac
  1685. X    else
  1686. X        xxx=`./loc lib$thislib.a X $libpth`
  1687. X        if $test -f $xxx; then
  1688. X            echo "Found $xxx."
  1689. X            case "$dflt" in
  1690. X            *$xxx*);;
  1691. X            *) dflt="$dflt $xxx";;
  1692. X            esac
  1693. X        else
  1694. X            xxx=`./loc Slib$thislib.a X $xlibpth`
  1695. X            if $test -f $xxx; then
  1696. X                echo "Found -l$thislib."
  1697. X                case "$dflt" in
  1698. X                *-l$thislib*|*-l$thatlib*);;
  1699. X                *) dflt="$dflt -l$thislib";;
  1700. X                esac
  1701. X            else
  1702. X                echo "No -l$thislib."
  1703. X            fi
  1704. X        fi
  1705. X    fi
  1706. Xdone
  1707. Xset X $dflt
  1708. Xshift
  1709. Xdflt="$*"
  1710. Xcase "$libs" in
  1711. X'') dflt="$dflt";;
  1712. X*) dflt="$libs";;
  1713. Xesac
  1714. Xcase "$dflt" in
  1715. X' '|'') dflt='none';;
  1716. Xesac
  1717. X
  1718. X$cat <<EOM
  1719. XSome versions of Unix support shared libraries, which make executables smaller
  1720. Xbut make load time slightly longer.
  1721. X
  1722. XOn some systems, mostly newer Unix System V's, the shared library is included
  1723. Xby putting the option "-lc_s" as the last thing on the cc command line when
  1724. Xlinking.  Other systems use shared libraries by default.  There may be other
  1725. Xlibraries needed to compile $package on your machine as well.  If your system
  1726. Xneeds the "-lc_s" option, include it here.  Include any other special libraries
  1727. Xhere as well.  Say "none" for none.
  1728. XEOM
  1729. X
  1730. Xecho " "
  1731. Xrp="Any additional libraries?"
  1732. X. ./myread
  1733. Xcase "$ans" in
  1734. Xnone) libs=' ';;
  1735. X*) libs="$ans";;
  1736. Xesac
  1737. X
  1738. X: see if nm is to be used to determine whether a symbol is defined or not
  1739. Xcase "$usenm" in
  1740. X'')
  1741. X    dflt=`egrep 'inlibc|csym' ../Configure | wc -l 2>/dev/null`
  1742. X    if $test $dflt -gt 20; then
  1743. X        dflt=y
  1744. X    else
  1745. X        dflt=n
  1746. X    fi
  1747. X    ;;
  1748. X*)
  1749. X    case "$usenm" in
  1750. X    true) dflt=y;;
  1751. X    *) dflt=n;;
  1752. X    esac
  1753. X    ;;
  1754. Xesac
  1755. X$cat <<EOM
  1756. X
  1757. XI can use 'nm' to extract the symbols from your C libraries. This is a time
  1758. Xconsuming task which may generate huge output on the disk (up to 3 megabytes)
  1759. Xbut that should make the symbols extraction faster. The alternative is to skip
  1760. Xthe 'nm' extraction part and to compile a small test program instead to
  1761. Xdetermine whether each symbol is present. If you have a fast C compiler and/or
  1762. Xif your 'nm' output cannot be parsed, this may be the best solution.
  1763. X
  1764. XEOM
  1765. Xrp='Shall I use nm to extract C symbols from the libraries?'
  1766. X. ./myread
  1767. Xcase "$ans" in
  1768. Xn|N) usenm=false;;
  1769. X*) usenm=true;;
  1770. Xesac
  1771. X
  1772. Xrunnm=$usenm
  1773. Xcase "$reuseval" in
  1774. Xtrue) runnm=false;;
  1775. Xesac
  1776. X
  1777. X: nm options which may be necessary
  1778. Xcase "$nm_opt" in
  1779. X'') if $test -f /mach_boot; then
  1780. X        nm_opt=''
  1781. X    elif $test -d /usr/ccs/lib; then
  1782. X        nm_opt='-p'
  1783. X    elif $test -f /dgux; then
  1784. X        nm_opt='-p'
  1785. X    else
  1786. X        nm_opt=''
  1787. X    fi;;
  1788. Xesac
  1789. X
  1790. Xcase "$runnm" in
  1791. Xtrue)
  1792. X: get list of predefined functions in a handy place
  1793. Xecho " "
  1794. Xcase "$libc" in
  1795. X'') libc=unknown
  1796. X    case "$libs" in
  1797. X    *-lc_s*) libc=`./loc libc_s.a $libc $libpth`
  1798. X    esac
  1799. X    ;;
  1800. Xesac
  1801. Xlibpth="$plibpth $libpth"
  1802. Xlibnames='';
  1803. Xcase "$libs" in
  1804. X'') ;;
  1805. X*)  for thislib in $libs; do
  1806. X    case "$thislib" in
  1807. X    -l*)
  1808. X        thislib=`expr X$thislib : 'X-l\(.*\)'`
  1809. X        try=`./loc lib$thislib.a blurfl/dyick $libpth`
  1810. X        if test ! -f $try; then
  1811. X            try=`./loc lib$thislib blurfl/dyick $libpth`
  1812. X            if test ! -f $try; then
  1813. X                try=`./loc $thislib blurfl/dyick $libpth`
  1814. X                if test ! -f $try; then
  1815. X                    try=`./loc Slib$thislib.a blurfl/dyick $xlibpth`
  1816. X                    if test ! -f $try; then
  1817. X                        try=''
  1818. X                    fi
  1819. X                fi
  1820. X            fi
  1821. X        fi
  1822. X        libnames="$libnames $try"
  1823. X        ;;
  1824. X    *) libnames="$libnames $thislib" ;;
  1825. X    esac
  1826. X    done
  1827. X    ;;
  1828. Xesac
  1829. Xxxx=normal
  1830. Xcase "$libc" in
  1831. Xunknown)
  1832. X    set /usr/ccs/lib/libc.so
  1833. X    $test -r $1 || set /usr/lib/libc.so
  1834. X    $test -r $1 || set /usr/shlib/libc.so
  1835. X    $test -r $1 || set /usr/lib/libc.so.[0-9]*
  1836. X    $test -r $1 || set /lib/libsys_s.a
  1837. X    eval set \$$#
  1838. X    ;;
  1839. X*)
  1840. X    set blurfl
  1841. X    ;;
  1842. Xesac
  1843. Xif $test -r "$1"; then
  1844. X    echo "Your (shared) C library seems to be in $1."
  1845. X    libc="$1"
  1846. Xelif $test -r /lib/libc && $test -r /lib/clib; then
  1847. X    echo "Your C library seems to be in both /lib/clib and /lib/libc."
  1848. X    xxx=apollo
  1849. X    libc='/lib/clib /lib/libc'
  1850. X    if $test -r /lib/syslib; then
  1851. X        echo "(Your math library is in /lib/syslib.)"
  1852. X        libc="$libc /lib/syslib"
  1853. X    fi
  1854. Xelif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
  1855. X    echo "Your C library seems to be in $libc, as you said before."
  1856. Xelif $test -r $incpath/usr/lib/libc.a; then
  1857. X    libc=$incpath/usr/lib/libc.a;
  1858. X    echo "Your C library seems to be in $libc.  That's fine."
  1859. Xelif $test -r /lib/libc.a; then
  1860. X    libc=/lib/libc.a;
  1861. X    echo "Your C library seems to be in $libc.  You're normal."
  1862. Xelse
  1863. X    if tans=`./loc libc.a blurfl/dyick $libpth`; $test -r "$tans"; then
  1864. X        :
  1865. X    elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
  1866. X        libnames="$libnames "`./loc clib blurfl/dyick $libpth`
  1867. X    elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
  1868. X        :
  1869. X    elif tans=`./loc Slibc.a blurfl/dyick $xlibpth`; $test -r "$tans"; then
  1870. X        :
  1871. X    elif tans=`./loc Mlibc.a blurfl/dyick $xlibpth`; $test -r "$tans"; then
  1872. X        :
  1873. X    else
  1874. X        tans=`./loc Llibc.a blurfl/dyick $xlibpth`
  1875. X    fi
  1876. X    if $test -r "$tans"; then
  1877. X        echo "Your C library seems to be in $tans, of all places."
  1878. X        libc=$tans
  1879. X    else
  1880. X        libc='blurfl'
  1881. X    fi
  1882. Xfi
  1883. Xif $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
  1884. X    dflt="$libc"
  1885. X    cat <<EOM
  1886. X
  1887. XIf the guess above is wrong (which it might be if you're using a strange
  1888. Xcompiler, or your machine supports multiple models), you can override it here.
  1889. X
  1890. XEOM
  1891. Xelse
  1892. X    dflt=''
  1893. X    echo $libpth | tr ' ' '\012' | sort | uniq > libpath
  1894. X    cat >&4 <<EOM
  1895. XI can't seem to find your C library.  I've looked in the following places:
  1896. X
  1897. XEOM
  1898. X    $sed 's/^/    /' libpath
  1899. X    cat <<EOM
  1900. X
  1901. XNone of these seems to contain your C library. I need to get its name...
  1902. X
  1903. XEOM
  1904. Xfi
  1905. Xfn=f
  1906. Xrp='Where is your C library?'
  1907. X. ./getfile
  1908. Xlibc="$ans"
  1909. X
  1910. Xecho " "
  1911. Xecho $libc $libnames | tr ' ' '\012' | sort | uniq > libnames
  1912. Xset X `cat libnames`
  1913. Xshift
  1914. Xxxx=files
  1915. Xcase $# in 1) xxx=file; esac
  1916. Xecho "Extracting names from the following $xxx for later perusal:" >&4
  1917. Xecho " "
  1918. X$sed 's/^/    /' libnames >&4
  1919. Xecho " "
  1920. X$echo $n "This may take a while...$c" >&4
  1921. X
  1922. Xnm $nm_opt $* 2>/dev/null >libc.tmp
  1923. X$echo $n ".$c"
  1924. X$grep fprintf libc.tmp > libc.ptf
  1925. Xxscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
  1926. Xxrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
  1927. Xif com="$sed -n -e 's/^.* [ADTS]  *_[_.]*//p' -e 's/^.* [ADTS] //p'";\
  1928. X    eval $xscan;\
  1929. X    $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  1930. X        eval $xrun
  1931. Xelif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
  1932. X    eval $xscan;\
  1933. X    $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  1934. X        eval $xrun
  1935. Xelif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
  1936. X    eval $xscan;\
  1937. X    $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  1938. X        eval $xrun
  1939. Xelif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
  1940. X    eval $xscan;\
  1941. X    $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  1942. X        eval $xrun
  1943. Xelif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
  1944. X    eval $xscan;\
  1945. X    $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  1946. X        eval $xrun
  1947. Xelif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
  1948. X    eval $xscan;\
  1949. X    $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  1950. X        eval $xrun
  1951. Xelif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
  1952. X                -e '/ file/d' -e 's/^\([^     ]*\).*/\1/p'";\
  1953. X    eval $xscan;\
  1954. X    $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  1955. X        eval $xrun
  1956. Xelif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
  1957. X    eval $xscan;\
  1958. X    $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  1959. X        eval $xrun
  1960. Xelif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
  1961. X    eval $xscan;\
  1962. X    $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  1963. X        eval $xrun
  1964. Xelse
  1965. X    nm -p $* 2>/dev/null >libc.tmp
  1966. X    com="$sed -n -e 's/^.* [ADTS]  *_[_.]*//p' -e 's/^.* [ADTS] //p'";\
  1967. X    eval "<libc.tmp $com >libc.list"
  1968. X    if $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  1969. X        nm_opt='-p'
  1970. X        echo "done" >&4
  1971. X    else
  1972. X        echo " "
  1973. X        echo "nm didn't seem to work right. Trying ar instead..." >&4
  1974. X        com=''
  1975. X        if ar t $libc > libc.tmp; then
  1976. X            for thisname in $libnames; do
  1977. X                ar t $thisname >>libc.tmp
  1978. X            done
  1979. X            $sed -e 's/\.o$//' < libc.tmp > libc.list
  1980. X            echo "Ok." >&4
  1981. X        else
  1982. X            echo "ar didn't seem to work right." >&4
  1983. X            echo "Maybe this is a Cray...trying bld instead..." >&4
  1984. X            if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
  1985. X                for thisname in $libnames; do
  1986. X                    bld t $libnames | \
  1987. X                    $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
  1988. X                    ar t $thisname >>libc.tmp
  1989. X                done
  1990. X                echo "Ok." >&4
  1991. X            else
  1992. X                echo "That didn't work either.  Giving up." >&4
  1993. X                exit 1
  1994. X            fi
  1995. X        fi
  1996. X    fi
  1997. Xfi
  1998. Xnm_extract="$com"
  1999. Xif $test -f /lib/syscalls.exp; then
  2000. X    echo " "
  2001. X    echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
  2002. X    $sed -n 's/^\([^     ]*\)[     ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list
  2003. Xfi
  2004. X;;
  2005. Xesac
  2006. X$rm -f libnames libpath
  2007. X
  2008. X: determine optimize, if desired, or use for debug flag also
  2009. Xcase "$optimize" in
  2010. X' ') dflt="none";;
  2011. X'') dflt="-O";;
  2012. X*) dflt="$optimize";;
  2013. Xesac
  2014. X$cat <<EOH
  2015. X
  2016. XSome C compilers have problems with their optimizers, by default, $package
  2017. Xcompiles with the -O flag to use the optimizer.  Alternately, you might want
  2018. Xto use the symbolic debugger, which uses the -g flag (on traditional Unix
  2019. Xsystems).  Either flag can be specified here.  To use neither flag, specify
  2020. Xthe word "none".
  2021. X
  2022. XEOH
  2023. Xrp="What optimizer/debugger flag should be used?"
  2024. X. ./myread
  2025. Xoptimize="$ans"
  2026. Xcase "$optimize" in
  2027. X'none') optimize=" ";;
  2028. Xesac
  2029. X
  2030. Xcase "$ccflags" in
  2031. X'')    case "$cc" in
  2032. X    *gcc*) dflt='-fpcc-struct-return';;
  2033. X    *) dflt='';;
  2034. X    esac
  2035. X    case "$optimize" in
  2036. X    *-g*) dflt="$dflt -DDEBUG";;
  2037. X    esac
  2038. X    case "$cc" in
  2039. X    *gcc*)    if test -d /etc/conf/kconfig.d &&
  2040. X          $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
  2041. X        then
  2042. X            dflt="$dflt -posix"
  2043. X        fi
  2044. X        ;;
  2045. X    esac
  2046. X    ;;
  2047. X*) dflt="$ccflags" ;;
  2048. Xesac
  2049. X
  2050. Xcase "$mips_type" in
  2051. X*BSD*) ;;
  2052. X'') ;;
  2053. X*) inclwanted="$inclwanted $usrinc/bsd";;
  2054. Xesac
  2055. Xfor thisincl in $inclwanted; do
  2056. X    if $test -d $thisincl; then
  2057. X        if $test x$thisincl != x$usrinc; then
  2058. X            case "$dflt" in
  2059. X            *$thisincl*);;
  2060. X            *) dflt="$dflt -I$thisincl";;
  2061. X            esac
  2062. X        fi
  2063. X    fi
  2064. Xdone
  2065. X
  2066. Xinctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
  2067. X    xxx=true;
  2068. Xelif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
  2069. X    xxx=true;
  2070. Xelse
  2071. X    xxx=false;
  2072. Xfi;
  2073. Xif $xxx; then
  2074. X    case "$dflt" in
  2075. X    *$2*);;
  2076. X    *) dflt="$dflt -D$2";;
  2077. X    esac;
  2078. Xfi'
  2079. X
  2080. Xif ./osf1; then
  2081. X    set signal.h __LANGUAGE_C__; eval $inctest
  2082. Xelse
  2083. X    set signal.h LANGUAGE_C; eval $inctest
  2084. Xfi
  2085. Xset signal.h NO_PROTOTYPE; eval $inctest
  2086. Xset signal.h _NO_PROTO; eval $inctest
  2087. X
  2088. Xcase "$dflt" in
  2089. X'') dflt=none;;
  2090. Xesac
  2091. X$cat <<EOH
  2092. X
  2093. XYour C compiler may want other flags.  For this question you should include
  2094. X-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
  2095. Xbut you should NOT include libraries or ld flags like -lwhatever.  If you
  2096. Xwant $package to honor its debug switch, you should include -DDEBUG here.
  2097. XTo use no flags, specify the word "none".
  2098. X
  2099. XEOH
  2100. Xset X $dflt
  2101. Xshift
  2102. Xdflt=${1+"$@"}
  2103. Xrp="Any additional cc flags?"
  2104. X. ./myread
  2105. Xcase "$ans" in
  2106. Xnone) ccflags='';;
  2107. X*) ccflags="$ans";;
  2108. Xesac
  2109. X
  2110. X: the following weeds options from ccflags that are of no interest to cpp
  2111. Xcppflags="$ccflags"
  2112. Xcase "$cc" in
  2113. X*gcc*) cppflags="$cppflags -D__GNUC__";;
  2114. Xesac
  2115. Xcase "$mips_type" in
  2116. X'');;
  2117. X*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
  2118. Xesac
  2119. Xcase "$cppflags" in
  2120. X'');;
  2121. X*)  set X $cppflags
  2122. X    cppflags=''
  2123. X    for flag
  2124. X    do
  2125. X        case $flag in
  2126. X        -D*|-I*|-traditional|-ansi|-nostdinc) cppflags="$cppflags $flag";;
  2127. X        esac
  2128. X    done
  2129. X    case "$cppflags" in
  2130. X    *-*)  echo "(C preprocessor flags: $cppflags)";;
  2131. X    esac
  2132. X    ;;
  2133. Xesac
  2134. X
  2135. X: flags used in final linking phase
  2136. Xcase "$ldflags" in
  2137. X'') if venix; then
  2138. X        dflt='-i -z'
  2139. X    else
  2140. X        dflt='none'
  2141. X    fi
  2142. X    ;;
  2143. X*) dflt="$ldflags";;
  2144. Xesac
  2145. Xecho " "
  2146. Xrp="Any additional ld flags (NOT including libraries)?"
  2147. X. ./myread
  2148. Xcase "$ans" in
  2149. Xnone) ldflags='';;
  2150. X*) ldflags="$ans";;
  2151. Xesac
  2152. Xrmlist="$rmlist pdp11"
  2153. X
  2154. X: is a C symbol defined?
  2155. Xcsym='tlook=$1;
  2156. Xcase "$3" in
  2157. X-v) tf=libc.tmp; tc=""; tdc="";;
  2158. X-a) tf=libc.tmp; tc="[0]"; tdc=[];;
  2159. X*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
  2160. Xesac;
  2161. Xtx=yes;
  2162. Xcase "$reuseval-$4" in
  2163. Xtrue-) ;;
  2164. Xtrue-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
  2165. Xesac;
  2166. Xcase "$tx" in
  2167. Xyes)
  2168. X    case "$runnm" in
  2169. X    true)
  2170. X        if $contains $tlook $tf >/dev/null 2>&1;
  2171. X        then tval=true;
  2172. X        else tval=false;
  2173. X        fi;;
  2174. X    *)
  2175. X        echo "main() { extern int $1$tdc; printf(\"%d\", $1$tc); }" > t.c;
  2176. X        if $cc $ccflags -o t t.c $ldflags $libs >/dev/null 2>&1;
  2177. X        then tval=true;
  2178. X        else tval=false;
  2179. X        fi;
  2180. X        $rm -f t t.c;;
  2181. X    esac;;
  2182. X*)
  2183. X    case "$tval" in
  2184. X    $define) tval=true;;
  2185. X    *) tval=false;;
  2186. X    esac;;
  2187. Xesac;
  2188. Xeval "$2=$tval"'
  2189. X
  2190. X: set up the script used to warn in case of inconsistency
  2191. Xcat <<'EOSC' >whoa
  2192. Xdflt=y
  2193. Xecho " "
  2194. Xecho "*** WHOA THERE!!! ***" >&4
  2195. Xecho "    The $hint value for \$$var on this machine was \"$was\"!" >&4
  2196. Xrp="    Keep the $hint value?"
  2197. X. ./myread
  2198. Xcase "$ans" in
  2199. Xy) td=$was; tu=$was;;
  2200. Xesac
  2201. XEOSC
  2202. X
  2203. X: define an is-in-libc? function
  2204. Xinlibc='echo " "; td=$define; tu=$undef;
  2205. Xsym=$1; var=$2; eval "was=\$$2";
  2206. Xtx=yes;
  2207. Xcase "$reuseval$was" in
  2208. Xtrue) ;;
  2209. Xtrue*) tx=no;;
  2210. Xesac;
  2211. Xcase "$tx" in
  2212. Xyes)
  2213. X    set $sym tres -f;
  2214. X    eval $csym;
  2215. X    case "$tres" in
  2216. X    true)
  2217. X        echo "$sym() found." >&4;
  2218. X        case "$was" in $undef) . whoa; esac; eval "$var=\$td";;
  2219. X    *)
  2220. X        echo "$sym() NOT found." >&4;
  2221. X        case "$was" in $define) . whoa; esac; eval "$var=\$tu";;
  2222. X    esac;;
  2223. X*)
  2224. X    case "$was" in
  2225. X    $define) echo "$sym() found." >&4;;
  2226. X    *) echo "$sym() NOT found." >&4;;
  2227. X    esac;;
  2228. Xesac'
  2229. X
  2230. X: see if bcopy exists
  2231. Xset bcopy d_bcopy
  2232. Xeval $inlibc
  2233. X
  2234. X: see if we have to deal with yellow pages, now NIS.
  2235. Xif $test -d /usr/etc/yp || $test -d /etc/yp; then
  2236. X    if $test -f /usr/etc/nibindd; then
  2237. X        echo " "
  2238. X        echo "I'm fairly confident you're on a NeXT."
  2239. X        echo " "
  2240. X        rp='Do you get the hosts file via NetInfo?'
  2241. X        dflt=y
  2242. X        case "$hostcat" in
  2243. X        nidump*) ;;
  2244. X        '') ;;
  2245. X        *) dflt=n;;
  2246. X        esac
  2247. X        . ./myread
  2248. X        case "$ans" in
  2249. X        y*) hostcat='nidump hosts .';;
  2250. X        *) hostcat='cat /etc/hosts';;
  2251. X        esac
  2252. X    fi
  2253. X    case "$hostcat" in
  2254. X    nidump*) ;;
  2255. X    *)
  2256. X        case "$hostcat" in
  2257. X        *ypcat*) dflt=y;;
  2258. X        '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
  2259. X                dflt=y
  2260. X            else
  2261. X                dflt=n
  2262. X            fi;;
  2263. X        *) dflt=n;;
  2264. X        esac
  2265. X        echo " "
  2266. X        rp='Are you getting the hosts file via yellow pages?'
  2267. X        . ./myread
  2268. X        case "$ans" in
  2269. X        y*) hostcat='ypcat hosts';;
  2270. X        *) hostcat='cat /etc/hosts';;
  2271. X        esac
  2272. X        ;;
  2273. X    esac
  2274. Xfi
  2275. X
  2276. X: now get the host name
  2277. Xecho " "
  2278. Xecho "Figuring out host name..." >&4
  2279. Xcase "$myhostname" in
  2280. X'') cont=true
  2281. X    echo 'Maybe "hostname" will work...'
  2282. X    if tans=`sh -c hostname 2>&1` ; then
  2283. X        myhostname=$tans
  2284. X        phostname=hostname
  2285. X        cont=''
  2286. X    fi
  2287. X    ;;
  2288. X*) cont='';;
  2289. Xesac
  2290. Xif $test "$cont"; then
  2291. X    if xenix; then
  2292. X        echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
  2293. X        if tans=`cat /etc/systemid 2>&1` ; then
  2294. X            myhostname=$tans
  2295. X            phostname='cat /etc/systemid'
  2296. X            echo "Whadyaknow.  Xenix always was a bit strange..."
  2297. X            cont=''
  2298. X        fi
  2299. X    elif $test -r /etc/systemid; then
  2300. X        echo "(What is a non-Xenix system doing with /etc/systemid?)"
  2301. X    fi
  2302. Xfi
  2303. Xif $test "$cont"; then
  2304. X    echo 'No, maybe "uuname -l" will work...'
  2305. X    if tans=`sh -c 'uuname -l' 2>&1` ; then
  2306. X        myhostname=$tans
  2307. X        phostname='uuname -l'
  2308. X    else
  2309. X        echo 'Strange.  Maybe "uname -n" will work...'
  2310. X        if tans=`sh -c 'uname -n' 2>&1` ; then
  2311. X            myhostname=$tans
  2312. X            phostname='uname -n'
  2313. X        else
  2314. X            echo 'Oh well, maybe I can mine it out of whoami.h...'
  2315. X            if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
  2316. X                myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
  2317. X                phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
  2318. X            else
  2319. X                case "$myhostname" in
  2320. X                '') echo "Does this machine have an identity crisis or something?"
  2321. X                    phostname='';;
  2322. X                *)
  2323. X                    echo "Well, you said $myhostname before..."
  2324. X                    phostname='echo $myhostname';;
  2325. X                esac
  2326. X            fi
  2327. X        fi
  2328. X    fi
  2329. Xfi
  2330. X: you do not want to know about this
  2331. Xset $myhostname
  2332. Xmyhostname=$1
  2333. X
  2334. X: translate upper to lower if necessary
  2335. Xcase "$myhostname" in
  2336. X*[A-Z]*)
  2337. X    myhostname=`echo $myhostname | tr '[A-Z]' '[a-z]'`
  2338. X    echo "(Normalizing case in your host name)"
  2339. X    ;;
  2340. Xesac
  2341. X
  2342. X: verify guess
  2343. Xif $test "$myhostname" ; then
  2344. X    dflt=y
  2345. X    rp='Your host name appears to be "'$myhostname'".'" Right?"
  2346. X    . ./myread
  2347. X    case "$ans" in
  2348. X    y*) ;;
  2349. X    *) myhostname='';;
  2350. X    esac
  2351. Xfi
  2352. X
  2353. X: bad guess or no guess
  2354. Xwhile $test "X$myhostname" = X ; do
  2355. X    dflt=''
  2356. X    rp="Please type the (one word) name of your host:"
  2357. X    . ./myread
  2358. X    myhostname="$ans"
  2359. Xdone
  2360. X
  2361. Xcase "$myhostname" in
  2362. X*.*)
  2363. X    dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
  2364. X    myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
  2365. X    echo "(Trimming domain name from host name--host name is now $myhostname)"
  2366. X    ;;
  2367. X*) case "$mydomain" in
  2368. END_OF_FILE
  2369.   if test 49998 -ne `wc -c <'Configure.01'`; then
  2370.     echo shar: \"'Configure.01'\" unpacked with wrong size!
  2371.   fi
  2372.   # end of 'Configure.01'
  2373. fi
  2374. if test -f 'agent/test/misc/compress.t' -a "${1}" != "-c" ; then 
  2375.   echo shar: Will not clobber existing file \"'agent/test/misc/compress.t'\"
  2376. else
  2377.   echo shar: Extracting \"'agent/test/misc/compress.t'\" \(1969 characters\)
  2378.   sed "s/^X//" >'agent/test/misc/compress.t' <<'END_OF_FILE'
  2379. X# Test compression feature
  2380. X
  2381. X# $Id: compress.t,v 3.0 1993/11/29 13:50:08 ram Exp ram $
  2382. X#
  2383. X#  Copyright (c) 1990-1993, Raphael Manfredi
  2384. X#  
  2385. X#  You may redistribute only under the terms of the Artistic License,
  2386. X#  as specified in the README file that comes with the distribution.
  2387. X#  You may reuse parts of this distribution only within the terms of
  2388. X#  that same Artistic License; a copy of which may be found at the root
  2389. X#  of the source tree for mailagent 3.0.
  2390. X#
  2391. X# $Log: compress.t,v $
  2392. X# Revision 3.0  1993/11/29  13:50:08  ram
  2393. X# Baseline for mailagent 3.0 netwide release.
  2394. X#
  2395. X
  2396. Xdo '../pl/misc.pl';
  2397. Xunlink "$user.Z", 'always';
  2398. X
  2399. X# Look whether compress is available. If not, do not perform this test.
  2400. X`compress mail`;
  2401. X`uncompress mail` if $? == 0 && -f mail.Z;
  2402. Xif ($? != 0) {        # No compress available in path, sorry
  2403. X    print "-1\n";    # Do not perform any tests
  2404. X    exit 0;
  2405. X}
  2406. X
  2407. X&add_option("-o 'compress: ~/.compress'");
  2408. Xopen(COMPRESS, '>.compress') || print "1\n";
  2409. Xprint COMPRESS <<EOF || print "2\n";
  2410. Xa[lm]*
  2411. X$user
  2412. XEOF
  2413. Xclose COMPRESS || print "3\n";
  2414. X
  2415. X&add_header('X-Tag: compress');
  2416. X`$cmd`;
  2417. X$? == 0 || print "4\n";
  2418. X-f "$user" && print "5\n";        # Should be compressed
  2419. X-f "$user.Z" || print "6\n";
  2420. X-f 'always' && print "7\n";        # Should also be compressed
  2421. X-f 'always.Z' || print "8\n";
  2422. X-f 'another' || print "9\n";    # This one is not compressed
  2423. X-f 'another.Z' && print "10\n";
  2424. X$msize = -s "$user.Z";
  2425. X
  2426. X`cp $user.Z $user >/dev/null 2>&1`;
  2427. X`$cmd`;
  2428. X$? == 0 || print "11\n";
  2429. X-f "$user" || print "12\n";        # Should be not be recompressed
  2430. X-f "$user.Z" || print "13\n";    # Should still be there
  2431. X-f 'always' && print "14\n";    # Should also be compressed
  2432. X-f 'always.Z' || print "15\n";
  2433. X-f 'another' || print "16\n";    # This one is not compressed
  2434. X-f 'another.Z' && print "17\n";
  2435. X(-s $user != $msize) || print "18\n";        # Mail saved there
  2436. X(-s "$user.Z" == $msize) || print "19\n";    # This one left undisturbed
  2437. X
  2438. Xunlink "$user", "$user.Z", 'always', 'always.Z', 'another', 'mail', '.compress';
  2439. Xprint "0\n";
  2440. END_OF_FILE
  2441.   if test 1969 -ne `wc -c <'agent/test/misc/compress.t'`; then
  2442.     echo shar: \"'agent/test/misc/compress.t'\" unpacked with wrong size!
  2443.   fi
  2444.   # end of 'agent/test/misc/compress.t'
  2445. fi
  2446. echo shar: End of archive 6 \(of 26\).
  2447. cp /dev/null ark6isdone
  2448. MISSING=""
  2449. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 ; do
  2450.     if test ! -f ark${I}isdone ; then
  2451.     MISSING="${MISSING} ${I}"
  2452.     fi
  2453. done
  2454. if test "${MISSING}" = "" ; then
  2455.     echo You have unpacked all 26 archives.
  2456.     echo "Now run 'sh PACKNOTES', then read README and type Configure.'"
  2457.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2458. else
  2459.     echo You still must unpack the following archives:
  2460.     echo "        " ${MISSING}
  2461. fi
  2462. exit 0
  2463.  
  2464. exit 0 # Just in case...
  2465.