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