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