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

  1. Newsgroups: comp.sources.misc
  2. From: Raphael Manfredi <ram@acri.fr>
  3. Subject: v41i007:  mailagent - Flexible mail filtering and processing package, v3.0, Part07/26
  4. Message-ID: <1993Dec2.133715.18266@sparky.sterling.com>
  5. X-Md4-Signature: 778dd4e20ef5807b0bb8d0c7c8c15a03
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Advanced Computer Research Institute, Lyon, France.
  8. Date: Thu, 2 Dec 1993 13:37:15 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: Raphael Manfredi <ram@acri.fr>
  12. Posting-number: Volume 41, Issue 7
  13. Archive-name: mailagent/part07
  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.02 agent/pl/add_log.pl
  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 7 (of 26)."'
  28. if test -f 'Configure.02' -a "${1}" != "-c" ; then 
  29.   echo shar: Will not clobber existing file \"'Configure.02'\"
  30. else
  31.   echo shar: Extracting \"'Configure.02'\" \(46962 characters\)
  32.   sed "s/^X//" >'Configure.02' <<'END_OF_FILE'
  33. X    '')
  34. X        $hostcat >hosts
  35. X        dflt=.`$awk "/[0-9].*$myhostname/ {for(i=2; i<=NF;i++) print \\\$i}" \
  36. X            hosts | $sort | $uniq | \
  37. X            $sed -n -e "s/$myhostname\.\([a-zA-Z_.]\)/\1/p"`
  38. X        case "$dflt" in
  39. X        .) echo "(You do not have fully-qualified names in /etc/hosts)"
  40. X            dflt='.uucp';;
  41. X        esac
  42. X        $rm -f hosts
  43. X        ;;
  44. X    *) dflt="$mydomain";;
  45. X    esac;;
  46. Xesac
  47. Xecho " "
  48. Xrp="What is your domain name?"
  49. X. ./myread
  50. Xtans="$ans"
  51. Xcase "$ans" in
  52. X'') ;;
  53. X.*) ;;
  54. X*) tans=".$tans";;
  55. Xesac
  56. Xmydomain="$tans"
  57. X
  58. X: a little sanity check here
  59. Xcase "$phostname" in
  60. X'') ;;
  61. X*)
  62. X    case `$phostname` in
  63. X    $myhostname$mydomain|$myhostname) ;;
  64. X    *)
  65. X        case "$phostname" in
  66. X        sed*)
  67. X            echo "(That doesn't agree with your whoami.h file, by the way.)"
  68. X            ;;
  69. X        *)
  70. X            echo "(That doesn't agree with your $phostname command, by the way.)"
  71. X            ;;
  72. X        esac
  73. X    ;;
  74. X    esac
  75. X    ;;
  76. Xesac
  77. X
  78. X: see how we will look up host name
  79. Xecho " "
  80. Xif false; then
  81. X    : dummy stub to allow use of elif
  82. Xelif set gethostname val -f d_gethname; eval $csym; $val; then
  83. X    echo 'gethostname() found.' >&4
  84. X    d_gethname="$define"
  85. X    call=gethostname
  86. Xelif set uname val -f d_uname; eval $csym; $val; then
  87. X    if xenix; then
  88. X        $cat <<'EOM'
  89. Xuname() was found, but you're running xenix, and older versions of xenix
  90. Xhave a broken uname(). If you don't really know whether your xenix is old
  91. Xenough to have a broken system call, use the default answer.
  92. X
  93. XEOM
  94. X        dflt=y
  95. X        case "$d_uname" in
  96. X        "$define") dflt=n;;
  97. X        esac
  98. X        rp='Is your uname() broken?'
  99. X        . ./myread
  100. X        case "$ans" in
  101. X        n*) d_uname="$define"; call=uname;;
  102. X        esac
  103. X    else
  104. X        echo 'uname() found.' >&4
  105. X        d_uname="$define"
  106. X        call=uname
  107. X    fi
  108. Xfi
  109. Xcase "$d_gethname" in
  110. X'') d_gethname="$undef";;
  111. Xesac
  112. Xcase "$d_uname" in
  113. X'') d_uname="$undef";;
  114. Xesac
  115. Xcase "$d_uname$d_gethname" in
  116. X*define*)
  117. X    dflt=n
  118. X    cat <<EOM
  119. XEvery now and then someone has a $call() that lies about the hostname
  120. Xbut can't be fixed for political or economic reasons.  If you wish, I can
  121. Xpretend $call() isn't there and maybe compile in the hostname or
  122. Xcompute it from the '$phostname' command at run-time.
  123. X
  124. XEOM
  125. X    rp="Shall I ignore $call() from now on?"
  126. X    . ./myread
  127. X    case "$ans" in
  128. X    y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
  129. X    esac;;
  130. Xesac
  131. Xcase "$phostname" in
  132. X'') aphostname='';;
  133. X*) case "$aphostname" in
  134. X    /*) ;;
  135. X    *) set X $phostname
  136. X        shift
  137. X        file=$1
  138. X        shift
  139. X        file=`./loc $file $file $pth`
  140. X        aphostname=`echo $file $*`
  141. X        ;;
  142. X    esac
  143. X    ;;
  144. Xesac
  145. Xcase "$d_uname$d_gethname" in
  146. X*define*) ;;
  147. X*)
  148. X    case "$phostname" in
  149. X    '') ;;
  150. X    *)
  151. X        $cat <<EOT
  152. X
  153. XThere is no gethostname() or uname() on this system.  You have two
  154. Xpossibilities at this point:
  155. X
  156. X1)  You can have your host name ($myhostname) compiled into $package, which
  157. X    lets $package start up faster, but makes your binaries non-portable, or
  158. X2)  you can have $package use a
  159. X    
  160. X    popen("$aphostname","r")
  161. X
  162. X    which will start slower but be more portable.
  163. X
  164. XIf you want option 2 but with a different command, you can edit config.sh at
  165. Xthe end of this shell script.
  166. X
  167. XEOT
  168. X        case "$d_phostname" in
  169. X        "$define") dflt=n;;
  170. X        "$undef")  dflt=y;;
  171. X        '')
  172. X            case "$d_portable" in
  173. X            "$define") dflt=n ;;
  174. X            *) dflt=y ;;
  175. X            esac;;
  176. X        esac
  177. X        rp="Do you want your host name compiled in?"
  178. X        . ./myread
  179. X        case "$ans" in
  180. X        n*) d_phostname="$define" ;;
  181. X        *) aphostname=''; d_phostname="$undef";;
  182. X        esac;;
  183. X    esac
  184. X    case "$aphostname" in
  185. X    '')
  186. X        echo 'No hostname function -- hardwiring "'$myhostname'".' >&4;;
  187. X    esac;;
  188. Xesac
  189. Xcase "$d_phostname" in
  190. X'') d_phostname="$undef";;
  191. Xesac
  192. X
  193. X: function used to set $1 to $val
  194. Xsetvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
  195. Xcase "$val$was" in
  196. X$define$undef) . whoa; eval "$var=\$td";;
  197. X$undef$define) . whoa; eval "$var=\$tu";;
  198. X*) eval "$var=$val";;
  199. Xesac'
  200. X
  201. X: see how we invoke the C preprocessor
  202. Xecho " "
  203. Xecho "Now, how can we feed standard input to your C preprocessor..." >&4
  204. Xcat <<'EOT' >testcpp.c
  205. X#define ABC abc
  206. X#define XYZ xyz
  207. XABC.XYZ
  208. XEOT
  209. Xcd ..
  210. Xecho 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
  211. Xchmod 755 cppstdin
  212. Xwrapper=`pwd`/cppstdin
  213. Xcd UU
  214. Xif $test "X$cppstdin" != "X" && \
  215. X    $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
  216. X    $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  217. X    echo "You used to use $cppstdin $cppminus so we'll use that again."
  218. Xelif $test "$cc" = gcc && \
  219. X    (echo "Using gcc, eh?  We'll try to force gcc -E using a wrapper..."; \
  220. X    $wrapper <testcpp.c >testcpp.out 2>&1; \
  221. X    $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1) ; then
  222. X    echo "Yup, we can."
  223. X    cppstdin="$wrapper"
  224. X    cppminus='';
  225. Xelif echo 'Maybe "'"$cc"' -E" will work...'; \
  226. X    $cc -E <testcpp.c >testcpp.out 2>&1; \
  227. X    $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  228. X    echo "Yup, it does."
  229. X    cppstdin="$cc -E"
  230. X    cppminus='';
  231. Xelif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
  232. X    $cc -E - <testcpp.c >testcpp.out 2>&1; \
  233. X    $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  234. X    echo "Yup, it does."
  235. X    cppstdin="$cc -E"
  236. X    cppminus='-';
  237. Xelif echo 'No such luck, maybe "'$cpp'" will work...'; \
  238. X    $cpp <testcpp.c >testcpp.out 2>&1; \
  239. X    $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  240. X    echo "It works!"
  241. X    cppstdin="$cpp"
  242. X    cppminus='';
  243. Xelif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
  244. X    $cpp - <testcpp.c >testcpp.out 2>&1; \
  245. X    $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  246. X    echo "Hooray, it works!  I was beginning to wonder."
  247. X    cppstdin="$cpp"
  248. X    cppminus='-';
  249. Xelif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
  250. X    $cc -P <testcpp.c >testcpp.out 2>&1; \
  251. X    $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  252. X    echo "Yipee, that works!"
  253. X    cppstdin="$cc -P"
  254. X    cppminus='';
  255. Xelif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
  256. X    $cc -P - <testcpp.c >testcpp.out 2>&1; \
  257. X    $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  258. X    echo "At long last!"
  259. X    cppstdin="$cc -P"
  260. X    cppminus='-';
  261. Xelif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
  262. X    $wrapper <testcpp.c >testcpp.out 2>&1; \
  263. X    $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  264. X    cppstdin="$wrapper"
  265. X    cppminus=''
  266. X    echo "Eureka!"
  267. Xelse
  268. X    dflt=''
  269. X    rp="No dice.  I can't find a C preprocessor.  Name one:"
  270. X    . ./myread
  271. X    cppstdin="$ans"
  272. X    $cppstdin <testcpp.c >testcpp.out 2>&1
  273. X    if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  274. X        echo "OK, that will do." >&4
  275. X    else
  276. Xecho "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
  277. X        exit 1
  278. X    fi
  279. Xfi
  280. Xcase "$cppstdin" in
  281. X"$wrapper") ;;
  282. X*) $rm -f $wrapper;;
  283. Xesac
  284. X$rm -f testcpp.c testcpp.out
  285. X
  286. X: determine filename position in cpp output
  287. Xecho " "
  288. Xecho "Computing filename position in cpp output for #include directives..." >&4
  289. Xecho '#include <stdio.h>' > foo.c
  290. X$cat >fieldn <<EOF
  291. X$startsh
  292. X$cppstdin $cppminus $cppflags <foo.c 2>/dev/null | \
  293. X$grep '^[     ]*#.*stdio\.h' | \
  294. Xwhile read cline; do
  295. X    pos=1
  296. X    set \$cline
  297. X    while $test \$# -gt 0; do
  298. X        if $test -r \`echo \$1 | $tr -d '"'\`; then
  299. X            echo "\$pos"
  300. X            exit 0
  301. X        fi
  302. X        shift
  303. X        pos=\`expr \$pos + 1\`
  304. X    done
  305. Xdone
  306. XEOF
  307. Xchmod +x fieldn
  308. Xfieldn=`./fieldn`
  309. X$rm -f foo.c fieldn
  310. Xcase $fieldn in
  311. X'') pos='???';;
  312. X1) pos=first;;
  313. X2) pos=second;;
  314. X3) pos=third;;
  315. X*) pos="${fieldn}th";;
  316. Xesac
  317. Xecho "Your cpp writes the filename in the $pos field of the line."
  318. X
  319. X: locate header file
  320. X$cat >findhdr <<EOF
  321. X$startsh
  322. Xwanted=\$1
  323. Xname=''
  324. Xif test -f $usrinc/\$wanted; then
  325. X    echo "$usrinc/\$wanted"
  326. X    exit 0
  327. Xfi
  328. Xawkprg='{ print \$$fieldn }'
  329. Xecho "#include <\$wanted>" > foo\$\$.c
  330. X$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
  331. X$grep "^[     ]*#.*\$wanted" | \
  332. Xwhile read cline; do
  333. X    name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
  334. X    case "\$name" in
  335. X    */\$wanted) echo "\$name"; exit 0;;
  336. X    *) name='';;
  337. X    esac;
  338. Xdone;
  339. X$rm -f foo\$\$.c;
  340. Xcase "\$name" in
  341. X'') exit 1;;
  342. Xesac
  343. XEOF
  344. Xchmod +x findhdr
  345. X
  346. X: see which of string.h or strings.h is needed
  347. Xecho " "
  348. Xstrings=`./findhdr string.h`
  349. Xif $test "$strings" && $test -r "$strings"; then
  350. X    echo "Using <string.h> instead of <strings.h>." >&4
  351. X    val="$define"
  352. Xelse
  353. X    val="$undef"
  354. X    strings=`./findhdr strings.h`
  355. X    if $test "$strings" && $test -r "$strings"; then
  356. X        echo "Using <strings.h> instead of <string.h>." >&4
  357. X    else
  358. X        echo "No string header found -- You'll surely have problems." >&4
  359. X    fi
  360. Xfi
  361. Xset i_string
  362. Xeval $setvar
  363. Xcase "$i_string" in
  364. X"$undef") strings=`./findhdr strings.h`;;
  365. X*)      strings=`./findhdr string.h`;;
  366. Xesac
  367. X
  368. X: index or strchr
  369. Xecho " "
  370. Xif set index val -f; eval $csym; $val; then
  371. X    if set strchr val -f d_strchr; eval $csym; $val; then
  372. X        if $contains strchr "$strings" >/dev/null 2>&1 ; then
  373. X            val="$define"
  374. X            vali="$undef"
  375. X            echo "strchr() found." >&4
  376. X        else
  377. X            val="$undef"
  378. X            vali="$define"
  379. X            echo "index() found." >&4
  380. X        fi
  381. X    else
  382. X        val="$undef"
  383. X        vali="$define"
  384. X        echo "index() found." >&4
  385. X    fi
  386. Xelse
  387. X    if set strchr val -f d_strchr; eval $csym; $val; then
  388. X        val="$define"
  389. X        vali="$undef"
  390. X        echo "strchr() found." >&4
  391. X    else
  392. X        echo "No index() or strchr() found!" >&4
  393. X        val="$undef"
  394. X        vali="$undef"
  395. X    fi
  396. Xfi
  397. Xset d_strchr; eval $setvar
  398. Xval="$vali"
  399. Xset d_index; eval $setvar
  400. X
  401. X: Initialize h_fcntl
  402. Xh_fcntl=false
  403. X
  404. X: Initialize h_sysfile
  405. Xh_sysfile=false
  406. X
  407. X: Locate the flags for 'open()'
  408. Xecho " "
  409. X$cat >open3.c <<'EOCP'
  410. X#include <sys/types.h>
  411. X#ifdef I_FCNTL
  412. X#include <fcntl.h>
  413. X#endif
  414. X#ifdef I_SYS_FILE
  415. X#include <sys/file.h>
  416. X#endif
  417. Xmain() {
  418. X    if(O_RDONLY);
  419. X#ifdef O_TRUNC
  420. X    exit(0);
  421. X#else
  422. X    exit(1);
  423. X#endif
  424. X}
  425. XEOCP
  426. X: check sys/file.h first to get FREAD on Sun
  427. Xif $test `./findhdr sys/file.h` && \
  428. X        $cc $cppflags "-DI_SYS_FILE" open3.c -o open3 >/dev/null 2>&1 ; then
  429. X    h_sysfile=true;
  430. X    echo "<sys/file.h> defines the O_* constants..." >&4
  431. X    if ./open3; then
  432. X        echo "and you have the 3 argument form of open()." >&4
  433. X        val="$define"
  434. X    else
  435. X        echo "but not the 3 argument form of open().  Oh, well." >&4
  436. X        val="$undef"
  437. X    fi
  438. Xelif $test `./findhdr fcntl.h` && \
  439. X        $cc "-DI_FCNTL" open3.c -o open3 >/dev/null 2>&1 ; then
  440. X    h_fcntl=true;
  441. X    echo "<fcntl.h> defines the O_* constants..." >&4
  442. X    if ./open3; then
  443. X        echo "and you have the 3 argument form of open()." >&4
  444. X        val="$define"
  445. X    else
  446. X        echo "but not the 3 argument form of open().  Oh, well." >&4
  447. X        val="$undef"
  448. X    fi
  449. Xelse
  450. X    val="$undef"
  451. X    echo "I can't find the O_* constant definitions!  You got problems." >&4
  452. Xfi
  453. Xset d_open3
  454. Xeval $setvar
  455. X$rm -f open3*
  456. X
  457. X: see if rename exists
  458. Xset rename d_rename
  459. Xeval $inlibc
  460. X
  461. X: see if strerror and/or sys_errlist[] exist
  462. Xecho " "
  463. Xif set strerror val -f d_strerror; eval $csym; $val; then
  464. X    echo 'strerror() found.' >&4
  465. X    d_strerror="$define"
  466. X    d_strerrm="$undef"
  467. X    if set sys_errlist val -a d_syserrlst; eval $csym; $val; then    
  468. X        echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
  469. X        d_syserrlst="$define"
  470. X    else
  471. X    echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
  472. X        d_syserrlst="$undef"
  473. X    fi
  474. Xelif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
  475. X    $contains '#[     ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
  476. X    echo 'strerror() found in string header.' >&4
  477. X    d_strerror="$define"
  478. X    d_strerrm="$undef"
  479. X    if set sys_errlist val -a d_syserrlst; eval $csym; $val; then    
  480. X        echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
  481. X        d_syserrlst="$define"
  482. X    else
  483. X        echo "(You don't appear to have any sys_errlist[], how can this be?)"
  484. X        d_syserrlst="$undef"
  485. X    fi
  486. Xelif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
  487. Xecho "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
  488. X    d_strerror="$undef"
  489. X    d_syserrlst="$define"
  490. X    d_strerrm="$define"
  491. Xelse
  492. X    echo 'strerror() and sys_errlist[] NOT found.' >&4
  493. X    d_strerror="$undef"
  494. X    d_syserrlst="$undef"
  495. X    d_strerrm="$undef"
  496. Xfi
  497. Xif set sys_errnolist val -a d_sysernlst; eval $csym; $val; then
  498. X    echo "(Symbolic error codes can be fetched via the sys_errnolist[] array.)"
  499. X    d_sysernlst="$define"
  500. Xelse
  501. X    echo "(However, I can't extract the symbolic error code out of errno.)"
  502. X    d_sysernlst="$undef"
  503. Xfi
  504. X
  505. X: see if union wait is available
  506. Xecho " "
  507. Xif $contains 'union.*wait.*{' `./findhdr sys/wait.h` >/dev/null 2>&1 ; then
  508. X    echo "Looks like we have to use 'union wait' pointer for wait()." >&4
  509. X    val="$define"
  510. Xelse
  511. X    echo "Your wait() should be happy with a plain 'int' pointer." >&4
  512. X    val="$undef"
  513. Xfi
  514. Xset d_uwait
  515. Xeval $setvar
  516. X
  517. X: backward compatibility for d_hvfork
  518. Xif test X$d_hvfork != X; then
  519. X    d_vfork="$d_hvfork"
  520. X    d_hvfork=''
  521. Xfi
  522. X: see if there is a vfork
  523. Xset vfork d_vfork
  524. Xeval $inlibc
  525. X
  526. X: preserve RCS keywords in files with variable substitution, grrr
  527. XHeader='$Header'
  528. XId='$Id'
  529. XLog='$Log'
  530. X
  531. X: see if flock exists
  532. Xset flock d_flock
  533. Xeval $inlibc
  534. X
  535. X: see which mailbox locking should be used
  536. Xecho " "
  537. Xlock_by_flock=''
  538. Xflock_only=''
  539. Xcase "$d_flock" in
  540. X"$define")
  541. X    if $contains EWOULDBLOCK $usrinc/errno.h > /dev/null 2>&1; then
  542. X        echo 'EWOULDBLOCK found, will use flock type mailbox locking.'
  543. X        val="$define"
  544. X    elif $contains EWOULDBLOCK $usrinc/sys/errno.h > /dev/null 2>&1; then
  545. X        echo 'EWOULDBLOCK found, will use flock type mailbox locking.'
  546. X        val="$define"
  547. X    else
  548. X        echo 'Will use .lock type mailbox locking.'
  549. X        val="$undef"
  550. X    fi
  551. X    ;;
  552. X*)
  553. X    echo 'Will use .lock type mailbox locking.'
  554. X    val="$undef"
  555. X    ;;
  556. Xesac
  557. Xset d_lockflock; eval $setvar
  558. X
  559. Xcase "$d_lockflock" in
  560. X"$define")
  561. X    lock_by_flock='true'
  562. X    case "$d_flockonly" in
  563. X    "$define") dflt=y;;
  564. X    *) dflt=n;;
  565. X    esac
  566. X    $cat <<EOM
  567. XSome sites wish to use flock style locking only. This allows $package to be
  568. Xinstalled without the setgid bit being set on some systems that would otherwise
  569. Xrequire it.
  570. X
  571. XNote: Be sure no other mail utility that needs to lock the mail spool file
  572. Xuses .lock type locking before using only flock style locking.
  573. X
  574. XEOM
  575. X    rp="Would you like to use flock style mail spool locking only?"
  576. X    . myread
  577. X    case "$ans" in
  578. X    y*|Y*) val="$define";;
  579. X    *) val="$undef";;
  580. X    esac
  581. X    ;;
  582. X*) val="$undef";;
  583. Xesac
  584. Xset d_flockonly; eval $setvar
  585. X
  586. Xcase "$d_flockonly" in
  587. X"$define") flock_only='true';;
  588. Xesac
  589. X
  590. X: now get the host name to advertise as our mailing address
  591. Xcase "$hiddennet" in
  592. X'') dflt=n;;
  593. X*) dflt=y;;
  594. Xesac
  595. X$cat <<EOM
  596. XSome sites are on "hidden" networks, in the sense that the network appears
  597. Xto the outside world as a single machine.  The advertised name of any host
  598. Xon this hidden network is the name of one machine on the local network which
  599. Xknows how to forward mail to any other host on the hidden network.
  600. X
  601. XDo you wish to advertise a different hostname to the world than the one your
  602. Xown host ($myhostname$mydomain) has?
  603. X
  604. XEOM
  605. Xrp='Use "hidden" network?'
  606. X. ./myread
  607. Xcase "$ans" in
  608. Xn*) d_hidnet="$undef" hiddennet='';;
  609. X*)
  610. X    d_hidnet="$define"
  611. X    echo " "
  612. X    case "$hiddennet" in
  613. X    '') dflt=`echo $mydomain | $sed -e 's/^\.//'`;;
  614. X    *) dflt="$hiddennet";;
  615. X    esac
  616. X    rp='What hostname do you wish to advertise?'
  617. X    . ./myread
  618. X    hiddennet="$ans"
  619. X    ;;
  620. Xesac
  621. X
  622. X: is AFS running?
  623. Xecho " "
  624. Xif test -d /afs; then
  625. X    echo "AFS may be running... I'll be extra cautious then..." >&4
  626. X    afs=true
  627. Xelse
  628. X    echo "AFS does not seem to be running..." >&4
  629. X    afs=false
  630. Xfi
  631. X
  632. X: determine where public executables go
  633. Xecho " "
  634. Xcase "$bin" in
  635. X'')
  636. X    dflt=`./loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin`
  637. X    ;;
  638. X*)
  639. X    dflt="$bin"
  640. X    ;;
  641. Xesac
  642. Xfn=d~
  643. Xrp='Pathname where the public executables will reside?'
  644. X. ./getfile
  645. Xbin="$ans"
  646. Xbinexp="$ansexp"
  647. Xif $afs; then
  648. X    $cat <<EOM
  649. X
  650. XSince you are running AFS, I need to distinguish the directory in which
  651. Xexecutables reside from the directory in which they are installed (and from
  652. Xwhich they are presumably copied to the former directory by occult means).
  653. X
  654. XEOM
  655. X    case "$installbin" in
  656. X    '') dflt=`echo $binexp | sed 's#^/afs/#/afs/.#'`;;
  657. X    *) dflt="$installbin";;
  658. X    esac
  659. X    fn=de~
  660. X    rp='Where will public executables be installed?'
  661. X    . ./getfile
  662. X    installbin="$ans"
  663. Xelse
  664. X    installbin="$binexp"
  665. Xfi
  666. X
  667. X: determine where manual pages go
  668. X$cat <<EOM
  669. X
  670. X$package has manual pages available in source form.
  671. XEOM
  672. Xcase "$nroff" in
  673. Xnroff)
  674. X    echo "However, you don't have nroff, so they're probably useless to you."
  675. X    case "$mansrc" in
  676. X    '') mansrc="none";;
  677. X    esac;;
  678. Xesac
  679. Xecho "If you don't want the manual sources installed, answer 'none'."
  680. Xcase "$mansrc" in
  681. X'')
  682. X    lookpath='/usr/local/man/man1 /usr/local/man/man1 /usr/man/manl'
  683. X    lookpath="$lookpath /usr/man/local/man1 /usr/man/l_man/man1"
  684. X    lookpath="$lookpath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
  685. X    lookpath="$lookpath /usr/man/man.L"
  686. X    mansrc=`./loc . $lookpath`
  687. X    if $test -d "$mansrc"; then
  688. X        dflt="$mansrc"
  689. X    else
  690. X        dflt="$sysman"
  691. X    fi
  692. X    ;;
  693. X*)  dflt="$mansrc"
  694. X    ;;
  695. Xesac
  696. Xecho " "
  697. Xfn=dn~
  698. Xrp='Where do the manual pages (source) go?'
  699. X. ./getfile
  700. Xmansrc="$ans"
  701. Xmansrcexp="$ansexp"
  702. Xif $afs; then
  703. X    $cat <<EOM
  704. X
  705. XSince you are running AFS, I need to distinguish the directory in which
  706. Xmanual pages reside from the directory in which they are installed (and from
  707. Xwhich they are presumably copied to the former directory by occult means).
  708. X
  709. XEOM
  710. X    case "$installmansrc" in
  711. X    '') dflt=`echo $mansrcexp | sed 's#^/afs/#/afs/.#'`;;
  712. X    *) dflt="$installmansrc";;
  713. X    esac
  714. X    fn=de~
  715. X    rp='Where will man pages be installed?'
  716. X    . ./getfile
  717. X    installmansrc="$ans"
  718. Xelse
  719. X    installmansrc="$mansrcexp"
  720. Xfi
  721. X
  722. X
  723. Xcase "$mansrc" in
  724. X'') manext='0';;
  725. X*l) manext=l;;
  726. X*n) manext=n;;
  727. X*o) manext=l;;
  728. X*p) manext=n;;
  729. X*C) manext=C;;
  730. X*L) manext=L;;
  731. X*L1) manext=L1;;
  732. X*) manext=1;;
  733. Xesac
  734. X
  735. X: determine where private executables go
  736. Xcase "$privlib" in
  737. X'')
  738. X    dflt=/usr/lib/$package
  739. X    $test -d /usr/local/lib && dflt=/usr/local/lib/$package
  740. X    $test -d /local/lib && dflt=/local/lib/$package
  741. X    ;;
  742. X*)  dflt="$privlib"
  743. X    ;;
  744. Xesac
  745. X$cat <<EOM
  746. X
  747. XThere are some auxiliary files for $package that need to be put into a
  748. Xprivate library directory that is accessible by everyone.
  749. X
  750. XEOM
  751. Xfn=d~+
  752. Xrp='Pathname where private library files will reside?'
  753. X. ./getfile
  754. Xprivlib="$ans"
  755. Xprivlibexp="$ansexp"
  756. Xif $afs; then
  757. X    $cat <<EOM
  758. X
  759. XSince you are running AFS, I need to distinguish the directory in which
  760. Xprivate files reside from the directory in which they are installed (and from
  761. Xwhich they are presumably copied to the former directory by occult means).
  762. X
  763. XEOM
  764. X    case "$installprivlib" in
  765. X    '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;;
  766. X    *) dflt="$installprivlib";;
  767. X    esac
  768. X    fn=de~
  769. X    rp='Where will private files be installed?'
  770. X    . ./getfile
  771. X    installprivlib="$ans"
  772. Xelse
  773. X    installprivlib="$privlibexp"
  774. Xfi
  775. X
  776. X: determine where public executables go
  777. Xcase "$scriptdir" in
  778. X'')
  779. X    dflt="$bin"
  780. X    : guess some guesses
  781. X    $test -d /usr/share/scripts && dflt=/usr/share/scripts
  782. X    $test -d /usr/share/bin && dflt=/usr/share/bin
  783. X    $test -d /usr/local/script && dflt=/usr/local/script
  784. X    ;;
  785. X*)  dflt="$scriptdir"
  786. X    ;;
  787. Xesac
  788. X$cat <<EOM
  789. XSome installations have a separate directory just for executable scripts so
  790. Xthat they can mount it across multiple architectures but keep the scripts in
  791. Xone spot.  You might, for example, have a subdirectory of /usr/share for this.
  792. XOr you might just lump your scripts in with all your other executables.
  793. XEOM
  794. Xfn=d~
  795. Xrp='Where do you keep publicly executable scripts?'
  796. X. ./getfile
  797. Xscriptdir="$ans"
  798. Xscriptdirexp="$ansexp"
  799. Xif $afs; then
  800. X    $cat <<EOM
  801. X
  802. XSince you are running AFS, I need to distinguish the directory in which
  803. Xscripts reside from the directory in which they are installed (and from
  804. Xwhich they are presumably copied to the former directory by occult means).
  805. X
  806. XEOM
  807. X    case "$installscript" in
  808. X    '') dflt=`echo $scriptdirexp | sed 's#^/afs/#/afs/.#'`;;
  809. X    *) dflt="$installscript";;
  810. X    esac
  811. X    fn=de~
  812. X    rp='Where will public scripts be installed?'
  813. X    . ./getfile
  814. X    installscript="$ans"
  815. Xelse
  816. X    installscript="$scriptdirexp"
  817. Xfi
  818. X
  819. X: check for length of integer
  820. Xecho " "
  821. Xcase "$intsize" in
  822. X'')
  823. X    echo "Checking to see how big your integers are..." >&4
  824. X    $cat >try.c <<'EOCP'
  825. X#include <stdio.h>
  826. Xmain()
  827. X{
  828. X    printf("%d\n", sizeof(int));
  829. X}
  830. XEOCP
  831. X    if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then
  832. X        dflt=`./try`
  833. X    else
  834. X        dflt='4'
  835. X        echo "(I can't seem to compile the test program.  Guessing...)"
  836. X    fi
  837. X    ;;
  838. X*)
  839. X    dflt="$intsize"
  840. X    ;;
  841. Xesac
  842. Xrp="What is the size of an integer (in bytes)?"
  843. X. ./myread
  844. Xintsize="$ans"
  845. X$rm -f try.c try
  846. X
  847. X: determine where mail is spooled
  848. Xcase "$maildir" in
  849. X'') dflt=`./loc . /usr/spool/mail /usr/spool/mail /usr/mail`;;
  850. X*) dflt="$maildir";;
  851. Xesac
  852. Xecho " "
  853. Xfn=d~
  854. Xrp='Where is yet-to-be-read mail spooled?'
  855. X. ./getfile
  856. Xmaildir="$ans"
  857. Xmaildirexp="$ansexp"
  858. X
  859. X: determine the name of a reasonable mailer
  860. Xcase "$mailer" in
  861. X'')
  862. X    if $test -f "$sendmail"; then
  863. X        dflt="$sendmail"
  864. X    elif $test -f "$smail"; then
  865. X        dflt="$smail"
  866. X    elif $test -f "$rmail"; then
  867. X        dflt="$rmail"
  868. X    elif $test -f /bin/mail; then
  869. X        dflt=/bin/mail
  870. X    else
  871. X        dflt=$mail
  872. X    fi
  873. X    ;;
  874. X*)  dflt="$mailer";;
  875. Xesac
  876. X$cat <<EOM
  877. X
  878. XI need the full pathname of the program used to deliver mail on your system.
  879. XA typical answer would be /usr/lib/sendmail or /bin/rmail, but you may choose
  880. Xany other program, as long as it can be fed from standard input and will
  881. Xhonour any user-supplied headers.
  882. X
  883. XEOM
  884. Xfn=f
  885. Xrp='Mail transport agent to be used?'
  886. X. ./getfile
  887. Xmailer="$ans"
  888. X
  889. X: determine where mail is spooled
  890. Xcase "$mailfile" in
  891. X'')
  892. X    dflt=`./loc . XXX /usr/spool/mail /usr/mail`
  893. X    case "$dflt" in
  894. X    XXX) dflt='%~/mailbox';;
  895. X    *) dflt="$dflt/%L";;
  896. X    esac
  897. X    ;;
  898. X*)  dflt="$mailfile"
  899. X    ;;
  900. Xesac
  901. Xcat <<'EOM'
  902. X
  903. XIn the following question, you may use %~ to represent the user's home
  904. Xdirectory, and %L to represent a users name.
  905. X
  906. XEOM
  907. Xrp='In which file is yet-to-be-read mail spooled? (~name ok)'
  908. X. ./myread
  909. Xmailfile=`./filexp "$ans"`
  910. X
  911. X: find out how to generate dependencies
  912. Xecho " "
  913. Xecho "Checking how to generate makefile dependencies on your machine..." >&4
  914. Xtoplev=`cd ..;pwd`
  915. X$cat >dep.c <<'EOCP'
  916. X#include "dep.h"
  917. XEOCP
  918. X$cat >dep.h <<'EOCP'
  919. X
  920. XEOCP
  921. Xtakeflags='flags=""
  922. Xcase "$@" in
  923. X*--*)
  924. X    for arg
  925. X    do
  926. X        shift
  927. X        case "$arg" in
  928. X        --) break;;
  929. X        *) flags="$flags $arg";;
  930. X        esac
  931. X    done;;
  932. Xesac'
  933. Xcase "$mkdep" in
  934. X'')
  935. X    ;;
  936. X*)
  937. X    if test -x "$mkdep" &&
  938. X        $mkdep dep.c >dep.out 2>/dev/null &&
  939. X        $contains 'dep\.o:.*dep\.h' dep.out >/dev/null 2>&1
  940. X    then
  941. X        echo "$mkdep works."
  942. X    else
  943. X        mkdep=
  944. X    fi
  945. Xesac
  946. X
  947. Xcase "$mkdep" in
  948. X'')
  949. X    $spitshell > ../mkdep <<EOM
  950. X$startsh
  951. X$takeflags
  952. Xfor srcfile
  953. Xdo
  954. X    $cpp -M -I. $cppflags \$flags \$srcfile 2>/dev/null
  955. Xdone
  956. XEOM
  957. X    mkdep=$toplev/mkdep
  958. X    chmod +x $mkdep
  959. X    $eunicefix $mkdep
  960. X    if $mkdep dep.c >dep.out 2>/dev/null &&
  961. X        $contains 'dep\.o:.*dep\.h' dep.out >/dev/null 2>&1
  962. X    then
  963. X        echo "Looks like we can use $cpp -M."
  964. X    else
  965. X        mkdep=
  966. X    fi
  967. X    ;;
  968. Xesac
  969. X
  970. Xcase "$mkdep" in
  971. X'')
  972. X    $spitshell > ../mkdep <<EOM
  973. X$startsh
  974. X$takeflags
  975. Xfor srcfile
  976. Xdo
  977. X    $cc -MM -I. $cppflags \$flags \$srcfile 2>/dev/null
  978. Xdone
  979. XEOM
  980. X    mkdep=$toplev/mkdep
  981. X    chmod +x $mkdep
  982. X    $eunicefix $mkdep
  983. X    if $mkdep dep.c >dep.out 2>/dev/null &&
  984. X        $contains 'dep.o: dep.h' dep.out >/dev/null 2>&1
  985. X    then
  986. X        echo "Looks like we can use $cc -MM."
  987. X    else
  988. X        mkdep=
  989. X    fi
  990. X    ;;
  991. Xesac
  992. X
  993. Xcase "$mkdep" in
  994. X'')
  995. X    $spitshell >../mkdep <<EOS
  996. X$startsh
  997. X$takeflags
  998. Xfor srcfile
  999. Xdo
  1000. X    case "\$srcfile" in
  1001. X    *.c) c='.c';;
  1002. X    *.y) c='.y';;
  1003. X    *.l) c='.l';;
  1004. X    esac
  1005. X    filebase=\`basename \$srcfile \$c\`
  1006. X    <\$srcfile $cpp $cppminus $cppflags -I. \$flags 2>/dev/null | \\
  1007. X    $sed -e '/^# *[0-9]/!d' \\
  1008. X        -e 's/^.*"\(.*\)".*\$/'\$filebase'.o: \1/' \\
  1009. X        -e 's|: \./|: |' \\
  1010. X        -e 's|: *$|: '\$srcfile'|' | \\
  1011. X    $grep -v '^#' | $sort | $uniq
  1012. Xdone
  1013. XEOS
  1014. X    mkdep=$toplev/mkdep
  1015. X    chmod +x $mkdep
  1016. X    $eunicefix $mkdep
  1017. X    if $mkdep dep.c >dep.out 2>/dev/null &&
  1018. X        $contains 'dep\.o:.*dep\.h' dep.out >/dev/null 2>&1
  1019. X    then
  1020. X        echo "A shell script using $cpp does the trick."
  1021. X    else
  1022. X        echo "$cpp doesn't seem to be any use at all."
  1023. X        $spitshell >../mkdep <<EOS
  1024. X$startsh
  1025. X$takeflags
  1026. Xfiles="\$@"
  1027. Xset X \$flags
  1028. Xshift
  1029. Xinc='.'
  1030. Xwhile test \$# -gt 0
  1031. Xdo
  1032. X    case "\$1" in
  1033. X    -I) 
  1034. X        shift
  1035. X        inc="\$inc:\$1"
  1036. X        ;;
  1037. X    -I*)
  1038. X        dir=\`echo \$1 | sed -e 's/^-I//'\`
  1039. X        inc="\$inc:\$dir"
  1040. X        ;;
  1041. X    esac
  1042. X    shift
  1043. Xdone
  1044. Xset X \$files
  1045. Xshift
  1046. Xtrap "$rm -f /tmp/mkdep\$\$; exit 1" 1 2 3 15
  1047. Xfor srcfile
  1048. Xdo
  1049. X    case "\$srcfile" in
  1050. X    *.c) c='.c';;
  1051. X    *.y) c='.y';;
  1052. X    *.l) c='.l';;
  1053. X    esac
  1054. X    filebase=\`basename \$srcfile \$c\`
  1055. X    echo \$filebase.o: \$srcfile
  1056. X    $grep '^#[  ]*include' \$srcfile /dev/null | \
  1057. X    $sed -n -e 's/#[   ]*include[  ]*//' \\
  1058. X        -e '/<\(.*\)>/ d' \\
  1059. X        -e 's/:[^"]*"\([^"]*\)".*/: \1/' \\
  1060. X        -e 's/\.c:/\.o:/p' > /tmp/mkdep\$\$
  1061. X    IFS=': '
  1062. X    while read file dep; do
  1063. X        for dir in \$inc; do
  1064. X            if $test -f "\$dir/\$dep"; then
  1065. X                dep="\$dir/\$dep"
  1066. X                break
  1067. X            fi
  1068. X        done
  1069. X        echo "\$file: \$dep" | $sed -e 's,: \./,: ,'
  1070. X    done </tmp/mkdep\$\$
  1071. X    IFS=' '
  1072. X    $rm -f /tmp/mkdep\$\$
  1073. Xdone
  1074. XEOS
  1075. X        mkdep=$toplev/mkdep
  1076. X        chmod +x $mkdep
  1077. X        $eunicefix $mkdep
  1078. X        if $mkdep dep.c >dep.out 2>/dev/null &&
  1079. X            $contains 'dep\.o:.*dep\.h' dep.out >/dev/null 2>&1
  1080. X        then
  1081. X            cat << EOM
  1082. X
  1083. XI can use a script with grep instead, but it will make some incorrect
  1084. Xdependencies, since it doesn't understand about conditional compilation.
  1085. XMoreover, some dependencies may be missing, because scanning won't be
  1086. Xa recursive process.
  1087. XIf you have a program which generates makefile dependencies, you may want
  1088. Xto use it.  If not, you can use the script and edit the Makefile by hand
  1089. Xif you need to.
  1090. XEOM
  1091. X        else
  1092. X            mkdep=
  1093. X            cat << EOM
  1094. X
  1095. XI can't seem to generate makefile dependencies at all!  Perhaps you have a
  1096. Xprogram that does?  If you don't, you might look at the mkdep script to
  1097. Xsee if you can create one which works.
  1098. XEOM
  1099. X        fi
  1100. X    fi
  1101. Xesac
  1102. Xdflt="$mkdep"
  1103. Xfn=f~/
  1104. Xrp="Name of program to make makefile dependencies?"
  1105. X. ./getfile
  1106. Xmkdep="$ans"
  1107. X$rm -f dep.c dep.h dep.o dep.out
  1108. X
  1109. X: get organization name
  1110. Xlongshots='/local/src /usr/src/new /usr/src/local /usr/local/src'
  1111. Xcase "$orgname" in
  1112. X'') if xxx=`./loc news/src/defs.h x $longshots`; then
  1113. X        dflt=`$sed -n 's/^.*MYORG[     ]*"\(.*\)".*$/\1/p' $xxx`
  1114. X    else
  1115. X        dflt=''
  1116. X    fi
  1117. X    ;;
  1118. X*)  dflt="$orgname";;
  1119. Xesac
  1120. X$cat << 'EOH'
  1121. XPlease type the name of your organization as you want it to appear on the
  1122. XOrganization line of outgoing articles.  (It's nice if this also specifies
  1123. Xyour location.  Your city name is probably sufficient if well known.)
  1124. XFor example:
  1125. X
  1126. X    University of Southern North Dakota, Hoople
  1127. X
  1128. XYou may also put the name of a file, as long as it begins with a slash.
  1129. XFor example:
  1130. X
  1131. X    /etc/organization
  1132. X
  1133. XEOH
  1134. Xorgname=""
  1135. Xwhile test "X$orgname" = "X"; do
  1136. X    rp='Organization:'
  1137. X    . ./myread
  1138. X    orgname="$ans"
  1139. Xdone
  1140. X
  1141. X: set the base revision
  1142. Xbaserev=3.0
  1143. X
  1144. X: get the patchlevel
  1145. Xecho " "
  1146. Xecho "Getting the current patchlevel..." >&4
  1147. Xif $test -r ../patchlevel.h;then
  1148. X    patchlevel=`awk '/PATCHLEVEL/ {print $3}' < ../patchlevel.h`
  1149. Xelse
  1150. X    patchlevel=0
  1151. Xfi
  1152. Xecho "(You have $package $baserev PL$patchlevel.)"
  1153. X
  1154. X: determine perl absolute location
  1155. Xcase "$perlpath" in
  1156. X'')
  1157. X    if test -f /usr/bin/perl; then
  1158. X        dflt=/usr/bin/perl
  1159. X    else
  1160. X        case "$_perl" in
  1161. X        */*) dflt="$_perl";;
  1162. X        *) dflt=/usr/bin/perl;;
  1163. X        esac
  1164. X    fi
  1165. X    ;;
  1166. X*)  dflt="$perlpath"
  1167. X    ;;
  1168. Xesac
  1169. Xecho " "
  1170. Xfn=f~/
  1171. Xrp="Where is perl located on your system?"
  1172. X. ./getfile
  1173. Xperlpath="$ans"
  1174. X
  1175. X: see what type pids are declared as in the kernel
  1176. Xcase "$pidtype" in
  1177. X'')
  1178. X    if $contains 'pid_t;' `./findhdr sys/types.h` >/dev/null 2>&1 ; then
  1179. X        dflt='pid_t';
  1180. X    else
  1181. X        dflt="int"
  1182. X    fi
  1183. X    ;;
  1184. X*)  dflt="$pidtype";;
  1185. Xesac
  1186. Xecho " "
  1187. Xrp="What type are process ids on this system declared as?"
  1188. X. ./myread
  1189. Xpidtype="$ans"
  1190. X
  1191. X: Cruising for prototypes
  1192. Xecho " "
  1193. Xecho "Checking out function prototypes..." >&4
  1194. X$cat >prototype.c <<'EOCP'
  1195. Xmain(int argc, char *argv[]) {
  1196. X    exit(0);}
  1197. XEOCP
  1198. Xif $cc -c prototype.c >prototype.out 2>&1 ; then
  1199. X    echo "Your C compiler appears to support function prototypes."
  1200. X    val="$define"
  1201. Xelse
  1202. X    echo "Your C compiler doesn't seem to understand function prototypes."
  1203. X    val="$undef"
  1204. Xfi
  1205. Xset prototype
  1206. Xeval $setvar
  1207. X$rm -f prototype*
  1208. X
  1209. X: get C preprocessor symbols handy
  1210. Xecho " "
  1211. Xecho $attrlist | $tr ' ' '\012' >Cppsym.know
  1212. X$cat <<EOSS >Cppsym
  1213. X$startsh
  1214. Xcase "\$1" in
  1215. X-l) list=true
  1216. X    shift
  1217. X    ;;
  1218. Xesac
  1219. Xunknown=''
  1220. Xcase "\$list\$#" in
  1221. X1|2)
  1222. X    for sym do
  1223. X        if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
  1224. X            exit 0
  1225. X        elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
  1226. X            :
  1227. X        else
  1228. X            unknown="\$unknown \$sym"
  1229. X        fi
  1230. X    done
  1231. X    set X \$unknown
  1232. X    shift
  1233. X    ;;
  1234. Xesac
  1235. Xcase \$# in
  1236. X0) exit 1;;
  1237. Xesac
  1238. Xecho \$* | $tr ' ' '\012' | $sed -e 's/\(.*\)/\\
  1239. X#ifdef \1\\
  1240. Xexit 0; _ _ _ _\1\\     \1\\
  1241. X#endif\\
  1242. X/' >Cppsym\$\$
  1243. Xecho "exit 1; _ _ _" >>Cppsym\$\$
  1244. X$cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
  1245. Xcase "\$list" in
  1246. Xtrue) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
  1247. X*)
  1248. X    sh Cppsym2\$\$
  1249. X    status=\$?
  1250. X    ;;
  1251. Xesac
  1252. X$rm -f Cppsym\$\$ Cppsym2\$\$
  1253. Xexit \$status
  1254. XEOSS
  1255. Xchmod +x Cppsym
  1256. X$eunicefix Cppsym
  1257. Xecho "Your C preprocessor defines the following symbols:"
  1258. XCppsym -l $attrlist >Cppsym.true
  1259. X$cat Cppsym.true
  1260. X
  1261. X: see how many register declarations we want to use
  1262. Xcase "$registers" in
  1263. X'')
  1264. X    if Cppsym vax; then
  1265. X        dflt=6
  1266. X    elif Cppsym sun mc68000 mips; then
  1267. X        dflt=10
  1268. X    elif Cppsym pyr; then
  1269. X        dflt=14
  1270. X    elif Cppsym ns32000 ns16000; then
  1271. X        dflt=5
  1272. X    elif Cppsym $smallmach; then
  1273. X        dflt=3
  1274. X    else
  1275. X        : if you have any other numbers for me, please send them in
  1276. X        dflt=6
  1277. X    fi;;
  1278. X*) dflt=$registers ;;
  1279. Xesac
  1280. Xcat <<EOM
  1281. XDifferent C compilers on different machines pay attention to different numbers
  1282. Xof register declarations.  About how many register declarations in each routine
  1283. Xdoes your C compiler pay attention to?  (OK to guess)
  1284. X
  1285. XEOM
  1286. Xrp="Maximum register declarations?"
  1287. X. ./myread
  1288. Xregisters=$ans
  1289. Xreg1=''
  1290. X$awk "BEGIN { for (i=1; i<=16; i++) printf \"reg%d=''\n\", i}" \
  1291. X    </dev/null >.foo
  1292. X. ./.foo
  1293. X$awk "BEGIN { for (i=1; i<=$registers; i++) printf \"reg%d=register\n\", i}" \
  1294. X    </dev/null >.foo
  1295. X. ./.foo
  1296. X$rm -f .foo
  1297. X
  1298. X: see if signal is declared as pointer to function returning int or void
  1299. Xecho " "
  1300. Xxxx=`./findhdr signal.h`
  1301. X$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
  1302. Xif $contains 'int.*\*[     ]*signal' $$.tmp >/dev/null 2>&1 ; then
  1303. X    echo "You have int (*signal())() instead of void." >&4
  1304. X    val="$undef"
  1305. X    signal_t="int"
  1306. Xelif $contains 'void.*\*[     ]*signal' $$.tmp >/dev/null 2>&1 ; then
  1307. X    echo "You have void (*signal())() instead of int." >&4
  1308. X    val="$define"
  1309. X    signal_t="void"
  1310. Xelif $contains 'extern[     ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
  1311. X    echo "You have int (*signal())() instead of void." >&4
  1312. X    val="$undef"
  1313. X    signal_t="int"
  1314. Xelse
  1315. X    case "$d_voidsig" in
  1316. X    '')
  1317. X    echo "I can't determine whether signal handler returns void or int..." >&4
  1318. X        dflt=void
  1319. X        rp="What type does your signal handler returns?"
  1320. X        . ./myread
  1321. X        case "$ans" in
  1322. X        void) val="$define"; signal_t="void";;
  1323. X        *) val="$undef"; signal_t="int";;
  1324. X        esac;;
  1325. X    *) echo "As you already told me, signal handler returns $signal_t." >&4;;
  1326. X    esac
  1327. Xfi
  1328. Xset d_voidsig
  1329. Xeval $setvar
  1330. X$rm -f $$.tmp
  1331. X
  1332. X: figure out how to guarantee perl startup
  1333. Xcase "$sharpbang" in
  1334. X*!)
  1335. X    $cat <<EOH
  1336. X
  1337. XI can use the #! construct to start perl on your system. This will make
  1338. Xstartup of perl scripts faster, but may cause problems if you want to share
  1339. Xthose scripts and perl is not in a standard place (/usr/bin/perl) on all your
  1340. Xplatforms. The alternative is to force a shell by starting the script with a
  1341. Xsingle ':' character.
  1342. X
  1343. XEOH
  1344. X    dflt=n
  1345. X    case "$startperl" in
  1346. X    *!*) dflt=y;;
  1347. X    '') case "$d_portable" in
  1348. X        "$define") ;;
  1349. X        *) dflt=y;;
  1350. X        esac;;
  1351. X    esac
  1352. X    rp='Shall I use #! to start up perl?'
  1353. X    . ./myread
  1354. X    case "$ans" in
  1355. X    y*|Y*) startperl="#!$perlpath";;
  1356. X    *) startperl=": # use perl";;
  1357. X    esac;;
  1358. X*) startperl=": # use perl";;
  1359. Xesac
  1360. X
  1361. X: see if time exists
  1362. Xecho " "
  1363. Xif set time val -f d_time; eval $csym; $val; then
  1364. X    echo 'time() found.' >&4
  1365. X    val="$define"
  1366. X    case "$timetype" in
  1367. X    '')
  1368. X        if $contains 'time_t;' `./findhdr sys/types.h` >/dev/null 2>&1 ; then
  1369. X            dflt='time_t';
  1370. X        else
  1371. X            dflt='long';
  1372. X        fi
  1373. X        ;;
  1374. X    *)  dflt="$timetype"
  1375. X        ;;
  1376. X    esac
  1377. X    echo " "
  1378. X    rp="What type is returned by time() on this sytem?"
  1379. X    . ./myread
  1380. X    timetype="$ans"
  1381. Xelse
  1382. X    echo 'time() not found, hope that will do.' >&4
  1383. X    val="$undef"
  1384. X    timetype='int';
  1385. Xfi
  1386. Xset d_time
  1387. Xeval $setvar
  1388. X
  1389. X: see what type uids are declared as in the kernel
  1390. Xcase "$uidtype" in
  1391. X'')
  1392. X    if $contains 'uid_t;' `./findhdr sys/types.h` >/dev/null 2>&1 ; then
  1393. X        dflt='uid_t';
  1394. X    else
  1395. X        xxx=`./findhdr sys/user.h`
  1396. X        set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
  1397. X        case $1 in
  1398. X        unsigned) dflt="$1 $2" ;;
  1399. X        *) dflt="$1" ;;
  1400. X        esac
  1401. X    fi
  1402. X    ;;
  1403. X*)  dflt="$uidtype";;
  1404. Xesac
  1405. Xecho " "
  1406. Xrp="What type are user ids on this system declared as?"
  1407. X. ./myread
  1408. Xuidtype="$ans"
  1409. X
  1410. X: check for void type
  1411. Xecho " "
  1412. X$cat >&4 <<EOM
  1413. XChecking to see how well your C compiler groks the void type...
  1414. X
  1415. X  Support flag bits are:
  1416. X    1: basic void declarations.
  1417. X    2: arrays of pointers to functions returning void.
  1418. X    4: operations between pointers to and addresses of void functions.
  1419. X    8: generic void pointers.
  1420. X
  1421. XEOM
  1422. Xcase "$voidflags" in
  1423. X'')
  1424. X    $cat >try.c <<'EOCP'
  1425. X#if TRY & 1
  1426. Xvoid main() {
  1427. X#else
  1428. Xmain() {
  1429. X#endif
  1430. X    extern void moo();    /* function returning void */
  1431. X    void (*goo)();        /* ptr to func returning void */
  1432. X#if TRY & 8
  1433. X    void *hue;        /* generic ptr */
  1434. X#endif
  1435. X#if TRY & 2
  1436. X    void (*foo[10])();
  1437. X#endif
  1438. X
  1439. X#if TRY & 4
  1440. X    if(goo == moo) {
  1441. X        exit(0);
  1442. X    }
  1443. X#endif
  1444. X    exit(0);
  1445. X}
  1446. XEOCP
  1447. X    if $cc -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
  1448. X        voidflags=$defvoidused
  1449. X    echo "It appears to support void to the level $package wants ($defvoidused)."
  1450. X        if $contains warning .out >/dev/null 2>&1; then
  1451. X            echo "However, you might get some warnings that look like this:"
  1452. X            $cat .out
  1453. X        fi
  1454. X    else
  1455. Xecho "Hmm, your compiler has some difficulty with void. Checking further..." >&4
  1456. X        if $cc -c -DTRY=1 try.c >/dev/null 2>&1 ; then
  1457. X            echo "It supports 1..."
  1458. X            if $cc -c -DTRY=3 try.c >/dev/null 2>&1 ; then
  1459. X                echo "It also supports 2..."
  1460. X                if $cc -c -DTRY=7 try.c >/dev/null 2>&1 ; then
  1461. X                    voidflags=7
  1462. X                    echo "And it supports 4 but not 8 definitely."
  1463. X                else
  1464. X                    echo "It doesn't support 4..."
  1465. X                    if $cc -c -DTRY=11 try.c >/dev/null 2>&1 ; then
  1466. X                        voidflags=11
  1467. X                        echo "But it supports 8."
  1468. X                    else
  1469. X                        voidflags=3
  1470. X                        echo "Neither does it support 8."
  1471. X                    fi
  1472. X                fi
  1473. X            else
  1474. X                echo "It does not support 2..."
  1475. X                if $cc -c -DTRY=13 try.c >/dev/null 2>&1 ; then
  1476. X                    voidflags=13
  1477. X                    echo "But it supports 4 and 8."
  1478. X                else
  1479. X                    if $cc -c -DTRY=5 try.c >/dev/null 2>&1 ; then
  1480. X                        voidflags=5
  1481. X                        echo "And it supports 4 but has not heard about 8."
  1482. X                    else
  1483. X                        echo "However it supports 8 but not 4."
  1484. X                    fi
  1485. X                fi
  1486. X            fi
  1487. X        else
  1488. X            echo "There is no support at all for void."
  1489. X            voidflags=0
  1490. X        fi
  1491. X    fi
  1492. Xesac
  1493. Xdflt="$voidflags";
  1494. Xrp="Your void support flags add up to what?"
  1495. X. ./myread
  1496. Xvoidflags="$ans"
  1497. X$rm -f try.* .out
  1498. X
  1499. X: define an alternate in-header-list? function
  1500. Xinhdr='echo " "; td=$define; tu=$undef; yyy=$@;
  1501. Xcont=true; xxf="echo \"<\$1> found.\" >&4";
  1502. Xcase $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
  1503. X*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
  1504. Xesac;
  1505. Xcase $# in 4) instead=instead;; *) instead="at last";; esac;
  1506. Xwhile $test "$cont"; do
  1507. X    xxx=`./findhdr $1`
  1508. X    var=$2; eval "was=\$$2";
  1509. X    if $test "$xxx" && $test -r "$xxx";
  1510. X    then eval $xxf;
  1511. X        eval "case \"\$$var\" in $undef) . whoa; esac"; eval "$var=\$td";
  1512. X        cont="";
  1513. X    else eval $xxnf;
  1514. X        eval "case \"\$$var\" in $define) . whoa; esac"; eval "$var=\$tu"; fi;
  1515. X    set $yyy; shift; shift; yyy=$@;
  1516. X    case $# in 0) cont="";;
  1517. X    2) xxf="echo \"but I found <\$1> $instead.\" >&4";
  1518. X        xxnf="echo \"and I did not find <\$1> either.\" >&4";;
  1519. X    *) xxf="echo \"but I found <\$1\> instead.\" >&4";
  1520. X        xxnf="echo \"there is no <\$1>, ...\" >&4";;
  1521. X    esac;
  1522. Xdone;
  1523. Xwhile $test "$yyy";
  1524. Xdo set $yyy; var=$2; eval "was=\$$2";
  1525. X    eval "case \"\$$var\" in $define) . whoa; esac"; eval "$var=\$tu";
  1526. X    set $yyy; shift; shift; yyy=$@;
  1527. Xdone'
  1528. X
  1529. X: see if this is a sys/file.h system
  1530. Xval=''
  1531. Xset sys/file.h val
  1532. Xeval $inhdr
  1533. X
  1534. X: do we need to #include <sys/file.h> ?
  1535. Xcase "$val" in
  1536. X"$define")
  1537. X    echo " "
  1538. X    if $h_sysfile; then
  1539. X        val="$define"
  1540. X        echo "We'll be including <sys/file.h>." >&4
  1541. X    else
  1542. X        val="$undef"
  1543. X        echo "We won't be including <sys/file.h>." >&4
  1544. X    fi
  1545. X    ;;
  1546. X*)
  1547. X    h_sysfile=false
  1548. X    ;;
  1549. Xesac
  1550. Xset i_sysfile
  1551. Xeval $setvar
  1552. X
  1553. X: see if fcntl.h is there
  1554. Xval=''
  1555. Xset fcntl.h val
  1556. Xeval $inhdr
  1557. X
  1558. X: see if we can include fcntl.h
  1559. Xcase "$val" in
  1560. X"$define")
  1561. X    echo " "
  1562. X    if $h_fcntl; then
  1563. X        val="$define"
  1564. X        echo "We'll be including <fcntl.h>." >&4
  1565. X    else
  1566. X        val="$undef"
  1567. X        if $h_sysfile; then
  1568. X    echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
  1569. X        else
  1570. X            echo "We won't be including <fcntl.h>." >&4
  1571. X        fi
  1572. X    fi
  1573. X    ;;
  1574. X*)
  1575. X    h_fcntl=false
  1576. X    val="$undef"
  1577. X    ;;
  1578. Xesac
  1579. Xset i_fcntl
  1580. Xeval $setvar
  1581. X
  1582. X: see if we should include time.h, sys/time.h, or both
  1583. Xecho " "
  1584. Xecho "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
  1585. X$echo $n "I'm now running the test program...$c"
  1586. X$cat >try.c <<'EOCP'
  1587. X#include <sys/types.h>
  1588. X#ifdef I_TIME
  1589. X#include <time.h>
  1590. X#endif
  1591. X#ifdef I_SYSTIME
  1592. X#ifdef SYSTIMEKERNEL
  1593. X#define KERNEL
  1594. X#endif
  1595. X#include <sys/time.h>
  1596. X#endif
  1597. X#ifdef I_SYSSELECT
  1598. X#include <sys/select.h>
  1599. X#endif
  1600. Xmain()
  1601. X{
  1602. X    struct tm foo;
  1603. X#ifdef S_TIMEVAL
  1604. X    struct timeval bar;
  1605. X#endif
  1606. X#ifdef S_TIMEZONE
  1607. X    struct timezone tzp;
  1608. X#endif
  1609. X    if (foo.tm_sec == foo.tm_sec)
  1610. X        exit(0);
  1611. X#ifdef S_TIMEVAL
  1612. X    if (bar.tv_sec == bar.tv_sec)
  1613. X        exit(0);
  1614. X#endif
  1615. X    exit(1);
  1616. X}
  1617. XEOCP
  1618. Xflags=''
  1619. Xfor s_timezone in '-DS_TIMEZONE' ''; do
  1620. Xsysselect=''
  1621. Xfor s_timeval in '-DS_TIMEVAL' ''; do
  1622. Xfor i_systimek in '' '-DSYSTIMEKERNEL'; do
  1623. Xfor i_time in '' '-DI_TIME'; do
  1624. Xfor i_systime in '-DI_SYSTIME' ''; do
  1625. X    case "$flags" in
  1626. X    '') $echo $n ".$c"
  1627. X        if $cc $ccflags \
  1628. X        $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone \
  1629. X        try.c -o try >/dev/null 2>&1 ; then
  1630. X            set X $i_time $i_systime $i_systimek $sysselect $s_timeval
  1631. X            shift
  1632. X            flags="$*"
  1633. X            echo " "
  1634. X            $echo $n "Succeeded with $flags$c"
  1635. X        fi
  1636. X        ;;
  1637. X    esac
  1638. Xdone
  1639. Xdone
  1640. Xdone
  1641. Xdone
  1642. Xdone
  1643. Xtimeincl=''
  1644. Xecho " "
  1645. Xcase "$flags" in
  1646. X*SYSTIMEKERNEL*) i_systimek="$define"
  1647. X    timeincl=`./findhdr sys/time.h`
  1648. X    echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
  1649. X*) i_systimek="$undef";;
  1650. Xesac
  1651. Xcase "$flags" in
  1652. X*I_TIME*) i_time="$define"
  1653. X    timeincl=`./findhdr time.h`" $timeincl"
  1654. X    echo "We'll include <time.h>." >&4;;
  1655. X*) i_time="$undef";;
  1656. Xesac
  1657. Xcase "$flags" in
  1658. X*I_SYSTIME*) i_systime="$define"
  1659. X    timeincl=`./findhdr sys/time.h`" $timeincl"
  1660. X    echo "We'll include <sys/time.h>." >&4;;
  1661. X*) i_systime="$undef";;
  1662. Xesac
  1663. X$rm -f try.c try
  1664. X
  1665. X: see if this is a syswait system
  1666. Xset sys/wait.h i_syswait
  1667. Xeval $inhdr
  1668. X
  1669. X: notify author that his package is used
  1670. Xif $test -f ../.config/mailauthor &&
  1671. X    cmp ../patchlevel.h ../.config/mailauthor >/dev/null 2>&1
  1672. Xthen
  1673. X    status="say that you're using $package";
  1674. X    case "$mailpatches" in
  1675. X    true) status='have patches mailed to you as they are issued';;
  1676. X    esac
  1677. X    case "$notifypatches" in
  1678. X    true) status='be notified when new patches are issued';;
  1679. X    esac
  1680. X    $cat <<EOM
  1681. X
  1682. XYou have already sent the author of $package (ram@acri.fr) mail to
  1683. X$status. If you wish, you may modify
  1684. Xyour previous request by sending a new mail with different options.
  1685. X
  1686. XEOM
  1687. X    rp='Should I send a status update to ram@acri.fr?'
  1688. X    dflt=n
  1689. Xelse
  1690. X    $cat <<EOM
  1691. X
  1692. XIf you are able to send mail to the Internet, the author of $package would
  1693. Xreally appreciate you letting me send off a quick note, just to say that you've
  1694. Xtried it. The author is more likely to spend time maintaining $package if it's
  1695. Xknown that many people are using it, and you can even ask to get sent new
  1696. Xpatches automagically this way if you wish. To protect your privacy, all I'll
  1697. Xsay in the mail is the version of $package that you're using.
  1698. X
  1699. XEOM
  1700. X    rp='Should I send mail to ram@acri.fr?'
  1701. X    dflt=y
  1702. Xfi
  1703. X. ./myread
  1704. Xcase "$ans" in
  1705. X[yY]*)
  1706. X    echo " "
  1707. X    echo "Great!. You cooperation is really appreciated."
  1708. X    $cat <<EOM
  1709. X
  1710. XSome braindead sites do not set a proper return address in the From: header of
  1711. Xtheir outgoing mail, making it impossible to reply to mail they generate.
  1712. XIf your site is broken in this way, write to your system administrator and get
  1713. Xit fixed!!! In the mean time, you can manually specify the Internet e-mail
  1714. Xaddress by which the author can get back to you, should there be a need to do
  1715. Xso. If manually specified, it should be something like "user@domain.top".
  1716. XIf your mail system generates addresses correctly, specify "none".
  1717. X
  1718. XEOM
  1719. X    case "$usermail" in
  1720. X    '-'|'') dflt=none;;
  1721. X    *) dflt="$usermail";;
  1722. X    esac
  1723. X    rp='Manually specify a return address to use:'
  1724. X    . ./myread
  1725. X    case "$ans" in
  1726. X    none|*@*.*)
  1727. X        case "$ans" in
  1728. X        none) usermail='-';;
  1729. X        *) usermail="$ans";;
  1730. X        esac
  1731. X        ;;
  1732. X    *)
  1733. X        echo "(Address does not look like an Internet one -- ignoring it.)"
  1734. X        usermail='-'
  1735. X        mailpatches=false
  1736. X        notifypatches=false
  1737. X        ;;
  1738. X    esac
  1739. X    echo " "
  1740. X    opt=''
  1741. X    rp='Would you like to have new patches automatically mailed to you?'
  1742. X    case "$mailpatches" in
  1743. X    true) dflt=y;;
  1744. X    *) dflt=n;;
  1745. X    esac
  1746. X    . ./myread
  1747. X    case "$ans" in
  1748. X    [yY]*) opt=' mailpatches'; mailpatches=true;;
  1749. X    *)
  1750. X        mailpatches=false
  1751. X        echo " "
  1752. X        rp='Ok, would you like to simply be notified of new patches?'
  1753. X        case "$notifypatches" in
  1754. X        false) dflt=n;;
  1755. X        *) dflt=y;;
  1756. X        esac
  1757. X        . ./myread
  1758. X        echo " "
  1759. X        case "$ans" in
  1760. X        [yY]*) opt=' notifypatches'; notifypatches=true;;
  1761. X        *)
  1762. X            echo "Fine, I'll simply say that you've tried it then."
  1763. X            notifypatches=false
  1764. X            ;;
  1765. X        esac
  1766. X        ;;
  1767. X    esac
  1768. X    echo "Sending mail to ram@acri.fr..." >&4
  1769. X    atsh='@SH'
  1770. X    $mailer ram@acri.fr <<EOM >/dev/null 2>&1
  1771. XSubject: Command
  1772. XPrecedence: junk
  1773. XTo: ram@acri.fr
  1774. X
  1775. X$atsh package $usermail $package $baserev $patchlevel$opt
  1776. XEOM
  1777. X    $rm -f ../.config/mailauthor
  1778. X    cp ../patchlevel.h ../.config/mailauthor
  1779. X    ;;
  1780. X*)
  1781. X    case "$dflt" in
  1782. X    "y") echo "Oh well, maybe next time.";;
  1783. X    esac
  1784. X    ;;
  1785. Xesac
  1786. X
  1787. X: end of configuration questions
  1788. Xecho " "
  1789. Xecho "End of configuration questions."
  1790. Xecho " "
  1791. X
  1792. X: back to where it started
  1793. Xif test -d ../UU; then
  1794. X    cd ..
  1795. Xfi
  1796. X
  1797. X: configuration may be patched via a 'config.over' file
  1798. Xif $test -f config.over; then
  1799. X    echo " "
  1800. X    dflt=y
  1801. X    rp='I see a config.over file.  Do you wish to load it?'
  1802. X    . UU/myread
  1803. X    case "$ans" in
  1804. X    n*) echo "OK, I'll ignore it.";;
  1805. X    *)    . ./config.over
  1806. X        echo "Configuration override changes have been loaded."
  1807. X        ;;
  1808. X    esac
  1809. Xfi
  1810. X
  1811. X: create config.sh file
  1812. Xecho " "
  1813. Xecho "Creating config.sh..." >&4
  1814. X$spitshell <<EOT >config.sh
  1815. X$startsh
  1816. X#
  1817. X# This file was produced by running the Configure script. It holds all the
  1818. X# definitions figured out by Configure. Should you modify one of these values,
  1819. X# do not forget to propagate your changes by running "Configure -der". You may
  1820. X# instead choose to run each of the .SH files by yourself, or "Configure -S".
  1821. X#
  1822. X
  1823. X# Configuration time: $cf_time
  1824. X# Configured by: $cf_by
  1825. X# Target system: $myuname
  1826. X
  1827. Xd_bsd='$d_bsd'
  1828. Xd_eunice='$d_eunice'
  1829. Xd_xenix='$d_xenix'
  1830. Xeunicefix='$eunicefix'
  1831. XMcc='$Mcc'
  1832. Xawk='$awk'
  1833. Xbash='$bash'
  1834. Xbison='$bison'
  1835. Xcat='$cat'
  1836. Xchgrp='$chgrp'
  1837. Xchmod='$chmod'
  1838. Xchown='$chown'
  1839. Xcompress='$compress'
  1840. Xcp='$cp'
  1841. Xcpio='$cpio'
  1842. Xcpp='$cpp'
  1843. Xcsh='$csh'
  1844. Xdate='$date'
  1845. Xecho='$echo'
  1846. Xegrep='$egrep'
  1847. Xemacs='$emacs'
  1848. Xexpr='$expr'
  1849. Xflex='$flex'
  1850. Xgcc='$gcc'
  1851. Xgrep='$grep'
  1852. Xinews='$inews'
  1853. Xksh='$ksh'
  1854. Xless='$less'
  1855. Xline='$line'
  1856. Xlint='$lint'
  1857. Xln='$ln'
  1858. Xlp='$lp'
  1859. Xlpr='$lpr'
  1860. Xls='$ls'
  1861. Xmail='$mail'
  1862. Xmailx='$mailx'
  1863. Xmake='$make'
  1864. Xmkdir='$mkdir'
  1865. Xmore='$more'
  1866. Xmv='$mv'
  1867. Xnroff='$nroff'
  1868. Xperl='$perl'
  1869. Xpg='$pg'
  1870. Xpmake='$pmake'
  1871. Xpr='$pr'
  1872. Xrm='$rm'
  1873. Xrmail='$rmail'
  1874. Xsed='$sed'
  1875. Xsendmail='$sendmail'
  1876. Xsh='$sh'
  1877. Xshar='$shar'
  1878. Xsleep='$sleep'
  1879. Xsmail='$smail'
  1880. Xsort='$sort'
  1881. Xsubmit='$submit'
  1882. Xtail='$tail'
  1883. Xtar='$tar'
  1884. Xtbl='$tbl'
  1885. Xtest='$test'
  1886. Xtouch='$touch'
  1887. Xtr='$tr'
  1888. Xtroff='$troff'
  1889. Xuname='$uname'
  1890. Xuniq='$uniq'
  1891. Xuuname='$uuname'
  1892. Xvi='$vi'
  1893. Xzcat='$zcat'
  1894. Xmailpatches='$mailpatches'
  1895. Xnotifypatches='$notifypatches'
  1896. Xusermail='$usermail'
  1897. Xhint='$hint'
  1898. Xmyuname='$myuname'
  1899. XAuthor='$Author'
  1900. XDate='$Date'
  1901. XHeader='$Header'
  1902. XId='$Id'
  1903. XLocker='$Locker'
  1904. XLog='$Log'
  1905. XRCSfile='$RCSfile'
  1906. XRevision='$Revision'
  1907. XSource='$Source'
  1908. XState='$State'
  1909. Xafs='$afs'
  1910. Xbaserev='$baserev'
  1911. Xbin='$bin'
  1912. Xbinexp='$binexp'
  1913. Xinstallbin='$installbin'
  1914. Xcc='$cc'
  1915. Xccflags='$ccflags'
  1916. Xcppflags='$cppflags'
  1917. Xldflags='$ldflags'
  1918. Xlkflags='$lkflags'
  1919. Xoptimize='$optimize'
  1920. Xcf_by='$cf_by'
  1921. Xcf_time='$cf_time'
  1922. Xcontains='$contains'
  1923. Xcppminus='$cppminus'
  1924. Xcppstdin='$cppstdin'
  1925. Xd_bcopy='$d_bcopy'
  1926. Xd_flock='$d_flock'
  1927. Xaphostname='$aphostname'
  1928. Xd_gethname='$d_gethname'
  1929. Xd_phostname='$d_phostname'
  1930. Xd_uname='$d_uname'
  1931. Xd_hidnet='$d_hidnet'
  1932. Xhiddennet='$hiddennet'
  1933. Xd_open3='$d_open3'
  1934. Xd_portable='$d_portable'
  1935. Xd_rename='$d_rename'
  1936. Xd_index='$d_index'
  1937. Xd_strchr='$d_strchr'
  1938. Xd_strerrm='$d_strerrm'
  1939. Xd_strerror='$d_strerror'
  1940. Xd_sysernlst='$d_sysernlst'
  1941. Xd_syserrlst='$d_syserrlst'
  1942. Xd_time='$d_time'
  1943. Xtimetype='$timetype'
  1944. Xd_uwait='$d_uwait'
  1945. Xd_vfork='$d_vfork'
  1946. Xd_voidsig='$d_voidsig'
  1947. Xsignal_t='$signal_t'
  1948. Xh_fcntl='$h_fcntl'
  1949. Xh_sysfile='$h_sysfile'
  1950. Xi_fcntl='$i_fcntl'
  1951. Xi_string='$i_string'
  1952. Xstrings='$strings'
  1953. Xi_sysfile='$i_sysfile'
  1954. Xi_syswait='$i_syswait'
  1955. Xi_systime='$i_systime'
  1956. Xi_systimek='$i_systimek'
  1957. Xi_time='$i_time'
  1958. Xtimeincl='$timeincl'
  1959. Xintsize='$intsize'
  1960. Xlibc='$libc'
  1961. Xlibpth='$libpth'
  1962. Xplibpth='$plibpth'
  1963. Xxlibpth='$xlibpth'
  1964. Xlibs='$libs'
  1965. Xmaildir='$maildir'
  1966. Xmaildirexp='$maildirexp'
  1967. Xmailer='$mailer'
  1968. Xmailfile='$mailfile'
  1969. Xinstallmansrc='$installmansrc'
  1970. Xmanext='$manext'
  1971. Xmansrc='$mansrc'
  1972. Xmansrcexp='$mansrcexp'
  1973. Xd_flockonly='$d_flockonly'
  1974. Xd_lockflock='$d_lockflock'
  1975. Xflock_only='$flock_only'
  1976. Xlock_by_flock='$lock_by_flock'
  1977. Xmkdep='$mkdep'
  1978. Xhuge='$huge'
  1979. Xlarge='$large'
  1980. Xmedium='$medium'
  1981. Xmodels='$models'
  1982. Xsmall='$small'
  1983. Xsplit='$split'
  1984. Xmydomain='$mydomain'
  1985. Xmyhostname='$myhostname'
  1986. Xphostname='$phostname'
  1987. Xc='$c'
  1988. Xn='$n'
  1989. Xgroupcat='$groupcat'
  1990. Xhostcat='$hostcat'
  1991. Xpasscat='$passcat'
  1992. Xorgname='$orgname'
  1993. Xpackage='$package'
  1994. Xspackage='$spackage'
  1995. Xpatchlevel='$patchlevel'
  1996. Xperlpath='$perlpath'
  1997. Xpidtype='$pidtype'
  1998. Xinstallprivlib='$installprivlib'
  1999. Xprivlib='$privlib'
  2000. Xprivlibexp='$privlibexp'
  2001. Xprototype='$prototype'
  2002. Xreg10='$reg10'
  2003. Xreg11='$reg11'
  2004. Xreg12='$reg12'
  2005. Xreg13='$reg13'
  2006. Xreg14='$reg14'
  2007. Xreg15='$reg15'
  2008. Xreg16='$reg16'
  2009. Xreg1='$reg1'
  2010. Xreg2='$reg2'
  2011. Xreg3='$reg3'
  2012. Xreg4='$reg4'
  2013. Xreg5='$reg5'
  2014. Xreg6='$reg6'
  2015. Xreg7='$reg7'
  2016. Xreg8='$reg8'
  2017. Xreg9='$reg9'
  2018. Xregisters='$registers'
  2019. Xinstallscript='$installscript'
  2020. Xscriptdir='$scriptdir'
  2021. Xscriptdirexp='$scriptdirexp'
  2022. Xsharpbang='$sharpbang'
  2023. Xshsharp='$shsharp'
  2024. Xspitshell='$spitshell'
  2025. Xstartperl='$startperl'
  2026. Xstartsh='$startsh'
  2027. Xsysman='$sysman'
  2028. Xuidtype='$uidtype'
  2029. Xnm_opt='$nm_opt'
  2030. Xrunnm='$runnm'
  2031. Xusenm='$usenm'
  2032. Xincpath='$incpath'
  2033. Xmips='$mips'
  2034. Xmips_type='$mips_type'
  2035. Xusrinc='$usrinc'
  2036. Xdefvoidused='$defvoidused'
  2037. Xvoidflags='$voidflags'
  2038. XEOT
  2039. X
  2040. X: add special variables
  2041. X$test -f patchlevel.h && \
  2042. Xawk '/^#define/ {printf "%s=%s\n",$2,$3}' patchlevel.h >>config.sh
  2043. Xecho "CONFIG=true" >>config.sh
  2044. X
  2045. X: propagate old symbols
  2046. Xif $test -f UU/config.sh; then
  2047. X    <UU/config.sh sort | uniq >UU/oldconfig.sh
  2048. X    sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
  2049. X    sort | uniq -u >UU/oldsyms
  2050. X    set X `cat UU/oldsyms`
  2051. X    shift
  2052. X    case $# in
  2053. X    0) ;;
  2054. X    *)
  2055. X        cat <<EOM
  2056. XHmm...You had some extra variables I don't know about...I'll try to keep 'em...
  2057. XEOM
  2058. X        echo "# Variables propagated from previous config.sh file." >>config.sh
  2059. X        for sym in `cat UU/oldsyms`; do
  2060. X            echo "    Propagating $hint variable "'$'"$sym..."
  2061. X            eval 'tmp="$'"${sym}"'"'
  2062. X            echo "$tmp" | \
  2063. X                sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
  2064. X        done
  2065. X        ;;
  2066. X    esac
  2067. Xfi
  2068. X
  2069. X: Finish up by extracting the .SH files
  2070. Xcase "$alldone" in
  2071. Xexit)
  2072. X    $rm -rf UU
  2073. X    echo "Done."
  2074. X    exit 0
  2075. X    ;;
  2076. Xcont)
  2077. X    ;;
  2078. X'')
  2079. X    echo " "
  2080. X    dflt=''
  2081. X    nostick=true
  2082. Xecho "If you didn't make any mistakes, then just type a carriage return here."
  2083. X    rp="If you need to edit config.sh, do it as a shell escape here:"
  2084. X    . UU/myread
  2085. X    nostick=''
  2086. X    case "$ans" in
  2087. X    '') ;;
  2088. X    *) : in case they cannot read
  2089. X        sh 1>&4 -c "$ans";;
  2090. X    esac
  2091. X    ;;
  2092. Xesac
  2093. X
  2094. X: if this fails, just run all the .SH files by hand
  2095. X. ./config.sh
  2096. X
  2097. Xecho " "
  2098. Xexec 1>&4
  2099. X. ./UU/extract
  2100. X
  2101. Xif $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
  2102. X    dflt=y
  2103. X    case "$silent" in
  2104. X    true) ;;
  2105. X    *)
  2106. X        $cat <<EOM
  2107. X
  2108. XNow you need to generate make dependencies by running "make depend".
  2109. XYou might prefer to run it in background: "make depend > makedepend.out &"
  2110. XIt can take a while, so you might not want to run it right now.
  2111. X
  2112. XEOM
  2113. X        ;;
  2114. X    esac
  2115. X    rp="Run make depend now?"
  2116. X    . UU/myread
  2117. X    case "$ans" in
  2118. X    y*)
  2119. X        make depend && echo "Now you must run a make."
  2120. X        ;;
  2121. X    *)
  2122. X        echo "You must run 'make depend' then 'make'."
  2123. X        ;;
  2124. X    esac
  2125. Xelif test -f [Mm]akefile; then
  2126. X    echo " "
  2127. X    echo "Now you must run a make."
  2128. Xelse
  2129. X    echo "Done."
  2130. Xfi
  2131. X
  2132. X$rm -f kit*isdone ark*isdone
  2133. X$rm -rf UU
  2134. X: End of Configure
  2135. END_OF_FILE
  2136.   if test 46962 -ne `wc -c <'Configure.02'`; then
  2137.     echo shar: \"'Configure.02'\" unpacked with wrong size!
  2138.   fi
  2139.   # end of 'Configure.02'
  2140. fi
  2141. if test -f 'agent/pl/add_log.pl' -a "${1}" != "-c" ; then 
  2142.   echo shar: Will not clobber existing file \"'agent/pl/add_log.pl'\"
  2143. else
  2144.   echo shar: Extracting \"'agent/pl/add_log.pl'\" \(5120 characters\)
  2145.   sed "s/^X//" >'agent/pl/add_log.pl' <<'END_OF_FILE'
  2146. X;# $Id: add_log.pl,v 3.0 1993/11/29 13:48:34 ram Exp ram $
  2147. X;#
  2148. X;#  Copyright (c) 1990-1993, Raphael Manfredi
  2149. X;#  
  2150. X;#  You may redistribute only under the terms of the Artistic License,
  2151. X;#  as specified in the README file that comes with the distribution.
  2152. X;#  You may reuse parts of this distribution only within the terms of
  2153. X;#  that same Artistic License; a copy of which may be found at the root
  2154. X;#  of the source tree for mailagent 3.0.
  2155. X;#
  2156. X;# $Log: add_log.pl,v $
  2157. X;# Revision 3.0  1993/11/29  13:48:34  ram
  2158. X;# Baseline for mailagent 3.0 netwide release.
  2159. X;#
  2160. X;# Logging facilities. Normally, logs are appended into the agentlog file by
  2161. X;# a call to &add_log. For plain mailagent actions, this is fine. However,
  2162. X;# when user-defined commands are run or when the generic server is used, it
  2163. X;# could be desirable to write the logs to some other file.
  2164. X;#
  2165. X;# Therefore, this package provides a generic logging interface (usr_log) while
  2166. X;# keeping the previous add_log routine for backward compatibility. The user
  2167. X;# may record alternative log files, with or without a copy to the global log.
  2168. X;#
  2169. X;# The following interface functions in the usrlog package are available:
  2170. X;#
  2171. X;#   . new(name, file, flag)
  2172. X;#       records a log file. If flag is true, a copy to the main log
  2173. X;#       is also written. The name parameter refers to the global name
  2174. X;#       under which the log is known from now on. If an existing log file
  2175. X;#       has already been defined under this name, nothing is done.
  2176. X;#   . delete(name)
  2177. X;#       deletes a log file by name.
  2178. X;#
  2179. X;# All files given as a relative path name (i.e. not starting with /) are
  2180. X;# rooted in the 'logdir' directory as defined in the ~/.mailagent file.
  2181. X;#
  2182. X;# To log something, the user calls:
  2183. X;#
  2184. X;#   . usr_log(name, string)
  2185. X;#
  2186. X;# The logfile name 'default' is reserved to refer to the default system-wide
  2187. X;# logfile. Trying to log something to a non-existent logfile will log to the
  2188. X;# default logfile instead.
  2189. X;#
  2190. X# Add an entry to logfile
  2191. X# There is no need to lock logfile as print is sandwiched betweeen
  2192. X# an open and a close (kernel will flush at the end of the file).
  2193. Xsub add_log {
  2194. X    # Indirection needed, so that we may remap add_log on stderr_log via a
  2195. X    # type glob assignment.
  2196. X    &usrlog'write_log($cf'logfile, $_[0], undef);
  2197. X}
  2198. X
  2199. X# When mailagent is used interactively, log messages are also printed on
  2200. X# the standard error.
  2201. X# NB: this function is not called directly, but via a type glob *add_log.
  2202. Xsub stderr_log {
  2203. X    print STDERR "$prog_name: $_[0]\n";
  2204. X    &usrlog'write_log($cf'logfile, $_[0], undef);
  2205. X}
  2206. X
  2207. X#
  2208. X# User-defined log files
  2209. X#
  2210. X
  2211. Xpackage usrlog;
  2212. X
  2213. X# Record a new logfile by storing its pathname in the %Logpath hash table
  2214. X# indexed by names and the carbon-copy flag in the %Cc table.
  2215. Xsub new {
  2216. X    local($name, $path, $cc) = @_;
  2217. X    return if defined $Logpath{$name};    # Logfile already recorded
  2218. X    return if $name eq 'default';        # Cannot redefined defaul log
  2219. X    $path = "$cf'logdir/$path" unless $path =~ m|^/|;
  2220. X    $Logpath{$name} = $path;            # Where logfile should be stored
  2221. X    $Cc{$name} = $cc ? 1 : 0;            # Should we cc the default logfile?
  2222. X    $Map{$path} = $name;                # Two-way hash table
  2223. X}
  2224. X
  2225. X# Delete user-defined logfile.
  2226. Xsub delete {
  2227. X    local($name) = @_;
  2228. X    return unless defined $Logpath{$name};
  2229. X    local($path) = $Logpath{$name};
  2230. X    delete $Logpath{$name};
  2231. X    delete $Cc{$name};
  2232. X    delete $Map{$path};
  2233. X}
  2234. X
  2235. X# User-level logging main entry point
  2236. Xsub main'usr_log {
  2237. X    local($name, $message) = @_;    # Logfile name and message to be logged
  2238. X    local($file);
  2239. X    $file = ($name eq 'default' || !defined $Logpath{$name}) ?
  2240. X        $cf'logfile : $Logpath{$name};
  2241. X    &write_log($file, $message, $Cc{$name});
  2242. X}
  2243. X
  2244. X# Log message into logfile, using jobnum to identify process.
  2245. Xsub write_log {
  2246. X    local($file, $msg, $cc) = @_;    # Logfile, message to be logged, cc flag
  2247. X    local($date);
  2248. X    local($log);
  2249. X
  2250. X    local ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
  2251. X        localtime(time);
  2252. X    $date = sprintf("%.2d/%.2d/%.2d %.2d:%.2d:%.2d",
  2253. X        $year,++$mon,$mday,$hour,$min,$sec);
  2254. X    $log = $date . " $'prog_name[$'jobnum]: $msg\n";
  2255. X
  2256. X    # If we cannot append to the logfile, first check whether it is the default
  2257. X    # logfile or not. If it is not, then add a log entry to state the error in
  2258. X    # the default log and then delete that user logname entry, assuming the
  2259. X    # fault we get is of a permanent nature and not an NFS failure for instance.
  2260. X
  2261. X    unless (open(LOGFILE, ">>$file")) {
  2262. X        if ($file ne $cf'logfile) {
  2263. X            local($name) = $Map{$file};    # Name under which it was registered
  2264. X            &'add_log("ERROR cannot append to $name logfile $file: $!")
  2265. X                if $'loglvl > 1;
  2266. X            &'add_log("NOTICE removing logging to $file") if $'loglvl > 6;
  2267. X            &delete($Map{$file});
  2268. X            $cc = 1;                # Force logging to default file
  2269. X        } else {                    # We were already writing to default log
  2270. X            return;                    # Cannot log message at all
  2271. X        }
  2272. X    }
  2273. X
  2274. X    print LOGFILE $log;
  2275. X    close LOGFILE;
  2276. X
  2277. X    # If $cc is set, a copy of the same log message (same time stamp guaranteed)
  2278. X    # is made to the default logfile. If called with $file set to that default
  2279. X    # logfile, $cc will be undef by construction.
  2280. X
  2281. X    if ($cc) {
  2282. X        open(LOGFILE, ">>$cf'logfile");
  2283. X        print LOGFILE $log;
  2284. X        close LOGFILE;
  2285. X    }
  2286. X}
  2287. X
  2288. Xpackage main;
  2289. X
  2290. END_OF_FILE
  2291.   if test 5120 -ne `wc -c <'agent/pl/add_log.pl'`; then
  2292.     echo shar: \"'agent/pl/add_log.pl'\" unpacked with wrong size!
  2293.   fi
  2294.   # end of 'agent/pl/add_log.pl'
  2295. fi
  2296. echo shar: End of archive 7 \(of 26\).
  2297. cp /dev/null ark7isdone
  2298. MISSING=""
  2299. 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
  2300.     if test ! -f ark${I}isdone ; then
  2301.     MISSING="${MISSING} ${I}"
  2302.     fi
  2303. done
  2304. if test "${MISSING}" = "" ; then
  2305.     echo You have unpacked all 26 archives.
  2306.     echo "Now run 'sh PACKNOTES', then read README and type Configure.'"
  2307.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2308. else
  2309.     echo You still must unpack the following archives:
  2310.     echo "        " ${MISSING}
  2311. fi
  2312. exit 0
  2313.  
  2314. exit 0 # Just in case...
  2315.