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