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