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