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