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