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