This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.000 patch.0i: fix glaring mistakes in patches a-h
[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
ecfc5424 21# $Id: Head.U,v 3.0.1.6 1994/10/29 15:54:19 ram Exp $
2304df62 22#
75f92628 23# Generated on Tue Jan 24 16:22:48 EST 1995 [metaconfig 3.0 PL48]
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
58
59: Proper PATH setting
60paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
61paths=$paths:'/usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin'
62paths=$paths:'/sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb'
63paths=$paths:'/bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin'
64paths=$paths:'/etc /usr/lib /usr/ucblib /lib /usr/ccs/lib'
65paths=$paths:'/sbin /usr/sbin /usr/libexec'
66
67for p in $paths
68do
69 case ":$PATH:" in
70 *:$p:*) ;;
71 *) test -d $p && PATH=$PATH:$p ;;
72 esac
73done
74
75PATH=.:$PATH
2304df62
AD
76export PATH
77
a0d0e21e 78: Sanity checks
2304df62 79if test ! -t 0; then
a0d0e21e 80 echo "Say 'sh $me', not 'sh <$me'"
2304df62
AD
81 exit 1
82fi
83
84: On HP-UX, large Configure scripts may exercise a bug in /bin/sh
85if test -f /hp-ux -a -f /bin/ksh; then
86 if (PATH=.; alias -x) >/dev/null 2>&1; then
87 : already under /bin/ksh
88 else
89 cat <<'EOM'
90(Feeding myself to ksh to avoid nasty sh bug in "here document" expansion.)
91EOM
ecfc5424 92 unset ENV
2304df62
AD
93 exec /bin/ksh $0 "$@"
94 fi
95else
96 : Warn them if they use ksh on other systems
97 (PATH=.; alias -x) >/dev/null 2>&1 && \
a0d0e21e
LW
98 cat <<EOM
99(I see you are using the Korn shell. Some ksh's blow up on $me,
2304df62
AD
100especially on exotic machines. If yours does, try the Bourne shell instead.)
101EOM
102fi
103
104: Configure runs within the UU subdirectory
105test -d UU || mkdir UU
106cd UU && rm -f *
107
a0d0e21e 108dynamic_ext=''
2304df62 109extensions=''
a0d0e21e
LW
110known_extensions=''
111static_ext=''
112useposix=''
ecfc5424 113d_bsd=''
2304df62
AD
114d_eunice=''
115d_xenix=''
116eunicefix=''
117Mcc=''
118awk=''
119bash=''
120bison=''
121byacc=''
122cat=''
123chgrp=''
124chmod=''
125chown=''
ecfc5424 126comm=''
2304df62
AD
127compress=''
128cp=''
129cpio=''
130cpp=''
131csh=''
132date=''
133echo=''
134egrep=''
135emacs=''
136expr=''
137find=''
138flex=''
139gcc=''
140grep=''
141inews=''
142ksh=''
143less=''
144line=''
145lint=''
146ln=''
147lp=''
148lpr=''
149ls=''
150mail=''
151mailx=''
152make=''
153mkdir=''
154more=''
155mv=''
156nroff=''
157perl=''
158pg=''
159pmake=''
160pr=''
161rm=''
162rmail=''
163sed=''
164sendmail=''
165sh=''
166shar=''
167sleep=''
168smail=''
169sort=''
170submit=''
171tail=''
172tar=''
173tbl=''
174test=''
175touch=''
176tr=''
177troff=''
178uname=''
179uniq=''
180uuname=''
181vi=''
182zcat=''
a0d0e21e 183libswanted=''
2304df62
AD
184hint=''
185myuname=''
85e6fe83
LW
186osname=''
187osvers=''
2304df62
AD
188Author=''
189Date=''
190Header=''
191Id=''
192Locker=''
193Log=''
194RCSfile=''
195Revision=''
196Source=''
197State=''
198afs=''
a0d0e21e
LW
199alignbytes=''
200archlib=''
201archlibexp=''
202archname=''
203d_archlib=''
204installarchlib=''
ecfc5424 205baserev=''
2304df62
AD
206bin=''
207binexp=''
208installbin=''
209byteorder=''
210cc=''
211gccversion=''
212ccflags=''
213cppflags=''
214ldflags=''
215lkflags=''
216optimize=''
217cf_by=''
218cf_time=''
219contains=''
a0d0e21e 220cpp_stuff=''
2304df62
AD
221cpplast=''
222cppminus=''
223cpprun=''
224cppstdin=''
225d_access=''
a0d0e21e 226d_alarm=''
ecfc5424 227d_attribut=''
2304df62
AD
228d_bcmp=''
229d_bcopy=''
230d_bzero=''
231d_casti32=''
232castflags=''
233d_castneg=''
a0d0e21e
LW
234d_chown=''
235d_chroot=''
2304df62 236d_chsize=''
a0d0e21e
LW
237d_closedir=''
238d_void_closedir=''
2304df62
AD
239d_const=''
240cryptlib=''
241d_crypt=''
242d_csh=''
a0d0e21e
LW
243d_cuserid=''
244d_dbl_dig=''
245d_difftime=''
246d_dlerror=''
247d_dlopen=''
248d_dlsymun=''
2304df62 249d_dosuid=''
a0d0e21e
LW
250d_suidsafe=''
251d_drem=''
2304df62
AD
252d_dup2=''
253d_fchmod=''
254d_fchown=''
255d_fcntl=''
a0d0e21e
LW
256d_fd_macros=''
257d_fd_set=''
258d_fds_bits=''
259d_fgetpos=''
2304df62
AD
260d_flexfnam=''
261d_flock=''
a0d0e21e
LW
262d_fmod=''
263d_fork=''
264d_fsetpos=''
265d_Gconvert=''
2304df62
AD
266d_getgrps=''
267d_gethent=''
268aphostname=''
269d_gethname=''
270d_phostname=''
271d_uname=''
a0d0e21e 272d_getlogin=''
2304df62
AD
273d_getpgrp2=''
274d_getpgrp=''
a0d0e21e 275d_getppid=''
2304df62 276d_getprior=''
a0d0e21e 277d_group=''
2304df62
AD
278d_htonl=''
279d_isascii=''
280d_killpg=''
281d_link=''
a0d0e21e
LW
282d_linuxstd=''
283d_locconv=''
284d_lockf=''
2304df62 285d_lstat=''
a0d0e21e
LW
286d_mblen=''
287d_mbstowcs=''
288d_mbtowc=''
2304df62
AD
289d_memcmp=''
290d_memcpy=''
291d_memmove=''
292d_memset=''
293d_mkdir=''
a0d0e21e
LW
294d_mkfifo=''
295d_mktime=''
2304df62
AD
296d_msg=''
297d_msgctl=''
298d_msgget=''
299d_msgrcv=''
300d_msgsnd=''
a0d0e21e 301d_nice=''
2304df62 302d_open3=''
a0d0e21e
LW
303d_passwd=''
304d_fpathconf=''
305d_pathconf=''
306d_pause=''
307d_pipe=''
2304df62
AD
308d_portable=''
309d_readdir=''
85e6fe83
LW
310d_rewinddir=''
311d_seekdir=''
312d_telldir=''
a0d0e21e 313d_readlink=''
2304df62
AD
314d_rename=''
315d_rmdir=''
316d_safebcpy=''
317d_safemcpy=''
318d_select=''
319d_sem=''
320d_semctl=''
321d_semget=''
322d_semop=''
323d_setegid=''
324d_seteuid=''
a0d0e21e 325d_setlinebuf=''
2304df62
AD
326d_setlocale=''
327d_setpgid=''
328d_setpgrp2=''
329d_bsdpgrp=''
330d_setpgrp=''
331d_setprior=''
332d_setregid=''
333d_setresgid=''
334d_setresuid=''
335d_setreuid=''
336d_setrgid=''
337d_setruid=''
338d_setsid=''
339d_shm=''
340d_shmat=''
a0d0e21e
LW
341d_shmatprototype=''
342shmattype=''
2304df62
AD
343d_shmctl=''
344d_shmdt=''
345d_shmget=''
346d_oldsock=''
347d_socket=''
348d_sockpair=''
349sockethdr=''
350socketlib=''
351d_statblks=''
352d_stdstdio=''
353d_index=''
354d_strchr=''
a0d0e21e 355d_strcoll=''
2304df62
AD
356d_strctcpy=''
357d_strerrm=''
358d_strerror=''
359d_sysernlst=''
360d_syserrlst=''
a0d0e21e 361d_strxfrm=''
2304df62
AD
362d_symlink=''
363d_syscall=''
a0d0e21e 364d_sysconf=''
2304df62 365d_system=''
a0d0e21e
LW
366d_tcgetpgrp=''
367d_tcsetpgrp=''
85e6fe83
LW
368d_time=''
369timetype=''
2304df62
AD
370clocktype=''
371d_times=''
372d_truncate=''
a0d0e21e
LW
373d_tzname=''
374d_umask=''
2304df62 375d_vfork=''
a0d0e21e 376usevfork=''
2304df62
AD
377d_voidsig=''
378signal_t=''
379d_volatile=''
380d_charvspr=''
381d_vprintf=''
382d_wait4=''
383d_waitpid=''
a0d0e21e
LW
384d_wcstombs=''
385d_wctomb=''
386dlext=''
85e6fe83
LW
387cccdlflags=''
388ccdlflags=''
ecfc5424 389d_shrplib=''
2304df62 390dlsrc=''
85e6fe83 391lddlflags=''
ecfc5424 392shrpdir=''
2304df62 393usedl=''
a0d0e21e 394fpostype=''
2304df62
AD
395gidtype=''
396groupstype=''
397h_fcntl=''
398h_sysfile=''
ecfc5424
AD
399db_hashtype=''
400db_prefixtype=''
a0d0e21e 401i_db=''
2304df62
AD
402i_dbm=''
403d_dirnamlen=''
a0d0e21e 404direntrytype=''
2304df62 405i_dirent=''
a0d0e21e 406i_dld=''
2304df62
AD
407i_dlfcn=''
408i_fcntl=''
a0d0e21e 409i_float=''
2304df62
AD
410i_gdbm=''
411i_grp=''
a0d0e21e
LW
412i_limits=''
413i_malloc=''
414i_math=''
85e6fe83 415i_memory=''
2304df62 416i_ndbm=''
85e6fe83 417i_neterrno=''
2304df62
AD
418i_niin=''
419i_sysin=''
420d_pwage=''
421d_pwchange=''
422d_pwclass=''
423d_pwcomment=''
424d_pwexpire=''
425d_pwquota=''
426i_pwd=''
2304df62 427i_stddef=''
a0d0e21e 428i_stdlib=''
2304df62
AD
429i_string=''
430strings=''
431i_sysdir=''
432i_sysfile=''
433d_voidtty=''
434i_bsdioctl=''
a0d0e21e 435i_sysfilio=''
2304df62
AD
436i_sysioctl=''
437i_syssockio=''
438i_sysndir=''
a0d0e21e 439i_sysparam=''
2304df62 440i_sysselct=''
a0d0e21e 441i_systimes=''
2304df62
AD
442i_sgtty=''
443i_termio=''
444i_termios=''
445i_systime=''
446i_systimek=''
447i_time=''
448timeincl=''
85e6fe83 449i_unistd=''
2304df62 450i_utime=''
a0d0e21e 451i_stdarg=''
2304df62
AD
452i_varargs=''
453i_varhdr=''
454i_vfork=''
455intsize=''
2304df62 456libc=''
a0d0e21e 457glibpth=''
2304df62
AD
458libpth=''
459plibpth=''
460xlibpth=''
461libs=''
85e6fe83
LW
462lns=''
463lseektype=''
464d_mymalloc=''
2304df62
AD
465mallocobj=''
466mallocsrc=''
467malloctype=''
468usemymalloc=''
469installmansrc=''
470manext=''
471mansrc=''
472mansrcexp=''
473huge=''
474large=''
475medium=''
476models=''
477small=''
478split=''
a0d0e21e 479modetype=''
2304df62
AD
480mydomain=''
481myhostname=''
482phostname=''
483c=''
484n=''
485groupcat=''
486hostcat=''
487passcat=''
85e6fe83
LW
488orderlib=''
489ranlib=''
2304df62
AD
490package=''
491spackage=''
ecfc5424 492patchlevel=''
a0d0e21e 493prefix=''
2304df62
AD
494installprivlib=''
495privlib=''
496privlibexp=''
497prototype=''
498randbits=''
499installscript=''
500scriptdir=''
501scriptdirexp=''
a0d0e21e 502selecttype=''
2304df62 503sig_name=''
a0d0e21e
LW
504sizetype=''
505so=''
2304df62
AD
506sharpbang=''
507shsharp=''
508spitshell=''
a0d0e21e 509ssizetype=''
2304df62
AD
510startsh=''
511stdchar=''
512sysman=''
513uidtype=''
514nm_opt=''
515runnm=''
516usenm=''
517incpath=''
518mips=''
519mips_type=''
520usrinc=''
521defvoidused=''
522voidflags=''
2304df62
AD
523CONFIG=''
524
ecfc5424
AD
525define='define'
526undef='undef'
527smallmach='pdp11 i8086 z8000 i80286 iAPX286'
528rmlist=''
529
530: We must find out about Eunice early
531eunicefix=':'
532if test -f /etc/unixtovms; then
533 eunicefix=/etc/unixtovms
534fi
535if test -f /etc/unixtovms.exe; then
536 eunicefix=/etc/unixtovms.exe
537fi
538
539: list of known cpp symbols, sorted alphabetically
540al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
541al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
542al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
543al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
544al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
545al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
546al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
547al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
548al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
549al="$al VMS Xenix286"
550al="$al _AIX _AIX32 _AIX370 _AM29000 _COFF _CRAY _CX_UX _EPI"
551al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET"
552al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
553al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
554al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
555al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
556al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
557al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
558al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
559al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
560al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
561al="$al __SVR4_2__ __UMAXV__"
562al="$al ____386BSD____ __alpha __alpha__ __amiga"
563al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
564al="$al __host_mips__"
565al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
566al="$al __hp9000s500 __hp9000s700 __hp9000s800"
567al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
568al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
569al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
570al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
571al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
572al="$al __mc88100 __mc88100__ __mips __mips__"
573al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
574al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
575al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
576al="$al _host_mips _mips _unix"
577al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
578al="$al apollo ardent att386 att3b"
579al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
580al="$al cadmus clipper concurrent convex cray ctix"
581al="$al dmert encore gcos gcx gimpel gould"
582al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
583al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
584al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
585al="$al i186 i286 i386 i486 i8086"
586al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
587al="$al ksr1 linux luna luna88k m68k m88100 m88k"
588al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
589al="$al mc68040 mc68060 mc68k mc68k32 mc700"
590al="$al mc88000 mc88100 merlin mert mips mvs n16"
591al="$al ncl_el ncl_mr"
592al="$al news1500 news1700 news1800 news1900 news3700"
593al="$al news700 news800 news900 ns16000 ns32000"
594al="$al ns32016 ns32332 ns32k nsc32000 os osf"
595al="$al parisc pc532 pdp11 plexus posix pyr"
596al="$al riscix riscos scs sequent sgi sinix sony sony_news"
597al="$al sonyrisc sparc sparclite spectrum stardent stratos"
598al="$al sun sun3 sun386 svr4 sysV68 sysV88"
599al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
600al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
601al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
602al="$al xenix z8000"
603
604gccversion=''
605groupstype=''
606i_whoami=''
607: change the next line if compiling for Xenix/286 on Xenix/386
608xlibpth='/usr/lib/386 /lib/386'
609
610: general looking path for locating libraries
611glibpth="/lib/pa1.1 /usr/lib/large /lib /usr/lib $xlibpth"
612glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
613glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib /usr/shlib"
614
615: Private path used by Configure to find libraries. Its value
616: is prepended to libpth. This variable takes care of special
617: machines, like the mips. Usually, it should be empty.
618plibpth=''
619
620: default library list
621libswanted=''
622: full support for void wanted by default
623defvoidused=15
624
625: set useposix=false in your hint file to disable the POSIX extension.
626useposix=true
627: no include file wanted by default
628inclwanted=''
629
630: List of libraries we want.
631libswanted='net socket inet nsl nm ndbm gdbm dbm db malloc dl'
632libswanted="$libswanted dld ld sun m c cposix posix ndir dir crypt"
633libswanted="$libswanted ucb bsd BSD PW x"
634: We want to search /usr/shlib before most other libraries.
635: This is only used by ext/util/extliblist
636glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
637glibpth="/usr/shlib $glibpth"
638: Do not use vfork unless overridden by a hint file.
639usevfork=false
640
2304df62
AD
641: script used to extract .SH files with variable substitutions
642cat >extract <<'EOS'
643CONFIG=true
644echo "Doing variable substitutions on .SH files..."
645if test -f MANIFEST; then
a0d0e21e
LW
646 shlist=`awk '{print $1}' <MANIFEST | grep '\.SH'`
647 : Pick up possible extension manifests.
648 for dir in ext/* ; do
649 if test -f $dir/MANIFEST; then
650 xxx=`awk '{print $1}' < $dir/MANIFEST |
651 sed -n "/\.SH$/ s@^@$dir/@p"`
652 shlist="$shlist $xxx"
653 fi
654 done
655 set x $shlist
2304df62
AD
656else
657 echo "(Looking for .SH files under the current directory.)"
658 set x `find . -name "*.SH" -print`
659fi
660shift
661case $# in
6620) set x *.SH; shift;;
663esac
664if test ! -f $1; then
665 shift
666fi
667for file in $*; do
668 case "$file" in
669 */*)
670 dir=`expr X$file : 'X\(.*\)/'`
671 file=`expr X$file : 'X.*/\(.*\)'`
672 (cd $dir && . ./$file)
673 ;;
674 *)
675 . ./$file
676 ;;
677 esac
678done
679if test -f config_h.SH; then
680 if test ! -f config.h; then
681 : oops, they left it out of MANIFEST, probably, so do it anyway.
682 . ./config_h.SH
683 fi
684fi
685EOS
686
687: produce awk script to parse command line options
688cat >options.awk <<'EOF'
689BEGIN {
ecfc5424 690 optstr = "dD:eEf:hOrsSU:V"; # getopt-style specification
2304df62
AD
691
692 len = length(optstr);
693 for (i = 1; i <= len; i++) {
694 c = substr(optstr, i, 1);
695 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
696 if (a == ":") {
697 arg[c] = 1;
698 i++;
699 }
700 opt[c] = 1;
701 }
702}
703{
704 expect = 0;
705 str = $0;
706 if (substr(str, 1, 1) != "-") {
707 printf("'%s'\n", str);
708 next;
709 }
710 len = length($0);
711 for (i = 2; i <= len; i++) {
712 c = substr(str, i, 1);
713 if (!opt[c]) {
714 printf("-%s\n", substr(str, i));
715 next;
716 }
717 printf("-%s\n", c);
718 if (arg[c]) {
719 if (i < len)
720 printf("'%s'\n", substr(str, i + 1));
721 else
722 expect = 1;
723 next;
724 }
725 }
726}
727END {
728 if (expect)
729 print "?";
730}
731EOF
732
733: process the command line options
734set X `for arg in "$@"; do echo $arg; done | awk -f options.awk`
735eval "set $*"
736shift
737rm -f options.awk
738
739: set up default values
740fastread=''
741reuseval=false
742config_sh=''
743alldone=''
744error=''
745silent=''
746extractsh=''
ecfc5424 747override=''
a0d0e21e 748optdef='optdef.sh'
ecfc5424 749rm -f $optdef
2304df62
AD
750
751: option parsing
752while test $# -gt 0; do
753 case "$1" in
754 -d) shift; fastread=yes;;
755 -e) shift; alldone=cont;;
756 -f)
757 shift
758 cd ..
759 if test -r "$1"; then
760 config_sh="$1"
761 else
a0d0e21e 762 echo "$me: cannot read config file $1." >&2
2304df62
AD
763 error=true
764 fi
765 cd UU
766 shift;;
767 -h) shift; error=true;;
768 -r) shift; reuseval=true;;
769 -s) shift; silent=true;;
770 -E) shift; alldone=exit;;
ecfc5424 771 -O) shift; override=true;;
2304df62 772 -S) shift; extractsh=true;;
a0d0e21e
LW
773 -D)
774 shift
775 case "$1" in
776 *=)
777 echo "$me: use '-U symbol=', not '-D symbol='." >&2
778 echo "$me: ignoring -D $1" >&2
779 ;;
ecfc5424
AD
780 *=*) echo "$1" | \
781 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> $optdef;;
a0d0e21e
LW
782 *) echo "$1='define'" >> $optdef;;
783 esac
784 shift
785 ;;
786 -U)
787 shift
788 case "$1" in
789 *=) echo "$1" >> $optdef;;
790 *=*)
791 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
792 echo "$me: ignoring -U $1" >&2
793 ;;
794 *) echo "$1='undef'" >> $optdef;;
795 esac
796 shift
797 ;;
ecfc5424 798 -V) echo "$me generated by metaconfig 3.0 PL48." >&2
2304df62
AD
799 exit 0;;
800 --) break;;
a0d0e21e 801 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
802 *) break;;
803 esac
804done
805
806case "$error" in
807true)
808 cat >&2 <<EOM
ecfc5424 809Usage: $me [-dehrEOSV] [-f config.sh] [-D symbol] [-D symbol=value]
a0d0e21e 810 [-U symbol] [-U symbol=]
2304df62
AD
811 -d : use defaults for all answers.
812 -e : go on without questioning past the production of config.sh.
813 -f : specify an alternate default configuration file.
814 -h : print this help message and exit (with an error status).
815 -r : reuse C symbols value if possible (skips costly nm extraction).
816 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
817 -D : define symbol to have some value:
818 -D symbol symbol gets the value 'define'
819 -D symbol=value symbol gets the value 'value'
2304df62 820 -E : stop at the end of questions, after having produced config.sh.
ecfc5424 821 -O : let -D and -U override definitions from loaded configuration file.
2304df62 822 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
823 -U : undefine symbol:
824 -U symbol symbol gets the value 'undef'
825 -U symbol= symbol gets completely empty
2304df62
AD
826 -V : print version number and exit (with a zero status).
827EOM
828 exit 1
829 ;;
830esac
831
832exec 4>&1
833case "$silent" in
834true) exec 1>/dev/null;;
835esac
836
ecfc5424 837: run the defines and the undefines, if any, but leave the file out there...
a0d0e21e
LW
838touch $optdef
839. ./$optdef
a0d0e21e 840
2304df62
AD
841case "$extractsh" in
842true)
843 case "$config_sh" in
844 '') config_sh='config.sh'; config='./config.sh';;
845 /*) config="$config_sh";;
846 *) config="./$config_sh";;
847 esac
848 echo " "
849 echo "Fetching answers from $config_sh..."
850 cd ..
851 . $config
ecfc5424 852 test "$override" && . ./$optdef
2304df62
AD
853 echo " "
854 . ./UU/extract
855 rm -rf UU
856 echo "Done."
857 exit 0
858 ;;
859esac
860
861: set package name
85e6fe83 862package=perl5
2304df62
AD
863
864: Eunice requires " " instead of "", can you believe it
865echo " "
866: Here we go...
867echo "Beginning of configuration questions for $package."
868
2304df62
AD
869trap 'echo " "; rm -rf $rmlist; exit 1' 1 2 3 15
870
2304df62
AD
871: Some greps do not return status, grrr.
872echo "grimblepritz" >grimble
873if grep blurfldyick grimble >/dev/null 2>&1 ; then
874 contains=contains
875elif grep grimblepritz grimble >/dev/null 2>&1 ; then
876 contains=grep
877else
878 contains=contains
879fi
880rm -f grimble
881: the following should work in any shell
882case "$contains" in
883contains*)
884 echo " "
885 echo "AGH! Grep doesn't return a status. Attempting remedial action."
886 cat >contains <<'EOSS'
887grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
888EOSS
889chmod +x contains
890esac
891
892: first determine how to suppress newline on echo command
893echo " "
894echo "Checking echo to see how to suppress newlines..."
895(echo "hi there\c" ; echo " ") >.echotmp
896if $contains c .echotmp >/dev/null 2>&1 ; then
897 echo "...using -n."
898 n='-n'
899 c=''
900else
901 cat <<'EOM'
902...using \c
903EOM
904 n=''
905 c='\c'
906fi
907echo $n "The star should be here-->$c"
908echo '*'
909rm -f .echotmp
910
911: Now test for existence of everything in MANIFEST
912echo " "
913if test -f ../MANIFEST; then
914 echo "First let's make sure your kit is complete. Checking..." >&4
915 awk '$1 !~ /PACK[A-Z]+/ {print $1}' ../MANIFEST | split -50
916 rm -f missing
917 for filelist in x??; do
918 (cd ..; ls `cat UU/$filelist` >/dev/null 2>>UU/missing)
919 done
920 if test -s missing; then
921 cat missing >&4
922 cat >&4 <<'EOM'
923
924THIS PACKAGE SEEMS TO BE INCOMPLETE.
925
926You have the option of continuing the configuration process, despite the
927distinct possibility that your kit is damaged, by typing 'y'es. If you
928do, don't blame me if something goes wrong. I advise you to type 'n'o
929and contact the author (lwall@netlabs.com).
930
931EOM
932 echo $n "Continue? [n] $c" >&4
933 read ans
934 case "$ans" in
935 y*)
936 echo "Continuing..." >&4
937 rm -f missing
938 ;;
939 *)
940 echo "ABORTING..." >&4
941 kill $$
942 ;;
943 esac
944 else
945 echo "Looks good..." >&4
946 fi
947else
948 echo "There is no MANIFEST file. I hope your kit is complete !"
949fi
950rm -f missing x??
951
952: compute the number of columns on the terminal for proper question formatting
953case "$COLUMNS" in
954'') COLUMNS='80';;
955esac
956
957: set up the echo used in my read
958myecho="case \"\$xxxm\" in
959'') echo $n \"\$rp $c\" >&4;;
960*) case \"\$rp\" in
961 '') echo $n \"[\$xxxm] $c\";;
962 *)
963 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
964 echo \"\$rp\" >&4
965 echo $n \"[\$xxxm] $c\" >&4
966 else
967 echo $n \"\$rp [\$xxxm] $c\" >&4
968 fi
969 ;;
970 esac;;
971esac"
972
973: now set up to do reads with possible shell escape and default assignment
974cat <<EOSC >myread
975xxxm=\$dflt
976$myecho
977ans='!'
978case "\$fastread" in
979yes) case "\$dflt" in
980 '') ;;
981 *) ans='';
982 case "\$silent-\$rp" in
983 true-) ;;
984 *) echo " " >&4;;
985 esac;;
986 esac;;
987*) case "\$silent" in
988 true) case "\$rp" in
989 '') ans='';;
990 esac;;
991 esac;;
992esac
993while expr "X\$ans" : "X!" >/dev/null; do
994 read answ
995 set x \$xxxm
996 shift
997 aok=''; eval "ans=\"\$answ\"" && aok=y
998 case "\$answ" in
999 "\$ans")
1000 case "\$ans" in
ecfc5424
AD
1001 \\&*)
1002 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1003 shift
1004 case "\$1" in
1005 -d)
1006 fastread=yes
1007 echo "(OK, I'll run with -d after this question.)"
1008 ;;
1009 -*)
1010 echo "*** Sorry, \$1 not supported yet."
1011 ;;
1012 esac
1013 $myecho
1014 ans=!
1015 ;;
2304df62
AD
1016 "!")
1017 sh 1>&4
1018 echo " "
1019 $myecho
1020 ;;
1021 !*)
1022 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1023 shift
1024 sh 1>&4 -c "\$*"
1025 echo " "
1026 $myecho
1027 ;;
1028 esac;;
1029 *)
1030 case "\$aok" in
1031 y)
1032 echo "*** Substitution done -- please confirm."
1033 xxxm="\$ans"
1034 ans=\`echo $n "\$ans$c" | tr '\012' ' '\`
1035 xxxm="\$ans"
1036 ans=!
1037 ;;
1038 *)
1039 echo "*** Error -- try again."
1040 ans=!
1041 ;;
1042 esac
1043 $myecho
1044 ;;
1045 esac
1046 case "\$ans\$xxxm\$nostick" in
1047 '')
1048 ans=!
1049 $myecho
1050 ;;
1051 esac
1052done
1053case "\$ans" in
1054'') ans="\$xxxm";;
1055esac
1056EOSC
1057
1058: create .config dir to save info across Configure sessions
1059test -d ../.config || mkdir ../.config
1060cat >../.config/README <<EOF
1061This directory created by Configure to save information that should
1062persist across sessions.
1063
1064You may safely delete it if you wish.
1065EOF
1066
1067: general instructions
1068needman=true
1069firsttime=true
1070user=`( (logname) 2>/dev/null || whoami) 2>&1`
1071if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1072 firsttime=false
1073 echo " "
1074 rp='Would you like to see the instructions?'
1075 dflt=n
1076 . ./myread
1077 case "$ans" in
1078 [yY]*) ;;
1079 *) needman=false;;
1080 esac
1081fi
1082if $needman; then
1083 cat <<EOH
1084
1085This installation shell script will examine your system and ask you questions
a0d0e21e 1086to determine how the perl5 package should be installed. If you get
2304df62
AD
1087stuck on a question, you may use a ! shell escape to start a subshell or
1088execute a command. Many of the questions will have default answers in square
1089brackets; typing carriage return will give you the default.
1090
1091On some of the questions which ask for file or directory names you are allowed
1092to use the ~name construct to specify the login directory belonging to "name",
1093even if you don't have a shell which knows about that. Questions where this is
1094allowed will be marked "(~name ok)".
1095
1096EOH
1097 rp=''
1098 dflt='Type carriage return to continue'
1099 . ./myread
1100 cat <<'EOH'
1101
1102The prompter used in this script allows you to use shell variables and
1103backticks in your answers. You may use $1, $2, etc... to refer to the words
1104in the default answer, as if the default line was a set of arguments given to a
1105script shell. This means you may also use $* to repeat the whole default line,
1106so you do not have to re-type everything to add something to the default.
1107
1108Everytime there is a substitution, you will have to confirm. If there is an
1109error (e.g. an unmatched backtick), the default answer will remain unchanged
1110and you will be prompted again.
1111
1112If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
1113the questions and use the computed defaults (or the previous answers if there
1114was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424
AD
1115You may also start interactively and then answer '& -d' at any prompt to turn
1116on the non-interactive behaviour for the remaining of the execution.
2304df62
AD
1117
1118EOH
1119 . ./myread
1120 cat <<EOH
1121
1122Much effort has been expended to ensure that this shell script will run on any
1123Unix system. If despite that it blows up on yours, your best bet is to edit
1124Configure and run it again. Also, let me (lwall@netlabs.com)
1125know how I blew it. If you can't run Configure for some reason, you'll have to
1126generate a config.sh file by hand.
1127
1128This installation script affects things in two ways:
1129
11301) it may do direct variable substitutions on some of the files included
1131 in this kit.
11322) it builds a config.h file for inclusion in C programs. You may edit
1133 any of these files as the need arises after running this script.
1134
1135If you make a mistake on a question, there is no easy way to back up to it
1136currently. The easiest thing to do is to edit config.sh and rerun all the SH
1137files. Configure will offer to let you do this before it runs the SH files.
1138
1139EOH
1140 dflt='Type carriage return to continue'
1141 . ./myread
1142 case "$firsttime" in
1143 true) echo $user >>../.config/instruct;;
1144 esac
1145fi
1146
1147: see if sh knows # comments
1148echo " "
1149echo "Checking your sh to see if it knows about # comments..." >&4
ecfc5424 1150if `sh -c '#' >/dev/null 2>&1`; then
2304df62
AD
1151 echo "Your sh handles # comments correctly."
1152 shsharp=true
1153 spitshell=cat
1154 echo " "
1155 echo "Okay, let's see if #! works on this system..."
a0d0e21e 1156 xcat=/bin/cat
ecfc5424 1157 test -f $xcat || xcat=/usr/bin/cat
a0d0e21e 1158 echo "#!$xcat" >try
2304df62
AD
1159 $eunicefix try
1160 chmod +x try
1161 ./try > today
1162 if test -s today; then
1163 echo "It does."
1164 sharpbang='#!'
1165 else
a0d0e21e 1166 echo "#! $xcat" > try
2304df62
AD
1167 $eunicefix try
1168 chmod +x try
1169 ./try > today
1170 if test -s today; then
1171 echo "It does."
1172 sharpbang='#! '
1173 else
1174 echo "It's just a comment."
1175 sharpbang=': use '
1176 fi
1177 fi
1178else
1179 echo "Your sh doesn't grok # comments--I will strip them later on."
1180 shsharp=false
a0d0e21e 1181 cd ..
2304df62
AD
1182 echo "exec grep -v '^[ ]*#'" >spitshell
1183 chmod +x spitshell
1184 $eunicefix spitshell
1185 spitshell=`pwd`/spitshell
a0d0e21e 1186 cd UU
2304df62
AD
1187 echo "I presume that if # doesn't work, #! won't work either!"
1188 sharpbang=': use '
1189fi
1190rm -f try today
1191
1192: figure out how to guarantee sh startup
1193echo " "
1194echo "Checking out how to guarantee sh startup..." >&4
1195case "$SYSTYPE" in
1196*bsd*|sys5*) startsh=$sharpbang"/$SYSTYPE/bin/sh";;
1197*) startsh=$sharpbang'/bin/sh';;
1198esac
1199echo "Let's see if '$startsh' works..."
1200cat >try <<EOSS
1201$startsh
1202set abc
1203test "$?abc" != 1
1204EOSS
1205
1206chmod +x try
1207$eunicefix try
1208if ./try; then
1209 echo "Yup, it does."
1210else
1211echo "Nope. You may have to fix up the shell scripts to make sure sh runs them."
1212fi
1213rm -f try
1214
1215: find out where common programs are
1216echo " "
1217echo "Locating common programs..." >&4
1218cat <<EOSC >loc
1219$startsh
1220case \$# in
12210) exit 1;;
1222esac
1223thing=\$1
1224shift
1225dflt=\$1
1226shift
1227for dir in \$*; do
1228 case "\$thing" in
1229 .)
1230 if test -d \$dir/\$thing; then
1231 echo \$dir
1232 exit 0
1233 fi
1234 ;;
1235 *)
a0d0e21e 1236 for thisthing in \$dir/\$thing; do
ecfc5424 1237 : just loop through to pick last item
a0d0e21e
LW
1238 done
1239 if test -f \$thisthing; then
1240 echo \$thisthing
2304df62
AD
1241 exit 0
1242 elif test -f \$dir/\$thing.exe; then
1243 : on Eunice apparently
1244 echo \$dir/\$thing
1245 exit 0
1246 fi
1247 ;;
1248 esac
1249done
1250echo \$dflt
1251exit 1
1252EOSC
1253chmod +x loc
1254$eunicefix loc
1255loclist="
1256awk
1257cat
ecfc5424 1258comm
2304df62
AD
1259cp
1260echo
1261expr
a0d0e21e 1262find
2304df62 1263grep
85e6fe83 1264ln
a0d0e21e 1265ls
2304df62 1266mkdir
2304df62
AD
1267rm
1268sed
1269sort
85e6fe83 1270touch
2304df62
AD
1271tr
1272uniq
1273"
1274trylist="
1275Mcc
2304df62
AD
1276byacc
1277cpp
1278csh
1279date
1280egrep
2304df62
AD
1281line
1282nroff
1283perl
1284test
1285uname
1286"
1287pth=`echo $PATH | sed -e 's/:/ /g'`
1288pth="$pth /lib /usr/lib"
1289for file in $loclist; do
1290 xxx=`./loc $file $file $pth`
1291 eval $file=$xxx
1292 eval _$file=$xxx
1293 case "$xxx" in
1294 /*)
1295 echo $file is in $xxx.
1296 ;;
1297 *)
1298 echo "I don't know where $file is. I hope it's in everyone's PATH."
1299 ;;
1300 esac
1301done
1302echo " "
1303echo "Don't worry if any of the following aren't found..."
1304say=offhand
1305for file in $trylist; do
1306 xxx=`./loc $file $file $pth`
1307 eval $file=$xxx
1308 eval _$file=$xxx
1309 case "$xxx" in
1310 /*)
1311 echo $file is in $xxx.
1312 ;;
1313 *)
1314 echo "I don't see $file out there, $say."
1315 say=either
1316 ;;
1317 esac
1318done
1319case "$egrep" in
1320egrep)
1321 echo "Substituting grep for egrep."
1322 egrep=$grep
1323 ;;
1324esac
1325case "$test" in
1326test)
1327 echo "Hopefully test is built into your sh."
1328 ;;
1329*)
ecfc5424 1330 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2304df62
AD
1331 echo "Using the test built into your sh."
1332 test=test
1333 _test=test
1334 fi
1335 ;;
1336esac
1337case "$echo" in
1338echo)
1339 echo "Hopefully echo is built into your sh."
1340 ;;
1341'') ;;
1342*)
1343 echo " "
1344echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1345 $echo $n "hi there$c" >foo1
1346 echo $n "hi there$c" >foo2
1347 if cmp foo1 foo2 >/dev/null 2>&1; then
1348 echo "They are compatible. In fact, they may be identical."
1349 else
1350 case "$n" in
1351 '-n') n='' c='\c';;
1352 *) n='-n' c='';;
1353 esac
1354 cat <<FOO
1355They are not compatible! You are probably running ksh on a non-USG system.
1356I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1357have echo built in and we may have to run some Bourne shell scripts. That
1358means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
1359
1360FOO
1361 $echo $n "The star should be here-->$c"
1362 $echo "*"
1363 fi
1364 $rm -f foo1 foo2
1365 ;;
1366esac
1367
a0d0e21e
LW
1368: determine whether symbolic links are supported
1369echo " "
1370$touch blurfl
1371if $ln -s blurfl sym > /dev/null 2>&1 ; then
1372 echo "Symbolic links are supported." >&4
1373 lns="$ln -s"
1374else
1375 echo "Symbolic links are NOT supported." >&4
1376 lns="$ln"
1377fi
1378$rm -f blurfl sym
1379
ecfc5424
AD
1380: see whether [:lower:] and [:upper:] are supported character classes
1381echo " "
1382up='[A-Z]'
1383low='[a-z]'
1384case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1385ABYZ)
1386 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
1387 up='[:upper:]'
1388 low='[:lower:]'
1389 ;;
1390*)
1391 echo "Your tr only supports [a-z] and [A-Z] to convert case." >&4
1392 ;;
1393esac
1394: set up the translation script tr, must be called with ./tr of course
1395cat >tr <<EOSC
1396$startsh
1397case "\$1\$2" in
1398'[A-Z][a-z]') exec $tr '$up' '$low';;
1399'[a-z][A-Z]') exec $tr '$low' '$up';;
1400esac
1401exec $tr "\$@"
1402EOSC
1403chmod +x tr
1404$eunicefix tr
1405
2304df62
AD
1406: Try to determine whether config.sh was made on this system
1407case "$config_sh" in
1408'')
1409myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
a0d0e21e 1410myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
ecfc5424 1411 ./tr '[A-Z]' '[a-z]' | tr '\012' ' '`
2304df62 1412dflt=n
ecfc5424
AD
1413if test "$fastread" = yes; then
1414 dflt=y
1415elif test -f ../config.sh; then
2304df62
AD
1416 oldmyuname=''
1417 if $contains myuname= ../config.sh >/dev/null 2>&1; then
1418 eval "old`grep myuname= ../config.sh`"
1419 fi
1420 if test "X$myuname" = "X$oldmyuname"; then
1421 dflt=y
1422 fi
1423fi
1424
1425: Get old answers from old config file if Configure was run on the
1426: same system, otherwise use the hints.
1427hint=default
1428cd ..
1429if test -f config.sh; then
1430 echo " "
1431 rp="I see a config.sh file. Shall I use it to set the defaults?"
1432 . UU/myread
1433 case "$ans" in
1434 n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
1435 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
1436 tmp_n="$n"
1437 tmp_c="$c"
2304df62 1438 . ./config.sh
ecfc5424 1439 test "$override" && . UU/$optdef
2304df62 1440 cp config.sh UU
ecfc5424
AD
1441 n="$tmp_n"
1442 c="$tmp_c"
2304df62
AD
1443 hint=previous
1444 ;;
1445 esac
1446fi
1447if test ! -f config.sh; then
1448 $cat <<EOM
1449
1450First time through, eh? I have some defaults handy for the following systems:
1451
1452EOM
1453 cd hints; ls -C *.sh | $sed 's/\.sh/ /g' >&4
1454 dflt=''
1455 : Half the following guesses are probably wrong... If you have better
1456 : tests or hints, please send them to lwall@netlabs.com
1457 : The metaconfig authors would also appreciate a copy...
a0d0e21e 1458 $test -f /irix && osname=irix
85e6fe83
LW
1459 $test -f /xenix && osname=sco_xenix
1460 $test -f /dynix && osname=dynix
1461 $test -f /dnix && osname=dnix
a0d0e21e 1462 $test -f /unicos && osname=unicos && osvers=`$uname -r`
85e6fe83 1463 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
1464 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
1465 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
1466 $test -d /usr/apollo/bin && osname=apollo
1467 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 1468 $test -d /usr/include/minix && osname=minix
2304df62
AD
1469 if $test -f $uname; then
1470 set X $myuname
1471 shift
1472
2304df62 1473 case "$5" in
85e6fe83 1474 fps*) osname=fps ;;
2304df62
AD
1475 mips*)
1476 case "$4" in
85e6fe83
LW
1477 umips) osname=umips ;;
1478 *) osname=mips ;;
2304df62 1479 esac;;
85e6fe83
LW
1480 [23]100) osname=mips ;;
1481 next*) osname=next ;;
1482 news*) osname=news ;;
ecfc5424
AD
1483 i386*)
1484 if $test -f /etc/kconfig; then
1485 osname=isc
a0d0e21e
LW
1486 if test "$lns" = "ln -s"; then
1487 osvers=4
1488 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
1489 osvers=3
2304df62 1490 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 1491 osvers=2
ecfc5424
AD
1492 fi
1493 fi
1494 ;;
2304df62
AD
1495 esac
1496
1497 case "$1" in
a0d0e21e
LW
1498 aix) osname=aix
1499 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
1500 case "$tmp" in
1501 'not found') osvers=3.2.0 ;;
1502 '<3240'|'<>3240') osvers=3.2.0 ;;
1503 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
1504 '=3250'|'>3250') osvers=3.2.5 ;;
1505 *) osvers='' ;;
1506 esac
1507 ;;
1508 dnix) osname=dnix
1509 osvers="$3"
1510 ;;
1511 domainos) osname=apollo
1512 osvers="$3"
1513 ;;
1514 dgux) osname=dgux
1515 osvers="$3"
1516 ;;
1517 freebsd) osname=freebsd
1518 osvers="$3" ;;
1519 genix) osname=genix ;;
1520 hp*) osname=hpux
1521 case "$3" in
1522 *.08.*) osvers=9 ;;
1523 *.09.*) osvers=9 ;;
1524 *.10.*) osvers=10 ;;
ecfc5424 1525 *) osvers="$3" ;;
a0d0e21e
LW
1526 esac
1527 ;;
1528 irix) osname=irix
1529 case "$3" in
1530 4*) osvers=4 ;;
1531 5*) osvers=5 ;;
ecfc5424 1532 *) osvers="$3" ;;
a0d0e21e
LW
1533 esac
1534 ;;
1535 linux) osname=linux
1536 case "$3" in
1537 1*) osvers=1 ;;
1538 *) osvers="$3" ;;
1539 esac
1540 ;;
1541 netbsd*) osname=netbsd
ecfc5424
AD
1542 osvers="$3"
1543 ;;
a0d0e21e
LW
1544 bsd386) osname=bsd386
1545 osvers=`$uname -r`
1546 ;;
1547 next*) osname=next ;;
1548 solaris) osname=solaris
1549 case "$3" in
1550 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 1551 *) osvers="$3" ;;
a0d0e21e
LW
1552 esac
1553 ;;
85e6fe83
LW
1554 sunos) osname=sunos
1555 case "$3" in
85e6fe83
LW
1556 5*) osname=solaris
1557 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 1558 *) osvers="$3" ;;
2304df62
AD
1559 esac
1560 ;;
a0d0e21e 1561 titanos) osname=titanos
85e6fe83 1562 case "$3" in
a0d0e21e
LW
1563 1*) osvers=1 ;;
1564 2*) osvers=2 ;;
1565 3*) osvers=3 ;;
1566 4*) osvers=4 ;;
ecfc5424 1567 *) osvers="$3" ;;
2304df62
AD
1568 esac
1569 ;;
85e6fe83 1570 ultrix) osname=ultrix
ecfc5424 1571 osvers="$3"
2304df62 1572 ;;
85e6fe83
LW
1573 osf1) case "$5" in
1574 alpha) osname=dec_osf
1575 case "$3" in
ecfc5424
AD
1576 [vt]1\.*) osvers=1 ;;
1577 [vt]2\.*) osvers=2 ;;
1578 [vt]3\.*) osvers=3 ;;
85e6fe83 1579 esac
ecfc5424
AD
1580 ;;
1581 hp*) osname=hp_osf1 ;;
1582 mips) osname=mips_osf1 ;;
85e6fe83
LW
1583 esac
1584 ;;
a0d0e21e
LW
1585 uts) osname=uts
1586 osvers="$3"
1587 ;;
85e6fe83 1588 $2) case "$osname" in
2304df62 1589 *isc*) ;;
a0d0e21e
LW
1590 *freebsd*) ;;
1591 svr*)
1592 : svr4.x or possibly later
1593 case "svr$3" in
1594 ${osname}*)
1595 osname=svr$3
1596 osvers=$4
1597 ;;
1598 esac
1599 case "$osname" in
1600 svr4.0)
1601 : Check for ESIX
1602 if test -f /stand/boot ; then
1603 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
1604 if test -n "$INITPROG" -a -f "$INITPROG"; then
1605 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
1606 if test -n "$isesix"; then
a0d0e21e
LW
1607 osname=esix4
1608 fi
1609 fi
1610 fi
1611 ;;
1612 esac
1613 ;;
2304df62 1614 *) if test -f /etc/systemid; then
a0d0e21e
LW
1615 osname=sco
1616 set `echo $3 | $sed 's/\./ /g'` $4
2304df62 1617 if $test -f sco_$1_$2_$3.sh; then
85e6fe83 1618 osvers=$1.$2.$3
2304df62 1619 elif $test -f sco_$1_$2.sh; then
85e6fe83 1620 osvers=$1.$2
2304df62 1621 elif $test -f sco_$1.sh; then
85e6fe83 1622 osvers=$1
2304df62 1623 fi
a0d0e21e
LW
1624 else
1625 case "$osname" in
1626 '') : Still unknown. Probably a generic Sys V.
1627 osname="sysv"
1628 osvers="$3"
1629 ;;
1630 esac
2304df62
AD
1631 fi
1632 ;;
1633 esac
1634 ;;
a0d0e21e
LW
1635 *) case "$osname" in
1636 '') : Still unknown. Probably a generic BSD.
1637 osname="$1"
1638 osvers="$3"
1639 ;;
1640 esac
1641 ;;
2304df62
AD
1642 esac
1643 else
1644 if test -f /vmunix -a -f news_os.sh; then
ecfc5424 1645 (what /vmunix | ../UU/tr '[A-Z]' '[a-z]') > ../UU/kernel.what 2>&1
2304df62 1646 if $contains news-os ../UU/kernel.what >/dev/null 2>&1; then
85e6fe83 1647 osname=news_os
2304df62
AD
1648 fi
1649 $rm -f ../UU/kernel.what
1650 fi
1651 fi
85e6fe83 1652
a0d0e21e
LW
1653 : Now look for a hint file osname_osvers, unless one has been
1654 : specified already.
1655 case "$hintfile" in
1656 ''|' ')
ecfc5424 1657 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
a0d0e21e 1658 : Also try without trailing minor version numbers.
ecfc5424
AD
1659 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
1660 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
1661 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
1662 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
a0d0e21e
LW
1663 case "$file" in
1664 '') dflt=none ;;
1665 *) case "$osvers" in
1666 '') dflt=$file
1667 ;;
1668 *) if $test -f $file.sh ; then
1669 dflt=$file
1670 elif $test -f $xfile.sh ; then
1671 dflt=$xfile
1672 elif $test -f $xxfile.sh ; then
1673 dflt=$xxfile
1674 elif $test -f $xxxfile.sh ; then
1675 dflt=$xxxfile
1676 elif $test -f $xxxxfile.sh ; then
1677 dflt=$xxxxfile
1678 elif $test -f "${osname}.sh" ; then
1679 dflt="${osname}"
1680 else
1681 dflt=none
1682 fi
1683 ;;
1684 esac
85e6fe83
LW
1685 ;;
1686 esac
1687 ;;
a0d0e21e 1688 *)
ecfc5424 1689 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 1690 ;;
2304df62 1691 esac
85e6fe83 1692
2304df62
AD
1693 $cat <<EOM
1694
1695You may give one or more space-separated answers, or "none" if appropriate.
1696If your OS version has no hints, DO NOT give a wrong version -- say "none".
1697
1698EOM
1699 rp="Which of these apply, if any?"
1700 . ../UU/myread
85e6fe83
LW
1701 tans=$ans
1702 for file in $tans; do
2304df62
AD
1703 if $test -f $file.sh; then
1704 . ./$file.sh
1705 $cat $file.sh >> ../UU/config.sh
85e6fe83 1706 elif $test X$tans = X -o X$tans = Xnone ; then
2304df62
AD
1707 : nothing
1708 else
85e6fe83
LW
1709 : Give one chance to correct a possible typo.
1710 echo "$file.sh does not exist"
1711 dflt=$file
1712 rp="hint to use instead?"
1713 . ../UU/myread
1714 for file in $ans; do
1715 if $test -f "$file.sh"; then
1716 . ./$file.sh
1717 $cat $file.sh >> ../UU/config.sh
1718 elif $test X$ans = X -o X$ans = Xnone ; then
1719 : nothing
1720 else
1721 echo "$file.sh does not exist -- ignored."
1722 fi
1723 done
2304df62
AD
1724 fi
1725 done
85e6fe83 1726
2304df62 1727 hint=recommended
85e6fe83
LW
1728 : Remember our hint file for later.
1729 if $test -f "$file.sh" ; then
a0d0e21e 1730 hintfile="$file"
85e6fe83 1731 else
a0d0e21e 1732 hintfile=''
85e6fe83
LW
1733 fi
1734
2304df62
AD
1735 cd ..
1736fi
1737cd UU
1738;;
1739*)
1740 echo " "
1741 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
1742 tmp_n="$n"
1743 tmp_c="$c"
2304df62
AD
1744 cd ..
1745 cp $config_sh config.sh 2>/dev/null
1746 . ./config.sh
1747 cd UU
ecfc5424 1748 test "$override" && . ./$optdef
2304df62 1749 cp ../config.sh .
ecfc5424
AD
1750 n="$tmp_n"
1751 c="$tmp_c"
2304df62
AD
1752 hint=previous
1753 ;;
1754esac
1755
1756: Restore computed paths
1757for file in $loclist $trylist; do
1758 eval $file="\$_$file"
1759done
1760
85e6fe83 1761cat << EOM
a0d0e21e 1762
85e6fe83 1763Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
1764The default value is probably right if the name rings a bell. Otherwise,
1765since spelling matters for me, either accept the default or answer "none"
1766to leave it blank.
a0d0e21e 1767
85e6fe83 1768EOM
85e6fe83 1769case "$osname" in
a0d0e21e 1770 ''|' ')
85e6fe83 1771 case "$hintfile" in
a0d0e21e 1772 ''|' '|none) dflt=none ;;
ecfc5424 1773 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
1774 esac
1775 ;;
1776 *) dflt="$osname" ;;
1777esac
1778rp="Operating system name?"
1779. ./myread
1780case "$ans" in
ecfc5424
AD
1781none) osname='' ;;
1782*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 1783esac
2304df62
AD
1784: who configured the system
1785cf_time=`$date 2>&1`
a0d0e21e
LW
1786(logname > .temp) >/dev/null 2>&1
1787$test -s .temp || (whoami > .temp) >/dev/null 2>&1
1788$test -s .temp || echo unknown > .temp
1789cf_by=`$cat .temp`
1790$rm -f .temp
2304df62
AD
1791
1792: determine where manual pages are on this system
1793echo " "
1794case "$sysman" in
1795'')
a0d0e21e 1796 syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2304df62
AD
1797 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
1798 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
1799 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
a0d0e21e
LW
1800 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
1801 sysman=`./loc . /usr/man/man1 $syspath`
2304df62
AD
1802 ;;
1803esac
1804if $test -d "$sysman"; then
1805 echo "System manual is in $sysman." >&4
1806else
1807 echo "Could not find manual pages in source form." >&4
1808fi
1809
1810: see what memory models we can support
1811case "$models" in
1812'')
1813 $cat >pdp11.c <<'EOP'
1814main() {
1815#ifdef pdp11
1816 exit(0);
1817#else
1818 exit(1);
1819#endif
1820}
1821EOP
1822 cc -o pdp11 pdp11.c >/dev/null 2>&1
1823 if ./pdp11 2>/dev/null; then
1824 dflt='unsplit split'
1825 else
1826 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
1827 case "$tans" in
1828 X) dflt='none';;
1829 *) if $test -d /lib/small || $test -d /usr/lib/small; then
1830 dflt='small'
1831 else
1832 dflt=''
1833 fi
1834 if $test -d /lib/medium || $test -d /usr/lib/medium; then
1835 dflt="$dflt medium"
1836 fi
1837 if $test -d /lib/large || $test -d /usr/lib/large; then
1838 dflt="$dflt large"
1839 fi
1840 if $test -d /lib/huge || $test -d /usr/lib/huge; then
1841 dflt="$dflt huge"
1842 fi
1843 esac
1844 fi;;
1845*) dflt="$models";;
1846esac
1847$cat <<EOM
1848
1849Some systems have different model sizes. On most systems they are called
1850small, medium, large, and huge. On the PDP11 they are called unsplit and
1851split. If your system doesn't support different memory models, say "none".
1852If you wish to force everything to one memory model, say "none" here and
1853put the appropriate flags later when it asks you for other cc and ld flags.
1854Venix systems may wish to put "none" and let the compiler figure things out.
1855(In the following question multiple model names should be space separated.)
1856
1857EOM
1858rp="Which memory models are supported?"
1859. ./myread
1860models="$ans"
1861
1862case "$models" in
1863none)
1864 small=''
1865 medium=''
1866 large=''
1867 huge=''
1868 unsplit=''
1869 split=''
1870 ;;
1871*split)
1872 case "$split" in
1873 '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
1874 $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
1875 dflt='-i'
1876 else
1877 dflt='none'
1878 fi;;
1879 *) dflt="$split";;
1880 esac
1881 rp="What flag indicates separate I and D space?"
1882 . ./myread
1883 tans="$ans"
1884 case "$tans" in
1885 none) tans='';;
1886 esac
1887 split="$tans"
1888 unsplit='';;
1889*large*|*small*|*medium*|*huge*)
1890 case "$models" in
1891 *large*)
1892 case "$large" in
1893 '') dflt='-Ml';;
1894 *) dflt="$large";;
1895 esac
1896 rp="What flag indicates large model?"
1897 . ./myread
1898 tans="$ans"
1899 case "$tans" in
1900 none) tans='';
1901 esac
1902 large="$tans";;
1903 *) large='';;
1904 esac
1905 case "$models" in
1906 *huge*) case "$huge" in
1907 '') dflt='-Mh';;
1908 *) dflt="$huge";;
1909 esac
1910 rp="What flag indicates huge model?"
1911 . ./myread
1912 tans="$ans"
1913 case "$tans" in
1914 none) tans='';
1915 esac
1916 huge="$tans";;
1917 *) huge="$large";;
1918 esac
1919 case "$models" in
1920 *medium*) case "$medium" in
1921 '') dflt='-Mm';;
1922 *) dflt="$medium";;
1923 esac
1924 rp="What flag indicates medium model?"
1925 . ./myread
1926 tans="$ans"
1927 case "$tans" in
1928 none) tans='';
1929 esac
1930 medium="$tans";;
1931 *) medium="$large";;
1932 esac
1933 case "$models" in
1934 *small*) case "$small" in
1935 '') dflt='none';;
1936 *) dflt="$small";;
1937 esac
1938 rp="What flag indicates small model?"
1939 . ./myread
1940 tans="$ans"
1941 case "$tans" in
1942 none) tans='';
1943 esac
1944 small="$tans";;
1945 *) small='';;
1946 esac
1947 ;;
1948*)
1949 echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
1950 ;;
1951esac
1952
1953: make some quick guesses about what we are up against
1954echo " "
1955$echo $n "Hmm... $c"
1956echo exit 1 >bsd
1957echo exit 1 >usg
1958echo exit 1 >v7
1959echo exit 1 >osf1
1960echo exit 1 >eunice
1961echo exit 1 >xenix
1962echo exit 1 >venix
ecfc5424 1963d_bsd="$undef"
2304df62
AD
1964$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
1965if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
1966then
1967 echo "Looks kind of like an OSF/1 system, but we'll see..."
1968 echo exit 0 >osf1
1969elif test `echo abc | tr a-z A-Z` = Abc ; then
1970 xxx=`./loc addbib blurfl $pth`
1971 if $test -f $xxx; then
1972 echo "Looks kind of like a USG system with BSD features, but we'll see..."
1973 echo exit 0 >bsd
1974 echo exit 0 >usg
1975 else
1976 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
1977 echo "Looks kind of like an extended USG system, but we'll see..."
1978 else
1979 echo "Looks kind of like a USG system, but we'll see..."
1980 fi
1981 echo exit 0 >usg
1982 fi
1983elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
1984 echo "Looks kind of like a BSD system, but we'll see..."
ecfc5424 1985 d_bsd="$define"
2304df62
AD
1986 echo exit 0 >bsd
1987else
1988 echo "Looks kind of like a Version 7 system, but we'll see..."
1989 echo exit 0 >v7
1990fi
1991case "$eunicefix" in
1992*unixtovms*)
1993 $cat <<'EOI'
1994There is, however, a strange, musty smell in the air that reminds me of
1995something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
1996EOI
1997 echo exit 0 >eunice
1998 d_eunice="$define"
1999: it so happens the Eunice I know will not run shell scripts in Unix format
2000 ;;
2001*)
2002 echo " "
2003 echo "Congratulations. You aren't running Eunice."
2004 d_eunice="$undef"
2005 ;;
2006esac
2007if test -f /xenix; then
2008 echo "Actually, this looks more like a XENIX system..."
2009 echo exit 0 >xenix
2010 d_xenix="$define"
2011else
2012 echo " "
2013 echo "It's not Xenix..."
2014 d_xenix="$undef"
2015fi
2016chmod +x xenix
2017$eunicefix xenix
2018if test -f /venix; then
2019 echo "Actually, this looks more like a VENIX system..."
2020 echo exit 0 >venix
2021else
2022 echo " "
ecfc5424 2023 if ./xenix; then
2304df62
AD
2024 : null
2025 else
2026 echo "Nor is it Venix..."
2027 fi
2028fi
2029chmod +x bsd usg v7 osf1 eunice xenix venix
2030$eunicefix bsd usg v7 osf1 eunice xenix venix
2031$rm -f foo
2032
2033: see if we need a special compiler
2034echo " "
ecfc5424 2035if ./usg; then
2304df62
AD
2036 case "$cc" in
2037 '') case "$Mcc" in
2038 /*) dflt='Mcc';;
2039 *) case "$large" in
2040 -M*) dflt='cc';;
2041 *) if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
2042 if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
2043 dflt='cc'
2044 else
2045 dflt='cc -M'
2046 fi
2047 else
2048 dflt='cc'
2049 fi;;
2050 esac;;
2051 esac;;
2052 *) dflt="$cc";;
2053 esac
2054 $cat <<'EOM'
2055On some systems the default C compiler will not resolve multiple global
2056references that happen to have the same name. On some such systems the "Mcc"
2057command may be used to force these to be resolved. On other systems a "cc -M"
2058command is required. (Note that the -M flag on other systems indicates a
2059memory model to use!) If you have the Gnu C compiler, you might wish to use
2060that instead.
2061
2062EOM
2063 rp="What command will force resolution on this system?"
2064 . ./myread
2065 cc="$ans"
2066else
2067 case "$cc" in
2068 '') dflt=cc;;
2069 *) dflt="$cc";;
2070 esac
2071 rp="Use which C compiler?"
2072 . ./myread
2073 cc="$ans"
2074fi
ecfc5424
AD
2075echo " "
2076echo "Checking for GNU cc in disguise and/or its version number..." >&4
2304df62
AD
2077$cat >gccvers.c <<EOM
2078#include <stdio.h>
a0d0e21e 2079int main() {
2304df62 2080#ifdef __GNUC__
a0d0e21e 2081#ifdef __VERSION__
ecfc5424 2082 printf("%s\n", __VERSION__);
2304df62 2083#else
ecfc5424 2084 printf("%s\n", "1");
2304df62 2085#endif
a0d0e21e 2086#endif
ecfc5424 2087 exit(0);
2304df62
AD
2088}
2089EOM
a0d0e21e
LW
2090if $cc -o gccvers gccvers.c >/dev/null 2>&1; then
2091 gccversion=`./gccvers`
2092 case "$gccversion" in
2093 '') echo "You are not using GNU cc." ;;
2094 *) echo "You are using GNU cc $gccversion." ;;
2095 esac
2096else
ecfc5424 2097 echo "I can't compile the test program -- Assuming it isn't GNU cc."
a0d0e21e
LW
2098fi
2099$rm -f gccvers*
2100case "$gccversion" in
21011*) cpp=`./loc gcc-cpp $cpp $pth` ;;
2304df62 2102esac
a0d0e21e 2103
2304df62
AD
2104: decide how portable to be
2105case "$d_portable" in
2106"$define") dflt=y;;
2107*) dflt=n;;
2108esac
2109$cat <<'EOH'
2110
2111I can set things up so that your shell scripts and binaries are more portable,
2112at what may be a noticable cost in performance. In particular, if you
2113ask to be portable, the following happens:
2114
2115 1) Shell scripts will rely on the PATH variable rather than using
2116 the paths derived above.
2117 2) ~username interpretations will be done at run time rather than
2118 by Configure.
2119
2120EOH
2121rp="Do you expect to run these scripts and binaries on multiple machines?"
2122. ./myread
2123case "$ans" in
2124 y*) d_portable="$define"
2304df62
AD
2125 ;;
2126 *) d_portable="$undef" ;;
2127esac
2128
2129: set up shell script to do ~ expansion
2130cat >filexp <<EOSS
2131$startsh
2132: expand filename
2133case "\$1" in
2134 ~/*|~)
2135 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
2136 ;;
2137 ~*)
2138 if $test -f /bin/csh; then
2139 /bin/csh -f -c "glob \$1"
a0d0e21e 2140 failed=\$?
2304df62
AD
2141 echo ""
2142 exit \$failed
2143 else
2144 name=\`$expr x\$1 : '..\([^/]*\)'\`
2145 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
2146 if $test ! -d "\$dir"; then
2147 me=\`basename \$0\`
2148 echo "\$me: can't locate home directory for: \$name" >&2
2149 exit 1
2150 fi
2151 case "\$1" in
2152 */*)
2153 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
2154 ;;
2155 *)
2156 echo \$dir
2157 ;;
2158 esac
2159 fi
2160 ;;
2161*)
2162 echo \$1
2163 ;;
2164esac
2165EOSS
2166chmod +x filexp
2167$eunicefix filexp
2168
2169: now set up to get a file name
2170cat <<'EOSC' >getfile
2171tilde=''
2172fullpath=''
2173already=''
2174skip=''
2175none_ok=''
2176exp_file=''
a0d0e21e 2177nopath_ok=''
2304df62
AD
2178orig_rp="$rp"
2179orig_dflt="$dflt"
2180
2181case "$fn" in
ecfc5424
AD
2182*\(*)
2183 expr $fn : '.*(\(.*\)).*' | tr ',' '\012' >getfile.ok
2184 fn=`echo $fn | sed 's/(.*)//'`
2185 ;;
2186esac
2187
2188case "$fn" in
a0d0e21e
LW
2189*:*)
2190 loc_file=`expr $fn : '.*:\(.*\)'`
2191 fn=`expr $fn : '\(.*\):.*'`
2192 ;;
2193esac
2194
2195case "$fn" in
2304df62
AD
2196*~*) tilde=true;;
2197esac
2198case "$fn" in
2199*/*) fullpath=true;;
2200esac
2201case "$fn" in
2202*+*) skip=true;;
2203esac
2204case "$fn" in
2205*n*) none_ok=true;;
2206esac
2207case "$fn" in
2208*e*) exp_file=true;;
2209esac
a0d0e21e
LW
2210case "$fn" in
2211*p*) nopath_ok=true;;
2212esac
2304df62
AD
2213
2214case "$fn" in
2215*f*) type='File';;
2216*d*) type='Directory';;
a0d0e21e 2217*l*) type='Locate';;
2304df62
AD
2218esac
2219
2220what="$type"
2221case "$what" in
2222Locate) what='File';;
2223esac
2224
2225case "$exp_file" in
2226'')
2227 case "$d_portable" in
2228 "$define") ;;
2229 *) exp_file=true;;
2230 esac
2231 ;;
2232esac
2233
2234cd ..
2235while test "$type"; do
2236 redo=''
2237 rp="$orig_rp"
2238 dflt="$orig_dflt"
2239 case "$tilde" in
2240 true) rp="$rp (~name ok)";;
2241 esac
2242 . UU/myread
ecfc5424
AD
2243 if test -f UU/getfile.ok && \
2244 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
2245 then
2246 value="$ans"
2247 ansexp="$ans"
2248 break
2249 fi
2304df62
AD
2250 case "$ans" in
2251 none)
2252 value=''
2253 ansexp=''
2254 case "$none_ok" in
2255 true) type='';;
2256 esac
2257 ;;
2258 *)
2259 case "$tilde" in
2260 '') value="$ans"
2261 ansexp="$ans";;
2262 *)
2263 value=`UU/filexp $ans`
2264 case $? in
2265 0)
2266 if test "$ans" != "$value"; then
ecfc5424 2267 echo "(That expands to $value on this system.)"
2304df62
AD
2268 fi
2269 ;;
2270 *) value="$ans";;
2271 esac
2272 ansexp="$value"
2273 case "$exp_file" in
2274 '') value="$ans";;
2275 esac
2276 ;;
2277 esac
2278 case "$fullpath" in
2279 true)
2280 case "$ansexp" in
2281 /*) value="$ansexp" ;;
2282 *)
2283 redo=true
2284 case "$already" in
2285 true)
2286 echo "I shall only accept a full path name, as in /bin/ls." >&4
2287 echo "Use a ! shell escape if you wish to check pathnames." >&4
2288 ;;
2289 *)
2290 echo "Please give a full path name, starting with slash." >&4
2291 case "$tilde" in
2292 true)
2293 echo "Note that using ~name is ok provided it expands well." >&4
2294 already=true
2295 ;;
2296 esac
2297 esac
2298 ;;
2299 esac
2300 ;;
2301 esac
2302 case "$redo" in
2303 '')
2304 case "$type" in
2305 File)
2306 if test -f "$ansexp"; then
2307 type=''
2308 elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1
2309 then
2310 echo "($value is not a plain file, but that's ok.)"
2311 type=''
2312 fi
2313 ;;
2314 Directory)
2315 if test -d "$ansexp"; then
2316 type=''
2317 fi
2318 ;;
2319 Locate)
2320 if test -d "$value"; then
a0d0e21e
LW
2321 echo "(Looking for $loc_file in directory $value.)"
2322 value="$value/$loc_file"
2304df62
AD
2323 fi
2324 if test -f "$value"; then
2325 type=''
2326 fi
a0d0e21e
LW
2327 case "$nopath_ok" in
2328 true) case "$value" in
2329 */*) ;;
2330 *) echo "Assuming $value will be in people's path."
2331 type=''
2332 ;;
2333 esac
2334 ;;
2335 esac
2304df62
AD
2336 ;;
2337 esac
2338
2339 case "$skip" in
2340 true) type='';
2341 esac
2342
2343 case "$type" in
2344 '') ;;
2345 *)
2346 if test "$fastread" = yes; then
2347 dflt=y
2348 else
2349 dflt=n
2350 fi
2351 rp="$what $value doesn't exist. Use that name anyway?"
2352 . UU/myread
2353 dflt=''
2354 case "$ans" in
2355 y*) type='';;
2356 *) echo " ";;
2357 esac
2358 ;;
2359 esac
2360 ;;
2361 esac
2362 ;;
2363 esac
2364done
2365cd UU
2366ans="$value"
2367rp="$orig_rp"
2368dflt="$orig_dflt"
ecfc5424 2369rm -f getfile.ok
2304df62
AD
2370EOSC
2371
2372: What should the include directory be ?
2373echo " "
2374$echo $n "Hmm... $c"
a0d0e21e 2375dflt='/usr/include'
2304df62
AD
2376incpath=''
2377mips_type=''
2378if $test -f /bin/mips && /bin/mips; then
2379 echo "Looks like a MIPS system..."
2380 $cat >usr.c <<'EOCP'
2381#ifdef SYSTYPE_BSD43
2382/bsd43
2383#endif
2384EOCP
2385 if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
2386 dflt='/bsd43/usr/include'
2387 incpath='/bsd43'
2388 mips_type='BSD 4.3'
2389 else
2390 mips_type='System V'
2391 fi
2392 $rm -f usr.c usr.out
2393 echo "and you're compiling with the $mips_type compiler and libraries."
2394else
2395 echo "Doesn't look like a MIPS system."
2396 echo "exit 1" >mips
2397 chmod +x mips
2398 $eunicefix mips
2399fi
2400echo " "
a0d0e21e
LW
2401case "$usrinc" in
2402'') ;;
2403*) dflt="$usrinc";;
2404esac
2304df62
AD
2405fn=d/
2406rp='Where are the include files you want to use?'
2407. ./getfile
2408usrinc="$ans"
2409
a0d0e21e
LW
2410: see how we invoke the C preprocessor
2411echo " "
2412echo "Now, how can we feed standard input to your C preprocessor..." >&4
2413cat <<'EOT' >testcpp.c
2414#define ABC abc
2415#define XYZ xyz
2416ABC.XYZ
2417EOT
2418cd ..
2419echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
2420chmod 755 cppstdin
2421wrapper=`pwd`/cppstdin
2422ok='false'
2423cd UU
2304df62 2424
a0d0e21e
LW
2425if $test "X$cppstdin" != "X" && \
2426 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
2427 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
2428then
2429 echo "You used to use $cppstdin $cppminus so we'll use that again."
2430 case "$cpprun" in
2431 '') echo "But let's see if we can live without a wrapper..." ;;
2432 *)
2433 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
2434 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
2304df62 2435 then
a0d0e21e
LW
2436 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
2437 ok='true'
2438 else
2439 echo "(However, $cpprun $cpplast does not work, let's see...)"
2304df62
AD
2440 fi
2441 ;;
2442 esac
2304df62 2443else
a0d0e21e
LW
2444 case "$cppstdin" in
2445 '') ;;
2446 *)
2447 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
2448 ;;
2449 esac
2304df62 2450fi
2304df62 2451
a0d0e21e
LW
2452if $ok; then
2453 : nothing
2454elif echo 'Maybe "'"$cc"' -E" will work...'; \
2455 $cc -E <testcpp.c >testcpp.out 2>&1; \
2456 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2457 echo "Yup, it does."
2458 x_cpp="$cc -E"
2459 x_minus='';
2460elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
2461 $cc -E - <testcpp.c >testcpp.out 2>&1; \
2462 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2463 echo "Yup, it does."
2464 x_cpp="$cc -E"
2465 x_minus='-';
2466elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
2467 $cc -P <testcpp.c >testcpp.out 2>&1; \
2468 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2469 echo "Yipee, that works!"
2470 x_cpp="$cc -P"
2471 x_minus='';
2472elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
2473 $cc -P - <testcpp.c >testcpp.out 2>&1; \
2474 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2475 echo "At long last!"
2476 x_cpp="$cc -P"
2477 x_minus='-';
2478elif echo 'No such luck, maybe "'$cpp'" will work...'; \
2479 $cpp <testcpp.c >testcpp.out 2>&1; \
2480 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2481 echo "It works!"
2482 x_cpp="$cpp"
2483 x_minus='';
2484elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
2485 $cpp - <testcpp.c >testcpp.out 2>&1; \
2486 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2487 echo "Hooray, it works! I was beginning to wonder."
2488 x_cpp="$cpp"
2489 x_minus='-';
2490elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
2491 $wrapper <testcpp.c >testcpp.out 2>&1; \
2492 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2493 x_cpp="$wrapper"
2494 x_minus=''
2495 echo "Eureka!"
2496else
2497 dflt=''
2498 rp="No dice. I can't find a C preprocessor. Name one:"
2499 . ./myread
2500 x_cpp="$ans"
2501 x_minus=''
2502 $x_cpp <testcpp.c >testcpp.out 2>&1
2503 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2504 echo "OK, that will do." >&4
2505 else
2506echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
2507 exit 1
2508 fi
2509fi
2510
2511case "$ok" in
2512false)
2513 cppstdin="$x_cpp"
2514 cppminus="$x_minus"
2515 cpprun="$x_cpp"
2516 cpplast="$x_minus"
2517 set X $x_cpp
2518 shift
2519 case "$1" in
2520 "$cpp")
2521 echo "Perhaps can we force $cc -E using a wrapper..."
2522 if $wrapper <testcpp.c >testcpp.out 2>&1; \
2523 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
2524 then
2525 echo "Yup, we can."
2526 cppstdin="$wrapper"
2527 cppminus='';
2528 else
2529 echo "Nope, we'll have to live without it..."
2530 fi
2531 ;;
2532 esac
2533 case "$cpprun" in
2534 "$wrapper")
2535 cpprun=''
2536 cpplast=''
2537 ;;
2538 esac
2539 ;;
2540esac
2541
2542case "$cppstdin" in
2543"$wrapper") ;;
2544*) $rm -f $wrapper;;
2545esac
2546$rm -f testcpp.c testcpp.out
2547
2548: determine optimize, if desired, or use for debug flag also
2549case "$optimize" in
2550' ') dflt='none';;
2551'') dflt='-O';;
2552*) dflt="$optimize";;
2553esac
2554$cat <<EOH
2555
2556Some C compilers have problems with their optimizers, by default, $package
2557compiles with the -O flag to use the optimizer. Alternately, you might want
2558to use the symbolic debugger, which uses the -g flag (on traditional Unix
2559systems). Either flag can be specified here. To use neither flag, specify
2560the word "none".
2561
2562EOH
2563rp="What optimizer/debugger flag should be used?"
2564. ./myread
2565optimize="$ans"
2566case "$optimize" in
2567'none') optimize=" ";;
2568esac
2569
2570dflt=''
2571case "$ccflags" in
2572'')
2573 case "$gccversion" in
2574 1*) dflt='-fpcc-struct-return' ;;
2575 esac
2576 case "$optimize" in
2577 *-g*) dflt="$dflt -DDEBUGGING";;
2578 esac
2579 case "$gccversion" in
2580 2*) if test -d /etc/conf/kconfig.d &&
2581 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
2582 then
2583 dflt="$dflt -posix"
2584 fi
2585 ;;
2586 esac
2587 ;;
2588esac
2589
2590case "$mips_type" in
2591*BSD*) ;;
2592'') ;;
2593*) inclwanted="$inclwanted $usrinc/bsd";;
2594esac
2595for thisincl in $inclwanted; do
2596 if $test -d $thisincl; then
2597 if $test x$thisincl != x$usrinc; then
2598 case "$dflt" in
2599 *$thisincl*);;
2600 *) dflt="$dflt -I$thisincl";;
2601 esac
2602 fi
2603 fi
2604done
2605
2606inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
2607 xxx=true;
2608elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
2609 xxx=true;
2610else
2611 xxx=false;
2612fi;
2613if $xxx; then
2614 case "$dflt" in
2615 *$2*);;
2616 *) dflt="$dflt -D$2";;
2617 esac;
2618fi'
2619
2620if ./osf1; then
2621 set signal.h __LANGUAGE_C__; eval $inctest
2622else
2623 set signal.h LANGUAGE_C; eval $inctest
2624fi
2625set signal.h NO_PROTOTYPE; eval $inctest
2626set signal.h _NO_PROTO; eval $inctest
2627
2628case "$dflt" in
2629'') dflt=none;;
2304df62 2630esac
85e6fe83
LW
2631case "$ccflags" in
2632'') ;;
2633*) dflt="$ccflags";;
2634esac
2304df62
AD
2635$cat <<EOH
2636
2637Your C compiler may want other flags. For this question you should include
2638-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
2639but you should NOT include libraries or ld flags like -lwhatever. If you
2640want $package to honor its debug switch, you should include -DDEBUGGING here.
a0d0e21e
LW
2641Your C compiler might also need additional flags, such as -D_POSIX_SOURCE,
2642-DHIDEMYMALLOC or -DCRIPPLED_CC.
2643
2304df62
AD
2644To use no flags, specify the word "none".
2645
2304df62
AD
2646EOH
2647set X $dflt
2648shift
2649dflt=${1+"$@"}
2650rp="Any additional cc flags?"
2651. ./myread
2652case "$ans" in
2653none) ccflags='';;
2654*) ccflags="$ans";;
2655esac
2656
2657: the following weeds options from ccflags that are of no interest to cpp
2658cppflags="$ccflags"
a0d0e21e
LW
2659case "$gccversion" in
26601*) cppflags="$cppflags -D__GNUC__"
2304df62
AD
2661esac
2662case "$mips_type" in
2663'');;
2664*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
2665esac
2666case "$cppflags" in
2667'');;
a0d0e21e
LW
2668*)
2669 echo " "
2670 echo "Let me guess what the preprocessor flags are..." >&4
2671 set X $cppflags
2672 shift
2304df62 2673 cppflags=''
a0d0e21e
LW
2674 $cat >cpp.c <<'EOM'
2675#define BLURFL foo
2676
2677BLURFL xx LFRULB
2678EOM
2679 previous=''
2680 for flag in $*
2304df62 2681 do
a0d0e21e
LW
2682 case "$flag" in
2683 -*) ftry="$flag";;
2684 *) ftry="$previous $flag";;
2304df62 2685 esac
a0d0e21e
LW
2686 if $cppstdin -DLFRULB=bar $ftry $cppminus <cpp.c \
2687 >cpp1.out 2>/dev/null && \
2688 $cpprun -DLFRULB=bar $ftry $cpplast <cpp.c \
2689 >cpp2.out 2>/dev/null && \
2690 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
2691 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
2692 then
2693 cppflags="$cppflags $ftry"
2694 previous=''
2695 else
2696 previous="$flag"
2697 fi
2304df62 2698 done
a0d0e21e
LW
2699 set X $cppflags
2700 shift
2701 cppflags=${1+"$@"}
2304df62 2702 case "$cppflags" in
a0d0e21e 2703 *-*) echo "They appear to be: $cppflags";;
2304df62 2704 esac
a0d0e21e 2705 $rm -f cpp.c cpp?.out
2304df62
AD
2706 ;;
2707esac
2708
2709: flags used in final linking phase
2710case "$ldflags" in
ecfc5424 2711'') if ./venix; then
2304df62
AD
2712 dflt='-i -z'
2713 else
a0d0e21e 2714 dflt=''
2304df62 2715 fi
a0d0e21e
LW
2716 case "$ccflags" in
2717 *-posix*) dflt="$dflt -posix" ;;
2718 esac
2719 case "$dflt" in
2720 '') dflt='none' ;;
2721 esac
2304df62
AD
2722 ;;
2723*) dflt="$ldflags";;
2724esac
2725echo " "
2726rp="Any additional ld flags (NOT including libraries)?"
2727. ./myread
2728case "$ans" in
2729none) ldflags='';;
2730*) ldflags="$ans";;
2731esac
2732rmlist="$rmlist pdp11"
2733
2304df62
AD
2734: Set private lib path
2735case "$plibpth" in
ecfc5424 2736'') if ./mips; then
2304df62
AD
2737 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
2738 fi;;
2739esac
a0d0e21e
LW
2740case "$libpth" in
2741' ') dlist='';;
2742'') dlist="$plibpth $glibpth";;
2743*) dlist="$libpth";;
2744esac
2745
2746: Now check and see which directories actually exist, avoiding duplicates
2747libpth=''
2748for xxx in $dlist
2304df62 2749do
a0d0e21e
LW
2750 if $test -d $xxx; then
2751 case " $libpth " in
2752 *" $xxx "*) ;;
2753 *) libpth="$libpth $xxx";;
2754 esac
2304df62
AD
2755 fi
2756done
a0d0e21e 2757$cat <<'EOM'
2304df62 2758
a0d0e21e
LW
2759Some systems have incompatible or broken versions of libraries. Among
2760the directories listed in the question below, please remove any you
2761know not to be holding relevant libraries, and add any that are needed.
2762Say "none" for none.
2763
2764EOM
2765case "$libpth" in
2766'') dflt='none';;
2767*)
2768 set X $libpth
2769 shift
2770 dflt=${1+"$@"}
2771 ;;
2772esac
2304df62
AD
2773rp="Directories to use for library searches?"
2774. ./myread
2775case "$ans" in
2776none) libpth=' ';;
2777*) libpth="$ans";;
2778esac
a0d0e21e
LW
2779
2780: compute shared library extension
2781case "$so" in
2782'')
2783 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
2784 dflt='sl'
2785 else
2786 dflt='so'
2787 fi
2788 ;;
2789*) dflt="$so";;
2790esac
ecfc5424 2791$cat <<EOM
a0d0e21e
LW
2792
2793On some systems, shared libraries may be available. Answer 'none' if
ecfc5424
AD
2794you want to suppress searching of shared libraries for the remaining
2795of this configuration.
2796
a0d0e21e
LW
2797EOM
2798rp='What is the file extension used for shared libraries?'
2799. ./myread
2800so="$ans"
2801
2304df62
AD
2802: Looking for optional libraries
2803echo " "
2804echo "Checking for optional libraries..." >&4
2805case "$libs" in
2806' '|'') dflt='';;
2807*) dflt="$libs";;
2808esac
2809case "$libswanted" in
2810'') libswanted='c_s';;
2811esac
2812for thislib in $libswanted; do
a0d0e21e
LW
2813
2814 if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`; $test -f "$xxx"; then
2815 echo "Found -l$thislib (shared)."
2816 case " $dflt " in
2817 *"-l$thislib "*);;
2818 *) dflt="$dflt -l$thislib";;
2819 esac
2820 elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
2821 echo "Found -l$thislib (shared)."
2822 case " $dflt " in
2823 *"-l$thislib "*);;
2824 *) dflt="$dflt -l$thislib";;
2825 esac
2826 elif xxx=`./loc lib$thislib.a X $libpth`; $test -f "$xxx"; then
2304df62 2827 echo "Found -l$thislib."
a0d0e21e
LW
2828 case " $dflt " in
2829 *"-l$thislib "*);;
2304df62
AD
2830 *) dflt="$dflt -l$thislib";;
2831 esac
a0d0e21e
LW
2832 elif xxx=`./loc lib${thislib}_s.a X $libpth`; $test -f "$xxx"; then
2833 echo "Found -l${thislib}_s."
2834 case " $dflt " in
2835 *"-l$thislib "*);;
2836 *) dflt="$dflt -l${thislib}_s";;
2304df62 2837 esac
a0d0e21e
LW
2838 elif xxx=`./loc Slib$thislib.a X $xlibpth`; $test -f "$xxx"; then
2839 echo "Found -l$thislib."
2840 case " $dflt " in
2841 *"-l$thislib "*);;
2304df62
AD
2842 *) dflt="$dflt -l$thislib";;
2843 esac
2844 else
a0d0e21e 2845 echo "No -l$thislib."
2304df62
AD
2846 fi
2847done
2848set X $dflt
2849shift
2850dflt="$*"
2851case "$libs" in
2852'') dflt="$dflt";;
2853*) dflt="$libs";;
2854esac
2855case "$dflt" in
2856' '|'') dflt='none';;
2857esac
2858
2859$cat <<EOM
2860
2861Some versions of Unix support shared libraries, which make executables smaller
2862but make load time slightly longer.
2863
2864On some systems, mostly newer Unix System V's, the shared library is included
2865by putting the option "-lc_s" as the last thing on the cc command line when
2866linking. Other systems use shared libraries by default. There may be other
2867libraries needed to compile $package on your machine as well. If your system
2868needs the "-lc_s" option, include it here. Include any other special libraries
2869here as well. Say "none" for none.
2870EOM
2871
2872echo " "
2873rp="Any additional libraries?"
2874. ./myread
2875case "$ans" in
2876none) libs=' ';;
2877*) libs="$ans";;
2878esac
2879
2880: see if nm is to be used to determine whether a symbol is defined or not
2881case "$usenm" in
2882'')
2883 dflt=`egrep 'inlibc|csym' ../Configure | wc -l 2>/dev/null`
2884 if $test $dflt -gt 20; then
2885 dflt=y
2886 else
2887 dflt=n
2888 fi
2889 ;;
2890*)
2891 case "$usenm" in
2892 true) dflt=y;;
2893 *) dflt=n;;
2894 esac
2895 ;;
2896esac
2897$cat <<EOM
2898
2899I can use 'nm' to extract the symbols from your C libraries. This is a time
2900consuming task which may generate huge output on the disk (up to 3 megabytes)
2901but that should make the symbols extraction faster. The alternative is to skip
2902the 'nm' extraction part and to compile a small test program instead to
2903determine whether each symbol is present. If you have a fast C compiler and/or
2904if your 'nm' output cannot be parsed, this may be the best solution.
2905
2906EOM
2907rp='Shall I use nm to extract C symbols from the libraries?'
2908. ./myread
2909case "$ans" in
2910n|N) usenm=false;;
2911*) usenm=true;;
2912esac
2913
2914runnm=$usenm
2915case "$reuseval" in
2916true) runnm=false;;
2917esac
2918
2919: nm options which may be necessary
2920case "$nm_opt" in
2921'') if $test -f /mach_boot; then
2922 nm_opt=''
2923 elif $test -d /usr/ccs/lib; then
2924 nm_opt='-p'
2925 elif $test -f /dgux; then
2926 nm_opt='-p'
2927 else
2928 nm_opt=''
2929 fi;;
2930esac
2931
2932case "$runnm" in
2933true)
2934: get list of predefined functions in a handy place
2935echo " "
2936case "$libc" in
2937'') libc=unknown
2938 case "$libs" in
2939 *-lc_s*) libc=`./loc libc_s.a $libc $libpth`
2940 esac
2941 ;;
2942esac
2304df62
AD
2943libnames='';
2944case "$libs" in
2945'') ;;
2946*) for thislib in $libs; do
2947 case "$thislib" in
a0d0e21e
LW
2948 -lc|-lc_s)
2949 : Handle C library specially below.
2950 ;;
2304df62 2951 -l*)
ecfc5424 2952 thislib=`echo $thislib | $sed -e 's/^-l//'`
a0d0e21e
LW
2953 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
2954 :
2955 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
2956 :
2957 elif try=`./loc lib$thislib.a X $libpth`; $test -f "$try"; then
2958 :
2959 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
2960 :
2961 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
2962 :
2963 elif try=`./loc Slib$thislib.a X $xlibpth`; $test -f "$try"; then
2964 :
2965 else
2966 try=''
2304df62
AD
2967 fi
2968 libnames="$libnames $try"
2969 ;;
2970 *) libnames="$libnames $thislib" ;;
2971 esac
2972 done
2973 ;;
2974esac
2975xxx=normal
2976case "$libc" in
2977unknown)
a0d0e21e
LW
2978 set /usr/ccs/lib/libc.$so
2979 $test -r $1 || set /usr/lib/libc.$so
2980 $test -r $1 || set /usr/shlib/libc.$so
2981 $test -r $1 || set /usr/lib/libc.$so.[0-9]*
2982 $test -r $1 || set /lib/libc.$so
2304df62
AD
2983 $test -r $1 || set /lib/libsys_s.a
2984 eval set \$$#
2985 ;;
2986*)
2987 set blurfl
2988 ;;
2989esac
2990if $test -r "$1"; then
2991 echo "Your (shared) C library seems to be in $1."
2992 libc="$1"
2993elif $test -r /lib/libc && $test -r /lib/clib; then
2994 echo "Your C library seems to be in both /lib/clib and /lib/libc."
2995 xxx=apollo
2996 libc='/lib/clib /lib/libc'
2997 if $test -r /lib/syslib; then
2998 echo "(Your math library is in /lib/syslib.)"
2999 libc="$libc /lib/syslib"
3000 fi
3001elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
3002 echo "Your C library seems to be in $libc, as you said before."
3003elif $test -r $incpath/usr/lib/libc.a; then
3004 libc=$incpath/usr/lib/libc.a;
3005 echo "Your C library seems to be in $libc. That's fine."
3006elif $test -r /lib/libc.a; then
3007 libc=/lib/libc.a;
3008 echo "Your C library seems to be in $libc. You're normal."
3009else
3010 if tans=`./loc libc.a blurfl/dyick $libpth`; $test -r "$tans"; then
3011 :
3012 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
3013 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
3014 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
3015 :
3016 elif tans=`./loc Slibc.a blurfl/dyick $xlibpth`; $test -r "$tans"; then
3017 :
3018 elif tans=`./loc Mlibc.a blurfl/dyick $xlibpth`; $test -r "$tans"; then
3019 :
3020 else
3021 tans=`./loc Llibc.a blurfl/dyick $xlibpth`
3022 fi
3023 if $test -r "$tans"; then
3024 echo "Your C library seems to be in $tans, of all places."
3025 libc=$tans
3026 else
3027 libc='blurfl'
3028 fi
3029fi
3030if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
3031 dflt="$libc"
3032 cat <<EOM
3033
3034If the guess above is wrong (which it might be if you're using a strange
3035compiler, or your machine supports multiple models), you can override it here.
3036
3037EOM
3038else
3039 dflt=''
3040 echo $libpth | tr ' ' '\012' | sort | uniq > libpath
3041 cat >&4 <<EOM
3042I can't seem to find your C library. I've looked in the following places:
3043
3044EOM
3045 $sed 's/^/ /' libpath
3046 cat <<EOM
3047
3048None of these seems to contain your C library. I need to get its name...
3049
3050EOM
3051fi
3052fn=f
3053rp='Where is your C library?'
3054. ./getfile
3055libc="$ans"
3056
3057echo " "
3058echo $libc $libnames | tr ' ' '\012' | sort | uniq > libnames
3059set X `cat libnames`
3060shift
3061xxx=files
3062case $# in 1) xxx=file; esac
3063echo "Extracting names from the following $xxx for later perusal:" >&4
3064echo " "
3065$sed 's/^/ /' libnames >&4
3066echo " "
3067$echo $n "This may take a while...$c" >&4
ecfc5424 3068
2304df62
AD
3069nm $nm_opt $* 2>/dev/null >libc.tmp
3070$echo $n ".$c"
3071$grep fprintf libc.tmp > libc.ptf
3072xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
3073xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
a0d0e21e 3074if com="$sed -n -e 's/^.* [ADTSI] *_[_.]*//p' -e 's/^.* [ADTSI] //p'";\
2304df62
AD
3075 eval $xscan;\
3076 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3077 eval $xrun
3078elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
3079 eval $xscan;\
3080 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3081 eval $xrun
3082elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
3083 eval $xscan;\
3084 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3085 eval $xrun
3086elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
3087 eval $xscan;\
3088 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3089 eval $xrun
3090elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
3091 eval $xscan;\
3092 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3093 eval $xrun
3094elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
3095 eval $xscan;\
3096 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3097 eval $xrun
3098elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
3099 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
3100 eval $xscan;\
3101 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3102 eval $xrun
3103elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
3104 eval $xscan;\
3105 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3106 eval $xrun
3107elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
3108 eval $xscan;\
3109 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3110 eval $xrun
a0d0e21e
LW
3111elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
3112 eval $xscan;\
3113 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3114 eval $xrun
2304df62
AD
3115else
3116 nm -p $* 2>/dev/null >libc.tmp
3117 com="$sed -n -e 's/^.* [ADTS] *_[_.]*//p' -e 's/^.* [ADTS] //p'";\
3118 eval "<libc.tmp $com >libc.list"
3119 if $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3120 nm_opt='-p'
3121 echo "done" >&4
3122 else
3123 echo " "
3124 echo "nm didn't seem to work right. Trying ar instead..." >&4
3125 com=''
3126 if ar t $libc > libc.tmp; then
3127 for thisname in $libnames; do
3128 ar t $thisname >>libc.tmp
3129 done
3130 $sed -e 's/\.o$//' < libc.tmp > libc.list
3131 echo "Ok." >&4
3132 else
3133 echo "ar didn't seem to work right." >&4
3134 echo "Maybe this is a Cray...trying bld instead..." >&4
3135 if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
3136 for thisname in $libnames; do
3137 bld t $libnames | \
3138 $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
3139 ar t $thisname >>libc.tmp
3140 done
3141 echo "Ok." >&4
3142 else
3143 echo "That didn't work either. Giving up." >&4
3144 exit 1
3145 fi
3146 fi
3147 fi
3148fi
3149nm_extract="$com"
3150if $test -f /lib/syscalls.exp; then
3151 echo " "
3152 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
3153 $sed -n 's/^\([^ ]*\)[ ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list
3154fi
3155;;
3156esac
3157$rm -f libnames libpath
3158
3159: is a C symbol defined?
3160csym='tlook=$1;
3161case "$3" in
3162-v) tf=libc.tmp; tc=""; tdc="";;
3163-a) tf=libc.tmp; tc="[0]"; tdc=[];;
3164*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
3165esac;
3166tx=yes;
3167case "$reuseval-$4" in
3168true-) ;;
3169true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
3170esac;
3171case "$tx" in
3172yes)
3173 case "$runnm" in
3174 true)
3175 if $contains $tlook $tf >/dev/null 2>&1;
3176 then tval=true;
3177 else tval=false;
3178 fi;;
3179 *)
3180 echo "main() { extern int $1$tdc; printf(\"%d\", $1$tc); }" > t.c;
3181 if $cc $ccflags -o t t.c $ldflags $libs >/dev/null 2>&1;
3182 then tval=true;
3183 else tval=false;
3184 fi;
3185 $rm -f t t.c;;
3186 esac;;
3187*)
3188 case "$tval" in
3189 $define) tval=true;;
3190 *) tval=false;;
3191 esac;;
3192esac;
3193eval "$2=$tval"'
3194
3195: set up the script used to warn in case of inconsistency
3196cat <<'EOSC' >whoa
3197dflt=y
3198echo " "
3199echo "*** WHOA THERE!!! ***" >&4
3200echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
3201rp=" Keep the $hint value?"
3202. ./myread
3203case "$ans" in
3204y) td=$was; tu=$was;;
3205esac
3206EOSC
3207
3208: define an is-in-libc? function
3209inlibc='echo " "; td=$define; tu=$undef;
3210sym=$1; var=$2; eval "was=\$$2";
3211tx=yes;
3212case "$reuseval$was" in
3213true) ;;
3214true*) tx=no;;
3215esac;
3216case "$tx" in
3217yes)
3218 set $sym tres -f;
3219 eval $csym;
3220 case "$tres" in
3221 true)
3222 echo "$sym() found." >&4;
ecfc5424 3223 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
2304df62
AD
3224 *)
3225 echo "$sym() NOT found." >&4;
ecfc5424 3226 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
2304df62
AD
3227 esac;;
3228*)
3229 case "$was" in
3230 $define) echo "$sym() found." >&4;;
3231 *) echo "$sym() NOT found." >&4;;
3232 esac;;
3233esac'
3234
a0d0e21e
LW
3235: see if gconvert exists
3236set gconvert d_gconvert
3237eval $inlibc
2304df62 3238
a0d0e21e
LW
3239case "$d_gconvert" in
3240$define)
ecfc5424 3241 echo "We'll use it to convert floats into a string then." >&4
a0d0e21e
LW
3242 d_Gconvert="gconvert((x),(n),(t),(b))"
3243 ;;
3244*)
3245 : Maybe we can emulate it with gcvt.
3246 set gcvt d_gcvt
3247 eval $inlibc
2304df62 3248
a0d0e21e
LW
3249 case "$d_gcvt" in
3250 $define)
3251 : Test whether gcvt drops a trailing decimal point
ecfc5424 3252 $cat >try.c <<'EOP'
a0d0e21e 3253main() {
ecfc5424
AD
3254 char buf[64];
3255 gcvt(1.0, 8, buf);
3256 if (buf[0] != '1' || buf[1] != '\0')
3257 exit(1);
3258 gcvt(0.0, 8, buf);
3259 if (buf[0] != '0' || buf[1] != '\0')
3260 exit(1);
3261 gcvt(-1.0, 8, buf);
3262 if (buf[0] != '-' || buf[1] != '1' || buf[2] != '\0')
3263 exit(1);
3264 exit(0);
a0d0e21e
LW
3265}
3266EOP
3267 if $cc $ccflags $ldflags -o try try.c $libs > /dev/null 2>&1; then
3268 if ./try; then
3269 echo "Good, your gcvt() drops a trailing decimal point."
ecfc5424 3270 echo "We'll use it to convert floats into a string." >&4
a0d0e21e
LW
3271 d_Gconvert="gcvt((x),(n),(b))"
3272 else
3273 echo "But your gcvt() keeps a trailing decimal point".
3274 d_Gconvert=''
3275 fi
2304df62 3276 else
a0d0e21e
LW
3277 echo "Hmm. I can't compile the gcvt test program."
3278 d_Gconvert=''
2304df62 3279 fi
a0d0e21e 3280 $rm -f try.c try
2304df62
AD
3281 ;;
3282 esac
a0d0e21e
LW
3283 case "$d_Gconvert" in
3284 '')
ecfc5424 3285 echo "I'll use sprintf instead to convert floats into a string." >&4
a0d0e21e 3286 d_Gconvert='sprintf((b),"%.*g",(n),(x))'
2304df62
AD
3287 ;;
3288 esac
2304df62
AD
3289esac
3290
a0d0e21e
LW
3291: Initialize h_fcntl
3292h_fcntl=false
3293
3294: Initialize h_sysfile
3295h_sysfile=false
2304df62
AD
3296
3297: determine filename position in cpp output
3298echo " "
3299echo "Computing filename position in cpp output for #include directives..." >&4
3300echo '#include <stdio.h>' > foo.c
3301$cat >fieldn <<EOF
3302$startsh
a0d0e21e 3303$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
2304df62
AD
3304$grep '^[ ]*#.*stdio\.h' | \
3305while read cline; do
3306 pos=1
3307 set \$cline
3308 while $test \$# -gt 0; do
3309 if $test -r \`echo \$1 | $tr -d '"'\`; then
3310 echo "\$pos"
3311 exit 0
3312 fi
3313 shift
3314 pos=\`expr \$pos + 1\`
3315 done
3316done
3317EOF
3318chmod +x fieldn
3319fieldn=`./fieldn`
3320$rm -f foo.c fieldn
3321case $fieldn in
3322'') pos='???';;
33231) pos=first;;
33242) pos=second;;
33253) pos=third;;
3326*) pos="${fieldn}th";;
3327esac
3328echo "Your cpp writes the filename in the $pos field of the line."
3329
3330: locate header file
3331$cat >findhdr <<EOF
3332$startsh
3333wanted=\$1
3334name=''
3335if test -f $usrinc/\$wanted; then
3336 echo "$usrinc/\$wanted"
3337 exit 0
3338fi
3339awkprg='{ print \$$fieldn }'
3340echo "#include <\$wanted>" > foo\$\$.c
3341$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3342$grep "^[ ]*#.*\$wanted" | \
3343while read cline; do
3344 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
3345 case "\$name" in
3346 */\$wanted) echo "\$name"; exit 0;;
3347 *) name='';;
3348 esac;
3349done;
3350$rm -f foo\$\$.c;
3351case "\$name" in
3352'') exit 1;;
3353esac
3354EOF
3355chmod +x findhdr
3356
3357: access call always available on UNIX
3358set access d_access
3359eval $inlibc
3360
3361: locate the flags for 'access()'
3362case "$d_access" in
3363"$define")
3364 echo " "
3365 $cat >access.c <<'EOCP'
3366#include <sys/types.h>
3367#ifdef I_FCNTL
3368#include <fcntl.h>
3369#endif
3370#ifdef I_SYS_FILE
3371#include <sys/file.h>
3372#endif
3373#ifdef I_UNISTD
3374#include <unistd.h>
3375#endif
3376main() {
3377 exit(R_OK);
3378}
3379EOCP
3380 : check sys/file.h first, no particular reason here
3381 if $test `./findhdr sys/file.h` && \
3382 $cc $cppflags -DI_SYS_FILE access.c -o access >/dev/null 2>&1 ; then
3383 h_sysfile=true;
3384 echo "<sys/file.h> defines the *_OK access constants." >&4
3385 elif $test `./findhdr fcntl.h` && \
3386 $cc $cppflags -DI_FCNTL access.c -o access >/dev/null 2>&1 ; then
3387 h_fcntl=true;
3388 echo "<fcntl.h> defines the *_OK access constants." >&4
85e6fe83
LW
3389 elif $test `./findhdr unistd.h` && \
3390 $cc $cppflags -DI_UNISTD access.c -o access >/dev/null 2>&1 ; then
3391 echo "<unistd.h> defines the *_OK access constants." >&4
2304df62
AD
3392 else
3393 echo "I can't find the four *_OK access constants--I'll use mine." >&4
3394 fi
3395 ;;
3396esac
3397$rm -f access*
3398
a0d0e21e
LW
3399: see if alarm exists
3400set alarm d_alarm
2304df62
AD
3401eval $inlibc
3402
a0d0e21e
LW
3403: is AFS running?
3404echo " "
3405if test -d /afs; then
3406 echo "AFS may be running... I'll be extra cautious then..." >&4
3407 afs=true
3408else
3409 echo "AFS does not seem to be running..." >&4
3410 afs=false
3411fi
2304df62 3412
a0d0e21e
LW
3413: determine root of directory hierarchy where package will be installed.
3414case "$prefix" in
3415'')
3416 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3417 ;;
3418*)
3419 dflt="$prefix"
3420 ;;
3421esac
3422$cat <<EOM
2304df62 3423
a0d0e21e
LW
3424By default, $package will be installed in $dflt/bin, manual
3425pages under $dflt/man, etc..., i.e. with $dflt as prefix for
3426all installation directories. Typically set to /usr/local, but you
3427may choose /usr if you wish to install $package among your system
3428binaries. If you wish to have binaries under /bin but manual pages
3429under /usr/local/man, that's ok: you will be prompted separately
3430for each of the installation directories, the prefix being only used
3431to set defaults.
3432
3433EOM
3434fn=d~
3435rp='Installation prefix to use?'
3436. ./getfile
3437prefix="$ans"
3438
3439: determine where private executables go
3440case "$privlib" in
2304df62 3441'')
a0d0e21e
LW
3442 dflt=$prefix/lib/$package
3443 ;;
3444*) dflt="$privlib"
3445 ;;
3446esac
3447$cat <<EOM
3448
3449There are some auxiliary files for $package that need to be put into a
3450private library directory that is accessible by everyone.
3451
3452EOM
3453fn=d~+
3454rp='Pathname where private library files will reside?'
3455. ./getfile
3456privlib="$ans"
3457privlibexp="$ansexp"
3458if $afs; then
3459 $cat <<EOM
3460
3461Since you are running AFS, I need to distinguish the directory in which
3462private files reside from the directory in which they are installed (and from
3463which they are presumably copied to the former directory by occult means).
3464
3465EOM
3466 case "$installprivlib" in
3467 '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;;
3468 *) dflt="$installprivlib";;
3469 esac
3470 fn=de~
3471 rp='Where will private files be installed?'
3472 . ./getfile
3473 installprivlib="$ans"
3474else
3475 installprivlib="$privlibexp"
3476fi
3477
3478: determine where public architecture dependent libraries go
3479case "$archname" in
3480'') tpath=`echo $PATH | sed -e 's/:/ /g'`
ecfc5424 3481 if xxx=`./loc arch blurfl $tpath`; test -f "$xxx"; then
a0d0e21e 3482 tarchname=`arch`
ecfc5424
AD
3483 archname="${tarchname}-$osname"
3484 elif xxx=`./loc uname blurfl $tpath`; test -f "$xxx" ; then
3485 if uname -m > tmparch 2>&1 ; then
3486 tarchname=`cat tmparch`
3487 archname="${tarchname}-$osname"
3488 fi
3489 rm -f tmparch
2304df62 3490 else
a0d0e21e 3491 archname="$osname"
2304df62
AD
3492 fi
3493 ;;
2304df62 3494esac
ecfc5424
AD
3495case "$archlib" in
3496'')
3497 case "$privlib" in
3498 '') dflt=`./loc . "." $prefix/lib /usr/local/lib /usr/lib /lib`;;
3499 *) dflt="$privlib/$archname";;
3500 esac
3501 ;;
3502*) dflt="$archlib";;
a0d0e21e 3503esac
a0d0e21e
LW
3504cat <<EOM
3505
3506$package contains architecture-dependent library files. If you are
3507sharing libraries in a heterogeneous environment, you might store
3508these files in a separate location. Otherwise, you can just include
3509them with the rest of the public library files.
3510
3511EOM
ecfc5424 3512fn=d~
a0d0e21e
LW
3513rp='Where do you want to put the public architecture-dependent libraries?'
3514. ./getfile
3515archlib="$ans"
3516archlibexp="$ansexp"
3517
3518if $afs; then
3519 $cat <<EOM
3520
3521Since you are running AFS, I need to distinguish the directory in which
3522private files reside from the directory in which they are installed (and from
3523which they are presumably copied to the former directory by occult means).
3524
3525EOM
3526 case "$installarchlib" in
3527 '') dflt=`echo $archlibexp | sed 's#^/afs/#/afs/.#'`;;
3528 *) dflt="$installarchlib";;
3529 esac
3530 fn=de~
3531 rp='Where will architecture-dependent library files be installed?'
3532 . ./getfile
3533 installarchlib="$ans"
3534else
3535 installarchlib="$archlibexp"
3536fi
3537if $test X"$archlib" = X"$privlib"; then
3538 d_archlib="$undef"
3539else
3540 d_archlib="$define"
3541fi
3542
2304df62
AD
3543: function used to set $1 to $val
3544setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3545case "$val$was" in
ecfc5424
AD
3546$define$undef) . ./whoa; eval "$var=\$td";;
3547$undef$define) . ./whoa; eval "$var=\$tu";;
2304df62
AD
3548*) eval "$var=$val";;
3549esac'
3550
ecfc5424 3551: Look for GNU-cc style attribute checking
2304df62 3552echo " "
a0d0e21e
LW
3553echo "Checking whether your compiler can handle __attribute__ ..." >&4
3554$cat >attrib.c <<'EOCP'
ecfc5424 3555void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
a0d0e21e
LW
3556EOCP
3557if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
3558 if $contains 'warning' attrib.out >/dev/null 2>&1; then
ecfc5424 3559 echo "Your C compiler doesn't fully support __attribute__."
a0d0e21e
LW
3560 val="$undef"
3561 else
ecfc5424 3562 echo "Your C compiler supports __attribute__."
a0d0e21e
LW
3563 val="$define"
3564 fi
3565else
ecfc5424 3566 echo "Your C compiler doesn't seem to understand __attribute__ at all."
a0d0e21e
LW
3567 val="$undef"
3568fi
ecfc5424 3569set d_attribut
a0d0e21e
LW
3570eval $setvar
3571$rm -f attrib*
3572
3573: see if bcmp exists
3574set bcmp d_bcmp
3575eval $inlibc
3576
3577: see if bcopy exists
3578set bcopy d_bcopy
3579eval $inlibc
3580
3581: see if setpgrp exists
3582set setpgrp d_setpgrp
3583eval $inlibc
3584
3585: see which flavor of setpgrp is in use
3586case "$d_setpgrp" in
3587"$define")
3588 echo " "
3589 $cat >set.c <<EOP
3590main()
3591{
3592 if (getuid() == 0) {
3593 printf("(I see you are running Configure as super-user...)\n");
3594 setuid(1);
3595 }
3596 if (-1 == setpgrp(1, 1))
3597 exit(1);
3598 exit(0);
3599}
3600EOP
ecfc5424 3601 if $cc $ccflags -o set set.c $ldflags $libs >/dev/null 2>&1; then
a0d0e21e
LW
3602 ./set 2>/dev/null
3603 case $? in
3604 0) echo "You have to use setpgrp() instead of setpgrp(pid, pgrp)." >&4
3605 val="$undef";;
3606 *) echo "You have to use setpgrp(pid, pgrp) instead of setpgrp()." >&4
3607 val="$define";;
3608 esac
3609 else
ecfc5424 3610 if ./usg; then
a0d0e21e
LW
3611 xxx="USG one, i.e. you use setpgrp()."
3612 val="$undef"
3613 else
3614 xxx="BSD one, i.e. you use setpgrp(pid, pgrp)."
3615 val="$define"
3616 fi
3617 echo "Assuming your setpgrp is a $xxx" >&4
3618 fi
3619 ;;
3620*) val="$undef";;
3621esac
3622set d_bsdpgrp
3623eval $setvar
3624$rm -f set set.c
3625
3626: see if bzero exists
3627set bzero d_bzero
3628eval $inlibc
3629
3630: check for length of integer
3631echo " "
3632case "$intsize" in
3633'')
3634 echo "Checking to see how big your integers are..." >&4
3635 $cat >try.c <<'EOCP'
3636#include <stdio.h>
3637main()
3638{
3639 printf("%d\n", sizeof(int));
3640}
3641EOCP
3642 if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then
3643 dflt=`./try`
3644 else
3645 dflt='4'
3646 echo "(I can't seem to compile the test program. Guessing...)"
3647 fi
3648 ;;
3649*)
3650 dflt="$intsize"
3651 ;;
3652esac
3653rp="What is the size of an integer (in bytes)?"
3654. ./myread
3655intsize="$ans"
3656$rm -f try.c try
3657
ecfc5424 3658: see if signal is declared as pointer to function returning int or void
a0d0e21e 3659echo " "
ecfc5424
AD
3660xxx=`./findhdr signal.h`
3661$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
3662if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
3663 echo "You have int (*signal())() instead of void." >&4
3664 val="$undef"
3665elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
3666 echo "You have void (*signal())() instead of int." >&4
3667 val="$define"
3668elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
3669 echo "You have int (*signal())() instead of void." >&4
3670 val="$undef"
a0d0e21e 3671else
ecfc5424
AD
3672 case "$d_voidsig" in
3673 '')
3674 echo "I can't determine whether signal handler returns void or int..." >&4
3675 dflt=void
3676 rp="What type does your signal handler return?"
3677 . ./myread
3678 case "$ans" in
3679 v*) val="$define";;
3680 *) val="$undef";;
3681 esac;;
3682 "$define")
3683 echo "As you already told me, signal handler returns void." >&4;;
3684 *)
3685 echo "As you already told me, signal handler returns int." >&4;;
3686 esac
3687fi
3688set d_voidsig
3689eval $setvar
3690case "$d_voidsig" in
3691"$define") signal_t="void";;
3692*) signal_t="int";;
3693esac
3694$rm -f $$.tmp
3695
3696: check for ability to cast large floats to 32-bit ints.
3697echo " "
3698echo 'Checking whether your C compiler can cast large floats to int32.' >&4
3699if $test "$intsize" -eq 4; then
3700 xxx=int
3701else
3702 xxx=long
3703fi
3704$cat >try.c <<EOCP
3705#include <sys/types.h>
3706#include <signal.h>
3707$signal_t blech() { exit(3); }
3708main()
2304df62 3709{
a0d0e21e 3710 $xxx i32;
2304df62
AD
3711 double f;
3712 int result = 0;
3713 signal(SIGFPE, blech);
3714
3715 f = (double) 0x7fffffff;
3716 f = 10 * f;
a0d0e21e 3717 i32 = ($xxx) f;
2304df62 3718
a0d0e21e 3719 if (i32 != ($xxx) f)
2304df62
AD
3720 result |= 1;
3721 exit(result);
3722}
3723EOCP
3724if $cc -o try $ccflags try.c >/dev/null 2>&1; then
3725 ./try
3726 yyy=$?
3727else
a0d0e21e 3728 echo "(I can't seem to compile the test program--assuming it can't)"
2304df62
AD
3729 yyy=1
3730fi
3731case "$yyy" in
37320) val="$define"
3733 echo "Yup, it can."
3734 ;;
3735*) val="$undef"
3736 echo "Nope, it can't."
3737 ;;
3738esac
3739set d_casti32
3740eval $setvar
85e6fe83 3741$rm -f try try.*
a0d0e21e 3742
2304df62
AD
3743: check for ability to cast negative floats to unsigned
3744echo " "
3745echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
ecfc5424
AD
3746$cat >try.c <<EOCP
3747#include <sys/types.h>
2304df62 3748#include <signal.h>
ecfc5424 3749$signal_t blech() { exit(3); }
2304df62
AD
3750main()
3751{
3752 double f = -123;
3753 unsigned long along;
3754 unsigned int aint;
3755 unsigned short ashort;
3756 int result = 0;
3757
3758 signal(SIGFPE, blech);
3759 along = (unsigned long)f;
3760 aint = (unsigned int)f;
3761 ashort = (unsigned short)f;
3762 if (along != (unsigned long)-123)
3763 result |= 1;
3764 if (aint != (unsigned int)-123)
3765 result |= 1;
3766 if (ashort != (unsigned short)-123)
3767 result |= 1;
3768 f = (double)0x40000000;
3769 f = f + f;
3770 along = 0;
3771 along = (unsigned long)f;
3772 if (along != 0x80000000)
3773 result |= 2;
3774 f -= 1.;
3775 along = 0;
3776 along = (unsigned long)f;
3777 if (along != 0x7fffffff)
3778 result |= 1;
3779 f += 2.;
3780 along = 0;
3781 along = (unsigned long)f;
3782 if (along != 0x80000001)
3783 result |= 2;
3784 exit(result);
3785
3786}
3787EOCP
3788if $cc -o try $ccflags try.c >/dev/null 2>&1; then
3789 ./try
3790 castflags=$?
3791else
ecfc5424 3792 echo "(I can't seem to compile the test program--assuming it can't)"
2304df62
AD
3793 castflags=3
3794fi
3795case "$castflags" in
37960) val="$define"
3797 echo "Yup, it can."
3798 ;;
3799*) val="$undef"
3800 echo "Nope, it can't."
3801 ;;
3802esac
3803set d_castneg
3804eval $setvar
3805$rm -f try.*
3806
2304df62
AD
3807: see if vprintf exists
3808echo " "
3809if set vprintf val -f d_vprintf; eval $csym; $val; then
3810 echo 'vprintf() found.' >&4
3811 val="$define"
3812 $cat >vprintf.c <<'EOF'
3813#include <varargs.h>
3814
3815main() { xxx("foo"); }
3816
3817xxx(va_alist)
3818va_dcl
3819{
3820 va_list args;
3821 char buf[10];
3822
3823 va_start(args);
3824 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
3825}
3826EOF
3827 if $cc $ccflags vprintf.c -o vprintf >/dev/null 2>&1 && ./vprintf; then
3828 echo "Your vsprintf() returns (int)." >&4
3829 val2="$undef"
3830 else
3831 echo "Your vsprintf() returns (char*)." >&4
3832 val2="$define"
3833 fi
3834else
3835 echo 'vprintf() NOT found.' >&4
3836 val="$undef"
3837 val2="$undef"
3838fi
3839set d_vprintf
3840eval $setvar
3841val=$val2
3842set d_charvspr
3843eval $setvar
3844
a0d0e21e
LW
3845: see if chown exists
3846set chown d_chown
3847eval $inlibc
3848
3849: see if chroot exists
3850set chroot d_chroot
3851eval $inlibc
3852
2304df62
AD
3853: see if chsize exists
3854set chsize d_chsize
3855eval $inlibc
3856
3857: check for const keyword
3858echo " "
3859echo 'Checking to see if your C compiler knows about "const"...' >&4
3860$cat >const.c <<'EOCP'
3861typedef struct spug { int drokk; } spug;
3862main()
3863{
3864 const char *foo;
3865 const spug y;
3866}
3867EOCP
3868if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
3869 val="$define"
3870 echo "Yup, it does."
3871else
3872 val="$undef"
3873 echo "Nope, it doesn't."
3874fi
3875set d_const
3876eval $setvar
3877
3878: see if crypt exists
3879echo " "
3880if set crypt val -f d_crypt; eval $csym; $val; then
3881 echo 'crypt() found.' >&4
3882 val="$define"
3883 cryptlib=''
3884else
3885 cryptlib=`./loc Slibcrypt.a "" $xlibpth`
3886 if $test -z "$cryptlib"; then
3887 cryptlib=`./loc Mlibcrypt.a "" $xlibpth`
3888 else
3889 cryptlib=-lcrypt
3890 fi
3891 if $test -z "$cryptlib"; then
3892 cryptlib=`./loc Llibcrypt.a "" $xlibpth`
3893 else
3894 cryptlib=-lcrypt
3895 fi
3896 if $test -z "$cryptlib"; then
3897 cryptlib=`./loc libcrypt.a "" $libpth`
3898 else
3899 cryptlib=-lcrypt
3900 fi
3901 if $test -z "$cryptlib"; then
3902 echo 'crypt() NOT found.' >&4
3903 val="$undef"
3904 else
3905 val="$define"
3906 fi
3907fi
3908set d_crypt
3909eval $setvar
3910
3911: get csh whereabouts
3912case "$csh" in
3913'csh') val="$undef" ;;
3914*) val="$define" ;;
3915esac
3916set d_csh
3917eval $setvar
3918
a0d0e21e
LW
3919: see if cuserid exists
3920set cuserid d_cuserid
2304df62
AD
3921eval $inlibc
3922
85e6fe83
LW
3923: define an alternate in-header-list? function
3924inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
3925cont=true; xxf="echo \"<\$1> found.\" >&4";
3926case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
3927*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
3928esac;
3929case $# in 4) instead=instead;; *) instead="at last";; esac;
3930while $test "$cont"; do
3931 xxx=`./findhdr $1`
3932 var=$2; eval "was=\$$2";
3933 if $test "$xxx" && $test -r "$xxx";
3934 then eval $xxf;
ecfc5424 3935 eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
85e6fe83
LW
3936 cont="";
3937 else eval $xxnf;
ecfc5424 3938 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
85e6fe83
LW
3939 set $yyy; shift; shift; yyy=$@;
3940 case $# in 0) cont="";;
3941 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
3942 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
3943 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
3944 xxnf="echo \"there is no <\$1>, ...\" >&4";;
3945 esac;
3946done;
3947while $test "$yyy";
3948do set $yyy; var=$2; eval "was=\$$2";
ecfc5424 3949 eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
85e6fe83
LW
3950 set $yyy; shift; shift; yyy=$@;
3951done'
3952
a0d0e21e
LW
3953: see if this is a limits.h system
3954set limits.h i_limits
85e6fe83
LW
3955eval $inhdr
3956
a0d0e21e
LW
3957: see if this is a float.h system
3958set float.h i_float
3959eval $inhdr
3960
3961: See if number of significant digits in a double precision number is known
3962echo " "
3963$cat >dbl_dig.c <<EOM
3964#$i_limits I_LIMITS
3965#$i_float I_FLOAT
3966#ifdef I_LIMITS
3967#include <limits.h>
85e6fe83 3968#endif
a0d0e21e
LW
3969#ifdef I_FLOAT
3970#include <float.h>
3971#endif
3972#ifdef DBL_DIG
3973printf("Contains DBL_DIG");
85e6fe83 3974#endif
85e6fe83 3975EOM
a0d0e21e
LW
3976$cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
3977if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
3978 echo "DBL_DIG found." >&4
3979 val="$define"
2304df62 3980else
a0d0e21e
LW
3981 echo "DBL_DIG NOT found." >&4
3982 val="$undef"
2304df62 3983fi
a0d0e21e
LW
3984$rm -f dbl_dig.?
3985set d_dbl_dig
2304df62 3986eval $setvar
2304df62 3987
a0d0e21e
LW
3988: see if difftime exists
3989set difftime d_difftime
2304df62
AD
3990eval $inlibc
3991
a0d0e21e
LW
3992: see if this is a dirent system
3993echo " "
3994if xinc=`./findhdr dirent.h`; $test "$xinc"; then
3995 val="$define"
3996 echo "<dirent.h> found." >&4
3997else
3998 val="$undef"
3999 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
4000 echo "<sys/dir.h> found." >&4
4001 echo " "
4002 else
4003 xinc=`./findhdr sys/ndir.h`
4004 fi
4005 echo "<dirent.h> NOT found." >&4
4006fi
4007set i_dirent
4008eval $setvar
4009
4010: Look for type of directory structure.
4011echo " "
4012$cppstdin $cppflags $cppminus < "$xinc" > try.c
4013
4014case "$direntrytype" in
4015''|' ')
4016 case "$i_dirent" in
4017 $define) guess1='struct dirent' ;;
4018 *) guess1='struct direct' ;;
4019 esac
4020 ;;
4021*) guess1="$direntrytype"
4022 ;;
4023esac
4024
4025case "$guess1" in
4026'struct dirent') guess2='struct direct' ;;
4027*) guess2='struct dirent' ;;
4028esac
4029
4030if $contains "$guess1" try.c >/dev/null 2>&1; then
4031 direntrytype="$guess1"
4032 echo "Your directory entries are $direntrytype." >&4
4033elif $contains "$guess2" try.c >/dev/null 2>&1; then
4034 direntrytype="$guess2"
4035 echo "Your directory entries seem to be $direntrytype." >&4
4036else
4037 echo "I don't recognize your system's directory entries." >&4
4038 rp="What type is used for directory entries on this system?"
4039 dflt="$guess1"
4040 . ./myread
4041 direntrytype="$ans"
4042fi
4043$rm -f try.c
4044
4045
4046: see if the directory entry stores field length
4047echo " "
ecfc5424
AD
4048$cppstdin $cppflags $cppminus < "$xinc" > try.c
4049if $contains 'd_namlen' try.c >/dev/null 2>&1; then
a0d0e21e
LW
4050 echo "Good, your directory entry keeps length information in d_namlen." >&4
4051 val="$define"
4052else
4053 echo "Your directory entry does not know about the d_namlen field." >&4
4054 val="$undef"
4055fi
4056set d_dirnamlen
4057eval $setvar
ecfc5424 4058$rm -f try.c
a0d0e21e
LW
4059
4060: see if dlerror exists
4061set dlerror d_dlerror
4062eval $inlibc
4063
4064: see if dld is available
4065set dld.h i_dld
4066eval $inhdr
4067
4068: see if dlopen exists
4069set dlopen d_dlopen
4070eval $inlibc
4071
4072: determine which dynamic loading, if any, to compile in
4073echo " "
4074dldir="ext/DynaLoader"
4075case "$usedl" in
4076$define|y|true)
4077 dflt='y'
4078 usedl="$define"
4079 ;;
4080$undef|n|false)
4081 dflt='n'
4082 usedl="$undef"
4083 ;;
4084*)
4085 dflt='n'
4086 case "$d_dlopen" in
ecfc5424
AD
4087 $define) dflt='y' ;;
4088 esac
a0d0e21e 4089 case "$i_dld" in
ecfc5424
AD
4090 $define) dflt='y' ;;
4091 esac
4092 : Does a dl_xxx.xs file exist for this operating system
4093 $test -f ../$dldir/dl_${osname}.xs && dflt='y'
4094 ;;
a0d0e21e
LW
4095esac
4096rp="Do you wish to use dynamic loading?"
4097. ./myread
4098usedl="$ans"
4099case "$ans" in
4100y*) usedl="$define"
4101 case "$dlsrc" in
4102 '')
4103 if $test -f ../$dldir/dl_${osname}.xs ; then
4104 dflt="$dldir/dl_${osname}.xs"
4105 elif $test "$d_dlopen" = "$define" ; then
4106 dflt="$dldir/dl_dlopen.xs"
4107 elif $test "$i_dld" = "$define" ; then
4108 dflt="$dldir/dl_dld.xs"
4109 else
4110 dflt=''
4111 fi
4112 ;;
4113 *) dflt="$dldir/$dlsrc"
4114 ;;
4115 esac
4116 echo "The following dynamic loading files are available:"
4117 : Can not go over to $dldir because getfile has path hard-coded in.
4118 cd ..; ls -C $dldir/dl*.xs; cd UU
4119 rp="Source file to use for dynamic loading"
4120 fn="fne~"
4121 . ./getfile
4122 usedl="$define"
4123 : emulate basename
4124 dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
4125 $cat << EOM
4126
4127Some systems may require passing special flags to $cc -c to
4128compile modules that will be used to create a shared library.
4129To use no flags, say "none".
4130
4131EOM
4132 case "$cccdlflags" in
ecfc5424
AD
4133 ''|' ') case "$cc" in
4134 *gcc*) dflt='-fpic' ;;
4135 *) case "$osname" in
4136 hpux) dflt='+z' ;;
4137 next) dflt='none' ;;
4138 solaris) dflt='-K pic' ;;
4139 sunos) dflt='-pic' ;;
4140 svr4*|esix*) dflt='-Kpic' ;;
4141 *) dflt='none' ;;
4142 esac ;;
4143 esac ;;
a0d0e21e
LW
4144 *) dflt="$cccdlflags" ;;
4145 esac
4146 rp="Any special flags to pass to $cc -c to compile shared library modules?"
4147 . ./myread
4148 case "$ans" in
4149 none) cccdlflags='' ;;
4150 *) cccdlflags="$ans" ;;
4151 esac
4152
4153 cat << 'EOM'
4154
ecfc5424
AD
4155Some systems may require passing special flags to ld to create a
4156library that can be dynamically loaded. If your ld flags include
4157-L/other/path options to locate libraries outside your loader's normal
4158search path, you may need to specify those -L options here as well. To
4159use no flags, say "none".
a0d0e21e
LW
4160
4161EOM
4162 case "$lddlflags" in
4163 ''|' ') case "$osname" in
4164 hpux) dflt='-b' ;;
4165 next) dflt='none' ;;
4166 solaris) dflt='-G' ;;
ecfc5424
AD
4167 sunos) dflt='-assert nodefinitions' ;;
4168 svr4*|esix*) dflt="-G $ldflags" ;;
a0d0e21e
LW
4169 *) dflt='none' ;;
4170 esac
4171 ;;
4172 *) dflt="$lddlflags" ;;
4173 esac
ecfc5424 4174 rp="Any special flags to pass to ld to create a dynamically loaded library?"
a0d0e21e
LW
4175 . ./myread
4176 case "$ans" in
4177 none) lddlflags='' ;;
4178 *) lddlflags="$ans" ;;
4179 esac
4180
4181 cat <<EOM
4182
4183Some systems may require passing special flags to $cc to indicate that
4184the resulting executable will use dynamic linking. To use no flags,
4185say "none".
4186
4187EOM
4188 case "$ccdlflags" in
ecfc5424
AD
4189 ''|' ') case "$osname" in
4190 hpux) dflt='none' ;;
4191 next) dflt='none' ;;
4192 sunos) dflt='none' ;;
4193 *) dflt='none' ;;
4194 esac ;;
4195 *) dflt="$ccdlflags" ;;
a0d0e21e
LW
4196 esac
4197 rp="Any special flags to pass to $cc to use dynamic loading?"
4198 . ./myread
4199 case "$ans" in
4200 none) ccdlflags='' ;;
4201 *) ccdlflags="$ans" ;;
4202 esac
4203 ;;
4204*) usedl="$undef"
4205 dlsrc='dl_none.xs'
4206 lddlflags=''
4207 ccdlflags=''
4208 ;;
4209esac
4210
ecfc5424
AD
4211val="$undef"
4212case "$osname" in
4213esix*|svr4*)
4214 case "$usedl" in
4215 $define)
4216 $cat <<EOM
4217
4218System V Release 4 systems can support dynamic loading
4219only if libperl is created as a shared library.
4220
4221EOM
4222 val="$define"
4223 ;;
4224 esac ;;
4225esac
4226set d_shrplib; eval $setvar
4227case "$d_shrplib" in
4228$define)
4229 cat <<EOM >&4
4230
4231Be sure to add the perl source directory to the LD_LIBRARY_PATH
4232environment variable before running make:
4233 LD_LIBRARY_PATH=`cd ..;pwd`; export LD_LIBRARY_PATH
4234or
4235 setenv LD_LIBRARY_PATH `cd ..;pwd`
4236
4237EOM
4238;;
4239esac
4240case "$d_shrplib" in
4241$define)
4242 case "$shrpdir" in
4243 "") dflt="$archlib/CORE";;
4244 *) dflt="$shrpdir";;
4245 esac
4246 rp="What directory should we install the shared libperl into?"
4247 fn="d~"
4248 . ./getfile
4249 shrpdir="$ans"
4250 ;;
4251*) shrpdir='none'
4252 ;;
4253esac
4254
a0d0e21e
LW
4255: see if dlfcn is available
4256set dlfcn.h i_dlfcn
4257eval $inhdr
4258
4259case "$usedl" in
4260$define|y|true)
4261 $cat << EOM
4262
4263On a few systems, the dynamically loaded modules that perl generates and uses
4264will need a different extension then shared libs. The default will probably
4265be appropriate.
4266
4267EOM
4268 case "$dlext" in
4269 '') dflt="$so" ;;
4270 *) dflt="$dlext" ;;
4271 esac
4272 rp='What is the extension of dynamically loaded modules'
4273 . ./myread
4274 dlext="$ans"
4275 ;;
4276*)
4277 dlext="none"
4278 ;;
4279esac
4280
4281: Check if dlsym need a leading underscore
4282echo " "
4283val="$undef"
4284
4285case "$dlsrc" in
4286dl_dlopen.xs)
4287 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
4288 $cat >dyna.c <<'EOM'
4289fred () { }
4290EOM
4291
4292$cat >fred.c<<EOM
4293
4294#include <stdio.h>
4295#$i_dlfcn I_DLFCN
4296#ifdef I_DLFCN
4297#include <dlfcn.h> /* the dynamic linker include file for Sunos/Solaris */
4298#else
4299#include <sys/types.h>
4300#include <nlist.h>
4301#include <link.h>
4302#endif
4303
4304extern int fred() ;
4305
4306main()
4307{
4308 void * handle ;
4309 void * symbol ;
4310#ifndef RTLD_LAZY
4311 int mode = 1 ;
4312#else
4313 int mode = RTLD_LAZY ;
4314#endif
4315 handle = dlopen("./dyna.$dlext", mode) ;
4316 if (handle == NULL) {
4317 printf ("1\n") ;
4318 exit(0);
4319 }
4320 symbol = dlsym(handle, "fred") ;
4321 if (symbol == NULL) {
4322 /* try putting a leading underscore */
4323 symbol = dlsym(handle, "_fred") ;
4324 if (symbol == NULL) {
4325 printf ("2\n") ;
4326 exit(0);
4327 }
4328 printf ("3\n") ;
4329 }
4330 else
4331 printf ("4\n") ;
4332 exit(0);
4333}
4334EOM
4335 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
4336 ld $lddlflags -o dyna.$dlext dyna.o > /dev/null 2>&1 &&
4337 $cc $ccflags $ldflags $cccdlflags $ccdlflags fred.c -o fred $libs > /dev/null 2>&1; then
4338 xxx=`./fred`
4339 case $xxx in
4340 1) echo "Test program failed using dlopen." >&4
4341 echo "Perhaps you should not use dynamic loading." >&4;;
4342 2) echo "Test program failed using dlsym." >&4
4343 echo "Perhaps you should not use dynamic loading." >&4;;
4344 3) echo "dlsym needs a leading underscore" >&4
4345 val="$define" ;;
4346 4) echo "dlsym doesn't need a leading underscore." >&4;;
4347 esac
4348 else
4349 echo "I can't compile and run the test program." >&4
4350 fi
4351 ;;
4352esac
4353
4354$rm -f fred fred.? dyna.$dlext dyna.?
4355
4356set d_dlsymun
4357eval $setvar
4358
4359: see if setuid scripts can be secure
ecfc5424 4360$cat <<EOM
a0d0e21e
LW
4361
4362Some kernels have a bug that prevents setuid #! scripts from being
4363secure. Some sites have disabled setuid #! scripts because of this.
4364
4365First let's decide if your kernel supports secure setuid #! scripts.
4366(If setuid #! scripts would be secure but have been disabled anyway,
4367don't say that they are secure if asked.)
4368
4369EOM
4370
4371val="$undef"
4372if $test -d /dev/fd; then
4373 echo "#!$ls" >reflect
4374 chmod +x,u+s reflect
4375 ./reflect >flect 2>&1
4376 if $contains "/dev/fd" flect >/dev/null; then
ecfc5424
AD
4377 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4378 val="$define"
a0d0e21e
LW
4379 else
4380 $cat <<EOM
4381If you are not sure if they are secure, I can check but I'll need a
4382username and password different from the one you are using right now.
4383If you don't have such a username or don't want me to test, simply
4384enter 'none'.
4385
4386EOM
4387 rp='Other username to test security of setuid scripts with?'
4388 dflt='none'
4389 . ./myread
4390 case "$ans" in
4391 n|none)
4392 case "$d_suidsafe" in
4393 '') echo "I'll assume setuid scripts are *not* secure." >&4
4394 dflt=n;;
4395 "$undef")
4396 echo "Well, the $hint value is *not* secure." >&4
4397 dflt=n;;
ecfc5424 4398 *) echo "Well, the $hint value *is* secure." >&4
a0d0e21e
LW
4399 dflt=y;;
4400 esac
4401 ;;
ecfc5424
AD
4402 *)
4403 $rm -f reflect flect
4404 echo "#!$ls" >reflect
4405 chmod +x,u+s reflect
4406 echo >flect
4407 chmod a+w flect
4408 echo '"su" will (probably) prompt you for '"$ans's password."
4409 su $ans -c './reflect >flect'
4410 if $contains "/dev/fd" flect >/dev/null; then
a0d0e21e
LW
4411 echo "Okay, it looks like setuid scripts are secure." >&4
4412 dflt=y
ecfc5424 4413 else
a0d0e21e
LW
4414 echo "I don't think setuid scripts are secure." >&4
4415 dflt=n
ecfc5424 4416 fi
a0d0e21e
LW
4417 ;;
4418 esac
4419 rp='Does your kernel have *secure* setuid scripts?'
4420 . ./myread
4421 case "$ans" in
4422 [yY]*) val="$define";;
4423 *) val="$undef";;
4424 esac
4425 fi
4426else
4427 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4428 val="$undef"
4429fi
4430set d_suidsafe
4431eval $setvar
4432
4433$rm -f reflect flect
4434
4435: now see if they want to do setuid emulation
ecfc5424
AD
4436echo " "
4437val="$undef"
4438case "$d_suidsafe" in
4439"$define")
4440 val="$undef"
4441 echo "No need to emulate SUID scripts since they are secure here." >& 4
4442 ;;
4443*)
4444 $cat <<EOM
a0d0e21e
LW
4445Some systems have disabled setuid scripts, especially systems where
4446setuid scripts cannot be secure. On systems where setuid scripts have
4447been disabled, the setuid/setgid bits on scripts are currently
4448useless. It is possible for $package to detect those bits and emulate
4449setuid/setgid in a secure fashion. This emulation will only work if
4450setuid scripts have been disabled in your kernel.
4451
4452EOM
a0d0e21e
LW
4453 case "$d_dosuid" in
4454 "$define") dflt=y ;;
4455 *) dflt=n ;;
4456 esac
4457 rp="Do you want to do setuid/setgid emulation?"
4458 . ./myread
4459 case "$ans" in
4460 [yY]*) val="$define";;
4461 *) val="$undef";;
4462 esac
4463 ;;
4464esac
4465set d_dosuid
4466eval $setvar
4467
4468: see if drem exists
4469set drem d_drem
4470eval $inlibc
4471
4472: see if dup2 exists
4473set dup2 d_dup2
4474eval $inlibc
4475
4476: see if fchmod exists
4477set fchmod d_fchmod
4478eval $inlibc
4479
4480: see if fchown exists
4481set fchown d_fchown
4482eval $inlibc
4483
4484: see if this is an fcntl system
4485set fcntl d_fcntl
4486eval $inlibc
4487
4488: see if fgetpos exists
4489set fgetpos d_fgetpos
4490eval $inlibc
4491
4492: see if we can have long filenames
4493echo " "
4494rmlist="$rmlist /tmp/cf$$"
4495$test -d /tmp/cf$$ || mkdir /tmp/cf$$
4496first=123456789abcdef
4497second=/tmp/cf$$/$first
4498$rm -f $first $second
4499if (echo hi >$first) 2>/dev/null; then
4500 if $test -f 123456789abcde; then
4501 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
4502 val="$undef"
4503 else
4504 if (echo hi >$second) 2>/dev/null; then
4505 if $test -f /tmp/cf$$/123456789abcde; then
4506 $cat <<'EOM'
4507That's peculiar... You can have filenames longer than 14 characters, but only
4508on some of the filesystems. Maybe you are using NFS. Anyway, to avoid problems
4509I shall consider your system cannot support long filenames at all.
4510EOM
4511 val="$undef"
4512 else
4513 echo 'You can have filenames longer than 14 characters.' >&4
4514 val="$define"
4515 fi
4516 else
4517 $cat <<'EOM'
4518How confusing! Some of your filesystems are sane enough to allow filenames
4519longer than 14 characters but some others like /tmp can't even think about them.
4520So, for now on, I shall assume your kernel does not allow them at all.
4521EOM
4522 val="$undef"
4523 fi
4524 fi
4525else
4526 $cat <<'EOM'
4527You can't have filenames longer than 14 chars. You can't even think about them!
4528EOM
4529 val="$undef"
4530fi
4531set d_flexfnam
4532eval $setvar
4533$rm -rf /tmp/cf$$ 123456789abcde*
4534
4535: see if flock exists
4536set flock d_flock
4537eval $inlibc
4538
4539: see if fmod exists
4540set fmod d_fmod
4541eval $inlibc
4542
4543: see if fork exists
4544set fork d_fork
4545eval $inlibc
4546
4547: see if pathconf exists
4548set pathconf d_pathconf
4549eval $inlibc
4550
4551: see if fpathconf exists
4552set fpathconf d_fpathconf
4553eval $inlibc
4554
4555: see if fsetpos exists
4556set fsetpos d_fsetpos
4557eval $inlibc
4558
4559: see if gethostent exists
4560set gethostent d_gethent
4561eval $inlibc
4562
4563: see if getlogin exists
4564set getlogin d_getlogin
4565eval $inlibc
4566
4567: see if getpgrp exists
4568set getpgrp d_getpgrp
4569eval $inlibc
4570
4571: see if getpgrp2 exists
4572set getpgrp2 d_getpgrp2
4573eval $inlibc
4574
4575: see if getppid exists
4576set getppid d_getppid
4577eval $inlibc
4578
4579: see if getpriority exists
4580set getpriority d_getprior
4581eval $inlibc
4582
4583: see if group exists
4584set group d_group
4585eval $inlibc
4586
4587: see if this is a netinet/in.h or sys/in.h system
4588set netinet/in.h i_niin sys/in.h i_sysin
4589eval $inhdr
4590
4591: see if htonl --and friends-- exists
4592val=''
4593set htonl val
4594eval $inlibc
4595
4596: Maybe they are macros.
4597case "$val" in
4598$undef)
4599 $cat >htonl.c <<EOM
4600#include <stdio.h>
4601#include <sys/types.h>
4602#$i_niin I_NETINET_IN
4603#$i_sysin I_SYS_IN
4604#ifdef I_NETINET_IN
4605#include <netinet/in.h>
4606#endif
4607#ifdef I_SYS_IN
4608#include <sys/in.h>
4609#endif
4610#ifdef htonl
4611printf("Defined as a macro.");
4612#endif
4613EOM
4614 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
4615 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
4616 val="$define"
4617 echo "But it seems to be defined as a macro." >&4
4618 fi
4619 $rm -f htonl.?
4620 ;;
4621esac
4622set d_htonl
4623eval $setvar
4624
4625: see which of string.h or strings.h is needed
4626echo " "
4627strings=`./findhdr string.h`
4628if $test "$strings" && $test -r "$strings"; then
4629 echo "Using <string.h> instead of <strings.h>." >&4
4630 val="$define"
4631else
4632 val="$undef"
4633 strings=`./findhdr strings.h`
4634 if $test "$strings" && $test -r "$strings"; then
4635 echo "Using <strings.h> instead of <string.h>." >&4
4636 else
4637 echo "No string header found -- You'll surely have problems." >&4
4638 fi
4639fi
4640set i_string
4641eval $setvar
4642case "$i_string" in
4643"$undef") strings=`./findhdr strings.h`;;
4644*) strings=`./findhdr string.h`;;
4645esac
4646
4647: index or strchr
4648echo " "
4649if set index val -f; eval $csym; $val; then
4650 if set strchr val -f d_strchr; eval $csym; $val; then
4651 if $contains strchr "$strings" >/dev/null 2>&1 ; then
4652 val="$define"
4653 vali="$undef"
4654 echo "strchr() found." >&4
4655 else
4656 val="$undef"
4657 vali="$define"
4658 echo "index() found." >&4
4659 fi
4660 else
4661 val="$undef"
4662 vali="$define"
4663 echo "index() found." >&4
4664 fi
4665else
4666 if set strchr val -f d_strchr; eval $csym; $val; then
4667 val="$define"
4668 vali="$undef"
4669 echo "strchr() found." >&4
4670 else
4671 echo "No index() or strchr() found!" >&4
4672 val="$undef"
4673 vali="$undef"
4674 fi
4675fi
4676set d_strchr; eval $setvar
4677val="$vali"
4678set d_index; eval $setvar
4679
4680: Look for isascii
4681echo " "
4682$cat >isascii.c <<'EOCP'
4683#include <stdio.h>
4684#include <ctype.h>
4685main() {
4686 int c = 'A';
4687 if (isascii(c))
4688 exit(0);
4689 else
4690 exit(1);
4691}
4692EOCP
4693if $cc $ccflags $ldflags -o isascii isascii.c $libs >/dev/null 2>&1 ; then
4694 echo "isascii() found." >&4
4695 val="$define"
4696else
4697 echo "isascii() NOT found." >&4
4698 val="$undef"
4699fi
4700set d_isascii
4701eval $setvar
4702$rm -f isascii*
4703
4704: see if killpg exists
4705set killpg d_killpg
4706eval $inlibc
4707
4708: see if link exists
4709set link d_link
4710eval $inlibc
4711
4712: see if stdio is really std
4713echo " "
4714xxx=`./findhdr stdio.h`
4715if $contains 'char.*_ptr;' "$xxx" >/dev/null 2>&1 ; then
4716 if $contains '_cnt;' "$xxx" >/dev/null 2>&1 ; then
4717 echo "Your stdio is pretty std." >&4
4718 val="$define"
4719 else
4720 echo "Your stdio isn't very std." >&4
4721 val="$undef"
4722 fi
4723else
4724 echo "Your stdio isn't very std." >&4
4725 val="$undef"
4726fi
4727set d_stdstdio
4728eval $setvar
4729
4730: see if stdio is like that in linux
4731case "$d_stdstdio" in
4732"$undef")
4733 echo " "
4734 xxx=`./findhdr stdio.h`
4735 $cppstdin $cppflags $cppminus < "$xxx" > stdio.E
4736 if $contains 'char.*_IO_read_base' stdio.E >/dev/null 2>&1 && \
4737 $contains '_IO_read_ptr' stdio.E >/dev/null 2>&1 && \
4738 $contains '_IO_read_end' stdio.E >/dev/null 2>&1 ; then
4739 echo "Your stdio looks like linux." >&4
4740 val="$define"
4741 else
4742 echo "You don't have linux stdio, either." >&4
4743 val="$undef"
4744 fi
4745 $rm -f stdio.E
4746 ;;
4747*) val="$undef" ;;
4748esac
4749
4750set d_linuxstd
4751eval $setvar
4752
4753: see if localeconv exists
4754set localeconv d_locconv
4755eval $inlibc
4756
4757: see if lockf exists
4758set lockf d_lockf
4759eval $inlibc
4760
4761: see if lstat exists
4762set lstat d_lstat
4763eval $inlibc
4764
4765: see if mblen exists
4766set mblen d_mblen
4767eval $inlibc
4768
4769: see if mbstowcs exists
4770set mbstowcs d_mbstowcs
4771eval $inlibc
4772
4773: see if mbtowc exists
4774set mbtowc d_mbtowc
4775eval $inlibc
4776
4777: see if memcmp exists
4778set memcmp d_memcmp
4779eval $inlibc
4780
4781: see if memcpy exists
4782set memcpy d_memcpy
4783eval $inlibc
4784
4785: see if memmove exists
4786set memmove d_memmove
2304df62
AD
4787eval $inlibc
4788
4789: see if memset exists
4790set memset d_memset
4791eval $inlibc
4792
4793: see if mkdir exists
4794set mkdir d_mkdir
4795eval $inlibc
4796
a0d0e21e
LW
4797: see if mkfifo exists
4798set mkfifo d_mkfifo
4799eval $inlibc
4800
4801: see if mktime exists
4802set mktime d_mktime
4803eval $inlibc
4804
2304df62
AD
4805: see if msgctl exists
4806set msgctl d_msgctl
4807eval $inlibc
4808
4809: see if msgget exists
4810set msgget d_msgget
4811eval $inlibc
4812
4813: see if msgsnd exists
4814set msgsnd d_msgsnd
4815eval $inlibc
4816
4817: see if msgrcv exists
4818set msgrcv d_msgrcv
4819eval $inlibc
4820
4821: see how much of the 'msg*(2)' library is present.
4822h_msg=true
4823echo " "
4824case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
4825*"$undef"*) h_msg=false;;
4826esac
4827: we could also check for sys/ipc.h ...
4828if $h_msg && $test `./findhdr sys/msg.h`; then
4829 echo "You have the full msg*(2) library." >&4
4830 val="$define"
4831else
4832 echo "You don't have the full msg*(2) library." >&4
4833 val="$undef"
4834fi
4835set d_msg
4836eval $setvar
4837
a0d0e21e
LW
4838: see if this is a malloc.h system
4839set malloc.h i_malloc
4840eval $inhdr
4841
85e6fe83 4842: determine which malloc to compile in
85e6fe83
LW
4843echo " "
4844case "$usemymalloc" in
a0d0e21e
LW
4845''|y*|true) dflt='y' ;;
4846n*|false) dflt='n' ;;
4847*) dflt="$usemymalloc" ;;
85e6fe83
LW
4848esac
4849rp="Do you wish to attempt to use the malloc that comes with $package?"
4850. ./myread
4851usemymalloc="$ans"
4852case "$ans" in
a0d0e21e
LW
4853y*|true)
4854 usemymalloc='y'
4855 mallocsrc='malloc.c'
4856 mallocobj='malloc.o'
4857 d_mymalloc="$define"
4858 case "$libs" in
4859 *-lmalloc*)
4860 : Remove malloc from list of libraries to use
4861 echo "Removing unneeded -lmalloc from library list" >&4
4862 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4863 shift
4864 libs="$*"
4865 echo "libs = $libs" >&4
4866 ;;
4867 esac
4868 ;;
4869*)
4870 usemymalloc='n'
4871 mallocsrc=''
4872 mallocobj=''
4873 d_mymalloc="$undef"
4874 ;;
85e6fe83
LW
4875esac
4876
4877: compute the type returned by malloc
4878echo " "
4879case "$malloctype" in
4880'')
a0d0e21e
LW
4881 $cat >malloc.c <<END
4882#$i_malloc I_MALLOC
4883#include <stdio.h>
4884#include <sys/types.h>
4885#ifdef I_MALLOC
85e6fe83 4886#include <malloc.h>
a0d0e21e 4887#endif
85e6fe83
LW
4888void *malloc();
4889END
4890 if $cc $ccflags -c malloc.c >/dev/null 2>&1; then
4891 malloctype='void *'
4892 else
4893 malloctype='char *'
4894 fi
4895 $rm -f malloc.[co]
4896 ;;
4897esac
4898echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4899
a0d0e21e
LW
4900: see if nice exists
4901set nice d_nice
2304df62
AD
4902eval $inlibc
4903
4904: Locate the flags for 'open()'
4905echo " "
4906$cat >open3.c <<'EOCP'
4907#include <sys/types.h>
4908#ifdef I_FCNTL
4909#include <fcntl.h>
4910#endif
4911#ifdef I_SYS_FILE
4912#include <sys/file.h>
4913#endif
4914main() {
4915 if(O_RDONLY);
4916#ifdef O_TRUNC
4917 exit(0);
4918#else
4919 exit(1);
4920#endif
4921}
4922EOCP
4923: check sys/file.h first to get FREAD on Sun
4924if $test `./findhdr sys/file.h` && \
4925 $cc $cppflags "-DI_SYS_FILE" open3.c -o open3 >/dev/null 2>&1 ; then
4926 h_sysfile=true;
4927 echo "<sys/file.h> defines the O_* constants..." >&4
4928 if ./open3; then
4929 echo "and you have the 3 argument form of open()." >&4
4930 val="$define"
4931 else
4932 echo "but not the 3 argument form of open(). Oh, well." >&4
4933 val="$undef"
4934 fi
4935elif $test `./findhdr fcntl.h` && \
4936 $cc "-DI_FCNTL" open3.c -o open3 >/dev/null 2>&1 ; then
4937 h_fcntl=true;
4938 echo "<fcntl.h> defines the O_* constants..." >&4
4939 if ./open3; then
4940 echo "and you have the 3 argument form of open()." >&4
4941 val="$define"
4942 else
4943 echo "but not the 3 argument form of open(). Oh, well." >&4
4944 val="$undef"
4945 fi
4946else
4947 val="$undef"
4948 echo "I can't find the O_* constant definitions! You got problems." >&4
4949fi
4950set d_open3
4951eval $setvar
4952$rm -f open3*
4953
a0d0e21e
LW
4954: see if passwd exists
4955set passwd d_passwd
4956eval $inlibc
4957
4958: see if pause exists
4959set pause d_pause
4960eval $inlibc
4961
4962: see if pipe exists
4963set pipe d_pipe
4964eval $inlibc
4965
2304df62
AD
4966: see if this is a pwd system
4967echo " "
4968xxx=`./findhdr pwd.h`
4969if $test "$xxx"; then
4970 i_pwd="$define"
4971 echo "<pwd.h> found." >&4
85e6fe83 4972 $cppstdin $cppflags $cppminus < $xxx >$$.h
2304df62
AD
4973 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
4974 d_pwquota="$define"
4975 else
4976 d_pwquota="$undef"
4977 fi
4978 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
4979 d_pwage="$define"
4980 else
4981 d_pwage="$undef"
4982 fi
4983 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
4984 d_pwchange="$define"
4985 else
4986 d_pwchange="$undef"
4987 fi
4988 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
4989 d_pwclass="$define"
4990 else
4991 d_pwclass="$undef"
4992 fi
4993 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
4994 d_pwexpire="$define"
4995 else
4996 d_pwexpire="$undef"
4997 fi
4998 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
4999 d_pwcomment="$define"
5000 else
5001 d_pwcomment="$undef"
5002 fi
5003 $rm -f $$.h
5004else
5005 i_pwd="$undef"
5006 d_pwquota="$undef"
5007 d_pwage="$undef"
5008 d_pwchange="$undef"
5009 d_pwclass="$undef"
5010 d_pwexpire="$undef"
5011 d_pwcomment="$undef"
5012 echo "<pwd.h> NOT found." >&4
5013fi
5014
85e6fe83 5015: see if readdir and friends exist
2304df62
AD
5016set readdir d_readdir
5017eval $inlibc
85e6fe83
LW
5018set seekdir d_seekdir
5019eval $inlibc
5020set telldir d_telldir
5021eval $inlibc
5022set rewinddir d_rewinddir
5023eval $inlibc
2304df62 5024
a0d0e21e
LW
5025: see if readlink exists
5026set readlink d_readlink
5027eval $inlibc
5028
2304df62
AD
5029: see if rename exists
5030set rename d_rename
5031eval $inlibc
5032
5033: see if rmdir exists
5034set rmdir d_rmdir
5035eval $inlibc
5036
5037: can bcopy handle overlapping blocks?
5038val="$undef"
5039case "$d_bcopy" in
5040"$define")
5041 echo " "
5042 echo "Checking to see if your bcopy() can do overlapping copies..." >&4
5043 $cat >foo.c <<'EOCP'
5044main()
5045{
85e6fe83
LW
5046char buf[128], abc[128];
5047char *b;
5048int len;
5049int off;
5050int align;
a0d0e21e 5051
85e6fe83 5052bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
2304df62
AD
5053
5054for (align = 7; align >= 0; align--) {
5055 for (len = 36; len; len--) {
5056 b = buf+align;
85e6fe83 5057 bcopy(abc, b, len);
2304df62
AD
5058 for (off = 1; off <= len; off++) {
5059 bcopy(b, b+off, len);
5060 bcopy(b+off, b, len);
85e6fe83 5061 if (bcmp(b, abc, len))
2304df62
AD
5062 exit(1);
5063 }
5064 }
5065}
5066exit(0);
5067}
5068EOCP
a0d0e21e 5069 if $cc foo.c -o safebcpy $ccflags $ldflags $libs >/dev/null 2>&1 ; then
2304df62
AD
5070 if ./safebcpy 2>/dev/null; then
5071 echo "Yes, it can."
5072 val="$define"
5073 else
5074 echo "It can't, sorry."
5075 fi
5076 else
5077 echo "(I can't compile the test program, so we'll assume not...)"
5078 fi
5079 ;;
5080esac
5081$rm -f foo.* safebcpy core
5082set d_safebcpy
5083eval $setvar
5084
5085: can memcpy handle overlapping blocks?
5086val="$undef"
5087case "$d_memcpy" in
5088"$define")
5089 echo " "
5090 echo "Checking to see if your memcpy() can do overlapping copies..." >&4
5091 $cat >foo.c <<'EOCP'
5092main()
5093{
85e6fe83
LW
5094char buf[128], abc[128];
5095char *b;
5096int len;
5097int off;
5098int align;
5099
5100memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
2304df62
AD
5101
5102for (align = 7; align >= 0; align--) {
5103 for (len = 36; len; len--) {
5104 b = buf+align;
85e6fe83 5105 memcpy(abc, b, len);
2304df62
AD
5106 for (off = 1; off <= len; off++) {
5107 memcpy(b, b+off, len);
5108 memcpy(b+off, b, len);
85e6fe83 5109 if (memcmp(b, abc, len))
2304df62
AD
5110 exit(1);
5111 }
5112 }
5113}
5114exit(0);
5115}
5116EOCP
a0d0e21e 5117 if $cc foo.c -o safemcpy $ccflags $ldflags $libs >/dev/null 2>&1 ; then
2304df62
AD
5118 if ./safemcpy 2>/dev/null; then
5119 echo "Yes, it can."
5120 val="$define"
5121 else
5122 echo "It can't, sorry."
5123 fi
5124 else
5125 echo "(I can't compile the test program, so we'll assume not...)"
5126 fi
5127 ;;
5128esac
5129$rm -f foo.* safemcpy core
5130set d_safemcpy
5131eval $setvar
5132
5133: see if select exists
5134set select d_select
5135eval $inlibc
5136
5137: see if semctl exists
5138set semctl d_semctl
5139eval $inlibc
5140
5141: see if semget exists
5142set semget d_semget
5143eval $inlibc
5144
5145: see if semop exists
5146set semop d_semop
5147eval $inlibc
5148
5149: see how much of the 'sem*(2)' library is present.
5150h_sem=true
5151echo " "
5152case "$d_semctl$d_semget$d_semop" in
5153*"$undef"*) h_sem=false;;
5154esac
5155: we could also check for sys/ipc.h ...
5156if $h_sem && $test `./findhdr sys/sem.h`; then
5157 echo "You have the full sem*(2) library." >&4
5158 val="$define"
5159else
5160 echo "You don't have the full sem*(2) library." >&4
5161 val="$undef"
5162fi
5163set d_sem
5164eval $setvar
5165
5166: see if setegid exists
5167set setegid d_setegid
5168eval $inlibc
5169
5170: see if seteuid exists
5171set seteuid d_seteuid
5172eval $inlibc
5173
a0d0e21e
LW
5174: see if setlinebuf exists
5175set setlinebuf d_setlinebuf
5176eval $inlibc
5177
2304df62
AD
5178: see if setlocale exists
5179set setlocale d_setlocale
5180eval $inlibc
a0d0e21e 5181
2304df62
AD
5182: see if setpgid exists
5183set setpgid d_setpgid
5184eval $inlibc
5185
2304df62
AD
5186: see if setpgrp2 exists
5187set setpgrp2 d_setpgrp2
5188eval $inlibc
5189
5190: see if setpriority exists
5191set setpriority d_setprior
5192eval $inlibc
5193
5194: see if setregid exists
5195set setregid d_setregid
5196eval $inlibc
5197set setresgid d_setresgid
5198eval $inlibc
5199
5200: see if setreuid exists
5201set setreuid d_setreuid
5202eval $inlibc
5203set setresuid d_setresuid
5204eval $inlibc
5205
5206: see if setrgid exists
5207set setrgid d_setrgid
5208eval $inlibc
5209
5210: see if setruid exists
5211set setruid d_setruid
5212eval $inlibc
5213
5214: see if setsid exists
5215set setsid d_setsid
5216eval $inlibc
5217
5218: see if shmctl exists
5219set shmctl d_shmctl
5220eval $inlibc
5221
5222: see if shmget exists
5223set shmget d_shmget
5224eval $inlibc
5225
a0d0e21e
LW
5226: see if shmat exists
5227set shmat d_shmat
5228eval $inlibc
5229: see what shmat returns
5230case "$d_shmat" in
5231"$define")
5232 $cat >shmat.c <<'END'
5233#include <sys/shm.h>
5234void *shmat();
5235END
5236 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
5237 shmattype='void *'
5238 else
5239 shmattype='char *'
5240 fi
5241 echo "and it returns ($shmattype)." >&4
5242 : see if a prototype for shmat is available
5243 $cppstdin $cppflags $cppminus < $usrinc/sys/shm.h > shmat.c 2>/dev/null
5244 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
5245 val="$define"
5246 else
5247 val="$undef"
5248 fi
5249 $rm -f shmat.[co]
5250 ;;
5251*)
5252 val="$undef"
5253 ;;
5254esac
5255set d_shmatprototype
5256eval $setvar
5257
5258: see if shmdt exists
5259set shmdt d_shmdt
5260eval $inlibc
5261
5262: see how much of the 'shm*(2)' library is present.
5263h_shm=true
5264echo " "
5265case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
5266*"$undef"*) h_shm=false;;
5267esac
5268: we could also check for sys/ipc.h ...
5269if $h_shm && $test `./findhdr sys/shm.h`; then
5270 echo "You have the full shm*(2) library." >&4
5271 val="$define"
5272else
5273 echo "You don't have the full shm*(2) library." >&4
5274 val="$undef"
5275fi
5276set d_shm
5277eval $setvar
5278
5279socketlib=''
5280sockethdr=''
5281: see whether socket exists
5282echo " "
5283$echo $n "Hmm... $c" >&4
5284if set socket val -f d_socket; eval $csym; $val; then
5285 echo "Looks like you have Berkeley networking support." >&4
5286 d_socket="$define"
5287 if set setsockopt val -f; eval $csym; $val; then
5288 d_oldsock="$undef"
5289 else
5290 echo "...but it uses the old 4.1c interface, rather than 4.2" >&4
5291 d_oldsock="$define"
5292 fi
5293else
5294 if $contains socklib libc.list >/dev/null 2>&1; then
5295 echo "Looks like you have Berkeley networking support." >&4
5296 d_socket="$define"
5297 : we will have to assume that it supports the 4.2 BSD interface
5298 d_oldsock="$undef"
5299 else
5300 echo "You don't have Berkeley networking in libc.a..." >&4
5301 if test -f /usr/lib/libnet.a; then
5302 ( (nm $nm_opt /usr/lib/libnet.a | eval $nm_extract) || \
5303 ar t /usr/lib/libnet.a) 2>/dev/null >> libc.list
5304 if $contains socket libc.list >/dev/null 2>&1; then
5305 echo "...but the Wollongong group seems to have hacked it in." >&4
5306 socketlib="-lnet"
5307 sockethdr="-I/usr/netinclude"
5308 d_socket="$define"
5309 if $contains setsockopt libc.list >/dev/null 2>&1; then
5310 d_oldsock="$undef"
5311 else
5312 echo "...using the old 4.1c interface, rather than 4.2" >&4
5313 d_oldsock="$define"
5314 fi
5315 else
5316 echo "or even in libnet.a, which is peculiar." >&4
5317 d_socket="$undef"
5318 d_oldsock="$undef"
5319 fi
5320 else
5321 echo "or anywhere else I see." >&4
5322 d_socket="$undef"
5323 d_oldsock="$undef"
5324 fi
5325 fi
5326fi
5327
5328: see if socketpair exists
5329set socketpair d_sockpair
2304df62
AD
5330eval $inlibc
5331
2304df62
AD
5332: see if stat knows about block sizes
5333echo " "
5334xxx=`./findhdr sys/stat.h`
5335if $contains 'st_blocks;' "$xxx" >/dev/null 2>&1 ; then
5336 if $contains 'st_blksize;' "$xxx" >/dev/null 2>&1 ; then
5337 echo "Your stat() knows about block sizes." >&4
5338 val="$define"
5339 else
5340 echo "Your stat() doesn't know about block sizes." >&4
5341 val="$undef"
5342 fi
5343else
5344 echo "Your stat() doesn't know about block sizes." >&4
5345 val="$undef"
5346fi
5347set d_statblks
5348eval $setvar
5349
a0d0e21e
LW
5350: see if strcoll exists
5351set strcoll d_strcoll
5352eval $inlibc
2304df62
AD
5353
5354: check for structure copying
5355echo " "
5356echo "Checking to see if your C compiler can copy structs..." >&4
5357$cat >try.c <<'EOCP'
5358main()
5359{
5360 struct blurfl {
5361 int dyick;
5362 } foo, bar;
5363
5364 foo = bar;
5365}
5366EOCP
5367if $cc -c try.c >/dev/null 2>&1 ; then
5368 val="$define"
5369 echo "Yup, it can."
5370else
5371 val="$undef"
5372 echo "Nope, it can't."
5373fi
5374set d_strctcpy
5375eval $setvar
5376$rm -f try.*
5377
5378: see if strerror and/or sys_errlist[] exist
5379echo " "
5380if set strerror val -f d_strerror; eval $csym; $val; then
5381 echo 'strerror() found.' >&4
5382 d_strerror="$define"
a0d0e21e 5383 d_strerrm='strerror(e)'
2304df62
AD
5384 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
5385 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
5386 d_syserrlst="$define"
5387 else
5388 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
5389 d_syserrlst="$undef"
5390 fi
5391elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
5392 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
5393 echo 'strerror() found in string header.' >&4
5394 d_strerror="$define"
a0d0e21e 5395 d_strerrm='strerror(e)'
2304df62
AD
5396 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
5397 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
5398 d_syserrlst="$define"
5399 else
5400 echo "(You don't appear to have any sys_errlist[], how can this be?)"
5401 d_syserrlst="$undef"
5402 fi
5403elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
5404echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
5405 d_strerror="$undef"
5406 d_syserrlst="$define"
a0d0e21e 5407 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
2304df62
AD
5408else
5409 echo 'strerror() and sys_errlist[] NOT found.' >&4
5410 d_strerror="$undef"
5411 d_syserrlst="$undef"
a0d0e21e 5412 d_strerrm='"unknown"'
2304df62
AD
5413fi
5414
a0d0e21e
LW
5415: see if strxfrm exists
5416set strxfrm d_strxfrm
5417eval $inlibc
5418
2304df62
AD
5419: see if symlink exists
5420set symlink d_symlink
5421eval $inlibc
5422
5423: see if syscall exists
5424set syscall d_syscall
5425eval $inlibc
5426
a0d0e21e
LW
5427: see if sysconf exists
5428set sysconf d_sysconf
5429eval $inlibc
5430
2304df62
AD
5431: see if system exists
5432set system d_system
5433eval $inlibc
5434
a0d0e21e
LW
5435: see if tcgetpgrp exists
5436set tcgetpgrp d_tcgetpgrp
5437eval $inlibc
5438
5439: see if tcsetpgrp exists
5440set tcsetpgrp d_tcsetpgrp
5441eval $inlibc
5442
5443: define an is-a-typedef? function
5444typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
5445case "$inclist" in
5446"") inclist="sys/types.h";;
5447esac;
ecfc5424
AD
5448eval "varval=\$$var";
5449case "$varval" in
a0d0e21e
LW
5450"")
5451 $rm -f temp.c;
5452 for inc in $inclist; do
5453 echo "#include <$inc>" >>temp.c;
5454 done;
5455 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
5456 if $contains $type temp.E >/dev/null 2>&1; then
5457 eval "$var=$type";
5458 else
5459 eval "$var=$def";
5460 fi;
5461 $rm -f temp.?;;
ecfc5424 5462*) eval "$var=$varval";;
a0d0e21e
LW
5463esac'
5464
5465: see if this is a sys/times.h system
5466set sys/times.h i_systimes
5467eval $inhdr
5468
2304df62
AD
5469: see if times exists
5470echo " "
5471if set times val -f d_times; eval $csym; $val; then
5472 echo 'times() found.' >&4
5473 d_times="$define"
a0d0e21e
LW
5474 inc=''
5475 case "$i_systimes" in
5476 "$define") inc='sys/times.h';;
2304df62 5477 esac
a0d0e21e
LW
5478 set clock_t clocktype long stdio.h sys/types.h $inc
5479 eval $typedef
5480 dflt="$clocktype"
2304df62
AD
5481 echo " "
5482 rp="What type is returned by times() on this sytem?"
5483 . ./myread
5484 clocktype="$ans"
5485else
a0d0e21e 5486 echo 'times() NOT found, hope that will do.' >&4
2304df62
AD
5487 d_times="$undef"
5488 clocktype='int'
5489fi
5490
5491: see if truncate exists
5492set truncate d_truncate
5493eval $inlibc
5494
a0d0e21e
LW
5495: see if tzname[] exists
5496echo " "
5497if set tzname val -a d_tzname; eval $csym; $val; then
5498 val="$define"
5499 echo 'tzname[] found.' >&4
5500else
5501 val="$undef"
5502 echo 'tzname[] NOT found.' >&4
5503fi
5504set d_tzname
5505eval $setvar
5506
5507: see if umask exists
5508set umask d_umask
5509eval $inlibc
5510
2304df62
AD
5511: see if we have to deal with yellow pages, now NIS.
5512if $test -d /usr/etc/yp || $test -d /etc/yp; then
5513 if $test -f /usr/etc/nibindd; then
5514 echo " "
5515 echo "I'm fairly confident you're on a NeXT."
5516 echo " "
5517 rp='Do you get the hosts file via NetInfo?'
5518 dflt=y
5519 case "$hostcat" in
5520 nidump*) ;;
5521 '') ;;
5522 *) dflt=n;;
5523 esac
5524 . ./myread
5525 case "$ans" in
5526 y*) hostcat='nidump hosts .';;
5527 *) hostcat='cat /etc/hosts';;
5528 esac
5529 fi
5530 case "$hostcat" in
5531 nidump*) ;;
5532 *)
5533 case "$hostcat" in
5534 *ypcat*) dflt=y;;
5535 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
5536 dflt=y
5537 else
5538 dflt=n
5539 fi;;
5540 *) dflt=n;;
5541 esac
5542 echo " "
5543 rp='Are you getting the hosts file via yellow pages?'
5544 . ./myread
5545 case "$ans" in
5546 y*) hostcat='ypcat hosts';;
5547 *) hostcat='cat /etc/hosts';;
5548 esac
5549 ;;
5550 esac
5551fi
5552
5553: now get the host name
5554echo " "
5555echo "Figuring out host name..." >&4
5556case "$myhostname" in
5557'') cont=true
5558 echo 'Maybe "hostname" will work...'
5559 if tans=`sh -c hostname 2>&1` ; then
5560 myhostname=$tans
5561 phostname=hostname
5562 cont=''
5563 fi
5564 ;;
5565*) cont='';;
5566esac
5567if $test "$cont"; then
ecfc5424 5568 if ./xenix; then
2304df62
AD
5569 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
5570 if tans=`cat /etc/systemid 2>&1` ; then
5571 myhostname=$tans
5572 phostname='cat /etc/systemid'
5573 echo "Whadyaknow. Xenix always was a bit strange..."
5574 cont=''
5575 fi
5576 elif $test -r /etc/systemid; then
5577 echo "(What is a non-Xenix system doing with /etc/systemid?)"
5578 fi
5579fi
5580if $test "$cont"; then
5581 echo 'No, maybe "uuname -l" will work...'
5582 if tans=`sh -c 'uuname -l' 2>&1` ; then
5583 myhostname=$tans
5584 phostname='uuname -l'
5585 else
5586 echo 'Strange. Maybe "uname -n" will work...'
5587 if tans=`sh -c 'uname -n' 2>&1` ; then
5588 myhostname=$tans
5589 phostname='uname -n'
5590 else
5591 echo 'Oh well, maybe I can mine it out of whoami.h...'
5592 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
5593 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
5594 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
5595 else
5596 case "$myhostname" in
5597 '') echo "Does this machine have an identity crisis or something?"
5598 phostname='';;
5599 *)
5600 echo "Well, you said $myhostname before..."
5601 phostname='echo $myhostname';;
5602 esac
5603 fi
5604 fi
5605 fi
5606fi
5607: you do not want to know about this
5608set $myhostname
5609myhostname=$1
5610
2304df62
AD
5611: verify guess
5612if $test "$myhostname" ; then
5613 dflt=y
5614 rp='Your host name appears to be "'$myhostname'".'" Right?"
5615 . ./myread
5616 case "$ans" in
5617 y*) ;;
5618 *) myhostname='';;
5619 esac
5620fi
5621
5622: bad guess or no guess
5623while $test "X$myhostname" = X ; do
5624 dflt=''
5625 rp="Please type the (one word) name of your host:"
5626 . ./myread
5627 myhostname="$ans"
5628done
5629
ecfc5424
AD
5630: translate upper to lower if necessary
5631case "$myhostname" in
5632*[A-Z]*)
5633 echo "(Normalizing case in your host name)"
5634 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
5635 ;;
5636esac
5637
2304df62
AD
5638: a little sanity check here
5639case "$phostname" in
5640'') ;;
5641*)
ecfc5424 5642 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
2304df62
AD
5643 $myhostname$mydomain|$myhostname) ;;
5644 *)
5645 case "$phostname" in
5646 sed*)
5647 echo "(That doesn't agree with your whoami.h file, by the way.)"
5648 ;;
5649 *)
5650 echo "(That doesn't agree with your $phostname command, by the way.)"
5651 ;;
5652 esac
5653 ;;
5654 esac
5655 ;;
5656esac
5657
5658: see how we will look up host name
5659echo " "
5660if false; then
5661 : dummy stub to allow use of elif
5662elif set uname val -f d_uname; eval $csym; $val; then
ecfc5424 5663 if ./xenix; then
2304df62
AD
5664 $cat <<'EOM'
5665uname() was found, but you're running xenix, and older versions of xenix
5666have a broken uname(). If you don't really know whether your xenix is old
5667enough to have a broken system call, use the default answer.
5668
5669EOM
5670 dflt=y
5671 case "$d_uname" in
5672 "$define") dflt=n;;
5673 esac
5674 rp='Is your uname() broken?'
5675 . ./myread
5676 case "$ans" in
5677 n*) d_uname="$define"; call=uname;;
5678 esac
5679 else
5680 echo 'uname() found.' >&4
5681 d_uname="$define"
5682 call=uname
5683 fi
5684fi
5685case "$d_gethname" in
5686'') d_gethname="$undef";;
5687esac
5688case "$d_uname" in
5689'') d_uname="$undef";;
5690esac
5691case "$d_phostname" in
5692'') d_phostname="$undef";;
5693esac
5694
a0d0e21e
LW
5695: backward compatibility for d_hvfork
5696if test X$d_hvfork != X; then
5697 d_vfork="$d_hvfork"
5698 d_hvfork=''
5699fi
2304df62 5700: see if there is a vfork
a0d0e21e
LW
5701val=''
5702set vfork val
2304df62 5703eval $inlibc
a0d0e21e
LW
5704
5705: Ok, but do we want to use it. vfork is reportedly unreliable in
5706: perl on Solaris 2.x, and probably elsewhere.
5707case "$val" in
5708$define)
5709 echo " "
5710 case "$usevfork" in
5711 false) dflt='n';;
5712 *) dflt='y';;
5713 esac
5714 rp="Some systems have problems with vfork(). Do you want to use it?"
5715 . ./myread
5716 case "$ans" in
5717 y|Y) ;;
5718 *)
5719 echo "Ok, we won't use vfork()."
5720 val="$undef"
5721 ;;
5722 esac
5723 ;;
5724esac
5725set d_vfork
5726eval $setvar
85e6fe83 5727case "$d_vfork" in
a0d0e21e
LW
5728$define) usevfork='true';;
5729*) usevfork='false';;
5730esac
5731
5732: see if this is an sysdir system
5733set sys/dir.h i_sysdir
5734eval $inhdr
5735
5736: see if this is an sysndir system
5737set sys/ndir.h i_sysndir
5738eval $inhdr
5739
5740: see if closedir exists
5741set closedir d_closedir
5742eval $inlibc
5743
5744case "$d_closedir" in
5745"$define")
5746 echo " "
5747 echo "Checking whether closedir() returns a status..." >&4
5748 cat > closedir.c <<EOM
5749#$i_dirent I_DIRENT /**/
5750#$i_sysdir I_SYS_DIR /**/
5751#$i_sysndir I_SYS_NDIR /**/
5752
5753#if defined(I_DIRENT)
5754#include <dirent.h>
5755#if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
5756#include <sys/dir.h>
5757#endif
5758#else
5759#ifdef I_SYS_NDIR
5760#include <sys/ndir.h>
5761#else
5762#ifdef I_SYS_DIR
5763#ifdef hp9000s500
5764#include <ndir.h> /* may be wrong in the future */
5765#else
5766#include <sys/dir.h>
5767#endif
5768#endif
5769#endif
5770#endif
5771int main() { return closedir(opendir(".")); }
5772EOM
5773 if $cc $ccflags $ldflags -o closedir closedir.c $libs > /dev/null 2>&1; then
5774 if ./closedir > /dev/null 2>&1 ; then
5775 echo "Yes, it does."
5776 val="$undef"
5777 else
5778 echo "No, it doesn't."
5779 val="$define"
5780 fi
5781 else
5782 echo "(I can't seem to compile the test program--assuming it doesn't)"
5783 val="$define"
5784 fi
5785 ;;
5786*)
5787 val="$undef";
5788 ;;
85e6fe83 5789esac
a0d0e21e
LW
5790set d_void_closedir
5791eval $setvar
5792$rm -f closedir*
2304df62
AD
5793: check for volatile keyword
5794echo " "
5795echo 'Checking to see if your C compiler knows about "volatile"...' >&4
5796$cat >try.c <<'EOCP'
5797main()
5798{
5799 typedef struct _goo_struct goo_struct;
5800 goo_struct * volatile goo = ((goo_struct *)0);
5801 struct _goo_struct {
5802 long long_int;
5803 int reg_int;
5804 char char_var;
5805 };
5806 typedef unsigned short foo_t;
5807 char *volatile foo;
5808 volatile int bar;
5809 volatile foo_t blech;
5810 foo = foo;
5811}
5812EOCP
5813if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
5814 val="$define"
5815 echo "Yup, it does."
5816else
5817 val="$undef"
5818 echo "Nope, it doesn't."
5819fi
5820set d_volatile
5821eval $setvar
5822$rm -f try.*
5823
5824: see if there is a wait4
5825set wait4 d_wait4
5826eval $inlibc
5827
5828: see if waitpid exists
5829set waitpid d_waitpid
5830eval $inlibc
5831
a0d0e21e
LW
5832: see if wcstombs exists
5833set wcstombs d_wcstombs
5834eval $inlibc
5835
5836: see if wctomb exists
5837set wctomb d_wctomb
5838eval $inlibc
5839
2304df62
AD
5840: preserve RCS keywords in files with variable substitution, grrr
5841Date='$Date'
5842Id='$Id'
5843Log='$Log'
5844RCSfile='$RCSfile'
5845Revision='$Revision'
5846
a0d0e21e 5847: check for alignment requirements
2304df62 5848echo " "
a0d0e21e
LW
5849case "$alignbytes" in
5850'') echo "Checking alignment constraints..." >&4
5851 $cat >try.c <<'EOCP'
5852struct foobar {
5853 char foo;
5854 double bar;
5855} try;
5856main()
5857{
5858 printf("%d\n", (char *)&try.bar - (char *)&try.foo);
5859}
5860EOCP
5861 if $cc $ccflags try.c -o try >/dev/null 2>&1; then
5862 dflt=`./try`
5863 else
5864 dflt='8'
5865 echo"(I can't seem to compile the test program...)"
5866 fi
5867 ;;
5868*) dflt="$alignbytes"
5869 ;;
5870esac
5871rp="Doubles must be aligned on a how-many-byte boundary?"
5872. ./myread
5873alignbytes="$ans"
5874$rm -f try.c try
2304df62
AD
5875
5876: determine where public executables go
5877echo " "
5878case "$bin" in
5879'')
a0d0e21e 5880 dflt="$prefix/bin"
2304df62
AD
5881 ;;
5882*)
5883 dflt="$bin"
5884 ;;
5885esac
5886fn=d~
5887rp='Pathname where the public executables will reside?'
5888. ./getfile
5889bin="$ans"
5890binexp="$ansexp"
5891if $afs; then
5892 $cat <<EOM
5893
5894Since you are running AFS, I need to distinguish the directory in which
5895executables reside from the directory in which they are installed (and from
5896which they are presumably copied to the former directory by occult means).
5897
5898EOM
5899 case "$installbin" in
5900 '') dflt=`echo $binexp | sed 's#^/afs/#/afs/.#'`;;
5901 *) dflt="$installbin";;
5902 esac
5903 fn=de~
5904 rp='Where will public executables be installed?'
5905 . ./getfile
5906 installbin="$ans"
5907else
5908 installbin="$binexp"
5909fi
5910
5911: check for ordering of bytes in a long
5912case "$byteorder" in
5913'')
5914 $cat <<'EOM'
5915
5916In the following, larger digits indicate more significance. A big-endian
5917machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
5918little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
5919machines may have weird orders like 3412. A Cray will report 87654321. If
5920the test program works the default is probably right.
5921I'm now running the test program...
5922EOM
5923 $cat >try.c <<'EOCP'
5924#include <stdio.h>
5925main()
5926{
5927 int i;
5928 union {
5929 unsigned long l;
5930 char c[sizeof(long)];
5931 } u;
5932
5933 if (sizeof(long) > 4)
5934 u.l = (0x08070605L << 32) | 0x04030201L;
5935 else
5936 u.l = 0x04030201L;
5937 for (i = 0; i < sizeof(long); i++)
5938 printf("%c", u.c[i]+'0');
5939 printf("\n");
5940}
5941EOCP
5942 if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then
5943 dflt=`./try`
5944 case "$dflt" in
5945 ????|????????) echo "(The test program ran ok.)";;
5946 *) echo "(The test program didn't run right for some reason.)";;
5947 esac
5948 else
5949 dflt='4321'
5950 cat <<'EOM'
a0d0e21e
LW
5951(I can't seem to compile the test program. Guessing big-endian...)
5952EOM
5953 fi
5954 ;;
5955*)
5956 echo " "
5957 dflt="$byteorder"
5958 ;;
2304df62 5959esac
a0d0e21e 5960rp="What is the order of bytes in a long?"
2304df62 5961. ./myread
a0d0e21e
LW
5962byteorder="$ans"
5963$rm -f try.c try
85e6fe83 5964
a0d0e21e
LW
5965: how do we catenate cpp tokens here?
5966echo " "
5967echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
5968$cat >cpp_stuff.c <<'EOCP'
5969#define RCAT(a,b)a/**/b
5970#define ACAT(a,b)a ## b
5971RCAT(Rei,ser)
5972ACAT(Cir,cus)
5973EOCP
ecfc5424 5974$cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
a0d0e21e
LW
5975if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
5976 echo "Oh! Smells like ANSI's been here."
5977 echo "We can catify or stringify, separately or together!"
5978 cpp_stuff=42
5979elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
5980 echo "Ah, yes! The good old days!"
5981 echo "However, in the good old days we don't know how to stringify and"
5982 echo "catify at the same time."
5983 cpp_stuff=1
5984else
5985 $cat >&4 <<EOM
5986Hmm, I don't seem to be able to catenate tokens with your cpp. You're going
5987to have to edit the values of CAT[2-5] in config.h...
85e6fe83 5988EOM
a0d0e21e
LW
5989 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
5990fi
ecfc5424
AD
5991$rm -f cpp_stuff.*
5992
5993: see if this is a db.h system
5994set db.h i_db
5995eval $inhdr
5996
5997case "$i_db" in
5998define)
5999 : Check the return type needed for hash
6000 echo "Checking return type needed for hash for Berkeley DB ..." >&4
6001 cat >try.c <<'EOCP'
6002#include <sys/types.h>
6003#include <db.h>
6004u_int32_t
6005hash_cb (ptr, size)
6006const void * ptr ;
6007size_t size ;
6008{
6009}
6010HASHINFO info ;
6011main()
6012{
6013 info.hash = hash_cb ;
6014}
6015EOCP
6016 if $cc $ccflags -c try.c >try.out 2>&1 ; then
6017 if $contains warning try.out >>/dev/null 2>&1 ; then
6018 db_hashtype='int'
6019 else
6020 db_hashtype='u_int32_t'
6021 fi
6022 else
6023 echo "I can't seem to compile the test program." >&4
6024 db_hashtype=int
6025 fi
6026 $rm -f try.[co]
6027 echo "Your version of Berkeley DB uses $db_hashtype for hash."
6028 ;;
6029*) db_hashtype=int
6030 ;;
6031esac
6032
6033case "$i_db" in
6034define)
6035 : Check the return type needed for prefix
6036 echo "Checking return type needed for prefix for Berkeley DB ..." >&4
6037 cat >try.c <<'EOCP'
6038#include <sys/types.h>
6039#include <db.h>
6040size_t
6041prefix_cb (key1, key2)
6042const DBT * key1 ;
6043const DBT * key2 ;
6044{
6045}
6046BTREEINFO info ;
6047main()
6048{
6049 info.prefix = prefix_cb ;
6050}
6051EOCP
6052 if $cc $ccflags -c try.c >try.out 2>&1 ; then
6053 if $contains warning try.out >>/dev/null 2>&1 ; then
6054 db_prefixtype='int'
6055 else
6056 db_prefixtype='size_t'
6057 fi
6058 else
6059 echo "I can't seem to compile the test program." >&4
6060 db_prefixtype='int'
6061 fi
6062 $rm -f try.[co]
6063 echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
6064 ;;
6065*) db_prefixtype='int'
6066 ;;
6067esac
85e6fe83 6068
a0d0e21e
LW
6069: check for void type
6070echo " "
ecfc5424
AD
6071echo "Checking to see how well your C compiler groks the void type..." >&4
6072echo " "
a0d0e21e 6073$cat >&4 <<EOM
a0d0e21e
LW
6074 Support flag bits are:
6075 1: basic void declarations.
6076 2: arrays of pointers to functions returning void.
6077 4: operations between pointers to and addresses of void functions.
6078 8: generic void pointers.
85e6fe83 6079EOM
ecfc5424 6080echo " "
a0d0e21e
LW
6081case "$voidflags" in
6082'')
6083 $cat >try.c <<'EOCP'
6084#if TRY & 1
6085void main() {
6086#else
6087main() {
6088#endif
6089 extern void moo(); /* function returning void */
6090 void (*goo)(); /* ptr to func returning void */
6091#if TRY & 8
6092 void *hue; /* generic ptr */
6093#endif
6094#if TRY & 2
6095 void (*foo[10])();
6096#endif
85e6fe83 6097
a0d0e21e
LW
6098#if TRY & 4
6099 if(goo == moo) {
6100 exit(0);
6101 }
6102#endif
6103 exit(0);
6104}
6105EOCP
6106 if $cc -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6107 voidflags=$defvoidused
6108 echo "It appears to support void to the level $package wants ($defvoidused)."
6109 if $contains warning .out >/dev/null 2>&1; then
6110 echo "However, you might get some warnings that look like this:"
6111 $cat .out
6112 fi
6113 else
6114echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6115 if $cc -c -DTRY=1 try.c >/dev/null 2>&1 ; then
6116 echo "It supports 1..."
6117 if $cc -c -DTRY=3 try.c >/dev/null 2>&1 ; then
6118 echo "It also supports 2..."
6119 if $cc -c -DTRY=7 try.c >/dev/null 2>&1 ; then
6120 voidflags=7
6121 echo "And it supports 4 but not 8 definitely."
6122 else
6123 echo "It doesn't support 4..."
6124 if $cc -c -DTRY=11 try.c >/dev/null 2>&1 ; then
6125 voidflags=11
6126 echo "But it supports 8."
6127 else
6128 voidflags=3
6129 echo "Neither does it support 8."
6130 fi
6131 fi
6132 else
6133 echo "It does not support 2..."
6134 if $cc -c -DTRY=13 try.c >/dev/null 2>&1 ; then
6135 voidflags=13
6136 echo "But it supports 4 and 8."
6137 else
6138 if $cc -c -DTRY=5 try.c >/dev/null 2>&1 ; then
6139 voidflags=5
6140 echo "And it supports 4 but has not heard about 8."
6141 else
6142 echo "However it supports 8 but not 4."
6143 fi
6144 fi
6145 fi
6146 else
6147 echo "There is no support at all for void."
6148 voidflags=0
6149 fi
6150 fi
2304df62 6151esac
a0d0e21e
LW
6152dflt="$voidflags";
6153rp="Your void support flags add up to what?"
6154. ./myread
6155voidflags="$ans"
6156$rm -f try.* .out
6157
ecfc5424
AD
6158: see if dbm.h is available
6159set dbm.h t_dbm
85e6fe83 6160eval $inhdr
ecfc5424
AD
6161case "$t_dbm" in
6162$define)
6163 : see if dbmclose exists
6164 set dbmclose d_dbmclose
6165 eval $inlibc
6166 case "$d_dbmclose" in
6167 $undef)
6168 t_dbm="$undef"
6169 echo "We won't be including <dbm.h>"
6170 ;;
6171 esac
6172 ;;
6173esac
6174val="$t_dbm"
6175set i_dbm
6176eval $setvar
85e6fe83
LW
6177
6178: see if ndbm.h is available
ecfc5424 6179set ndbm.h t_ndbm
85e6fe83 6180eval $inhdr
ecfc5424
AD
6181case "$t_ndbm" in
6182$define)
6183 : see if dbm_open exists
6184 set dbm_open d_dbm_open
6185 eval $inlibc
6186 case "$d_dbm_open" in
6187 $undef)
6188 t_ndbm="$undef"
6189 echo "We won't be including <ndbm.h>"
6190 ;;
6191 esac
6192 ;;
6193esac
6194val="$t_ndbm"
6195set i_ndbm
6196eval $setvar
85e6fe83
LW
6197
6198: see if gdbm.h is available
ecfc5424 6199set gdbm.h t_gdbm
85e6fe83 6200eval $inhdr
ecfc5424
AD
6201case "$t_gdbm" in
6202$define)
6203 : see if gdbm_open exists
6204 set gdbm_open d_gdbm_open
6205 eval $inlibc
6206 case "$d_gdbm_open" in
6207 $undef)
6208 t_gdbm="$undef"
6209 echo "We won't be including <gdbm.h>"
6210 ;;
6211 esac
6212 ;;
6213esac
6214val="$t_gdbm"
6215set i_gdbm
6216eval $setvar
85e6fe83 6217
2304df62 6218echo " "
a0d0e21e
LW
6219echo "Looking for extensions..." >&4
6220cd ../ext
6221known_extensions=''
6222for xxx in * ; do
6223 if $test -f $xxx/$xxx.xs; then
6224 known_extensions="$known_extensions $xxx"
6225 fi
6226done
6227set X $known_extensions
6228shift
6229known_extensions="$*"
6230cd ../UU
6231
85e6fe83 6232: Now see which are supported on this system.
a0d0e21e
LW
6233avail_ext=''
6234for xxx in $known_extensions ; do
85e6fe83 6235 case "$xxx" in
a0d0e21e
LW
6236 DB_File) case "$i_db" in
6237 $define) avail_ext="$avail_ext $xxx" ;;
6238 esac
6239 ;;
6240 GDBM_File) case "$i_gdbm" in
6241 $define) avail_ext="$avail_ext $xxx" ;;
6242 esac
6243 ;;
6244 NDBM_File) case "$i_ndbm" in
6245 $define) avail_ext="$avail_ext $xxx" ;;
85e6fe83
LW
6246 esac
6247 ;;
a0d0e21e
LW
6248 ODBM_File) case "$i_dbm" in
6249 $define) avail_ext="$avail_ext $xxx" ;;
85e6fe83
LW
6250 esac
6251 ;;
a0d0e21e
LW
6252 POSIX) case "$useposix" in
6253 true|define|y) avail_ext="$avail_ext $xxx" ;;
85e6fe83
LW
6254 esac
6255 ;;
a0d0e21e
LW
6256 Socket) case "$d_socket" in
6257 $define) avail_ext="$avail_ext $xxx" ;;
85e6fe83
LW
6258 esac
6259 ;;
a0d0e21e 6260 *) avail_ext="$avail_ext $xxx"
85e6fe83
LW
6261 ;;
6262 esac
6263done
6264
a0d0e21e
LW
6265set X $avail_ext
6266shift
6267avail_ext="$*"
6268
6269case $usedl in
6270$define)
6271 $cat <<EOM
6272A number of extensions are supplied with $package. You may choose to
6273compile these extensions for dynamic loading (the default), compile
6274them into the $package executable (static loading), or not include
6275them at all. Answer "none" to include no extensions.
6276
6277EOM
6278 case "$dynamic_ext" in
6279 ''|' ') dflt="$avail_ext" ;;
6280 *) dflt="$dynamic_ext" ;;
6281 esac
6282 case "$dflt" in
6283 '') dflt=none;;
6284 esac
6285 rp="What extensions do you wish to load dynamically?"
6286 . ./myread
6287 case "$ans" in
6288 none) dynamic_ext='' ;;
6289 *) dynamic_ext="$ans" ;;
6290 esac
6291
6292 case "$static_ext" in
6293 ''|' ')
6294 : Exclude those already listed in dynamic linking
6295 dflt=''
6296 for xxx in $avail_ext; do
6297 case " $dynamic_ext " in
6298 *" $xxx "*) ;;
6299 *) dflt="$dflt $xxx" ;;
6300 esac
6301 done
6302 set X $dflt
6303 shift
6304 dflt="$*"
6305 ;;
6306 *) dflt="$static_ext"
6307 ;;
6308 esac
6309
6310 case "$dflt" in
6311 '') dflt=none;;
6312 esac
6313 rp="What extensions do you wish to load statically?"
6314 . ./myread
6315 case "$ans" in
6316 none) static_ext='' ;;
6317 *) static_ext="$ans" ;;
6318 esac
6319 ;;
6320*)
6321 $cat <<EOM
6322A number of extensions are supplied with $package. Answer "none"
6323to include no extensions.
6324
6325EOM
6326 case "$static_ext" in
6327 ''|' ') dflt="$avail_ext" ;;
6328 *) dflt="$static_ext" ;;
6329 esac
6330
6331 case "$dflt" in
6332 '') dflt=none;;
6333 esac
6334 rp="What extensions do you wish to include?"
6335 . ./myread
6336 case "$ans" in
6337 none) static_ext='' ;;
6338 *) static_ext="$ans" ;;
6339 esac
6340 ;;
6341esac
6342
6343set X $dynamic_ext $static_ext
6344shift
6345extensions="$*"
6346
6347: see what type file positions are declared as in the library
6348set fpos_t fpostype long stdio.h sys/types.h
6349eval $typedef
6350echo " "
6351dflt="$fpostype"
6352rp="What is the type for file position used by fsetpos()?"
2304df62 6353. ./myread
a0d0e21e 6354fpostype="$ans"
2304df62
AD
6355
6356: see what type gids are declared as in the kernel
a0d0e21e
LW
6357set gid_t gidtype xxx stdio.h sys/types.h
6358eval $typedef
2304df62 6359case "$gidtype" in
a0d0e21e
LW
6360xxx)
6361 xxx=`./findhdr sys/user.h`
6362 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
6363 case $1 in
6364 unsigned) dflt="$1 $2" ;;
6365 *) dflt="$1" ;;
6366 esac
2304df62 6367 ;;
a0d0e21e 6368*) dflt="$gidtype";;
2304df62
AD
6369esac
6370echo " "
6371rp="What is the type for group ids returned by getgid()?"
6372. ./myread
a0d0e21e
LW
6373gidtype="$ans"
6374
2304df62
AD
6375: see if getgroups exists
6376set getgroups d_getgrps
6377eval $inlibc
6378
a0d0e21e
LW
6379: Find type of 2nd arg to getgroups
6380echo " "
2304df62
AD
6381case "$d_getgrps" in
6382'define')
a0d0e21e 6383 case "$groupstype" in
2304df62
AD
6384 '') dflt="$gidtype" ;;
6385 *) dflt="$groupstype" ;;
a0d0e21e
LW
6386 esac
6387 $cat <<EOM
2304df62 6388What is the type of the second argument to getgroups()? Usually this
85e6fe83 6389is the same as group ids, $gidtype, but not always.
2304df62
AD
6390
6391EOM
a0d0e21e
LW
6392 rp='What type is the second argument to getgroups()?'
6393 . ./myread
6394 groupstype="$ans"
6395 ;;
6396*) groupstype="$gidtype";;
2304df62 6397esac
2304df62 6398
85e6fe83 6399: see what type lseek is declared as in the kernel
a0d0e21e
LW
6400set off_t lseektype long stdio.h sys/types.h
6401eval $typedef
2304df62 6402echo " "
a0d0e21e 6403dflt="$lseektype"
85e6fe83
LW
6404rp="What type is lseek's offset on this system declared as?"
6405. ./myread
6406lseektype="$ans"
2304df62
AD
6407
6408: determine where manual pages go
6409$cat <<EOM
6410
6411$package has manual pages available in source form.
6412EOM
ecfc5424 6413case "$nroff" in
2304df62
AD
6414nroff)
6415 echo "However, you don't have nroff, so they're probably useless to you."
6416 case "$mansrc" in
6417 '') mansrc="none";;
6418 esac;;
6419esac
6420echo "If you don't want the manual sources installed, answer 'none'."
6421case "$mansrc" in
6422'')
a0d0e21e
LW
6423 lookpath="$prefix/man/man1 $prefix/man/u_man/man1 $prefix/man/l_man/man1"
6424 lookpath="$lookpath /usr/local/man/man1 /usr/local/man/man1 /usr/man/manl"
2304df62
AD
6425 lookpath="$lookpath /usr/man/local/man1 /usr/man/l_man/man1"
6426 lookpath="$lookpath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
6427 lookpath="$lookpath /usr/man/man.L"
a0d0e21e 6428 mansrc=`./loc . $prefix/man/man1 $lookpath`
2304df62
AD
6429 if $test -d "$mansrc"; then
6430 dflt="$mansrc"
6431 else
6432 dflt="$sysman"
6433 fi
6434 ;;
6435*) dflt="$mansrc"
6436 ;;
6437esac
6438echo " "
6439fn=dn~
6440rp='Where do the manual pages (source) go?'
6441. ./getfile
6442mansrc="$ans"
6443mansrcexp="$ansexp"
6444if $afs; then
6445 $cat <<EOM
6446
6447Since you are running AFS, I need to distinguish the directory in which
6448manual pages reside from the directory in which they are installed (and from
6449which they are presumably copied to the former directory by occult means).
6450
6451EOM
6452 case "$installmansrc" in
6453 '') dflt=`echo $mansrcexp | sed 's#^/afs/#/afs/.#'`;;
6454 *) dflt="$installmansrc";;
6455 esac
6456 fn=de~
6457 rp='Where will man pages be installed?'
6458 . ./getfile
6459 installmansrc="$ans"
6460else
6461 installmansrc="$mansrcexp"
6462fi
6463
6464
6465case "$mansrc" in
6466'') manext='0';;
6467*l) manext=l;;
6468*n) manext=n;;
6469*o) manext=l;;
6470*p) manext=n;;
6471*C) manext=C;;
6472*L) manext=L;;
6473*L1) manext=L1;;
6474*) manext=1;;
6475esac
6476
a0d0e21e
LW
6477: see what type is used for mode_t
6478set mode_t modetype int stdio.h sys/types.h
6479eval $typedef
6480dflt="$modetype"
85e6fe83 6481echo " "
a0d0e21e 6482rp="What type is used for file modes?"
85e6fe83 6483. ./myread
a0d0e21e 6484modetype="$ans"
85e6fe83 6485
ecfc5424
AD
6486: set the base revision
6487baserev=5.0
6488
6489: get the patchlevel
6490echo " "
6491echo "Getting the current patchlevel..." >&4
6492if $test -r ../patchlevel.h;then
6493 patchlevel=`awk '/PATCHLEVEL/ {print $3}' < ../patchlevel.h`
6494else
6495 patchlevel=0
6496fi
6497echo "(You have $package $baserev PL$patchlevel.)"
6498
2304df62
AD
6499: Cruising for prototypes
6500echo " "
6501echo "Checking out function prototypes..." >&4
6502$cat >prototype.c <<'EOCP'
6503main(int argc, char *argv[]) {
6504 exit(0);}
6505EOCP
a0d0e21e 6506if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
2304df62
AD
6507 echo "Your C compiler appears to support function prototypes."
6508 val="$define"
6509else
6510 echo "Your C compiler doesn't seem to understand function prototypes."
6511 val="$undef"
6512fi
6513set prototype
6514eval $setvar
6515$rm -f prototype*
6516
6517: check for size of random number generator
6518echo " "
6519case "$randbits" in
6520'')
6521 echo "Checking to see how many bits your rand function produces..." >&4
6522 $cat >try.c <<'EOCP'
6523#include <stdio.h>
6524main()
6525{
6526 register int i;
6527 register unsigned long tmp;
6528 register unsigned long max = 0L;
6529
6530 for (i = 1000; i; i--) {
6531 tmp = (unsigned long)rand();
6532 if (tmp > max) max = tmp;
6533 }
6534 for (i = 0; max; i++)
6535 max /= 2;
6536 printf("%d\n",i);
6537}
6538EOCP
6539 if $cc try.c -o try >/dev/null 2>&1 ; then
6540 dflt=`try`
6541 else
6542 dflt='?'
6543 echo "(I can't seem to compile the test program...)"
6544 fi
6545 ;;
6546*)
6547 dflt="$randbits"
6548 ;;
6549esac
a0d0e21e
LW
6550rp='How many bits does your rand() function produce?'
6551. ./myread
6552randbits="$ans"
6553$rm -f try.c try
6554
6555: see if ar generates random libraries by itself
6556echo " "
6557echo "Checking how to generate random libraries on your machine..." >&4
6558echo 'int bar1() { return bar2(); }' > bar1.c
6559echo 'int bar2() { return 2; }' > bar2.c
6560$cat > foo.c <<'EOP'
6561main() { printf("%d\n", bar1()); exit(0); }
6562EOP
6563$cc $ccflags -c bar1.c >/dev/null 2>&1
6564$cc $ccflags -c bar2.c >/dev/null 2>&1
6565$cc $ccflags -c foo.c >/dev/null 2>&1
6566ar rc bar.a bar2.o bar1.o >/dev/null 2>&1
ecfc5424 6567if $cc $ccflags $ldflags -o foobar foo.o bar.a $libs > /dev/null 2>&1 &&
a0d0e21e
LW
6568 ./foobar >/dev/null 2>&1; then
6569 echo "ar appears to generate random libraries itself."
6570 orderlib=false
6571 ranlib=":"
6572elif ar ts bar.a >/dev/null 2>&1 &&
6573 $cc $ccflags $ldflags -o foobar foo.o bar.a $libs > /dev/null 2>&1 &&
6574 ./foobar >/dev/null 2>&1; then
6575 echo "a table of contents needs to be added with 'ar ts'."
6576 orderlib=false
6577 ranlib="ar ts"
6578else
ecfc5424
AD
6579 case "$ranlib" in
6580 :) ranlib='';;
6581 '')
6582 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
6583 $test -f $ranlib || ranlib=''
6584 ;;
6585 esac
a0d0e21e 6586 if $test -n "$ranlib"; then
ecfc5424 6587 echo "your system has '$ranlib'; we'll use that."
a0d0e21e
LW
6588 orderlib=false
6589 else
6590 echo "your system doesn't seem to support random libraries"
6591 echo "so we'll use lorder and tsort to order the libraries."
6592 orderlib=true
6593 ranlib=":"
6594 fi
6595fi
6596$rm -f foo* bar*
6597
6598: determine where public executable scripts go
6599case "$scriptdir" in
6600'')
6601 dflt="$bin"
6602 : guess some guesses
6603 $test -d /usr/share/scripts && dflt=/usr/share/scripts
6604 $test -d /usr/share/bin && dflt=/usr/share/bin
6605 $test -d /usr/local/script && dflt=/usr/local/script
6606 $test -d $prefix/script && dflt=$prefix/script
6607 ;;
6608*) dflt="$scriptdir"
6609 ;;
6610esac
6611$cat <<EOM
6612
6613Some installations have a separate directory just for executable scripts so
6614that they can mount it across multiple architectures but keep the scripts in
6615one spot. You might, for example, have a subdirectory of /usr/share for this.
6616Or you might just lump your scripts in with all your other executables.
6617
6618EOM
6619fn=d~
6620rp='Where do you keep publicly executable scripts?'
6621. ./getfile
6622scriptdir="$ans"
6623scriptdirexp="$ansexp"
6624if $afs; then
6625 $cat <<EOM
6626
6627Since you are running AFS, I need to distinguish the directory in which
6628scripts reside from the directory in which they are installed (and from
6629which they are presumably copied to the former directory by occult means).
6630
6631EOM
6632 case "$installscript" in
6633 '') dflt=`echo $scriptdirexp | sed 's#^/afs/#/afs/.#'`;;
6634 *) dflt="$installscript";;
6635 esac
6636 fn=de~
6637 rp='Where will public scripts be installed?'
6638 . ./getfile
6639 installscript="$ans"
6640else
6641 installscript="$scriptdirexp"
6642fi
6643
6644: see if sys/select.h has to be included
6645set sys/select.h i_sysselct
6646eval $inhdr
6647
6648: see if we should include time.h, sys/time.h, or both
6649echo " "
6650echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
6651$echo $n "I'm now running the test program...$c"
6652$cat >try.c <<'EOCP'
6653#include <sys/types.h>
6654#ifdef I_TIME
6655#include <time.h>
6656#endif
6657#ifdef I_SYSTIME
6658#ifdef SYSTIMEKERNEL
6659#define KERNEL
6660#endif
6661#include <sys/time.h>
6662#endif
6663#ifdef I_SYSSELECT
6664#include <sys/select.h>
6665#endif
6666main()
6667{
6668 struct tm foo;
6669#ifdef S_TIMEVAL
6670 struct timeval bar;
6671#endif
6672#ifdef S_TIMEZONE
6673 struct timezone tzp;
6674#endif
6675 if (foo.tm_sec == foo.tm_sec)
6676 exit(0);
6677#ifdef S_TIMEVAL
6678 if (bar.tv_sec == bar.tv_sec)
6679 exit(0);
6680#endif
6681 exit(1);
6682}
6683EOCP
6684flags=''
6685s_timezone=''
6686sysselect=''
6687for s_timeval in '-DS_TIMEVAL' ''; do
6688for i_systimek in '' '-DSYSTIMEKERNEL'; do
6689for i_time in '' '-DI_TIME'; do
6690for i_systime in '-DI_SYSTIME' ''; do
6691 case "$flags" in
6692 '') $echo $n ".$c"
6693 if $cc $ccflags \
6694 $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone \
6695 try.c -o try >/dev/null 2>&1 ; then
6696 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
6697 shift
6698 flags="$*"
6699 echo " "
6700 $echo $n "Succeeded with $flags$c"
6701 fi
6702 ;;
6703 esac
6704done
6705done
6706done
6707done
6708timeincl=''
6709echo " "
6710case "$flags" in
6711*SYSTIMEKERNEL*) i_systimek="$define"
6712 timeincl=`./findhdr sys/time.h`
6713 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
6714*) i_systimek="$undef";;
6715esac
6716case "$flags" in
6717*I_TIME*) i_time="$define"
6718 timeincl=`./findhdr time.h`" $timeincl"
6719 echo "We'll include <time.h>." >&4;;
6720*) i_time="$undef";;
6721esac
6722case "$flags" in
6723*I_SYSTIME*) i_systime="$define"
6724 timeincl=`./findhdr sys/time.h`" $timeincl"
6725 echo "We'll include <sys/time.h>." >&4;;
6726*) i_systime="$undef";;
6727esac
2304df62
AD
6728$rm -f try.c try
6729
a0d0e21e
LW
6730: check for fd_set items
6731$cat <<EOM
6732
6733Checking to see how well your C compiler handles fd_set and friends ...
6734EOM
6735$cat >fd_set.c <<EOCP
6736#$i_systime I_SYS_TIME
6737#$i_sysselct I_SYS_SELECT
6738#$d_socket HAS_SOCKET
6739#include <sys/types.h>
6740#ifdef HAS_SOCKET
6741#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
6742#endif
6743#ifdef I_SYS_TIME
6744#include <sys/time.h>
6745#else
6746#ifdef I_SYS_SELECT
6747#include <sys/select.h>
6748#endif
6749#endif
6750main() {
6751 fd_set fds;
6752
6753#ifdef TRYBITS
6754 if(fds.fds_bits);
6755#endif
6756
6757#if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
6758 exit(0);
6759#else
6760 exit(1);
6761#endif
6762}
6763EOCP
6764if $cc $ccflags -DTRYBITS fd_set.c -o fd_set >fd_set.out 2>&1 ; then
6765 d_fds_bits="$define"
6766 d_fd_set="$define"
6767 echo "Well, your system knows about the normal fd_set typedef..." >&4
6768 if ./fd_set; then
6769 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
6770 d_fd_macros="$define"
85e6fe83 6771 else
a0d0e21e
LW
6772 $cat >&4 <<'EOM'
6773but not the normal fd_set macros! Gaaack! I'll have to cover for you.
6774EOM
6775 d_fd_macros="$undef"
85e6fe83
LW
6776 fi
6777else
a0d0e21e
LW
6778 $cat <<'EOM'
6779Hmm, your compiler has some difficulty with fd_set. Checking further...
6780EOM
6781 if $cc $ccflags fd_set.c -o fd_set >fd_set.out 2>&1 ; then
6782 d_fds_bits="$undef"
6783 d_fd_set="$define"
6784 echo "Well, your system has some sort of fd_set available..." >&4
6785 if ./fd_set; then
6786 echo "and you have the normal fd_set macros." >&4
6787 d_fd_macros="$define"
6788 else
6789 $cat <<'EOM'
6790but not the normal fd_set macros! Gross! More work for me...
6791EOM
6792 d_fd_macros="$undef"
6793 fi
85e6fe83 6794 else
a0d0e21e
LW
6795 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
6796 d_fd_set="$undef"
6797 d_fds_bits="$undef"
6798 d_fd_macros="$undef"
85e6fe83
LW
6799 fi
6800fi
a0d0e21e
LW
6801$rm -f fd_set*
6802
6803
6804: check for type of arguments to select. This will only really
6805: work if the system supports prototypes and provides one for
6806: select.
6807case "$d_select" in
6808$define)
6809 : Make initial guess
6810 case "$selecttype" in
6811 ''|' ')
6812 case "$d_fd_set" in
6813 $define) xxx='fd_set *' ;;
6814 *) xxx='int *' ;;
6815 esac
6816 ;;
6817 *) xxx="$selecttype"
6818 ;;
6819 esac
6820 : backup guess
6821 case "$xxx" in
6822 'fd_set *') yyy='int *' ;;
6823 'int *') yyy='fd_set *' ;;
6824 esac
85e6fe83 6825
2304df62
AD
6826 $cat <<EOM
6827
a0d0e21e 6828Checking to see what type of arguments are expected by select().
2304df62 6829EOM
a0d0e21e
LW
6830 $cat >try.c <<EOCP
6831#$i_systime I_SYS_TIME
6832#$i_sysselct I_SYS_SELECT
6833#$d_socket HAS_SOCKET
6834#include <sys/types.h>
6835#ifdef HAS_SOCKET
6836#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
6837#endif
6838#ifdef I_SYS_TIME
6839#include <sys/time.h>
6840#else
6841#ifdef I_SYS_SELECT
6842#include <sys/select.h>
6843#endif
6844#endif
6845main()
6846{
6847 int width;
6848 Select_fd_set_t readfds;
6849 Select_fd_set_t writefds;
6850 Select_fd_set_t exceptfds;
6851 struct timeval timeout;
6852 select(width, readfds, writefds, exceptfds, &timeout);
6853 exit(0);
6854}
6855EOCP
6856 if $cc $ccflags -c -DSelect_fd_set_t="$xxx" try.c >/dev/null 2>&1 ; then
6857 selecttype="$xxx"
6858 echo "Your system uses $xxx for the arguments to select." >&4
6859 elif $cc $ccflags -c -DSelect_fd_set_t="$yyy" try.c >/dev/null 2>&1 ; then
6860 selecttype="$yyy"
6861 echo "Your system uses $yyy for the arguments to select." >&4
6862 else
6863 rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
6864 dflt="$xxx"
6865 . ./myread
6866 selecttype="$ans"
6867 fi
6868 $rm -f try.[co]
6869 ;;
6870*) selecttype = 'int *'
6871 ;;
6872esac
2304df62
AD
6873
6874: generate list of signal names
6875echo " "
6876case "$sig_name" in
6877'')
6878 echo "Generating a list of signal names..." >&4
6879 xxx=`./findhdr signal.h`" "`./findhdr sys/signal.h`
6880 set X `cat $xxx 2>&1 | $awk '
6881$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ {
6882 sig[$3] = substr($2,4,20)
6883 if (max < $3 && $3 < 60) {
6884 max = $3
6885 }
6886}
6887
6888END {
6889 for (i = 1; i <= max; i++) {
6890 if (sig[i] == "")
6891 printf "%d", i
6892 else
6893 printf "%s", sig[i]
6894 if (i < max)
6895 printf " "
6896 }
6897 printf "\n"
6898}
6899'`
6900 shift
6901 case $# in
6902 0)
6903 echo 'kill -l' >/tmp/foo$$
6904 set X `csh -f </tmp/foo$$`
6905 $rm -f /tmp/foo$$
6906 shift
6907 case $# in
6908 0)set HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM
6909 ;;
6910 esac
6911 ;;
6912 esac
6913 sig_name="ZERO $*"
a0d0e21e 6914 ;;
2304df62 6915esac
a0d0e21e
LW
6916echo "The following signals are available:"
6917echo " "
6918echo $sig_name | $awk \
6919'BEGIN { linelen = 0 }
6920{
6921 for (i = 1; i < NF; i++) {
6922 name = "SIG" $i " "
6923 linelen = linelen + length(name)
6924 if (linelen > 70) {
6925 printf "\n"
6926 linelen = length(name)
6927 }
6928 printf "%s", name
6929 }
6930}'
6931echo " "
6932
6933: see what type is used for size_t
6934set size_t sizetype 'unsigned int' stdio.h sys/types.h
6935eval $typedef
6936dflt="$sizetype"
6937echo " "
6938rp="What type is used for the length parameter for string functions?"
2304df62 6939. ./myread
a0d0e21e
LW
6940sizetype="$ans"
6941
6942: see what type is used for signed size_t
6943set ssize_t ssizetype int stdio.h sys/types.h
6944eval $typedef
6945dflt="$ssizetype"
6946$cat > ssize.c <<EOM
6947#include <stdio.h>
6948#include <sys/types.h>
6949#define Size_t $sizetype
6950#define SSize_t $dflt
6951main()
6952{
6953 if (sizeof(Size_t) == sizeof(SSize_t))
6954 printf("$dflt\n");
6955 else if (sizeof(Size_t) == sizeof(int))
6956 printf("int\n");
6957 else
6958 printf("long\n");
6959}
6960EOM
6961echo " "
6962if $cc $ccflags $ldflags -o ssize ssize.c $libs > /dev/null 2>&1 ; then
6963 ssizetype=`./ssize`
6964 echo "I'll be using $ssizetype for functions returning a byte count." >&4
6965else
6966 echo "(I can't compile the test program--please enlighten me!)"
6967 $cat <<EOM
6968
6969I need a type that is the same size as $sizetype, but is guaranteed to
6970be signed. Common values are int and long.
6971
6972EOM
6973 rp="What signed type is the same size as $sizetype?"
6974 . ./myread
6975 ssizetype="$ans"
6976fi
6977$rm -f ssize ssize.[co]
6978
6979: see what type of char stdio uses.
6980echo " "
6981if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
6982 echo "Your stdio uses unsigned chars." >&4
6983 stdchar="unsigned char"
6984else
6985 echo "Your stdio uses signed chars." >&4
6986 stdchar="char"
6987fi
6988
6989: see if time exists
6990echo " "
ecfc5424 6991if set time val -f d_time; eval $csym; $val; then
a0d0e21e 6992 echo 'time() found.' >&4
ecfc5424 6993 val="$define"
a0d0e21e
LW
6994 set time_t timetype long stdio.h sys/types.h
6995 eval $typedef
6996 dflt="$timetype"
6997 echo " "
6998 rp="What type is returned by time() on this sytem?"
6999 . ./myread
7000 timetype="$ans"
7001else
7002 echo 'time() not found, hope that will do.' >&4
ecfc5424 7003 val="$undef"
a0d0e21e
LW
7004 timetype='int';
7005fi
a0d0e21e
LW
7006set d_time
7007eval $setvar
7008
7009: see what type uids are declared as in the kernel
7010set uid_t uidtype xxx stdio.h sys/types.h
7011eval $typedef
7012case "$uidtype" in
7013xxx)
7014 xxx=`./findhdr sys/user.h`
7015 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
7016 case $1 in
7017 unsigned) dflt="$1 $2" ;;
7018 *) dflt="$1" ;;
7019 esac
7020 ;;
7021*) dflt="$uidtype";;
7022esac
7023echo " "
7024rp="What is the type for user ids returned by getuid()?"
7025. ./myread
7026uidtype="$ans"
2304df62 7027
2304df62
AD
7028: see if this is a sys/file.h system
7029val=''
7030set sys/file.h val
7031eval $inhdr
7032
7033: do we need to #include <sys/file.h> ?
7034case "$val" in
7035"$define")
7036 echo " "
7037 if $h_sysfile; then
7038 val="$define"
7039 echo "We'll be including <sys/file.h>." >&4
7040 else
7041 val="$undef"
7042 echo "We won't be including <sys/file.h>." >&4
7043 fi
7044 ;;
7045*)
7046 h_sysfile=false
7047 ;;
7048esac
7049set i_sysfile
7050eval $setvar
7051
7052: see if fcntl.h is there
7053val=''
7054set fcntl.h val
7055eval $inhdr
7056
7057: see if we can include fcntl.h
7058case "$val" in
7059"$define")
7060 echo " "
7061 if $h_fcntl; then
7062 val="$define"
7063 echo "We'll be including <fcntl.h>." >&4
7064 else
7065 val="$undef"
7066 if $h_sysfile; then
7067 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
7068 else
7069 echo "We won't be including <fcntl.h>." >&4
7070 fi
7071 fi
7072 ;;
7073*)
7074 h_fcntl=false
7075 val="$undef"
7076 ;;
7077esac
7078set i_fcntl
7079eval $setvar
7080
2304df62
AD
7081: see if this is an grp system
7082set grp.h i_grp
7083eval $inhdr
7084
a0d0e21e
LW
7085: see if this is a math.h system
7086set math.h i_math
7087eval $inhdr
7088
85e6fe83 7089: see if memory.h is available.
a0d0e21e
LW
7090val=''
7091set memory.h val
2304df62 7092eval $inhdr
a0d0e21e 7093
85e6fe83 7094: See if it conflicts with string.h
a0d0e21e
LW
7095case "$val" in
7096$define)
7097 case "$strings" in
7098 '') ;;
7099 *)
7100 $cppstdin $cppflags $cppminus < $strings > mem.h
7101 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
7102 echo " "
7103 echo "We won't be including <memory.h>."
7104 val="$undef"
7105 fi
7106 $rm -f mem.h
7107 ;;
7108 esac
85e6fe83 7109esac
a0d0e21e
LW
7110set i_memory
7111eval $setvar
2304df62 7112
85e6fe83 7113: see if net/errno.h is available
a0d0e21e
LW
7114val=''
7115set net/errno.h val
2304df62 7116eval $inhdr
a0d0e21e 7117
85e6fe83 7118: Unfortunately, it causes problems on some systems. Arrgh.
a0d0e21e
LW
7119case "$val" in
7120$define)
7121 cat > try.c <<'EOM'
85e6fe83
LW
7122#include <stdio.h>
7123#include <errno.h>
7124#include <net/errno.h>
7125int func()
7126{
a0d0e21e 7127 return ENOTSOCK;
85e6fe83
LW
7128}
7129EOM
a0d0e21e
LW
7130 if $cc $ccflags -c try.c >/dev/null 2>&1; then
7131 echo "We'll be including <net/errno.h>." >&4
7132 else
7133 echo "We won't be including <net/errno.h>." >&4
7134 val="$undef"
7135 fi
7136 $rm -f try.* try
7137 ;;
85e6fe83 7138esac
a0d0e21e
LW
7139set i_neterrno
7140eval $setvar
2304df62
AD
7141
7142: get C preprocessor symbols handy
7143echo " "
ecfc5424 7144$echo $n "Hmm... $c"
a0d0e21e 7145echo $al | $tr ' ' '\012' >Cppsym.know
2304df62
AD
7146$cat <<EOSS >Cppsym
7147$startsh
7148case "\$1" in
7149-l) list=true
7150 shift
7151 ;;
7152esac
7153unknown=''
7154case "\$list\$#" in
71551|2)
7156 for sym do
7157 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
7158 exit 0
7159 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
7160 :
7161 else
7162 unknown="\$unknown \$sym"
7163 fi
7164 done
7165 set X \$unknown
7166 shift
7167 ;;
7168esac
7169case \$# in
71700) exit 1;;
7171esac
7172echo \$* | $tr ' ' '\012' | $sed -e 's/\(.*\)/\\
7173#ifdef \1\\
7174exit 0; _ _ _ _\1\\ \1\\
7175#endif\\
7176/' >Cppsym\$\$
7177echo "exit 1; _ _ _" >>Cppsym\$\$
7178$cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _' >Cppsym2\$\$
7179case "\$list" in
7180true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
7181*)
7182 sh Cppsym2\$\$
7183 status=\$?
7184 ;;
7185esac
7186$rm -f Cppsym\$\$ Cppsym2\$\$
7187exit \$status
7188EOSS
7189chmod +x Cppsym
7190$eunicefix Cppsym
ecfc5424
AD
7191./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
7192
7193: now check the C compiler for additional symbols
7194$cat >ccsym <<EOS
7195$startsh
7196$cat >tmp.c <<EOF
7197extern int foo;
7198EOF
7199for i in \`$cc -v -c tmp.c 2>&1\`
7200do
7201 case "\$i" in
7202 -D*) echo "\$i" | $sed 's/^-D//';;
7203 -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
7204 esac
7205done
7206$rm -f try.c
7207EOS
7208chmod +x ccsym
7209$eunicefix ccsym
7210./ccsym | $sort | $uniq >ccsym.raw
7211$awk '/\=/ { print $0; next } { print $0"=1" }' ccsym.raw >ccsym.list
7212$awk '{ print $0"=1" }' Cppsym.true >ccsym.true
7213$comm -13 ccsym.true ccsym.list >ccsym.own
7214$comm -12 ccsym.true ccsym.list >ccsym.com
7215$comm -23 ccsym.true ccsym.list >ccsym.cpp
7216also=''
7217symbols='symbols'
7218if $test -z ccsym.raw; then
7219 echo "Your C compiler doesn't seem to define any symbol!" >&4
7220 echo " "
7221 echo "However, your C preprocessor defines the following ones:"
7222 $cat Cppsym.true
7223else
7224 if $test -s ccsym.com; then
7225 echo "Your C compiler and pre-processor define these symbols:"
7226 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
7227 also='also '
7228 symbols='ones'
7229 $test "$silent" || sleep 1
7230 fi
7231 if $test -s ccsym.cpp; then
7232 $test "$also" && echo " "
7233 echo "Your C pre-processor ${also}defines the following $symbols:"
7234 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
7235 also='further '
7236 $test "$silent" || sleep 1
7237 fi
7238 if $test -s ccsym.own; then
7239 $test "$also" && echo " "
7240 echo "Your C compiler ${also}defines the following cpp variables:"
7241 $sed -e 's/\(.*\)=1/\1/' ccsym.own
7242 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
7243 $test "$silent" || sleep 1
7244 fi
7245fi
7246$rm -f ccsym*
2304df62
AD
7247
7248: see if this is a termio system
7249val="$undef"
7250val2="$undef"
7251val3="$undef"
7252if $test `./findhdr termios.h`; then
7253 set tcsetattr i_termios
7254 eval $inlibc
7255 val3="$i_termios"
7256fi
7257echo " "
7258case "$val3" in
7259"$define") echo "You have POSIX termios.h... good!" >&4;;
ecfc5424 7260*) if ./Cppsym pyr; then
2304df62
AD
7261 case "`/bin/universe`" in
7262 ucb) if $test `./findhdr sgtty.h`; then
7263 val2="$define"
7264 echo "<sgtty.h> found." >&4
7265 else
7266 echo "System is pyramid with BSD universe."
7267 echo "<sgtty.h> not found--you could have problems." >&4
7268 fi;;
7269 *) if $test `./findhdr termio.h`; then
7270 val="$define"
7271 echo "<termio.h> found." >&4
7272 else
7273 echo "System is pyramid with USG universe."
7274 echo "<termio.h> not found--you could have problems." >&4
7275 fi;;
7276 esac
ecfc5424 7277 elif ./usg; then
2304df62
AD
7278 if $test `./findhdr termio.h`; then
7279 echo "<termio.h> found." >&4
7280 val="$define"
7281 elif $test `./findhdr sgtty.h`; then
7282 echo "<sgtty.h> found." >&4
7283 val2="$define"
7284 else
7285echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
7286 fi
7287 else
7288 if $test `./findhdr sgtty.h`; then
7289 echo "<sgtty.h> found." >&4
7290 val2="$define"
7291 elif $test `./findhdr termio.h`; then
7292 echo "<termio.h> found." >&4
7293 val="$define"
7294 else
7295echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
7296 fi
7297 fi;;
7298esac
7299set i_termio; eval $setvar
7300val=$val2; set i_sgtty; eval $setvar
7301val=$val3; set i_termios; eval $setvar
7302
a0d0e21e 7303: see if stdarg is available
2304df62 7304echo " "
a0d0e21e
LW
7305if $test `./findhdr stdarg.h`; then
7306 echo "<stdarg.h> found." >&4
7307 valstd="$define"
2304df62 7308else
a0d0e21e
LW
7309 echo "<stdarg.h> NOT found." >&4
7310 valstd="$undef"
2304df62 7311fi
85e6fe83 7312
a0d0e21e 7313: see if varags is available
2304df62
AD
7314echo " "
7315if $test `./findhdr varargs.h`; then
2304df62
AD
7316 echo "<varargs.h> found." >&4
7317else
2304df62
AD
7318 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
7319fi
2304df62
AD
7320
7321: set up the varargs testing programs
7322$cat > varargs.c <<EOP
7323#ifdef I_STDARG
7324#include <stdarg.h>
7325#endif
7326#ifdef I_VARARGS
7327#include <varargs.h>
7328#endif
7329
7330#ifdef I_STDARG
7331int f(char *p, ...)
7332#else
7333int f(va_alist)
7334va_dcl
7335#endif
7336{
7337 va_list ap;
7338#ifndef I_STDARG
7339 char *p;
7340#endif
7341#ifdef I_STDARG
7342 va_start(ap,p);
7343#else
7344 va_start(ap);
7345 p = va_arg(ap, char *);
7346#endif
7347 va_end(ap);
7348}
7349EOP
7350$cat > varargs <<EOP
7351if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
7352 echo "true"
7353else
7354 echo "false"
7355fi
7356$rm -f varargs.o
7357EOP
7358chmod +x varargs
7359
7360: now check which varargs header should be included
7361echo " "
7362i_varhdr=''
a0d0e21e 7363case "$valstd" in
2304df62
AD
7364"$define")
7365 if `./varargs I_STDARG`; then
a0d0e21e 7366 val='stdarg.h'
2304df62 7367 elif `./varargs I_VARARGS`; then
a0d0e21e 7368 val='varargs.h'
2304df62
AD
7369 fi
7370 ;;
7371*)
7372 if `./varargs I_VARARGS`; then
a0d0e21e 7373 val='varargs.h'
2304df62
AD
7374 fi
7375 ;;
7376esac
a0d0e21e 7377case "$val" in
2304df62
AD
7378'')
7379echo "I could not find the definition for va_dcl... You have problems..." >&4
a0d0e21e
LW
7380 val="$undef"; set i_stdarg; eval $setvar
7381 val="$undef"; set i_varargs; eval $setvar
2304df62 7382 ;;
a0d0e21e
LW
7383*)
7384 set i_varhdr
7385 eval $setvar
7386 case "$i_varhdr" in
7387 stdarg.h)
7388 val="$define"; set i_stdarg; eval $setvar
7389 val="$undef"; set i_varargs; eval $setvar
7390 ;;
7391 varargs.h)
7392 val="$undef"; set i_stdarg; eval $setvar
7393 val="$define"; set i_varargs; eval $setvar
7394 ;;
7395 esac
7396 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
2304df62
AD
7397esac
7398$rm -f varargs*
7399
a0d0e21e
LW
7400: see if stddef is available
7401set stddef.h i_stddef
7402eval $inhdr
7403
7404: see if stdlib is available
7405set stdlib.h i_stdlib
7406eval $inhdr
7407
7408: see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
7409set sys/filio.h i_sysfilio
7410eval $inhdr
7411echo " "
7412if $test `./findhdr sys/ioctl.h`; then
7413 val="$define"
7414 echo '<sys/ioctl.h> found.' >&4
7415else
7416 val="$undef"
7417 if $test $i_sysfilio = "$define"; then
7418 echo '<sys/ioctl.h> NOT found.' >&4
7419 else
7420 $test $i_sgtty = "$define" && xxx="sgtty.h"
7421 $test $i_termio = "$define" && xxx="termio.h"
7422 $test $i_termios = "$define" && xxx="termios.h"
7423echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
7424 fi
7425fi
7426set i_sysioctl
7427eval $setvar
7428
7429: see if this is a sys/param system
7430set sys/param.h i_sysparam
7431eval $inhdr
7432
7433: see if this is a unistd.h system
7434set unistd.h i_unistd
7435eval $inhdr
7436
7437: see if this is an utime system
7438set utime.h i_utime
7439eval $inhdr
7440
2304df62 7441: see if this is a vfork system
85e6fe83 7442case "$d_vfork" in
a0d0e21e
LW
7443"$define")
7444 set vfork.h i_vfork
85e6fe83
LW
7445 eval $inhdr
7446 ;;
a0d0e21e
LW
7447*)
7448 i_vfork="$undef"
7449 ;;
85e6fe83 7450esac
a0d0e21e 7451
2304df62
AD
7452: end of configuration questions
7453echo " "
7454echo "End of configuration questions."
7455echo " "
7456
7457: back to where it started
7458if test -d ../UU; then
7459 cd ..
7460fi
7461
7462: configuration may be patched via a 'config.over' file
7463if $test -f config.over; then
7464 echo " "
7465 dflt=y
7466 rp='I see a config.over file. Do you wish to load it?'
7467 . UU/myread
7468 case "$ans" in
7469 n*) echo "OK, I'll ignore it.";;
7470 *) . ./config.over
7471 echo "Configuration override changes have been loaded."
7472 ;;
7473 esac
7474fi
7475
ecfc5424
AD
7476: in case they want portability, strip down executable paths
7477case "$d_portable" in
7478"$define")
7479 echo " "
7480 echo "Stripping down executable paths..." >&4
7481 for file in $loclist $trylist; do
7482 eval $file="\$file"
7483 done
7484 ;;
7485esac
7486
2304df62
AD
7487: create config.sh file
7488echo " "
7489echo "Creating config.sh..." >&4
7490$spitshell <<EOT >config.sh
7491$startsh
7492#
7493# This file was produced by running the Configure script. It holds all the
7494# definitions figured out by Configure. Should you modify one of these values,
7495# do not forget to propagate your changes by running "Configure -der". You may
7496# instead choose to run each of the .SH files by yourself, or "Configure -S".
7497#
7498
7499# Configuration time: $cf_time
7500# Configured by: $cf_by
7501# Target system: $myuname
7502
2304df62
AD
7503Author='$Author'
7504Date='$Date'
7505Header='$Header'
7506Id='$Id'
7507Locker='$Locker'
7508Log='$Log'
ecfc5424 7509Mcc='$Mcc'
2304df62
AD
7510RCSfile='$RCSfile'
7511Revision='$Revision'
7512Source='$Source'
7513State='$State'
7514afs='$afs'
a0d0e21e 7515alignbytes='$alignbytes'
ecfc5424 7516aphostname='$aphostname'
a0d0e21e
LW
7517archlib='$archlib'
7518archlibexp='$archlibexp'
7519archname='$archname'
ecfc5424
AD
7520awk='$awk'
7521baserev='$baserev'
7522bash='$bash'
2304df62
AD
7523bin='$bin'
7524binexp='$binexp'
ecfc5424
AD
7525bison='$bison'
7526byacc='$byacc'
2304df62 7527byteorder='$byteorder'
ecfc5424
AD
7528c='$c'
7529castflags='$castflags'
7530cat='$cat'
2304df62 7531cc='$cc'
ecfc5424
AD
7532cccdlflags='$cccdlflags'
7533ccdlflags='$ccdlflags'
2304df62 7534ccflags='$ccflags'
2304df62
AD
7535cf_by='$cf_by'
7536cf_time='$cf_time'
ecfc5424
AD
7537chgrp='$chgrp'
7538chmod='$chmod'
7539chown='$chown'
7540clocktype='$clocktype'
7541comm='$comm'
7542compress='$compress'
2304df62 7543contains='$contains'
ecfc5424
AD
7544cp='$cp'
7545cpio='$cpio'
7546cpp='$cpp'
a0d0e21e 7547cpp_stuff='$cpp_stuff'
ecfc5424 7548cppflags='$cppflags'
2304df62
AD
7549cpplast='$cpplast'
7550cppminus='$cppminus'
7551cpprun='$cpprun'
7552cppstdin='$cppstdin'
ecfc5424
AD
7553cryptlib='$cryptlib'
7554csh='$csh'
7555d_Gconvert='$d_Gconvert'
2304df62 7556d_access='$d_access'
a0d0e21e 7557d_alarm='$d_alarm'
ecfc5424
AD
7558d_archlib='$d_archlib'
7559d_attribut='$d_attribut'
2304df62
AD
7560d_bcmp='$d_bcmp'
7561d_bcopy='$d_bcopy'
ecfc5424
AD
7562d_bsd='$d_bsd'
7563d_bsdpgrp='$d_bsdpgrp'
2304df62
AD
7564d_bzero='$d_bzero'
7565d_casti32='$d_casti32'
2304df62 7566d_castneg='$d_castneg'
ecfc5424 7567d_charvspr='$d_charvspr'
a0d0e21e
LW
7568d_chown='$d_chown'
7569d_chroot='$d_chroot'
2304df62 7570d_chsize='$d_chsize'
a0d0e21e 7571d_closedir='$d_closedir'
2304df62 7572d_const='$d_const'
2304df62
AD
7573d_crypt='$d_crypt'
7574d_csh='$d_csh'
a0d0e21e
LW
7575d_cuserid='$d_cuserid'
7576d_dbl_dig='$d_dbl_dig'
7577d_difftime='$d_difftime'
ecfc5424 7578d_dirnamlen='$d_dirnamlen'
a0d0e21e
LW
7579d_dlerror='$d_dlerror'
7580d_dlopen='$d_dlopen'
7581d_dlsymun='$d_dlsymun'
2304df62 7582d_dosuid='$d_dosuid'
a0d0e21e 7583d_drem='$d_drem'
2304df62 7584d_dup2='$d_dup2'
ecfc5424 7585d_eunice='$d_eunice'
2304df62
AD
7586d_fchmod='$d_fchmod'
7587d_fchown='$d_fchown'
7588d_fcntl='$d_fcntl'
a0d0e21e
LW
7589d_fd_macros='$d_fd_macros'
7590d_fd_set='$d_fd_set'
7591d_fds_bits='$d_fds_bits'
7592d_fgetpos='$d_fgetpos'
2304df62
AD
7593d_flexfnam='$d_flexfnam'
7594d_flock='$d_flock'
a0d0e21e
LW
7595d_fmod='$d_fmod'
7596d_fork='$d_fork'
ecfc5424 7597d_fpathconf='$d_fpathconf'
a0d0e21e 7598d_fsetpos='$d_fsetpos'
2304df62
AD
7599d_getgrps='$d_getgrps'
7600d_gethent='$d_gethent'
2304df62 7601d_gethname='$d_gethname'
a0d0e21e 7602d_getlogin='$d_getlogin'
2304df62
AD
7603d_getpgrp2='$d_getpgrp2'
7604d_getpgrp='$d_getpgrp'
a0d0e21e 7605d_getppid='$d_getppid'
2304df62 7606d_getprior='$d_getprior'
a0d0e21e 7607d_group='$d_group'
2304df62 7608d_htonl='$d_htonl'
ecfc5424 7609d_index='$d_index'
2304df62
AD
7610d_isascii='$d_isascii'
7611d_killpg='$d_killpg'
7612d_link='$d_link'
a0d0e21e
LW
7613d_linuxstd='$d_linuxstd'
7614d_locconv='$d_locconv'
7615d_lockf='$d_lockf'
2304df62 7616d_lstat='$d_lstat'
a0d0e21e
LW
7617d_mblen='$d_mblen'
7618d_mbstowcs='$d_mbstowcs'
7619d_mbtowc='$d_mbtowc'
2304df62
AD
7620d_memcmp='$d_memcmp'
7621d_memcpy='$d_memcpy'
7622d_memmove='$d_memmove'
7623d_memset='$d_memset'
7624d_mkdir='$d_mkdir'
a0d0e21e
LW
7625d_mkfifo='$d_mkfifo'
7626d_mktime='$d_mktime'
2304df62
AD
7627d_msg='$d_msg'
7628d_msgctl='$d_msgctl'
7629d_msgget='$d_msgget'
7630d_msgrcv='$d_msgrcv'
7631d_msgsnd='$d_msgsnd'
ecfc5424 7632d_mymalloc='$d_mymalloc'
a0d0e21e 7633d_nice='$d_nice'
ecfc5424 7634d_oldsock='$d_oldsock'
2304df62 7635d_open3='$d_open3'
a0d0e21e 7636d_passwd='$d_passwd'
a0d0e21e
LW
7637d_pathconf='$d_pathconf'
7638d_pause='$d_pause'
ecfc5424 7639d_phostname='$d_phostname'
a0d0e21e 7640d_pipe='$d_pipe'
2304df62 7641d_portable='$d_portable'
ecfc5424
AD
7642d_pwage='$d_pwage'
7643d_pwchange='$d_pwchange'
7644d_pwclass='$d_pwclass'
7645d_pwcomment='$d_pwcomment'
7646d_pwexpire='$d_pwexpire'
7647d_pwquota='$d_pwquota'
2304df62 7648d_readdir='$d_readdir'
a0d0e21e 7649d_readlink='$d_readlink'
2304df62 7650d_rename='$d_rename'
ecfc5424 7651d_rewinddir='$d_rewinddir'
2304df62
AD
7652d_rmdir='$d_rmdir'
7653d_safebcpy='$d_safebcpy'
7654d_safemcpy='$d_safemcpy'
ecfc5424 7655d_seekdir='$d_seekdir'
2304df62
AD
7656d_select='$d_select'
7657d_sem='$d_sem'
7658d_semctl='$d_semctl'
7659d_semget='$d_semget'
7660d_semop='$d_semop'
7661d_setegid='$d_setegid'
7662d_seteuid='$d_seteuid'
a0d0e21e 7663d_setlinebuf='$d_setlinebuf'
2304df62
AD
7664d_setlocale='$d_setlocale'
7665d_setpgid='$d_setpgid'
7666d_setpgrp2='$d_setpgrp2'
2304df62
AD
7667d_setpgrp='$d_setpgrp'
7668d_setprior='$d_setprior'
7669d_setregid='$d_setregid'
7670d_setresgid='$d_setresgid'
7671d_setresuid='$d_setresuid'
7672d_setreuid='$d_setreuid'
7673d_setrgid='$d_setrgid'
7674d_setruid='$d_setruid'
7675d_setsid='$d_setsid'
7676d_shm='$d_shm'
7677d_shmat='$d_shmat'
a0d0e21e 7678d_shmatprototype='$d_shmatprototype'
2304df62
AD
7679d_shmctl='$d_shmctl'
7680d_shmdt='$d_shmdt'
7681d_shmget='$d_shmget'
ecfc5424 7682d_shrplib='$d_shrplib'
2304df62
AD
7683d_socket='$d_socket'
7684d_sockpair='$d_sockpair'
2304df62
AD
7685d_statblks='$d_statblks'
7686d_stdstdio='$d_stdstdio'
2304df62 7687d_strchr='$d_strchr'
a0d0e21e 7688d_strcoll='$d_strcoll'
2304df62
AD
7689d_strctcpy='$d_strctcpy'
7690d_strerrm='$d_strerrm'
7691d_strerror='$d_strerror'
a0d0e21e 7692d_strxfrm='$d_strxfrm'
ecfc5424 7693d_suidsafe='$d_suidsafe'
2304df62
AD
7694d_symlink='$d_symlink'
7695d_syscall='$d_syscall'
a0d0e21e 7696d_sysconf='$d_sysconf'
ecfc5424
AD
7697d_sysernlst='$d_sysernlst'
7698d_syserrlst='$d_syserrlst'
2304df62 7699d_system='$d_system'
a0d0e21e
LW
7700d_tcgetpgrp='$d_tcgetpgrp'
7701d_tcsetpgrp='$d_tcsetpgrp'
ecfc5424 7702d_telldir='$d_telldir'
85e6fe83 7703d_time='$d_time'
2304df62
AD
7704d_times='$d_times'
7705d_truncate='$d_truncate'
a0d0e21e
LW
7706d_tzname='$d_tzname'
7707d_umask='$d_umask'
ecfc5424 7708d_uname='$d_uname'
2304df62 7709d_vfork='$d_vfork'
ecfc5424 7710d_void_closedir='$d_void_closedir'
2304df62 7711d_voidsig='$d_voidsig'
ecfc5424 7712d_voidtty='$d_voidtty'
2304df62 7713d_volatile='$d_volatile'
2304df62
AD
7714d_vprintf='$d_vprintf'
7715d_wait4='$d_wait4'
7716d_waitpid='$d_waitpid'
a0d0e21e
LW
7717d_wcstombs='$d_wcstombs'
7718d_wctomb='$d_wctomb'
ecfc5424
AD
7719d_xenix='$d_xenix'
7720date='$date'
7721db_hashtype='$db_hashtype'
7722db_prefixtype='$db_prefixtype'
7723defvoidused='$defvoidused'
7724direntrytype='$direntrytype'
a0d0e21e 7725dlext='$dlext'
2304df62 7726dlsrc='$dlsrc'
ecfc5424
AD
7727dynamic_ext='$dynamic_ext'
7728echo='$echo'
7729egrep='$egrep'
7730emacs='$emacs'
7731eunicefix='$eunicefix'
7732expr='$expr'
7733extensions='$extensions'
7734find='$find'
7735flex='$flex'
a0d0e21e 7736fpostype='$fpostype'
ecfc5424
AD
7737gcc='$gcc'
7738gccversion='$gccversion'
2304df62 7739gidtype='$gidtype'
ecfc5424
AD
7740glibpth='$glibpth'
7741grep='$grep'
7742groupcat='$groupcat'
2304df62
AD
7743groupstype='$groupstype'
7744h_fcntl='$h_fcntl'
7745h_sysfile='$h_sysfile'
ecfc5424
AD
7746hint='$hint'
7747hostcat='$hostcat'
7748huge='$huge'
7749i_bsdioctl='$i_bsdioctl'
a0d0e21e 7750i_db='$i_db'
2304df62 7751i_dbm='$i_dbm'
2304df62 7752i_dirent='$i_dirent'
a0d0e21e 7753i_dld='$i_dld'
2304df62
AD
7754i_dlfcn='$i_dlfcn'
7755i_fcntl='$i_fcntl'
a0d0e21e 7756i_float='$i_float'
2304df62
AD
7757i_gdbm='$i_gdbm'
7758i_grp='$i_grp'
a0d0e21e
LW
7759i_limits='$i_limits'
7760i_malloc='$i_malloc'
7761i_math='$i_math'
85e6fe83 7762i_memory='$i_memory'
2304df62 7763i_ndbm='$i_ndbm'
85e6fe83 7764i_neterrno='$i_neterrno'
2304df62 7765i_niin='$i_niin'
2304df62 7766i_pwd='$i_pwd'
ecfc5424
AD
7767i_sgtty='$i_sgtty'
7768i_stdarg='$i_stdarg'
2304df62 7769i_stddef='$i_stddef'
a0d0e21e 7770i_stdlib='$i_stdlib'
2304df62 7771i_string='$i_string'
2304df62
AD
7772i_sysdir='$i_sysdir'
7773i_sysfile='$i_sysfile'
a0d0e21e 7774i_sysfilio='$i_sysfilio'
ecfc5424 7775i_sysin='$i_sysin'
2304df62 7776i_sysioctl='$i_sysioctl'
2304df62 7777i_sysndir='$i_sysndir'
a0d0e21e 7778i_sysparam='$i_sysparam'
2304df62 7779i_sysselct='$i_sysselct'
ecfc5424
AD
7780i_syssockio='$i_syssockio'
7781i_systime='$i_systime'
7782i_systimek='$i_systimek'
a0d0e21e 7783i_systimes='$i_systimes'
2304df62
AD
7784i_termio='$i_termio'
7785i_termios='$i_termios'
2304df62 7786i_time='$i_time'
85e6fe83 7787i_unistd='$i_unistd'
2304df62
AD
7788i_utime='$i_utime'
7789i_varargs='$i_varargs'
7790i_varhdr='$i_varhdr'
7791i_vfork='$i_vfork'
ecfc5424
AD
7792incpath='$incpath'
7793inews='$inews'
7794installarchlib='$installarchlib'
7795installbin='$installbin'
7796installmansrc='$installmansrc'
7797installprivlib='$installprivlib'
7798installscript='$installscript'
2304df62 7799intsize='$intsize'
ecfc5424
AD
7800known_extensions='$known_extensions'
7801ksh='$ksh'
7802large='$large'
7803lddlflags='$lddlflags'
7804ldflags='$ldflags'
7805less='$less'
2304df62
AD
7806libc='$libc'
7807libpth='$libpth'
2304df62 7808libs='$libs'
ecfc5424
AD
7809libswanted='$libswanted'
7810line='$line'
7811lint='$lint'
7812lkflags='$lkflags'
7813ln='$ln'
85e6fe83 7814lns='$lns'
ecfc5424
AD
7815lp='$lp'
7816lpr='$lpr'
7817ls='$ls'
85e6fe83 7818lseektype='$lseektype'
ecfc5424
AD
7819mail='$mail'
7820mailx='$mailx'
7821make='$make'
2304df62
AD
7822mallocobj='$mallocobj'
7823mallocsrc='$mallocsrc'
7824malloctype='$malloctype'
2304df62
AD
7825manext='$manext'
7826mansrc='$mansrc'
7827mansrcexp='$mansrcexp'
2304df62 7828medium='$medium'
ecfc5424
AD
7829mips='$mips'
7830mips_type='$mips_type'
7831mkdir='$mkdir'
2304df62 7832models='$models'
a0d0e21e 7833modetype='$modetype'
ecfc5424
AD
7834more='$more'
7835mv='$mv'
2304df62
AD
7836mydomain='$mydomain'
7837myhostname='$myhostname'
ecfc5424 7838myuname='$myuname'
2304df62 7839n='$n'
ecfc5424
AD
7840nm_opt='$nm_opt'
7841nroff='$nroff'
7842optimize='$optimize'
85e6fe83 7843orderlib='$orderlib'
ecfc5424
AD
7844osname='$osname'
7845osvers='$osvers'
2304df62 7846package='$package'
ecfc5424
AD
7847passcat='$passcat'
7848patchlevel='$patchlevel'
7849perl='$perl'
7850pg='$pg'
7851phostname='$phostname'
7852plibpth='$plibpth'
7853pmake='$pmake'
7854pr='$pr'
a0d0e21e 7855prefix='$prefix'
2304df62
AD
7856privlib='$privlib'
7857privlibexp='$privlibexp'
7858prototype='$prototype'
7859randbits='$randbits'
ecfc5424
AD
7860ranlib='$ranlib'
7861rm='$rm'
7862rmail='$rmail'
7863runnm='$runnm'
2304df62
AD
7864scriptdir='$scriptdir'
7865scriptdirexp='$scriptdirexp'
ecfc5424 7866sed='$sed'
a0d0e21e 7867selecttype='$selecttype'
ecfc5424
AD
7868sendmail='$sendmail'
7869sh='$sh'
7870shar='$shar'
7871sharpbang='$sharpbang'
7872shmattype='$shmattype'
7873shrpdir='$shrpdir'
7874shsharp='$shsharp'
2304df62 7875sig_name='$sig_name'
ecfc5424 7876signal_t='$signal_t'
a0d0e21e 7877sizetype='$sizetype'
ecfc5424
AD
7878sleep='$sleep'
7879smail='$smail'
7880small='$small'
a0d0e21e 7881so='$so'
ecfc5424
AD
7882sockethdr='$sockethdr'
7883socketlib='$socketlib'
7884sort='$sort'
7885spackage='$spackage'
2304df62 7886spitshell='$spitshell'
ecfc5424 7887split='$split'
a0d0e21e 7888ssizetype='$ssizetype'
2304df62 7889startsh='$startsh'
ecfc5424 7890static_ext='$static_ext'
2304df62 7891stdchar='$stdchar'
ecfc5424
AD
7892strings='$strings'
7893submit='$submit'
2304df62 7894sysman='$sysman'
ecfc5424
AD
7895tail='$tail'
7896tar='$tar'
7897tbl='$tbl'
7898test='$test'
7899timeincl='$timeincl'
7900timetype='$timetype'
7901touch='$touch'
7902tr='$tr'
7903troff='$troff'
2304df62 7904uidtype='$uidtype'
ecfc5424
AD
7905uname='$uname'
7906uniq='$uniq'
7907usedl='$usedl'
7908usemymalloc='$usemymalloc'
2304df62 7909usenm='$usenm'
ecfc5424
AD
7910useposix='$useposix'
7911usevfork='$usevfork'
2304df62 7912usrinc='$usrinc'
ecfc5424
AD
7913uuname='$uuname'
7914vi='$vi'
2304df62 7915voidflags='$voidflags'
ecfc5424
AD
7916xlibpth='$xlibpth'
7917zcat='$zcat'
2304df62
AD
7918EOT
7919
7920: add special variables
7921$test -f patchlevel.h && \
7922awk '/^#define/ {printf "%s=%s\n",$2,$3}' patchlevel.h >>config.sh
7923echo "CONFIG=true" >>config.sh
7924
7925: propagate old symbols
7926if $test -f UU/config.sh; then
7927 <UU/config.sh sort | uniq >UU/oldconfig.sh
7928 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
7929 sort | uniq -u >UU/oldsyms
7930 set X `cat UU/oldsyms`
7931 shift
7932 case $# in
7933 0) ;;
7934 *)
7935 cat <<EOM
7936Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
7937EOM
7938 echo "# Variables propagated from previous config.sh file." >>config.sh
7939 for sym in `cat UU/oldsyms`; do
7940 echo " Propagating $hint variable "'$'"$sym..."
7941 eval 'tmp="$'"${sym}"'"'
7942 echo "$tmp" | \
7943 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
7944 done
7945 ;;
7946 esac
7947fi
7948
7949: Finish up by extracting the .SH files
7950case "$alldone" in
7951exit)
7952 $rm -rf UU
7953 echo "Done."
7954 exit 0
7955 ;;
7956cont)
7957 ;;
7958'')
7959 echo " "
7960 dflt=''
7961 nostick=true
7962echo "If you didn't make any mistakes, then just type a carriage return here."
7963 rp="If you need to edit config.sh, do it as a shell escape here:"
7964 . UU/myread
7965 nostick=''
7966 case "$ans" in
7967 '') ;;
7968 *) : in case they cannot read
7969 sh 1>&4 -c "$ans";;
7970 esac
7971 ;;
7972esac
7973
7974: if this fails, just run all the .SH files by hand
7975. ./config.sh
7976
7977echo " "
7978exec 1>&4
7979. ./UU/extract
7980
7981if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
7982 dflt=y
7983 case "$silent" in
7984 true) ;;
7985 *)
7986 $cat <<EOM
7987
7988Now you need to generate make dependencies by running "make depend".
7989You might prefer to run it in background: "make depend > makedepend.out &"
7990It can take a while, so you might not want to run it right now.
7991
7992EOM
7993 ;;
7994 esac
7995 rp="Run make depend now?"
7996 . UU/myread
7997 case "$ans" in
7998 y*)
7999 make depend && echo "Now you must run a make."
8000 ;;
8001 *)
8002 echo "You must run 'make depend' then 'make'."
8003 ;;
8004 esac
8005elif test -f [Mm]akefile; then
8006 echo " "
8007 echo "Now you must run a make."
8008else
8009 echo "Done."
8010fi
8011
8012$rm -f kit*isdone ark*isdone
8013$rm -rf UU
a0d0e21e 8014
2304df62 8015: End of Configure
a0d0e21e 8016