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