home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / tools / developer-tools / andere sprachen / perl5 / perl5.002 / configure < prev    next >
Encoding:
Text File  |  1996-02-29  |  200.6 KB  |  9,484 lines

  1. #! /bin/sh
  2. #
  3. # If these # comments don't work, trim them. Don't worry about any other
  4. # shell scripts, Configure will trim # comments from them for you.
  5. #
  6. # (If you are trying to port this package to a machine without sh,
  7. # I would suggest you have a look at the prototypical config_h.SH file
  8. # and edit it to reflect your system. Some packages may include samples
  9. # of config.h for certain machines, so you might look for one of those.)
  10. #
  11. # Yes, you may rip this off to use in other distribution packages. This
  12. # script belongs to the public domain and cannot be copyrighted.
  13. #
  14. # (Note: this Configure script was generated automatically. Rather than
  15. # working with this copy of Configure, you may wish to get metaconfig.
  16. # The dist-3.0 package (which contains metaconfig) was posted in
  17. # comp.sources.misc so you may fetch it yourself from your nearest
  18. # archive site. Check with Archie if you don't know where that can be.)
  19. #
  20.  
  21. # $Id: Head.U,v 3.0.1.8 1995/07/25 13:40:02 ram Exp $
  22. #
  23. # Generated on Wed Feb 21 14:26:18 EST 1996 [metaconfig 3.0 PL60]
  24.  
  25. cat >/tmp/c1$$ <<EOF
  26. ARGGGHHHH!!!!!
  27.  
  28. SCO csh still thinks true is false.  Write to SCO today and tell them that next
  29. year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
  30.  
  31. (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
  32. we'd have to do is go in and swap the && and || tokens, wherever they are.)
  33.  
  34. [End of diatribe. We now return you to your regularly scheduled programming...]
  35. EOF
  36. cat >/tmp/c2$$ <<EOF
  37.  
  38. OOPS!  You naughty creature!  You didn't run Configure with sh!
  39. I will attempt to remedy the situation by running sh for you...
  40. EOF
  41.  
  42. true || cat /tmp/c1$$ /tmp/c2$$
  43. true || exec sh $0 $argv:q
  44.  
  45. (exit $?0) || cat /tmp/c2$$
  46. (exit $?0) || exec sh $0 $argv:q
  47. rm -f /tmp/c1$$ /tmp/c2$$
  48.  
  49. : compute my invocation name
  50. me=$0
  51. case "$0" in
  52. */*)
  53.     me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
  54.     test "$me" || me=$0
  55.     ;;
  56. esac
  57.  
  58. : Proper PATH separator
  59. p_=:
  60.  
  61. : Proper PATH setting
  62. paths='/usr/bin'
  63. #paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
  64. #paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
  65. #paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
  66. #paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
  67. #paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
  68. #paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
  69. #paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
  70. #paths="$paths /sbin /usr/sbin /usr/libexec"
  71.  
  72. for p in $paths
  73. do
  74.     case "$p_$PATH$p_" in
  75.     *$p_$p$p_*) ;;
  76.     *) test -d $p && PATH=$PATH$p_$p ;;
  77.     esac
  78. done
  79.  
  80. PATH=.$p_$PATH
  81. export PATH
  82.  
  83. : Sanity checks
  84. if test ! -t 0; then
  85.     echo "Say 'sh $me', not 'sh <$me'"
  86.     exit 1
  87. fi
  88.  
  89. : On HP-UX, large Configure scripts may exercise a bug in /bin/sh
  90. if test -f /hp-ux -a -f /bin/ksh; then
  91.     if (PATH=.; alias -x) >/dev/null 2>&1; then
  92.         : already under /bin/ksh
  93.     else
  94.         cat <<'EOM'
  95. (Feeding myself to ksh to avoid nasty sh bug in "here document" expansion.)
  96. EOM
  97.         unset ENV
  98.         exec /bin/ksh $0 "$@"
  99.     fi
  100. else
  101.     : Warn them if they use ksh on other systems
  102.     (PATH=.; alias -x) >/dev/null 2>&1 && \
  103.         cat <<EOM
  104. (I see you are using the Korn shell.  Some ksh's blow up on $me,
  105. especially on exotic machines.  If yours does, try the Bourne shell instead.)
  106. EOM
  107. fi
  108.  
  109. : Configure runs within the UU subdirectory
  110. test -d UU || mkdir UU
  111. cd UU && rm -f ./*
  112.  
  113. dynamic_ext=''
  114. extensions=''
  115. known_extensions=''
  116. static_ext=''
  117. useposix=''
  118. usesafe=''
  119. d_bsd=''
  120. d_eunice=''
  121. d_xenix=''
  122. eunicefix=''
  123. Mcc=''
  124. awk=''
  125. bash=''
  126. bison=''
  127. byacc=''
  128. cat=''
  129. chgrp=''
  130. chmod=''
  131. chown=''
  132. comm=''
  133. compress=''
  134. cp=''
  135. cpio=''
  136. cpp=''
  137. csh=''
  138. date=''
  139. echo=''
  140. egrep=''
  141. emacs=''
  142. expr=''
  143. find=''
  144. flex=''
  145. gcc=''
  146. grep=''
  147. inews=''
  148. ksh=''
  149. less=''
  150. line=''
  151. lint=''
  152. ln=''
  153. lp=''
  154. lpr=''
  155. ls=''
  156. mail=''
  157. mailx=''
  158. make=''
  159. mkdir=''
  160. more=''
  161. mv=''
  162. nroff=''
  163. perl=''
  164. pg=''
  165. pmake=''
  166. pr=''
  167. rm=''
  168. rmail=''
  169. sed=''
  170. sendmail=''
  171. sh=''
  172. shar=''
  173. sleep=''
  174. smail=''
  175. sort=''
  176. submit=''
  177. tail=''
  178. tar=''
  179. tbl=''
  180. test=''
  181. touch=''
  182. tr=''
  183. troff=''
  184. uname=''
  185. uniq=''
  186. uuname=''
  187. vi=''
  188. zcat=''
  189. full_sed=''
  190. libswanted=''
  191. hint=''
  192. myuname=''
  193. osname=''
  194. osvers=''
  195. Author=''
  196. Date=''
  197. Header=''
  198. Id=''
  199. Locker=''
  200. Log=''
  201. RCSfile=''
  202. Revision=''
  203. Source=''
  204. State=''
  205. ar=''
  206. archobjs=''
  207. exe_ext=''
  208. firstmakefile=''
  209. lib_ext=''
  210. obj_ext=''
  211. path_sep=''
  212. afs=''
  213. alignbytes=''
  214. archlib=''
  215. archlibexp=''
  216. d_archlib=''
  217. installarchlib=''
  218. archname=''
  219. myarchname=''
  220. baserev=''
  221. bin=''
  222. binexp=''
  223. installbin=''
  224. byteorder=''
  225. cc=''
  226. gccversion=''
  227. ccflags=''
  228. cppflags=''
  229. ldflags=''
  230. lkflags=''
  231. locincpth=''
  232. optimize=''
  233. cf_email=''
  234. cf_by=''
  235. cf_time=''
  236. contains=''
  237. cpp_stuff=''
  238. cpplast=''
  239. cppminus=''
  240. cpprun=''
  241. cppstdin=''
  242. d_access=''
  243. d_alarm=''
  244. d_attribut=''
  245. d_bcmp=''
  246. d_bcopy=''
  247. d_bzero=''
  248. d_casti32=''
  249. castflags=''
  250. d_castneg=''
  251. d_chown=''
  252. d_chroot=''
  253. d_chsize=''
  254. d_closedir=''
  255. d_void_closedir=''
  256. d_const=''
  257. cryptlib=''
  258. d_crypt=''
  259. d_csh=''
  260. full_csh=''
  261. d_cuserid=''
  262. d_dbl_dig=''
  263. d_difftime=''
  264. d_dlerror=''
  265. d_dlopen=''
  266. d_dlsymun=''
  267. d_dosuid=''
  268. d_suidsafe=''
  269. d_dup2=''
  270. d_fchmod=''
  271. d_fchown=''
  272. d_fcntl=''
  273. d_fd_macros=''
  274. d_fd_set=''
  275. d_fds_bits=''
  276. d_fgetpos=''
  277. d_flexfnam=''
  278. d_flock=''
  279. d_fork=''
  280. d_fsetpos=''
  281. d_Gconvert=''
  282. d_getgrps=''
  283. d_gethent=''
  284. aphostname=''
  285. d_gethname=''
  286. d_phostname=''
  287. d_uname=''
  288. d_getlogin=''
  289. d_getpgrp2=''
  290. d_getpgrp=''
  291. d_getppid=''
  292. d_getprior=''
  293. d_htonl=''
  294. d_isascii=''
  295. d_killpg=''
  296. d_link=''
  297. d_locconv=''
  298. d_lockf=''
  299. d_lstat=''
  300. d_mblen=''
  301. d_mbstowcs=''
  302. d_mbtowc=''
  303. d_memcmp=''
  304. d_memcpy=''
  305. d_memmove=''
  306. d_memset=''
  307. d_mkdir=''
  308. d_mkfifo=''
  309. d_mktime=''
  310. d_msg=''
  311. d_msgctl=''
  312. d_msgget=''
  313. d_msgrcv=''
  314. d_msgsnd=''
  315. d_nice=''
  316. d_open3=''
  317. d_fpathconf=''
  318. d_pathconf=''
  319. d_pause=''
  320. d_pipe=''
  321. d_poll=''
  322. d_portable=''
  323. d_readdir=''
  324. d_rewinddir=''
  325. d_seekdir=''
  326. d_telldir=''
  327. d_readlink=''
  328. d_rename=''
  329. d_rmdir=''
  330. d_safebcpy=''
  331. d_safemcpy=''
  332. d_select=''
  333. d_sem=''
  334. d_semctl=''
  335. d_semget=''
  336. d_semop=''
  337. d_setegid=''
  338. d_seteuid=''
  339. d_setlinebuf=''
  340. d_setlocale=''
  341. d_setpgid=''
  342. d_setpgrp2=''
  343. d_bsdpgrp=''
  344. d_setpgrp=''
  345. d_setprior=''
  346. d_setregid=''
  347. d_setresgid=''
  348. d_setresuid=''
  349. d_setreuid=''
  350. d_setrgid=''
  351. d_setruid=''
  352. d_setsid=''
  353. d_shm=''
  354. d_shmat=''
  355. d_shmatprototype=''
  356. shmattype=''
  357. d_shmctl=''
  358. d_shmdt=''
  359. d_shmget=''
  360. d_sigsetjmp=''
  361. d_sigaction=''
  362. d_sigintrp=''
  363. d_sigvec=''
  364. d_sigvectr=''
  365. d_oldsock=''
  366. d_socket=''
  367. d_sockpair=''
  368. sockethdr=''
  369. socketlib=''
  370. d_statblks=''
  371. d_stdio_cnt_lval=''
  372. d_stdio_ptr_lval=''
  373. d_stdiobase=''
  374. d_stdstdio=''
  375. stdio_base=''
  376. stdio_bufsiz=''
  377. stdio_cnt=''
  378. stdio_ptr=''
  379. d_index=''
  380. d_strchr=''
  381. d_strcoll=''
  382. d_strctcpy=''
  383. d_strerrm=''
  384. d_strerror=''
  385. d_sysernlst=''
  386. d_syserrlst=''
  387. d_strxfrm=''
  388. d_symlink=''
  389. d_syscall=''
  390. d_sysconf=''
  391. d_system=''
  392. d_tcgetpgrp=''
  393. d_tcsetpgrp=''
  394. d_time=''
  395. timetype=''
  396. clocktype=''
  397. d_times=''
  398. d_truncate=''
  399. d_tzname=''
  400. d_umask=''
  401. d_vfork=''
  402. usevfork=''
  403. d_voidsig=''
  404. signal_t=''
  405. d_volatile=''
  406. d_charvspr=''
  407. d_vprintf=''
  408. d_wait4=''
  409. d_waitpid=''
  410. d_wcstombs=''
  411. d_wctomb=''
  412. dlext=''
  413. cccdlflags=''
  414. ccdlflags=''
  415. d_shrplib=''
  416. dlsrc=''
  417. ld=''
  418. lddlflags=''
  419. shrpdir=''
  420. usedl=''
  421. fpostype=''
  422. gidtype=''
  423. groupstype=''
  424. h_fcntl=''
  425. h_sysfile=''
  426. db_hashtype=''
  427. db_prefixtype=''
  428. i_db=''
  429. i_dbm=''
  430. i_rpcsvcdbm=''
  431. d_dirnamlen=''
  432. direntrytype=''
  433. i_dirent=''
  434. i_dld=''
  435. i_dlfcn=''
  436. i_fcntl=''
  437. i_float=''
  438. i_gdbm=''
  439. i_grp=''
  440. i_limits=''
  441. i_locale=''
  442. i_malloc=''
  443. i_math=''
  444. i_memory=''
  445. i_ndbm=''
  446. i_neterrno=''
  447. i_niin=''
  448. i_sysin=''
  449. d_pwage=''
  450. d_pwchange=''
  451. d_pwclass=''
  452. d_pwcomment=''
  453. d_pwexpire=''
  454. d_pwquota=''
  455. i_pwd=''
  456. i_stddef=''
  457. i_stdlib=''
  458. i_string=''
  459. strings=''
  460. i_sysdir=''
  461. i_sysfile=''
  462. d_voidtty=''
  463. i_bsdioctl=''
  464. i_sysfilio=''
  465. i_sysioctl=''
  466. i_syssockio=''
  467. i_sysndir=''
  468. i_sysparam=''
  469. i_sysselct=''
  470. i_sysstat=''
  471. i_systimes=''
  472. i_systypes=''
  473. i_sysun=''
  474. i_sgtty=''
  475. i_termio=''
  476. i_termios=''
  477. i_systime=''
  478. i_systimek=''
  479. i_time=''
  480. timeincl=''
  481. i_unistd=''
  482. i_utime=''
  483. i_stdarg=''
  484. i_varargs=''
  485. i_varhdr=''
  486. i_vfork=''
  487. intsize=''
  488. libc=''
  489. glibpth=''
  490. libpth=''
  491. loclibpth=''
  492. plibpth=''
  493. xlibpth=''
  494. libs=''
  495. lns=''
  496. lseektype=''
  497. d_mymalloc=''
  498. freetype=''
  499. mallocobj=''
  500. mallocsrc=''
  501. malloctype=''
  502. usemymalloc=''
  503. installman1dir=''
  504. man1dir=''
  505. man1direxp=''
  506. man1ext=''
  507. installman3dir=''
  508. man3dir=''
  509. man3direxp=''
  510. man3ext=''
  511. huge=''
  512. large=''
  513. medium=''
  514. models=''
  515. small=''
  516. split=''
  517. modetype=''
  518. mydomain=''
  519. myhostname=''
  520. phostname=''
  521. c=''
  522. n=''
  523. d_eofnblk=''
  524. eagain=''
  525. o_nonblock=''
  526. rd_nodata=''
  527. groupcat=''
  528. hostcat=''
  529. passcat=''
  530. d_oldarchlib=''
  531. oldarchlib=''
  532. oldarchlibexp=''
  533. orderlib=''
  534. ranlib=''
  535. package=''
  536. spackage=''
  537. pager=''
  538. patchlevel=''
  539. perladmin=''
  540. perlpath=''
  541. prefix=''
  542. prefixexp=''
  543. installprivlib=''
  544. privlib=''
  545. privlibexp=''
  546. prototype=''
  547. randbits=''
  548. installscript=''
  549. scriptdir=''
  550. scriptdirexp=''
  551. selecttype=''
  552. sig_name=''
  553. sig_num=''
  554. installsitearch=''
  555. sitearch=''
  556. sitearchexp=''
  557. installsitelib=''
  558. sitelib=''
  559. sitelibexp=''
  560. sizetype=''
  561. so=''
  562. sharpbang=''
  563. shsharp=''
  564. spitshell=''
  565. ssizetype=''
  566. startperl=''
  567. startsh=''
  568. stdchar=''
  569. sysman=''
  570. uidtype=''
  571. nm_opt=''
  572. nm_so_opt=''
  573. runnm=''
  574. usenm=''
  575. incpath=''
  576. mips=''
  577. mips_type=''
  578. usrinc=''
  579. defvoidused=''
  580. voidflags=''
  581. CONFIG=''
  582.  
  583. define='define'
  584. undef='undef'
  585. smallmach='pdp11 i8086 z8000 i80286 iAPX286'
  586. rmlist=''
  587.  
  588. : We must find out about Eunice early
  589. eunicefix=':'
  590. if test -f /etc/unixtovms; then
  591.     eunicefix=/etc/unixtovms
  592. fi
  593. if test -f /etc/unixtovms.exe; then
  594.     eunicefix=/etc/unixtovms.exe
  595. fi
  596.  
  597. : list of known cpp symbols, sorted alphabetically
  598. al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
  599. al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
  600. al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
  601. al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
  602. al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
  603. al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
  604. al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
  605. al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
  606. al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
  607. al="$al VMS Xenix286"
  608. al="$al _AIX _AIX32 _AIX370 _AM29000 _COFF _CRAY _CX_UX _EPI"
  609. al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET"
  610. al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
  611. al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
  612. al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
  613. al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
  614. al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
  615. al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
  616. al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
  617. al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
  618. al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
  619. al="$al __SVR4_2__ __UMAXV__"
  620. al="$al ____386BSD____ __alpha __alpha__ __amiga"
  621. al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
  622. al="$al __host_mips__"
  623. al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
  624. al="$al __hp9000s500 __hp9000s700 __hp9000s800"
  625. al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
  626. al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
  627. al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
  628. al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
  629. al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
  630. al="$al __mc88100 __mc88100__ __mips __mips__"
  631. al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
  632. al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
  633. al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
  634. al="$al _host_mips _mips _unix"
  635. al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
  636. al="$al apollo ardent att386 att3b"
  637. al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
  638. al="$al cadmus clipper concurrent convex cray ctix"
  639. al="$al dmert encore gcos gcx gimpel gould"
  640. al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
  641. al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
  642. al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
  643. al="$al i186 i286 i386 i486 i8086"
  644. al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
  645. al="$al ksr1 linux luna luna88k m68k m88100 m88k"
  646. al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
  647. al="$al mc68040 mc68060 mc68k mc68k32 mc700"
  648. al="$al mc88000 mc88100 merlin mert mips mvs n16"
  649. al="$al ncl_el ncl_mr"
  650. al="$al news1500 news1700 news1800 news1900 news3700"
  651. al="$al news700 news800 news900 ns16000 ns32000"
  652. al="$al ns32016 ns32332 ns32k nsc32000 os osf"
  653. al="$al parisc pc532 pdp11 plexus posix pyr"
  654. al="$al riscix riscos scs sequent sgi sinix sony sony_news"
  655. al="$al sonyrisc sparc sparclite spectrum stardent stratos"
  656. al="$al sun sun3 sun386 svr4 sysV68 sysV88"
  657. al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
  658. al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
  659. al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
  660. al="$al xenix z8000"
  661.  
  662. groupstype=''
  663. i_whoami=''
  664. : default library list
  665. libswanted=''
  666. : set useposix=false in your hint file to disable the POSIX extension.
  667. useposix=true
  668. : set usesafe=false in your hint if you want to skip the Safe extension.
  669. usesafe=true
  670. : Define several unixisms.  These can be used in hint files.
  671. exe_ext='' 
  672. : Extra object files, if any, needed on this platform.
  673. archobjs=''
  674. : Possible local include directories to search.
  675. : Set locincpth to "" in a hint file to defeat local include searches.
  676. locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
  677. locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
  678. :
  679. : no include file wanted by default
  680. inclwanted=''
  681.  
  682. : change the next line if compiling for Xenix/286 on Xenix/386
  683. xlibpth='/usr/lib/386 /lib/386'
  684.  
  685. : Possible local library directories to search.
  686. loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
  687. loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
  688.  
  689. : general looking path for locating libraries
  690. glibpth="/lib/pa1.1 /usr/shlib /usr/lib/large /lib /usr/lib"
  691. glibpth="$glibpth $xlibpth /lib/large /usr/lib/small /lib/small"
  692. glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/shlib"
  693.  
  694. : Private path used by Configure to find libraries.  Its value
  695. : is prepended to libpth. This variable takes care of special
  696. : machines, like the mips.  Usually, it should be empty.
  697. plibpth=''
  698.  
  699. : full support for void wanted by default
  700. defvoidused=15
  701.  
  702. : List of libraries we want.
  703. libswanted='net socket inet nsl nm ndbm gdbm dbm db malloc dl'
  704. libswanted="$libswanted dld ld sun m c cposix posix ndir dir crypt"
  705. libswanted="$libswanted ucb bsd BSD PW x"
  706. : We probably want to search /usr/shlib before most other libraries.
  707. : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
  708. glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
  709. glibpth="/usr/shlib $glibpth"
  710. : Do not use vfork unless overridden by a hint file.
  711. usevfork=false
  712.  
  713. : script used to extract .SH files with variable substitutions
  714. cat >extract <<'EOS'
  715. CONFIG=true
  716. echo "Doing variable substitutions on .SH files..."
  717. if test -f MANIFEST; then
  718.     shlist=`awk '{print $1}' <MANIFEST | grep '\.SH'`
  719.     : Pick up possible extension manifests.
  720.     for dir in ext/* ; do
  721.         if test -f $dir/MANIFEST; then
  722.             xxx=`awk '{print $1}' < $dir/MANIFEST | 
  723.                 sed -n "/\.SH$/ s@^@$dir/@p"`
  724.             shlist="$shlist $xxx"
  725.         fi
  726.     done
  727.     set x $shlist
  728. else
  729.     echo "(Looking for .SH files under the current directory.)"
  730.     set x `find . -name "*.SH" -print`
  731. fi
  732. shift
  733. case $# in
  734. 0) set x *.SH; shift;;
  735. esac
  736. if test ! -f $1; then
  737.     shift
  738. fi
  739. for file in $*; do
  740.     case "$file" in
  741.     */*)
  742.         dir=`expr X$file : 'X\(.*\)/'`
  743.         file=`expr X$file : 'X.*/\(.*\)'`
  744.         (cd $dir && . ./$file)
  745.         ;;
  746.     *)
  747.         . ./$file
  748.         ;;
  749.     esac
  750. done
  751. if test -f config_h.SH; then
  752.     if test ! -f config.h; then
  753.     : oops, they left it out of MANIFEST, probably, so do it anyway.
  754.     . ./config_h.SH
  755.     fi
  756. fi
  757. EOS
  758.  
  759. : produce awk script to parse command line options
  760. cat >options.awk <<'EOF'
  761. BEGIN {
  762.     optstr = "dD:eEf:hKOrsSU:V";    # getopt-style specification
  763.  
  764.     len = length(optstr);
  765.     for (i = 1; i <= len; i++) {
  766.         c = substr(optstr, i, 1);
  767.         if (i < len) a = substr(optstr, i + 1, 1); else a = "";
  768.         if (a == ":") {
  769.             arg[c] = 1;
  770.             i++;
  771.         }
  772.         opt[c] = 1;
  773.     }
  774. }
  775. {
  776.     expect = 0;
  777.     str = $0;
  778.     if (substr(str, 1, 1) != "-") {
  779.         printf("'%s'\n", str);
  780.         next;
  781.     }
  782.     len = length($0);
  783.     for (i = 2; i <= len; i++) {
  784.         c = substr(str, i, 1);
  785.         if (!opt[c]) {
  786.             printf("-%s\n", substr(str, i));
  787.             next;
  788.         }
  789.         printf("-%s\n", c);
  790.         if (arg[c]) {
  791.             if (i < len)
  792.                 printf("'%s'\n", substr(str, i + 1));
  793.             else
  794.                 expect = 1;
  795.             next;
  796.         }
  797.     }
  798. }
  799. END {
  800.     if (expect)
  801.         print "?";
  802. }
  803. EOF
  804.  
  805. : process the command line options
  806. set X `for arg in "$@"; do echo "X$arg"; done |
  807.     sed -e s/X// | awk -f options.awk`
  808. eval "set $*"
  809. shift
  810. rm -f options.awk
  811.  
  812. : set up default values
  813. fastread=''
  814. reuseval=false
  815. config_sh=''
  816. alldone=''
  817. error=''
  818. silent=''
  819. extractsh=''
  820. override=''
  821. knowitall=''
  822. rm -f optdef.sh
  823.  
  824. : option parsing
  825. while test $# -gt 0; do
  826.     case "$1" in
  827.     -d) shift; fastread=yes;;
  828.     -e) shift; alldone=cont;;
  829.     -f)
  830.         shift
  831.         cd ..
  832.         if test -r "$1"; then
  833.             config_sh="$1"
  834.         else
  835.             echo "$me: cannot read config file $1." >&2
  836.             error=true
  837.         fi
  838.         cd UU
  839.         shift;;
  840.     -h) shift; error=true;;
  841.     -r) shift; reuseval=true;;
  842.     -s) shift; silent=true;;
  843.     -E) shift; alldone=exit;;
  844.     -K) shift; knowitall=true;;
  845.     -O) shift; override=true;;
  846.     -S) shift; extractsh=true;;
  847.     -D)
  848.         shift
  849.         case "$1" in
  850.         *=)
  851.             echo "$me: use '-U symbol=', not '-D symbol='." >&2
  852.             echo "$me: ignoring -D $1" >&2
  853.             ;;
  854.         *=*) echo "$1" | \
  855.                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
  856.         *) echo "$1='define'" >> optdef.sh;;
  857.         esac
  858.         shift
  859.         ;;
  860.     -U)
  861.         shift
  862.         case "$1" in
  863.         *=) echo "$1" >> optdef.sh;;
  864.         *=*)
  865.             echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
  866.             echo "$me: ignoring -U $1" >&2
  867.             ;;
  868.         *) echo "$1='undef'" >> optdef.sh;;
  869.         esac
  870.         shift
  871.         ;;
  872.     -V) echo "$me generated by metaconfig 3.0 PL60." >&2
  873.         exit 0;;
  874.     --) break;;
  875.     -*) echo "$me: unknown option $1" >&2; shift; error=true;;
  876.     *) break;;
  877.     esac
  878. done
  879.  
  880. case "$error" in
  881. true)
  882.     cat >&2 <<EOM
  883. Usage: $me [-dehrEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
  884.                  [-U symbol] [-U symbol=]
  885.   -d : use defaults for all answers.
  886.   -e : go on without questioning past the production of config.sh.
  887.   -f : specify an alternate default configuration file.
  888.   -h : print this help message and exit (with an error status).
  889.   -r : reuse C symbols value if possible (skips costly nm extraction).
  890.   -s : silent mode, only echoes questions and essential information.
  891.   -D : define symbol to have some value:
  892.          -D symbol         symbol gets the value 'define'
  893.          -D symbol=value   symbol gets the value 'value'
  894.   -E : stop at the end of questions, after having produced config.sh.
  895.   -K : do not use unless you know what you are doing.
  896.   -O : let -D and -U override definitions from loaded configuration file.
  897.   -S : perform variable substitutions on all .SH files (can mix with -f)
  898.   -U : undefine symbol:
  899.          -U symbol    symbol gets the value 'undef'
  900.          -U symbol=   symbol gets completely empty
  901.   -V : print version number and exit (with a zero status).
  902. EOM
  903.     exit 1
  904.     ;;
  905. esac
  906.  
  907. exec 4>&1
  908. case "$silent" in
  909. true) exec 1>/dev/null;;
  910. esac
  911.  
  912. : run the defines and the undefines, if any, but leave the file out there...
  913. touch optdef.sh
  914. . ./optdef.sh
  915.  
  916. case "$extractsh" in
  917. true)
  918.     case "$config_sh" in
  919.     '') config_sh='config.sh'; config='./config.sh';;
  920.     /*) config="$config_sh";;
  921.     *) config="./$config_sh";;
  922.     esac
  923.     echo " "
  924.     echo "Fetching answers from $config_sh..."
  925.     cd ..
  926.     . $config
  927.     test "$override" && . ./optdef.sh
  928.     echo " "
  929.     . ./UU/extract
  930.     rm -rf UU
  931.     echo "Done."
  932.     exit 0
  933.     ;;
  934. esac
  935.  
  936. : set package name
  937. package=perl5
  938. first=`echo $package | sed -e 's/^\(.\).*/\1/'`
  939. last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
  940. case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
  941. ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
  942. *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
  943. esac
  944.  
  945. : Eunice requires " " instead of "", can you believe it
  946. echo " "
  947. : Here we go...
  948. echo "Beginning of configuration questions for $package."
  949.  
  950. trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
  951.  
  952. : Some greps do not return status, grrr.
  953. echo "grimblepritz" >grimble
  954. if grep blurfldyick grimble >/dev/null 2>&1 ; then
  955.     contains=contains
  956. elif grep grimblepritz grimble >/dev/null 2>&1 ; then
  957.     contains=grep
  958. else
  959.     contains=contains
  960. fi
  961. rm -f grimble
  962. : the following should work in any shell
  963. case "$contains" in
  964. contains*)
  965.     echo " "
  966.     echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
  967.     cat >contains <<'EOSS'
  968. grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
  969. EOSS
  970. chmod +x contains
  971. esac
  972.  
  973. : first determine how to suppress newline on echo command
  974. echo " "
  975. echo "Checking echo to see how to suppress newlines..."
  976. (echo "hi there\c" ; echo " ") >.echotmp
  977. if $contains c .echotmp >/dev/null 2>&1 ; then
  978.     echo "...using -n."
  979.     n='-n'
  980.     c=''
  981. else
  982.     cat <<'EOM'
  983. ...using \c
  984. EOM
  985.     n=''
  986.     c='\c'
  987. fi
  988. echo $n "The star should be here-->$c"
  989. echo '*'
  990. rm -f .echotmp
  991.  
  992. : Now test for existence of everything in MANIFEST
  993. echo " "
  994. if test -f ../MANIFEST; then
  995.     echo "First let's make sure your kit is complete.  Checking..." >&4
  996.     awk '$1 !~ /PACK[A-Z]+/ {print $1}' ../MANIFEST | split -50
  997.     rm -f missing
  998.     for filelist in x??; do
  999.         (cd ..; ls `cat UU/$filelist` >/dev/null 2>>UU/missing)
  1000.     done
  1001.     if test -s missing; then
  1002.         cat missing >&4
  1003.         cat >&4 <<'EOM'
  1004.  
  1005. THIS PACKAGE SEEMS TO BE INCOMPLETE.
  1006.  
  1007. You have the option of continuing the configuration process, despite the
  1008. distinct possibility that your kit is damaged, by typing 'y'es.  If you
  1009. do, don't blame me if something goes wrong.  I advise you to type 'n'o
  1010. and contact the author (doughera@lafcol.lafayette.edu).
  1011.  
  1012. EOM
  1013.         echo $n "Continue? [n] $c" >&4
  1014.         read ans
  1015.         case "$ans" in
  1016.         y*)
  1017.             echo "Continuing..." >&4
  1018.             rm -f missing
  1019.             ;;
  1020.         *)
  1021.             echo "ABORTING..." >&4
  1022.             kill $$
  1023.             ;;
  1024.         esac
  1025.     else
  1026.         echo "Looks good..." >&4
  1027.     fi
  1028. else
  1029.     echo "There is no MANIFEST file.  I hope your kit is complete !"
  1030. fi
  1031. rm -f missing x??
  1032.  
  1033. : compute the number of columns on the terminal for proper question formatting
  1034. case "$COLUMNS" in
  1035. '') COLUMNS='80';;
  1036. esac
  1037.  
  1038. : set up the echo used in my read
  1039. myecho="case \"\$xxxm\" in
  1040. '') echo $n \"\$rp $c\" >&4;;
  1041. *) case \"\$rp\" in
  1042.     '') echo $n \"[\$xxxm] $c\";;
  1043.     *)
  1044.         if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
  1045.             echo \"\$rp\" >&4
  1046.             echo $n \"[\$xxxm] $c\" >&4
  1047.         else
  1048.             echo $n \"\$rp [\$xxxm] $c\" >&4
  1049.         fi
  1050.         ;;
  1051.     esac;;
  1052. esac"
  1053.  
  1054. : now set up to do reads with possible shell escape and default assignment
  1055. cat <<EOSC >myread
  1056. xxxm=\$dflt
  1057. $myecho
  1058. ans='!'
  1059. case "\$fastread" in
  1060. yes) case "\$dflt" in
  1061.     '') ;;
  1062.     *) ans='';
  1063.         case "\$silent-\$rp" in
  1064.         true-) ;;
  1065.         *) echo " " >&4;;
  1066.         esac;;
  1067.     esac;;
  1068. *) case "\$silent" in
  1069.     true) case "\$rp" in
  1070.         '') ans='';;
  1071.         esac;;
  1072.     esac;;
  1073. esac
  1074. while expr "X\$ans" : "X!" >/dev/null; do
  1075.     read answ
  1076.     set x \$xxxm
  1077.     shift
  1078.     aok=''; eval "ans=\"\$answ\"" && aok=y
  1079.     case  "\$answ" in
  1080.     "\$ans")
  1081.         case "\$ans" in
  1082.         \\&*)
  1083.             set x \`expr "X\$ans" : "X&\(.*\)\$"\`
  1084.             shift
  1085.             case "\$1" in
  1086.             -d)
  1087.                 fastread=yes
  1088.                 echo "(OK, I'll run with -d after this question.)" >&4
  1089.                 ;;
  1090.             -*)
  1091.                 echo "*** Sorry, \$1 not supported yet." >&4
  1092.                 ;;
  1093.             esac
  1094.             $myecho
  1095.             ans=!
  1096.             ;;
  1097.         "!")
  1098.             sh 1>&4
  1099.             echo " "
  1100.             $myecho
  1101.             ;;
  1102.         !*)
  1103.             set x \`expr "X\$ans" : "X!\(.*\)\$"\`
  1104.             shift
  1105.             sh 1>&4 -c "\$*"
  1106.             echo " "
  1107.             $myecho
  1108.             ;;
  1109.         esac;;
  1110.     *)
  1111.         case "\$aok" in
  1112.         y)
  1113.             echo "*** Substitution done -- please confirm."
  1114.             xxxm="\$ans"
  1115.             ans=\`echo $n "\$ans$c" | tr '\012' ' '\`
  1116.             xxxm="\$ans"
  1117.             ans=!
  1118.             ;;
  1119.         *)
  1120.             echo "*** Error -- try again."
  1121.             ans=!
  1122.             ;;
  1123.         esac
  1124.         $myecho
  1125.         ;;
  1126.     esac
  1127.     case "\$ans\$xxxm\$nostick" in
  1128.     '')
  1129.         ans=!
  1130.         $myecho
  1131.         ;;
  1132.     esac
  1133. done
  1134. case "\$ans" in
  1135. '') ans="\$xxxm";;
  1136. esac
  1137. EOSC
  1138.  
  1139. : create .config dir to save info across Configure sessions
  1140. test -d ../.config || mkdir ../.config
  1141. cat >../.config/README <<EOF
  1142. This directory created by Configure to save information that should
  1143. persist across sessions.
  1144.  
  1145. You may safely delete it if you wish.
  1146. EOF
  1147.  
  1148. : general instructions
  1149. needman=true
  1150. firsttime=true
  1151. user=`( (logname) 2>/dev/null || whoami) 2>&1`
  1152. if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
  1153.     firsttime=false
  1154.     echo " "
  1155.     rp='Would you like to see the instructions?'
  1156.     dflt=n
  1157.     . ./myread
  1158.     case "$ans" in
  1159.     [yY]*) ;;
  1160.     *) needman=false;;
  1161.     esac
  1162. fi
  1163. if $needman; then
  1164.     cat <<EOH
  1165.  
  1166. This installation shell script will examine your system and ask you questions
  1167. to determine how the perl5 package should be installed. If you get
  1168. stuck on a question, you may use a ! shell escape to start a subshell or
  1169. execute a command.  Many of the questions will have default answers in square
  1170. brackets; typing carriage return will give you the default.
  1171.  
  1172. On some of the questions which ask for file or directory names you are allowed
  1173. to use the ~name construct to specify the login directory belonging to "name",
  1174. even if you don't have a shell which knows about that.  Questions where this is
  1175. allowed will be marked "(~name ok)".
  1176.  
  1177. EOH
  1178.     rp=''
  1179.     dflt='Type carriage return to continue'
  1180.     . ./myread
  1181.     cat <<'EOH'
  1182.  
  1183. The prompter used in this script allows you to use shell variables and
  1184. backticks in your answers.  You may use $1, $2, etc...  to refer to the words
  1185. in the default answer, as if the default line was a set of arguments given to a
  1186. script shell.  This means you may also use $* to repeat the whole default line,
  1187. so you do not have to re-type everything to add something to the default.
  1188.  
  1189. Everytime there is a substitution, you will have to confirm.  If there is an
  1190. error (e.g. an unmatched backtick), the default answer will remain unchanged
  1191. and you will be prompted again.
  1192.  
  1193. If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
  1194. the questions and use the computed defaults (or the previous answers if there
  1195. was already a config.sh file). Type 'Configure -h' for a list of options.
  1196. You may also start interactively and then answer '& -d' at any prompt to turn
  1197. on the non-interactive behaviour for the remaining of the execution.
  1198.  
  1199. EOH
  1200.     . ./myread
  1201.     cat <<EOH
  1202.  
  1203. Much effort has been expended to ensure that this shell script will run on any
  1204. Unix system.  If despite that it blows up on yours, your best bet is to edit
  1205. Configure and run it again.  If you can't run Configure for some reason,
  1206. you'll have to generate a config.sh file by hand.  Whatever problems you
  1207. have, let me (doughera@lafcol.lafayette.edu) know how I blew it.
  1208.  
  1209. This installation script affects things in two ways:
  1210.  
  1211. 1) it may do direct variable substitutions on some of the files included
  1212.    in this kit.
  1213. 2) it builds a config.h file for inclusion in C programs.  You may edit
  1214.    any of these files as the need arises after running this script.
  1215.  
  1216. If you make a mistake on a question, there is no easy way to back up to it
  1217. currently.  The easiest thing to do is to edit config.sh and rerun all the SH
  1218. files.  Configure will offer to let you do this before it runs the SH files.
  1219.  
  1220. EOH
  1221.     dflt='Type carriage return to continue'
  1222.     . ./myread
  1223.     case "$firsttime" in
  1224.     true) echo $user >>../.config/instruct;;
  1225.     esac
  1226. fi
  1227.  
  1228. : see if sh knows # comments
  1229. echo " "
  1230. echo "Checking your sh to see if it knows about # comments..." >&4
  1231. if `sh -c '#' >/dev/null 2>&1`; then
  1232.     echo "Your sh handles # comments correctly."
  1233.     shsharp=true
  1234.     spitshell=cat
  1235.     echo " "
  1236.     echo "Okay, let's see if #! works on this system..."
  1237.     xcat=/bin/cat
  1238.     test -f $xcat || xcat=/usr/bin/cat
  1239.     echo "#!$xcat" >try
  1240.     $eunicefix try
  1241.     chmod +x try
  1242.     ./try > today
  1243.     if test -s today; then
  1244.         echo "It does."
  1245.         sharpbang='#!'
  1246.     else
  1247.         echo "#! $xcat" > try
  1248.         $eunicefix try
  1249.         chmod +x try
  1250.         ./try > today
  1251.         if test -s today; then
  1252.             echo "It does."
  1253.             sharpbang='#! '
  1254.         else
  1255.             echo "It's just a comment."
  1256.             sharpbang=': use '
  1257.         fi
  1258.     fi
  1259. else
  1260.     echo "Your sh doesn't grok # comments--I will strip them later on."
  1261.     shsharp=false
  1262.     cd ..
  1263.     echo "exec grep -v '^[     ]*#'" >spitshell
  1264.     chmod +x spitshell
  1265.     $eunicefix spitshell
  1266.     spitshell=`pwd`/spitshell
  1267.     cd UU
  1268.     echo "I presume that if # doesn't work, #! won't work either!"
  1269.     sharpbang=': use '
  1270. fi
  1271. rm -f try today
  1272.  
  1273. : figure out how to guarantee sh startup
  1274. echo " "
  1275. echo "Checking out how to guarantee sh startup..." >&4
  1276. case "$SYSTYPE" in
  1277. *bsd*|sys5*) startsh=$sharpbang"/$SYSTYPE/bin/sh";;
  1278. *) startsh=$sharpbang'/bin/sh';;
  1279. esac
  1280. echo "Let's see if '$startsh' works..."
  1281. cat >try <<EOSS
  1282. $startsh
  1283. set abc
  1284. test "$?abc" != 1
  1285. EOSS
  1286.  
  1287. chmod +x try
  1288. $eunicefix try
  1289. if ./try; then
  1290.     echo "Yup, it does."
  1291. else
  1292. echo "Nope.  You may have to fix up the shell scripts to make sure sh runs them."
  1293. fi
  1294. rm -f try
  1295.  
  1296. : find out where common programs are
  1297. echo " "
  1298. echo "Locating common programs..." >&4
  1299. cat <<EOSC >loc
  1300. $startsh
  1301. case \$# in
  1302. 0) exit 1;;
  1303. esac
  1304. thing=\$1
  1305. shift
  1306. dflt=\$1
  1307. shift
  1308. for dir in \$*; do
  1309.     case "\$thing" in
  1310.     .)
  1311.     if test -d \$dir/\$thing; then
  1312.         echo \$dir
  1313.         exit 0
  1314.     fi
  1315.     ;;
  1316.     *)
  1317.     for thisthing in \$dir/\$thing; do
  1318.         : just loop through to pick last item
  1319.     done
  1320.     if test -f \$thisthing; then
  1321.         echo \$thisthing
  1322.         exit 0
  1323.     elif test -f \$dir/\$thing.exe; then
  1324.         : on Eunice apparently
  1325.         echo \$dir/\$thing
  1326.         exit 0
  1327.     fi
  1328.     ;;
  1329.     esac
  1330. done
  1331. echo \$dflt
  1332. exit 1
  1333. EOSC
  1334. chmod +x loc
  1335. $eunicefix loc
  1336. loclist="
  1337. awk
  1338. cat
  1339. comm
  1340. cp
  1341. echo
  1342. expr
  1343. find
  1344. grep
  1345. ln
  1346. ls
  1347. mkdir
  1348. rm
  1349. sed
  1350. sort
  1351. touch
  1352. tr
  1353. uniq
  1354. "
  1355. trylist="
  1356. Mcc
  1357. byacc
  1358. cpp
  1359. csh
  1360. date
  1361. egrep
  1362. less
  1363. line
  1364. more
  1365. nroff
  1366. perl
  1367. pg
  1368. sendmail
  1369. test
  1370. uname
  1371. "
  1372. pth=`echo $PATH | sed -e "s/$p_/ /g"`
  1373. pth="$pth /lib /usr/lib"
  1374. for file in $loclist; do
  1375.     xxx=`./loc $file $file $pth`
  1376.     eval $file=$xxx
  1377.     eval _$file=$xxx
  1378.     case "$xxx" in
  1379.     /*)
  1380.         echo $file is in $xxx.
  1381.         ;;
  1382.     ?:[\\/]*)
  1383.         echo $file is in $xxx.
  1384.         ;;
  1385.     *)
  1386.         echo "I don't know where '$file' is, and my life depends on it." >&4
  1387.         echo "Go find a public domain implementation or fix your PATH setting!" >&4
  1388.         exit 1
  1389.         ;;
  1390.     esac
  1391. done
  1392. echo " "
  1393. echo "Don't worry if any of the following aren't found..."
  1394. say=offhand
  1395. for file in $trylist; do
  1396.     xxx=`./loc $file $file $pth`
  1397.     eval $file=$xxx
  1398.     eval _$file=$xxx
  1399.     case "$xxx" in
  1400.     /*)
  1401.         echo $file is in $xxx.
  1402.         ;;
  1403.     ?:[\\/]*)
  1404.         echo $file is in $xxx.
  1405.         ;;
  1406.     *)
  1407.         echo "I don't see $file out there, $say."
  1408.         say=either
  1409.         ;;
  1410.     esac
  1411. done
  1412. case "$egrep" in
  1413. egrep)
  1414.     echo "Substituting grep for egrep."
  1415.     egrep=$grep
  1416.     ;;
  1417. esac
  1418. case "$test" in
  1419. test)
  1420.     echo "Hopefully test is built into your sh."
  1421.     ;;
  1422. *)
  1423.     if `sh -c "PATH= test true" >/dev/null 2>&1`; then
  1424.         echo "Using the test built into your sh."
  1425.         test=test
  1426.         _test=test
  1427.     fi
  1428.     ;;
  1429. esac
  1430. case "$echo" in
  1431. echo)
  1432.     echo "Hopefully echo is built into your sh."
  1433.     ;;
  1434. '') ;;
  1435. *)
  1436.     echo " "
  1437. echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
  1438.     $echo $n "hi there$c" >foo1
  1439.     echo $n "hi there$c" >foo2
  1440.     if cmp foo1 foo2 >/dev/null 2>&1; then
  1441.         echo "They are compatible.  In fact, they may be identical."
  1442.     else
  1443.         case "$n" in
  1444.         '-n') n='' c='\c';;
  1445.         *) n='-n' c='';;
  1446.         esac
  1447.         cat <<FOO
  1448. They are not compatible!  You are probably running ksh on a non-USG system.
  1449. I'll have to use $echo instead of the builtin, since Bourne shell doesn't
  1450. have echo built in and we may have to run some Bourne shell scripts.  That
  1451. means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
  1452.  
  1453. FOO
  1454.         $echo $n "The star should be here-->$c"
  1455.         $echo "*"
  1456.     fi
  1457.     $rm -f foo1 foo2
  1458.     ;;
  1459. esac
  1460.  
  1461. : determine whether symbolic links are supported
  1462. echo " "
  1463. $touch blurfl
  1464. if $ln -s blurfl sym > /dev/null 2>&1 ; then
  1465.     echo "Symbolic links are supported." >&4
  1466.     lns="$ln -s"
  1467. else
  1468.     echo "Symbolic links are NOT supported." >&4
  1469.     lns="$ln"
  1470. fi
  1471. $rm -f blurfl sym
  1472.  
  1473. : see whether [:lower:] and [:upper:] are supported character classes
  1474. echo " "
  1475. up='[A-Z]'
  1476. low='[a-z]'
  1477. case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
  1478. ABYZ)
  1479.     echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
  1480.     up='[:upper:]'
  1481.     low='[:lower:]'
  1482.     ;;
  1483. *)
  1484.     echo "Your tr only supports [a-z] and [A-Z] to convert case." >&4
  1485.     ;;
  1486. esac
  1487. : set up the translation script tr, must be called with ./tr of course
  1488. cat >tr <<EOSC
  1489. $startsh
  1490. case "\$1\$2" in
  1491. '[A-Z][a-z]') exec $tr '$up' '$low';;
  1492. '[a-z][A-Z]') exec $tr '$low' '$up';;
  1493. esac
  1494. exec $tr "\$@"
  1495. EOSC
  1496. chmod +x tr
  1497. $eunicefix tr
  1498.  
  1499. : Try to determine whether config.sh was made on this system
  1500. case "$config_sh" in
  1501. '')
  1502. myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
  1503. myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
  1504.     ./tr '[A-Z]' '[a-z]' | tr '\012' ' '`
  1505. newmyuname="$myuname"
  1506. dflt=n
  1507. case "$knowitall" in
  1508. '')
  1509.     if test -f ../config.sh; then
  1510.         if $contains myuname= ../config.sh >/dev/null 2>&1; then
  1511.             eval "`grep myuname= ../config.sh`"
  1512.         fi
  1513.         if test "X$myuname" = "X$newmyuname"; then
  1514.             dflt=y
  1515.         fi
  1516.     fi
  1517.     ;;
  1518. *) dflt=y;;
  1519. esac
  1520.  
  1521. : Get old answers from old config file if Configure was run on the
  1522. : same system, otherwise use the hints.
  1523. hint=default
  1524. cd ..
  1525. if test -f config.sh; then
  1526.     echo " "
  1527.     rp="I see a config.sh file.  Shall I use it to set the defaults?"
  1528.     . UU/myread
  1529.     case "$ans" in
  1530.     n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
  1531.     *)  echo "Fetching default answers from your old config.sh file..." >&4
  1532.         tmp_n="$n"
  1533.         tmp_c="$c"
  1534.         . ./config.sh
  1535.         cp config.sh UU
  1536.         n="$tmp_n"
  1537.         c="$tmp_c"
  1538.         hint=previous
  1539.         ;;
  1540.     esac
  1541. fi
  1542. if test ! -f config.sh; then
  1543.     $cat <<EOM
  1544.  
  1545. First time through, eh?  I have some defaults handy for the following systems:
  1546.  
  1547. EOM
  1548.     cd hints; ls -C *.sh | $sed 's/\.sh/   /g' >&4
  1549.     dflt=''
  1550.     : Half the following guesses are probably wrong... If you have better
  1551.     : tests or hints, please send them to doughera@lafcol.lafayette.edu
  1552.     : The metaconfig authors would also appreciate a copy...
  1553.     $test -f /irix && osname=irix
  1554.     $test -f /xenix && osname=sco_xenix
  1555.     $test -f /dynix && osname=dynix
  1556.     $test -f /dnix && osname=dnix
  1557.      $test -f /unicos && osname=unicos && osvers=`$uname -r`
  1558.     $test -f /bin/mips && /bin/mips && osname=mips
  1559.     $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
  1560.         $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
  1561.     $test -d /usr/apollo/bin && osname=apollo
  1562.     $test -f /etc/saf/_sactab && osname=svr4
  1563.     $test -d /usr/include/minix && osname=minix
  1564.     if $test -d /MachTen; then
  1565.         osname=machten 
  1566.         if $test -x /sbin/version; then
  1567.             osvers=`/sbin/version | $awk '{print $2}' | 
  1568.             $sed -e 's/[A-Za-z]$//'`
  1569.         elif $test -x /usr/etc/version; then
  1570.             osvers=`/usr/etc/version | $awk '{print $2}' | 
  1571.             $sed -e 's/[A-Za-z]$//'`
  1572.         else
  1573.             osvers="$2.$3"
  1574.         fi
  1575.     fi
  1576.     if $test -f $uname; then
  1577.         set X $myuname
  1578.         shift
  1579.  
  1580.         case "$5" in
  1581.         fps*) osname=fps ;;
  1582.         mips*)
  1583.             case "$4" in
  1584.             umips) osname=umips ;;
  1585.             *) osname=mips ;;
  1586.             esac;;
  1587.         [23]100) osname=mips ;;
  1588.         next*) osname=next ;;
  1589.         news*) osname=news ;;
  1590.         i386*)
  1591.             if $test -f /etc/kconfig; then
  1592.                 osname=isc
  1593.                 if test "$lns" = "ln -s"; then
  1594.                     osvers=4
  1595.                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
  1596.                     osvers=3
  1597.                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
  1598.                     osvers=2
  1599.                 fi
  1600.             fi
  1601.             ;;
  1602.         esac
  1603.  
  1604.         case "$1" in
  1605.         aix) osname=aix
  1606.             tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
  1607.             case "$tmp" in
  1608.             'not found') osvers="$4"."$3" ;;
  1609.             '<3240'|'<>3240') osvers=3.2.0 ;;
  1610.             '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
  1611.             '=3250'|'>3250') osvers=3.2.5 ;;
  1612.             *) osvers=$tmp;;
  1613.             esac
  1614.             ;;
  1615.         dnix) osname=dnix
  1616.             osvers="$3"
  1617.             ;;
  1618.         domainos) osname=apollo
  1619.             osvers="$3"
  1620.             ;;
  1621.         dgux) osname=dgux 
  1622.             osvers="$3"
  1623.             ;;
  1624.         freebsd) osname=freebsd 
  1625.             osvers="$3" ;;
  1626.         genix) osname=genix ;;
  1627.         hp*) osname=hpux 
  1628.             case "$3" in
  1629.             *.08.*) osvers=9 ;;
  1630.             *.09.*) osvers=9 ;;
  1631.             *.10.*) osvers=10 ;;
  1632.             *)    osvers="$3" ;;
  1633.             esac
  1634.             ;;
  1635.         irix) osname=irix
  1636.             case "$3" in
  1637.             4*) osvers=4 ;;
  1638.             5*) osvers=5 ;;
  1639.             *)    osvers="$3" ;;
  1640.             esac
  1641.             ;;
  1642.         linux) osname=linux
  1643.             case "$3" in
  1644.             1*) osvers=1 ;;
  1645.             *)    osvers="$3" ;;
  1646.             esac
  1647.             ;;
  1648.         netbsd*) osname=netbsd 
  1649.             osvers="$3"
  1650.             ;;
  1651.         bsd386) osname=bsd386
  1652.             osvers=`$uname -r`
  1653.             ;;
  1654.         next*) osname=next ;;
  1655.         solaris) osname=solaris
  1656.             case "$3" in
  1657.             5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
  1658.             *)    osvers="$3" ;;
  1659.             esac
  1660.             ;;
  1661.         sunos) osname=sunos
  1662.             case "$3" in
  1663.             5*) osname=solaris
  1664.                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
  1665.             *)    osvers="$3" ;;
  1666.             esac
  1667.             ;;
  1668.         titanos) osname=titanos
  1669.             case "$3" in
  1670.             1*) osvers=1 ;;
  1671.             2*) osvers=2 ;;
  1672.             3*) osvers=3 ;;
  1673.             4*) osvers=4 ;;
  1674.             *)    osvers="$3" ;;
  1675.             esac
  1676.             ;;
  1677.         ultrix) osname=ultrix
  1678.             osvers="$3"
  1679.             ;;
  1680.         osf1)    case "$5" in
  1681.                 alpha)
  1682.                     osname=dec_osf
  1683.                     osvers=`echo "$3" | sed 's/^[vt]//'`
  1684.                     ;;
  1685.             hp*)    osname=hp_osf1    ;;
  1686.             mips)    osname=mips_osf1 ;;
  1687.             esac
  1688.             ;;
  1689.         uts) osname=uts 
  1690.             osvers="$3"
  1691.             ;;
  1692.         $2) case "$osname" in
  1693.             *isc*) ;;
  1694.             *freebsd*) ;;
  1695.              svr*)
  1696.                 : svr4.x or possibly later
  1697.                 case "svr$3" in    
  1698.                 ${osname}*)
  1699.                     osname=svr$3
  1700.                     osvers=$4
  1701.                     ;;
  1702.                 esac
  1703.                 case "$osname" in
  1704.                 svr4.0)
  1705.                     : Check for ESIX
  1706.                     if test -f /stand/boot ; then
  1707.                         eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
  1708.                         if test -n "$INITPROG" -a -f "$INITPROG"; then
  1709.             isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
  1710.                             if test -n "$isesix"; then
  1711.                                 osname=esix4
  1712.                             fi
  1713.                         fi
  1714.                     fi
  1715.                     ;;
  1716.                 esac
  1717.                 ;;
  1718.             *)    if test -f /etc/systemid; then
  1719.                     osname=sco
  1720.                     set `echo $3 | $sed 's/\./ /g'` $4
  1721.                     if $test -f sco_$1_$2_$3.sh; then
  1722.                         osvers=$1.$2.$3
  1723.                     elif $test -f sco_$1_$2.sh; then
  1724.                         osvers=$1.$2
  1725.                     elif $test -f sco_$1.sh; then
  1726.                         osvers=$1
  1727.                     fi
  1728.                 else
  1729.                     case "$osname" in
  1730.                     '') : Still unknown.  Probably a generic Sys V.
  1731.                         osname="sysv"
  1732.                         osvers="$3"
  1733.                         ;;
  1734.                     esac
  1735.                 fi
  1736.                 ;;
  1737.             esac
  1738.             ;;
  1739.         *)    case "$osname" in
  1740.             '') : Still unknown.  Probably a generic BSD.
  1741.                 osname="$1"
  1742.                 osvers="$3"
  1743.                 ;;
  1744.             esac
  1745.             ;;
  1746.         esac
  1747.     else
  1748.         if test -f /vmunix -a -f news_os.sh; then
  1749.             (what /vmunix | ../UU/tr '[A-Z]' '[a-z]') > ../UU/kernel.what 2>&1
  1750.             if $contains news-os ../UU/kernel.what >/dev/null 2>&1; then
  1751.                 osname=news_os
  1752.             fi
  1753.             $rm -f ../UU/kernel.what
  1754.         elif test -d c:/.; then
  1755.             set X $myuname
  1756.             osname=os2
  1757.             osvers="$5"
  1758.         fi
  1759.     fi
  1760.     
  1761.     : Now look for a hint file osname_osvers, unless one has been
  1762.     : specified already.
  1763.     case "$hintfile" in
  1764.     ''|' ')
  1765.         file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
  1766.         : Also try without trailing minor version numbers.
  1767.         xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
  1768.         xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
  1769.         xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
  1770.         xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
  1771.         case "$file" in
  1772.         '') dflt=none ;;
  1773.         *)  case "$osvers" in
  1774.             '') dflt=$file
  1775.                 ;;
  1776.             *)  if $test -f $file.sh ; then
  1777.                     dflt=$file
  1778.                 elif $test -f $xfile.sh ; then
  1779.                     dflt=$xfile
  1780.                 elif $test -f $xxfile.sh ; then
  1781.                     dflt=$xxfile
  1782.                 elif $test -f $xxxfile.sh ; then
  1783.                     dflt=$xxxfile
  1784.                 elif $test -f $xxxxfile.sh ; then
  1785.                     dflt=$xxxxfile
  1786.                 elif $test -f "${osname}.sh" ; then
  1787.                     dflt="${osname}"
  1788.                 else
  1789.                     dflt=none
  1790.                 fi
  1791.                 ;;
  1792.             esac
  1793.             ;;
  1794.         esac
  1795.         ;;
  1796.     *)
  1797.         dflt=`echo $hintfile | $sed 's/\.sh$//'`
  1798.         ;;
  1799.     esac
  1800.  
  1801.     $cat <<EOM
  1802.  
  1803. You may give one or more space-separated answers, or "none" if appropriate.
  1804. If your OS version has no hints, DO NOT give a wrong version -- say "none".
  1805.  
  1806. EOM
  1807.     rp="Which of these apply, if any?"
  1808.     . ../UU/myread
  1809.     tans=$ans
  1810.     for file in $tans; do
  1811.         if $test -f $file.sh; then
  1812.             . ./$file.sh
  1813.             $cat $file.sh >> ../UU/config.sh
  1814.         elif $test X$tans = X -o X$tans = Xnone ; then
  1815.             : nothing
  1816.         else
  1817.             : Give one chance to correct a possible typo.
  1818.             echo "$file.sh does not exist"
  1819.             dflt=$file
  1820.             rp="hint to use instead?"
  1821.             . ../UU/myread
  1822.             for file in $ans; do
  1823.                 if $test -f "$file.sh"; then
  1824.                     . ./$file.sh
  1825.                     $cat $file.sh >> ../UU/config.sh
  1826.                 elif $test X$ans = X -o X$ans = Xnone ; then
  1827.                     : nothing
  1828.                 else
  1829.                     echo "$file.sh does not exist -- ignored."
  1830.                 fi
  1831.             done
  1832.         fi
  1833.     done
  1834.  
  1835.     hint=recommended
  1836.     : Remember our hint file for later.
  1837.     if $test -f "$file.sh" ; then
  1838.         hintfile="$file"
  1839.     else
  1840.         hintfile=''
  1841.     fi
  1842.  
  1843.     cd ..
  1844. fi
  1845. cd UU
  1846. ;;
  1847. *)
  1848.     echo " "
  1849.     echo "Fetching default answers from $config_sh..." >&4
  1850.     tmp_n="$n"
  1851.     tmp_c="$c"
  1852.     cd ..
  1853.     cp $config_sh config.sh 2>/dev/null
  1854.     . ./config.sh
  1855.     cd UU
  1856.     cp ../config.sh .
  1857.     n="$tmp_n"
  1858.     c="$tmp_c"
  1859.     hint=previous
  1860.     ;;
  1861. esac
  1862. test "$override" && . ./optdef.sh
  1863. myuname="$newmyuname"
  1864.  
  1865. : Restore computed paths
  1866. for file in $loclist $trylist; do
  1867.     eval $file="\$_$file"
  1868. done
  1869.  
  1870. cat << EOM
  1871.  
  1872. Configure uses the operating system name and version to set some defaults.
  1873. The default value is probably right if the name rings a bell. Otherwise,
  1874. since spelling matters for me, either accept the default or answer "none"
  1875. to leave it blank.
  1876.  
  1877. EOM
  1878. case "$osname" in
  1879.     ''|' ')
  1880.         case "$hintfile" in
  1881.         ''|' '|none) dflt=none ;;
  1882.         *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
  1883.         esac
  1884.         ;;
  1885.     *) dflt="$osname" ;;
  1886. esac
  1887. rp="Operating system name?"
  1888. . ./myread
  1889. case "$ans" in
  1890. none)  osname='' ;;
  1891. *) osname=`echo "$ans" | $sed -e 's/[     ][    ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
  1892. esac
  1893. : who configured the system
  1894. cf_time=`$date 2>&1`
  1895. (logname > .temp) >/dev/null 2>&1
  1896. $test -s .temp || (whoami > .temp) >/dev/null 2>&1
  1897. $test -s .temp || echo unknown > .temp
  1898. cf_by=`$cat .temp`
  1899. $rm -f .temp
  1900.  
  1901. : determine the architecture name
  1902. echo " "
  1903. if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
  1904.     tarch=`arch`"-$osname"
  1905. elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
  1906.     if uname -m > tmparch 2>&1 ; then
  1907.         tarch=`$sed -e 's/ /_/g' -e 's/$/'"-$osname/" tmparch`
  1908.     else
  1909.         tarch="$osname"
  1910.     fi
  1911.     $rm -f tmparch
  1912. else
  1913.     tarch="$osname"
  1914. fi
  1915. case "$myarchname" in
  1916. ''|"$tarch") ;;
  1917. *)
  1918.     echo "(Your architecture name used to be $myarchname.)"
  1919.     archname=''
  1920.     ;;
  1921. esac
  1922. case "$archname" in
  1923. '') dflt="$tarch";;
  1924. *) dflt="$archname";;
  1925. esac
  1926. rp='What is your architecture name'
  1927. . ./myread
  1928. archname="$ans"
  1929. myarchname="$tarch"
  1930.  
  1931. : is AFS running?
  1932. echo " "
  1933. if test -d /afs; then
  1934.     echo "AFS may be running... I'll be extra cautious then..." >&4
  1935.     afs=true
  1936. else
  1937.     echo "AFS does not seem to be running..." >&4
  1938.     afs=false
  1939. fi
  1940.  
  1941. : decide how portable to be.  Allow command line overrides.
  1942. case "$d_portable" in
  1943. "$undef") ;;
  1944. *)    d_portable="$define" ;;
  1945. esac
  1946.  
  1947. : set up shell script to do ~ expansion
  1948. cat >filexp <<EOSS
  1949. $startsh
  1950. : expand filename
  1951. case "\$1" in
  1952.  ~/*|~)
  1953.     echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
  1954.     ;;
  1955.  ~*)
  1956.     if $test -f /bin/csh; then
  1957.         /bin/csh -f -c "glob \$1"
  1958.         failed=\$?
  1959.         echo ""
  1960.         exit \$failed
  1961.     else
  1962.         name=\`$expr x\$1 : '..\([^/]*\)'\`
  1963.         dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
  1964.         if $test ! -d "\$dir"; then
  1965.             me=\`basename \$0\`
  1966.             echo "\$me: can't locate home directory for: \$name" >&2
  1967.             exit 1
  1968.         fi
  1969.         case "\$1" in
  1970.         */*)
  1971.             echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
  1972.             ;;
  1973.         *)
  1974.             echo \$dir
  1975.             ;;
  1976.         esac
  1977.     fi
  1978.     ;;
  1979. *)
  1980.     echo \$1
  1981.     ;;
  1982. esac
  1983. EOSS
  1984. chmod +x filexp
  1985. $eunicefix filexp
  1986.  
  1987. : now set up to get a file name
  1988. cat <<'EOSC' >getfile
  1989. tilde=''
  1990. fullpath=''
  1991. already=''
  1992. skip=''
  1993. none_ok=''
  1994. exp_file=''
  1995. nopath_ok=''
  1996. orig_rp="$rp"
  1997. orig_dflt="$dflt"
  1998.  
  1999. case "$fn" in
  2000. *\(*)
  2001.     expr $fn : '.*(\(.*\)).*' | tr ',' '\012' >getfile.ok
  2002.     fn=`echo $fn | sed 's/(.*)//'`
  2003.     ;;
  2004. esac
  2005.  
  2006. case "$fn" in
  2007. *:*)
  2008.     loc_file=`expr $fn : '.*:\(.*\)'`
  2009.     fn=`expr $fn : '\(.*\):.*'`
  2010.     ;;
  2011. esac
  2012.  
  2013. case "$fn" in
  2014. *~*) tilde=true;;
  2015. esac
  2016. case "$fn" in
  2017. */*) fullpath=true;;
  2018. esac
  2019. case "$fn" in
  2020. *+*) skip=true;;
  2021. esac
  2022. case "$fn" in
  2023. *n*) none_ok=true;;
  2024. esac
  2025. case "$fn" in
  2026. *e*) exp_file=true;;
  2027. esac
  2028. case "$fn" in
  2029. *p*) nopath_ok=true;;
  2030. esac
  2031.  
  2032. case "$fn" in
  2033. *f*) type='File';;
  2034. *d*) type='Directory';;
  2035. *l*) type='Locate';;
  2036. esac
  2037.  
  2038. what="$type"
  2039. case "$what" in
  2040. Locate) what='File';;
  2041. esac
  2042.  
  2043. case "$exp_file" in
  2044. '')
  2045.     case "$d_portable" in
  2046.     "$define") ;;
  2047.     *) exp_file=true;;
  2048.     esac
  2049.     ;;
  2050. esac
  2051.  
  2052. cd ..
  2053. while test "$type"; do
  2054.     redo=''
  2055.     rp="$orig_rp"
  2056.     dflt="$orig_dflt"
  2057.     case "$tilde" in
  2058.     true) rp="$rp (~name ok)";;
  2059.     esac
  2060.     . UU/myread
  2061.     if test -f UU/getfile.ok && \
  2062.         $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
  2063.     then
  2064.         value="$ans"
  2065.         ansexp="$ans"
  2066.         break
  2067.     fi
  2068.     case "$ans" in
  2069.     none)
  2070.         value=''
  2071.         ansexp=''
  2072.         case "$none_ok" in
  2073.         true) type='';;
  2074.         esac
  2075.         ;;
  2076.     *)
  2077.         case "$tilde" in
  2078.         '') value="$ans"
  2079.             ansexp="$ans";;
  2080.         *)
  2081.             value=`UU/filexp $ans`
  2082.             case $? in
  2083.             0)
  2084.                 if test "$ans" != "$value"; then
  2085.                     echo "(That expands to $value on this system.)"
  2086.                 fi
  2087.                 ;;
  2088.             *) value="$ans";;
  2089.             esac
  2090.             ansexp="$value"
  2091.             case "$exp_file" in
  2092.             '') value="$ans";;
  2093.             esac
  2094.             ;;
  2095.         esac
  2096.         case "$fullpath" in
  2097.         true)
  2098.             case "$ansexp" in
  2099.             /*) value="$ansexp" ;;
  2100.             *)
  2101.                 redo=true
  2102.                 case "$already" in
  2103.                 true)
  2104.                 echo "I shall only accept a full path name, as in /bin/ls." >&4
  2105.                 echo "Use a ! shell escape if you wish to check pathnames." >&4
  2106.                     ;;
  2107.                 *)
  2108.                 echo "Please give a full path name, starting with slash." >&4
  2109.                     case "$tilde" in
  2110.                     true)
  2111.                 echo "Note that using ~name is ok provided it expands well." >&4
  2112.                         already=true
  2113.                         ;;
  2114.                     esac
  2115.                 esac
  2116.                 ;;
  2117.             esac
  2118.             ;;
  2119.         esac
  2120.         case "$redo" in
  2121.         '')
  2122.             case "$type" in
  2123.             File)
  2124.                 if test -f "$ansexp"; then
  2125.                     type=''
  2126.                 elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1
  2127.                 then
  2128.                     echo "($value is not a plain file, but that's ok.)"
  2129.                     type=''
  2130.                 fi
  2131.                 ;;
  2132.             Directory)
  2133.                 if test -d "$ansexp"; then
  2134.                     type=''
  2135.                 fi
  2136.                 ;;
  2137.             Locate)
  2138.                 if test -d "$ansexp"; then
  2139.                     echo "(Looking for $loc_file in directory $value.)"
  2140.                     value="$value/$loc_file"
  2141.                     ansexp="$ansexp/$loc_file"
  2142.                 fi
  2143.                 if test -f "$ansexp"; then
  2144.                     type=''
  2145.                 fi
  2146.                 case "$nopath_ok" in
  2147.                 true)    case "$value" in
  2148.                     */*) ;;
  2149.                     *)    echo "Assuming $value will be in people's path."
  2150.                         type=''
  2151.                         ;;
  2152.                     esac
  2153.                     ;;
  2154.                 esac
  2155.                 ;;
  2156.             esac
  2157.  
  2158.             case "$skip" in
  2159.             true) type='';
  2160.             esac
  2161.  
  2162.             case "$type" in
  2163.             '') ;;
  2164.             *)
  2165.                 if test "$fastread" = yes; then
  2166.                     dflt=y
  2167.                 else
  2168.                     dflt=n
  2169.                 fi
  2170.                 rp="$what $value doesn't exist.  Use that name anyway?"
  2171.                 . UU/myread
  2172.                 dflt=''
  2173.                 case "$ans" in
  2174.                 y*) type='';;
  2175.                 *) echo " ";;
  2176.                 esac
  2177.                 ;;
  2178.             esac
  2179.             ;;
  2180.         esac
  2181.         ;;
  2182.     esac
  2183. done
  2184. cd UU
  2185. ans="$value"
  2186. rp="$orig_rp"
  2187. dflt="$orig_dflt"
  2188. rm -f getfile.ok
  2189. EOSC
  2190.  
  2191. : determine root of directory hierarchy where package will be installed.
  2192. case "$prefix" in
  2193. '')
  2194.     dflt=`./loc . /usr/local /usr/local /local /opt /usr`
  2195.     ;;
  2196. *)
  2197.     dflt="$prefix"
  2198.     ;;
  2199. esac
  2200. $cat <<EOM
  2201.  
  2202. By default, $package will be installed in $dflt/bin, manual
  2203. pages under $dflt/man, etc..., i.e. with $dflt as prefix for
  2204. all installation directories. Typically set to /usr/local, but you
  2205. may choose /usr if you wish to install $package among your system
  2206. binaries. If you wish to have binaries under /bin but manual pages
  2207. under /usr/local/man, that's ok: you will be prompted separately
  2208. for each of the installation directories, the prefix being only used
  2209. to set the defaults.
  2210.  
  2211. EOM
  2212. fn=d~
  2213. rp='Installation prefix to use?'
  2214. . ./getfile
  2215. oldprefix=''
  2216. case "$prefix" in
  2217. '') ;;
  2218. *)
  2219.     case "$ans" in
  2220.     "$prefix") ;;
  2221.     *) oldprefix="$prefix";;
  2222.     esac
  2223.     ;;
  2224. esac
  2225. prefix="$ans"
  2226. prefixexp="$ansexp"
  2227.  
  2228. : set the prefixit variable, to compute a suitable default value
  2229. prefixit='case "$3" in
  2230. ""|none)
  2231.     case "$oldprefix" in
  2232.     "") eval "$1=\"\$$2\"";;
  2233.     *)
  2234.         case "$3" in
  2235.         "") eval "$1=";;
  2236.         none)
  2237.             eval "tp=\"\$$2\"";
  2238.             case "$tp" in
  2239.             ""|" ") eval "$1=\"\$$2\"";;
  2240.             *) eval "$1=";;
  2241.             esac;;
  2242.         esac;;
  2243.     esac;;
  2244. *)
  2245.     eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
  2246.     case "$tp" in
  2247.     --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
  2248.     /*-$oldprefix/*|\~*-$oldprefix/*)
  2249.         eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
  2250.     *) eval "$1=\"\$$2\"";;
  2251.     esac;;
  2252. esac'
  2253.  
  2254. : determine where private library files go
  2255. : Usual default is /usr/local/lib/perl5.  Also allow things like 
  2256. : /opt/perl/lib, since /opt/perl/lib/perl5 would be redundant.
  2257. case "$prefix" in
  2258. *perl*) set dflt privlib lib ;;
  2259. *)     set dflt privlib lib/$package ;;
  2260. esac
  2261. eval $prefixit
  2262. $cat <<EOM
  2263.  
  2264. There are some auxiliary files for $package that need to be put into a
  2265. private library directory that is accessible by everyone.
  2266.  
  2267. EOM
  2268. fn=d~+
  2269. rp='Pathname where the private library files will reside?'
  2270. . ./getfile
  2271. if $test "X$privlibexp" != "X$ansexp"; then
  2272.     installprivlib=''
  2273. fi
  2274. privlib="$ans"
  2275. privlibexp="$ansexp"
  2276. if $afs; then
  2277.     $cat <<EOM
  2278.  
  2279. Since you are running AFS, I need to distinguish the directory in which
  2280. private files reside from the directory in which they are installed (and from
  2281. which they are presumably copied to the former directory by occult means).
  2282.  
  2283. EOM
  2284.     case "$installprivlib" in
  2285.     '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;;
  2286.     *) dflt="$installprivlib";;
  2287.     esac
  2288.     fn=de~
  2289.     rp='Where will private files be installed?'
  2290.     . ./getfile
  2291.     installprivlib="$ans"
  2292. else
  2293.     installprivlib="$privlibexp"
  2294. fi
  2295.  
  2296. : set the base revision
  2297. baserev=5.0
  2298.  
  2299. : get the patchlevel
  2300. echo " "
  2301. echo "Getting the current patchlevel..." >&4
  2302. if $test -r ../patchlevel.h;then
  2303.     patchlevel=`awk '/PATCHLEVEL/ {print $3}' < ../patchlevel.h`
  2304. else
  2305.     patchlevel=0
  2306. fi
  2307. echo "(You have $package $baserev PL$patchlevel.)"
  2308.  
  2309. : set the prefixup variable, to restore leading tilda escape
  2310. prefixup='case "$prefixexp" in
  2311. "$prefix") ;;
  2312. *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
  2313. esac'
  2314.  
  2315. : determine where public architecture dependent libraries go
  2316. set archlib archlib
  2317. eval $prefixit
  2318. case "$archlib" in
  2319. '')
  2320.     case "$privlib" in
  2321.     '')
  2322.         dflt=`./loc . "." $prefixexp/lib /usr/local/lib /usr/lib /lib`
  2323.         set dflt
  2324.         eval $prefixup
  2325.         ;;
  2326.     *)    version=`echo $baserev $patchlevel | $awk '{print $1 + $2/1000.0}'`
  2327.         dflt="$privlib/$archname/$version"
  2328.         ;;
  2329.     esac
  2330.     ;;
  2331. *) dflt="$archlib";;
  2332. esac
  2333. cat <<EOM
  2334.  
  2335. $spackage contains architecture-dependent library files.  If you are
  2336. sharing libraries in a heterogeneous environment, you might store
  2337. these files in a separate location.  Otherwise, you can just include
  2338. them with the rest of the public library files.
  2339.  
  2340. EOM
  2341. fn=d+~
  2342. rp='Where do you want to put the public architecture-dependent libraries?'
  2343. . ./getfile
  2344. archlib="$ans"
  2345. archlibexp="$ansexp"
  2346.  
  2347. if $afs; then
  2348.     $cat <<EOM
  2349.  
  2350. Since you are running AFS, I need to distinguish the directory in which
  2351. private files reside from the directory in which they are installed (and from
  2352. which they are presumably copied to the former directory by occult means).
  2353.  
  2354. EOM
  2355.     case "$installarchlib" in
  2356.     '') dflt=`echo $archlibexp | sed 's#^/afs/#/afs/.#'`;;
  2357.     *) dflt="$installarchlib";;
  2358.     esac
  2359.     fn=de~
  2360.     rp='Where will architecture-dependent library files be installed?'
  2361.     . ./getfile
  2362.     installarchlib="$ans"
  2363. else
  2364.     installarchlib="$archlibexp"
  2365. fi
  2366. if $test X"$archlib" = X"$privlib"; then
  2367.     d_archlib="$undef"
  2368. else
  2369.     d_archlib="$define"
  2370. fi
  2371.  
  2372. : set up the script used to warn in case of inconsistency
  2373. cat <<'EOSC' >whoa
  2374. dflt=y
  2375. echo " "
  2376. echo "*** WHOA THERE!!! ***" >&4
  2377. echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
  2378. rp="    Keep the $hint value?"
  2379. . ./myread
  2380. case "$ans" in
  2381. y) td=$was; tu=$was;;
  2382. esac
  2383. EOSC
  2384.  
  2385. : function used to set $1 to $val
  2386. setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
  2387. case "$val$was" in
  2388. $define$undef) . ./whoa; eval "$var=\$td";;
  2389. $undef$define) . ./whoa; eval "$var=\$tu";;
  2390. *) eval "$var=$val";;
  2391. esac'
  2392.  
  2393. : make some quick guesses about what we are up against
  2394. echo " "
  2395. $echo $n "Hmm...  $c"
  2396. echo exit 1 >bsd
  2397. echo exit 1 >usg
  2398. echo exit 1 >v7
  2399. echo exit 1 >osf1
  2400. echo exit 1 >eunice
  2401. echo exit 1 >xenix
  2402. echo exit 1 >venix
  2403. d_bsd="$undef"
  2404. $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
  2405. if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
  2406. then
  2407.     echo "Looks kind of like an OSF/1 system, but we'll see..."
  2408.     echo exit 0 >osf1
  2409. elif test `echo abc | tr a-z A-Z` = Abc ; then
  2410.     xxx=`./loc addbib blurfl $pth`
  2411.     if $test -f $xxx; then
  2412.     echo "Looks kind of like a USG system with BSD features, but we'll see..."
  2413.         echo exit 0 >bsd
  2414.         echo exit 0 >usg
  2415.     else
  2416.         if $contains SIGTSTP foo >/dev/null 2>&1 ; then
  2417.             echo "Looks kind of like an extended USG system, but we'll see..."
  2418.         else
  2419.             echo "Looks kind of like a USG system, but we'll see..."
  2420.         fi
  2421.         echo exit 0 >usg
  2422.     fi
  2423. elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
  2424.     echo "Looks kind of like a BSD system, but we'll see..."
  2425.     d_bsd="$define"
  2426.     echo exit 0 >bsd
  2427. else
  2428.     echo "Looks kind of like a Version 7 system, but we'll see..."
  2429.     echo exit 0 >v7
  2430. fi
  2431. case "$eunicefix" in
  2432. *unixtovms*)
  2433.     $cat <<'EOI'
  2434. There is, however, a strange, musty smell in the air that reminds me of
  2435. something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
  2436. EOI
  2437.     echo exit 0 >eunice
  2438.     d_eunice="$define"
  2439. : it so happens the Eunice I know will not run shell scripts in Unix format
  2440.     ;;
  2441. *)
  2442.     echo " "
  2443.     echo "Congratulations.  You aren't running Eunice."
  2444.     d_eunice="$undef"
  2445.     ;;
  2446. esac
  2447. if test -f /xenix; then
  2448.     echo "Actually, this looks more like a XENIX system..."
  2449.     echo exit 0 >xenix
  2450.     d_xenix="$define"
  2451. else
  2452.     echo " "
  2453.     echo "It's not Xenix..."
  2454.     d_xenix="$undef"
  2455. fi
  2456. chmod +x xenix
  2457. $eunicefix xenix
  2458. if test -f /venix; then
  2459.     echo "Actually, this looks more like a VENIX system..."
  2460.     echo exit 0 >venix
  2461. else
  2462.     echo " "
  2463.     if ./xenix; then
  2464.         : null
  2465.     else
  2466.         echo "Nor is it Venix..."
  2467.     fi
  2468. fi
  2469. chmod +x bsd usg v7 osf1 eunice xenix venix
  2470. $eunicefix bsd usg v7 osf1 eunice xenix venix
  2471. $rm -f foo
  2472.  
  2473. : see if setuid scripts can be secure
  2474. $cat <<EOM
  2475.  
  2476. Some kernels have a bug that prevents setuid #! scripts from being
  2477. secure.  Some sites have disabled setuid #! scripts because of this.
  2478.  
  2479. First let's decide if your kernel supports secure setuid #! scripts.
  2480. (If setuid #! scripts would be secure but have been disabled anyway,
  2481. don't say that they are secure if asked.)
  2482.  
  2483. EOM
  2484.  
  2485. val="$undef"
  2486. if $test -d /dev/fd; then
  2487.     echo "#!$ls" >reflect
  2488.     chmod +x,u+s reflect
  2489.     ./reflect >flect 2>&1
  2490.     if $contains "/dev/fd" flect >/dev/null; then
  2491.         echo "Congratulations, your kernel has secure setuid scripts!" >&4
  2492.         val="$define"
  2493.     else
  2494.         $cat <<EOM
  2495. If you are not sure if they are secure, I can check but I'll need a
  2496. username and password different from the one you are using right now.
  2497. If you don't have such a username or don't want me to test, simply
  2498. enter 'none'.
  2499.  
  2500. EOM
  2501.         rp='Other username to test security of setuid scripts with?'
  2502.         dflt='none'
  2503.         . ./myread
  2504.         case "$ans" in
  2505.         n|none)
  2506.             case "$d_suidsafe" in
  2507.             '')    echo "I'll assume setuid scripts are *not* secure." >&4
  2508.                 dflt=n;;
  2509.             "$undef")
  2510.                 echo "Well, the $hint value is *not* secure." >&4
  2511.                 dflt=n;;
  2512.             *)    echo "Well, the $hint value *is* secure." >&4
  2513.                 dflt=y;;
  2514.             esac
  2515.             ;;
  2516.         *)
  2517.             $rm -f reflect flect
  2518.             echo "#!$ls" >reflect
  2519.             chmod +x,u+s reflect
  2520.             echo >flect
  2521.             chmod a+w flect
  2522.             echo '"su" will (probably) prompt you for '"$ans's password."
  2523.             su $ans -c './reflect >flect'
  2524.             if $contains "/dev/fd" flect >/dev/null; then
  2525.                 echo "Okay, it looks like setuid scripts are secure." >&4
  2526.                 dflt=y
  2527.             else
  2528.                 echo "I don't think setuid scripts are secure." >&4
  2529.                 dflt=n
  2530.             fi
  2531.             ;;
  2532.         esac
  2533.         rp='Does your kernel have *secure* setuid scripts?'
  2534.         . ./myread
  2535.         case "$ans" in
  2536.         [yY]*)    val="$define";;
  2537.         *)    val="$undef";;
  2538.         esac
  2539.     fi
  2540. else
  2541.     echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
  2542.     val="$undef"
  2543. fi
  2544. set d_suidsafe
  2545. eval $setvar
  2546.  
  2547. $rm -f reflect flect
  2548.  
  2549. : now see if they want to do setuid emulation
  2550. echo " "
  2551. val="$undef"
  2552. case "$d_suidsafe" in
  2553. "$define")
  2554.     val="$undef"
  2555.     echo "No need to emulate SUID scripts since they are secure here." >& 4
  2556.     ;;
  2557. *)
  2558.     $cat <<EOM
  2559. Some systems have disabled setuid scripts, especially systems where
  2560. setuid scripts cannot be secure.  On systems where setuid scripts have
  2561. been disabled, the setuid/setgid bits on scripts are currently
  2562. useless.  It is possible for $package to detect those bits and emulate
  2563. setuid/setgid in a secure fashion.  This emulation will only work if
  2564. setuid scripts have been disabled in your kernel.
  2565.  
  2566. EOM
  2567.     case "$d_dosuid" in
  2568.     "$define") dflt=y ;;
  2569.     *) dflt=n ;;
  2570.     esac
  2571.     rp="Do you want to do setuid/setgid emulation?"
  2572.     . ./myread
  2573.     case "$ans" in
  2574.     [yY]*)    val="$define";;
  2575.     *)    val="$undef";;
  2576.     esac
  2577.     ;;
  2578. esac
  2579. set d_dosuid
  2580. eval $setvar
  2581.  
  2582. : determine where site specific libraries go.
  2583. set sitelib sitelib
  2584. eval $prefixit
  2585. case "$sitelib" in
  2586. '')    dflt="$privlib/site_perl" ;;
  2587. *)    dflt="$sitelib" ;;
  2588. esac
  2589. $cat <<EOM
  2590.  
  2591. The installation process will also create a directory for
  2592. site-specific extensions and modules.  Some users find it convenient
  2593. to place all local files in this directory rather than in the main
  2594. distribution directory.
  2595.  
  2596. EOM
  2597. fn=d~+
  2598. rp='Pathname for the site-specific library files?'
  2599. . ./getfile
  2600. if $test "X$sitelibexp" != "X$ansexp"; then
  2601.     installsitelib=''
  2602. fi
  2603. sitelib="$ans"
  2604. sitelibexp="$ansexp"
  2605. if $afs; then
  2606.     $cat <<EOM
  2607.  
  2608. Since you are running AFS, I need to distinguish the directory in which
  2609. private files reside from the directory in which they are installed (and from
  2610. which they are presumably copied to the former directory by occult means).
  2611.  
  2612. EOM
  2613.     case "$installsitelib" in
  2614.     '') dflt=`echo $sitelibexp | sed 's#^/afs/#/afs/.#'`;;
  2615.     *) dflt="$installsitelib";;
  2616.     esac
  2617.     fn=de~
  2618.     rp='Where will private files be installed?'
  2619.     . ./getfile
  2620.     installsitelib="$ans"
  2621. else
  2622.     installsitelib="$sitelibexp"
  2623. fi
  2624.  
  2625. : determine where site specific architecture-dependent libraries go.
  2626. xxx=`echo $sitelib/$archname | sed 's!^$prefix!!'`
  2627. : xxx is usuually lib/site_perl/archname.
  2628. set sitearch sitearch none
  2629. eval $prefixit
  2630. case "$sitearch" in
  2631. '')    dflt="$sitelib/$archname" ;;
  2632. *)    dflt="$sitearch" ;;
  2633. esac
  2634. $cat <<EOM
  2635.  
  2636. The installation process will also create a directory for
  2637. architecture-dependent site-specific extensions and modules.
  2638.  
  2639. EOM
  2640. fn=nd~+
  2641. rp='Pathname for the site-specific architecture-dependent library files?'
  2642. . ./getfile
  2643. if $test "X$sitearchexp" != "X$ansexp"; then
  2644.     installsitearch=''
  2645. fi
  2646. sitearch="$ans"
  2647. sitearchexp="$ansexp"
  2648. if $afs; then
  2649.     $cat <<EOM
  2650.  
  2651. Since you are running AFS, I need to distinguish the directory in which
  2652. private files reside from the directory in which they are installed (and from
  2653. which they are presumably copied to the former directory by occult means).
  2654.  
  2655. EOM
  2656.     case "$installsitearch" in
  2657.     '') dflt=`echo $sitearchexp | sed 's#^/afs/#/afs/.#'`;;
  2658.     *) dflt="$installsitearch";;
  2659.     esac
  2660.     fn=de~
  2661.     rp='Where will private files be installed?'
  2662.     . ./getfile
  2663.     installsitearch="$ans"
  2664. else
  2665.     installsitearch="$sitearchexp"
  2666. fi
  2667.  
  2668. : determine where old public architecture dependent libraries might be
  2669. case "$oldarchlib" in
  2670. '')    case "$privlib" in
  2671.     '') ;;
  2672.     *)    dflt="$privlib/$archname"
  2673.         ;;
  2674.     esac
  2675.     ;;
  2676. *)    dflt="$oldarchlib" 
  2677.     ;;
  2678. esac
  2679. if $test ! -d "$dflt/auto"; then
  2680.     dflt=none
  2681. fi
  2682. cat <<EOM
  2683.  
  2684. In 5.001, Perl stored architecture-dependent library files in a library
  2685. with a name such as $privlib/$archname, 
  2686. and this directory contained files from the standard extensions and 
  2687. files from any additional extensions you might have added.  Starting 
  2688. with version 5.002, all the architecture-dependent standard extensions 
  2689. will go into $archlib, 
  2690. while locally-added extensions will go into
  2691. $sitearch.
  2692.  
  2693. If you wish Perl to continue to search the old architecture-dependent
  2694. library for your local extensions, give the path to that directory.
  2695. If you do not wish to use your old architecture-dependent library
  2696. files, answer 'none'.
  2697.  
  2698. EOM
  2699. fn=dn~
  2700. rp='Directory for your old 5.001 architecture-dependent libraries?'
  2701. . ./getfile
  2702. oldarchlib="$ans"
  2703. oldarchlibexp="$ansexp"
  2704. case "$oldarchlib" in
  2705. ''|' ') val="$undef" ;;
  2706. *) val="$define" ;;
  2707. esac
  2708. set d_oldarchlib
  2709. eval $setvar
  2710.  
  2711. : determine where public executables go
  2712. echo " "
  2713. set dflt bin bin
  2714. eval $prefixit
  2715. fn=d~
  2716. rp='Pathname where the public executables will reside?'
  2717. . ./getfile
  2718. if $test "X$ansexp" != "X$binexp"; then
  2719.     installbin=''
  2720. fi
  2721. bin="$ans"
  2722. binexp="$ansexp"
  2723. if $afs; then
  2724.     $cat <<EOM
  2725.  
  2726. Since you are running AFS, I need to distinguish the directory in which
  2727. executables reside from the directory in which they are installed (and from
  2728. which they are presumably copied to the former directory by occult means).
  2729.  
  2730. EOM
  2731.     case "$installbin" in
  2732.     '') dflt=`echo $binexp | sed 's#^/afs/#/afs/.#'`;;
  2733.     *) dflt="$installbin";;
  2734.     esac
  2735.     fn=de~
  2736.     rp='Where will public executables be installed?'
  2737.     . ./getfile
  2738.     installbin="$ans"
  2739. else
  2740.     installbin="$binexp"
  2741. fi
  2742.  
  2743. : determine where manual pages are on this system
  2744. echo " "
  2745. case "$sysman" in
  2746. '') 
  2747.     syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
  2748.     syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
  2749.     syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
  2750.     syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
  2751.     syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
  2752.     sysman=`./loc . /usr/man/man1 $syspath`
  2753.     ;;
  2754. esac
  2755. if $test -d "$sysman"; then
  2756.     echo "System manual is in $sysman." >&4
  2757. else
  2758.     echo "Could not find manual pages in source form." >&4
  2759. fi
  2760.  
  2761. : determine where manual pages go
  2762. set man1dir man1dir none
  2763. eval $prefixit
  2764. $cat <<EOM
  2765.  
  2766. $spackage has manual pages available in source form.
  2767. EOM
  2768. case "$nroff" in
  2769. nroff)
  2770.     echo "However, you don't have nroff, so they're probably useless to you."
  2771.     case "$man1dir" in
  2772.     '') man1dir="none";;
  2773.     esac;;
  2774. esac
  2775. echo "If you don't want the manual sources installed, answer 'none'."
  2776. case "$man1dir" in
  2777. ' ') dflt=none
  2778.     ;;
  2779. '')
  2780.     lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
  2781.     lookpath="$lookpath $prefixexp/man/p_man/man1"
  2782.     lookpath="$lookpath $prefixexp/man/u_man/man1"
  2783.     lookpath="$lookpath $prefixexp/man/man.1"
  2784.     : If prefix contains 'perl' then we want to keep the man pages
  2785.     : under the prefix directory.  Otherwise, look in a variety of
  2786.     : other possible places.  This is debatable, but probably a
  2787.     : good compromise.  Well, apparently not.
  2788.     : Experience has shown people expect man1dir to be under prefix,
  2789.     : so we now always put it there.  Users who want other behavior
  2790.     : can answer interactively or use a command line option.
  2791.     : Does user have System V-style man paths.
  2792.     case "$sysman" in
  2793.     */?_man*)    dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
  2794.     *)    dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
  2795.     esac
  2796.     set dflt
  2797.     eval $prefixup
  2798.     ;;
  2799. *)  dflt="$man1dir"
  2800.     ;;
  2801. esac
  2802. echo " "
  2803. fn=dn+~
  2804. rp="Where do the main $spackage manual pages (source) go?"
  2805. . ./getfile
  2806. if $test "X$man1direxp" != "X$ansexp"; then
  2807.     installman1dir=''
  2808. fi
  2809. man1dir="$ans"
  2810. man1direxp="$ansexp"
  2811. case "$man1dir" in
  2812. '') man1dir=' '
  2813.     installman1dir='';;
  2814. esac
  2815. if $afs; then
  2816.     $cat <<EOM
  2817.  
  2818. Since you are running AFS, I need to distinguish the directory in which
  2819. manual pages reside from the directory in which they are installed (and from
  2820. which they are presumably copied to the former directory by occult means).
  2821.  
  2822. EOM
  2823.     case "$installman1dir" in
  2824.     '') dflt=`echo $man1direxp | sed 's#^/afs/#/afs/.#'`;;
  2825.     *) dflt="$installman1dir";;
  2826.     esac
  2827.     fn=de~
  2828.     rp='Where will man pages be installed?'
  2829.     . ./getfile
  2830.     installman1dir="$ans"
  2831. else
  2832.     installman1dir="$man1direxp"
  2833. fi
  2834.  
  2835. : What suffix to use on installed man pages
  2836.  
  2837. case "$man1dir" in
  2838. ' ')
  2839.     man1ext='0'
  2840.     ;;
  2841. *)
  2842.     rp="What suffix should be used for the main $spackage man pages?"
  2843.     case "$man1ext" in
  2844.     '')    case "$man1dir" in
  2845.         *1)  dflt=1 ;;
  2846.         *1p) dflt=1p ;;
  2847.         *1pm) dflt=1pm ;;
  2848.         *l) dflt=l;;
  2849.         *n) dflt=n;;
  2850.         *o) dflt=o;;
  2851.         *p) dflt=p;;
  2852.         *C) dflt=C;;
  2853.         *L) dflt=L;;
  2854.         *L1) dflt=L1;;
  2855.         *) dflt=1;;
  2856.         esac
  2857.         ;;
  2858.     *)    dflt="$man1ext";;
  2859.     esac
  2860.     . ./myread
  2861.     man1ext="$ans"
  2862.     ;;
  2863. esac
  2864.  
  2865. : see if we can have long filenames
  2866. echo " "
  2867. rmlist="$rmlist /tmp/cf$$"
  2868. $test -d /tmp/cf$$ || mkdir /tmp/cf$$
  2869. first=123456789abcdef
  2870. second=/tmp/cf$$/$first
  2871. $rm -f $first $second
  2872. if (echo hi >$first) 2>/dev/null; then
  2873.     if $test -f 123456789abcde; then
  2874.         echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
  2875.         val="$undef"
  2876.     else
  2877.         if (echo hi >$second) 2>/dev/null; then
  2878.             if $test -f /tmp/cf$$/123456789abcde; then
  2879.                 $cat <<'EOM'
  2880. That's peculiar... You can have filenames longer than 14 characters, but only
  2881. on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
  2882. I shall consider your system cannot support long filenames at all.
  2883. EOM
  2884.                 val="$undef"
  2885.             else
  2886.                 echo 'You can have filenames longer than 14 characters.' >&4
  2887.                 val="$define"
  2888.             fi
  2889.         else
  2890.             $cat <<'EOM'
  2891. How confusing! Some of your filesystems are sane enough to allow filenames
  2892. longer than 14 characters but some others like /tmp can't even think about them.
  2893. So, for now on, I shall assume your kernel does not allow them at all.
  2894. EOM
  2895.             val="$undef"
  2896.         fi
  2897.     fi
  2898. else
  2899.     $cat <<'EOM'
  2900. You can't have filenames longer than 14 chars.  You can't even think about them!
  2901. EOM
  2902.     val="$undef"
  2903. fi 
  2904. set d_flexfnam
  2905. eval $setvar
  2906. $rm -rf /tmp/cf$$ 123456789abcde*
  2907.  
  2908. : determine where library module manual pages go
  2909. set man3dir man3dir none
  2910. eval $prefixit
  2911. $cat <<EOM
  2912.  
  2913. $spackage has manual pages for many of the library modules.
  2914. EOM
  2915.  
  2916. case "$nroff" in
  2917. nroff)
  2918.     $cat <<'EOM'
  2919. However, you don't have nroff, so they're probably useless to you.
  2920. You can use the supplied perldoc script instead.
  2921. EOM
  2922.     case "$man3dir" in
  2923.     '') man3dir="none";;
  2924.     esac;;
  2925. esac
  2926.  
  2927. case "$d_flexfnam" in
  2928. undef)
  2929.     $cat <<'EOM'
  2930. However, your system can't handle the long file names like File::Basename.3. 
  2931. You can use the supplied perldoc script instead.
  2932. EOM
  2933.     case "$man3dir" in
  2934.     '') man3dir="none";;
  2935.     esac;;
  2936. esac
  2937.  
  2938. echo "If you don't want the manual sources installed, answer 'none'."
  2939. : We dont use /usr/local/man/man3 because some man programs will
  2940. : only show the /usr/local/man/man3 contents, and not the system ones,
  2941. : thus man less will show the perl module less.pm, but not the system
  2942. : less command.  We might also conflict with TCL man pages.
  2943. : However, something like /opt/perl/man/man3 is fine.
  2944. case "$man3dir" in
  2945. '')    case "$prefix" in 
  2946.     *perl*) dflt=`echo $man1dir | 
  2947.             $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'` ;;
  2948.     *)    dflt="$privlib/man/man3" ;;
  2949.     esac
  2950.     ;;
  2951. ' ') dflt=none;;
  2952. *)    dflt="$man3dir" ;;
  2953. esac
  2954. echo " "
  2955.  
  2956. fn=dn+~
  2957. rp="Where do the $spackage library man pages (source) go?"
  2958. . ./getfile
  2959. if test "X$man3direxp" != "X$ansexp"; then
  2960.     installman3dir=''
  2961. fi
  2962.  
  2963. man3dir="$ans"
  2964. man3direxp="$ansexp"
  2965. case "$man3dir" in
  2966. '') man3dir=' '
  2967.     installman3dir='';;
  2968. esac
  2969. if $afs; then
  2970.     $cat <<EOM
  2971.  
  2972. Since you are running AFS, I need to distinguish the directory in which
  2973. manual pages reside from the directory in which they are installed (and from
  2974. which they are presumably copied to the former directory by occult means).
  2975.  
  2976. EOM
  2977.     case "$installman3dir" in
  2978.     '') dflt=`echo $man3direxp | sed 's#^/afs/#/afs/.#'`;;
  2979.     *) dflt="$installman3dir";;
  2980.     esac
  2981.     fn=de~
  2982.     rp='Where will man pages be installed?'
  2983.     . ./getfile
  2984.     installman3dir="$ans"
  2985. else
  2986.     installman3dir="$man3direxp"
  2987. fi
  2988.  
  2989. : What suffix to use on installed man pages
  2990.  
  2991. case "$man3dir" in
  2992. ' ')
  2993.     man3ext='0'
  2994.     ;;
  2995. *)
  2996.     rp="What suffix should be used for the $spackage library man pages?"
  2997.     case "$man3ext" in
  2998.     '')    case "$man3dir" in
  2999.         *3)  dflt=3 ;;
  3000.         *3p) dflt=3p ;;
  3001.         *3pm) dflt=3pm ;;
  3002.         *l) dflt=l;;
  3003.         *n) dflt=n;;
  3004.         *o) dflt=o;;
  3005.         *p) dflt=p;;
  3006.         *C) dflt=C;;
  3007.         *L) dflt=L;;
  3008.         *L3) dflt=L3;;
  3009.         *) dflt=3;;
  3010.         esac
  3011.         ;;
  3012.     *)    dflt="$man3ext";;
  3013.     esac
  3014.     . ./myread
  3015.     man3ext="$ans"
  3016.     ;;
  3017. esac
  3018.  
  3019. : see what memory models we can support
  3020. case "$models" in
  3021. '')
  3022.     $cat >pdp11.c <<'EOP'
  3023. main() {
  3024. #ifdef pdp11
  3025.     exit(0);
  3026. #else
  3027.     exit(1);
  3028. #endif
  3029. }
  3030. EOP
  3031.     cc -o pdp11 pdp11.c >/dev/null 2>&1
  3032.     if ./pdp11 2>/dev/null; then
  3033.         dflt='unsplit split'
  3034.     else
  3035.         tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
  3036.         case "$tans" in
  3037.         X) dflt='none';;
  3038.         *) if $test -d /lib/small || $test -d /usr/lib/small; then
  3039.                 dflt='small'
  3040.             else
  3041.                 dflt=''
  3042.             fi
  3043.             if $test -d /lib/medium || $test -d /usr/lib/medium; then
  3044.                 dflt="$dflt medium"
  3045.             fi
  3046.             if $test -d /lib/large || $test -d /usr/lib/large; then
  3047.                 dflt="$dflt large"
  3048.             fi
  3049.             if $test -d /lib/huge || $test -d /usr/lib/huge; then
  3050.                 dflt="$dflt huge"
  3051.             fi
  3052.         esac
  3053.     fi;;
  3054. *) dflt="$models";;
  3055. esac
  3056. $cat <<EOM
  3057.  
  3058. Some systems have different model sizes.  On most systems they are called
  3059. small, medium, large, and huge.  On the PDP11 they are called unsplit and
  3060. split.  If your system doesn't support different memory models, say "none".
  3061. If you wish to force everything to one memory model, say "none" here and
  3062. put the appropriate flags later when it asks you for other cc and ld flags.
  3063. Venix systems may wish to put "none" and let the compiler figure things out.
  3064. (In the following question multiple model names should be space separated.)
  3065.  
  3066. EOM
  3067. rp="Which memory models are supported?"
  3068. . ./myread
  3069. models="$ans"
  3070.  
  3071. case "$models" in
  3072. none)
  3073.     small=''
  3074.     medium=''
  3075.     large=''
  3076.     huge=''
  3077.     unsplit=''
  3078.     split=''
  3079.     ;;
  3080. *split)
  3081.     case "$split" in
  3082.     '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
  3083.              $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
  3084.             dflt='-i'
  3085.         else
  3086.             dflt='none'
  3087.         fi;;
  3088.     *) dflt="$split";;
  3089.     esac
  3090.     rp="What flag indicates separate I and D space?"
  3091.     . ./myread
  3092.     tans="$ans"
  3093.     case "$tans" in
  3094.     none) tans='';;
  3095.     esac
  3096.     split="$tans"
  3097.     unsplit='';;
  3098. *large*|*small*|*medium*|*huge*)
  3099.     case "$models" in
  3100.     *large*)
  3101.         case "$large" in
  3102.         '') dflt='-Ml';;
  3103.         *) dflt="$large";;
  3104.         esac
  3105.     rp="What flag indicates large model?"
  3106.     . ./myread
  3107.     tans="$ans"
  3108.     case "$tans" in
  3109.     none) tans='';
  3110.     esac
  3111.     large="$tans";;
  3112.     *) large='';;
  3113.     esac
  3114.     case "$models" in
  3115.     *huge*) case "$huge" in
  3116.         '') dflt='-Mh';;
  3117.         *) dflt="$huge";;
  3118.         esac
  3119.         rp="What flag indicates huge model?"
  3120.         . ./myread
  3121.         tans="$ans"
  3122.         case "$tans" in
  3123.         none) tans='';
  3124.         esac
  3125.         huge="$tans";;
  3126.     *) huge="$large";;
  3127.     esac
  3128.     case "$models" in
  3129.     *medium*) case "$medium" in
  3130.         '') dflt='-Mm';;
  3131.         *) dflt="$medium";;
  3132.         esac
  3133.         rp="What flag indicates medium model?"
  3134.         . ./myread
  3135.         tans="$ans"
  3136.         case "$tans" in
  3137.         none) tans='';
  3138.         esac
  3139.         medium="$tans";;
  3140.     *) medium="$large";;
  3141.     esac
  3142.     case "$models" in
  3143.     *small*) case "$small" in
  3144.         '') dflt='none';;
  3145.         *) dflt="$small";;
  3146.         esac
  3147.         rp="What flag indicates small model?"
  3148.         . ./myread
  3149.         tans="$ans"
  3150.         case "$tans" in
  3151.         none) tans='';
  3152.         esac
  3153.         small="$tans";;
  3154.     *) small='';;
  3155.     esac
  3156.     ;;
  3157. *)
  3158.     echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
  3159.     ;;
  3160. esac
  3161.  
  3162. : see if we need a special compiler
  3163. echo " "
  3164. if ./usg; then
  3165.     case "$cc" in
  3166.     '') case "$Mcc" in
  3167.         /*) dflt='Mcc';;
  3168.         *) case "$large" in
  3169.             -M*) dflt='cc';;
  3170.             *)    if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
  3171.                     if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
  3172.                         dflt='cc'
  3173.                     else
  3174.                         dflt='cc -M'
  3175.                     fi
  3176.                 else
  3177.                     dflt='cc'
  3178.                 fi;;
  3179.             esac;;
  3180.         esac;;
  3181.     *)  dflt="$cc";;
  3182.     esac
  3183.     $cat <<'EOM'
  3184. On some systems the default C compiler will not resolve multiple global
  3185. references that happen to have the same name.  On some such systems the "Mcc"
  3186. command may be used to force these to be resolved.  On other systems a "cc -M"
  3187. command is required.  (Note that the -M flag on other systems indicates a
  3188. memory model to use!) If you have the Gnu C compiler, you might wish to use
  3189. that instead.
  3190.  
  3191. EOM
  3192.     rp="What command will force resolution on this system?"
  3193.     . ./myread
  3194.     cc="$ans"
  3195. else
  3196.     case "$cc" in
  3197.     '') dflt=cc;;
  3198.     *) dflt="$cc";;
  3199.     esac
  3200.     rp="Use which C compiler?"
  3201.     . ./myread
  3202.     cc="$ans"
  3203. fi
  3204. echo " "
  3205. echo "Checking for GNU cc in disguise and/or its version number..." >&4
  3206. $cat >gccvers.c <<EOM
  3207. #include <stdio.h>
  3208. int main() {
  3209. #ifdef __GNUC__
  3210. #ifdef __VERSION__
  3211.     printf("%s\n", __VERSION__);
  3212. #else
  3213.     printf("%s\n", "1");
  3214. #endif
  3215. #endif
  3216.     exit(0);
  3217. }
  3218. EOM
  3219. if $cc -o gccvers gccvers.c >/dev/null 2>&1; then
  3220.     gccversion=`./gccvers`
  3221.     case "$gccversion" in
  3222.     '') echo "You are not using GNU cc." ;;
  3223.     *)  echo "You are using GNU cc $gccversion." ;;
  3224.     esac
  3225. else
  3226.     echo " "
  3227.     echo "*** WHOA THERE!!! ***" >&4
  3228.     echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
  3229.     case "$knowitall" in
  3230.     '')
  3231.     echo "    You'd better start hunting for one and let me know about it." >&4
  3232.         exit 1
  3233.         ;;
  3234.     esac
  3235. fi
  3236. $rm -f gccvers*
  3237. case "$gccversion" in
  3238. 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
  3239. esac
  3240.  
  3241. : What should the include directory be ?
  3242. echo " "
  3243. $echo $n "Hmm...  $c"
  3244. dflt='/usr/include'
  3245. incpath=''
  3246. mips_type=''
  3247. if $test -f /bin/mips && /bin/mips; then
  3248.     echo "Looks like a MIPS system..."
  3249.     $cat >usr.c <<'EOCP'
  3250. #ifdef SYSTYPE_BSD43
  3251. /bsd43
  3252. #endif
  3253. EOCP
  3254.     if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
  3255.         dflt='/bsd43/usr/include'
  3256.         incpath='/bsd43'
  3257.         mips_type='BSD 4.3'
  3258.     else
  3259.         mips_type='System V'
  3260.     fi
  3261.     $rm -f usr.c usr.out
  3262.     echo "and you're compiling with the $mips_type compiler and libraries."
  3263.     xxx_prompt=y
  3264.     echo "exit 0" >mips
  3265. else
  3266.     echo "Doesn't look like a MIPS system."
  3267.     xxx_prompt=n
  3268.     echo "exit 1" >mips
  3269. fi
  3270. chmod +x mips
  3271. $eunicefix mips
  3272. echo " "
  3273. case "$usrinc" in
  3274. '') ;;
  3275. *) dflt="$usrinc";;
  3276. esac
  3277. case "$xxx_prompt" in
  3278. y)    fn=d/
  3279.     rp='Where are the include files you want to use?'
  3280.     . ./getfile
  3281.     usrinc="$ans"
  3282.     ;;
  3283. *)    usrinc="$dflt"
  3284.     ;;
  3285. esac
  3286.  
  3287. : see if we have to deal with yellow pages, now NIS.
  3288. if $test -d /usr/etc/yp || $test -d /etc/yp; then
  3289.     if $test -f /usr/etc/nibindd; then
  3290.         echo " "
  3291.         echo "I'm fairly confident you're on a NeXT."
  3292.         echo " "
  3293.         rp='Do you get the hosts file via NetInfo?'
  3294.         dflt=y
  3295.         case "$hostcat" in
  3296.         nidump*) ;;
  3297.         '') ;;
  3298.         *) dflt=n;;
  3299.         esac
  3300.         . ./myread
  3301.         case "$ans" in
  3302.         y*) hostcat='nidump hosts .';;
  3303.         *)    case "$hostcat" in
  3304.             nidump*) hostcat='';;
  3305.             esac
  3306.             ;;
  3307.         esac
  3308.     fi
  3309.     case "$hostcat" in
  3310.     nidump*) ;;
  3311.     *)
  3312.         case "$hostcat" in
  3313.         *ypcat*) dflt=y;;
  3314.         '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
  3315.                 dflt=y
  3316.             else
  3317.                 dflt=n
  3318.             fi;;
  3319.         *) dflt=n;;
  3320.         esac
  3321.         echo " "
  3322.         rp='Are you getting the hosts file via yellow pages?'
  3323.         . ./myread
  3324.         case "$ans" in
  3325.         y*) hostcat='ypcat hosts';;
  3326.         *) hostcat='cat /etc/hosts';;
  3327.         esac
  3328.         ;;
  3329.     esac
  3330. fi
  3331.  
  3332. : now get the host name
  3333. echo " "
  3334. echo "Figuring out host name..." >&4
  3335. case "$myhostname" in
  3336. '') cont=true
  3337.     echo 'Maybe "hostname" will work...'
  3338.     if tans=`sh -c hostname 2>&1` ; then
  3339.         myhostname=$tans
  3340.         phostname=hostname
  3341.         cont=''
  3342.     fi
  3343.     ;;
  3344. *) cont='';;
  3345. esac
  3346. if $test "$cont"; then
  3347.     if ./xenix; then
  3348.         echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
  3349.         if tans=`cat /etc/systemid 2>&1` ; then
  3350.             myhostname=$tans
  3351.             phostname='cat /etc/systemid'
  3352.             echo "Whadyaknow.  Xenix always was a bit strange..."
  3353.             cont=''
  3354.         fi
  3355.     elif $test -r /etc/systemid; then
  3356.         echo "(What is a non-Xenix system doing with /etc/systemid?)"
  3357.     fi
  3358. fi
  3359. if $test "$cont"; then
  3360.     echo 'No, maybe "uuname -l" will work...'
  3361.     if tans=`sh -c 'uuname -l' 2>&1` ; then
  3362.         myhostname=$tans
  3363.         phostname='uuname -l'
  3364.     else
  3365.         echo 'Strange.  Maybe "uname -n" will work...'
  3366.         if tans=`sh -c 'uname -n' 2>&1` ; then
  3367.             myhostname=$tans
  3368.             phostname='uname -n'
  3369.         else
  3370.             echo 'Oh well, maybe I can mine it out of whoami.h...'
  3371.             if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
  3372.                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
  3373.                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
  3374.             else
  3375.                 case "$myhostname" in
  3376.                 '') echo "Does this machine have an identity crisis or something?"
  3377.                     phostname='';;
  3378.                 *)
  3379.                     echo "Well, you said $myhostname before..."
  3380.                     phostname='echo $myhostname';;
  3381.                 esac
  3382.             fi
  3383.         fi
  3384.     fi
  3385. fi
  3386. : you do not want to know about this
  3387. set $myhostname
  3388. myhostname=$1
  3389.  
  3390. : verify guess
  3391. if $test "$myhostname" ; then
  3392.     dflt=y
  3393.     rp='Your host name appears to be "'$myhostname'".'" Right?"
  3394.     . ./myread
  3395.     case "$ans" in
  3396.     y*) ;;
  3397.     *) myhostname='';;
  3398.     esac
  3399. fi
  3400.  
  3401. : bad guess or no guess
  3402. while $test "X$myhostname" = X ; do
  3403.     dflt=''
  3404.     rp="Please type the (one word) name of your host:"
  3405.     . ./myread
  3406.     myhostname="$ans"
  3407. done
  3408.  
  3409. : translate upper to lower if necessary
  3410. case "$myhostname" in
  3411. *[A-Z]*)
  3412.     echo "(Normalizing case in your host name)"
  3413.     myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
  3414.     ;;
  3415. esac
  3416.  
  3417. case "$myhostname" in
  3418. *.*)
  3419.     dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
  3420.     myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
  3421.     echo "(Trimming domain name from host name--host name is now $myhostname)"
  3422.     ;;
  3423. *) case "$mydomain" in
  3424.     '')
  3425.         {
  3426.             : If we use NIS, try ypmatch.
  3427.             : Is there some reason why this was not done before?
  3428.             test "X$hostcat" = "Xypcat hosts" &&
  3429.             ypmatch "$myhostname" hosts 2>/dev/null |\
  3430.                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
  3431.             $test -s hosts
  3432.         } || {
  3433.             : Extract only the relevant hosts, reducing file size,
  3434.             : remove comments, insert trailing space for later use.
  3435.                  $hostcat | $sed -n -e "s/[     ]*#.*//; s/\$/ /
  3436.                     /[     ]$myhostname[    . ]/p" > hosts
  3437.         }
  3438.         tmp_re="[    . ]"
  3439.         $test x`$awk "/[0-9].*[     ]$myhostname$tmp_re/ { sum++ }
  3440.                  END { print sum }" hosts` = x1 || tmp_re="[     ]"
  3441.         dflt=.`$awk "/[0-9].*[     ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
  3442.             hosts | $sort | $uniq | \
  3443.             $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
  3444.         case `$echo X$dflt` in
  3445.         X*\ *)    echo "(Several hosts in /etc/hosts matched hostname)"
  3446.             dflt=.
  3447.             ;;
  3448.         .) echo "(You do not have fully-qualified names in /etc/hosts)"
  3449.             ;;
  3450.         esac
  3451.         case "$dflt" in
  3452.         .)
  3453.             tans=`./loc resolv.conf X /etc /usr/etc`
  3454.             if $test -f "$tans"; then
  3455.                 echo "(Attempting domain name extraction from $tans)"
  3456.                 : Why was there an Egrep here, when Sed works?
  3457.                 dflt=.`$sed -n -e 's/^domain[     ]*\(.*\)/\1/p' $tans \
  3458.                     | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
  3459.             fi
  3460.             ;;
  3461.         esac
  3462.         case "$dflt" in
  3463.         .) echo "(No help from resolv.conf either -- attempting clever guess)"
  3464.             dflt=.`sh -c domainname 2>/dev/null`
  3465.             case "$dflt" in
  3466.             '') dflt='.';;
  3467.             .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
  3468.             esac
  3469.             ;;
  3470.         esac
  3471.         case "$dflt" in
  3472.         .) echo "(Lost all hope -- silly guess then)"
  3473.             dflt='.uucp'
  3474.             ;;
  3475.         esac
  3476.         $rm -f hosts
  3477.         ;;
  3478.     *) dflt="$mydomain";;
  3479.     esac;;
  3480. esac
  3481. echo " "
  3482. rp="What is your domain name?"
  3483. . ./myread
  3484. tans="$ans"
  3485. case "$ans" in
  3486. '') ;;
  3487. .*) ;;
  3488. *) tans=".$tans";;
  3489. esac
  3490. mydomain="$tans"
  3491.  
  3492. : translate upper to lower if necessary
  3493. case "$mydomain" in
  3494. *[A-Z]*)
  3495.     echo "(Normalizing case in your domain name)"
  3496.     mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
  3497.     ;;
  3498. esac
  3499.  
  3500. : a little sanity check here
  3501. case "$phostname" in
  3502. '') ;;
  3503. *)
  3504.     case `$phostname | ./tr '[A-Z]' '[a-z]'` in
  3505.     $myhostname$mydomain|$myhostname) ;;
  3506.     *)
  3507.         case "$phostname" in
  3508.         sed*)
  3509.             echo "(That doesn't agree with your whoami.h file, by the way.)"
  3510.             ;;
  3511.         *)
  3512.             echo "(That doesn't agree with your $phostname command, by the way.)"
  3513.             ;;
  3514.         esac
  3515.     ;;
  3516.     esac
  3517.     ;;
  3518. esac
  3519.  
  3520. $cat <<EOM
  3521.  
  3522. I need to get your e-mail address in Internet format if possible, i.e.
  3523. something like user@host.domain. Please answer accurately since I have
  3524. no easy means to double check it. The default value provided below
  3525. is most probably close to the reality but may not be valid from outside
  3526. your organization...
  3527.  
  3528. EOM
  3529. cont=x
  3530. while test "$cont"; do
  3531.     case "$cf_email" in
  3532.     '') dflt="$cf_by@$myhostname$mydomain";;
  3533.     *) dflt="$cf_email";;
  3534.     esac
  3535.     rp='What is your e-mail address?'
  3536.     . ./myread
  3537.     cf_email="$ans"
  3538.     case "$cf_email" in
  3539.     *@*.*) cont='' ;;
  3540.     *)
  3541.         rp='Address does not look like an Internet one.  Use it anyway?'
  3542.         case "$fastread" in
  3543.         yes) dflt=y ;;
  3544.         *) dflt=n ;;
  3545.         esac
  3546.         . ./myread
  3547.         case "$ans" in
  3548.         y*) cont='' ;;
  3549.         *) echo " " ;;
  3550.         esac
  3551.         ;;
  3552.     esac
  3553. done
  3554.  
  3555. $cat <<EOM
  3556.  
  3557. If you or somebody else will be maintaining perl at your site, please
  3558. fill in the correct e-mail address here so that they may be contacted
  3559. if necessary. Currently, the "perlbug" program included with perl
  3560. will send mail to this address in addition to perlbug@perl.com. You may
  3561. enter "none" for no administrator.
  3562.  
  3563. EOM
  3564. case "$perladmin" in
  3565. '') dflt="$cf_email";;
  3566. *) dflt="$perladmin";;
  3567. esac
  3568. rp='Perl administrator e-mail address'
  3569. . ./myread
  3570. perladmin="$ans"
  3571.  
  3572. : determine where public executable scripts go
  3573. set scriptdir scriptdir
  3574. eval $prefixit
  3575. case "$scriptdir" in
  3576. '')
  3577.     dflt="$bin"
  3578.     : guess some guesses
  3579.     $test -d /usr/share/scripts && dflt=/usr/share/scripts
  3580.     $test -d /usr/share/bin && dflt=/usr/share/bin
  3581.     $test -d /usr/local/script && dflt=/usr/local/script
  3582.     $test -d $prefixexp/script && dflt=$prefixexp/script
  3583.     set dflt
  3584.     eval $prefixup
  3585.     ;;
  3586. *)  dflt="$scriptdir"
  3587.     ;;
  3588. esac
  3589. $cat <<EOM
  3590.  
  3591. Some installations have a separate directory just for executable scripts so
  3592. that they can mount it across multiple architectures but keep the scripts in
  3593. one spot.  You might, for example, have a subdirectory of /usr/share for this.
  3594. Or you might just lump your scripts in with all your other executables.
  3595.  
  3596. EOM
  3597. fn=d~
  3598. rp='Where do you keep publicly executable scripts?'
  3599. . ./getfile
  3600. if $test "X$ansexp" != "X$scriptdirexp"; then
  3601.     installscript=''
  3602. fi
  3603. scriptdir="$ans"
  3604. scriptdirexp="$ansexp"
  3605. if $afs; then
  3606.     $cat <<EOM
  3607.  
  3608. Since you are running AFS, I need to distinguish the directory in which
  3609. scripts reside from the directory in which they are installed (and from
  3610. which they are presumably copied to the former directory by occult means).
  3611.  
  3612. EOM
  3613.     case "$installscript" in
  3614.     '') dflt=`echo $scriptdirexp | sed 's#^/afs/#/afs/.#'`;;
  3615.     *) dflt="$installscript";;
  3616.     esac
  3617.     fn=de~
  3618.     rp='Where will public scripts be installed?'
  3619.     . ./getfile
  3620.     installscript="$ans"
  3621. else
  3622.     installscript="$scriptdirexp"
  3623. fi
  3624.  
  3625. : determine perl absolute location
  3626. case "$perlpath" in
  3627. '')    perlpath=$binexp/perl ;;
  3628. esac
  3629.  
  3630. : figure out how to guarantee perl startup
  3631. case "$startperl" in
  3632. '')
  3633.     case "$sharpbang" in
  3634.     *!)
  3635.         $cat <<EOH
  3636.  
  3637. I can use the #! construct to start perl on your system. This will
  3638. make startup of perl scripts faster, but may cause problems if you
  3639. want to share those scripts and perl is not in a standard place
  3640. ($perlpath) on all your platforms. The alternative is to force
  3641. a shell by starting the script with a single ':' character.
  3642.  
  3643. EOH
  3644.         dflt=$perlpath
  3645.         rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
  3646.         . ./myread
  3647.         case "$ans" in
  3648.         none) startperl=": # use perl";;
  3649.         *) startperl="#!$ans";;
  3650.         esac
  3651.         ;;
  3652.     *) startperl=": # use perl"
  3653.         ;;
  3654.     esac
  3655.     ;;
  3656. esac
  3657. echo "I'll use $startperl to start perl scripts."
  3658.  
  3659. : see how we invoke the C preprocessor
  3660. echo " "
  3661. echo "Now, how can we feed standard input to your C preprocessor..." >&4
  3662. cat <<'EOT' >testcpp.c
  3663. #define ABC abc
  3664. #define XYZ xyz
  3665. ABC.XYZ
  3666. EOT
  3667. cd ..
  3668. echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
  3669. chmod 755 cppstdin
  3670. wrapper=`pwd`/cppstdin
  3671. ok='false'
  3672. cd UU
  3673.  
  3674. if $test "X$cppstdin" != "X" && \
  3675.     $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
  3676.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
  3677. then
  3678.     echo "You used to use $cppstdin $cppminus so we'll use that again."
  3679.     case "$cpprun" in
  3680.     '') echo "But let's see if we can live without a wrapper..." ;;
  3681.     *)
  3682.         if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
  3683.             $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
  3684.         then
  3685.             echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
  3686.             ok='true'
  3687.         else
  3688.             echo "(However, $cpprun $cpplast does not work, let's see...)"
  3689.         fi
  3690.         ;;
  3691.     esac
  3692. else
  3693.     case "$cppstdin" in
  3694.     '') ;;
  3695.     *)
  3696.         echo "Good old $cppstdin $cppminus does not seem to be of any help..."
  3697.         ;;
  3698.     esac
  3699. fi
  3700.  
  3701. if $ok; then
  3702.     : nothing
  3703. elif echo 'Maybe "'"$cc"' -E" will work...'; \
  3704.     $cc -E <testcpp.c >testcpp.out 2>&1; \
  3705.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  3706.     echo "Yup, it does."
  3707.     x_cpp="$cc -E"
  3708.     x_minus='';
  3709. elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
  3710.     $cc -E - <testcpp.c >testcpp.out 2>&1; \
  3711.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  3712.     echo "Yup, it does."
  3713.     x_cpp="$cc -E"
  3714.     x_minus='-';
  3715. elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
  3716.     $cc -P <testcpp.c >testcpp.out 2>&1; \
  3717.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  3718.     echo "Yipee, that works!"
  3719.     x_cpp="$cc -P"
  3720.     x_minus='';
  3721. elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
  3722.     $cc -P - <testcpp.c >testcpp.out 2>&1; \
  3723.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  3724.     echo "At long last!"
  3725.     x_cpp="$cc -P"
  3726.     x_minus='-';
  3727. elif echo 'No such luck, maybe "'$cpp'" will work...'; \
  3728.     $cpp <testcpp.c >testcpp.out 2>&1; \
  3729.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  3730.     echo "It works!"
  3731.     x_cpp="$cpp"
  3732.     x_minus='';
  3733. elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
  3734.     $cpp - <testcpp.c >testcpp.out 2>&1; \
  3735.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  3736.     echo "Hooray, it works!  I was beginning to wonder."
  3737.     x_cpp="$cpp"
  3738.     x_minus='-';
  3739. elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
  3740.     $wrapper <testcpp.c >testcpp.out 2>&1; \
  3741.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  3742.     x_cpp="$wrapper"
  3743.     x_minus=''
  3744.     echo "Eureka!"
  3745. else
  3746.     dflt=''
  3747.     rp="No dice.  I can't find a C preprocessor.  Name one:"
  3748.     . ./myread
  3749.     x_cpp="$ans"
  3750.     x_minus=''
  3751.     $x_cpp <testcpp.c >testcpp.out 2>&1
  3752.     if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  3753.         echo "OK, that will do." >&4
  3754.     else
  3755. echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
  3756.         exit 1
  3757.     fi
  3758. fi
  3759.  
  3760. case "$ok" in
  3761. false)
  3762.     cppstdin="$x_cpp"
  3763.     cppminus="$x_minus"
  3764.     cpprun="$x_cpp"
  3765.     cpplast="$x_minus"
  3766.     set X $x_cpp
  3767.     shift
  3768.     case "$1" in
  3769.     "$cpp")
  3770.         echo "Perhaps can we force $cc -E using a wrapper..."
  3771.         if $wrapper <testcpp.c >testcpp.out 2>&1; \
  3772.             $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
  3773.         then
  3774.             echo "Yup, we can."
  3775.             cppstdin="$wrapper"
  3776.             cppminus='';
  3777.         else
  3778.             echo "Nope, we'll have to live without it..."
  3779.         fi
  3780.         ;;
  3781.     esac
  3782.     case "$cpprun" in
  3783.     "$wrapper")
  3784.         cpprun=''
  3785.         cpplast=''
  3786.         ;;
  3787.     esac
  3788.     ;;
  3789. esac
  3790.  
  3791. case "$cppstdin" in
  3792. "$wrapper") ;;
  3793. *) $rm -f $wrapper;;
  3794. esac
  3795. $rm -f testcpp.c testcpp.out
  3796.  
  3797. : Set private lib path
  3798. case "$plibpth" in
  3799. '') if ./mips; then
  3800.         plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
  3801.     fi;;
  3802. esac
  3803. case "$libpth" in
  3804. ' ') dlist='';;
  3805. '') dlist="$loclibpth $plibpth $glibpth";;
  3806. *) dlist="$libpth";;
  3807. esac
  3808.  
  3809. : Now check and see which directories actually exist, avoiding duplicates
  3810. libpth=''
  3811. for xxx in $dlist
  3812. do
  3813.     if $test -d $xxx; then
  3814.         case " $libpth " in
  3815.         *" $xxx "*) ;;
  3816.         *) libpth="$libpth $xxx";;
  3817.         esac
  3818.     fi
  3819. done
  3820. $cat <<'EOM'
  3821.  
  3822. Some systems have incompatible or broken versions of libraries.  Among
  3823. the directories listed in the question below, please remove any you
  3824. know not to be holding relevant libraries, and add any that are needed.
  3825. Say "none" for none.
  3826.  
  3827. EOM
  3828. case "$libpth" in
  3829. '') dflt='none';;
  3830. *)
  3831.     set X $libpth
  3832.     shift
  3833.     dflt=${1+"$@"}
  3834.     ;;
  3835. esac
  3836. rp="Directories to use for library searches?"
  3837. . ./myread
  3838. case "$ans" in
  3839. none) libpth=' ';;
  3840. *) libpth="$ans";;
  3841. esac
  3842.  
  3843. : determine optimize, if desired, or use for debug flag also
  3844. case "$optimize" in
  3845. ' ') dflt='none';;
  3846. '') dflt='-O';;
  3847. *) dflt="$optimize";;
  3848. esac
  3849. $cat <<EOH
  3850.  
  3851. Some C compilers have problems with their optimizers, by default, $package
  3852. compiles with the -O flag to use the optimizer.  Alternately, you might want
  3853. to use the symbolic debugger, which uses the -g flag (on traditional Unix
  3854. systems).  Either flag can be specified here.  To use neither flag, specify
  3855. the word "none".
  3856.  
  3857. EOH
  3858. rp="What optimizer/debugger flag should be used?"
  3859. . ./myread
  3860. optimize="$ans"
  3861. case "$optimize" in
  3862. 'none') optimize=" ";;
  3863. esac
  3864.  
  3865. dflt=''
  3866. : We will not override a previous value, but we might want to
  3867. : augment a hint file
  3868. case "$hint" in
  3869. none|recommended)
  3870.     case "$gccversion" in
  3871.     1*) dflt='-fpcc-struct-return' ;;
  3872.     esac
  3873.     case "$optimize" in
  3874.     *-g*) dflt="$dflt -DDEBUGGING";;
  3875.     esac
  3876.     case "$gccversion" in
  3877.     2*) if test -d /etc/conf/kconfig.d &&
  3878.             $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
  3879.         then
  3880.             dflt="$dflt -posix"
  3881.         fi
  3882.         ;;
  3883.     esac
  3884.     ;;
  3885. esac
  3886.  
  3887. case "$mips_type" in
  3888. *BSD*|'') inclwanted="$locincpth $usrinc";;
  3889. *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
  3890. esac
  3891. for thisincl in $inclwanted; do
  3892.     if $test -d $thisincl; then
  3893.         if $test x$thisincl != x$usrinc; then
  3894.             case "$dflt" in
  3895.             *$thisincl*);;
  3896.             *) dflt="$dflt -I$thisincl";;
  3897.             esac
  3898.         fi
  3899.     fi
  3900. done
  3901.  
  3902. inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
  3903.     xxx=true;
  3904. elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
  3905.     xxx=true;
  3906. else
  3907.     xxx=false;
  3908. fi;
  3909. if $xxx; then
  3910.     case "$dflt" in
  3911.     *$2*);;
  3912.     *) dflt="$dflt -D$2";;
  3913.     esac;
  3914. fi'
  3915.  
  3916. if ./osf1; then
  3917.     set signal.h __LANGUAGE_C__; eval $inctest
  3918. else
  3919.     set signal.h LANGUAGE_C; eval $inctest
  3920. fi
  3921. set signal.h NO_PROTOTYPE; eval $inctest
  3922. set signal.h _NO_PROTO; eval $inctest
  3923.  
  3924. case "$hint" in
  3925. none|recommended) dflt="$ccflags $dflt" ;;
  3926. *) dflt="$ccflags";;
  3927. esac
  3928.  
  3929. case "$dflt" in
  3930. ''|' ') dflt=none;;
  3931. esac
  3932. $cat <<EOH
  3933.  
  3934. Your C compiler may want other flags.  For this question you should include
  3935. -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
  3936. but you should NOT include libraries or ld flags like -lwhatever.  If you
  3937. want $package to honor its debug switch, you should include -DDEBUGGING here.
  3938. Your C compiler might also need additional flags, such as -D_POSIX_SOURCE,
  3939. -DHIDEMYMALLOC or -DCRIPPLED_CC.
  3940.  
  3941. To use no flags, specify the word "none".
  3942.  
  3943. EOH
  3944. set X $dflt
  3945. shift
  3946. dflt=${1+"$@"}
  3947. rp="Any additional cc flags?"
  3948. . ./myread
  3949. case "$ans" in
  3950. none) ccflags='';;
  3951. *) ccflags="$ans";;
  3952. esac
  3953.  
  3954. : the following weeds options from ccflags that are of no interest to cpp
  3955. cppflags="$ccflags"
  3956. case "$gccversion" in
  3957. 1*) cppflags="$cppflags -D__GNUC__"
  3958. esac
  3959. case "$mips_type" in
  3960. '');;
  3961. *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
  3962. esac
  3963. case "$cppflags" in
  3964. '');;
  3965. *)
  3966.     echo " "
  3967.     echo "Let me guess what the preprocessor flags are..." >&4
  3968.     set X $cppflags
  3969.     shift
  3970.     cppflags=''
  3971.     $cat >cpp.c <<'EOM'
  3972. #define BLURFL foo
  3973.  
  3974. BLURFL xx LFRULB
  3975. EOM
  3976.     previous=''
  3977.     for flag in $*
  3978.     do
  3979.         case "$flag" in
  3980.         -*) ftry="$flag";;
  3981.         *) ftry="$previous $flag";;
  3982.         esac
  3983.         if $cppstdin -DLFRULB=bar $ftry $cppminus <cpp.c \
  3984.             >cpp1.out 2>/dev/null && \
  3985.             $cpprun -DLFRULB=bar $ftry $cpplast <cpp.c \
  3986.             >cpp2.out 2>/dev/null && \
  3987.             $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
  3988.             $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
  3989.         then
  3990.             cppflags="$cppflags $ftry"
  3991.             previous=''
  3992.         else
  3993.             previous="$flag"
  3994.         fi
  3995.     done
  3996.     set X $cppflags
  3997.     shift
  3998.     cppflags=${1+"$@"}
  3999.     case "$cppflags" in
  4000.     *-*)  echo "They appear to be: $cppflags";;
  4001.     esac
  4002.     $rm -f cpp.c cpp?.out
  4003.     ;;
  4004. esac
  4005.  
  4006. : flags used in final linking phase
  4007.  
  4008. case "$ldflags" in
  4009. '') if ./venix; then
  4010.         dflt='-i -z'
  4011.     else
  4012.         dflt=''
  4013.     fi
  4014.     case "$ccflags" in
  4015.     *-posix*) dflt="$dflt -posix" ;;
  4016.     esac
  4017.     ;;
  4018. *) dflt="$ldflags";;
  4019. esac
  4020.  
  4021. : Try to guess additional flags to pick up local libraries.
  4022. for thislibdir in $libpth; do
  4023.     case " $loclibpth " in
  4024.     *" $thislibdir "*)
  4025.         case "$dflt " in 
  4026.         *"-L$thislibdir "*) ;;
  4027.         *)  dflt="$dflt -L$thislibdir" ;;
  4028.         esac
  4029.         ;;
  4030.     esac
  4031. done
  4032.  
  4033. case "$dflt" in
  4034. '') dflt='none' ;;
  4035. esac
  4036.  
  4037. $cat <<EOH
  4038.  
  4039. Your C linker may need flags.  For this question you should
  4040. include -L/whatever and any other flags used by the C linker, but you
  4041. should NOT include libraries like -lwhatever.
  4042.  
  4043. Make sure you include the appropriate -L/path flags if your C linker
  4044. does not normally search all of the directories you specified above,
  4045. namely
  4046.     $libpth
  4047. To use no flags, specify the word "none".
  4048.  
  4049. EOH
  4050.  
  4051. rp="Any additional ld flags (NOT including libraries)?"
  4052. . ./myread
  4053. case "$ans" in
  4054. none) ldflags='';;
  4055. *) ldflags="$ans";;
  4056. esac
  4057. rmlist="$rmlist pdp11"
  4058.  
  4059. : coherency check
  4060. echo " "
  4061. echo "Checking your choice of C compiler and flags for coherency..." >&4
  4062. set X $cc $optimize $ccflags $ldflags try.c -o try
  4063. shift
  4064. $cat >try.msg <<EOM
  4065. I've tried to compile and run a simple program with:
  4066.  
  4067.     $*
  4068.     ./try
  4069.  
  4070. and I got the following output:
  4071.  
  4072. EOM
  4073. $cat > try.c <<'EOF'
  4074. #include <stdio.h>
  4075. main() { exit(0); }
  4076. EOF
  4077. dflt=y
  4078. if sh -c "$cc $optimize $ccflags try.c -o try $ldflags" >>try.msg 2>&1; then
  4079.     if sh -c './try' >>try.msg 2>&1; then
  4080.         dflt=n
  4081.     else
  4082.         echo "The program compiled OK, but exited with status $?." >>try.msg
  4083.         rp="You have a problem.  Shall I abort Configure"
  4084.         dflt=y
  4085.     fi
  4086. else
  4087.     echo "I can't compile the test program." >>try.msg
  4088.     rp="You have a BIG problem.  Shall I abort Configure"
  4089.     dflt=y
  4090. fi
  4091. case "$dflt" in
  4092. y)
  4093.     $cat try.msg
  4094.     case "$knowitall" in
  4095.     '')
  4096.         echo "(The supplied flags might be incorrect with this C compiler.)"
  4097.         ;;
  4098.     *) dflt=n;;
  4099.     esac
  4100.     echo " "
  4101.     . ./myread
  4102.     case "$ans" in
  4103.     n*|N*) ;;
  4104.     *)    echo "Ok.  Stopping Configure." >&4
  4105.         exit 1
  4106.         ;;
  4107.     esac
  4108.     ;;
  4109. n) echo "OK, that should do.";;
  4110. esac
  4111. $rm -f try try.* core
  4112.  
  4113. : compute shared library extension
  4114. case "$so" in
  4115. '')
  4116.     if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
  4117.         dflt='sl'
  4118.     else
  4119.         dflt='so'
  4120.     fi
  4121.     ;;
  4122. *) dflt="$so";;
  4123. esac
  4124. $cat <<EOM
  4125.  
  4126. On some systems, shared libraries may be available.  Answer 'none' if
  4127. you want to suppress searching of shared libraries for the remaining
  4128. of this configuration.
  4129.  
  4130. EOM
  4131. rp='What is the file extension used for shared libraries?'
  4132. . ./myread
  4133. so="$ans"
  4134.  
  4135. : Looking for optional libraries
  4136. echo " "
  4137. echo "Checking for optional libraries..." >&4
  4138. case "$libs" in
  4139. ' '|'') dflt='';;
  4140. *) dflt="$libs";;
  4141. esac
  4142. case "$libswanted" in
  4143. '') libswanted='c_s';;
  4144. esac
  4145. for thislib in $libswanted; do
  4146.     
  4147.     if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`; $test -f "$xxx"; then
  4148.         echo "Found -l$thislib (shared)."
  4149.         case " $dflt " in
  4150.         *"-l$thislib "*);;
  4151.         *) dflt="$dflt -l$thislib";;
  4152.         esac
  4153.     elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
  4154.         echo "Found -l$thislib (shared)."
  4155.         case " $dflt " in
  4156.         *"-l$thislib "*);;
  4157.         *) dflt="$dflt -l$thislib";;
  4158.         esac
  4159.     elif xxx=`./loc lib$thislib.a X $libpth`; $test -f "$xxx"; then
  4160.         echo "Found -l$thislib."
  4161.         case " $dflt " in
  4162.         *"-l$thislib "*);;
  4163.         *) dflt="$dflt -l$thislib";;
  4164.         esac
  4165.     elif xxx=`./loc $thislib.a X $libpth`; $test -f "$xxx"; then
  4166.         echo "Found -l$thislib."
  4167.         case " $dflt " in
  4168.         *"-l$thislib "*);;
  4169.         *) dflt="$dflt -l$thislib";;
  4170.         esac
  4171.     elif xxx=`./loc lib${thislib}_s.a X $libpth`; $test -f "$xxx"; then
  4172.         echo "Found -l${thislib}_s."
  4173.         case " $dflt " in
  4174.         *"-l$thislib "*);;
  4175.         *) dflt="$dflt -l${thislib}_s";;
  4176.         esac
  4177.     elif xxx=`./loc Slib$thislib.a X $xlibpth`; $test -f "$xxx"; then
  4178.         echo "Found -l$thislib."
  4179.         case " $dflt " in
  4180.         *"-l$thislib "*);;
  4181.         *) dflt="$dflt -l$thislib";;
  4182.         esac
  4183.     else
  4184.         echo "No -l$thislib."
  4185.     fi
  4186. done
  4187. set X $dflt
  4188. shift
  4189. dflt="$*"
  4190. case "$libs" in
  4191. '') dflt="$dflt";;
  4192. *) dflt="$libs";;
  4193. esac
  4194. case "$dflt" in
  4195. ' '|'') dflt='none';;
  4196. esac
  4197.  
  4198. $cat <<EOM
  4199.  
  4200. Some versions of Unix support shared libraries, which make executables smaller
  4201. but make load time slightly longer.
  4202.  
  4203. On some systems, mostly newer Unix System V's, the shared library is included
  4204. by putting the option "-lc_s" as the last thing on the cc command line when
  4205. linking.  Other systems use shared libraries by default.  There may be other
  4206. libraries needed to compile $package on your machine as well.  If your system
  4207. needs the "-lc_s" option, include it here.  Include any other special libraries
  4208. here as well.  Say "none" for none.
  4209. EOM
  4210.  
  4211. echo " "
  4212. rp="Any additional libraries?"
  4213. . ./myread
  4214. case "$ans" in
  4215. none) libs=' ';;
  4216. *) libs="$ans";;
  4217. esac
  4218.  
  4219. : see if nm is to be used to determine whether a symbol is defined or not
  4220. case "$usenm" in
  4221. '')
  4222.     dflt=`egrep 'inlibc|csym' ../Configure | wc -l 2>/dev/null`
  4223.     if $test $dflt -gt 20; then
  4224.         dflt=y
  4225.     else
  4226.         dflt=n
  4227.     fi
  4228.     ;;
  4229. *)
  4230.     case "$usenm" in
  4231.     true) dflt=y;;
  4232.     *) dflt=n;;
  4233.     esac
  4234.     ;;
  4235. esac
  4236. $cat <<EOM
  4237.  
  4238. I can use 'nm' to extract the symbols from your C libraries. This is a time
  4239. consuming task which may generate huge output on the disk (up to 3 megabytes)
  4240. but that should make the symbols extraction faster. The alternative is to skip
  4241. the 'nm' extraction part and to compile a small test program instead to
  4242. determine whether each symbol is present. If you have a fast C compiler and/or
  4243. if your 'nm' output cannot be parsed, this may be the best solution.
  4244.  
  4245. EOM
  4246. rp='Shall I use nm to extract C symbols from the libraries?'
  4247. . ./myread
  4248. case "$ans" in
  4249. n|N) usenm=false;;
  4250. *) usenm=true;;
  4251. esac
  4252.  
  4253. runnm=$usenm
  4254. case "$reuseval" in
  4255. true) runnm=false;;
  4256. esac
  4257.  
  4258. : nm options which may be necessary
  4259. case "$nm_opt" in
  4260. '') if $test -f /mach_boot; then
  4261.         nm_opt=''
  4262.     elif $test -d /usr/ccs/lib; then
  4263.         nm_opt='-p'
  4264.     elif $test -f /dgux; then
  4265.         nm_opt='-p'
  4266.     else
  4267.         nm_opt=''
  4268.     fi;;
  4269. esac
  4270.  
  4271. : nm options which may be necessary for shared libraries but illegal
  4272. : for archive libraries.  Thank you, Linux.
  4273. case "$nm_so_opt" in
  4274. '')    case "$myuname" in
  4275.     *linux*)
  4276.         if nm --help | $grep 'dynamic' > /dev/null 2>&1; then
  4277.             nm_so_opt='--dynamic'
  4278.         fi
  4279.         ;;
  4280.     esac
  4281.     ;;
  4282. esac
  4283.  
  4284. case "$runnm" in
  4285. true)
  4286. : get list of predefined functions in a handy place
  4287. echo " "
  4288. case "$libc" in
  4289. '') libc=unknown
  4290.     case "$libs" in
  4291.     *-lc_s*) libc=`./loc libc_s.a $libc $libpth`
  4292.     esac
  4293.     ;;
  4294. esac
  4295. libnames='';
  4296. case "$libs" in
  4297. '') ;;
  4298. *)  for thislib in $libs; do
  4299.     case "$thislib" in
  4300.     -lc|-lc_s)
  4301.         : Handle C library specially below.
  4302.         ;;
  4303.     -l*)
  4304.         thislib=`echo $thislib | $sed -e 's/^-l//'`
  4305.         if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
  4306.             :
  4307.         elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
  4308.             :
  4309.         elif try=`./loc lib$thislib.a X $libpth`; $test -f "$try"; then
  4310.             :
  4311.         elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
  4312.             :
  4313.         elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
  4314.             :
  4315.         elif try=`./loc Slib$thislib.a X $xlibpth`; $test -f "$try"; then
  4316.             :
  4317.         else
  4318.             try=''
  4319.         fi
  4320.         libnames="$libnames $try"
  4321.         ;;
  4322.     *) libnames="$libnames $thislib" ;;
  4323.     esac
  4324.     done
  4325.     ;;
  4326. esac
  4327. xxx=normal
  4328. case "$libc" in
  4329. unknown)
  4330.     set /lib/libc.$so
  4331.     for xxx in $libpth; do
  4332.         $test -r $1 || set $xxx/libc.$so
  4333.         : The messy sed command sorts on library version numbers.
  4334.         $test -r $1 || \
  4335.             set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
  4336.                 tr ' ' '\012' | egrep -v '\.[A-Za-z]*$' | $sed -e '
  4337.                 h
  4338.                 s/[0-9][0-9]*/0000&/g
  4339.                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
  4340.                 G
  4341.                 s/\n/ /' | \
  4342.              sort | $sed -e 's/^.* //'`
  4343.         eval set \$$#
  4344.     done
  4345.     $test -r $1 || set /usr/ccs/lib/libc.$so
  4346.       $test -r $1 || set /lib/libsys_s.a
  4347.       ;;
  4348. *)
  4349.     set blurfl
  4350.     ;;
  4351. esac
  4352. if $test -r "$1"; then
  4353.     echo "Your (shared) C library seems to be in $1."
  4354.     libc="$1"
  4355. elif $test -r /lib/libc && $test -r /lib/clib; then
  4356.     echo "Your C library seems to be in both /lib/clib and /lib/libc."
  4357.     xxx=apollo
  4358.     libc='/lib/clib /lib/libc'
  4359.     if $test -r /lib/syslib; then
  4360.         echo "(Your math library is in /lib/syslib.)"
  4361.         libc="$libc /lib/syslib"
  4362.     fi
  4363. elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
  4364.     echo "Your C library seems to be in $libc, as you said before."
  4365. elif $test -r $incpath/usr/lib/libc.a; then
  4366.     libc=$incpath/usr/lib/libc.a;
  4367.     echo "Your C library seems to be in $libc.  That's fine."
  4368. elif $test -r /lib/libc.a; then
  4369.     libc=/lib/libc.a;
  4370.     echo "Your C library seems to be in $libc.  You're normal."
  4371. else
  4372.     if tans=`./loc libc.a blurfl/dyick $libpth`; $test -r "$tans"; then
  4373.         :
  4374.     elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
  4375.         libnames="$libnames "`./loc clib blurfl/dyick $libpth`
  4376.     elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
  4377.         :
  4378.     elif tans=`./loc Slibc.a blurfl/dyick $xlibpth`; $test -r "$tans"; then
  4379.         :
  4380.     elif tans=`./loc Mlibc.a blurfl/dyick $xlibpth`; $test -r "$tans"; then
  4381.         :
  4382.     else
  4383.         tans=`./loc Llibc.a blurfl/dyick $xlibpth`
  4384.     fi
  4385.     if $test -r "$tans"; then
  4386.         echo "Your C library seems to be in $tans, of all places."
  4387.         libc=$tans
  4388.     else
  4389.         libc='blurfl'
  4390.     fi
  4391. fi
  4392. if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
  4393.     dflt="$libc"
  4394.     cat <<EOM
  4395.  
  4396. If the guess above is wrong (which it might be if you're using a strange
  4397. compiler, or your machine supports multiple models), you can override it here.
  4398.  
  4399. EOM
  4400. else
  4401.     dflt=''
  4402.     echo $libpth | tr ' ' '\012' | sort | uniq > libpath
  4403.     cat >&4 <<EOM
  4404. I can't seem to find your C library.  I've looked in the following places:
  4405.  
  4406. EOM
  4407.     $sed 's/^/    /' libpath
  4408.     cat <<EOM
  4409.  
  4410. None of these seems to contain your C library. I need to get its name...
  4411.  
  4412. EOM
  4413. fi
  4414. fn=f
  4415. rp='Where is your C library?'
  4416. . ./getfile
  4417. libc="$ans"
  4418.  
  4419. echo " "
  4420. echo $libc $libnames | tr ' ' '\012' | sort | uniq > libnames
  4421. set X `cat libnames`
  4422. shift
  4423. xxx=files
  4424. case $# in 1) xxx=file; esac
  4425. echo "Extracting names from the following $xxx for later perusal:" >&4
  4426. echo " "
  4427. $sed 's/^/    /' libnames >&4
  4428. echo " "
  4429. $echo $n "This may take a while...$c" >&4
  4430.  
  4431. : Linux may need the special Dynamic option to nm for shared libraries.
  4432. : In general, this is stored in the nm_so_opt variable.
  4433. : Unfortunately, that option may be fatal on non-shared libraries.
  4434. for nm_libs_ext in $*; do
  4435.     case $nm_libs_ext in
  4436.     *$so*)    nm $nm_so_opt $nm_opt $nm_libs_ext 2>/dev/null ;;
  4437.     *)        nm $nm_opt $nm_libs_ext 2>/dev/null ;;
  4438.     esac
  4439. done > libc.tmp
  4440.  
  4441. $echo $n ".$c"
  4442. $grep fprintf libc.tmp > libc.ptf
  4443. xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
  4444. xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
  4445. xxx='[ADTSIW]'
  4446. if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx //p'";\
  4447.     eval $xscan;\
  4448.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  4449.         eval $xrun
  4450. elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
  4451.     eval $xscan;\
  4452.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  4453.         eval $xrun
  4454. elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
  4455.     eval $xscan;\
  4456.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  4457.         eval $xrun
  4458. elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
  4459.     eval $xscan;\
  4460.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  4461.         eval $xrun
  4462. elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
  4463.     eval $xscan;\
  4464.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  4465.         eval $xrun
  4466. elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
  4467.     eval $xscan;\
  4468.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  4469.         eval $xrun
  4470. elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
  4471.                 -e '/ file/d' -e 's/^\([^     ]*\).*/\1/p'";\
  4472.     eval $xscan;\
  4473.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  4474.         eval $xrun
  4475. elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
  4476.     eval $xscan;\
  4477.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  4478.         eval $xrun
  4479. elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
  4480.     eval $xscan;\
  4481.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  4482.         eval $xrun
  4483. elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
  4484.     eval $xscan;\
  4485.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  4486.         eval $xrun
  4487. elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
  4488.     eval $xscan;\
  4489.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  4490.         eval $xrun
  4491. else
  4492.     nm -p $* 2>/dev/null >libc.tmp
  4493.     $grep fprintf libc.tmp > libc.ptf
  4494.     if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
  4495.         eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
  4496.     then
  4497.         nm_opt='-p'
  4498.         eval $xrun
  4499.     else
  4500.         echo " "
  4501.         echo "nm didn't seem to work right. Trying ar instead..." >&4
  4502.         com=''
  4503.         if ar t $libc > libc.tmp; then
  4504.             for thisname in $libnames; do
  4505.                 ar t $thisname >>libc.tmp
  4506.             done
  4507.             $sed -e 's/\.o$//' < libc.tmp > libc.list
  4508.             echo "Ok." >&4
  4509.         else
  4510.             echo "ar didn't seem to work right." >&4
  4511.             echo "Maybe this is a Cray...trying bld instead..." >&4
  4512.             if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list
  4513.             then
  4514.                 for thisname in $libnames; do
  4515.                     bld t $libnames | \
  4516.                     $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
  4517.                     ar t $thisname >>libc.tmp
  4518.                 done
  4519.                 echo "Ok." >&4
  4520.             else
  4521.                 echo "That didn't work either.  Giving up." >&4
  4522.                 exit 1
  4523.             fi
  4524.         fi
  4525.     fi
  4526. fi
  4527. nm_extract="$com"
  4528. if $test -f /lib/syscalls.exp; then
  4529.     echo " "
  4530.     echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
  4531.     $sed -n 's/^\([^     ]*\)[     ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list
  4532. fi
  4533. ;;
  4534. esac
  4535. $rm -f libnames libpath
  4536.  
  4537. : is a C symbol defined?
  4538. csym='tlook=$1;
  4539. case "$3" in
  4540. -v) tf=libc.tmp; tc=""; tdc="";;
  4541. -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
  4542. *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
  4543. esac;
  4544. tx=yes;
  4545. case "$reuseval-$4" in
  4546. true-) ;;
  4547. true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
  4548. esac;
  4549. case "$tx" in
  4550. yes)
  4551.     case "$runnm" in
  4552.     true)
  4553.         if $contains $tlook $tf >/dev/null 2>&1;
  4554.         then tval=true;
  4555.         else tval=false;
  4556.         fi;;
  4557.     *)
  4558.         echo "main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
  4559.         if $cc $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
  4560.         then tval=true;
  4561.         else tval=false;
  4562.         fi;
  4563.         $rm -f t t.c;;
  4564.     esac;;
  4565. *)
  4566.     case "$tval" in
  4567.     $define) tval=true;;
  4568.     *) tval=false;;
  4569.     esac;;
  4570. esac;
  4571. eval "$2=$tval"'
  4572.  
  4573. : define an is-in-libc? function
  4574. inlibc='echo " "; td=$define; tu=$undef;
  4575. sym=$1; var=$2; eval "was=\$$2";
  4576. tx=yes;
  4577. case "$reuseval$was" in
  4578. true) ;;
  4579. true*) tx=no;;
  4580. esac;
  4581. case "$tx" in
  4582. yes)
  4583.     set $sym tres -f;
  4584.     eval $csym;
  4585.     case "$tres" in
  4586.     true)
  4587.         echo "$sym() found." >&4;
  4588.         case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
  4589.     *)
  4590.         echo "$sym() NOT found." >&4;
  4591.         case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
  4592.     esac;;
  4593. *)
  4594.     case "$was" in
  4595.     $define) echo "$sym() found." >&4;;
  4596.     *) echo "$sym() NOT found." >&4;;
  4597.     esac;;
  4598. esac'
  4599.  
  4600. : Check how to convert floats to strings.
  4601. echo " "
  4602. echo "Checking for an efficient way to convert floats to strings."
  4603. $cat >try.c <<'EOP'
  4604. #ifdef TRY_gconvert
  4605. #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
  4606. #endif
  4607. #ifdef TRY_gcvt
  4608. #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
  4609. #endif
  4610. #ifdef TRY_sprintf
  4611. #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
  4612. #endif
  4613. main() { 
  4614.     char buf[64]; 
  4615.     Gconvert(1.0, 8, 0, buf); 
  4616.     if (buf[0] != '1' || buf[1] != '\0')
  4617.         exit(1);
  4618.     Gconvert(0.0, 8, 0, buf); 
  4619.     if (buf[0] != '0' || buf[1] != '\0')
  4620.         exit(1);
  4621.     Gconvert(-1.0, 8, 0, buf); 
  4622.     if (buf[0] != '-' || buf[1] != '1' || buf[2] != '\0')
  4623.         exit(1);
  4624.     exit(0);
  4625. }
  4626. EOP
  4627. case "$d_Gconvert" in
  4628. gconvert*) xxx_list='gconvert gcvt sprintf' ;;
  4629. gcvt*) xxx_list='gcvt gconvert sprintf' ;;
  4630. sprintf*) xxx_list='sprintf gconvert gcvt' ;;
  4631. *) xxx_list='gconvert gcvt sprintf' ;;
  4632. esac
  4633.  
  4634. for xxx_convert in $xxx_list; do
  4635.     echo "Trying $xxx_convert"
  4636.     $rm -f try try.o
  4637.     if $cc $ccflags -DTRY_$xxx_convert $ldflags -o try \
  4638.         try.c $libs > /dev/null 2>&1 ; then
  4639.         echo "$xxx_convert" found. >&4
  4640.         if ./try; then
  4641.             echo "Good, $xxx_convert drops a trailing decimal point."
  4642.             echo "I'll use $xxx_convert to convert floats into a string." >&4
  4643.             break;
  4644.         else
  4645.             echo "But $xxx_convert keeps a trailing decimal point".
  4646.         fi
  4647.     else
  4648.         echo "$xxx_convert NOT found." >&4
  4649.     fi
  4650. done
  4651.         
  4652. case "$xxx_convert" in
  4653. gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
  4654. gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
  4655. *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
  4656. esac
  4657.  
  4658. : Initialize h_fcntl
  4659. h_fcntl=false
  4660.  
  4661. : Initialize h_sysfile
  4662. h_sysfile=false
  4663.  
  4664. : determine filename position in cpp output
  4665. echo " "
  4666. echo "Computing filename position in cpp output for #include directives..." >&4
  4667. echo '#include <stdio.h>' > foo.c
  4668. $cat >fieldn <<EOF
  4669. $startsh
  4670. $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
  4671. $grep '^[     ]*#.*stdio\.h' | \
  4672. while read cline; do
  4673.     pos=1
  4674.     set \$cline
  4675.     while $test \$# -gt 0; do
  4676.         if $test -r \`echo \$1 | $tr -d '"'\`; then
  4677.             echo "\$pos"
  4678.             exit 0
  4679.         fi
  4680.         shift
  4681.         pos=\`expr \$pos + 1\`
  4682.     done
  4683. done
  4684. EOF
  4685. chmod +x fieldn
  4686. fieldn=`./fieldn`
  4687. $rm -f foo.c fieldn
  4688. case $fieldn in
  4689. '') pos='???';;
  4690. 1) pos=first;;
  4691. 2) pos=second;;
  4692. 3) pos=third;;
  4693. *) pos="${fieldn}th";;
  4694. esac
  4695. echo "Your cpp writes the filename in the $pos field of the line."
  4696.  
  4697. : locate header file
  4698. $cat >findhdr <<EOF
  4699. $startsh
  4700. wanted=\$1
  4701. name=''
  4702. if test -f $usrinc/\$wanted; then
  4703.     echo "$usrinc/\$wanted"
  4704.     exit 0
  4705. fi
  4706. awkprg='{ print \$$fieldn }'
  4707. echo "#include <\$wanted>" > foo\$\$.c
  4708. $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
  4709. $grep "^[     ]*#.*\$wanted" | \
  4710. while read cline; do
  4711.     name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
  4712.     case "\$name" in
  4713.     */\$wanted) echo "\$name"; exit 0;;
  4714.     *) name='';;
  4715.     esac;
  4716. done;
  4717. $rm -f foo\$\$.c;
  4718. case "\$name" in
  4719. '') exit 1;;
  4720. esac
  4721. EOF
  4722. chmod +x findhdr
  4723.  
  4724. : access call always available on UNIX
  4725. set access d_access
  4726. eval $inlibc
  4727.  
  4728. : locate the flags for 'access()'
  4729. case "$d_access" in
  4730. "$define")
  4731.     echo " "
  4732.     $cat >access.c <<'EOCP'
  4733. #include <sys/types.h>
  4734. #ifdef I_FCNTL
  4735. #include <fcntl.h>
  4736. #endif
  4737. #ifdef I_SYS_FILE
  4738. #include <sys/file.h>
  4739. #endif
  4740. #ifdef I_UNISTD
  4741. #include <unistd.h>
  4742. #endif
  4743. main() {
  4744.     exit(R_OK);
  4745. }
  4746. EOCP
  4747.     : check sys/file.h first, no particular reason here
  4748.     if $test `./findhdr sys/file.h` && \
  4749.         $cc $cppflags -DI_SYS_FILE access.c -o access >/dev/null 2>&1 ; then
  4750.         h_sysfile=true;
  4751.         echo "<sys/file.h> defines the *_OK access constants." >&4
  4752.     elif $test `./findhdr fcntl.h` && \
  4753.         $cc $cppflags -DI_FCNTL access.c -o access >/dev/null 2>&1 ; then
  4754.         h_fcntl=true;
  4755.         echo "<fcntl.h> defines the *_OK access constants." >&4
  4756.     elif $test `./findhdr unistd.h` && \
  4757.         $cc $cppflags -DI_UNISTD access.c -o access >/dev/null 2>&1 ; then
  4758.         echo "<unistd.h> defines the *_OK access constants." >&4
  4759.     else
  4760.         echo "I can't find the four *_OK access constants--I'll use mine." >&4
  4761.     fi
  4762.     ;;
  4763. esac
  4764. $rm -f access*
  4765.  
  4766. : see if alarm exists
  4767. set alarm d_alarm
  4768. eval $inlibc
  4769.  
  4770. : Look for GNU-cc style attribute checking
  4771. echo " "
  4772. echo "Checking whether your compiler can handle __attribute__ ..." >&4
  4773. $cat >attrib.c <<'EOCP'
  4774. #include <stdio.h>
  4775. void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
  4776. EOCP
  4777. if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
  4778.     if $contains 'warning' attrib.out >/dev/null 2>&1; then
  4779.         echo "Your C compiler doesn't fully support __attribute__."
  4780.         val="$undef"
  4781.     else
  4782.         echo "Your C compiler supports __attribute__."
  4783.         val="$define"
  4784.     fi
  4785. else
  4786.     echo "Your C compiler doesn't seem to understand __attribute__ at all."
  4787.     val="$undef"
  4788. fi
  4789. set d_attribut
  4790. eval $setvar
  4791. $rm -f attrib*
  4792.  
  4793. : see if bcmp exists
  4794. set bcmp d_bcmp
  4795. eval $inlibc
  4796.  
  4797. : see if bcopy exists
  4798. set bcopy d_bcopy
  4799. eval $inlibc
  4800.  
  4801. : see if setpgrp exists
  4802. set setpgrp d_setpgrp
  4803. eval $inlibc
  4804.  
  4805. : see which flavor of setpgrp is in use
  4806. case "$d_setpgrp" in
  4807. "$define")
  4808.     echo " "
  4809.     $cat >set.c <<EOP
  4810. main()
  4811. {
  4812.     if (getuid() == 0) {
  4813.         printf("(I see you are running Configure as super-user...)\n");
  4814.         setuid(1);
  4815.     }
  4816.     if (-1 == setpgrp(1, 1))
  4817.         exit(1);
  4818.     exit(0);
  4819. }
  4820. EOP
  4821.     if $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1; then
  4822.         ./set 2>/dev/null
  4823.         case $? in
  4824.         0) echo "You have to use setpgrp() instead of setpgrp(pid, pgrp)." >&4
  4825.             val="$undef";;
  4826.         *) echo "You have to use setpgrp(pid, pgrp) instead of setpgrp()." >&4
  4827.             val="$define";;
  4828.         esac
  4829.     else
  4830.         if ./usg; then
  4831.             xxx="USG one, i.e. you use setpgrp()."
  4832.             val="$undef"
  4833.         else
  4834.             xxx="BSD one, i.e. you use setpgrp(pid, pgrp)."
  4835.             val="$define"
  4836.         fi
  4837.         echo "Assuming your setpgrp is a $xxx" >&4
  4838.     fi
  4839.     ;;
  4840. *) val="$undef";;
  4841. esac
  4842. set d_bsdpgrp
  4843. eval $setvar
  4844. $rm -f set set.c
  4845.  
  4846. : see if bzero exists
  4847. set bzero d_bzero
  4848. eval $inlibc
  4849.  
  4850. : check for length of integer
  4851. echo " "
  4852. case "$intsize" in
  4853. '')
  4854.     echo "Checking to see how big your integers are..." >&4
  4855.     $cat >try.c <<'EOCP'
  4856. #include <stdio.h>
  4857. main()
  4858. {
  4859.     printf("%d\n", sizeof(int));
  4860.     exit(0);
  4861. }
  4862. EOCP
  4863.     if $cc $ccflags try.c -o try >/dev/null 2>&1 && ./try > /dev/null; then
  4864.         intsize=`./try`
  4865.         echo "Your integers are $intsize bytes long."
  4866.     else
  4867.         dflt='4'
  4868.         echo "(I can't seem to compile the test program.  Guessing...)"
  4869.         rp="What is the size of an integer (in bytes)?"
  4870.         . ./myread
  4871.         intsize="$ans"
  4872.     fi
  4873.     ;;
  4874. esac
  4875. $rm -f try.c try
  4876.  
  4877. : see if signal is declared as pointer to function returning int or void
  4878. echo " "
  4879. xxx=`./findhdr signal.h`
  4880. $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
  4881. if $contains 'int.*\*[     ]*signal' $$.tmp >/dev/null 2>&1 ; then
  4882.     echo "You have int (*signal())() instead of void." >&4
  4883.     val="$undef"
  4884. elif $contains 'void.*\*[     ]*signal' $$.tmp >/dev/null 2>&1 ; then
  4885.     echo "You have void (*signal())() instead of int." >&4
  4886.     val="$define"
  4887. elif $contains 'extern[     ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
  4888.     echo "You have int (*signal())() instead of void." >&4
  4889.     val="$undef"
  4890. else
  4891.     case "$d_voidsig" in
  4892.     '')
  4893.     echo "I can't determine whether signal handler returns void or int..." >&4
  4894.         dflt=void
  4895.         rp="What type does your signal handler return?"
  4896.         . ./myread
  4897.         case "$ans" in
  4898.         v*) val="$define";;
  4899.         *) val="$undef";;
  4900.         esac;;
  4901.     "$define")
  4902.         echo "As you already told me, signal handler returns void." >&4;;
  4903.     *)
  4904.         echo "As you already told me, signal handler returns int." >&4;;
  4905.     esac
  4906. fi
  4907. set d_voidsig
  4908. eval $setvar
  4909. case "$d_voidsig" in
  4910. "$define") signal_t="void";;
  4911. *) signal_t="int";;
  4912. esac
  4913. $rm -f $$.tmp
  4914.  
  4915. : check for ability to cast large floats to 32-bit ints.
  4916. echo " "
  4917. echo 'Checking whether your C compiler can cast large floats to int32.' >&4
  4918. if $test "$intsize" -eq 4; then
  4919.     xxx=int
  4920. else
  4921.     xxx=long
  4922. fi
  4923. $cat >try.c <<EOCP
  4924. #include <sys/types.h>
  4925. #include <signal.h>
  4926. $signal_t blech() { exit(3); }
  4927. main()
  4928. {
  4929.     $xxx i32;
  4930.     double f;
  4931.     int result = 0;
  4932.     signal(SIGFPE, blech);
  4933.  
  4934.     f = (double) 0x7fffffff;
  4935.     f = 10 * f;
  4936.     i32  = ($xxx) f;
  4937.  
  4938.     if (i32 != ($xxx) f)
  4939.         result |= 1;
  4940.     exit(result);
  4941. }
  4942. EOCP
  4943. if $cc -o try $ccflags try.c >/dev/null 2>&1; then
  4944.     ./try
  4945.     yyy=$?
  4946. else
  4947.     echo "(I can't seem to compile the test program--assuming it can't)"
  4948.     yyy=1
  4949. fi
  4950. case "$yyy" in
  4951. 0)    val="$define"
  4952.     echo "Yup, it can."
  4953.     ;;
  4954. *)    val="$undef"
  4955.     echo "Nope, it can't."
  4956.     ;;
  4957. esac
  4958. set d_casti32
  4959. eval $setvar
  4960. $rm -f try try.*
  4961.  
  4962. : check for ability to cast negative floats to unsigned
  4963. echo " "
  4964. echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
  4965. $cat >try.c <<EOCP
  4966. #include <sys/types.h>
  4967. #include <signal.h>
  4968. $signal_t blech() { exit(7); }
  4969. $signal_t blech_in_list() { exit(4); }
  4970. unsigned long dummy_long(p) unsigned long p; { return p; }
  4971. unsigned int dummy_int(p) unsigned int p; { return p; }
  4972. unsigned short dummy_short(p) unsigned short p; { return p; }
  4973. main()
  4974. {
  4975.     double f = -123.;
  4976.     unsigned long along;
  4977.     unsigned int aint;
  4978.     unsigned short ashort;
  4979.     int result = 0;
  4980.  
  4981.     signal(SIGFPE, blech);
  4982.     along = (unsigned long)f;
  4983.     aint = (unsigned int)f;
  4984.     ashort = (unsigned short)f;
  4985.     if (along != (unsigned long)-123)
  4986.         result |= 1;
  4987.     if (aint != (unsigned int)-123)
  4988.         result |= 1;
  4989.     if (ashort != (unsigned short)-123)
  4990.         result |= 1;
  4991.     f = (double)0x40000000;
  4992.     f = f + f;
  4993.     along = 0;
  4994.     along = (unsigned long)f;
  4995.     if (along != 0x80000000)
  4996.         result |= 2;
  4997.     f -= 1.;
  4998.     along = 0;
  4999.     along = (unsigned long)f;
  5000.     if (along != 0x7fffffff)
  5001.         result |= 1;
  5002.     f += 2.;
  5003.     along = 0;
  5004.     along = (unsigned long)f;
  5005.     if (along != 0x80000001)
  5006.         result |= 2;
  5007.     if (result)
  5008.         exit(result);
  5009.     signal(SIGFPE, blech_in_list);
  5010.     f = 123.;
  5011.     along = dummy_long((unsigned long)f);
  5012.     aint = dummy_int((unsigned int)f);
  5013.     ashort = dummy_short((unsigned short)f);
  5014.     if (along != (unsigned long)123)
  5015.         result |= 4;
  5016.     if (aint != (unsigned int)123)
  5017.         result |= 4;
  5018.     if (ashort != (unsigned short)123)
  5019.         result |= 4;
  5020.     exit(result);
  5021.  
  5022. }
  5023. EOCP
  5024. if $cc -o try $ccflags try.c >/dev/null 2>&1; then
  5025.     ./try
  5026.     castflags=$?
  5027. else
  5028.     echo "(I can't seem to compile the test program--assuming it can't)"
  5029.     castflags=7
  5030. fi
  5031. case "$castflags" in
  5032. 0)    val="$define"
  5033.     echo "Yup, it can."
  5034.     ;;
  5035. *)    val="$undef"
  5036.     echo "Nope, it can't."
  5037.     ;;
  5038. esac
  5039. set d_castneg
  5040. eval $setvar
  5041. $rm -f try.*
  5042.  
  5043. : see if vprintf exists
  5044. echo " "
  5045. if set vprintf val -f d_vprintf; eval $csym; $val; then
  5046.     echo 'vprintf() found.' >&4
  5047.     val="$define"
  5048.     $cat >vprintf.c <<'EOF'
  5049. #include <varargs.h>
  5050.  
  5051. main() { xxx("foo"); }
  5052.  
  5053. xxx(va_alist)
  5054. va_dcl
  5055. {
  5056.     va_list args;
  5057.     char buf[10];
  5058.  
  5059.     va_start(args);
  5060.     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
  5061. }
  5062. EOF
  5063.     if $cc $ccflags vprintf.c -o vprintf >/dev/null 2>&1 && ./vprintf; then
  5064.         echo "Your vsprintf() returns (int)." >&4
  5065.         val2="$undef"
  5066.     else
  5067.         echo "Your vsprintf() returns (char*)." >&4
  5068.         val2="$define"
  5069.     fi
  5070. else
  5071.     echo 'vprintf() NOT found.' >&4
  5072.         val="$undef"
  5073.         val2="$undef"
  5074. fi
  5075. set d_vprintf
  5076. eval $setvar
  5077. val=$val2
  5078. set d_charvspr
  5079. eval $setvar
  5080.  
  5081. : see if chown exists
  5082. set chown d_chown
  5083. eval $inlibc
  5084.  
  5085. : see if chroot exists
  5086. set chroot d_chroot
  5087. eval $inlibc
  5088.  
  5089. : see if chsize exists
  5090. set chsize d_chsize
  5091. eval $inlibc
  5092.  
  5093. : check for const keyword
  5094. echo " "
  5095. echo 'Checking to see if your C compiler knows about "const"...' >&4
  5096. $cat >const.c <<'EOCP'
  5097. typedef struct spug { int drokk; } spug;
  5098. main()
  5099. {
  5100.     const char *foo;
  5101.     const spug y;
  5102. }
  5103. EOCP
  5104. if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
  5105.     val="$define"
  5106.     echo "Yup, it does."
  5107. else
  5108.     val="$undef"
  5109.     echo "Nope, it doesn't."
  5110. fi
  5111. set d_const
  5112. eval $setvar
  5113.  
  5114. : see if crypt exists
  5115. echo " "
  5116. if set crypt val -f d_crypt; eval $csym; $val; then
  5117.     echo 'crypt() found.' >&4
  5118.     val="$define"
  5119.     cryptlib=''
  5120. else
  5121.     cryptlib=`./loc Slibcrypt.a "" $xlibpth`
  5122.     if $test -z "$cryptlib"; then
  5123.         cryptlib=`./loc Mlibcrypt.a "" $xlibpth`
  5124.     else
  5125.         cryptlib=-lcrypt
  5126.     fi
  5127.     if $test -z "$cryptlib"; then
  5128.         cryptlib=`./loc Llibcrypt.a "" $xlibpth`
  5129.     else
  5130.         cryptlib=-lcrypt
  5131.     fi
  5132.     if $test -z "$cryptlib"; then
  5133.         cryptlib=`./loc libcrypt.a "" $libpth`
  5134.     else
  5135.         cryptlib=-lcrypt
  5136.     fi
  5137.     if $test -z "$cryptlib"; then
  5138.         echo 'crypt() NOT found.' >&4
  5139.         val="$undef"
  5140.     else
  5141.         val="$define"
  5142.     fi
  5143. fi
  5144. set d_crypt
  5145. eval $setvar
  5146.  
  5147. : get csh whereabouts
  5148. case "$csh" in
  5149. 'csh') val="$undef" ;;
  5150. *) val="$define" ;;
  5151. esac
  5152. set d_csh
  5153. eval $setvar
  5154. full_csh=$csh
  5155.  
  5156. : see if cuserid exists
  5157. set cuserid d_cuserid
  5158. eval $inlibc
  5159.  
  5160. : define an alternate in-header-list? function
  5161. inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
  5162. cont=true; xxf="echo \"<\$1> found.\" >&4";
  5163. case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
  5164. *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
  5165. esac;
  5166. case $# in 4) instead=instead;; *) instead="at last";; esac;
  5167. while $test "$cont"; do
  5168.     xxx=`./findhdr $1`
  5169.     var=$2; eval "was=\$$2";
  5170.     if $test "$xxx" && $test -r "$xxx";
  5171.     then eval $xxf;
  5172.     eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
  5173.         cont="";
  5174.     else eval $xxnf;
  5175.     eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
  5176.     set $yyy; shift; shift; yyy=$@;
  5177.     case $# in 0) cont="";;
  5178.     2) xxf="echo \"but I found <\$1> $instead.\" >&4";
  5179.         xxnf="echo \"and I did not find <\$1> either.\" >&4";;
  5180.     *) xxf="echo \"but I found <\$1\> instead.\" >&4";
  5181.         xxnf="echo \"there is no <\$1>, ...\" >&4";;
  5182.     esac;
  5183. done;
  5184. while $test "$yyy";
  5185. do set $yyy; var=$2; eval "was=\$$2";
  5186.     eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
  5187.     set $yyy; shift; shift; yyy=$@;
  5188. done'
  5189.  
  5190. : see if this is a limits.h system
  5191. set limits.h i_limits
  5192. eval $inhdr
  5193.  
  5194. : see if this is a float.h system
  5195. set float.h i_float
  5196. eval $inhdr
  5197.  
  5198. : See if number of significant digits in a double precision number is known
  5199. echo " "
  5200. $cat >dbl_dig.c <<EOM
  5201. #$i_limits I_LIMITS
  5202. #$i_float I_FLOAT
  5203. #ifdef I_LIMITS
  5204. #include <limits.h>
  5205. #endif
  5206. #ifdef I_FLOAT
  5207. #include <float.h>
  5208. #endif
  5209. #ifdef DBL_DIG
  5210. printf("Contains DBL_DIG");
  5211. #endif
  5212. EOM
  5213. $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
  5214. if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
  5215.     echo "DBL_DIG found." >&4
  5216.     val="$define"
  5217. else
  5218.     echo "DBL_DIG NOT found." >&4
  5219.     val="$undef"
  5220. fi
  5221. $rm -f dbl_dig.?
  5222. set d_dbl_dig
  5223. eval $setvar
  5224.  
  5225. : see if difftime exists
  5226. set difftime d_difftime
  5227. eval $inlibc
  5228.  
  5229. : see if this is a dirent system
  5230. echo " "
  5231. if xinc=`./findhdr dirent.h`; $test "$xinc"; then
  5232.     val="$define"
  5233.     echo "<dirent.h> found." >&4
  5234. else
  5235.     val="$undef"
  5236.     if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
  5237.         echo "<sys/dir.h> found." >&4
  5238.         echo " "
  5239.     else
  5240.         xinc=`./findhdr sys/ndir.h`
  5241.     fi
  5242.     echo "<dirent.h> NOT found." >&4
  5243. fi
  5244. set i_dirent
  5245. eval $setvar
  5246.  
  5247. : Look for type of directory structure.
  5248. echo " "
  5249. $cppstdin $cppflags $cppminus < "$xinc" > try.c
  5250.  
  5251. case "$direntrytype" in
  5252. ''|' ')
  5253.     case "$i_dirent" in
  5254.     $define) guess1='struct dirent' ;;
  5255.     *) guess1='struct direct'  ;;
  5256.     esac
  5257.     ;;
  5258. *)    guess1="$direntrytype"
  5259.     ;;
  5260. esac
  5261.  
  5262. case "$guess1" in
  5263. 'struct dirent') guess2='struct direct' ;;
  5264. *) guess2='struct dirent' ;;
  5265. esac
  5266.         
  5267. if $contains "$guess1" try.c >/dev/null 2>&1; then
  5268.     direntrytype="$guess1"
  5269.     echo "Your directory entries are $direntrytype." >&4
  5270. elif $contains "$guess2" try.c >/dev/null 2>&1; then
  5271.     direntrytype="$guess2"
  5272.     echo "Your directory entries seem to be $direntrytype." >&4
  5273. else
  5274.     echo "I don't recognize your system's directory entries." >&4
  5275.     rp="What type is used for directory entries on this system?"
  5276.     dflt="$guess1"
  5277.     . ./myread
  5278.     direntrytype="$ans"
  5279. fi
  5280. $rm -f try.c
  5281.  
  5282.  
  5283. : see if the directory entry stores field length
  5284. echo " "
  5285. $cppstdin $cppflags $cppminus < "$xinc" > try.c
  5286. if $contains 'd_namlen' try.c >/dev/null 2>&1; then
  5287.     echo "Good, your directory entry keeps length information in d_namlen." >&4
  5288.     val="$define"
  5289. else
  5290.     echo "Your directory entry does not know about the d_namlen field." >&4
  5291.     val="$undef"
  5292. fi
  5293. set d_dirnamlen
  5294. eval $setvar
  5295. $rm -f try.c
  5296.  
  5297. : see if dlerror exists
  5298. xxx_runnm="$runnm"
  5299. runnm=false
  5300. set dlerror d_dlerror
  5301. eval $inlibc
  5302. runnm="$xxx_runnm"
  5303.  
  5304. : see if dld is available
  5305. set dld.h i_dld
  5306. eval $inhdr
  5307.  
  5308. : see if dlopen exists
  5309. xxx_runnm="$runnm"
  5310. runnm=false
  5311. set dlopen d_dlopen
  5312. eval $inlibc
  5313. runnm="$xxx_runnm"
  5314.  
  5315. : determine which dynamic loading, if any, to compile in
  5316. echo " "
  5317. dldir="ext/DynaLoader"
  5318. case "$usedl" in
  5319. $define|y|true)
  5320.     dflt='y'
  5321.     usedl="$define"
  5322.     ;;
  5323. $undef|n|false)
  5324.     dflt='n'
  5325.     usedl="$undef"
  5326.     ;;
  5327. *) 
  5328.     dflt='n'
  5329.     case "$d_dlopen" in
  5330.         $define) dflt='y' ;;
  5331.     esac
  5332.     case "$i_dld" in
  5333.         $define) dflt='y' ;;
  5334.     esac
  5335.     : Does a dl_xxx.xs file exist for this operating system
  5336.     $test -f ../$dldir/dl_${osname}.xs && dflt='y'
  5337.     ;;
  5338. esac
  5339. rp="Do you wish to use dynamic loading?"
  5340. . ./myread
  5341. usedl="$ans"
  5342. case "$ans" in
  5343. y*) usedl="$define"
  5344.     case "$dlsrc" in
  5345.     '')
  5346.         if $test -f ../$dldir/dl_${osname}.xs ; then
  5347.             dflt="$dldir/dl_${osname}.xs"
  5348.         elif $test "$d_dlopen" = "$define" ; then
  5349.             dflt="$dldir/dl_dlopen.xs"
  5350.         elif $test "$i_dld" = "$define" ; then
  5351.             dflt="$dldir/dl_dld.xs"
  5352.         else
  5353.             dflt=''
  5354.         fi
  5355.         ;;
  5356.     *)    dflt="$dldir/$dlsrc"
  5357.         ;;
  5358.     esac
  5359.     echo "The following dynamic loading files are available:"
  5360.     : Can not go over to $dldir because getfile has path hard-coded in.
  5361.     cd ..; ls -C $dldir/dl*.xs; cd UU
  5362.     rp="Source file to use for dynamic loading"
  5363.     fn="fne"
  5364.     . ./getfile
  5365.     usedl="$define"
  5366.     : emulate basename
  5367.     dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
  5368.  
  5369.     $cat << EOM
  5370.  
  5371. Some systems may require passing special flags to $cc -c to
  5372. compile modules that will be used to create a shared library.
  5373. To use no flags, say "none".
  5374.  
  5375. EOM
  5376.     case "$cccdlflags" in
  5377.     '')    case "$gccversion" in
  5378.         '') case "$osname" in
  5379.             hpux)    dflt='+z' ;;
  5380.             next)    dflt='none' ;;
  5381.             solaris|svr4*|esix*) dflt='-Kpic' ;;
  5382.             sunos)    dflt='-pic' ;;
  5383.             *)    dflt='none' ;;
  5384.             esac ;;
  5385.         *)    dflt='-fpic' ;;
  5386.         esac ;;
  5387.     *)    dflt="$cccdlflags" ;;
  5388.     esac
  5389.     rp="Any special flags to pass to $cc -c to compile shared library modules?"
  5390.     . ./myread
  5391.     case "$ans" in
  5392.     none) cccdlflags=' ' ;;
  5393.     *) cccdlflags="$ans" ;;
  5394.     esac
  5395.  
  5396.     cat << EOM
  5397.  
  5398. Some systems use ld to create libraries that can be dynamically loaded,
  5399. while other systems (such as those using ELF) use $cc.
  5400.  
  5401. EOM
  5402.     case "$ld" in
  5403.     '')    $cat >try.c <<'EOM'
  5404. /* Test for whether ELF binaries are produced */
  5405. #include <fcntl.h>
  5406. #include <stdlib.h>
  5407. main() {
  5408.     char b[4];
  5409.     int i = open("a.out",O_RDONLY);
  5410.     if(i == -1) 
  5411.         exit(1); /* fail */
  5412.     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
  5413.         exit(0); /* succeed (yes, it's ELF) */
  5414.     else
  5415.         exit(1); /* fail */
  5416. }
  5417. EOM
  5418.         if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
  5419.             cat <<EOM
  5420. You appear to have ELF support.  I'll use $cc to build dynamic libraries.
  5421. EOM
  5422.             dflt="$cc"
  5423.         else
  5424.             echo "I'll use ld to build dynamic libraries."
  5425.             dflt='ld'
  5426.         fi
  5427.         rm -f try.c a.out
  5428.         ;;
  5429.     *)    dflt="$ld"
  5430.         ;;
  5431.     esac
  5432.  
  5433.     rp="What command should be used to create dynamic libraries?"
  5434.     . ./myread
  5435.     ld="$ans"
  5436.  
  5437.     cat << EOM
  5438.  
  5439. Some systems may require passing special flags to $ld to create a
  5440. library that can be dynamically loaded.  If your ld flags include
  5441. -L/other/path options to locate libraries outside your loader's normal
  5442. search path, you may need to specify those -L options here as well.  To
  5443. use no flags, say "none".
  5444.  
  5445. EOM
  5446.     case "$lddlflags" in
  5447.     '') case "$osname" in
  5448.             hpux)  dflt='-b' ;;
  5449.             linux)    dflt='-shared' ;;
  5450.             next)  dflt='none' ;;
  5451.             solaris) dflt='-G' ;;
  5452.             sunos) dflt='-assert nodefinitions' ;;
  5453.             svr4*|esix*) dflt="-G $ldflags" ;;
  5454.             *)     dflt='none' ;;
  5455.             esac
  5456.             ;;
  5457.     *) dflt="$lddlflags" ;;
  5458.     esac
  5459.  
  5460. : Try to guess additional flags to pick up local libraries.
  5461. for thisflag in $ldflags; do
  5462.     case "$thisflag" in
  5463.     -L*)
  5464.         case " $dflt " in
  5465.         *" $thisflag "*) ;;
  5466.         *) dflt="$dflt $thisflag" ;;
  5467.         esac
  5468.         ;;
  5469.     esac
  5470. done
  5471.  
  5472. case "$dflt" in
  5473. '') dflt='none' ;;
  5474. esac
  5475.  
  5476.     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
  5477.     . ./myread
  5478.     case "$ans" in
  5479.     none) lddlflags=' ' ;;
  5480.     *) lddlflags="$ans" ;;
  5481.     esac
  5482.  
  5483.     cat <<EOM
  5484.  
  5485. Some systems may require passing special flags to $cc to indicate that
  5486. the resulting executable will use dynamic linking.  To use no flags,
  5487. say "none".
  5488.  
  5489. EOM
  5490.     case "$ccdlflags" in
  5491.     '') case "$osname" in
  5492.         hpux)    dflt='-Wl,-E' ;;
  5493.         linux)    dflt='-rdynamic' ;;
  5494.         next)    dflt='none' ;;
  5495.         sunos)    dflt='none' ;;
  5496.         *)    dflt='none' ;;
  5497.         esac ;;
  5498.     *)  dflt="$ccdlflags" ;;
  5499.     esac
  5500.     rp="Any special flags to pass to $cc to use dynamic loading?"
  5501.     . ./myread
  5502.     case "$ans" in
  5503.     none) ccdlflags=' ' ;;
  5504.     *) ccdlflags="$ans" ;;
  5505.     esac
  5506.     ;;
  5507. *)  usedl="$undef"
  5508.     ld='ld'
  5509.     dlsrc='dl_none.xs'
  5510.     lddlflags=''
  5511.     ccdlflags=''
  5512.     ;;
  5513. esac
  5514.  
  5515. val="$undef"
  5516. case "$osname" in
  5517. esix*|svr4*)
  5518.     case "$usedl" in
  5519.     $define)
  5520.     $cat <<EOM
  5521.  
  5522. System V Release 4 systems can support dynamic loading
  5523. only if libperl is created as a shared library.
  5524.  
  5525. EOM
  5526.     val="$define"
  5527.     ;;
  5528.     esac ;;
  5529. esac
  5530. set d_shrplib; eval $setvar
  5531. case "$d_shrplib" in
  5532. $define)
  5533.     cat <<EOM >&4
  5534.  
  5535. Be sure to add the perl source directory to the LD_LIBRARY_PATH
  5536. environment variable before running make:
  5537.     LD_LIBRARY_PATH=`cd ..;pwd`; export LD_LIBRARY_PATH
  5538. or
  5539.     setenv LD_LIBRARY_PATH `cd ..;pwd`
  5540.  
  5541. EOM
  5542. ;;
  5543. esac
  5544. case "$d_shrplib" in
  5545. $define)
  5546.     case "$shrpdir" in
  5547.     "")    dflt="$archlib/CORE";;
  5548.     *)    dflt="$shrpdir";;
  5549.     esac
  5550.     rp="What directory should we install the shared libperl into?"
  5551.     fn="d~"
  5552.     . ./getfile
  5553.     shrpdir="$ans"
  5554.     ;;
  5555. *)    shrpdir='none'
  5556.     ;;
  5557. esac
  5558.  
  5559. : see if dlfcn is available
  5560. set dlfcn.h i_dlfcn
  5561. eval $inhdr
  5562.  
  5563. case "$usedl" in
  5564. $define|y|true)
  5565.     $cat << EOM
  5566.  
  5567. On a few systems, the dynamically loaded modules that perl generates and uses
  5568. will need a different extension then shared libs. The default will probably
  5569. be appropriate.
  5570.  
  5571. EOM
  5572.     case "$dlext" in
  5573.     '')    dflt="$so" ;;
  5574.     *)    dflt="$dlext" ;;
  5575.     esac
  5576.     rp='What is the extension of dynamically loaded modules'
  5577.     . ./myread
  5578.     dlext="$ans"
  5579.     ;;
  5580. *)
  5581.     dlext="none"
  5582.     ;;
  5583. esac
  5584.  
  5585. : Check if dlsym need a leading underscore
  5586. echo " "
  5587. val="$undef"
  5588.  
  5589. case "$dlsrc" in
  5590. dl_dlopen.xs)
  5591.     echo "Checking whether your dlsym() needs a leading underscore ..." >&4
  5592.     $cat >dyna.c <<'EOM'
  5593. fred () { }
  5594. EOM
  5595.  
  5596. $cat >fred.c<<EOM
  5597.  
  5598. #include <stdio.h>
  5599. #$i_dlfcn I_DLFCN
  5600. #ifdef I_DLFCN
  5601. #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
  5602. #else
  5603. #include <sys/types.h>
  5604. #include <nlist.h>
  5605. #include <link.h>
  5606. #endif
  5607.  
  5608. extern int fred() ;
  5609.  
  5610. main()
  5611. {
  5612.     void * handle ;
  5613.     void * symbol ;
  5614. #ifndef RTLD_LAZY
  5615.     int mode = 1 ;
  5616. #else
  5617.     int mode = RTLD_LAZY ;
  5618. #endif
  5619.     handle = dlopen("./dyna.$dlext", mode) ;
  5620.     if (handle == NULL) {
  5621.         printf ("1\n") ;
  5622.         exit(0);
  5623.     }
  5624.     symbol = dlsym(handle, "fred") ;
  5625.     if (symbol == NULL) {
  5626.         /* try putting a leading underscore */
  5627.         symbol = dlsym(handle, "_fred") ;
  5628.         if (symbol == NULL) {
  5629.             printf ("2\n") ;
  5630.             exit(0);
  5631.         }
  5632.         printf ("3\n") ;
  5633.     }
  5634.     else
  5635.         printf ("4\n") ;
  5636.     exit(0);
  5637. }
  5638. EOM
  5639.     if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
  5640.         $ld $lddlflags -o dyna.$dlext dyna.o > /dev/null 2>&1 && 
  5641.         $cc $ccflags $ldflags $cccdlflags $ccdlflags fred.c -o fred $libs > /dev/null 2>&1; then
  5642.         xxx=`./fred`
  5643.         case $xxx in
  5644.         1)    echo "Test program failed using dlopen." >&4
  5645.             echo "Perhaps you should not use dynamic loading." >&4;;
  5646.         2)    echo "Test program failed using dlsym." >&4
  5647.             echo "Perhaps you should not use dynamic loading." >&4;;
  5648.         3)    echo "dlsym needs a leading underscore" >&4
  5649.             val="$define" ;;
  5650.         4)    echo "dlsym doesn't need a leading underscore." >&4;;
  5651.         esac
  5652.     else
  5653.         echo "I can't compile and run the test program." >&4
  5654.     fi
  5655.     ;;
  5656. esac
  5657.         
  5658. $rm -f fred fred.? dyna.$dlext dyna.?
  5659.  
  5660. set d_dlsymun
  5661. eval $setvar
  5662.  
  5663. : see if dup2 exists
  5664. set dup2 d_dup2
  5665. eval $inlibc
  5666.  
  5667. : Locate the flags for 'open()'
  5668. echo " "
  5669. $cat >open3.c <<'EOCP'
  5670. #include <sys/types.h>
  5671. #ifdef I_FCNTL
  5672. #include <fcntl.h>
  5673. #endif
  5674. #ifdef I_SYS_FILE
  5675. #include <sys/file.h>
  5676. #endif
  5677. main() {
  5678.     if(O_RDONLY);
  5679. #ifdef O_TRUNC
  5680.     exit(0);
  5681. #else
  5682.     exit(1);
  5683. #endif
  5684. }
  5685. EOCP
  5686. : check sys/file.h first to get FREAD on Sun
  5687. if $test `./findhdr sys/file.h` && \
  5688.         $cc $cppflags "-DI_SYS_FILE" open3.c -o open3 >/dev/null 2>&1 ; then
  5689.     h_sysfile=true;
  5690.     echo "<sys/file.h> defines the O_* constants..." >&4
  5691.     if ./open3; then
  5692.         echo "and you have the 3 argument form of open()." >&4
  5693.         val="$define"
  5694.     else
  5695.         echo "but not the 3 argument form of open().  Oh, well." >&4
  5696.         val="$undef"
  5697.     fi
  5698. elif $test `./findhdr fcntl.h` && \
  5699.         $cc "-DI_FCNTL" open3.c -o open3 >/dev/null 2>&1 ; then
  5700.     h_fcntl=true;
  5701.     echo "<fcntl.h> defines the O_* constants..." >&4
  5702.     if ./open3; then
  5703.         echo "and you have the 3 argument form of open()." >&4
  5704.         val="$define"
  5705.     else
  5706.         echo "but not the 3 argument form of open().  Oh, well." >&4
  5707.         val="$undef"
  5708.     fi
  5709. else
  5710.     val="$undef"
  5711.     echo "I can't find the O_* constant definitions!  You got problems." >&4
  5712. fi
  5713. set d_open3
  5714. eval $setvar
  5715. $rm -f open3*
  5716.  
  5717. : check for non-blocking I/O stuff
  5718. case "$h_sysfile" in
  5719. true) echo "#include <sys/file.h>" > head.c;;
  5720. *)
  5721.     case "$h_fcntl" in
  5722.     true) echo "#include <fcntl.h>" > head.c;;
  5723.     *) echo "#include <sys/fcntl.h>" > head.c;;
  5724.     esac
  5725.     ;;
  5726. esac
  5727. echo " "
  5728. echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
  5729. case "$o_nonblock" in
  5730. '')
  5731.     $cat head.c > try.c
  5732.     $cat >>try.c <<'EOCP'
  5733. main() {
  5734. #ifdef O_NONBLOCK
  5735.     printf("O_NONBLOCK\n");
  5736.     exit(0);
  5737. #endif
  5738. #ifdef O_NDELAY
  5739.     printf("O_NDELAY\n");
  5740.     exit(0);
  5741. #endif
  5742. #ifdef FNDELAY
  5743.     printf("FNDELAY\n");
  5744.     exit(0);
  5745. #endif
  5746.     exit(0);
  5747. }
  5748. EOCP
  5749.     if $cc $ccflags $ldflags try.c -o try >/dev/null 2>&1; then
  5750.         o_nonblock=`./try`
  5751.         case "$o_nonblock" in
  5752.         '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
  5753.         *) echo "Seems like we can use $o_nonblock.";;
  5754.         esac
  5755.     else
  5756.         echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
  5757.     fi
  5758.     ;;
  5759. *) echo "Using $hint value $o_nonblock.";;
  5760. esac
  5761. $rm -f try try.* .out core
  5762.  
  5763. echo " "
  5764. echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
  5765. case "$eagain" in
  5766. '')
  5767.     $cat head.c > try.c
  5768.     $cat >>try.c <<EOCP
  5769. #include <errno.h>
  5770. #include <sys/types.h>
  5771. #include <signal.h>
  5772. #define MY_O_NONBLOCK $o_nonblock
  5773. extern int errno;
  5774. $signal_t blech(x) int x; { exit(3); }
  5775. EOCP
  5776.     $cat >> try.c <<'EOCP'
  5777. main()
  5778. {
  5779.     int pd[2];
  5780.     int pu[2];
  5781.     char buf[1];
  5782.     char string[100];
  5783.  
  5784.     pipe(pd);    /* Down: child -> parent */
  5785.     pipe(pu);    /* Up: parent -> child */
  5786.     if (0 != fork()) {
  5787.         int ret;
  5788.         close(pd[1]);    /* Parent reads from pd[0] */
  5789.         close(pu[0]);    /* Parent writes (blocking) to pu[1] */
  5790.         if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
  5791.             exit(1);
  5792.         signal(SIGALRM, blech);
  5793.         alarm(5);
  5794.         if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
  5795.             exit(2);
  5796.         sprintf(string, "%d\n", ret);
  5797.         write(2, string, strlen(string));
  5798.         alarm(0);
  5799. #ifdef EAGAIN
  5800.         if (errno == EAGAIN) {
  5801.             printf("EAGAIN\n");
  5802.             goto ok;
  5803.         }
  5804. #endif
  5805. #ifdef EWOULDBLOCK
  5806.         if (errno == EWOULDBLOCK)
  5807.             printf("EWOULDBLOCK\n");
  5808. #endif
  5809.     ok:
  5810.         write(pu[1], buf, 1);    /* Unblocks child, tell it to close our pipe */
  5811.         sleep(2);                /* Give it time to close our pipe */
  5812.         alarm(5);
  5813.         ret = read(pd[0], buf, 1);    /* Should read EOF */
  5814.         alarm(0);
  5815.         sprintf(string, "%d\n", ret);
  5816.         write(3, string, strlen(string));
  5817.         exit(0);
  5818.     }
  5819.  
  5820.     close(pd[0]);            /* We write to pd[1] */
  5821.     close(pu[1]);            /* We read from pu[0] */
  5822.     read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
  5823.     close(pd[1]);            /* Pipe pd is now fully closed! */
  5824.     exit(0);                /* Bye bye, thank you for playing! */
  5825. }
  5826. EOCP
  5827.     if $cc $ccflags $ldflags try.c -o try >/dev/null 2>&1; then
  5828.         echo "$startsh" >mtry
  5829.         echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
  5830.         chmod +x mtry
  5831.         ./mtry >/dev/null 2>&1
  5832.         case $? in
  5833.         0) eagain=`$cat try.out`;;
  5834.         1) echo "Could not perform non-blocking setting!";;
  5835.         2) echo "I did a successful read() for something that was not there!";;
  5836.         3) echo "Hmm... non-blocking I/O does not seem to be working!";;
  5837.         *) echo "Something terribly wrong happened during testing.";;
  5838.         esac
  5839.         rd_nodata=`$cat try.ret`
  5840.         echo "A read() system call with no data present returns $rd_nodata."
  5841.         case "$rd_nodata" in
  5842.         0|-1) ;;
  5843.         *)
  5844.             echo "(That's peculiar, fixing that to be -1.)"
  5845.             rd_nodata=-1
  5846.             ;;
  5847.         esac
  5848.         case "$eagain" in
  5849.         '')
  5850.             echo "Forcing errno EAGAIN on read() with no data available."
  5851.             eagain=EAGAIN
  5852.             ;;
  5853.         *)
  5854.             echo "Your read() sets errno to $eagain when no data is available."
  5855.             ;;
  5856.         esac
  5857.         status=`$cat try.err`
  5858.         case "$status" in
  5859.         0) echo "And it correctly returns 0 to signal EOF.";;
  5860.         -1) echo "But it also returns -1 to signal EOF, so be careful!";;
  5861.         *) echo "However, your read() returns '$status' on EOF??";;
  5862.         esac
  5863.         val="$define"
  5864.         if test "$status" -eq "$rd_nodata"; then
  5865.             echo "WARNING: you can't distinguish between EOF and no data!"
  5866.             val="$undef"
  5867.         fi
  5868.     else
  5869.         echo "I can't compile the test program--assuming errno EAGAIN will do."
  5870.         eagain=EAGAIN
  5871.     fi
  5872.     set d_eofnblk
  5873.     eval $setvar
  5874.     ;;
  5875. *)
  5876.     echo "Using $hint value $eagain."
  5877.     echo "Your read() returns $rd_nodata when no data is present."
  5878.     case "$d_eofnblk" in
  5879.     "$define") echo "And you can see EOF because read() returns 0.";;
  5880.     "$undef") echo "But you can't see EOF status from read() returned value.";;
  5881.     *)
  5882.         echo "(Assuming you can't see EOF status from read anyway.)"
  5883.         d_eofnblk=$undef
  5884.         ;;
  5885.     esac
  5886.     ;;
  5887. esac
  5888. $rm -f try try.* .out core head.c mtry
  5889.  
  5890. : see if fchmod exists
  5891. set fchmod d_fchmod
  5892. eval $inlibc
  5893.  
  5894. : see if fchown exists
  5895. set fchown d_fchown
  5896. eval $inlibc
  5897.  
  5898. : see if this is an fcntl system
  5899. set fcntl d_fcntl
  5900. eval $inlibc
  5901.  
  5902. : see if fgetpos exists
  5903. set fgetpos d_fgetpos
  5904. eval $inlibc
  5905.  
  5906. : see if flock exists
  5907. set flock d_flock
  5908. eval $inlibc
  5909.  
  5910. : see if fork exists
  5911. set fork d_fork
  5912. eval $inlibc
  5913.  
  5914. : see if pathconf exists
  5915. set pathconf d_pathconf
  5916. eval $inlibc
  5917.  
  5918. : see if fpathconf exists
  5919. set fpathconf d_fpathconf
  5920. eval $inlibc
  5921.  
  5922. : see if fsetpos exists
  5923. set fsetpos d_fsetpos
  5924. eval $inlibc
  5925.  
  5926. : see if gethostent exists
  5927. set gethostent d_gethent
  5928. eval $inlibc
  5929.  
  5930. : see if getlogin exists
  5931. set getlogin d_getlogin
  5932. eval $inlibc
  5933.  
  5934. : see if getpgrp exists
  5935. set getpgrp d_getpgrp
  5936. eval $inlibc
  5937.  
  5938. : see if getpgrp2 exists
  5939. set getpgrp2 d_getpgrp2
  5940. eval $inlibc
  5941.  
  5942. : see if getppid exists
  5943. set getppid d_getppid
  5944. eval $inlibc
  5945.  
  5946. : see if getpriority exists
  5947. set getpriority d_getprior
  5948. eval $inlibc
  5949.  
  5950. : see if this is a netinet/in.h or sys/in.h system
  5951. set netinet/in.h i_niin sys/in.h i_sysin
  5952. eval $inhdr
  5953.  
  5954. : see if htonl --and friends-- exists
  5955. val=''
  5956. set htonl val
  5957. eval $inlibc
  5958.  
  5959. : Maybe they are macros.
  5960. case "$val" in
  5961. $undef)
  5962.     $cat >htonl.c <<EOM
  5963. #include <stdio.h>
  5964. #include <sys/types.h>
  5965. #$i_niin I_NETINET_IN
  5966. #$i_sysin I_SYS_IN
  5967. #ifdef I_NETINET_IN
  5968. #include <netinet/in.h>
  5969. #endif
  5970. #ifdef I_SYS_IN
  5971. #include <sys/in.h>
  5972. #endif
  5973. #ifdef htonl
  5974. printf("Defined as a macro.");
  5975. #endif
  5976. EOM
  5977.     $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
  5978.     if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
  5979.         val="$define"
  5980.         echo "But it seems to be defined as a macro." >&4
  5981.     fi
  5982.     $rm -f htonl.?
  5983.     ;;
  5984. esac
  5985. set d_htonl
  5986. eval $setvar
  5987.  
  5988. : see which of string.h or strings.h is needed
  5989. echo " "
  5990. strings=`./findhdr string.h`
  5991. if $test "$strings" && $test -r "$strings"; then
  5992.     echo "Using <string.h> instead of <strings.h>." >&4
  5993.     val="$define"
  5994. else
  5995.     val="$undef"
  5996.     strings=`./findhdr strings.h`
  5997.     if $test "$strings" && $test -r "$strings"; then
  5998.         echo "Using <strings.h> instead of <string.h>." >&4
  5999.     else
  6000.         echo "No string header found -- You'll surely have problems." >&4
  6001.     fi
  6002. fi
  6003. set i_string
  6004. eval $setvar
  6005. case "$i_string" in
  6006. "$undef") strings=`./findhdr strings.h`;;
  6007. *)      strings=`./findhdr string.h`;;
  6008. esac
  6009.  
  6010. : index or strchr
  6011. echo " "
  6012. if set index val -f; eval $csym; $val; then
  6013.     if set strchr val -f d_strchr; eval $csym; $val; then
  6014.         if $contains strchr "$strings" >/dev/null 2>&1 ; then
  6015.             val="$define"
  6016.             vali="$undef"
  6017.             echo "strchr() found." >&4
  6018.         else
  6019.             val="$undef"
  6020.             vali="$define"
  6021.             echo "index() found." >&4
  6022.         fi
  6023.     else
  6024.         val="$undef"
  6025.         vali="$define"
  6026.         echo "index() found." >&4
  6027.     fi
  6028. else
  6029.     if set strchr val -f d_strchr; eval $csym; $val; then
  6030.         val="$define"
  6031.         vali="$undef"
  6032.         echo "strchr() found." >&4
  6033.     else
  6034.         echo "No index() or strchr() found!" >&4
  6035.         val="$undef"
  6036.         vali="$undef"
  6037.     fi
  6038. fi
  6039. set d_strchr; eval $setvar
  6040. val="$vali"
  6041. set d_index; eval $setvar
  6042.  
  6043. : Look for isascii
  6044. echo " "
  6045. $cat >isascii.c <<'EOCP'
  6046. #include <stdio.h>
  6047. #include <ctype.h>
  6048. main() {
  6049.     int c = 'A';
  6050.     if (isascii(c))
  6051.         exit(0);
  6052.     else
  6053.         exit(1);
  6054. }
  6055. EOCP
  6056. if $cc $ccflags $ldflags -o isascii isascii.c $libs >/dev/null 2>&1 ; then
  6057.     echo "isascii() found." >&4
  6058.     val="$define"
  6059. else
  6060.     echo "isascii() NOT found." >&4
  6061.     val="$undef"
  6062. fi
  6063. set d_isascii
  6064. eval $setvar
  6065. $rm -f isascii*
  6066.  
  6067. : see if killpg exists
  6068. set killpg d_killpg
  6069. eval $inlibc
  6070.  
  6071. : see if link exists
  6072. set link d_link
  6073. eval $inlibc
  6074.  
  6075. : see if localeconv exists
  6076. set localeconv d_locconv
  6077. eval $inlibc
  6078.  
  6079. : see if lockf exists
  6080. set lockf d_lockf
  6081. eval $inlibc
  6082.  
  6083. : see if lstat exists
  6084. set lstat d_lstat
  6085. eval $inlibc
  6086.  
  6087. : see if mblen exists
  6088. set mblen d_mblen
  6089. eval $inlibc
  6090.  
  6091. : see if mbstowcs exists
  6092. set mbstowcs d_mbstowcs
  6093. eval $inlibc
  6094.  
  6095. : see if mbtowc exists
  6096. set mbtowc d_mbtowc
  6097. eval $inlibc
  6098.  
  6099. : see if memcmp exists
  6100. set memcmp d_memcmp
  6101. eval $inlibc
  6102.  
  6103. : see if memcpy exists
  6104. set memcpy d_memcpy
  6105. eval $inlibc
  6106.  
  6107. : see if memmove exists
  6108. set memmove d_memmove
  6109. eval $inlibc
  6110.  
  6111. : see if memset exists
  6112. set memset d_memset
  6113. eval $inlibc
  6114.  
  6115. : see if mkdir exists
  6116. set mkdir d_mkdir
  6117. eval $inlibc
  6118.  
  6119. : see if mkfifo exists
  6120. set mkfifo d_mkfifo
  6121. eval $inlibc
  6122.  
  6123. : see if mktime exists
  6124. set mktime d_mktime
  6125. eval $inlibc
  6126.  
  6127. : see if msgctl exists
  6128. set msgctl d_msgctl
  6129. eval $inlibc
  6130.  
  6131. : see if msgget exists
  6132. set msgget d_msgget
  6133. eval $inlibc
  6134.  
  6135. : see if msgsnd exists
  6136. set msgsnd d_msgsnd
  6137. eval $inlibc
  6138.  
  6139. : see if msgrcv exists
  6140. set msgrcv d_msgrcv
  6141. eval $inlibc
  6142.  
  6143. : see how much of the 'msg*(2)' library is present.
  6144. h_msg=true
  6145. echo " "
  6146. case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
  6147. *"$undef"*) h_msg=false;;
  6148. esac
  6149. : we could also check for sys/ipc.h ...
  6150. if $h_msg && $test `./findhdr sys/msg.h`; then
  6151.     echo "You have the full msg*(2) library." >&4
  6152.     val="$define"
  6153. else
  6154.     echo "You don't have the full msg*(2) library." >&4
  6155.     val="$undef"
  6156. fi
  6157. set d_msg
  6158. eval $setvar
  6159.  
  6160. : see if this is a malloc.h system
  6161. set malloc.h i_malloc
  6162. eval $inhdr
  6163.  
  6164. : see if stdlib is available
  6165. set stdlib.h i_stdlib
  6166. eval $inhdr
  6167.  
  6168. : determine which malloc to compile in
  6169. echo " "
  6170. case "$usemymalloc" in
  6171. ''|y*|true)    dflt='y' ;;
  6172. n*|false)    dflt='n' ;;
  6173. *)    dflt="$usemymalloc" ;;
  6174. esac
  6175. rp="Do you wish to attempt to use the malloc that comes with $package?"
  6176. . ./myread
  6177. usemymalloc="$ans"
  6178. case "$ans" in
  6179. y*|true)
  6180.     usemymalloc='y'
  6181.     mallocsrc='malloc.c'
  6182.     mallocobj='malloc.o'
  6183.     d_mymalloc="$define"
  6184.     case "$libs" in
  6185.     *-lmalloc*)
  6186.         : Remove malloc from list of libraries to use
  6187.         echo "Removing unneeded -lmalloc from library list" >&4
  6188.         set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
  6189.         shift
  6190.         libs="$*"
  6191.         echo "libs = $libs" >&4
  6192.         ;;
  6193.     esac
  6194.     ;;
  6195. *)
  6196.     usemymalloc='n'
  6197.     mallocsrc=''
  6198.     mallocobj=''
  6199.     d_mymalloc="$undef"
  6200.     ;;
  6201. esac
  6202.  
  6203. : compute the return types of malloc and free
  6204. echo " "
  6205. $cat >malloc.c <<END
  6206. #$i_malloc I_MALLOC
  6207. #$i_stdlib I_STDLIB
  6208. #include <stdio.h>
  6209. #include <sys/types.h>
  6210. #ifdef I_MALLOC
  6211. #include <malloc.h>
  6212. #endif
  6213. #ifdef I_STDLIB
  6214. #include <stdlib.h>
  6215. #endif
  6216. #ifdef TRY_MALLOC
  6217. void *malloc();
  6218. #endif
  6219. #ifdef TRY_FREE
  6220. void free();
  6221. #endif
  6222. END
  6223. case "$malloctype" in
  6224. '')
  6225.     if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
  6226.         malloctype='void *'
  6227.     else
  6228.         malloctype='char *'
  6229.     fi
  6230.     ;;
  6231. esac
  6232. echo "Your system wants malloc to return '$malloctype', it would seem." >&4
  6233.  
  6234. case "$freetype" in
  6235. '')
  6236.     if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
  6237.         freetype='void'
  6238.     else
  6239.         freetype='int'
  6240.     fi
  6241.     ;;
  6242. esac
  6243. echo "Your system uses $freetype free(), it would seem." >&4
  6244. $rm -f malloc.[co]
  6245. : see if nice exists
  6246. set nice d_nice
  6247. eval $inlibc
  6248.  
  6249. : see if pause exists
  6250. set pause d_pause
  6251. eval $inlibc
  6252.  
  6253. : see if pipe exists
  6254. set pipe d_pipe
  6255. eval $inlibc
  6256.  
  6257. : see if poll exists
  6258. set poll d_poll
  6259. eval $inlibc
  6260.  
  6261. : see if this is a pwd.h system
  6262. set pwd.h i_pwd
  6263. eval $inhdr
  6264.  
  6265. case "$i_pwd" in
  6266. $define)
  6267.     xxx=`./findhdr pwd.h`
  6268.     $cppstdin $cppflags $cppminus < $xxx >$$.h
  6269.  
  6270.     if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
  6271.         val="$define"
  6272.     else
  6273.         val="$undef"
  6274.     fi
  6275.     set d_pwquota
  6276.     eval $setvar
  6277.  
  6278.     if $contains 'pw_age' $$.h >/dev/null 2>&1; then
  6279.         val="$define"
  6280.     else
  6281.         val="$undef"
  6282.     fi
  6283.     set d_pwage
  6284.     eval $setvar
  6285.  
  6286.     if $contains 'pw_change' $$.h >/dev/null 2>&1; then
  6287.         val="$define"
  6288.     else
  6289.         val="$undef"
  6290.     fi
  6291.     set d_pwchange
  6292.     eval $setvar
  6293.  
  6294.     if $contains 'pw_class' $$.h >/dev/null 2>&1; then
  6295.         val="$define"
  6296.     else
  6297.         val="$undef"
  6298.     fi
  6299.     set d_pwclass
  6300.     eval $setvar
  6301.  
  6302.     if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
  6303.         val="$define"
  6304.     else
  6305.         val="$undef"
  6306.     fi
  6307.     set d_pwexpire
  6308.     eval $setvar
  6309.  
  6310.     if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
  6311.         val="$define"
  6312.     else
  6313.         val="$undef"
  6314.     fi
  6315.     set d_pwcomment
  6316.     eval $setvar
  6317.  
  6318.     $rm -f $$.h
  6319.     ;;
  6320. *)
  6321.     val="$undef"; 
  6322.     set d_pwquota; eval $setvar
  6323.     set d_pwage; eval $setvar
  6324.     set d_pwchange; eval $setvar
  6325.     set d_pwclass; eval $setvar
  6326.     set d_pwexpire; eval $setvar
  6327.     set d_pwcomment; eval $setvar
  6328.     ;;
  6329. esac
  6330.  
  6331. : see if readdir and friends exist
  6332. set readdir d_readdir
  6333. eval $inlibc
  6334. set seekdir d_seekdir
  6335. eval $inlibc
  6336. set telldir d_telldir
  6337. eval $inlibc
  6338. set rewinddir d_rewinddir
  6339. eval $inlibc
  6340.  
  6341. : see if readlink exists
  6342. set readlink d_readlink
  6343. eval $inlibc
  6344.  
  6345. : see if rename exists
  6346. set rename d_rename
  6347. eval $inlibc
  6348.  
  6349. : see if rmdir exists
  6350. set rmdir d_rmdir
  6351. eval $inlibc
  6352.  
  6353. : can bcopy handle overlapping blocks?
  6354. val="$undef"
  6355. case "$d_bcopy" in
  6356. "$define")
  6357.     echo " "
  6358.     echo "Checking to see if your bcopy() can do overlapping copies..." >&4
  6359.     $cat >foo.c <<'EOCP'
  6360. main()
  6361. {
  6362. char buf[128], abc[128];
  6363. char *b;
  6364. int len;
  6365. int off;
  6366. int align;
  6367.  
  6368. bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
  6369.  
  6370. for (align = 7; align >= 0; align--) {
  6371.     for (len = 36; len; len--) {
  6372.         b = buf+align;
  6373.         bcopy(abc, b, len);
  6374.         for (off = 1; off <= len; off++) {
  6375.             bcopy(b, b+off, len);
  6376.             bcopy(b+off, b, len);
  6377.             if (bcmp(b, abc, len))
  6378.                 exit(1);
  6379.         }
  6380.     }
  6381. }
  6382. exit(0);
  6383. }
  6384. EOCP
  6385.     if $cc $ccflags $ldflags foo.c -o safebcpy $libs >/dev/null 2>&1; then
  6386.         if ./safebcpy 2>/dev/null; then
  6387.             echo "Yes, it can."
  6388.             val="$define"
  6389.         else
  6390.             echo "It can't, sorry."
  6391.         fi
  6392.     else
  6393.         echo "(I can't compile the test program, so we'll assume not...)"
  6394.     fi
  6395.     ;;
  6396. esac
  6397. $rm -f foo.* safebcpy core
  6398. set d_safebcpy
  6399. eval $setvar
  6400.  
  6401. : can memcpy handle overlapping blocks?
  6402. val="$undef"
  6403. case "$d_memcpy" in
  6404. "$define")
  6405.     echo " "
  6406.     echo "Checking to see if your memcpy() can do overlapping copies..." >&4
  6407.     $cat >foo.c <<'EOCP'
  6408. main()
  6409. {
  6410. char buf[128], abc[128];
  6411. char *b;
  6412. int len;
  6413. int off;
  6414. int align;
  6415.  
  6416. memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
  6417.  
  6418. for (align = 7; align >= 0; align--) {
  6419.     for (len = 36; len; len--) {
  6420.         b = buf+align;
  6421.         memcpy(b, abc, len);
  6422.         for (off = 1; off <= len; off++) {
  6423.             memcpy(b+off, b, len);
  6424.             memcpy(b, b+off, len);
  6425.             if (memcmp(b, abc, len))
  6426.                 exit(1);
  6427.         }
  6428.     }
  6429. }
  6430. exit(0);
  6431. }
  6432. EOCP
  6433.     if $cc $ccflags $ldflags foo.c -o safemcpy $libs >/dev/null 2>&1; then
  6434.         if ./safemcpy 2>/dev/null; then
  6435.             echo "Yes, it can."
  6436.             val="$define"
  6437.         else
  6438.             echo "It can't, sorry."
  6439.         fi
  6440.     else
  6441.         echo "(I can't compile the test program, so we'll assume not...)"
  6442.     fi
  6443.     ;;
  6444. esac
  6445. $rm -f foo.* safemcpy core
  6446. set d_safemcpy
  6447. eval $setvar
  6448.  
  6449. : see if select exists
  6450. set select d_select
  6451. eval $inlibc
  6452.  
  6453. : see if semctl exists
  6454. set semctl d_semctl
  6455. eval $inlibc
  6456.  
  6457. : see if semget exists
  6458. set semget d_semget
  6459. eval $inlibc
  6460.  
  6461. : see if semop exists
  6462. set semop d_semop
  6463. eval $inlibc
  6464.  
  6465. : see how much of the 'sem*(2)' library is present.
  6466. h_sem=true
  6467. echo " "
  6468. case "$d_semctl$d_semget$d_semop" in
  6469. *"$undef"*) h_sem=false;;
  6470. esac
  6471. : we could also check for sys/ipc.h ...
  6472. if $h_sem && $test `./findhdr sys/sem.h`; then
  6473.     echo "You have the full sem*(2) library." >&4
  6474.     val="$define"
  6475. else
  6476.     echo "You don't have the full sem*(2) library." >&4
  6477.     val="$undef"
  6478. fi
  6479. set d_sem
  6480. eval $setvar
  6481.  
  6482. : see if setegid exists
  6483. set setegid d_setegid
  6484. eval $inlibc
  6485.  
  6486. : see if seteuid exists
  6487. set seteuid d_seteuid
  6488. eval $inlibc
  6489.  
  6490. : see if setlinebuf exists
  6491. set setlinebuf d_setlinebuf
  6492. eval $inlibc
  6493.  
  6494. : see if setlocale exists
  6495. set setlocale d_setlocale
  6496. eval $inlibc
  6497.  
  6498. : see if setpgid exists
  6499. set setpgid d_setpgid
  6500. eval $inlibc
  6501.  
  6502. : see if setpgrp2 exists
  6503. set setpgrp2 d_setpgrp2
  6504. eval $inlibc
  6505.  
  6506. : see if setpriority exists
  6507. set setpriority d_setprior
  6508. eval $inlibc
  6509.  
  6510. : see if setregid exists
  6511. set setregid d_setregid
  6512. eval $inlibc
  6513. set setresgid d_setresgid
  6514. eval $inlibc
  6515.  
  6516. : see if setreuid exists
  6517. set setreuid d_setreuid
  6518. eval $inlibc
  6519. set setresuid d_setresuid
  6520. eval $inlibc
  6521.  
  6522. : see if setrgid exists
  6523. set setrgid d_setrgid
  6524. eval $inlibc
  6525.  
  6526. : see if setruid exists
  6527. set setruid d_setruid
  6528. eval $inlibc
  6529.  
  6530. : see if setsid exists
  6531. set setsid d_setsid
  6532. eval $inlibc
  6533.  
  6534. : see if shmctl exists
  6535. set shmctl d_shmctl
  6536. eval $inlibc
  6537.  
  6538. : see if shmget exists
  6539. set shmget d_shmget
  6540. eval $inlibc
  6541.  
  6542. : see if shmat exists
  6543. set shmat d_shmat
  6544. eval $inlibc
  6545. : see what shmat returns
  6546. case "$d_shmat" in
  6547. "$define")
  6548.     $cat >shmat.c <<'END'
  6549. #include <sys/shm.h>
  6550. void *shmat();
  6551. END
  6552.     if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
  6553.         shmattype='void *'
  6554.     else
  6555.         shmattype='char *'
  6556.     fi
  6557.     echo "and it returns ($shmattype)." >&4
  6558.     : see if a prototype for shmat is available
  6559.     xxx=`./findhdr sys/shm.h`
  6560.     $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
  6561.     if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
  6562.         val="$define"
  6563.     else
  6564.         val="$undef"
  6565.     fi
  6566.     $rm -f shmat.[co]
  6567.     ;;
  6568. *)
  6569.     val="$undef"
  6570.     ;;
  6571. esac
  6572. set d_shmatprototype
  6573. eval $setvar
  6574.  
  6575. : see if shmdt exists
  6576. set shmdt d_shmdt
  6577. eval $inlibc
  6578.  
  6579. : see how much of the 'shm*(2)' library is present.
  6580. h_shm=true
  6581. echo " "
  6582. case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
  6583. *"$undef"*) h_shm=false;;
  6584. esac
  6585. : we could also check for sys/ipc.h ...
  6586. if $h_shm && $test `./findhdr sys/shm.h`; then
  6587.     echo "You have the full shm*(2) library." >&4
  6588.     val="$define"
  6589. else
  6590.     echo "You don't have the full shm*(2) library." >&4
  6591.     val="$undef"
  6592. fi
  6593. set d_shm
  6594. eval $setvar
  6595.  
  6596. : see if sigvector exists -- since sigvec will match the substring
  6597. echo " "
  6598. if set sigvector val -f d_sigvectr; eval $csym; $val; then
  6599.     echo 'sigvector() found--you must be running HP-UX.' >&4
  6600.     val="$define"; set d_sigvectr; eval $setvar
  6601.     val="$define"; set d_sigvec; eval $setvar
  6602. else
  6603. : try the original name
  6604.     d_sigvectr="$undef"
  6605.     if set sigvec val -f d_sigvec; eval $csym; $val; then
  6606.         echo 'sigvec() found.' >&4
  6607.         val="$define"; set d_sigvec; eval $setvar
  6608.     else
  6609.         echo 'sigvec() not found--race conditions with signals may occur.' >&4
  6610.         val="$undef"; set d_sigvec; eval $setvar
  6611.     fi
  6612. fi
  6613.  
  6614. : see if we have sigaction
  6615. set sigaction d_sigaction
  6616. eval $inlibc
  6617.  
  6618.  
  6619. : see if sigsetjmp exists
  6620. echo " "
  6621. case "$d_sigsetjmp" in
  6622. '')
  6623.     $cat >set.c <<EOP
  6624. #include <setjmp.h>
  6625. sigjmp_buf env;
  6626. int set = 1;
  6627. main()
  6628. {
  6629.     if (sigsetjmp(env,1))
  6630.         exit(set);
  6631.     set = 0;
  6632.     siglongjmp(env, 1);
  6633.     exit(1);
  6634. }
  6635. EOP
  6636.     if $cc $ccflags $ldflags set.c -o set $libs >/dev/null 2>&1; then
  6637.         if ./set >/dev/null 2>&1; then
  6638.             echo "POSIX sigsetjmp found." >&4
  6639.             val="$define"
  6640.         else
  6641.             $cat <<EOM
  6642. Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
  6643. EOM
  6644.             val="$undef"
  6645.         fi
  6646.     else
  6647.         echo "Sigsetjmp not found." >&4
  6648.         val="$undef"
  6649.     fi
  6650.     ;;
  6651. *) val="$d_sigsetjmp"
  6652.     case "$d_sigsetjmp" in
  6653.     $define) echo "POSIX sigsetjmp found." >&4;;
  6654.     $undef) echo "Sigsetjmp not found." >&4;;
  6655.     esac
  6656.     ;;
  6657. esac
  6658. set d_sigsetjmp
  6659. eval $setvar
  6660. $rm -f set.c set
  6661.  
  6662. socketlib=''
  6663. sockethdr=''
  6664. : see whether socket exists
  6665. echo " "
  6666. $echo $n "Hmm... $c" >&4
  6667. if set socket val -f d_socket; eval $csym; $val; then
  6668.     echo "Looks like you have Berkeley networking support." >&4
  6669.     d_socket="$define"
  6670.     if set setsockopt val -f; eval $csym; $val; then
  6671.         d_oldsock="$undef"
  6672.     else
  6673.         echo "...but it uses the old 4.1c interface, rather than 4.2" >&4
  6674.         d_oldsock="$define"
  6675.     fi
  6676. else
  6677.     if $contains socklib libc.list >/dev/null 2>&1; then
  6678.         echo "Looks like you have Berkeley networking support." >&4
  6679.         d_socket="$define"
  6680.         : we will have to assume that it supports the 4.2 BSD interface
  6681.         d_oldsock="$undef"
  6682.     else
  6683.         echo "You don't have Berkeley networking in libc.a..." >&4
  6684.         if test -f /usr/lib/libnet.a; then
  6685.             ( (nm $nm_opt /usr/lib/libnet.a | eval $nm_extract) ||  \
  6686.             ar t /usr/lib/libnet.a) 2>/dev/null >> libc.list
  6687.             if $contains socket libc.list >/dev/null 2>&1; then
  6688.             echo "...but the Wollongong group seems to have hacked it in." >&4
  6689.                 socketlib="-lnet"
  6690.                 sockethdr="-I/usr/netinclude"
  6691.                 d_socket="$define"
  6692.                 if $contains setsockopt libc.list >/dev/null 2>&1; then
  6693.                     d_oldsock="$undef"
  6694.                 else
  6695.                     echo "...using the old 4.1c interface, rather than 4.2" >&4
  6696.                     d_oldsock="$define"
  6697.                 fi
  6698.             else
  6699.                 echo "or even in libnet.a, which is peculiar." >&4
  6700.                 d_socket="$undef"
  6701.                 d_oldsock="$undef"
  6702.             fi
  6703.         else
  6704.             echo "or anywhere else I see." >&4
  6705.             d_socket="$undef"
  6706.             d_oldsock="$undef"
  6707.         fi
  6708.     fi
  6709. fi
  6710.  
  6711. : see if socketpair exists
  6712. set socketpair d_sockpair
  6713. eval $inlibc
  6714.  
  6715. : see if stat knows about block sizes
  6716. echo " "
  6717. xxx=`./findhdr sys/stat.h`
  6718. if $contains 'st_blocks;' "$xxx" >/dev/null 2>&1 ; then
  6719.     if $contains 'st_blksize;' "$xxx" >/dev/null 2>&1 ; then
  6720.         echo "Your stat() knows about block sizes." >&4
  6721.         val="$define"
  6722.     else
  6723.         echo "Your stat() doesn't know about block sizes." >&4
  6724.         val="$undef"
  6725.     fi
  6726. else
  6727.     echo "Your stat() doesn't know about block sizes." >&4
  6728.     val="$undef"
  6729. fi
  6730. set d_statblks
  6731. eval $setvar
  6732.  
  6733. : see if _ptr and _cnt from stdio act std
  6734. echo " "
  6735. if $contains '_IO_fpos_t' `./findhdr stdio.h` >/dev/null 2>&1 ; then
  6736.     echo "(Looks like you have stdio.h from Linux.)"
  6737.     case "$stdio_ptr" in
  6738.     '') stdio_ptr='((fp)->_IO_read_ptr)'
  6739.         ptr_lval=$define
  6740.         ;;
  6741.     *)    ptr_lval=$d_stdio_ptr_lval;;
  6742.     esac
  6743.     case "$stdio_cnt" in
  6744.     '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
  6745.         cnt_lval=$undef
  6746.         ;;
  6747.     *)    cnt_lval=$d_stdio_cnt_lval;;
  6748.     esac
  6749.     case "$stdio_base" in
  6750.     '') stdio_base='((fp)->_IO_read_base)';;
  6751.     esac
  6752.     case "$stdio_bufsiz" in
  6753.     '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
  6754.     esac
  6755. else
  6756.     case "$stdio_ptr" in
  6757.     '') stdio_ptr='((fp)->_ptr)'
  6758.         ptr_lval=$define
  6759.         ;;
  6760.     *)    ptr_lval=$d_stdio_ptr_lval;;
  6761.     esac
  6762.     case "$stdio_cnt" in
  6763.     '') stdio_cnt='((fp)->_cnt)'
  6764.         cnt_lval=$define
  6765.         ;;
  6766.     *)    cnt_lval=$d_stdio_cnt_lval;;
  6767.     esac
  6768.     case "$stdio_base" in
  6769.     '') stdio_base='((fp)->_base)';;
  6770.     esac
  6771.     case "$stdio_bufsiz" in
  6772.     '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
  6773.     esac
  6774. fi
  6775. : test whether _ptr and _cnt really work
  6776. echo "Checking how std your stdio is..." >&4
  6777. $cat >try.c <<EOP
  6778. #include <stdio.h>
  6779. #define FILE_ptr(fp)    $stdio_ptr
  6780. #define FILE_cnt(fp)    $stdio_cnt
  6781. main() { 
  6782.     FILE *fp = fopen("try.c", "r");
  6783.     char c = getc(fp);
  6784.     if (
  6785.         18 <= FILE_cnt(fp) &&
  6786.         strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
  6787.     )
  6788.         exit(0);
  6789.     exit(1);
  6790. }
  6791. EOP
  6792. val="$undef"
  6793. if $cc $ccflags $ldflags -o try try.c $libs >/dev/null 2>&1; then
  6794.     if ./try; then
  6795.         echo "Your stdio acts pretty std."
  6796.         val="$define"
  6797.     else
  6798.         echo "Your stdio isn't very std."
  6799.     fi
  6800. else
  6801.     echo "Your stdio doesn't appear very std."
  6802. fi
  6803. $rm -f try.c try
  6804. set d_stdstdio
  6805. eval $setvar
  6806.  
  6807. : Can _ptr be used as an lvalue?
  6808. case "$d_stdstdio$ptr_lval" in
  6809. $define$define) val=$define ;;
  6810. *) val=$undef ;;
  6811. esac
  6812. set d_stdio_ptr_lval
  6813. eval $setvar
  6814.  
  6815. : Can _cnt be used as an lvalue?
  6816. case "$d_stdstdio$cnt_lval" in
  6817. $define$define) val=$define ;;
  6818. *) val=$undef ;;
  6819. esac
  6820. set d_stdio_cnt_lval
  6821. eval $setvar
  6822.  
  6823. : see if _base is also standard
  6824. val="$undef"
  6825. case "$d_stdstdio" in
  6826. $define)
  6827.     $cat >try.c <<EOP
  6828. #include <stdio.h>
  6829. #define FILE_base(fp)    $stdio_base
  6830. #define FILE_bufsiz(fp)    $stdio_bufsiz
  6831. main() { 
  6832.     FILE *fp = fopen("try.c", "r");
  6833.     char c = getc(fp);
  6834.     if (
  6835.         19 <= FILE_bufsiz(fp) &&
  6836.         strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
  6837.     )
  6838.         exit(0);
  6839.     exit(1);
  6840. }
  6841. EOP
  6842.     if $cc $ccflags $ldflags -o try try.c $libs > /dev/null 2>&1; then
  6843.         if ./try; then
  6844.             echo "Even its _base field acts std."
  6845.             val="$define"
  6846.         else
  6847.             echo "But its _base field isn't std."
  6848.         fi
  6849.     else
  6850.         echo "However, it seems to be lacking the _base field."
  6851.     fi
  6852.     $rm -f try.c try
  6853.     ;;
  6854. esac
  6855. set d_stdiobase
  6856. eval $setvar
  6857.  
  6858. : see if strcoll exists
  6859. set strcoll d_strcoll
  6860. eval $inlibc
  6861.  
  6862. : check for structure copying
  6863. echo " "
  6864. echo "Checking to see if your C compiler can copy structs..." >&4
  6865. $cat >try.c <<'EOCP'
  6866. main()
  6867. {
  6868.     struct blurfl {
  6869.         int dyick;
  6870.     } foo, bar;
  6871.  
  6872.     foo = bar;
  6873. }
  6874. EOCP
  6875. if $cc -c try.c >/dev/null 2>&1 ; then
  6876.     val="$define"
  6877.     echo "Yup, it can."
  6878. else
  6879.     val="$undef"
  6880.     echo "Nope, it can't."
  6881. fi
  6882. set d_strctcpy
  6883. eval $setvar
  6884. $rm -f try.*
  6885.  
  6886. : see if strerror and/or sys_errlist[] exist
  6887. echo " "
  6888. if set strerror val -f d_strerror; eval $csym; $val; then
  6889.     echo 'strerror() found.' >&4
  6890.     d_strerror="$define"
  6891.     d_strerrm='strerror(e)'
  6892.     if set sys_errlist val -a d_syserrlst; eval $csym; $val; then    
  6893.         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
  6894.         d_syserrlst="$define"
  6895.     else
  6896.     echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
  6897.         d_syserrlst="$undef"
  6898.     fi
  6899. elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
  6900.     $contains '#[     ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
  6901.     echo 'strerror() found in string header.' >&4
  6902.     d_strerror="$define"
  6903.     d_strerrm='strerror(e)'
  6904.     if set sys_errlist val -a d_syserrlst; eval $csym; $val; then    
  6905.         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
  6906.         d_syserrlst="$define"
  6907.     else
  6908.         echo "(You don't appear to have any sys_errlist[], how can this be?)"
  6909.         d_syserrlst="$undef"
  6910.     fi
  6911. elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
  6912. echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
  6913.     d_strerror="$undef"
  6914.     d_syserrlst="$define"
  6915.     d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
  6916. else
  6917.     echo 'strerror() and sys_errlist[] NOT found.' >&4
  6918.     d_strerror="$undef"
  6919.     d_syserrlst="$undef"
  6920.     d_strerrm='"unknown"'
  6921. fi
  6922.  
  6923. : see if strxfrm exists
  6924. set strxfrm d_strxfrm
  6925. eval $inlibc
  6926.  
  6927. : see if symlink exists
  6928. set symlink d_symlink
  6929. eval $inlibc
  6930.  
  6931. : see if syscall exists
  6932. set syscall d_syscall
  6933. eval $inlibc
  6934.  
  6935. : see if sysconf exists
  6936. set sysconf d_sysconf
  6937. eval $inlibc
  6938.  
  6939. : see if system exists
  6940. set system d_system
  6941. eval $inlibc
  6942.  
  6943. : see if tcgetpgrp exists
  6944. set tcgetpgrp d_tcgetpgrp
  6945. eval $inlibc
  6946.  
  6947. : see if tcsetpgrp exists
  6948. set tcsetpgrp d_tcsetpgrp
  6949. eval $inlibc
  6950.  
  6951. : define an is-a-typedef? function
  6952. typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
  6953. case "$inclist" in
  6954. "") inclist="sys/types.h";;
  6955. esac;
  6956. eval "varval=\$$var";
  6957. case "$varval" in
  6958. "")
  6959.     $rm -f temp.c;
  6960.     for inc in $inclist; do
  6961.         echo "#include <$inc>" >>temp.c;
  6962.     done;
  6963.     $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
  6964.     if $contains $type temp.E >/dev/null 2>&1; then
  6965.         eval "$var=\$type";
  6966.     else
  6967.         eval "$var=\$def";
  6968.     fi;
  6969.     $rm -f temp.?;;
  6970. *) eval "$var=\$varval";;
  6971. esac'
  6972.  
  6973. : see if this is a sys/times.h system
  6974. set sys/times.h i_systimes
  6975. eval $inhdr
  6976.  
  6977. : see if times exists
  6978. echo " "
  6979. if set times val -f d_times; eval $csym; $val; then
  6980.     echo 'times() found.' >&4
  6981.     d_times="$define"
  6982.     inc=''
  6983.     case "$i_systimes" in
  6984.     "$define") inc='sys/times.h';;
  6985.     esac
  6986.     set clock_t clocktype long stdio.h sys/types.h $inc
  6987.     eval $typedef
  6988.     dflt="$clocktype"
  6989.     echo " "
  6990.     rp="What type is returned by times() on this system?"
  6991.     . ./myread
  6992.     clocktype="$ans"
  6993. else
  6994.     echo 'times() NOT found, hope that will do.' >&4
  6995.     d_times="$undef"
  6996.     clocktype='int'
  6997. fi
  6998.  
  6999. : see if truncate exists
  7000. set truncate d_truncate
  7001. eval $inlibc
  7002.  
  7003. : see if tzname[] exists
  7004. echo " "
  7005. if set tzname val -a d_tzname; eval $csym; $val; then
  7006.     val="$define"
  7007.     echo 'tzname[] found.' >&4
  7008. else
  7009.     val="$undef"
  7010.     echo 'tzname[] NOT found.' >&4
  7011. fi
  7012. set d_tzname
  7013. eval $setvar
  7014.  
  7015. : see if umask exists
  7016. set umask d_umask
  7017. eval $inlibc
  7018.  
  7019. : see how we will look up host name
  7020. echo " "
  7021. if false; then
  7022.     : dummy stub to allow use of elif
  7023. elif set uname val -f d_uname; eval $csym; $val; then
  7024.     if ./xenix; then
  7025.         $cat <<'EOM'
  7026. uname() was found, but you're running xenix, and older versions of xenix
  7027. have a broken uname(). If you don't really know whether your xenix is old
  7028. enough to have a broken system call, use the default answer.
  7029.  
  7030. EOM
  7031.         dflt=y
  7032.         case "$d_uname" in
  7033.         "$define") dflt=n;;
  7034.         esac
  7035.         rp='Is your uname() broken?'
  7036.         . ./myread
  7037.         case "$ans" in
  7038.         n*) d_uname="$define"; call=uname;;
  7039.         esac
  7040.     else
  7041.         echo 'uname() found.' >&4
  7042.         d_uname="$define"
  7043.         call=uname
  7044.     fi
  7045. fi
  7046. case "$d_gethname" in
  7047. '') d_gethname="$undef";;
  7048. esac
  7049. case "$d_uname" in
  7050. '') d_uname="$undef";;
  7051. esac
  7052. case "$d_phostname" in
  7053. '') d_phostname="$undef";;
  7054. esac
  7055.  
  7056. : backward compatibility for d_hvfork
  7057. if test X$d_hvfork != X; then
  7058.     d_vfork="$d_hvfork"
  7059.     d_hvfork=''
  7060. fi
  7061. : see if there is a vfork
  7062. val=''
  7063. set vfork val
  7064. eval $inlibc
  7065.  
  7066. : Ok, but do we want to use it. vfork is reportedly unreliable in 
  7067. : perl on Solaris 2.x, and probably elsewhere.
  7068. case "$val" in
  7069. $define)
  7070.     echo " "
  7071.     case "$usevfork" in
  7072.     false) dflt='n';;
  7073.     *) dflt='y';;
  7074.     esac
  7075.     rp="Some systems have problems with vfork().  Do you want to use it?"
  7076.     . ./myread
  7077.     case "$ans" in
  7078.     y|Y) ;;
  7079.     *)
  7080.         echo "Ok, we won't use vfork()."
  7081.         val="$undef"
  7082.         ;;
  7083.     esac
  7084.     ;;
  7085. esac
  7086. set d_vfork
  7087. eval $setvar
  7088. case "$d_vfork" in
  7089. $define) usevfork='true';;
  7090. *) usevfork='false';;
  7091. esac
  7092.  
  7093. : see if this is an sysdir system
  7094. set sys/dir.h i_sysdir
  7095. eval $inhdr
  7096.  
  7097. : see if this is an sysndir system
  7098. set sys/ndir.h i_sysndir
  7099. eval $inhdr
  7100.  
  7101. : see if closedir exists
  7102. set closedir d_closedir
  7103. eval $inlibc
  7104.  
  7105. case "$d_closedir" in
  7106. "$define")
  7107.     echo " "
  7108.     echo "Checking whether closedir() returns a status..." >&4
  7109.     cat > closedir.c <<EOM
  7110. #$i_dirent I_DIRENT        /**/
  7111. #$i_sysdir I_SYS_DIR        /**/
  7112. #$i_sysndir I_SYS_NDIR        /**/
  7113.  
  7114. #if defined(I_DIRENT)
  7115. #include <dirent.h>
  7116. #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
  7117. #include <sys/dir.h>
  7118. #endif
  7119. #else
  7120. #ifdef I_SYS_NDIR
  7121. #include <sys/ndir.h>
  7122. #else
  7123. #ifdef I_SYS_DIR
  7124. #ifdef hp9000s500
  7125. #include <ndir.h>    /* may be wrong in the future */
  7126. #else
  7127. #include <sys/dir.h>
  7128. #endif
  7129. #endif
  7130. #endif
  7131. #endif 
  7132. int main() { return closedir(opendir(".")); }
  7133. EOM
  7134.     if $cc $ccflags $ldflags -o closedir closedir.c $libs > /dev/null 2>&1; then
  7135.         if ./closedir > /dev/null 2>&1 ; then
  7136.             echo "Yes, it does."
  7137.             val="$undef"
  7138.         else
  7139.             echo "No, it doesn't."
  7140.             val="$define"
  7141.         fi
  7142.     else
  7143.         echo "(I can't seem to compile the test program--assuming it doesn't)"
  7144.         val="$define"
  7145.     fi
  7146.     ;;
  7147. *)
  7148.     val="$undef";
  7149.     ;;
  7150. esac
  7151. set d_void_closedir
  7152. eval $setvar
  7153. $rm -f closedir*
  7154. : check for volatile keyword
  7155. echo " "
  7156. echo 'Checking to see if your C compiler knows about "volatile"...' >&4
  7157. $cat >try.c <<'EOCP'
  7158. main()
  7159. {
  7160.     typedef struct _goo_struct goo_struct;
  7161.     goo_struct * volatile goo = ((goo_struct *)0);
  7162.     struct _goo_struct {
  7163.         long long_int;
  7164.         int reg_int;
  7165.         char char_var;
  7166.     };
  7167.     typedef unsigned short foo_t;
  7168.     char *volatile foo;
  7169.     volatile int bar;
  7170.     volatile foo_t blech;
  7171.     foo = foo;
  7172. }
  7173. EOCP
  7174. if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
  7175.     val="$define"
  7176.     echo "Yup, it does."
  7177. else
  7178.     val="$undef"
  7179.     echo "Nope, it doesn't."
  7180. fi
  7181. set d_volatile
  7182. eval $setvar
  7183. $rm -f try.*
  7184.  
  7185. : see if there is a wait4
  7186. set wait4 d_wait4
  7187. eval $inlibc
  7188.  
  7189. : see if waitpid exists
  7190. set waitpid d_waitpid
  7191. eval $inlibc
  7192.  
  7193. : see if wcstombs exists
  7194. set wcstombs d_wcstombs
  7195. eval $inlibc
  7196.  
  7197. : see if wctomb exists
  7198. set wctomb d_wctomb
  7199. eval $inlibc
  7200.  
  7201. : preserve RCS keywords in files with variable substitution, grrr
  7202. Date='$Date'
  7203. Id='$Id'
  7204. Log='$Log'
  7205. RCSfile='$RCSfile'
  7206. Revision='$Revision'
  7207.  
  7208. : check for alignment requirements
  7209. echo " "
  7210. case "$alignbytes" in
  7211. '') echo "Checking alignment constraints..." >&4
  7212.     $cat >try.c <<'EOCP'
  7213. struct foobar {
  7214.     char foo;
  7215.     double bar;
  7216. } try;
  7217. main()
  7218. {
  7219.     printf("%d\n", (char *)&try.bar - (char *)&try.foo);
  7220. }
  7221. EOCP
  7222.     if $cc $ccflags try.c -o try >/dev/null 2>&1; then
  7223.         dflt=`./try`
  7224.     else
  7225.         dflt='8'
  7226.         echo"(I can't seem to compile the test program...)"
  7227.     fi
  7228.     ;;
  7229. *) dflt="$alignbytes"
  7230.     ;;
  7231. esac
  7232. rp="Doubles must be aligned on a how-many-byte boundary?"
  7233. . ./myread
  7234. alignbytes="$ans"
  7235. $rm -f try.c try
  7236.  
  7237. : Define several unixisms. Hints files or command line options
  7238. : can be used to override them.
  7239. case "$ar" in
  7240. '') ar='ar';;
  7241. esac
  7242. case "$lib_ext" in
  7243. '') lib_ext='.a';;
  7244. esac
  7245. case "$obj_ext" in
  7246. '') obj_ext='.o';;
  7247. esac
  7248. case "$path_sep" in
  7249. '') path_sep=':';;
  7250. esac
  7251. : Which makefile gets called first.  This is used by make depend.
  7252. case "$firstmakefile" in
  7253. '') firstmakefile='makefile';;
  7254. esac
  7255.  
  7256. : check for ordering of bytes in a long
  7257. case "$byteorder" in
  7258. '')
  7259.     $cat <<'EOM'
  7260.   
  7261. In the following, larger digits indicate more significance.  A big-endian
  7262. machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
  7263. little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
  7264. machines may have weird orders like 3412.  A Cray will report 87654321. If
  7265. the test program works the default is probably right.
  7266. I'm now running the test program...
  7267. EOM
  7268.     $cat >try.c <<'EOCP'
  7269. #include <stdio.h>
  7270. main()
  7271. {
  7272.     int i;
  7273.     union {
  7274.         unsigned long l;
  7275.         char c[sizeof(long)];
  7276.     } u;
  7277.  
  7278.     if (sizeof(long) > 4)
  7279.         u.l = (0x08070605L << 32) | 0x04030201L;
  7280.     else
  7281.         u.l = 0x04030201L;
  7282.     for (i = 0; i < sizeof(long); i++)
  7283.         printf("%c", u.c[i]+'0');
  7284.     printf("\n");
  7285.     exit(0);
  7286. }
  7287. EOCP
  7288.     xxx_prompt=y
  7289.     if $cc $ccflags try.c -o try >/dev/null 2>&1 && ./try > /dev/null; then
  7290.         dflt=`./try`
  7291.         case "$dflt" in
  7292.         [1-4][1-4][1-4][1-4]|12345678|87654321)
  7293.             echo "(The test program ran ok.)"
  7294.             echo "byteorder=$dflt"
  7295.             xxx_prompt=n
  7296.             ;;
  7297.         ????|????????) echo "(The test program ran ok.)" ;;
  7298.         *) echo "(The test program didn't run right for some reason.)" ;;
  7299.         esac
  7300.     else
  7301.         dflt='4321'
  7302.         cat <<'EOM'
  7303. (I can't seem to compile the test program.  Guessing big-endian...)
  7304. EOM
  7305.     fi
  7306.     case "$xxx_prompt" in
  7307.     y)
  7308.         rp="What is the order of bytes in a long?"
  7309.         . ./myread
  7310.         byteorder="$ans"
  7311.         ;;
  7312.     *)    byteorder=$dflt
  7313.         ;;
  7314.     esac
  7315.     ;;
  7316. esac
  7317. $rm -f try.c try
  7318.  
  7319. : how do we catenate cpp tokens here?
  7320. echo " "
  7321. echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
  7322. $cat >cpp_stuff.c <<'EOCP'
  7323. #define RCAT(a,b)a/**/b
  7324. #define ACAT(a,b)a ## b
  7325. RCAT(Rei,ser)
  7326. ACAT(Cir,cus)
  7327. EOCP
  7328. $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
  7329. if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
  7330.     echo "Oh!  Smells like ANSI's been here."
  7331.     echo "We can catify or stringify, separately or together!"
  7332.     cpp_stuff=42
  7333. elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
  7334.     echo "Ah, yes!  The good old days!"
  7335.     echo "However, in the good old days we don't know how to stringify and"
  7336.     echo "catify at the same time."
  7337.     cpp_stuff=1
  7338. else
  7339.     $cat >&4 <<EOM
  7340. Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
  7341. to have to edit the values of CAT[2-5] in config.h...
  7342. EOM
  7343.     cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
  7344. fi
  7345. $rm -f cpp_stuff.*
  7346.  
  7347. : see if this is a db.h system
  7348. set db.h i_db
  7349. eval $inhdr
  7350.  
  7351. case "$i_db" in
  7352. define)
  7353.     : Check the return type needed for hash 
  7354.     echo " "
  7355.     echo "Checking return type needed for hash for Berkeley DB ..." >&4
  7356.     $cat >try.c <<EOCP
  7357. #$d_const HASCONST
  7358. #ifndef HASCONST
  7359. #define const
  7360. #endif
  7361. #include <sys/types.h>
  7362. #include <db.h>
  7363. u_int32_t hash_cb (ptr, size)
  7364. const void *ptr;
  7365. size_t size;
  7366. {
  7367. }
  7368. HASHINFO info;
  7369. main()
  7370. {
  7371.     info.hash = hash_cb;
  7372. }
  7373. EOCP
  7374.     if $cc $ccflags -c try.c >try.out 2>&1 ; then
  7375.         if $contains warning try.out >>/dev/null 2>&1 ; then
  7376.             db_hashtype='int'
  7377.         else
  7378.             db_hashtype='u_int32_t'
  7379.         fi
  7380.     else
  7381.         echo "I can't seem to compile the test program." >&4
  7382.         db_hashtype=int
  7383.     fi
  7384.     $rm -f try.*
  7385.     echo "Your version of Berkeley DB uses $db_hashtype for hash."
  7386.     ;;
  7387. *)    db_hashtype=int
  7388.     ;;
  7389. esac
  7390.  
  7391. case "$i_db" in
  7392. define)
  7393.     : Check the return type needed for prefix 
  7394.     echo " "
  7395.     echo "Checking return type needed for prefix for Berkeley DB ..." >&4
  7396.     cat >try.c <<EOCP
  7397. #$d_const HASCONST
  7398. #ifndef HASCONST
  7399. #define const
  7400. #endif
  7401. #include <sys/types.h>
  7402. #include <db.h>
  7403. size_t prefix_cb (key1, key2)
  7404. const DBT *key1;
  7405. const DBT *key2;
  7406. {
  7407. }
  7408. BTREEINFO info;
  7409. main()
  7410. {
  7411.     info.prefix = prefix_cb;
  7412. }
  7413. EOCP
  7414.     if $cc $ccflags -c try.c  >try.out 2>&1 ; then
  7415.         if $contains warning try.out >>/dev/null 2>&1 ; then
  7416.             db_prefixtype='int'
  7417.         else
  7418.             db_prefixtype='size_t'
  7419.         fi
  7420.     else
  7421.         echo "I can't seem to compile the test program." >&4
  7422.         db_prefixtype='int'
  7423.     fi
  7424.     $rm -f try.*
  7425.     echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
  7426.     ;;
  7427. *)    db_prefixtype='int'
  7428.     ;;
  7429. esac
  7430.  
  7431. : check for void type
  7432. echo " "
  7433. echo "Checking to see how well your C compiler groks the void type..." >&4
  7434. echo " "
  7435. $cat >&4 <<EOM
  7436.   Support flag bits are:
  7437.     1: basic void declarations.
  7438.     2: arrays of pointers to functions returning void.
  7439.     4: operations between pointers to and addresses of void functions.
  7440.     8: generic void pointers.
  7441. EOM
  7442. echo " "
  7443. case "$voidflags" in
  7444. '')
  7445.     $cat >try.c <<'EOCP'
  7446. #if TRY & 1
  7447. void main() {
  7448. #else
  7449. main() {
  7450. #endif
  7451.     extern void moo();    /* function returning void */
  7452.     void (*goo)();        /* ptr to func returning void */
  7453. #if TRY & 8
  7454.     void *hue;        /* generic ptr */
  7455. #endif
  7456. #if TRY & 2
  7457.     void (*foo[10])();
  7458. #endif
  7459.  
  7460. #if TRY & 4
  7461.     if(goo == moo) {
  7462.         exit(0);
  7463.     }
  7464. #endif
  7465.     exit(0);
  7466. }
  7467. EOCP
  7468.     if $cc -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
  7469.         voidflags=$defvoidused
  7470.     echo "It appears to support void to the level $package wants ($defvoidused)."
  7471.         if $contains warning .out >/dev/null 2>&1; then
  7472.             echo "However, you might get some warnings that look like this:"
  7473.             $cat .out
  7474.         fi
  7475.     else
  7476. echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
  7477.         if $cc -c -DTRY=1 try.c >/dev/null 2>&1 ; then
  7478.             echo "It supports 1..."
  7479.             if $cc -c -DTRY=3 try.c >/dev/null 2>&1 ; then
  7480.                 echo "It also supports 2..."
  7481.                 if $cc -c -DTRY=7 try.c >/dev/null 2>&1 ; then
  7482.                     voidflags=7
  7483.                     echo "And it supports 4 but not 8 definitely."
  7484.                 else
  7485.                     echo "It doesn't support 4..."
  7486.                     if $cc -c -DTRY=11 try.c >/dev/null 2>&1 ; then
  7487.                         voidflags=11
  7488.                         echo "But it supports 8."
  7489.                     else
  7490.                         voidflags=3
  7491.                         echo "Neither does it support 8."
  7492.                     fi
  7493.                 fi
  7494.             else
  7495.                 echo "It does not support 2..."
  7496.                 if $cc -c -DTRY=13 try.c >/dev/null 2>&1 ; then
  7497.                     voidflags=13
  7498.                     echo "But it supports 4 and 8."
  7499.                 else
  7500.                     if $cc -c -DTRY=5 try.c >/dev/null 2>&1 ; then
  7501.                         voidflags=5
  7502.                         echo "And it supports 4 but has not heard about 8."
  7503.                     else
  7504.                         echo "However it supports 8 but not 4."
  7505.                     fi
  7506.                 fi
  7507.             fi
  7508.         else
  7509.             echo "There is no support at all for void."
  7510.             voidflags=0
  7511.         fi
  7512.     fi
  7513. esac
  7514. : Only prompt user if support does not match the level we want
  7515. case "$voidflags" in
  7516. "$defvoidused") ;;
  7517. *)
  7518.     dflt="$voidflags";
  7519.     rp="Your void support flags add up to what?"
  7520.     . ./myread
  7521.     voidflags="$ans"
  7522.     ;;
  7523. esac
  7524. $rm -f try.* .out
  7525.  
  7526. : see what type file positions are declared as in the library
  7527. set fpos_t fpostype long stdio.h sys/types.h
  7528. eval $typedef
  7529. echo " "
  7530. dflt="$fpostype"
  7531. rp="What is the type for file position used by fsetpos()?"
  7532. . ./myread
  7533. fpostype="$ans"
  7534.  
  7535. : Store the full pathname to the sed program for use in the C program
  7536. full_sed=$sed
  7537.  
  7538. : see what type gids are declared as in the kernel
  7539. set gid_t gidtype xxx stdio.h sys/types.h
  7540. eval $typedef
  7541. case "$gidtype" in
  7542. xxx)
  7543.     xxx=`./findhdr sys/user.h`
  7544.     set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
  7545.     case $1 in
  7546.     unsigned) dflt="$1 $2" ;;
  7547.     *) dflt="$1" ;;
  7548.     esac
  7549.     ;;
  7550. *) dflt="$gidtype";;
  7551. esac
  7552. echo " "
  7553. rp="What is the type for group ids returned by getgid()?"
  7554. . ./myread
  7555. gidtype="$ans"
  7556.  
  7557. : see if getgroups exists
  7558. set getgroups d_getgrps
  7559. eval $inlibc
  7560.  
  7561. : Find type of 2nd arg to getgroups
  7562. echo " "
  7563. case "$d_getgrps" in
  7564. 'define')
  7565.     case "$groupstype" in
  7566.     '') dflt="$gidtype" ;;
  7567.     *)  dflt="$groupstype" ;;
  7568.     esac
  7569.     $cat <<EOM
  7570. What is the type of the second argument to getgroups()?  Usually this
  7571. is the same as group ids, $gidtype, but not always.
  7572.  
  7573. EOM
  7574.     rp='What type is the second argument to getgroups()?'
  7575.     . ./myread
  7576.     groupstype="$ans"
  7577.     ;;
  7578. *)  groupstype="$gidtype";;
  7579. esac
  7580.  
  7581. : see what type lseek is declared as in the kernel
  7582. set off_t lseektype long stdio.h sys/types.h
  7583. eval $typedef
  7584. echo " "
  7585. dflt="$lseektype"
  7586. rp="What type is lseek's offset on this system declared as?"
  7587. . ./myread
  7588. lseektype="$ans"
  7589.  
  7590. : see what type is used for mode_t
  7591. set mode_t modetype int stdio.h sys/types.h
  7592. eval $typedef
  7593. dflt="$modetype"
  7594. echo " "
  7595. rp="What type is used for file modes?"
  7596. . ./myread
  7597. modetype="$ans"
  7598.  
  7599. : locate the preferred pager for this system
  7600. case "$pager" in
  7601. '')
  7602.     dflt=''
  7603.     case "$pg" in
  7604.     /*) dflt=$pg;;
  7605.     esac
  7606.     case "$more" in
  7607.     /*) dflt=$more;;
  7608.     esac
  7609.     case "$less" in
  7610.     /*) dflt=$less;;
  7611.     esac
  7612.     case "$dflt" in
  7613.     '') dflt=/usr/ucb/more;;
  7614.     esac
  7615.     ;;
  7616. *) dflt="$pager";;
  7617. esac
  7618. echo " "
  7619. fn=f/
  7620. rp='What pager is used on your system?'
  7621. . ./getfile
  7622. pager="$ans"
  7623.  
  7624. : Cruising for prototypes
  7625. echo " "
  7626. echo "Checking out function prototypes..." >&4
  7627. $cat >prototype.c <<'EOCP'
  7628. main(int argc, char *argv[]) {
  7629.     exit(0);}
  7630. EOCP
  7631. if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
  7632.     echo "Your C compiler appears to support function prototypes."
  7633.     val="$define"
  7634. else
  7635.     echo "Your C compiler doesn't seem to understand function prototypes."
  7636.     val="$undef"
  7637. fi
  7638. set prototype
  7639. eval $setvar
  7640. $rm -f prototype*
  7641.  
  7642. : check for size of random number generator
  7643. echo " "
  7644. case "$randbits" in
  7645. '')
  7646.     echo "Checking to see how many bits your rand function produces..." >&4
  7647.     $cat >try.c <<'EOCP'
  7648. #include <stdio.h>
  7649. main()
  7650. {
  7651.     register int i;
  7652.     register unsigned long tmp;
  7653.     register unsigned long max = 0L;
  7654.  
  7655.     for (i = 1000; i; i--) {
  7656.         tmp = (unsigned long)rand();
  7657.         if (tmp > max) max = tmp;
  7658.     }
  7659.     for (i = 0; max; i++)
  7660.         max /= 2;
  7661.     printf("%d\n",i);
  7662. }
  7663. EOCP
  7664.     if $cc try.c -o try >/dev/null 2>&1 ; then
  7665.         dflt=`try`
  7666.     else
  7667.         dflt='?'
  7668.         echo "(I can't seem to compile the test program...)"
  7669.     fi
  7670.     ;;
  7671. *)
  7672.     dflt="$randbits"
  7673.     ;;
  7674. esac
  7675. rp='How many bits does your rand() function produce?'
  7676. . ./myread
  7677. randbits="$ans"
  7678. $rm -f try.c try
  7679.  
  7680. : see if ar generates random libraries by itself
  7681. echo " "
  7682. echo "Checking how to generate random libraries on your machine..." >&4
  7683. echo 'int bar1() { return bar2(); }' > bar1.c
  7684. echo 'int bar2() { return 2; }' > bar2.c
  7685. $cat > foo.c <<'EOP'
  7686. main() { printf("%d\n", bar1()); exit(0); }
  7687. EOP
  7688. $cc $ccflags -c bar1.c >/dev/null 2>&1
  7689. $cc $ccflags -c bar2.c >/dev/null 2>&1
  7690. $cc $ccflags -c foo.c >/dev/null 2>&1
  7691. ar rc bar.a bar2.o bar1.o >/dev/null 2>&1
  7692. if $cc $ccflags $ldflags -o foobar foo.o bar.a $libs > /dev/null 2>&1 &&
  7693.     ./foobar >/dev/null 2>&1; then
  7694.     echo "ar appears to generate random libraries itself."
  7695.     orderlib=false
  7696.     ranlib=":"
  7697. elif ar ts bar.a >/dev/null 2>&1 &&
  7698.     $cc $ccflags $ldflags -o foobar foo.o bar.a $libs > /dev/null 2>&1 &&
  7699.     ./foobar >/dev/null 2>&1; then
  7700.         echo "a table of contents needs to be added with 'ar ts'."
  7701.         orderlib=false
  7702.         ranlib="ar ts"
  7703. else
  7704.     case "$ranlib" in
  7705.     :) ranlib='';;
  7706.     '')
  7707.         ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
  7708.         $test -f $ranlib || ranlib=''
  7709.         ;;
  7710.     esac
  7711.     if $test -n "$ranlib"; then
  7712.         echo "your system has '$ranlib'; we'll use that."
  7713.         orderlib=false
  7714.     else
  7715.         echo "your system doesn't seem to support random libraries"
  7716.         echo "so we'll use lorder and tsort to order the libraries."
  7717.         orderlib=true
  7718.         ranlib=":"
  7719.     fi
  7720. fi
  7721. $rm -f foo* bar* 
  7722.  
  7723. : see if sys/select.h has to be included
  7724. set sys/select.h i_sysselct
  7725. eval $inhdr
  7726.  
  7727. : see if we should include time.h, sys/time.h, or both
  7728. echo " "
  7729. echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
  7730. $echo $n "I'm now running the test program...$c"
  7731. $cat >try.c <<'EOCP'
  7732. #include <sys/types.h>
  7733. #ifdef I_TIME
  7734. #include <time.h>
  7735. #endif
  7736. #ifdef I_SYSTIME
  7737. #ifdef SYSTIMEKERNEL
  7738. #define KERNEL
  7739. #endif
  7740. #include <sys/time.h>
  7741. #endif
  7742. #ifdef I_SYSSELECT
  7743. #include <sys/select.h>
  7744. #endif
  7745. main()
  7746. {
  7747.     struct tm foo;
  7748. #ifdef S_TIMEVAL
  7749.     struct timeval bar;
  7750. #endif
  7751. #ifdef S_TIMEZONE
  7752.     struct timezone tzp;
  7753. #endif
  7754.     if (foo.tm_sec == foo.tm_sec)
  7755.         exit(0);
  7756. #ifdef S_TIMEVAL
  7757.     if (bar.tv_sec == bar.tv_sec)
  7758.         exit(0);
  7759. #endif
  7760.     exit(1);
  7761. }
  7762. EOCP
  7763. flags=''
  7764. for s_timezone in '-DS_TIMEZONE' ''; do
  7765. sysselect=''
  7766. for s_timeval in '-DS_TIMEVAL' ''; do
  7767. for i_systimek in '' '-DSYSTIMEKERNEL'; do
  7768. for i_time in '' '-DI_TIME'; do
  7769. for i_systime in '-DI_SYSTIME' ''; do
  7770.     case "$flags" in
  7771.     '') $echo $n ".$c"
  7772.         if $cc $ccflags \
  7773.         $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone \
  7774.         try.c -o try >/dev/null 2>&1 ; then
  7775.             set X $i_time $i_systime $i_systimek $sysselect $s_timeval
  7776.             shift
  7777.             flags="$*"
  7778.             echo " "
  7779.             $echo $n "Succeeded with $flags$c"
  7780.         fi
  7781.         ;;
  7782.     esac
  7783. done
  7784. done
  7785. done
  7786. done
  7787. done
  7788. timeincl=''
  7789. echo " "
  7790. case "$flags" in
  7791. *SYSTIMEKERNEL*) i_systimek="$define"
  7792.     timeincl=`./findhdr sys/time.h`
  7793.     echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
  7794. *) i_systimek="$undef";;
  7795. esac
  7796. case "$flags" in
  7797. *I_TIME*) i_time="$define"
  7798.     timeincl=`./findhdr time.h`" $timeincl"
  7799.     echo "We'll include <time.h>." >&4;;
  7800. *) i_time="$undef";;
  7801. esac
  7802. case "$flags" in
  7803. *I_SYSTIME*) i_systime="$define"
  7804.     timeincl=`./findhdr sys/time.h`" $timeincl"
  7805.     echo "We'll include <sys/time.h>." >&4;;
  7806. *) i_systime="$undef";;
  7807. esac
  7808. $rm -f try.c try
  7809.  
  7810. : check for fd_set items
  7811. $cat <<EOM
  7812.  
  7813. Checking to see how well your C compiler handles fd_set and friends ...
  7814. EOM
  7815. $cat >fd_set.c <<EOCP
  7816. #$i_systime I_SYS_TIME
  7817. #$i_sysselct I_SYS_SELECT
  7818. #$d_socket HAS_SOCKET
  7819. #include <sys/types.h>
  7820. #ifdef HAS_SOCKET
  7821. #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
  7822. #endif
  7823. #ifdef I_SYS_TIME
  7824. #include <sys/time.h>
  7825. #else
  7826. #ifdef I_SYS_SELECT
  7827. #include <sys/select.h>
  7828. #endif
  7829. #endif
  7830. main() {
  7831.     fd_set fds;
  7832.  
  7833. #ifdef TRYBITS
  7834.     if(fds.fds_bits);
  7835. #endif
  7836.  
  7837. #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
  7838.     exit(0);
  7839. #else
  7840.     exit(1);
  7841. #endif
  7842. }
  7843. EOCP
  7844. if $cc $ccflags -DTRYBITS fd_set.c -o fd_set >fd_set.out 2>&1 ; then
  7845.     d_fds_bits="$define"
  7846.     d_fd_set="$define"
  7847.     echo "Well, your system knows about the normal fd_set typedef..." >&4
  7848.     if ./fd_set; then
  7849.         echo "and you have the normal fd_set macros (just as I'd expect)." >&4
  7850.         d_fd_macros="$define"
  7851.     else
  7852.         $cat >&4 <<'EOM'
  7853. but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
  7854. EOM
  7855.         d_fd_macros="$undef"
  7856.     fi
  7857. else
  7858.     $cat <<'EOM'
  7859. Hmm, your compiler has some difficulty with fd_set.  Checking further...
  7860. EOM
  7861.     if $cc $ccflags fd_set.c -o fd_set >fd_set.out 2>&1 ; then
  7862.         d_fds_bits="$undef"
  7863.         d_fd_set="$define"
  7864.         echo "Well, your system has some sort of fd_set available..." >&4
  7865.         if ./fd_set; then
  7866.             echo "and you have the normal fd_set macros." >&4
  7867.             d_fd_macros="$define"
  7868.         else
  7869.             $cat <<'EOM'
  7870. but not the normal fd_set macros!  Gross!  More work for me...
  7871. EOM
  7872.             d_fd_macros="$undef"
  7873.         fi
  7874.     else
  7875.     echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
  7876.         d_fd_set="$undef"
  7877.         d_fds_bits="$undef"
  7878.         d_fd_macros="$undef"
  7879.     fi
  7880. fi
  7881. $rm -f fd_set*
  7882.  
  7883.  
  7884. : check for type of arguments to select.  This will only really
  7885. : work if the system supports prototypes and provides one for
  7886. : select.
  7887. case "$d_select" in
  7888. $define)
  7889.     : Make initial guess
  7890.     case "$selecttype" in
  7891.     ''|' ')
  7892.         case "$d_fd_set" in
  7893.         $define) xxx='fd_set *' ;;
  7894.         *) xxx='int *' ;;
  7895.         esac
  7896.         ;;
  7897.     *)     xxx="$selecttype" 
  7898.         ;;
  7899.     esac
  7900.     : backup guess
  7901.     case "$xxx" in
  7902.     'fd_set *') yyy='int *' ;;
  7903.     'int *') yyy='fd_set *' ;;
  7904.     esac
  7905.  
  7906.     $cat <<EOM
  7907.  
  7908. Checking to see what type of arguments are expected by select().
  7909. EOM
  7910.     $cat >try.c <<EOCP
  7911. #$i_systime I_SYS_TIME
  7912. #$i_sysselct I_SYS_SELECT
  7913. #$d_socket HAS_SOCKET
  7914. #include <sys/types.h>
  7915. #ifdef HAS_SOCKET
  7916. #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
  7917. #endif
  7918. #ifdef I_SYS_TIME
  7919. #include <sys/time.h>
  7920. #else
  7921. #ifdef I_SYS_SELECT
  7922. #include <sys/select.h>
  7923. #endif
  7924. #endif
  7925. main()
  7926. {
  7927.     int width;
  7928.     Select_fd_set_t readfds;
  7929.     Select_fd_set_t writefds;
  7930.     Select_fd_set_t exceptfds;
  7931.     struct timeval timeout;
  7932.     select(width, readfds, writefds, exceptfds, &timeout);
  7933.     exit(0);
  7934. }
  7935. EOCP
  7936.     if $cc $ccflags -c -DSelect_fd_set_t="$xxx" try.c >/dev/null 2>&1 ; then
  7937.         selecttype="$xxx"
  7938.         echo "Your system uses $xxx for the arguments to select." >&4
  7939.     elif $cc $ccflags -c -DSelect_fd_set_t="$yyy" try.c >/dev/null 2>&1 ; then
  7940.         selecttype="$yyy"
  7941.         echo "Your system uses $yyy for the arguments to select." >&4
  7942.     else
  7943.         rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
  7944.         dflt="$xxx"
  7945.         . ./myread
  7946.         selecttype="$ans"
  7947.     fi
  7948.     $rm -f try.[co]
  7949.     ;;
  7950. *)    selecttype='int *'
  7951.     ;;
  7952. esac
  7953.  
  7954. : Trace out the files included by signal.h, then look for SIGxxx names.
  7955. : Remove SIGARRAYSIZE used by HPUX.
  7956. : Remove SIGTYP void lines used by OS2.
  7957. xxx=`echo '#include <signal.h>' |
  7958.     $cppstdin $cppminus $cppflags 2>/dev/null |
  7959.     $grep '^[     ]*#.*include' | 
  7960.     $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
  7961. : Check this list of files to be sure we have parsed the cpp output ok.
  7962. : This will also avoid potentially non-existent files, such 
  7963. : as ../foo/bar.h
  7964. xxxfiles=''
  7965. for xx in $xxx /dev/null ; do
  7966.     $test -f "$xx" && xxxfiles="$xxxfiles $xx"
  7967. done
  7968. : If we have found no files, at least try signal.h
  7969. case "$xxxfiles" in
  7970. '')    xxxfiles=`./findhdr signal.h` ;;
  7971. esac
  7972. xxx=`awk '
  7973. $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $3 !~ /void/ {
  7974.     print substr($2, 4, 20)
  7975. }
  7976. $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
  7977.     print substr($3, 4, 20)
  7978. }' $xxxfiles`
  7979. : Append some common names just in case the awk scan failed.
  7980. xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
  7981. xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
  7982. xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
  7983. xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
  7984. : generate a few handy files for later
  7985. $cat > signal.c <<'EOP'
  7986. #include <sys/types.h>
  7987. #include <signal.h>
  7988. int main() {
  7989. #ifdef NSIG
  7990. printf("NSIG %d\n", NSIG);
  7991. #else
  7992. #ifdef _NSIG
  7993. printf("NSIG %d\n", _NSIG);
  7994. #endif
  7995. #endif
  7996. EOP
  7997. echo $xxx | $tr ' ' '\012' | $sort | $uniq | $awk '
  7998. {
  7999.     printf "#ifdef SIG"; printf $1; printf "\n"
  8000.     printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
  8001.     printf $1; printf ");\n"
  8002.     printf "#endif\n"
  8003. }
  8004. END {
  8005.     printf "}\n";
  8006. }
  8007. ' >>signal.c
  8008. $cat >signal.awk <<'EOP'
  8009. BEGIN { ndups = 0 }
  8010. $1 ~ /^NSIG$/ { nsig = $2 }
  8011. ($1 !~ /^NSIG$/) && (NF == 2) {
  8012.     if ($2 > maxsig) { maxsig = $2 }
  8013.     if (sig_name[$2]) {
  8014.     dup_name[ndups] = $1
  8015.     dup_num[ndups] = $2
  8016.     ndups++ 
  8017.     }
  8018.     else {
  8019.     sig_name[$2] = $1
  8020.     sig_num[$2] = $2
  8021.     }
  8022.  
  8023. }
  8024. END { 
  8025.     if (nsig == 0) { nsig = maxsig + 1 }
  8026.     for (n = 1; n < nsig; n++) {
  8027.         if (sig_name[n]) {
  8028.             printf("%s %d\n", sig_name[n], sig_num[n])
  8029.         }
  8030.         else {
  8031.             printf("NUM%d %d\n", n, n) 
  8032.         }
  8033.     }
  8034.     for (n = 0; n < ndups; n++) {
  8035.         printf("%s %d\n", dup_name[n], dup_num[n])
  8036.     }
  8037. }
  8038. EOP
  8039. $cat >signal_cmd <<EOS
  8040. $startsh
  8041. $test -s signal.lst && exit 0
  8042. if $cc $ccflags signal.c -o signal $ldflags >/dev/null 2>&1; then
  8043.     ./signal | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
  8044. else
  8045.     echo "(I can't seem be able to compile the test program -- Guessing)"
  8046.     echo 'kill -l' >signal
  8047.     set X \`csh -f <signal\`
  8048.     $rm -f signal
  8049.     shift
  8050.     case \$# in
  8051.     0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
  8052.     esac
  8053.     echo \$@ | $tr ' ' '\012' | \
  8054.         $awk '{ printf $1; printf " %d\n", ++s; }' >signal.lst
  8055. fi
  8056. $rm -f signal.c signal signal.o
  8057. EOS
  8058. chmod a+x signal_cmd
  8059. $eunicefix signal_cmd
  8060.  
  8061. : generate list of signal names
  8062. echo " "
  8063. case "$sig_name" in
  8064. '')    sig_num='' ;;
  8065. esac
  8066. case "$sig_num" in
  8067. '')    sig_name='' ;;
  8068. esac
  8069. case "$sig_name" in
  8070. '')
  8071.     echo "Generating a list of signal names and numbers..." >&4
  8072.     ./signal_cmd
  8073.     sig_name=`$awk '{printf "%s ", $1}' signal.lst`
  8074.     sig_name="ZERO $sig_name"
  8075.     sig_num=`$awk '{printf "%d ", $2}' signal.lst`
  8076.     sig_num="0 $sig_num"
  8077.     ;;
  8078. esac
  8079. echo "The following signals are available:"
  8080. echo " "
  8081. echo $sig_name | $awk \
  8082. 'BEGIN { linelen = 0 }
  8083. {
  8084.     for (i = 1; i <= NF; i++) {
  8085.         name = "SIG" $i " "
  8086.         linelen = linelen + length(name)
  8087.         if (linelen > 70) {
  8088.             printf "\n"
  8089.             linelen = length(name)
  8090.         }
  8091.         printf "%s", name
  8092.     }
  8093.     printf "\n"
  8094. }'
  8095. $rm -f signal signal.c signal.awk signal.lst signal_cmd 
  8096.  
  8097. : see what type is used for size_t
  8098. set size_t sizetype 'unsigned int' stdio.h sys/types.h
  8099. eval $typedef
  8100. dflt="$sizetype"
  8101. echo " "
  8102. rp="What type is used for the length parameter for string functions?"
  8103. . ./myread
  8104. sizetype="$ans"
  8105.  
  8106. : see what type is used for signed size_t
  8107. set ssize_t ssizetype int stdio.h sys/types.h
  8108. eval $typedef
  8109. dflt="$ssizetype"
  8110. $cat > ssize.c <<EOM
  8111. #include <stdio.h>
  8112. #include <sys/types.h>
  8113. #define Size_t $sizetype
  8114. #define SSize_t $dflt
  8115. main()
  8116. {
  8117.     if (sizeof(Size_t) == sizeof(SSize_t))
  8118.         printf("$dflt\n");
  8119.     else if (sizeof(Size_t) == sizeof(int))
  8120.         printf("int\n");
  8121.     else 
  8122.         printf("long\n");
  8123. }
  8124. EOM
  8125. echo " "
  8126. if $cc $ccflags $ldflags -o ssize ssize.c $libs > /dev/null 2>&1 ; then
  8127.     ssizetype=`./ssize`
  8128.     echo "I'll be using $ssizetype for functions returning a byte count." >&4
  8129. else
  8130.     echo "(I can't compile the test program--please enlighten me!)"
  8131.     $cat <<EOM
  8132.  
  8133. I need a type that is the same size as $sizetype, but is guaranteed to
  8134. be signed.  Common values are int and long.
  8135.  
  8136. EOM
  8137.     rp="What signed type is the same size as $sizetype?"
  8138.     . ./myread
  8139.     ssizetype="$ans"
  8140. fi
  8141. $rm -f ssize ssize.[co]
  8142.  
  8143. : see what type of char stdio uses.
  8144. echo " "
  8145. if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
  8146.     echo "Your stdio uses unsigned chars." >&4
  8147.     stdchar="unsigned char"
  8148. else
  8149.     echo "Your stdio uses signed chars." >&4
  8150.     stdchar="char"
  8151. fi
  8152.  
  8153. : see if time exists
  8154. echo " "
  8155. if set time val -f d_time; eval $csym; $val; then
  8156.     echo 'time() found.' >&4
  8157.     val="$define"
  8158.     set time_t timetype long stdio.h sys/types.h
  8159.     eval $typedef
  8160.     dflt="$timetype"
  8161.     echo " "
  8162.     rp="What type is returned by time() on this system?"
  8163.     . ./myread
  8164.     timetype="$ans"
  8165. else
  8166.     echo 'time() not found, hope that will do.' >&4
  8167.     val="$undef"
  8168.     timetype='int';
  8169. fi
  8170. set d_time
  8171. eval $setvar
  8172.  
  8173. : see what type uids are declared as in the kernel
  8174. set uid_t uidtype xxx stdio.h sys/types.h
  8175. eval $typedef
  8176. case "$uidtype" in
  8177. xxx)
  8178.     xxx=`./findhdr sys/user.h`
  8179.     set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
  8180.     case $1 in
  8181.     unsigned) dflt="$1 $2" ;;
  8182.     *) dflt="$1" ;;
  8183.     esac
  8184.     ;;
  8185. *) dflt="$uidtype";;
  8186. esac
  8187. echo " "
  8188. rp="What is the type for user ids returned by getuid()?"
  8189. . ./myread
  8190. uidtype="$ans"
  8191.  
  8192. : see if dbm.h is available
  8193. : see if dbmclose exists
  8194. set dbmclose d_dbmclose
  8195. eval $inlibc
  8196.  
  8197. case "$d_dbmclose" in
  8198. $define)
  8199.     set dbm.h i_dbm
  8200.     eval $inhdr
  8201.     case "$i_dbm" in
  8202.     $define)
  8203.         val="$undef"
  8204.         set i_rpcsvcdbm
  8205.         eval $setvar
  8206.         ;;
  8207.     *)    set rpcsvc/dbm.h i_rpcsvcdbm
  8208.         eval $inhdr
  8209.         ;;
  8210.     esac
  8211.     ;;
  8212. *)    echo "We won't be including <dbm.h>"
  8213.     val="$undef"
  8214.     set i_dbm
  8215.     eval $setvar
  8216.     val="$undef"
  8217.     set i_rpcsvcdbm
  8218.     eval $setvar
  8219.     ;;
  8220. esac
  8221.  
  8222. : see if this is a sys/file.h system
  8223. val=''
  8224. set sys/file.h val
  8225. eval $inhdr
  8226.  
  8227. : do we need to include sys/file.h ?
  8228. case "$val" in
  8229. "$define")
  8230.     echo " "
  8231.     if $h_sysfile; then
  8232.         val="$define"
  8233.         echo "We'll be including <sys/file.h>." >&4
  8234.     else
  8235.         val="$undef"
  8236.         echo "We won't be including <sys/file.h>." >&4
  8237.     fi
  8238.     ;;
  8239. *)
  8240.     h_sysfile=false
  8241.     ;;
  8242. esac
  8243. set i_sysfile
  8244. eval $setvar
  8245.  
  8246. : see if fcntl.h is there
  8247. val=''
  8248. set fcntl.h val
  8249. eval $inhdr
  8250.  
  8251. : see if we can include fcntl.h
  8252. case "$val" in
  8253. "$define")
  8254.     echo " "
  8255.     if $h_fcntl; then
  8256.         val="$define"
  8257.         echo "We'll be including <fcntl.h>." >&4
  8258.     else
  8259.         val="$undef"
  8260.         if $h_sysfile; then
  8261.     echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
  8262.         else
  8263.             echo "We won't be including <fcntl.h>." >&4
  8264.         fi
  8265.     fi
  8266.     ;;
  8267. *)
  8268.     h_fcntl=false
  8269.     val="$undef"
  8270.     ;;
  8271. esac
  8272. set i_fcntl
  8273. eval $setvar
  8274.  
  8275. : see if this is an grp system
  8276. set grp.h i_grp
  8277. eval $inhdr
  8278.  
  8279. : see if locale.h is available
  8280. set locale.h i_locale
  8281. eval $inhdr
  8282.  
  8283. : see if this is a math.h system
  8284. set math.h i_math
  8285. eval $inhdr
  8286.  
  8287. : see if memory.h is available.
  8288. val=''
  8289. set memory.h val
  8290. eval $inhdr
  8291.  
  8292. : See if it conflicts with string.h
  8293. case "$val" in
  8294. $define)
  8295.     case "$strings" in
  8296.     '') ;;
  8297.     *)
  8298.         $cppstdin $cppflags $cppminus < $strings > mem.h
  8299.         if $contains 'memcpy' mem.h >/dev/null 2>&1; then
  8300.             echo " "
  8301.             echo "We won't be including <memory.h>."
  8302.             val="$undef"
  8303.         fi
  8304.         $rm -f mem.h
  8305.         ;;
  8306.     esac
  8307. esac
  8308. set i_memory
  8309. eval $setvar
  8310.  
  8311. : see if ndbm.h is available
  8312. set ndbm.h t_ndbm
  8313. eval $inhdr
  8314. case "$t_ndbm" in
  8315. $define)
  8316.     : see if dbm_open exists
  8317.     set dbm_open d_dbm_open
  8318.     eval $inlibc
  8319.     case "$d_dbm_open" in
  8320.     $undef)
  8321.         t_ndbm="$undef"
  8322.         echo "We won't be including <ndbm.h>"
  8323.         ;;
  8324.     esac
  8325.     ;;
  8326. esac
  8327. val="$t_ndbm"
  8328. set i_ndbm
  8329. eval $setvar
  8330.  
  8331. : see if net/errno.h is available
  8332. val=''
  8333. set net/errno.h val
  8334. eval $inhdr
  8335.  
  8336. : Unfortunately, it causes problems on some systems.  Arrgh.
  8337. case "$val" in
  8338. $define)
  8339.     cat > try.c <<'EOM'
  8340. #include <stdio.h>
  8341. #include <errno.h>
  8342. #include <net/errno.h>
  8343. int func()
  8344. {
  8345.     return ENOTSOCK;
  8346. }
  8347. EOM
  8348.     if $cc $ccflags -c try.c >/dev/null 2>&1; then
  8349.         echo "We'll be including <net/errno.h>." >&4
  8350.     else
  8351.         echo "We won't be including <net/errno.h>." >&4
  8352.         val="$undef"
  8353.     fi
  8354.     $rm -f try.* try
  8355.     ;;
  8356. esac
  8357. set i_neterrno
  8358. eval $setvar
  8359.  
  8360. : get C preprocessor symbols handy
  8361. echo " "
  8362. $echo $n "Hmm... $c"
  8363. echo $al | $tr ' ' '\012' >Cppsym.know
  8364. $cat <<EOSS >Cppsym
  8365. $startsh
  8366. case "\$1" in
  8367. -l) list=true
  8368.     shift
  8369.     ;;
  8370. esac
  8371. unknown=''
  8372. case "\$list\$#" in
  8373. 1|2)
  8374.     for sym do
  8375.         if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
  8376.             exit 0
  8377.         elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
  8378.             :
  8379.         else
  8380.             unknown="\$unknown \$sym"
  8381.         fi
  8382.     done
  8383.     set X \$unknown
  8384.     shift
  8385.     ;;
  8386. esac
  8387. case \$# in
  8388. 0) exit 1;;
  8389. esac
  8390. echo \$* | $tr ' ' '\012' | $sed -e 's/\(.*\)/\\
  8391. #ifdef \1\\
  8392. exit 0; _ _ _ _\1\\     \1\\
  8393. #endif\\
  8394. /' >Cppsym\$\$
  8395. echo "exit 1; _ _ _" >>Cppsym\$\$
  8396. $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
  8397. case "\$list" in
  8398. true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
  8399. *)
  8400.     sh Cppsym2\$\$
  8401.     status=\$?
  8402.     ;;
  8403. esac
  8404. $rm -f Cppsym\$\$ Cppsym2\$\$
  8405. exit \$status
  8406. EOSS
  8407. chmod +x Cppsym
  8408. $eunicefix Cppsym
  8409. ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
  8410.  
  8411. : now check the C compiler for additional symbols
  8412. $cat >ccsym <<EOS
  8413. $startsh
  8414. $cat >tmp.c <<EOF
  8415. extern int foo;
  8416. EOF
  8417. for i in \`$cc -v -c tmp.c 2>&1\`
  8418. do
  8419.     case "\$i" in
  8420.     -D*) echo "\$i" | $sed 's/^-D//';;
  8421.     -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
  8422.     esac
  8423. done
  8424. $rm -f try.c
  8425. EOS
  8426. chmod +x ccsym
  8427. $eunicefix ccsym
  8428. ./ccsym | $sort | $uniq >ccsym.raw
  8429. $awk '/\=/ { print $0; next }
  8430.     { print $0"=1" }' ccsym.raw >ccsym.list
  8431. $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
  8432. $comm -13 ccsym.true ccsym.list >ccsym.own
  8433. $comm -12 ccsym.true ccsym.list >ccsym.com
  8434. $comm -23 ccsym.true ccsym.list >ccsym.cpp
  8435. also=''
  8436. symbols='symbols'
  8437. if $test -z ccsym.raw; then
  8438.     echo "Your C compiler doesn't seem to define any symbol!" >&4
  8439.     echo " "
  8440.     echo "However, your C preprocessor defines the following ones:"
  8441.     $cat Cppsym.true
  8442. else
  8443.     if $test -s ccsym.com; then
  8444.         echo "Your C compiler and pre-processor define these symbols:"
  8445.         $sed -e 's/\(.*\)=.*/\1/' ccsym.com
  8446.         also='also '
  8447.         symbols='ones'
  8448.         $test "$silent" || sleep 1
  8449.     fi
  8450.     if $test -s ccsym.cpp; then
  8451.         $test "$also" && echo " "
  8452.         echo "Your C pre-processor ${also}defines the following $symbols:"
  8453.         $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
  8454.         also='further '
  8455.         $test "$silent" || sleep 1
  8456.     fi
  8457.     if $test -s ccsym.own; then
  8458.         $test "$also" && echo " "
  8459.         echo "Your C compiler ${also}defines the following cpp variables:"
  8460.         $sed -e 's/\(.*\)=1/\1/' ccsym.own
  8461.         $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
  8462.         $test "$silent" || sleep 1
  8463.     fi
  8464. fi
  8465. $rm -f ccsym*
  8466.  
  8467. : see if this is a termio system
  8468. val="$undef"
  8469. val2="$undef"
  8470. val3="$undef"
  8471. if $test `./findhdr termios.h`; then
  8472.     set tcsetattr i_termios
  8473.     eval $inlibc
  8474.     val3="$i_termios"
  8475. fi
  8476. echo " "
  8477. case "$val3" in
  8478. "$define") echo "You have POSIX termios.h... good!" >&4;;
  8479. *) if ./Cppsym pyr; then
  8480.         case "`/bin/universe`" in
  8481.         ucb) if $test `./findhdr sgtty.h`; then
  8482.                 val2="$define"
  8483.                 echo "<sgtty.h> found." >&4
  8484.             else
  8485.                 echo "System is pyramid with BSD universe."
  8486.                 echo "<sgtty.h> not found--you could have problems." >&4
  8487.             fi;;
  8488.         *) if $test `./findhdr termio.h`; then
  8489.                 val="$define"
  8490.                 echo "<termio.h> found." >&4
  8491.             else
  8492.                 echo "System is pyramid with USG universe."
  8493.                 echo "<termio.h> not found--you could have problems." >&4
  8494.             fi;;
  8495.         esac
  8496.     elif ./usg; then
  8497.         if $test `./findhdr termio.h`; then
  8498.             echo "<termio.h> found." >&4
  8499.             val="$define"
  8500.         elif $test `./findhdr sgtty.h`; then
  8501.             echo "<sgtty.h> found." >&4
  8502.             val2="$define"
  8503.         else
  8504. echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
  8505.         fi
  8506.     else
  8507.         if $test `./findhdr sgtty.h`; then
  8508.             echo "<sgtty.h> found." >&4
  8509.             val2="$define"
  8510.         elif $test `./findhdr termio.h`; then
  8511.             echo "<termio.h> found." >&4
  8512.             val="$define"
  8513.         else
  8514. echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
  8515.         fi
  8516.     fi;;
  8517. esac
  8518. set i_termio; eval $setvar
  8519. val=$val2; set i_sgtty; eval $setvar
  8520. val=$val3; set i_termios; eval $setvar
  8521.  
  8522. : see if stdarg is available
  8523. echo " "
  8524. if $test `./findhdr stdarg.h`; then
  8525.     echo "<stdarg.h> found." >&4
  8526.     valstd="$define"
  8527. else
  8528.     echo "<stdarg.h> NOT found." >&4
  8529.     valstd="$undef"
  8530. fi
  8531.  
  8532. : see if varags is available
  8533. echo " "
  8534. if $test `./findhdr varargs.h`; then
  8535.     echo "<varargs.h> found." >&4
  8536. else
  8537.     echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
  8538. fi
  8539.  
  8540. : set up the varargs testing programs
  8541. $cat > varargs.c <<EOP
  8542. #ifdef I_STDARG
  8543. #include <stdarg.h>
  8544. #endif
  8545. #ifdef I_VARARGS
  8546. #include <varargs.h>
  8547. #endif
  8548.  
  8549. #ifdef I_STDARG
  8550. int f(char *p, ...)
  8551. #else
  8552. int f(va_alist)
  8553. va_dcl
  8554. #endif
  8555. {
  8556.     va_list ap;
  8557. #ifndef I_STDARG
  8558.     char *p;
  8559. #endif
  8560. #ifdef I_STDARG
  8561.     va_start(ap,p);
  8562. #else
  8563.     va_start(ap);
  8564.     p = va_arg(ap, char *);
  8565. #endif
  8566.     va_end(ap);
  8567. }
  8568. EOP
  8569. $cat > varargs <<EOP
  8570. $startsh
  8571. if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
  8572.     echo "true"
  8573. else
  8574.     echo "false"
  8575. fi
  8576. $rm -f varargs.o
  8577. EOP
  8578. chmod +x varargs
  8579.  
  8580. : now check which varargs header should be included
  8581. echo " "
  8582. i_varhdr=''
  8583. case "$valstd" in
  8584. "$define")
  8585.     if `./varargs I_STDARG`; then
  8586.         val='stdarg.h'
  8587.     elif `./varargs I_VARARGS`; then
  8588.         val='varargs.h'
  8589.     fi
  8590.     ;;
  8591. *)
  8592.     if `./varargs I_VARARGS`; then
  8593.         val='varargs.h'
  8594.     fi
  8595.     ;;
  8596. esac
  8597. case "$val" in
  8598. '')
  8599. echo "I could not find the definition for va_dcl... You have problems..." >&4
  8600.     val="$undef"; set i_stdarg; eval $setvar
  8601.     val="$undef"; set i_varargs; eval $setvar
  8602.     ;;
  8603. *) 
  8604.     set i_varhdr
  8605.     eval $setvar
  8606.     case "$i_varhdr" in
  8607.     stdarg.h)
  8608.         val="$define"; set i_stdarg; eval $setvar
  8609.         val="$undef"; set i_varargs; eval $setvar
  8610.         ;;
  8611.     varargs.h)
  8612.         val="$undef"; set i_stdarg; eval $setvar
  8613.         val="$define"; set i_varargs; eval $setvar
  8614.         ;;
  8615.     esac
  8616.     echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
  8617. esac
  8618. $rm -f varargs*
  8619.  
  8620. : see if stddef is available
  8621. set stddef.h i_stddef
  8622. eval $inhdr
  8623.  
  8624. : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
  8625. set sys/filio.h i_sysfilio
  8626. eval $inhdr
  8627. echo " "
  8628. if $test `./findhdr sys/ioctl.h`; then
  8629.     val="$define"
  8630.     echo '<sys/ioctl.h> found.' >&4
  8631. else
  8632.     val="$undef"
  8633.     if $test $i_sysfilio = "$define"; then
  8634.         echo '<sys/ioctl.h> NOT found.' >&4
  8635.     else
  8636.         $test $i_sgtty = "$define" && xxx="sgtty.h"
  8637.         $test $i_termio = "$define" && xxx="termio.h"
  8638.         $test $i_termios = "$define" && xxx="termios.h"
  8639. echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
  8640.     fi
  8641. fi
  8642. set i_sysioctl
  8643. eval $setvar
  8644.  
  8645. : see if this is a sys/param system
  8646. set sys/param.h i_sysparam
  8647. eval $inhdr
  8648.  
  8649. : see if sys/stat.h is available
  8650. set sys/stat.h i_sysstat
  8651. eval $inhdr
  8652.  
  8653. : see if sys/types.h has to be included
  8654. set sys/types.h i_systypes
  8655. eval $inhdr
  8656.  
  8657. : see if this is a sys/un.h system
  8658. set sys/un.h i_sysun
  8659. eval $inhdr
  8660.  
  8661. : see if this is a unistd.h system
  8662. set unistd.h i_unistd
  8663. eval $inhdr
  8664.  
  8665. : see if this is an utime system
  8666. set utime.h i_utime
  8667. eval $inhdr
  8668.  
  8669. : see if this is a vfork system
  8670. case "$d_vfork" in
  8671. "$define")
  8672.     set vfork.h i_vfork
  8673.     eval $inhdr
  8674.     ;;
  8675. *)
  8676.     i_vfork="$undef"
  8677.     ;;
  8678. esac
  8679.  
  8680. : see if gdbm.h is available
  8681. set gdbm.h t_gdbm
  8682. eval $inhdr
  8683. case "$t_gdbm" in
  8684. $define)
  8685.     : see if gdbm_open exists
  8686.     set gdbm_open d_gdbm_open
  8687.     eval $inlibc
  8688.     case "$d_gdbm_open" in
  8689.     $undef)
  8690.         t_gdbm="$undef"
  8691.         echo "We won't be including <gdbm.h>"
  8692.         ;;
  8693.     esac
  8694.     ;;
  8695. esac
  8696. val="$t_gdbm"
  8697. set i_gdbm
  8698. eval $setvar
  8699.  
  8700. echo " "
  8701. echo "Looking for extensions..." >&4
  8702. cd ../ext
  8703. : If we are using the old config.sh, known_extensions may contain
  8704. : old or inaccurate or duplicate values.
  8705. known_extensions=''
  8706. : We do not use find because it might not be available.
  8707. : We do not just use MANIFEST because the user may have dropped
  8708. : some additional extensions into the source tree and expect them
  8709. : to be built.
  8710. for xxx in * ; do
  8711.     if $test -f $xxx/$xxx.xs; then
  8712.         known_extensions="$known_extensions $xxx"
  8713.     else
  8714.         if $test -d $xxx; then
  8715.             cd $xxx
  8716.             for yyy in * ; do
  8717.                 if $test -f $yyy/$yyy.xs; then
  8718.                     known_extensions="$known_extensions $xxx/$yyy"
  8719.                 fi
  8720.             done
  8721.             cd ..
  8722.         fi
  8723.     fi
  8724. done
  8725. set X $known_extensions
  8726. shift
  8727. known_extensions="$*"
  8728. cd ../UU
  8729.  
  8730. : Now see which are supported on this system.
  8731. avail_ext=''
  8732. for xxx in $known_extensions ; do
  8733.     case "$xxx" in
  8734.     DB_File) case "$i_db" in 
  8735.         $define) avail_ext="$avail_ext $xxx" ;;
  8736.         esac
  8737.         ;;
  8738.     GDBM_File) case "$i_gdbm" in 
  8739.         $define) avail_ext="$avail_ext $xxx" ;;
  8740.         esac
  8741.         ;;
  8742.     NDBM_File) case "$i_ndbm" in 
  8743.         $define) avail_ext="$avail_ext $xxx" ;;
  8744.         esac
  8745.         ;;
  8746.     ODBM_File) case "${i_dbm}${i_rpcsvcdbm}" in 
  8747.         *"${define}"*) avail_ext="$avail_ext $xxx" ;;
  8748.         esac
  8749.         ;;
  8750.     POSIX) case "$useposix" in 
  8751.         true|define|y) avail_ext="$avail_ext $xxx" ;;
  8752.         esac
  8753.         ;;
  8754.     SAFE) case "$usesafe" in 
  8755.         true|define|y) avail_ext="$avail_ext $xxx" ;;
  8756.         esac
  8757.         ;;
  8758.     Socket) case "$d_socket" in 
  8759.         $define) avail_ext="$avail_ext $xxx" ;;
  8760.         esac
  8761.         ;;
  8762.     *)      avail_ext="$avail_ext $xxx"
  8763.         ;;
  8764.     esac
  8765. done
  8766.  
  8767. set X $avail_ext
  8768. shift
  8769. avail_ext="$*"
  8770.  
  8771. case $usedl in
  8772. $define)
  8773.     $cat <<EOM
  8774. A number of extensions are supplied with $package.  You may choose to
  8775. compile these extensions for dynamic loading (the default), compile
  8776. them into the $package executable (static loading), or not include
  8777. them at all.  Answer "none" to include no extensions.
  8778.  
  8779. EOM
  8780.     case "$dynamic_ext" in
  8781.     '') dflt="$avail_ext" ;;
  8782.     *)    dflt="$dynamic_ext" ;;
  8783.     esac
  8784.     case "$dflt" in
  8785.     '')    dflt=none;;
  8786.     esac
  8787.     rp="What extensions do you wish to load dynamically?"
  8788.     . ./myread
  8789.     case "$ans" in
  8790.     none) dynamic_ext=' ' ;;
  8791.     *) dynamic_ext="$ans" ;;
  8792.     esac
  8793.  
  8794.     case "$static_ext" in
  8795.     '')
  8796.         : Exclude those already listed in dynamic linking
  8797.         dflt=''
  8798.         for xxx in $avail_ext; do
  8799.             case " $dynamic_ext " in
  8800.             *" $xxx "*) ;;
  8801.             *) dflt="$dflt $xxx" ;;
  8802.             esac
  8803.         done
  8804.         set X $dflt
  8805.         shift
  8806.         dflt="$*"
  8807.         ;;
  8808.     *)  dflt="$static_ext" 
  8809.         ;;
  8810.     esac
  8811.  
  8812.     case "$dflt" in
  8813.     '')    dflt=none;;
  8814.     esac
  8815.     rp="What extensions do you wish to load statically?"
  8816.     . ./myread
  8817.     case "$ans" in
  8818.     none) static_ext=' ' ;;
  8819.     *) static_ext="$ans" ;;
  8820.     esac
  8821.     ;;
  8822. *)
  8823.     $cat <<EOM
  8824. A number of extensions are supplied with $package.  Answer "none" 
  8825. to include no extensions. 
  8826.  
  8827. EOM
  8828.     case "$static_ext" in
  8829.     '') dflt="$avail_ext" ;;
  8830.     *)    dflt="$static_ext" ;;
  8831.     esac
  8832.  
  8833.     case "$dflt" in
  8834.     '')    dflt=none;;
  8835.     esac
  8836.     rp="What extensions do you wish to include?"
  8837.     . ./myread
  8838.     case "$ans" in
  8839.     none) static_ext=' ' ;;
  8840.     *) static_ext="$ans" ;;
  8841.     esac
  8842.     ;;
  8843. esac
  8844.  
  8845. set X $dynamic_ext $static_ext
  8846. shift
  8847. extensions="$*"
  8848.  
  8849. : Remove build directory name from cppstdin so it can be used from
  8850. : either the present location or the final installed location.
  8851. echo " "
  8852. : Get out of the UU directory to get correct path name.
  8853. cd ..
  8854. case "$cppstdin" in
  8855. `pwd`/cppstdin)
  8856.     echo "Stripping down cppstdin path name"
  8857.     cppstdin=cppstdin
  8858.     ;;
  8859. esac
  8860. cd UU
  8861.  
  8862. : end of configuration questions
  8863. echo " "
  8864. echo "End of configuration questions."
  8865. echo " "
  8866.  
  8867. : back to where it started
  8868. if test -d ../UU; then
  8869.     cd ..
  8870. fi
  8871.  
  8872. : configuration may be patched via a 'config.over' file
  8873. if $test -f config.over; then
  8874.     echo " "
  8875.     dflt=y
  8876.     rp='I see a config.over file.  Do you wish to load it?'
  8877.     . UU/myread
  8878.     case "$ans" in
  8879.     n*) echo "OK, I'll ignore it.";;
  8880.     *)    . ./config.over
  8881.         echo "Configuration override changes have been loaded."
  8882.         ;;
  8883.     esac
  8884. fi
  8885.  
  8886. : in case they want portability, strip down executable paths
  8887. case "$d_portable" in
  8888. "$define")
  8889.     echo " "
  8890.     echo "Stripping down executable paths..." >&4
  8891.     for file in $loclist $trylist; do
  8892.         eval $file="\$file"
  8893.     done
  8894.     ;;
  8895. esac
  8896.  
  8897. : create config.sh file
  8898. echo " "
  8899. echo "Creating config.sh..." >&4
  8900. $spitshell <<EOT >config.sh
  8901. $startsh
  8902. #
  8903. # This file was produced by running the Configure script. It holds all the
  8904. # definitions figured out by Configure. Should you modify one of these values,
  8905. # do not forget to propagate your changes by running "Configure -der". You may
  8906. # instead choose to run each of the .SH files by yourself, or "Configure -S".
  8907. #
  8908.  
  8909. # Configuration time: $cf_time
  8910. # Configured by: $cf_by
  8911. # Target system: $myuname
  8912.  
  8913. Author='$Author'
  8914. Date='$Date'
  8915. Header='$Header'
  8916. Id='$Id'
  8917. Locker='$Locker'
  8918. Log='$Log'
  8919. Mcc='$Mcc'
  8920. RCSfile='$RCSfile'
  8921. Revision='$Revision'
  8922. Source='$Source'
  8923. State='$State'
  8924. afs='$afs'
  8925. alignbytes='$alignbytes'
  8926. aphostname='$aphostname'
  8927. ar='$ar'
  8928. archlib='$archlib'
  8929. archlibexp='$archlibexp'
  8930. archname='$archname'
  8931. archobjs='$archobjs'
  8932. awk='$awk'
  8933. baserev='$baserev'
  8934. bash='$bash'
  8935. bin='$bin'
  8936. binexp='$binexp'
  8937. bison='$bison'
  8938. byacc='$byacc'
  8939. byteorder='$byteorder'
  8940. c='$c'
  8941. castflags='$castflags'
  8942. cat='$cat'
  8943. cc='$cc'
  8944. cccdlflags='$cccdlflags'
  8945. ccdlflags='$ccdlflags'
  8946. ccflags='$ccflags'
  8947. cf_by='$cf_by'
  8948. cf_email='$cf_email'
  8949. cf_time='$cf_time'
  8950. chgrp='$chgrp'
  8951. chmod='$chmod'
  8952. chown='$chown'
  8953. clocktype='$clocktype'
  8954. comm='$comm'
  8955. compress='$compress'
  8956. contains='$contains'
  8957. cp='$cp'
  8958. cpio='$cpio'
  8959. cpp='$cpp'
  8960. cpp_stuff='$cpp_stuff'
  8961. cppflags='$cppflags'
  8962. cpplast='$cpplast'
  8963. cppminus='$cppminus'
  8964. cpprun='$cpprun'
  8965. cppstdin='$cppstdin'
  8966. cryptlib='$cryptlib'
  8967. csh='$csh'
  8968. d_Gconvert='$d_Gconvert'
  8969. d_access='$d_access'
  8970. d_alarm='$d_alarm'
  8971. d_archlib='$d_archlib'
  8972. d_attribut='$d_attribut'
  8973. d_bcmp='$d_bcmp'
  8974. d_bcopy='$d_bcopy'
  8975. d_bsd='$d_bsd'
  8976. d_bsdpgrp='$d_bsdpgrp'
  8977. d_bzero='$d_bzero'
  8978. d_casti32='$d_casti32'
  8979. d_castneg='$d_castneg'
  8980. d_charvspr='$d_charvspr'
  8981. d_chown='$d_chown'
  8982. d_chroot='$d_chroot'
  8983. d_chsize='$d_chsize'
  8984. d_closedir='$d_closedir'
  8985. d_const='$d_const'
  8986. d_crypt='$d_crypt'
  8987. d_csh='$d_csh'
  8988. d_cuserid='$d_cuserid'
  8989. d_dbl_dig='$d_dbl_dig'
  8990. d_difftime='$d_difftime'
  8991. d_dirnamlen='$d_dirnamlen'
  8992. d_dlerror='$d_dlerror'
  8993. d_dlopen='$d_dlopen'
  8994. d_dlsymun='$d_dlsymun'
  8995. d_dosuid='$d_dosuid'
  8996. d_dup2='$d_dup2'
  8997. d_eofnblk='$d_eofnblk'
  8998. d_eunice='$d_eunice'
  8999. d_fchmod='$d_fchmod'
  9000. d_fchown='$d_fchown'
  9001. d_fcntl='$d_fcntl'
  9002. d_fd_macros='$d_fd_macros'
  9003. d_fd_set='$d_fd_set'
  9004. d_fds_bits='$d_fds_bits'
  9005. d_fgetpos='$d_fgetpos'
  9006. d_flexfnam='$d_flexfnam'
  9007. d_flock='$d_flock'
  9008. d_fork='$d_fork'
  9009. d_fpathconf='$d_fpathconf'
  9010. d_fsetpos='$d_fsetpos'
  9011. d_getgrps='$d_getgrps'
  9012. d_gethent='$d_gethent'
  9013. d_gethname='$d_gethname'
  9014. d_getlogin='$d_getlogin'
  9015. d_getpgrp2='$d_getpgrp2'
  9016. d_getpgrp='$d_getpgrp'
  9017. d_getppid='$d_getppid'
  9018. d_getprior='$d_getprior'
  9019. d_htonl='$d_htonl'
  9020. d_index='$d_index'
  9021. d_isascii='$d_isascii'
  9022. d_killpg='$d_killpg'
  9023. d_link='$d_link'
  9024. d_locconv='$d_locconv'
  9025. d_lockf='$d_lockf'
  9026. d_lstat='$d_lstat'
  9027. d_mblen='$d_mblen'
  9028. d_mbstowcs='$d_mbstowcs'
  9029. d_mbtowc='$d_mbtowc'
  9030. d_memcmp='$d_memcmp'
  9031. d_memcpy='$d_memcpy'
  9032. d_memmove='$d_memmove'
  9033. d_memset='$d_memset'
  9034. d_mkdir='$d_mkdir'
  9035. d_mkfifo='$d_mkfifo'
  9036. d_mktime='$d_mktime'
  9037. d_msg='$d_msg'
  9038. d_msgctl='$d_msgctl'
  9039. d_msgget='$d_msgget'
  9040. d_msgrcv='$d_msgrcv'
  9041. d_msgsnd='$d_msgsnd'
  9042. d_mymalloc='$d_mymalloc'
  9043. d_nice='$d_nice'
  9044. d_oldarchlib='$d_oldarchlib'
  9045. d_oldsock='$d_oldsock'
  9046. d_open3='$d_open3'
  9047. d_pathconf='$d_pathconf'
  9048. d_pause='$d_pause'
  9049. d_phostname='$d_phostname'
  9050. d_pipe='$d_pipe'
  9051. d_poll='$d_poll'
  9052. d_portable='$d_portable'
  9053. d_pwage='$d_pwage'
  9054. d_pwchange='$d_pwchange'
  9055. d_pwclass='$d_pwclass'
  9056. d_pwcomment='$d_pwcomment'
  9057. d_pwexpire='$d_pwexpire'
  9058. d_pwquota='$d_pwquota'
  9059. d_readdir='$d_readdir'
  9060. d_readlink='$d_readlink'
  9061. d_rename='$d_rename'
  9062. d_rewinddir='$d_rewinddir'
  9063. d_rmdir='$d_rmdir'
  9064. d_safebcpy='$d_safebcpy'
  9065. d_safemcpy='$d_safemcpy'
  9066. d_seekdir='$d_seekdir'
  9067. d_select='$d_select'
  9068. d_sem='$d_sem'
  9069. d_semctl='$d_semctl'
  9070. d_semget='$d_semget'
  9071. d_semop='$d_semop'
  9072. d_setegid='$d_setegid'
  9073. d_seteuid='$d_seteuid'
  9074. d_setlinebuf='$d_setlinebuf'
  9075. d_setlocale='$d_setlocale'
  9076. d_setpgid='$d_setpgid'
  9077. d_setpgrp2='$d_setpgrp2'
  9078. d_setpgrp='$d_setpgrp'
  9079. d_setprior='$d_setprior'
  9080. d_setregid='$d_setregid'
  9081. d_setresgid='$d_setresgid'
  9082. d_setresuid='$d_setresuid'
  9083. d_setreuid='$d_setreuid'
  9084. d_setrgid='$d_setrgid'
  9085. d_setruid='$d_setruid'
  9086. d_setsid='$d_setsid'
  9087. d_shm='$d_shm'
  9088. d_shmat='$d_shmat'
  9089. d_shmatprototype='$d_shmatprototype'
  9090. d_shmctl='$d_shmctl'
  9091. d_shmdt='$d_shmdt'
  9092. d_shmget='$d_shmget'
  9093. d_shrplib='$d_shrplib'
  9094. d_sigaction='$d_sigaction'
  9095. d_sigintrp='$d_sigintrp'
  9096. d_sigsetjmp='$d_sigsetjmp'
  9097. d_sigvec='$d_sigvec'
  9098. d_sigvectr='$d_sigvectr'
  9099. d_socket='$d_socket'
  9100. d_sockpair='$d_sockpair'
  9101. d_statblks='$d_statblks'
  9102. d_stdio_cnt_lval='$d_stdio_cnt_lval'
  9103. d_stdio_ptr_lval='$d_stdio_ptr_lval'
  9104. d_stdiobase='$d_stdiobase'
  9105. d_stdstdio='$d_stdstdio'
  9106. d_strchr='$d_strchr'
  9107. d_strcoll='$d_strcoll'
  9108. d_strctcpy='$d_strctcpy'
  9109. d_strerrm='$d_strerrm'
  9110. d_strerror='$d_strerror'
  9111. d_strxfrm='$d_strxfrm'
  9112. d_suidsafe='$d_suidsafe'
  9113. d_symlink='$d_symlink'
  9114. d_syscall='$d_syscall'
  9115. d_sysconf='$d_sysconf'
  9116. d_sysernlst='$d_sysernlst'
  9117. d_syserrlst='$d_syserrlst'
  9118. d_system='$d_system'
  9119. d_tcgetpgrp='$d_tcgetpgrp'
  9120. d_tcsetpgrp='$d_tcsetpgrp'
  9121. d_telldir='$d_telldir'
  9122. d_time='$d_time'
  9123. d_times='$d_times'
  9124. d_truncate='$d_truncate'
  9125. d_tzname='$d_tzname'
  9126. d_umask='$d_umask'
  9127. d_uname='$d_uname'
  9128. d_vfork='$d_vfork'
  9129. d_void_closedir='$d_void_closedir'
  9130. d_voidsig='$d_voidsig'
  9131. d_voidtty='$d_voidtty'
  9132. d_volatile='$d_volatile'
  9133. d_vprintf='$d_vprintf'
  9134. d_wait4='$d_wait4'
  9135. d_waitpid='$d_waitpid'
  9136. d_wcstombs='$d_wcstombs'
  9137. d_wctomb='$d_wctomb'
  9138. d_xenix='$d_xenix'
  9139. date='$date'
  9140. db_hashtype='$db_hashtype'
  9141. db_prefixtype='$db_prefixtype'
  9142. defvoidused='$defvoidused'
  9143. direntrytype='$direntrytype'
  9144. dlext='$dlext'
  9145. dlsrc='$dlsrc'
  9146. dynamic_ext='$dynamic_ext'
  9147. eagain='$eagain'
  9148. echo='$echo'
  9149. egrep='$egrep'
  9150. emacs='$emacs'
  9151. eunicefix='$eunicefix'
  9152. exe_ext='$exe_ext'
  9153. expr='$expr'
  9154. extensions='$extensions'
  9155. find='$find'
  9156. firstmakefile='$firstmakefile'
  9157. flex='$flex'
  9158. fpostype='$fpostype'
  9159. freetype='$freetype'
  9160. full_csh='$full_csh'
  9161. full_sed='$full_sed'
  9162. gcc='$gcc'
  9163. gccversion='$gccversion'
  9164. gidtype='$gidtype'
  9165. glibpth='$glibpth'
  9166. grep='$grep'
  9167. groupcat='$groupcat'
  9168. groupstype='$groupstype'
  9169. h_fcntl='$h_fcntl'
  9170. h_sysfile='$h_sysfile'
  9171. hint='$hint'
  9172. hostcat='$hostcat'
  9173. huge='$huge'
  9174. i_bsdioctl='$i_bsdioctl'
  9175. i_db='$i_db'
  9176. i_dbm='$i_dbm'
  9177. i_dirent='$i_dirent'
  9178. i_dld='$i_dld'
  9179. i_dlfcn='$i_dlfcn'
  9180. i_fcntl='$i_fcntl'
  9181. i_float='$i_float'
  9182. i_gdbm='$i_gdbm'
  9183. i_grp='$i_grp'
  9184. i_limits='$i_limits'
  9185. i_locale='$i_locale'
  9186. i_malloc='$i_malloc'
  9187. i_math='$i_math'
  9188. i_memory='$i_memory'
  9189. i_ndbm='$i_ndbm'
  9190. i_neterrno='$i_neterrno'
  9191. i_niin='$i_niin'
  9192. i_pwd='$i_pwd'
  9193. i_rpcsvcdbm='$i_rpcsvcdbm'
  9194. i_sgtty='$i_sgtty'
  9195. i_stdarg='$i_stdarg'
  9196. i_stddef='$i_stddef'
  9197. i_stdlib='$i_stdlib'
  9198. i_string='$i_string'
  9199. i_sysdir='$i_sysdir'
  9200. i_sysfile='$i_sysfile'
  9201. i_sysfilio='$i_sysfilio'
  9202. i_sysin='$i_sysin'
  9203. i_sysioctl='$i_sysioctl'
  9204. i_sysndir='$i_sysndir'
  9205. i_sysparam='$i_sysparam'
  9206. i_sysselct='$i_sysselct'
  9207. i_syssockio='$i_syssockio'
  9208. i_sysstat='$i_sysstat'
  9209. i_systime='$i_systime'
  9210. i_systimek='$i_systimek'
  9211. i_systimes='$i_systimes'
  9212. i_systypes='$i_systypes'
  9213. i_sysun='$i_sysun'
  9214. i_termio='$i_termio'
  9215. i_termios='$i_termios'
  9216. i_time='$i_time'
  9217. i_unistd='$i_unistd'
  9218. i_utime='$i_utime'
  9219. i_varargs='$i_varargs'
  9220. i_varhdr='$i_varhdr'
  9221. i_vfork='$i_vfork'
  9222. incpath='$incpath'
  9223. inews='$inews'
  9224. installarchlib='$installarchlib'
  9225. installbin='$installbin'
  9226. installman1dir='$installman1dir'
  9227. installman3dir='$installman3dir'
  9228. installprivlib='$installprivlib'
  9229. installscript='$installscript'
  9230. installsitearch='$installsitearch'
  9231. installsitelib='$installsitelib'
  9232. intsize='$intsize'
  9233. known_extensions='$known_extensions'
  9234. ksh='$ksh'
  9235. large='$large'
  9236. ld='$ld'
  9237. lddlflags='$lddlflags'
  9238. ldflags='$ldflags'
  9239. less='$less'
  9240. lib_ext='$lib_ext'
  9241. libc='$libc'
  9242. libpth='$libpth'
  9243. libs='$libs'
  9244. libswanted='$libswanted'
  9245. line='$line'
  9246. lint='$lint'
  9247. lkflags='$lkflags'
  9248. ln='$ln'
  9249. lns='$lns'
  9250. locincpth='$locincpth'
  9251. loclibpth='$loclibpth'
  9252. lp='$lp'
  9253. lpr='$lpr'
  9254. ls='$ls'
  9255. lseektype='$lseektype'
  9256. mail='$mail'
  9257. mailx='$mailx'
  9258. make='$make'
  9259. mallocobj='$mallocobj'
  9260. mallocsrc='$mallocsrc'
  9261. malloctype='$malloctype'
  9262. man1dir='$man1dir'
  9263. man1direxp='$man1direxp'
  9264. man1ext='$man1ext'
  9265. man3dir='$man3dir'
  9266. man3direxp='$man3direxp'
  9267. man3ext='$man3ext'
  9268. medium='$medium'
  9269. mips='$mips'
  9270. mips_type='$mips_type'
  9271. mkdir='$mkdir'
  9272. models='$models'
  9273. modetype='$modetype'
  9274. more='$more'
  9275. mv='$mv'
  9276. myarchname='$myarchname'
  9277. mydomain='$mydomain'
  9278. myhostname='$myhostname'
  9279. myuname='$myuname'
  9280. n='$n'
  9281. nm_opt='$nm_opt'
  9282. nm_so_opt='$nm_so_opt'
  9283. nroff='$nroff'
  9284. o_nonblock='$o_nonblock'
  9285. obj_ext='$obj_ext'
  9286. oldarchlib='$oldarchlib'
  9287. oldarchlibexp='$oldarchlibexp'
  9288. optimize='$optimize'
  9289. orderlib='$orderlib'
  9290. osname='$osname'
  9291. osvers='$osvers'
  9292. package='$package'
  9293. pager='$pager'
  9294. passcat='$passcat'
  9295. patchlevel='$patchlevel'
  9296. path_sep='$path_sep'
  9297. perl='$perl'
  9298. perladmin='$perladmin'
  9299. perlpath='$perlpath'
  9300. pg='$pg'
  9301. phostname='$phostname'
  9302. plibpth='$plibpth'
  9303. pmake='$pmake'
  9304. pr='$pr'
  9305. prefix='$prefix'
  9306. prefixexp='$prefixexp'
  9307. privlib='$privlib'
  9308. privlibexp='$privlibexp'
  9309. prototype='$prototype'
  9310. randbits='$randbits'
  9311. ranlib='$ranlib'
  9312. rd_nodata='$rd_nodata'
  9313. rm='$rm'
  9314. rmail='$rmail'
  9315. runnm='$runnm'
  9316. scriptdir='$scriptdir'
  9317. scriptdirexp='$scriptdirexp'
  9318. sed='$sed'
  9319. selecttype='$selecttype'
  9320. sendmail='$sendmail'
  9321. sh='$sh'
  9322. shar='$shar'
  9323. sharpbang='$sharpbang'
  9324. shmattype='$shmattype'
  9325. shrpdir='$shrpdir'
  9326. shsharp='$shsharp'
  9327. sig_name='$sig_name'
  9328. sig_num='$sig_num'
  9329. signal_t='$signal_t'
  9330. sitearch='$sitearch'
  9331. sitearchexp='$sitearchexp'
  9332. sitelib='$sitelib'
  9333. sitelibexp='$sitelibexp'
  9334. sizetype='$sizetype'
  9335. sleep='$sleep'
  9336. smail='$smail'
  9337. small='$small'
  9338. so='$so'
  9339. sockethdr='$sockethdr'
  9340. socketlib='$socketlib'
  9341. sort='$sort'
  9342. spackage='$spackage'
  9343. spitshell='$spitshell'
  9344. split='$split'
  9345. ssizetype='$ssizetype'
  9346. startperl='$startperl'
  9347. startsh='$startsh'
  9348. static_ext='$static_ext'
  9349. stdchar='$stdchar'
  9350. stdio_base='$stdio_base'
  9351. stdio_bufsiz='$stdio_bufsiz'
  9352. stdio_cnt='$stdio_cnt'
  9353. stdio_ptr='$stdio_ptr'
  9354. strings='$strings'
  9355. submit='$submit'
  9356. sysman='$sysman'
  9357. tail='$tail'
  9358. tar='$tar'
  9359. tbl='$tbl'
  9360. test='$test'
  9361. timeincl='$timeincl'
  9362. timetype='$timetype'
  9363. touch='$touch'
  9364. tr='$tr'
  9365. troff='$troff'
  9366. uidtype='$uidtype'
  9367. uname='$uname'
  9368. uniq='$uniq'
  9369. usedl='$usedl'
  9370. usemymalloc='$usemymalloc'
  9371. usenm='$usenm'
  9372. useposix='$useposix'
  9373. usesafe='$usesafe'
  9374. usevfork='$usevfork'
  9375. usrinc='$usrinc'
  9376. uuname='$uuname'
  9377. vi='$vi'
  9378. voidflags='$voidflags'
  9379. xlibpth='$xlibpth'
  9380. zcat='$zcat'
  9381. EOT
  9382.  
  9383. : add special variables
  9384. $test -f patchlevel.h && \
  9385. awk '/^#define/ {printf "%s=%s\n",$2,$3}' patchlevel.h >>config.sh
  9386. echo "CONFIG=true" >>config.sh
  9387.  
  9388. : propagate old symbols
  9389. if $test -f UU/config.sh; then
  9390.     <UU/config.sh sort | uniq >UU/oldconfig.sh
  9391.     sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
  9392.     sort | uniq -u >UU/oldsyms
  9393.     set X `cat UU/oldsyms`
  9394.     shift
  9395.     case $# in
  9396.     0) ;;
  9397.     *)
  9398.         cat <<EOM
  9399. Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
  9400. EOM
  9401.         echo "# Variables propagated from previous config.sh file." >>config.sh
  9402.         for sym in `cat UU/oldsyms`; do
  9403.             echo "    Propagating $hint variable "'$'"$sym..."
  9404.             eval 'tmp="$'"${sym}"'"'
  9405.             echo "$tmp" | \
  9406.                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
  9407.         done
  9408.         ;;
  9409.     esac
  9410. fi
  9411.  
  9412. : Finish up by extracting the .SH files
  9413. case "$alldone" in
  9414. exit)
  9415.     $rm -rf UU
  9416.     echo "Done."
  9417.     exit 0
  9418.     ;;
  9419. cont)
  9420.     ;;
  9421. '')
  9422.     dflt=''
  9423.     nostick=true
  9424.     $cat <<EOM
  9425.  
  9426. If you'd like to make any changes to the config.sh file before I begin
  9427. to configure things, do it as a shell escape now (e.g. !vi config.sh).
  9428.  
  9429. EOM
  9430.     rp="Press return or use a shell escape to edit config.sh:"
  9431.     . UU/myread
  9432.     nostick=''
  9433.     case "$ans" in
  9434.     '') ;;
  9435.     *) : in case they cannot read
  9436.         sh 1>&4 -c "$ans";;
  9437.     esac
  9438.     ;;
  9439. esac
  9440.  
  9441. : if this fails, just run all the .SH files by hand
  9442. . ./config.sh
  9443.  
  9444. echo " "
  9445. exec 1>&4
  9446. . ./UU/extract
  9447.  
  9448. if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
  9449.     dflt=y
  9450.     case "$silent" in
  9451.     true) ;;
  9452.     *)
  9453.         $cat <<EOM
  9454.  
  9455. Now you need to generate make dependencies by running "make depend".
  9456. You might prefer to run it in background: "make depend > makedepend.out &"
  9457. It can take a while, so you might not want to run it right now.
  9458.  
  9459. EOM
  9460.         ;;
  9461.     esac
  9462.     rp="Run make depend now?"
  9463.     . UU/myread
  9464.     case "$ans" in
  9465.     y*)
  9466.         make depend && echo "Now you must run a make."
  9467.         ;;
  9468.     *)
  9469.         echo "You must run 'make depend' then 'make'."
  9470.         ;;
  9471.     esac
  9472. elif test -f [Mm]akefile; then
  9473.     echo " "
  9474.     echo "Now you must run a make."
  9475. else
  9476.     echo "Done."
  9477. fi
  9478.  
  9479. $rm -f kit*isdone ark*isdone
  9480. $rm -rf UU
  9481.  
  9482. : End of Configure
  9483.  
  9484.