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