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