This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
This is my patch patch.1n 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
8e07c86e 21# $Id: Head.U,v 3.0.1.8 1995/07/25 13:40:02 ram Exp $
2304df62 22#
8e07c86e 23# Generated on Thu Oct 19 10:47:09 EDT 1995 [metaconfig 3.0 PL58]
2304df62
AD
24
25cat >/tmp/c1$$ <<EOF
26ARGGGHHHH!!!!!
27
28SCO csh still thinks true is false. Write to SCO today and tell them that next
29year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
30
31(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
32we'd have to do is go in and swap the && and || tokens, wherever they are.)
33
34[End of diatribe. We now return you to your regularly scheduled programming...]
35EOF
36cat >/tmp/c2$$ <<EOF
37
38OOPS! You naughty creature! You didn't run Configure with sh!
39I will attempt to remedy the situation by running sh for you...
40EOF
41
42true || cat /tmp/c1$$ /tmp/c2$$
43true || exec sh $0 $argv:q
44
45(exit $?0) || cat /tmp/c2$$
46(exit $?0) || exec sh $0 $argv:q
47rm -f /tmp/c1$$ /tmp/c2$$
48
a0d0e21e
LW
49: compute my invocation name
50me=$0
51case "$0" in
52*/*)
53 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
54 test "$me" || me=$0
55 ;;
56esac
57
8e07c86e
AD
58: Proper PATH separator
59p_=:
60: On OS/2 this directory should exist if this is not floppy only system :-]
61if test -d c:/.; then
62 p_=\;
63 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
64 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
65fi
a0d0e21e
LW
66
67: Proper PATH setting
68paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
16d20bd9 69paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
232e078e 70paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
16d20bd9 71paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
232e078e
AD
72paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
73paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
74paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
75paths="$paths /sbin /usr/sbin /usr/libexec"
a0d0e21e
LW
76
77for p in $paths
78do
8e07c86e
AD
79 case "$p_$PATH$p_" in
80 *$p_$p$p_*) ;;
81 *) test -d $p && PATH=$PATH$p_$p ;;
a0d0e21e
LW
82 esac
83done
84
8e07c86e 85PATH=.$p_$PATH
2304df62
AD
86export PATH
87
a0d0e21e 88: Sanity checks
2304df62 89if test ! -t 0; then
a0d0e21e 90 echo "Say 'sh $me', not 'sh <$me'"
2304df62
AD
91 exit 1
92fi
93
94: On HP-UX, large Configure scripts may exercise a bug in /bin/sh
95if test -f /hp-ux -a -f /bin/ksh; then
96 if (PATH=.; alias -x) >/dev/null 2>&1; then
97 : already under /bin/ksh
98 else
99 cat <<'EOM'
100(Feeding myself to ksh to avoid nasty sh bug in "here document" expansion.)
101EOM
ecfc5424 102 unset ENV
2304df62
AD
103 exec /bin/ksh $0 "$@"
104 fi
105else
106 : Warn them if they use ksh on other systems
107 (PATH=.; alias -x) >/dev/null 2>&1 && \
a0d0e21e
LW
108 cat <<EOM
109(I see you are using the Korn shell. Some ksh's blow up on $me,
2304df62
AD
110especially on exotic machines. If yours does, try the Bourne shell instead.)
111EOM
112fi
113
114: Configure runs within the UU subdirectory
115test -d UU || mkdir UU
8e07c86e 116cd UU && rm -f ./*
2304df62 117
a0d0e21e 118dynamic_ext=''
2304df62 119extensions=''
a0d0e21e
LW
120known_extensions=''
121static_ext=''
122useposix=''
ecfc5424 123d_bsd=''
2304df62
AD
124d_eunice=''
125d_xenix=''
126eunicefix=''
127Mcc=''
128awk=''
129bash=''
130bison=''
131byacc=''
132cat=''
133chgrp=''
134chmod=''
135chown=''
ecfc5424 136comm=''
2304df62
AD
137compress=''
138cp=''
139cpio=''
140cpp=''
141csh=''
142date=''
143echo=''
144egrep=''
145emacs=''
146expr=''
147find=''
148flex=''
149gcc=''
150grep=''
151inews=''
152ksh=''
153less=''
154line=''
155lint=''
156ln=''
157lp=''
158lpr=''
159ls=''
160mail=''
161mailx=''
162make=''
163mkdir=''
164more=''
165mv=''
166nroff=''
167perl=''
168pg=''
169pmake=''
170pr=''
171rm=''
172rmail=''
173sed=''
174sendmail=''
175sh=''
176shar=''
177sleep=''
178smail=''
179sort=''
180submit=''
181tail=''
182tar=''
183tbl=''
184test=''
185touch=''
186tr=''
187troff=''
188uname=''
189uniq=''
190uuname=''
191vi=''
192zcat=''
1aef975c 193full_sed=''
a0d0e21e 194libswanted=''
2304df62
AD
195hint=''
196myuname=''
85e6fe83
LW
197osname=''
198osvers=''
2304df62
AD
199Author=''
200Date=''
201Header=''
202Id=''
203Locker=''
204Log=''
205RCSfile=''
206Revision=''
207Source=''
208State=''
209afs=''
a0d0e21e
LW
210alignbytes=''
211archlib=''
212archlibexp=''
a0d0e21e
LW
213d_archlib=''
214installarchlib=''
40000a8c
AD
215archname=''
216myarchname=''
ecfc5424 217baserev=''
2304df62
AD
218bin=''
219binexp=''
220installbin=''
221byteorder=''
222cc=''
223gccversion=''
224ccflags=''
225cppflags=''
226ldflags=''
227lkflags=''
8e07c86e 228locincpth=''
2304df62 229optimize=''
8e07c86e 230cf_email=''
2304df62
AD
231cf_by=''
232cf_time=''
233contains=''
a0d0e21e 234cpp_stuff=''
2304df62
AD
235cpplast=''
236cppminus=''
237cpprun=''
238cppstdin=''
239d_access=''
a0d0e21e 240d_alarm=''
ecfc5424 241d_attribut=''
2304df62
AD
242d_bcmp=''
243d_bcopy=''
244d_bzero=''
245d_casti32=''
246castflags=''
247d_castneg=''
a0d0e21e
LW
248d_chown=''
249d_chroot=''
2304df62 250d_chsize=''
a0d0e21e
LW
251d_closedir=''
252d_void_closedir=''
2304df62
AD
253d_const=''
254cryptlib=''
255d_crypt=''
256d_csh=''
1aef975c 257full_csh=''
a0d0e21e
LW
258d_cuserid=''
259d_dbl_dig=''
260d_difftime=''
261d_dlerror=''
262d_dlopen=''
263d_dlsymun=''
2304df62 264d_dosuid=''
a0d0e21e 265d_suidsafe=''
2304df62
AD
266d_dup2=''
267d_fchmod=''
268d_fchown=''
269d_fcntl=''
a0d0e21e
LW
270d_fd_macros=''
271d_fd_set=''
272d_fds_bits=''
273d_fgetpos=''
2304df62
AD
274d_flexfnam=''
275d_flock=''
a0d0e21e
LW
276d_fork=''
277d_fsetpos=''
278d_Gconvert=''
2304df62
AD
279d_getgrps=''
280d_gethent=''
281aphostname=''
282d_gethname=''
283d_phostname=''
284d_uname=''
a0d0e21e 285d_getlogin=''
2304df62
AD
286d_getpgrp2=''
287d_getpgrp=''
a0d0e21e 288d_getppid=''
2304df62
AD
289d_getprior=''
290d_htonl=''
291d_isascii=''
292d_killpg=''
293d_link=''
a0d0e21e
LW
294d_locconv=''
295d_lockf=''
2304df62 296d_lstat=''
a0d0e21e
LW
297d_mblen=''
298d_mbstowcs=''
299d_mbtowc=''
2304df62
AD
300d_memcmp=''
301d_memcpy=''
302d_memmove=''
303d_memset=''
304d_mkdir=''
a0d0e21e
LW
305d_mkfifo=''
306d_mktime=''
2304df62
AD
307d_msg=''
308d_msgctl=''
309d_msgget=''
310d_msgrcv=''
311d_msgsnd=''
a0d0e21e 312d_nice=''
2304df62 313d_open3=''
a0d0e21e
LW
314d_fpathconf=''
315d_pathconf=''
316d_pause=''
317d_pipe=''
8e07c86e 318d_poll=''
2304df62
AD
319d_portable=''
320d_readdir=''
85e6fe83
LW
321d_rewinddir=''
322d_seekdir=''
323d_telldir=''
a0d0e21e 324d_readlink=''
2304df62
AD
325d_rename=''
326d_rmdir=''
327d_safebcpy=''
328d_safemcpy=''
329d_select=''
330d_sem=''
331d_semctl=''
332d_semget=''
333d_semop=''
334d_setegid=''
335d_seteuid=''
a0d0e21e 336d_setlinebuf=''
2304df62
AD
337d_setlocale=''
338d_setpgid=''
339d_setpgrp2=''
340d_bsdpgrp=''
341d_setpgrp=''
342d_setprior=''
343d_setregid=''
344d_setresgid=''
345d_setresuid=''
346d_setreuid=''
347d_setrgid=''
348d_setruid=''
349d_setsid=''
350d_shm=''
351d_shmat=''
a0d0e21e
LW
352d_shmatprototype=''
353shmattype=''
2304df62
AD
354d_shmctl=''
355d_shmdt=''
356d_shmget=''
357d_oldsock=''
358d_socket=''
359d_sockpair=''
360sockethdr=''
361socketlib=''
362d_statblks=''
c2960299
AD
363d_stdio_cnt_lval=''
364d_stdio_ptr_lval=''
16d20bd9 365d_stdiobase=''
2304df62 366d_stdstdio=''
16d20bd9
AD
367stdio_base=''
368stdio_bufsiz=''
369stdio_cnt=''
370stdio_ptr=''
2304df62
AD
371d_index=''
372d_strchr=''
a0d0e21e 373d_strcoll=''
2304df62
AD
374d_strctcpy=''
375d_strerrm=''
376d_strerror=''
377d_sysernlst=''
378d_syserrlst=''
a0d0e21e 379d_strxfrm=''
2304df62
AD
380d_symlink=''
381d_syscall=''
a0d0e21e 382d_sysconf=''
2304df62 383d_system=''
a0d0e21e
LW
384d_tcgetpgrp=''
385d_tcsetpgrp=''
85e6fe83
LW
386d_time=''
387timetype=''
2304df62
AD
388clocktype=''
389d_times=''
390d_truncate=''
a0d0e21e
LW
391d_tzname=''
392d_umask=''
2304df62 393d_vfork=''
a0d0e21e 394usevfork=''
2304df62
AD
395d_voidsig=''
396signal_t=''
397d_volatile=''
398d_charvspr=''
399d_vprintf=''
400d_wait4=''
401d_waitpid=''
a0d0e21e
LW
402d_wcstombs=''
403d_wctomb=''
404dlext=''
85e6fe83
LW
405cccdlflags=''
406ccdlflags=''
ecfc5424 407d_shrplib=''
2304df62 408dlsrc=''
232e078e 409ld=''
85e6fe83 410lddlflags=''
ecfc5424 411shrpdir=''
2304df62 412usedl=''
a0d0e21e 413fpostype=''
2304df62
AD
414gidtype=''
415groupstype=''
416h_fcntl=''
417h_sysfile=''
ecfc5424
AD
418db_hashtype=''
419db_prefixtype=''
a0d0e21e 420i_db=''
2304df62 421i_dbm=''
8e07c86e 422i_rpcsvcdbm=''
2304df62 423d_dirnamlen=''
a0d0e21e 424direntrytype=''
2304df62 425i_dirent=''
a0d0e21e 426i_dld=''
2304df62
AD
427i_dlfcn=''
428i_fcntl=''
a0d0e21e 429i_float=''
2304df62
AD
430i_gdbm=''
431i_grp=''
a0d0e21e
LW
432i_limits=''
433i_malloc=''
434i_math=''
85e6fe83 435i_memory=''
2304df62 436i_ndbm=''
85e6fe83 437i_neterrno=''
2304df62
AD
438i_niin=''
439i_sysin=''
440d_pwage=''
441d_pwchange=''
442d_pwclass=''
443d_pwcomment=''
444d_pwexpire=''
445d_pwquota=''
446i_pwd=''
2304df62 447i_stddef=''
a0d0e21e 448i_stdlib=''
2304df62
AD
449i_string=''
450strings=''
451i_sysdir=''
452i_sysfile=''
453d_voidtty=''
454i_bsdioctl=''
a0d0e21e 455i_sysfilio=''
2304df62
AD
456i_sysioctl=''
457i_syssockio=''
458i_sysndir=''
a0d0e21e 459i_sysparam=''
2304df62 460i_sysselct=''
1aef975c 461i_sysstat=''
a0d0e21e 462i_systimes=''
fed7345c 463i_systypes=''
2304df62
AD
464i_sgtty=''
465i_termio=''
466i_termios=''
467i_systime=''
468i_systimek=''
469i_time=''
470timeincl=''
85e6fe83 471i_unistd=''
2304df62 472i_utime=''
a0d0e21e 473i_stdarg=''
2304df62
AD
474i_varargs=''
475i_varhdr=''
476i_vfork=''
477intsize=''
2304df62 478libc=''
a0d0e21e 479glibpth=''
2304df62 480libpth=''
8e07c86e 481loclibpth=''
2304df62
AD
482plibpth=''
483xlibpth=''
484libs=''
85e6fe83
LW
485lns=''
486lseektype=''
487d_mymalloc=''
94b6baf5 488freetype=''
2304df62
AD
489mallocobj=''
490mallocsrc=''
491malloctype=''
492usemymalloc=''
16d20bd9
AD
493installman1dir=''
494man1dir=''
495man1direxp=''
496man1ext=''
497installman3dir=''
498man3dir=''
499man3direxp=''
500man3ext=''
2304df62
AD
501huge=''
502large=''
503medium=''
504models=''
505small=''
506split=''
a0d0e21e 507modetype=''
2304df62
AD
508mydomain=''
509myhostname=''
510phostname=''
511c=''
512n=''
8e07c86e
AD
513d_eofnblk=''
514eagain=''
515o_nonblock=''
516rd_nodata=''
2304df62
AD
517groupcat=''
518hostcat=''
519passcat=''
85e6fe83
LW
520orderlib=''
521ranlib=''
2304df62
AD
522package=''
523spackage=''
ecfc5424 524patchlevel=''
8e07c86e 525perladmin=''
a0d0e21e 526prefix=''
1aef975c 527prefixexp=''
2304df62
AD
528installprivlib=''
529privlib=''
530privlibexp=''
531prototype=''
532randbits=''
533installscript=''
534scriptdir=''
535scriptdirexp=''
a0d0e21e 536selecttype=''
2304df62 537sig_name=''
8e07c86e
AD
538sig_max=''
539sig_num=''
16d20bd9
AD
540d_sitelib=''
541installsitelib=''
542sitelib=''
543sitelibexp=''
a0d0e21e
LW
544sizetype=''
545so=''
2304df62
AD
546sharpbang=''
547shsharp=''
548spitshell=''
a0d0e21e 549ssizetype=''
2304df62
AD
550startsh=''
551stdchar=''
552sysman=''
553uidtype=''
554nm_opt=''
555runnm=''
556usenm=''
557incpath=''
558mips=''
559mips_type=''
560usrinc=''
561defvoidused=''
562voidflags=''
2304df62
AD
563CONFIG=''
564
ecfc5424
AD
565define='define'
566undef='undef'
567smallmach='pdp11 i8086 z8000 i80286 iAPX286'
568rmlist=''
569
570: We must find out about Eunice early
571eunicefix=':'
572if test -f /etc/unixtovms; then
573 eunicefix=/etc/unixtovms
574fi
575if test -f /etc/unixtovms.exe; then
576 eunicefix=/etc/unixtovms.exe
577fi
578
579: list of known cpp symbols, sorted alphabetically
580al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
581al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
582al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
583al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
584al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
585al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
586al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
587al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
588al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
589al="$al VMS Xenix286"
590al="$al _AIX _AIX32 _AIX370 _AM29000 _COFF _CRAY _CX_UX _EPI"
591al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET"
592al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
593al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
594al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
595al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
596al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
597al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
598al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
599al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
600al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
601al="$al __SVR4_2__ __UMAXV__"
602al="$al ____386BSD____ __alpha __alpha__ __amiga"
603al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
604al="$al __host_mips__"
605al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
606al="$al __hp9000s500 __hp9000s700 __hp9000s800"
607al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
608al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
609al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
610al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
611al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
612al="$al __mc88100 __mc88100__ __mips __mips__"
613al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
614al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
615al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
616al="$al _host_mips _mips _unix"
617al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
618al="$al apollo ardent att386 att3b"
619al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
620al="$al cadmus clipper concurrent convex cray ctix"
621al="$al dmert encore gcos gcx gimpel gould"
622al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
623al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
624al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
625al="$al i186 i286 i386 i486 i8086"
626al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
627al="$al ksr1 linux luna luna88k m68k m88100 m88k"
628al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
629al="$al mc68040 mc68060 mc68k mc68k32 mc700"
630al="$al mc88000 mc88100 merlin mert mips mvs n16"
631al="$al ncl_el ncl_mr"
632al="$al news1500 news1700 news1800 news1900 news3700"
633al="$al news700 news800 news900 ns16000 ns32000"
634al="$al ns32016 ns32332 ns32k nsc32000 os osf"
635al="$al parisc pc532 pdp11 plexus posix pyr"
636al="$al riscix riscos scs sequent sgi sinix sony sony_news"
637al="$al sonyrisc sparc sparclite spectrum stardent stratos"
638al="$al sun sun3 sun386 svr4 sysV68 sysV88"
639al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
640al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
641al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
642al="$al xenix z8000"
643
ecfc5424
AD
644groupstype=''
645i_whoami=''
8e07c86e
AD
646: default library list
647libswanted=''
648: set useposix=false in your hint file to disable the POSIX extension.
649useposix=true
650: Possible local include directories to search.
651locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
652locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
653:
654: no include file wanted by default
655inclwanted=''
656
ecfc5424
AD
657: change the next line if compiling for Xenix/286 on Xenix/386
658xlibpth='/usr/lib/386 /lib/386'
659
8e07c86e
AD
660: Possible local library directories to search.
661loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
662loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
663
ecfc5424 664: general looking path for locating libraries
8e07c86e
AD
665glibpth="/lib/pa1.1 /usr/shlib /usr/lib/large /lib /usr/lib"
666glibpth="$glibpth $xlibpth /lib/large /usr/lib/small /lib/small"
667glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/shlib"
ecfc5424
AD
668
669: Private path used by Configure to find libraries. Its value
670: is prepended to libpth. This variable takes care of special
671: machines, like the mips. Usually, it should be empty.
672plibpth=''
673
ecfc5424
AD
674: full support for void wanted by default
675defvoidused=15
676
ecfc5424
AD
677: List of libraries we want.
678libswanted='net socket inet nsl nm ndbm gdbm dbm db malloc dl'
679libswanted="$libswanted dld ld sun m c cposix posix ndir dir crypt"
680libswanted="$libswanted ucb bsd BSD PW x"
1aef975c 681: We probably want to search /usr/shlib before most other libraries.
94b6baf5 682: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
683glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
684glibpth="/usr/shlib $glibpth"
685: Do not use vfork unless overridden by a hint file.
686usevfork=false
687
2304df62
AD
688: script used to extract .SH files with variable substitutions
689cat >extract <<'EOS'
690CONFIG=true
691echo "Doing variable substitutions on .SH files..."
692if test -f MANIFEST; then
a0d0e21e
LW
693 shlist=`awk '{print $1}' <MANIFEST | grep '\.SH'`
694 : Pick up possible extension manifests.
695 for dir in ext/* ; do
696 if test -f $dir/MANIFEST; then
697 xxx=`awk '{print $1}' < $dir/MANIFEST |
698 sed -n "/\.SH$/ s@^@$dir/@p"`
699 shlist="$shlist $xxx"
700 fi
701 done
702 set x $shlist
2304df62
AD
703else
704 echo "(Looking for .SH files under the current directory.)"
705 set x `find . -name "*.SH" -print`
706fi
707shift
708case $# in
7090) set x *.SH; shift;;
710esac
711if test ! -f $1; then
712 shift
713fi
714for file in $*; do
715 case "$file" in
716 */*)
717 dir=`expr X$file : 'X\(.*\)/'`
718 file=`expr X$file : 'X.*/\(.*\)'`
719 (cd $dir && . ./$file)
720 ;;
721 *)
722 . ./$file
723 ;;
724 esac
725done
726if test -f config_h.SH; then
727 if test ! -f config.h; then
728 : oops, they left it out of MANIFEST, probably, so do it anyway.
729 . ./config_h.SH
730 fi
731fi
732EOS
733
734: produce awk script to parse command line options
735cat >options.awk <<'EOF'
736BEGIN {
16d20bd9 737 optstr = "dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
738
739 len = length(optstr);
740 for (i = 1; i <= len; i++) {
741 c = substr(optstr, i, 1);
742 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
743 if (a == ":") {
744 arg[c] = 1;
745 i++;
746 }
747 opt[c] = 1;
748 }
749}
750{
751 expect = 0;
752 str = $0;
753 if (substr(str, 1, 1) != "-") {
754 printf("'%s'\n", str);
755 next;
756 }
757 len = length($0);
758 for (i = 2; i <= len; i++) {
759 c = substr(str, i, 1);
760 if (!opt[c]) {
761 printf("-%s\n", substr(str, i));
762 next;
763 }
764 printf("-%s\n", c);
765 if (arg[c]) {
766 if (i < len)
767 printf("'%s'\n", substr(str, i + 1));
768 else
769 expect = 1;
770 next;
771 }
772 }
773}
774END {
775 if (expect)
776 print "?";
777}
778EOF
779
780: process the command line options
781set X `for arg in "$@"; do echo $arg; done | awk -f options.awk`
782eval "set $*"
783shift
784rm -f options.awk
785
786: set up default values
787fastread=''
788reuseval=false
789config_sh=''
790alldone=''
791error=''
792silent=''
793extractsh=''
ecfc5424 794override=''
16d20bd9 795knowitall=''
1aef975c 796rm -f optdef.sh
2304df62
AD
797
798: option parsing
799while test $# -gt 0; do
800 case "$1" in
801 -d) shift; fastread=yes;;
802 -e) shift; alldone=cont;;
803 -f)
804 shift
805 cd ..
806 if test -r "$1"; then
807 config_sh="$1"
808 else
a0d0e21e 809 echo "$me: cannot read config file $1." >&2
2304df62
AD
810 error=true
811 fi
812 cd UU
813 shift;;
814 -h) shift; error=true;;
815 -r) shift; reuseval=true;;
816 -s) shift; silent=true;;
817 -E) shift; alldone=exit;;
16d20bd9 818 -K) shift; knowitall=true;;
ecfc5424 819 -O) shift; override=true;;
2304df62 820 -S) shift; extractsh=true;;
a0d0e21e
LW
821 -D)
822 shift
823 case "$1" in
824 *=)
825 echo "$me: use '-U symbol=', not '-D symbol='." >&2
826 echo "$me: ignoring -D $1" >&2
827 ;;
ecfc5424 828 *=*) echo "$1" | \
1aef975c
AD
829 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
830 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
831 esac
832 shift
833 ;;
834 -U)
835 shift
836 case "$1" in
1aef975c 837 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
838 *=*)
839 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
840 echo "$me: ignoring -U $1" >&2
841 ;;
1aef975c 842 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
843 esac
844 shift
845 ;;
8e07c86e 846 -V) echo "$me generated by metaconfig 3.0 PL58." >&2
2304df62
AD
847 exit 0;;
848 --) break;;
a0d0e21e 849 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
850 *) break;;
851 esac
852done
853
854case "$error" in
855true)
856 cat >&2 <<EOM
16d20bd9 857Usage: $me [-dehrEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
a0d0e21e 858 [-U symbol] [-U symbol=]
2304df62
AD
859 -d : use defaults for all answers.
860 -e : go on without questioning past the production of config.sh.
861 -f : specify an alternate default configuration file.
862 -h : print this help message and exit (with an error status).
863 -r : reuse C symbols value if possible (skips costly nm extraction).
864 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
865 -D : define symbol to have some value:
866 -D symbol symbol gets the value 'define'
867 -D symbol=value symbol gets the value 'value'
2304df62 868 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 869 -K : do not use unless you know what you are doing.
ecfc5424 870 -O : let -D and -U override definitions from loaded configuration file.
2304df62 871 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
872 -U : undefine symbol:
873 -U symbol symbol gets the value 'undef'
874 -U symbol= symbol gets completely empty
2304df62
AD
875 -V : print version number and exit (with a zero status).
876EOM
877 exit 1
878 ;;
879esac
880
881exec 4>&1
882case "$silent" in
883true) exec 1>/dev/null;;
884esac
885
ecfc5424 886: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
887touch optdef.sh
888. ./optdef.sh
a0d0e21e 889
2304df62
AD
890case "$extractsh" in
891true)
892 case "$config_sh" in
893 '') config_sh='config.sh'; config='./config.sh';;
894 /*) config="$config_sh";;
895 *) config="./$config_sh";;
896 esac
897 echo " "
898 echo "Fetching answers from $config_sh..."
899 cd ..
900 . $config
1aef975c 901 test "$override" && . ./optdef.sh
2304df62
AD
902 echo " "
903 . ./UU/extract
904 rm -rf UU
905 echo "Done."
906 exit 0
907 ;;
908esac
909
910: set package name
85e6fe83 911package=perl5
1aef975c
AD
912first=`echo $package | sed -e 's/^\(.\).*/\1/'`
913last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
914case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
915ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
916*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
917esac
2304df62
AD
918
919: Eunice requires " " instead of "", can you believe it
920echo " "
921: Here we go...
922echo "Beginning of configuration questions for $package."
923
1aef975c 924trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2304df62 925
2304df62
AD
926: Some greps do not return status, grrr.
927echo "grimblepritz" >grimble
928if grep blurfldyick grimble >/dev/null 2>&1 ; then
929 contains=contains
930elif grep grimblepritz grimble >/dev/null 2>&1 ; then
931 contains=grep
932else
933 contains=contains
934fi
935rm -f grimble
936: the following should work in any shell
937case "$contains" in
938contains*)
939 echo " "
940 echo "AGH! Grep doesn't return a status. Attempting remedial action."
941 cat >contains <<'EOSS'
942grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
943EOSS
944chmod +x contains
945esac
946
947: first determine how to suppress newline on echo command
948echo " "
949echo "Checking echo to see how to suppress newlines..."
950(echo "hi there\c" ; echo " ") >.echotmp
951if $contains c .echotmp >/dev/null 2>&1 ; then
952 echo "...using -n."
953 n='-n'
954 c=''
955else
956 cat <<'EOM'
957...using \c
958EOM
959 n=''
960 c='\c'
961fi
962echo $n "The star should be here-->$c"
963echo '*'
964rm -f .echotmp
965
966: Now test for existence of everything in MANIFEST
967echo " "
968if test -f ../MANIFEST; then
969 echo "First let's make sure your kit is complete. Checking..." >&4
970 awk '$1 !~ /PACK[A-Z]+/ {print $1}' ../MANIFEST | split -50
971 rm -f missing
972 for filelist in x??; do
973 (cd ..; ls `cat UU/$filelist` >/dev/null 2>>UU/missing)
974 done
975 if test -s missing; then
976 cat missing >&4
977 cat >&4 <<'EOM'
978
979THIS PACKAGE SEEMS TO BE INCOMPLETE.
980
981You have the option of continuing the configuration process, despite the
982distinct possibility that your kit is damaged, by typing 'y'es. If you
983do, don't blame me if something goes wrong. I advise you to type 'n'o
984and contact the author (lwall@netlabs.com).
985
986EOM
987 echo $n "Continue? [n] $c" >&4
988 read ans
989 case "$ans" in
990 y*)
991 echo "Continuing..." >&4
992 rm -f missing
993 ;;
994 *)
995 echo "ABORTING..." >&4
996 kill $$
997 ;;
998 esac
999 else
1000 echo "Looks good..." >&4
1001 fi
1002else
1003 echo "There is no MANIFEST file. I hope your kit is complete !"
1004fi
1005rm -f missing x??
1006
1007: compute the number of columns on the terminal for proper question formatting
1008case "$COLUMNS" in
1009'') COLUMNS='80';;
1010esac
1011
1012: set up the echo used in my read
1013myecho="case \"\$xxxm\" in
1014'') echo $n \"\$rp $c\" >&4;;
1015*) case \"\$rp\" in
1016 '') echo $n \"[\$xxxm] $c\";;
1017 *)
1018 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1019 echo \"\$rp\" >&4
1020 echo $n \"[\$xxxm] $c\" >&4
1021 else
1022 echo $n \"\$rp [\$xxxm] $c\" >&4
1023 fi
1024 ;;
1025 esac;;
1026esac"
1027
1028: now set up to do reads with possible shell escape and default assignment
1029cat <<EOSC >myread
1030xxxm=\$dflt
1031$myecho
1032ans='!'
1033case "\$fastread" in
1034yes) case "\$dflt" in
1035 '') ;;
1036 *) ans='';
1037 case "\$silent-\$rp" in
1038 true-) ;;
1039 *) echo " " >&4;;
1040 esac;;
1041 esac;;
1042*) case "\$silent" in
1043 true) case "\$rp" in
1044 '') ans='';;
1045 esac;;
1046 esac;;
1047esac
1048while expr "X\$ans" : "X!" >/dev/null; do
1049 read answ
1050 set x \$xxxm
1051 shift
1052 aok=''; eval "ans=\"\$answ\"" && aok=y
1053 case "\$answ" in
1054 "\$ans")
1055 case "\$ans" in
ecfc5424
AD
1056 \\&*)
1057 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1058 shift
1059 case "\$1" in
1060 -d)
1061 fastread=yes
1062 echo "(OK, I'll run with -d after this question.)"
1063 ;;
1064 -*)
1065 echo "*** Sorry, \$1 not supported yet."
1066 ;;
1067 esac
1068 $myecho
1069 ans=!
1070 ;;
2304df62
AD
1071 "!")
1072 sh 1>&4
1073 echo " "
1074 $myecho
1075 ;;
1076 !*)
1077 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1078 shift
1079 sh 1>&4 -c "\$*"
1080 echo " "
1081 $myecho
1082 ;;
1083 esac;;
1084 *)
1085 case "\$aok" in
1086 y)
1087 echo "*** Substitution done -- please confirm."
1088 xxxm="\$ans"
1089 ans=\`echo $n "\$ans$c" | tr '\012' ' '\`
1090 xxxm="\$ans"
1091 ans=!
1092 ;;
1093 *)
1094 echo "*** Error -- try again."
1095 ans=!
1096 ;;
1097 esac
1098 $myecho
1099 ;;
1100 esac
1101 case "\$ans\$xxxm\$nostick" in
1102 '')
1103 ans=!
1104 $myecho
1105 ;;
1106 esac
1107done
1108case "\$ans" in
1109'') ans="\$xxxm";;
1110esac
1111EOSC
1112
1113: create .config dir to save info across Configure sessions
1114test -d ../.config || mkdir ../.config
1115cat >../.config/README <<EOF
1116This directory created by Configure to save information that should
1117persist across sessions.
1118
1119You may safely delete it if you wish.
1120EOF
1121
1122: general instructions
1123needman=true
1124firsttime=true
1125user=`( (logname) 2>/dev/null || whoami) 2>&1`
1126if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1127 firsttime=false
1128 echo " "
1129 rp='Would you like to see the instructions?'
1130 dflt=n
1131 . ./myread
1132 case "$ans" in
1133 [yY]*) ;;
1134 *) needman=false;;
1135 esac
1136fi
1137if $needman; then
1138 cat <<EOH
1139
1140This installation shell script will examine your system and ask you questions
a0d0e21e 1141to determine how the perl5 package should be installed. If you get
2304df62
AD
1142stuck on a question, you may use a ! shell escape to start a subshell or
1143execute a command. Many of the questions will have default answers in square
1144brackets; typing carriage return will give you the default.
1145
1146On some of the questions which ask for file or directory names you are allowed
1147to use the ~name construct to specify the login directory belonging to "name",
1148even if you don't have a shell which knows about that. Questions where this is
1149allowed will be marked "(~name ok)".
1150
1151EOH
1152 rp=''
1153 dflt='Type carriage return to continue'
1154 . ./myread
1155 cat <<'EOH'
1156
1157The prompter used in this script allows you to use shell variables and
1158backticks in your answers. You may use $1, $2, etc... to refer to the words
1159in the default answer, as if the default line was a set of arguments given to a
1160script shell. This means you may also use $* to repeat the whole default line,
1161so you do not have to re-type everything to add something to the default.
1162
1163Everytime there is a substitution, you will have to confirm. If there is an
1164error (e.g. an unmatched backtick), the default answer will remain unchanged
1165and you will be prompted again.
1166
1167If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
1168the questions and use the computed defaults (or the previous answers if there
1169was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424
AD
1170You may also start interactively and then answer '& -d' at any prompt to turn
1171on the non-interactive behaviour for the remaining of the execution.
2304df62
AD
1172
1173EOH
1174 . ./myread
1175 cat <<EOH
1176
1177Much effort has been expended to ensure that this shell script will run on any
1178Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
1179Configure and run it again. If you can't run Configure for some reason,
1180you'll have to generate a config.sh file by hand. Whatever problems you
1181have, let me (lwall@netlabs.com) know how I blew it.
2304df62
AD
1182
1183This installation script affects things in two ways:
1184
11851) it may do direct variable substitutions on some of the files included
1186 in this kit.
11872) it builds a config.h file for inclusion in C programs. You may edit
1188 any of these files as the need arises after running this script.
1189
1190If you make a mistake on a question, there is no easy way to back up to it
1191currently. The easiest thing to do is to edit config.sh and rerun all the SH
1192files. Configure will offer to let you do this before it runs the SH files.
1193
1194EOH
1195 dflt='Type carriage return to continue'
1196 . ./myread
1197 case "$firsttime" in
1198 true) echo $user >>../.config/instruct;;
1199 esac
1200fi
1201
1202: see if sh knows # comments
1203echo " "
1204echo "Checking your sh to see if it knows about # comments..." >&4
ecfc5424 1205if `sh -c '#' >/dev/null 2>&1`; then
2304df62
AD
1206 echo "Your sh handles # comments correctly."
1207 shsharp=true
1208 spitshell=cat
1209 echo " "
1210 echo "Okay, let's see if #! works on this system..."
a0d0e21e 1211 xcat=/bin/cat
ecfc5424 1212 test -f $xcat || xcat=/usr/bin/cat
a0d0e21e 1213 echo "#!$xcat" >try
2304df62
AD
1214 $eunicefix try
1215 chmod +x try
1216 ./try > today
1217 if test -s today; then
1218 echo "It does."
1219 sharpbang='#!'
1220 else
a0d0e21e 1221 echo "#! $xcat" > try
2304df62
AD
1222 $eunicefix try
1223 chmod +x try
1224 ./try > today
1225 if test -s today; then
1226 echo "It does."
1227 sharpbang='#! '
1228 else
1229 echo "It's just a comment."
1230 sharpbang=': use '
1231 fi
1232 fi
1233else
1234 echo "Your sh doesn't grok # comments--I will strip them later on."
1235 shsharp=false
a0d0e21e 1236 cd ..
2304df62
AD
1237 echo "exec grep -v '^[ ]*#'" >spitshell
1238 chmod +x spitshell
1239 $eunicefix spitshell
1240 spitshell=`pwd`/spitshell
a0d0e21e 1241 cd UU
2304df62
AD
1242 echo "I presume that if # doesn't work, #! won't work either!"
1243 sharpbang=': use '
1244fi
1245rm -f try today
1246
1247: figure out how to guarantee sh startup
1248echo " "
1249echo "Checking out how to guarantee sh startup..." >&4
1250case "$SYSTYPE" in
1251*bsd*|sys5*) startsh=$sharpbang"/$SYSTYPE/bin/sh";;
1252*) startsh=$sharpbang'/bin/sh';;
1253esac
1254echo "Let's see if '$startsh' works..."
1255cat >try <<EOSS
1256$startsh
1257set abc
1258test "$?abc" != 1
1259EOSS
1260
1261chmod +x try
1262$eunicefix try
1263if ./try; then
1264 echo "Yup, it does."
1265else
1266echo "Nope. You may have to fix up the shell scripts to make sure sh runs them."
1267fi
1268rm -f try
1269
1270: find out where common programs are
1271echo " "
1272echo "Locating common programs..." >&4
1273cat <<EOSC >loc
1274$startsh
1275case \$# in
12760) exit 1;;
1277esac
1278thing=\$1
1279shift
1280dflt=\$1
1281shift
1282for dir in \$*; do
1283 case "\$thing" in
1284 .)
1285 if test -d \$dir/\$thing; then
1286 echo \$dir
1287 exit 0
1288 fi
1289 ;;
1290 *)
a0d0e21e 1291 for thisthing in \$dir/\$thing; do
ecfc5424 1292 : just loop through to pick last item
a0d0e21e
LW
1293 done
1294 if test -f \$thisthing; then
1295 echo \$thisthing
2304df62
AD
1296 exit 0
1297 elif test -f \$dir/\$thing.exe; then
1298 : on Eunice apparently
1299 echo \$dir/\$thing
1300 exit 0
1301 fi
1302 ;;
1303 esac
1304done
1305echo \$dflt
1306exit 1
1307EOSC
1308chmod +x loc
1309$eunicefix loc
1310loclist="
1311awk
1312cat
ecfc5424 1313comm
2304df62
AD
1314cp
1315echo
1316expr
a0d0e21e 1317find
2304df62 1318grep
85e6fe83 1319ln
a0d0e21e 1320ls
2304df62 1321mkdir
2304df62
AD
1322rm
1323sed
1324sort
8e07c86e 1325tail
85e6fe83 1326touch
2304df62
AD
1327tr
1328uniq
1329"
1330trylist="
1331Mcc
2304df62
AD
1332byacc
1333cpp
1334csh
1335date
1336egrep
2304df62
AD
1337line
1338nroff
1339perl
1340test
1341uname
1342"
8e07c86e 1343pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
1344pth="$pth /lib /usr/lib"
1345for file in $loclist; do
1346 xxx=`./loc $file $file $pth`
1347 eval $file=$xxx
1348 eval _$file=$xxx
1349 case "$xxx" in
1350 /*)
1351 echo $file is in $xxx.
1352 ;;
8e07c86e
AD
1353 ?:[\\/]*)
1354 echo $file is in $xxx.
1355 ;;
2304df62
AD
1356 *)
1357 echo "I don't know where $file is. I hope it's in everyone's PATH."
1358 ;;
1359 esac
1360done
1361echo " "
1362echo "Don't worry if any of the following aren't found..."
1363say=offhand
1364for file in $trylist; do
1365 xxx=`./loc $file $file $pth`
1366 eval $file=$xxx
1367 eval _$file=$xxx
1368 case "$xxx" in
1369 /*)
1370 echo $file is in $xxx.
1371 ;;
8e07c86e
AD
1372 ?:[\\/]*)
1373 echo $file is in $xxx.
1374 ;;
2304df62
AD
1375 *)
1376 echo "I don't see $file out there, $say."
1377 say=either
1378 ;;
1379 esac
1380done
1381case "$egrep" in
1382egrep)
1383 echo "Substituting grep for egrep."
1384 egrep=$grep
1385 ;;
1386esac
1387case "$test" in
1388test)
1389 echo "Hopefully test is built into your sh."
1390 ;;
1391*)
ecfc5424 1392 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2304df62
AD
1393 echo "Using the test built into your sh."
1394 test=test
1395 _test=test
1396 fi
1397 ;;
1398esac
1399case "$echo" in
1400echo)
1401 echo "Hopefully echo is built into your sh."
1402 ;;
1403'') ;;
1404*)
1405 echo " "
1406echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1407 $echo $n "hi there$c" >foo1
1408 echo $n "hi there$c" >foo2
1409 if cmp foo1 foo2 >/dev/null 2>&1; then
1410 echo "They are compatible. In fact, they may be identical."
1411 else
1412 case "$n" in
1413 '-n') n='' c='\c';;
1414 *) n='-n' c='';;
1415 esac
1416 cat <<FOO
1417They are not compatible! You are probably running ksh on a non-USG system.
1418I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1419have echo built in and we may have to run some Bourne shell scripts. That
1420means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
1421
1422FOO
1423 $echo $n "The star should be here-->$c"
1424 $echo "*"
1425 fi
1426 $rm -f foo1 foo2
1427 ;;
1428esac
1429
a0d0e21e
LW
1430: determine whether symbolic links are supported
1431echo " "
1432$touch blurfl
1433if $ln -s blurfl sym > /dev/null 2>&1 ; then
1434 echo "Symbolic links are supported." >&4
1435 lns="$ln -s"
1436else
1437 echo "Symbolic links are NOT supported." >&4
1438 lns="$ln"
1439fi
1440$rm -f blurfl sym
1441
ecfc5424
AD
1442: see whether [:lower:] and [:upper:] are supported character classes
1443echo " "
1444up='[A-Z]'
1445low='[a-z]'
1446case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1447ABYZ)
1448 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
1449 up='[:upper:]'
1450 low='[:lower:]'
1451 ;;
1452*)
1453 echo "Your tr only supports [a-z] and [A-Z] to convert case." >&4
1454 ;;
1455esac
1456: set up the translation script tr, must be called with ./tr of course
1457cat >tr <<EOSC
1458$startsh
1459case "\$1\$2" in
1460'[A-Z][a-z]') exec $tr '$up' '$low';;
1461'[a-z][A-Z]') exec $tr '$low' '$up';;
1462esac
1463exec $tr "\$@"
1464EOSC
1465chmod +x tr
1466$eunicefix tr
1467
2304df62
AD
1468: Try to determine whether config.sh was made on this system
1469case "$config_sh" in
1470'')
1471myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
a0d0e21e 1472myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
ecfc5424 1473 ./tr '[A-Z]' '[a-z]' | tr '\012' ' '`
1aef975c 1474newmyuname="$myuname"
2304df62 1475dflt=n
16d20bd9
AD
1476case "$knowitall" in
1477'')
1478 if test -f ../config.sh; then
1479 if $contains myuname= ../config.sh >/dev/null 2>&1; then
1480 eval "`grep myuname= ../config.sh`"
1481 fi
1482 if test "X$myuname" = "X$newmyuname"; then
1483 dflt=y
1484 fi
2304df62 1485 fi
16d20bd9
AD
1486 ;;
1487*) dflt=y;;
1488esac
2304df62
AD
1489
1490: Get old answers from old config file if Configure was run on the
1491: same system, otherwise use the hints.
1492hint=default
1493cd ..
1494if test -f config.sh; then
16d20bd9
AD
1495 echo " "
1496 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
1497 . UU/myread
1498 case "$ans" in
1499 n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
1500 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
1501 tmp_n="$n"
1502 tmp_c="$c"
2304df62
AD
1503 . ./config.sh
1504 cp config.sh UU
ecfc5424
AD
1505 n="$tmp_n"
1506 c="$tmp_c"
2304df62
AD
1507 hint=previous
1508 ;;
1509 esac
1510fi
1511if test ! -f config.sh; then
1512 $cat <<EOM
1513
1514First time through, eh? I have some defaults handy for the following systems:
1515
1516EOM
1517 cd hints; ls -C *.sh | $sed 's/\.sh/ /g' >&4
1518 dflt=''
1519 : Half the following guesses are probably wrong... If you have better
1520 : tests or hints, please send them to lwall@netlabs.com
1521 : The metaconfig authors would also appreciate a copy...
a0d0e21e 1522 $test -f /irix && osname=irix
85e6fe83
LW
1523 $test -f /xenix && osname=sco_xenix
1524 $test -f /dynix && osname=dynix
1525 $test -f /dnix && osname=dnix
a0d0e21e 1526 $test -f /unicos && osname=unicos && osvers=`$uname -r`
85e6fe83 1527 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
1528 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
1529 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
1530 $test -d /usr/apollo/bin && osname=apollo
1531 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 1532 $test -d /usr/include/minix && osname=minix
fec02dd3
AD
1533 $test -d /MachTen && osname=machten && \
1534 osvers=`/usr/etc/version | $awk '{print $2}' | \
1535 $sed -e 's/[A-Za-z]$//'`
2304df62
AD
1536 if $test -f $uname; then
1537 set X $myuname
1538 shift
1539
2304df62 1540 case "$5" in
85e6fe83 1541 fps*) osname=fps ;;
2304df62
AD
1542 mips*)
1543 case "$4" in
85e6fe83
LW
1544 umips) osname=umips ;;
1545 *) osname=mips ;;
2304df62 1546 esac;;
85e6fe83
LW
1547 [23]100) osname=mips ;;
1548 next*) osname=next ;;
1549 news*) osname=news ;;
ecfc5424
AD
1550 i386*)
1551 if $test -f /etc/kconfig; then
1552 osname=isc
a0d0e21e
LW
1553 if test "$lns" = "ln -s"; then
1554 osvers=4
1555 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
1556 osvers=3
2304df62 1557 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 1558 osvers=2
ecfc5424
AD
1559 fi
1560 fi
1561 ;;
2304df62
AD
1562 esac
1563
1564 case "$1" in
a0d0e21e
LW
1565 aix) osname=aix
1566 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
1567 case "$tmp" in
1aef975c 1568 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
1569 '<3240'|'<>3240') osvers=3.2.0 ;;
1570 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
1571 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 1572 *) osvers=$tmp;;
a0d0e21e
LW
1573 esac
1574 ;;
1575 dnix) osname=dnix
1576 osvers="$3"
1577 ;;
1578 domainos) osname=apollo
1579 osvers="$3"
1580 ;;
1581 dgux) osname=dgux
1582 osvers="$3"
1583 ;;
1584 freebsd) osname=freebsd
1585 osvers="$3" ;;
1586 genix) osname=genix ;;
1587 hp*) osname=hpux
1588 case "$3" in
1589 *.08.*) osvers=9 ;;
1590 *.09.*) osvers=9 ;;
1591 *.10.*) osvers=10 ;;
ecfc5424 1592 *) osvers="$3" ;;
a0d0e21e
LW
1593 esac
1594 ;;
1595 irix) osname=irix
1596 case "$3" in
1597 4*) osvers=4 ;;
1598 5*) osvers=5 ;;
ecfc5424 1599 *) osvers="$3" ;;
a0d0e21e
LW
1600 esac
1601 ;;
1602 linux) osname=linux
1603 case "$3" in
1604 1*) osvers=1 ;;
1605 *) osvers="$3" ;;
1606 esac
1607 ;;
1608 netbsd*) osname=netbsd
ecfc5424
AD
1609 osvers="$3"
1610 ;;
a0d0e21e
LW
1611 bsd386) osname=bsd386
1612 osvers=`$uname -r`
1613 ;;
1614 next*) osname=next ;;
1615 solaris) osname=solaris
1616 case "$3" in
1617 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 1618 *) osvers="$3" ;;
a0d0e21e
LW
1619 esac
1620 ;;
85e6fe83
LW
1621 sunos) osname=sunos
1622 case "$3" in
85e6fe83
LW
1623 5*) osname=solaris
1624 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 1625 *) osvers="$3" ;;
2304df62
AD
1626 esac
1627 ;;
a0d0e21e 1628 titanos) osname=titanos
85e6fe83 1629 case "$3" in
a0d0e21e
LW
1630 1*) osvers=1 ;;
1631 2*) osvers=2 ;;
1632 3*) osvers=3 ;;
1633 4*) osvers=4 ;;
ecfc5424 1634 *) osvers="$3" ;;
2304df62
AD
1635 esac
1636 ;;
85e6fe83 1637 ultrix) osname=ultrix
ecfc5424 1638 osvers="$3"
2304df62 1639 ;;
85e6fe83 1640 osf1) case "$5" in
fed7345c
AD
1641 alpha)
1642 osname=dec_osf
1643 osvers=`echo "$3" | sed 's/^[vt]//'`
ecfc5424
AD
1644 ;;
1645 hp*) osname=hp_osf1 ;;
1646 mips) osname=mips_osf1 ;;
85e6fe83
LW
1647 esac
1648 ;;
a0d0e21e
LW
1649 uts) osname=uts
1650 osvers="$3"
1651 ;;
85e6fe83 1652 $2) case "$osname" in
2304df62 1653 *isc*) ;;
a0d0e21e
LW
1654 *freebsd*) ;;
1655 svr*)
1656 : svr4.x or possibly later
1657 case "svr$3" in
1658 ${osname}*)
1659 osname=svr$3
1660 osvers=$4
1661 ;;
1662 esac
1663 case "$osname" in
1664 svr4.0)
1665 : Check for ESIX
1666 if test -f /stand/boot ; then
1667 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
1668 if test -n "$INITPROG" -a -f "$INITPROG"; then
1669 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
1670 if test -n "$isesix"; then
a0d0e21e
LW
1671 osname=esix4
1672 fi
1673 fi
1674 fi
1675 ;;
1676 esac
1677 ;;
2304df62 1678 *) if test -f /etc/systemid; then
a0d0e21e
LW
1679 osname=sco
1680 set `echo $3 | $sed 's/\./ /g'` $4
2304df62 1681 if $test -f sco_$1_$2_$3.sh; then
85e6fe83 1682 osvers=$1.$2.$3
2304df62 1683 elif $test -f sco_$1_$2.sh; then
85e6fe83 1684 osvers=$1.$2
2304df62 1685 elif $test -f sco_$1.sh; then
85e6fe83 1686 osvers=$1
2304df62 1687 fi
a0d0e21e
LW
1688 else
1689 case "$osname" in
1690 '') : Still unknown. Probably a generic Sys V.
1691 osname="sysv"
1692 osvers="$3"
1693 ;;
1694 esac
2304df62
AD
1695 fi
1696 ;;
1697 esac
1698 ;;
a0d0e21e
LW
1699 *) case "$osname" in
1700 '') : Still unknown. Probably a generic BSD.
1701 osname="$1"
1702 osvers="$3"
1703 ;;
1704 esac
1705 ;;
2304df62
AD
1706 esac
1707 else
1708 if test -f /vmunix -a -f news_os.sh; then
ecfc5424 1709 (what /vmunix | ../UU/tr '[A-Z]' '[a-z]') > ../UU/kernel.what 2>&1
2304df62 1710 if $contains news-os ../UU/kernel.what >/dev/null 2>&1; then
85e6fe83 1711 osname=news_os
2304df62
AD
1712 fi
1713 $rm -f ../UU/kernel.what
8e07c86e
AD
1714 elif test -d c:/.; then
1715 set X $myuname
1716 osname=os2
1717 osvers="$5"
2304df62
AD
1718 fi
1719 fi
85e6fe83 1720
a0d0e21e
LW
1721 : Now look for a hint file osname_osvers, unless one has been
1722 : specified already.
1723 case "$hintfile" in
1724 ''|' ')
ecfc5424 1725 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
a0d0e21e 1726 : Also try without trailing minor version numbers.
ecfc5424
AD
1727 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
1728 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
1729 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
1730 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
a0d0e21e
LW
1731 case "$file" in
1732 '') dflt=none ;;
1733 *) case "$osvers" in
1734 '') dflt=$file
1735 ;;
1736 *) if $test -f $file.sh ; then
1737 dflt=$file
1738 elif $test -f $xfile.sh ; then
1739 dflt=$xfile
1740 elif $test -f $xxfile.sh ; then
1741 dflt=$xxfile
1742 elif $test -f $xxxfile.sh ; then
1743 dflt=$xxxfile
1744 elif $test -f $xxxxfile.sh ; then
1745 dflt=$xxxxfile
1746 elif $test -f "${osname}.sh" ; then
1747 dflt="${osname}"
1748 else
1749 dflt=none
1750 fi
1751 ;;
1752 esac
85e6fe83
LW
1753 ;;
1754 esac
1755 ;;
a0d0e21e 1756 *)
ecfc5424 1757 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 1758 ;;
2304df62 1759 esac
1aef975c 1760
2304df62
AD
1761 $cat <<EOM
1762
1763You may give one or more space-separated answers, or "none" if appropriate.
1764If your OS version has no hints, DO NOT give a wrong version -- say "none".
1765
1766EOM
1767 rp="Which of these apply, if any?"
1768 . ../UU/myread
85e6fe83
LW
1769 tans=$ans
1770 for file in $tans; do
2304df62
AD
1771 if $test -f $file.sh; then
1772 . ./$file.sh
1773 $cat $file.sh >> ../UU/config.sh
85e6fe83 1774 elif $test X$tans = X -o X$tans = Xnone ; then
2304df62
AD
1775 : nothing
1776 else
85e6fe83
LW
1777 : Give one chance to correct a possible typo.
1778 echo "$file.sh does not exist"
1779 dflt=$file
1780 rp="hint to use instead?"
1781 . ../UU/myread
1782 for file in $ans; do
1783 if $test -f "$file.sh"; then
1784 . ./$file.sh
1785 $cat $file.sh >> ../UU/config.sh
1786 elif $test X$ans = X -o X$ans = Xnone ; then
1787 : nothing
1788 else
1789 echo "$file.sh does not exist -- ignored."
1790 fi
1791 done
2304df62
AD
1792 fi
1793 done
85e6fe83 1794
2304df62 1795 hint=recommended
85e6fe83
LW
1796 : Remember our hint file for later.
1797 if $test -f "$file.sh" ; then
a0d0e21e 1798 hintfile="$file"
85e6fe83 1799 else
a0d0e21e 1800 hintfile=''
85e6fe83
LW
1801 fi
1802
2304df62
AD
1803 cd ..
1804fi
1805cd UU
1806;;
1807*)
1808 echo " "
1809 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
1810 tmp_n="$n"
1811 tmp_c="$c"
2304df62
AD
1812 cd ..
1813 cp $config_sh config.sh 2>/dev/null
1814 . ./config.sh
1815 cd UU
1816 cp ../config.sh .
ecfc5424
AD
1817 n="$tmp_n"
1818 c="$tmp_c"
2304df62
AD
1819 hint=previous
1820 ;;
1821esac
1aef975c
AD
1822test "$override" && . ./optdef.sh
1823myuname="$newmyuname"
2304df62
AD
1824
1825: Restore computed paths
1826for file in $loclist $trylist; do
1827 eval $file="\$_$file"
1828done
1829
85e6fe83 1830cat << EOM
a0d0e21e 1831
85e6fe83 1832Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
1833The default value is probably right if the name rings a bell. Otherwise,
1834since spelling matters for me, either accept the default or answer "none"
1835to leave it blank.
a0d0e21e 1836
85e6fe83 1837EOM
85e6fe83 1838case "$osname" in
a0d0e21e 1839 ''|' ')
85e6fe83 1840 case "$hintfile" in
a0d0e21e 1841 ''|' '|none) dflt=none ;;
ecfc5424 1842 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
1843 esac
1844 ;;
1845 *) dflt="$osname" ;;
1846esac
1847rp="Operating system name?"
1848. ./myread
1849case "$ans" in
ecfc5424
AD
1850none) osname='' ;;
1851*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 1852esac
2304df62
AD
1853: who configured the system
1854cf_time=`$date 2>&1`
a0d0e21e
LW
1855(logname > .temp) >/dev/null 2>&1
1856$test -s .temp || (whoami > .temp) >/dev/null 2>&1
1857$test -s .temp || echo unknown > .temp
1858cf_by=`$cat .temp`
1859$rm -f .temp
2304df62
AD
1860
1861: determine where manual pages are on this system
1862echo " "
1863case "$sysman" in
1864'')
a0d0e21e 1865 syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2304df62
AD
1866 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
1867 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
1868 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
a0d0e21e
LW
1869 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
1870 sysman=`./loc . /usr/man/man1 $syspath`
2304df62
AD
1871 ;;
1872esac
1873if $test -d "$sysman"; then
1874 echo "System manual is in $sysman." >&4
1875else
1876 echo "Could not find manual pages in source form." >&4
1877fi
1878
1879: see what memory models we can support
1880case "$models" in
1881'')
1882 $cat >pdp11.c <<'EOP'
1883main() {
1884#ifdef pdp11
1885 exit(0);
1886#else
1887 exit(1);
1888#endif
1889}
1890EOP
1891 cc -o pdp11 pdp11.c >/dev/null 2>&1
1892 if ./pdp11 2>/dev/null; then
1893 dflt='unsplit split'
1894 else
1895 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
1896 case "$tans" in
1897 X) dflt='none';;
1898 *) if $test -d /lib/small || $test -d /usr/lib/small; then
1899 dflt='small'
1900 else
1901 dflt=''
1902 fi
1903 if $test -d /lib/medium || $test -d /usr/lib/medium; then
1904 dflt="$dflt medium"
1905 fi
1906 if $test -d /lib/large || $test -d /usr/lib/large; then
1907 dflt="$dflt large"
1908 fi
1909 if $test -d /lib/huge || $test -d /usr/lib/huge; then
1910 dflt="$dflt huge"
1911 fi
1912 esac
1913 fi;;
1914*) dflt="$models";;
1915esac
1916$cat <<EOM
1917
1918Some systems have different model sizes. On most systems they are called
1919small, medium, large, and huge. On the PDP11 they are called unsplit and
1920split. If your system doesn't support different memory models, say "none".
1921If you wish to force everything to one memory model, say "none" here and
1922put the appropriate flags later when it asks you for other cc and ld flags.
1923Venix systems may wish to put "none" and let the compiler figure things out.
1924(In the following question multiple model names should be space separated.)
1925
1926EOM
1927rp="Which memory models are supported?"
1928. ./myread
1929models="$ans"
1930
1931case "$models" in
1932none)
1933 small=''
1934 medium=''
1935 large=''
1936 huge=''
1937 unsplit=''
1938 split=''
1939 ;;
1940*split)
1941 case "$split" in
1942 '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
1943 $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
1944 dflt='-i'
1945 else
1946 dflt='none'
1947 fi;;
1948 *) dflt="$split";;
1949 esac
1950 rp="What flag indicates separate I and D space?"
1951 . ./myread
1952 tans="$ans"
1953 case "$tans" in
1954 none) tans='';;
1955 esac
1956 split="$tans"
1957 unsplit='';;
1958*large*|*small*|*medium*|*huge*)
1959 case "$models" in
1960 *large*)
1961 case "$large" in
1962 '') dflt='-Ml';;
1963 *) dflt="$large";;
1964 esac
1965 rp="What flag indicates large model?"
1966 . ./myread
1967 tans="$ans"
1968 case "$tans" in
1969 none) tans='';
1970 esac
1971 large="$tans";;
1972 *) large='';;
1973 esac
1974 case "$models" in
1975 *huge*) case "$huge" in
1976 '') dflt='-Mh';;
1977 *) dflt="$huge";;
1978 esac
1979 rp="What flag indicates huge model?"
1980 . ./myread
1981 tans="$ans"
1982 case "$tans" in
1983 none) tans='';
1984 esac
1985 huge="$tans";;
1986 *) huge="$large";;
1987 esac
1988 case "$models" in
1989 *medium*) case "$medium" in
1990 '') dflt='-Mm';;
1991 *) dflt="$medium";;
1992 esac
1993 rp="What flag indicates medium model?"
1994 . ./myread
1995 tans="$ans"
1996 case "$tans" in
1997 none) tans='';
1998 esac
1999 medium="$tans";;
2000 *) medium="$large";;
2001 esac
2002 case "$models" in
2003 *small*) case "$small" in
2004 '') dflt='none';;
2005 *) dflt="$small";;
2006 esac
2007 rp="What flag indicates small model?"
2008 . ./myread
2009 tans="$ans"
2010 case "$tans" in
2011 none) tans='';
2012 esac
2013 small="$tans";;
2014 *) small='';;
2015 esac
2016 ;;
2017*)
2018 echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2019 ;;
2020esac
2021
2022: make some quick guesses about what we are up against
2023echo " "
2024$echo $n "Hmm... $c"
2025echo exit 1 >bsd
2026echo exit 1 >usg
2027echo exit 1 >v7
2028echo exit 1 >osf1
2029echo exit 1 >eunice
2030echo exit 1 >xenix
2031echo exit 1 >venix
ecfc5424 2032d_bsd="$undef"
2304df62
AD
2033$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2034if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2035then
2036 echo "Looks kind of like an OSF/1 system, but we'll see..."
2037 echo exit 0 >osf1
2038elif test `echo abc | tr a-z A-Z` = Abc ; then
2039 xxx=`./loc addbib blurfl $pth`
2040 if $test -f $xxx; then
2041 echo "Looks kind of like a USG system with BSD features, but we'll see..."
2042 echo exit 0 >bsd
2043 echo exit 0 >usg
2044 else
2045 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2046 echo "Looks kind of like an extended USG system, but we'll see..."
2047 else
2048 echo "Looks kind of like a USG system, but we'll see..."
2049 fi
2050 echo exit 0 >usg
2051 fi
2052elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2053 echo "Looks kind of like a BSD system, but we'll see..."
ecfc5424 2054 d_bsd="$define"
2304df62
AD
2055 echo exit 0 >bsd
2056else
2057 echo "Looks kind of like a Version 7 system, but we'll see..."
2058 echo exit 0 >v7
2059fi
2060case "$eunicefix" in
2061*unixtovms*)
2062 $cat <<'EOI'
2063There is, however, a strange, musty smell in the air that reminds me of
2064something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2065EOI
2066 echo exit 0 >eunice
2067 d_eunice="$define"
2068: it so happens the Eunice I know will not run shell scripts in Unix format
2069 ;;
2070*)
2071 echo " "
2072 echo "Congratulations. You aren't running Eunice."
2073 d_eunice="$undef"
2074 ;;
2075esac
2076if test -f /xenix; then
2077 echo "Actually, this looks more like a XENIX system..."
2078 echo exit 0 >xenix
2079 d_xenix="$define"
2080else
2081 echo " "
2082 echo "It's not Xenix..."
2083 d_xenix="$undef"
2084fi
2085chmod +x xenix
2086$eunicefix xenix
2087if test -f /venix; then
2088 echo "Actually, this looks more like a VENIX system..."
2089 echo exit 0 >venix
2090else
2091 echo " "
ecfc5424 2092 if ./xenix; then
2304df62
AD
2093 : null
2094 else
2095 echo "Nor is it Venix..."
2096 fi
2097fi
2098chmod +x bsd usg v7 osf1 eunice xenix venix
2099$eunicefix bsd usg v7 osf1 eunice xenix venix
2100$rm -f foo
2101
2102: see if we need a special compiler
2103echo " "
ecfc5424 2104if ./usg; then
2304df62
AD
2105 case "$cc" in
2106 '') case "$Mcc" in
2107 /*) dflt='Mcc';;
2108 *) case "$large" in
2109 -M*) dflt='cc';;
2110 *) if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
2111 if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
2112 dflt='cc'
2113 else
2114 dflt='cc -M'
2115 fi
2116 else
2117 dflt='cc'
2118 fi;;
2119 esac;;
2120 esac;;
2121 *) dflt="$cc";;
2122 esac
2123 $cat <<'EOM'
2124On some systems the default C compiler will not resolve multiple global
2125references that happen to have the same name. On some such systems the "Mcc"
2126command may be used to force these to be resolved. On other systems a "cc -M"
2127command is required. (Note that the -M flag on other systems indicates a
2128memory model to use!) If you have the Gnu C compiler, you might wish to use
2129that instead.
2130
2131EOM
2132 rp="What command will force resolution on this system?"
2133 . ./myread
2134 cc="$ans"
2135else
2136 case "$cc" in
2137 '') dflt=cc;;
2138 *) dflt="$cc";;
2139 esac
2140 rp="Use which C compiler?"
2141 . ./myread
2142 cc="$ans"
2143fi
ecfc5424
AD
2144echo " "
2145echo "Checking for GNU cc in disguise and/or its version number..." >&4
2304df62
AD
2146$cat >gccvers.c <<EOM
2147#include <stdio.h>
a0d0e21e 2148int main() {
2304df62 2149#ifdef __GNUC__
a0d0e21e 2150#ifdef __VERSION__
ecfc5424 2151 printf("%s\n", __VERSION__);
2304df62 2152#else
ecfc5424 2153 printf("%s\n", "1");
2304df62 2154#endif
a0d0e21e 2155#endif
ecfc5424 2156 exit(0);
2304df62
AD
2157}
2158EOM
a0d0e21e
LW
2159if $cc -o gccvers gccvers.c >/dev/null 2>&1; then
2160 gccversion=`./gccvers`
2161 case "$gccversion" in
2162 '') echo "You are not using GNU cc." ;;
2163 *) echo "You are using GNU cc $gccversion." ;;
2164 esac
2165else
16d20bd9
AD
2166 echo " "
2167 echo "*** WHOA THERE!!! ***" >&4
2168 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
2169 case "$knowitall" in
2170 '')
2171 echo " You'd better start hunting for one and let me know about it." >&4
2172 exit 1
2173 ;;
2174 esac
a0d0e21e
LW
2175fi
2176$rm -f gccvers*
2177case "$gccversion" in
21781*) cpp=`./loc gcc-cpp $cpp $pth` ;;
2304df62 2179esac
a0d0e21e 2180
8e07c86e 2181: decide how portable to be. Allow command line overrides.
2304df62 2182case "$d_portable" in
8e07c86e
AD
2183"$undef") ;;
2184*) d_portable="$define" ;;
2304df62
AD
2185esac
2186
2187: set up shell script to do ~ expansion
2188cat >filexp <<EOSS
2189$startsh
2190: expand filename
2191case "\$1" in
2192 ~/*|~)
2193 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
2194 ;;
2195 ~*)
2196 if $test -f /bin/csh; then
2197 /bin/csh -f -c "glob \$1"
a0d0e21e 2198 failed=\$?
2304df62
AD
2199 echo ""
2200 exit \$failed
2201 else
2202 name=\`$expr x\$1 : '..\([^/]*\)'\`
2203 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
2204 if $test ! -d "\$dir"; then
2205 me=\`basename \$0\`
2206 echo "\$me: can't locate home directory for: \$name" >&2
2207 exit 1
2208 fi
2209 case "\$1" in
2210 */*)
2211 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
2212 ;;
2213 *)
2214 echo \$dir
2215 ;;
2216 esac
2217 fi
2218 ;;
2219*)
2220 echo \$1
2221 ;;
2222esac
2223EOSS
2224chmod +x filexp
2225$eunicefix filexp
2226
2227: now set up to get a file name
2228cat <<'EOSC' >getfile
2229tilde=''
2230fullpath=''
2231already=''
2232skip=''
2233none_ok=''
2234exp_file=''
a0d0e21e 2235nopath_ok=''
2304df62
AD
2236orig_rp="$rp"
2237orig_dflt="$dflt"
2238
2239case "$fn" in
ecfc5424
AD
2240*\(*)
2241 expr $fn : '.*(\(.*\)).*' | tr ',' '\012' >getfile.ok
2242 fn=`echo $fn | sed 's/(.*)//'`
2243 ;;
2244esac
2245
2246case "$fn" in
a0d0e21e
LW
2247*:*)
2248 loc_file=`expr $fn : '.*:\(.*\)'`
2249 fn=`expr $fn : '\(.*\):.*'`
2250 ;;
2251esac
2252
2253case "$fn" in
2304df62
AD
2254*~*) tilde=true;;
2255esac
2256case "$fn" in
2257*/*) fullpath=true;;
2258esac
2259case "$fn" in
2260*+*) skip=true;;
2261esac
2262case "$fn" in
2263*n*) none_ok=true;;
2264esac
2265case "$fn" in
2266*e*) exp_file=true;;
2267esac
a0d0e21e
LW
2268case "$fn" in
2269*p*) nopath_ok=true;;
2270esac
2304df62
AD
2271
2272case "$fn" in
2273*f*) type='File';;
2274*d*) type='Directory';;
a0d0e21e 2275*l*) type='Locate';;
2304df62
AD
2276esac
2277
2278what="$type"
2279case "$what" in
2280Locate) what='File';;
2281esac
2282
2283case "$exp_file" in
2284'')
2285 case "$d_portable" in
2286 "$define") ;;
2287 *) exp_file=true;;
2288 esac
2289 ;;
2290esac
2291
2292cd ..
2293while test "$type"; do
2294 redo=''
2295 rp="$orig_rp"
2296 dflt="$orig_dflt"
2297 case "$tilde" in
2298 true) rp="$rp (~name ok)";;
2299 esac
2300 . UU/myread
ecfc5424
AD
2301 if test -f UU/getfile.ok && \
2302 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
2303 then
2304 value="$ans"
2305 ansexp="$ans"
2306 break
2307 fi
2304df62
AD
2308 case "$ans" in
2309 none)
2310 value=''
2311 ansexp=''
2312 case "$none_ok" in
2313 true) type='';;
2314 esac
2315 ;;
2316 *)
2317 case "$tilde" in
2318 '') value="$ans"
2319 ansexp="$ans";;
2320 *)
2321 value=`UU/filexp $ans`
2322 case $? in
2323 0)
2324 if test "$ans" != "$value"; then
ecfc5424 2325 echo "(That expands to $value on this system.)"
2304df62
AD
2326 fi
2327 ;;
2328 *) value="$ans";;
2329 esac
2330 ansexp="$value"
2331 case "$exp_file" in
2332 '') value="$ans";;
2333 esac
2334 ;;
2335 esac
2336 case "$fullpath" in
2337 true)
2338 case "$ansexp" in
2339 /*) value="$ansexp" ;;
2340 *)
2341 redo=true
2342 case "$already" in
2343 true)
2344 echo "I shall only accept a full path name, as in /bin/ls." >&4
2345 echo "Use a ! shell escape if you wish to check pathnames." >&4
2346 ;;
2347 *)
2348 echo "Please give a full path name, starting with slash." >&4
2349 case "$tilde" in
2350 true)
2351 echo "Note that using ~name is ok provided it expands well." >&4
2352 already=true
2353 ;;
2354 esac
2355 esac
2356 ;;
2357 esac
2358 ;;
2359 esac
2360 case "$redo" in
2361 '')
2362 case "$type" in
2363 File)
2364 if test -f "$ansexp"; then
2365 type=''
2366 elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1
2367 then
2368 echo "($value is not a plain file, but that's ok.)"
2369 type=''
2370 fi
2371 ;;
2372 Directory)
2373 if test -d "$ansexp"; then
2374 type=''
2375 fi
2376 ;;
2377 Locate)
40000a8c 2378 if test -d "$ansexp"; then
a0d0e21e
LW
2379 echo "(Looking for $loc_file in directory $value.)"
2380 value="$value/$loc_file"
40000a8c 2381 ansexp="$ansexp/$loc_file"
2304df62 2382 fi
40000a8c 2383 if test -f "$ansexp"; then
2304df62
AD
2384 type=''
2385 fi
a0d0e21e
LW
2386 case "$nopath_ok" in
2387 true) case "$value" in
2388 */*) ;;
2389 *) echo "Assuming $value will be in people's path."
2390 type=''
2391 ;;
2392 esac
2393 ;;
2394 esac
2304df62
AD
2395 ;;
2396 esac
2397
2398 case "$skip" in
2399 true) type='';
2400 esac
2401
2402 case "$type" in
2403 '') ;;
2404 *)
2405 if test "$fastread" = yes; then
2406 dflt=y
2407 else
2408 dflt=n
2409 fi
2410 rp="$what $value doesn't exist. Use that name anyway?"
2411 . UU/myread
2412 dflt=''
2413 case "$ans" in
2414 y*) type='';;
2415 *) echo " ";;
2416 esac
2417 ;;
2418 esac
2419 ;;
2420 esac
2421 ;;
2422 esac
2423done
2424cd UU
2425ans="$value"
2426rp="$orig_rp"
2427dflt="$orig_dflt"
ecfc5424 2428rm -f getfile.ok
2304df62
AD
2429EOSC
2430
2431: What should the include directory be ?
2432echo " "
2433$echo $n "Hmm... $c"
a0d0e21e 2434dflt='/usr/include'
2304df62
AD
2435incpath=''
2436mips_type=''
2437if $test -f /bin/mips && /bin/mips; then
2438 echo "Looks like a MIPS system..."
2439 $cat >usr.c <<'EOCP'
2440#ifdef SYSTYPE_BSD43
2441/bsd43
2442#endif
2443EOCP
2444 if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
2445 dflt='/bsd43/usr/include'
2446 incpath='/bsd43'
2447 mips_type='BSD 4.3'
2448 else
2449 mips_type='System V'
2450 fi
2451 $rm -f usr.c usr.out
2452 echo "and you're compiling with the $mips_type compiler and libraries."
8e07c86e 2453 xxx_prompt=y
40000a8c 2454 echo "exit 0" >mips
2304df62
AD
2455else
2456 echo "Doesn't look like a MIPS system."
8e07c86e 2457 xxx_prompt=n
2304df62 2458 echo "exit 1" >mips
2304df62 2459fi
40000a8c
AD
2460chmod +x mips
2461$eunicefix mips
2304df62 2462echo " "
a0d0e21e
LW
2463case "$usrinc" in
2464'') ;;
2465*) dflt="$usrinc";;
2466esac
8e07c86e
AD
2467case "$xxx_prompt" in
2468y) fn=d/
2469 rp='Where are the include files you want to use?'
2470 . ./getfile
2471 usrinc="$ans"
2472 ;;
2473*) usrinc="$dflt"
2474 ;;
2475esac
2304df62 2476
a0d0e21e
LW
2477: see how we invoke the C preprocessor
2478echo " "
2479echo "Now, how can we feed standard input to your C preprocessor..." >&4
2480cat <<'EOT' >testcpp.c
2481#define ABC abc
2482#define XYZ xyz
2483ABC.XYZ
2484EOT
2485cd ..
2486echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
2487chmod 755 cppstdin
2488wrapper=`pwd`/cppstdin
2489ok='false'
2490cd UU
2304df62 2491
a0d0e21e
LW
2492if $test "X$cppstdin" != "X" && \
2493 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
2494 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
2495then
2496 echo "You used to use $cppstdin $cppminus so we'll use that again."
2497 case "$cpprun" in
2498 '') echo "But let's see if we can live without a wrapper..." ;;
2499 *)
2500 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
2501 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
2304df62 2502 then
a0d0e21e
LW
2503 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
2504 ok='true'
2505 else
2506 echo "(However, $cpprun $cpplast does not work, let's see...)"
2304df62
AD
2507 fi
2508 ;;
2509 esac
2304df62 2510else
a0d0e21e
LW
2511 case "$cppstdin" in
2512 '') ;;
2513 *)
2514 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
2515 ;;
2516 esac
2304df62 2517fi
2304df62 2518
a0d0e21e
LW
2519if $ok; then
2520 : nothing
2521elif echo 'Maybe "'"$cc"' -E" will work...'; \
2522 $cc -E <testcpp.c >testcpp.out 2>&1; \
2523 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2524 echo "Yup, it does."
2525 x_cpp="$cc -E"
2526 x_minus='';
2527elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
2528 $cc -E - <testcpp.c >testcpp.out 2>&1; \
2529 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2530 echo "Yup, it does."
2531 x_cpp="$cc -E"
2532 x_minus='-';
2533elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
2534 $cc -P <testcpp.c >testcpp.out 2>&1; \
2535 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2536 echo "Yipee, that works!"
2537 x_cpp="$cc -P"
2538 x_minus='';
2539elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
2540 $cc -P - <testcpp.c >testcpp.out 2>&1; \
2541 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2542 echo "At long last!"
2543 x_cpp="$cc -P"
2544 x_minus='-';
2545elif echo 'No such luck, maybe "'$cpp'" will work...'; \
2546 $cpp <testcpp.c >testcpp.out 2>&1; \
2547 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2548 echo "It works!"
2549 x_cpp="$cpp"
2550 x_minus='';
2551elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
2552 $cpp - <testcpp.c >testcpp.out 2>&1; \
2553 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2554 echo "Hooray, it works! I was beginning to wonder."
2555 x_cpp="$cpp"
2556 x_minus='-';
2557elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
2558 $wrapper <testcpp.c >testcpp.out 2>&1; \
2559 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2560 x_cpp="$wrapper"
2561 x_minus=''
2562 echo "Eureka!"
2563else
2564 dflt=''
2565 rp="No dice. I can't find a C preprocessor. Name one:"
2566 . ./myread
2567 x_cpp="$ans"
2568 x_minus=''
2569 $x_cpp <testcpp.c >testcpp.out 2>&1
2570 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2571 echo "OK, that will do." >&4
2572 else
2573echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
2574 exit 1
2575 fi
2576fi
2577
2578case "$ok" in
2579false)
2580 cppstdin="$x_cpp"
2581 cppminus="$x_minus"
2582 cpprun="$x_cpp"
2583 cpplast="$x_minus"
2584 set X $x_cpp
2585 shift
2586 case "$1" in
2587 "$cpp")
2588 echo "Perhaps can we force $cc -E using a wrapper..."
2589 if $wrapper <testcpp.c >testcpp.out 2>&1; \
2590 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
2591 then
2592 echo "Yup, we can."
2593 cppstdin="$wrapper"
2594 cppminus='';
2595 else
2596 echo "Nope, we'll have to live without it..."
2597 fi
2598 ;;
2599 esac
2600 case "$cpprun" in
2601 "$wrapper")
2602 cpprun=''
2603 cpplast=''
2604 ;;
2605 esac
2606 ;;
2607esac
2608
2609case "$cppstdin" in
2610"$wrapper") ;;
2611*) $rm -f $wrapper;;
2612esac
2613$rm -f testcpp.c testcpp.out
2614
8e07c86e
AD
2615: Set private lib path
2616case "$plibpth" in
2617'') if ./mips; then
2618 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
2619 fi;;
2620esac
2621case "$libpth" in
2622' ') dlist='';;
2623'') dlist="$loclibpth $plibpth $glibpth";;
2624*) dlist="$libpth";;
a0d0e21e 2625esac
a0d0e21e 2626
8e07c86e
AD
2627: Now check and see which directories actually exist, avoiding duplicates
2628libpth=''
2629for xxx in $dlist
2630do
2631 if $test -d $xxx; then
2632 case " $libpth " in
2633 *" $xxx "*) ;;
2634 *) libpth="$libpth $xxx";;
2635 esac
2636 fi
2637done
2638$cat <<'EOM'
a0d0e21e 2639
8e07c86e
AD
2640Some systems have incompatible or broken versions of libraries. Among
2641the directories listed in the question below, please remove any you
2642know not to be holding relevant libraries, and add any that are needed.
2643Say "none" for none.
2644
2645EOM
2646case "$libpth" in
2647'') dflt='none';;
2648*)
2649 set X $libpth
2650 shift
2651 dflt=${1+"$@"}
2652 ;;
2653esac
2654rp="Directories to use for library searches?"
a0d0e21e 2655. ./myread
8e07c86e
AD
2656case "$ans" in
2657none) libpth=' ';;
2658*) libpth="$ans";;
a0d0e21e
LW
2659esac
2660
8e07c86e
AD
2661: determine root of directory hierarchy where package will be installed.
2662case "$prefix" in
2663'')
2664 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
2665 ;;
2666*)
2667 dflt="$prefix"
a0d0e21e
LW
2668 ;;
2669esac
8e07c86e 2670$cat <<EOM
a0d0e21e 2671
8e07c86e
AD
2672By default, $package will be installed in $dflt/bin, manual
2673pages under $dflt/man, etc..., i.e. with $dflt as prefix for
2674all installation directories. Typically set to /usr/local, but you
2675may choose /usr if you wish to install $package among your system
2676binaries. If you wish to have binaries under /bin but manual pages
2677under /usr/local/man, that's ok: you will be prompted separately
2678for each of the installation directories, the prefix being only used
2679to set the defaults.
2680
2681EOM
2682fn=d~
2683rp='Installation prefix to use?'
2684. ./getfile
2685oldprefix=''
2686case "$prefix" in
a0d0e21e 2687'') ;;
8e07c86e
AD
2688*)
2689 case "$ans" in
2690 "$prefix") ;;
2691 *) oldprefix="$prefix";;
2692 esac
2693 ;;
a0d0e21e 2694esac
8e07c86e
AD
2695prefix="$ans"
2696prefixexp="$ansexp"
a0d0e21e 2697
8e07c86e
AD
2698: set the prefixit variable, to compute a suitable default value
2699prefixit='case "$3" in
2700""|none)
2701 case "$oldprefix" in
2702 "") eval "$1=\"\$$2\"";;
2703 *)
2704 case "$3" in
2705 "") eval "$1=";;
2706 none)
2707 eval "tp=\"\$$2\"";
2708 case "$tp" in
2709 ""|" ") eval "$1=\"\$$2\"";;
2710 *) eval "$1=";;
2711 esac;;
2712 esac;;
2713 esac;;
2714*)
2715 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
2716 case "$tp" in
2717 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
2718 /*-$oldprefix/*|\~*-$oldprefix/*)
2719 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
2720 *) eval "$1=\"\$$2\"";;
2721 esac;;
2722esac'
a0d0e21e 2723
8e07c86e
AD
2724: is AFS running?
2725echo " "
2726if test -d /afs; then
2727 echo "AFS may be running... I'll be extra cautious then..." >&4
2728 afs=true
a0d0e21e 2729else
8e07c86e
AD
2730 echo "AFS does not seem to be running..." >&4
2731 afs=false
a0d0e21e 2732fi
a0d0e21e 2733
8e07c86e
AD
2734: determine where public executables go
2735echo " "
2736set dflt bin bin
2737eval $prefixit
2738fn=d~
2739rp='Pathname where the public executables will reside?'
2740. ./getfile
2741if $test "X$ansexp" != "X$binexp"; then
2742 installbin=''
2743fi
2744bin="$ans"
2745binexp="$ansexp"
2746if $afs; then
2747 $cat <<EOM
2304df62 2748
8e07c86e
AD
2749Since you are running AFS, I need to distinguish the directory in which
2750executables reside from the directory in which they are installed (and from
2751which they are presumably copied to the former directory by occult means).
a0d0e21e 2752
8e07c86e
AD
2753EOM
2754 case "$installbin" in
2755 '') dflt=`echo $binexp | sed 's#^/afs/#/afs/.#'`;;
2756 *) dflt="$installbin";;
2757 esac
2758 fn=de~
2759 rp='Where will public executables be installed?'
2760 . ./getfile
2761 installbin="$ans"
2762else
2763 installbin="$binexp"
2764fi
2304df62 2765
8e07c86e
AD
2766: set the prefixup variable, to restore leading tilda escape
2767prefixup='case "$prefixexp" in
2768"$prefix") ;;
2769*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
2770esac'
2771
2772: determine where public executable scripts go
2773set scriptdir scriptdir
2774eval $prefixit
2775case "$scriptdir" in
2776'')
2777 dflt="$bin"
2778 : guess some guesses
2779 $test -d /usr/share/scripts && dflt=/usr/share/scripts
2780 $test -d /usr/share/bin && dflt=/usr/share/bin
2781 $test -d /usr/local/script && dflt=/usr/local/script
2782 $test -d $prefixexp/script && dflt=$prefixexp/script
2783 set dflt
2784 eval $prefixup
2785 ;;
2786*) dflt="$scriptdir"
2787 ;;
2788esac
2789$cat <<EOM
2790
2791Some installations have a separate directory just for executable scripts so
2792that they can mount it across multiple architectures but keep the scripts in
2793one spot. You might, for example, have a subdirectory of /usr/share for this.
2794Or you might just lump your scripts in with all your other executables.
2795
2796EOM
2797fn=d~
2798rp='Where do you keep publicly executable scripts?'
2799. ./getfile
2800if $test "X$ansexp" != "X$scriptdirexp"; then
2801 installscript=''
2802fi
2803scriptdir="$ans"
2804scriptdirexp="$ansexp"
2805if $afs; then
2806 $cat <<EOM
2807
2808Since you are running AFS, I need to distinguish the directory in which
2809scripts reside from the directory in which they are installed (and from
2810which they are presumably copied to the former directory by occult means).
2811
2812EOM
2813 case "$installscript" in
2814 '') dflt=`echo $scriptdirexp | sed 's#^/afs/#/afs/.#'`;;
2815 *) dflt="$installscript";;
2816 esac
2817 fn=de~
2818 rp='Where will public scripts be installed?'
2819 . ./getfile
2820 installscript="$ans"
2821else
2822 installscript="$scriptdirexp"
2823fi
2824
2825: determine where private executables go
2826set dflt privlib lib/$package
2827eval $prefixit
2828$cat <<EOM
2829
2830There are some auxiliary files for $package that need to be put into a
2831private library directory that is accessible by everyone.
2832
2833EOM
2834fn=d~+
2835rp='Pathname where the private library files will reside?'
2836. ./getfile
2837if $test "X$privlibexp" != "X$ansexp"; then
2838 installprivlib=''
2839fi
2840privlib="$ans"
2841privlibexp="$ansexp"
2842if $afs; then
2843 $cat <<EOM
2844
2845Since you are running AFS, I need to distinguish the directory in which
2846private files reside from the directory in which they are installed (and from
2847which they are presumably copied to the former directory by occult means).
2848
2849EOM
2850 case "$installprivlib" in
2851 '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;;
2852 *) dflt="$installprivlib";;
2853 esac
2854 fn=de~
2855 rp='Where will private files be installed?'
2856 . ./getfile
2857 installprivlib="$ans"
2858else
2859 installprivlib="$privlibexp"
2860fi
2861
2862: determine the architecture name
2863echo " "
2864if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
2865 tarch=`arch`"-$osname"
2866elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
2867 if uname -m > tmparch 2>&1 ; then
2868 tarch=`$sed -e 's/ /_/g' -e 's/$/'"-$osname/" tmparch`
2869 else
2870 tarch="$osname"
2871 fi
2872 $rm -f tmparch
2873else
2874 tarch="$osname"
2875fi
2876case "$myarchname" in
2877''|"$tarch") ;;
2878*)
2879 echo "(Your architecture name used to be $myarchname.)"
2880 archname=''
2881 ;;
2882esac
2883case "$archname" in
2884'') dflt="$tarch";;
2885*) dflt="$archname";;
2886esac
2887rp='What is your architecture name'
2888. ./myread
2889archname="$ans"
2890myarchname="$tarch"
2891
2892: determine where public architecture dependent libraries go
2893set archlib archlib
2894eval $prefixit
2895case "$archlib" in
2896'')
2897 case "$privlib" in
2898 '')
2899 dflt=`./loc . "." $prefixexp/lib /usr/local/lib /usr/lib /lib`
2900 set dflt
2901 eval $prefixup
2902 ;;
2903 *) dflt="$privlib/$archname";;
2904 esac
2905 ;;
2906*) dflt="$archlib";;
2907esac
2908cat <<EOM
2909
2910$spackage contains architecture-dependent library files. If you are
2911sharing libraries in a heterogeneous environment, you might store
2912these files in a separate location. Otherwise, you can just include
2913them with the rest of the public library files.
2914
2915EOM
2916fn=d~
2917rp='Where do you want to put the public architecture-dependent libraries?'
2918. ./getfile
2919archlib="$ans"
2920archlibexp="$ansexp"
2921
2922if $afs; then
2923 $cat <<EOM
2924
2925Since you are running AFS, I need to distinguish the directory in which
2926private files reside from the directory in which they are installed (and from
2927which they are presumably copied to the former directory by occult means).
2928
2929EOM
2930 case "$installarchlib" in
2931 '') dflt=`echo $archlibexp | sed 's#^/afs/#/afs/.#'`;;
2932 *) dflt="$installarchlib";;
2933 esac
2934 fn=de~
2935 rp='Where will architecture-dependent library files be installed?'
2936 . ./getfile
2937 installarchlib="$ans"
2938else
2939 installarchlib="$archlibexp"
2940fi
2941if $test X"$archlib" = X"$privlib"; then
2942 d_archlib="$undef"
2943else
2944 d_archlib="$define"
2945fi
2946
2947: determine whether the user wants to include a site-specific library
2948: in addition to privlib.
2949$cat <<EOM
2950
2951Some sites may wish to specify a local directory for $package
2952to search by default in addition to $privlib.
2953If you don't want to use such an additional directory, answer 'none'.
2954
2955EOM
2956case "$sitelib" in
2957'') dflt=none ;;
2958*) dflt="$sitelib" ;;
2959esac
2960fn=d~+n
2961rp='Local directory for additional library files?'
2962. ./getfile
2963if $test "X$sitelibexp" != "X$ansexp"; then
2964 installsitelib=''
2965fi
2966sitelib="$ans"
2967sitelibexp="$ansexp"
2968if $afs; then
2969 case "$sitelib" in
2970 '') installsitelib="$sitelibexp"
2971 ;;
2972 *) $cat <<EOM
2973
2974Since you are running AFS, I need to distinguish the directory in which
2975private files reside from the directory in which they are installed (and from
2976which they are presumably copied to the former directory by occult means).
2977
2978EOM
2979 case "$installsitelib" in
2980 '') dflt=`echo $sitelibexp | sed 's#^/afs/#/afs/.#'`;;
2981 *) dflt="$installsitelib";;
2982 esac
2983 fn=de~
2984 rp='Where will additional local files be installed?'
2985 . ./getfile
2986 installsitelib="$ans"
2987 ;;
2988 esac
2989else
2990 installsitelib="$sitelibexp"
2991fi
2992
2993case "$sitelibexp" in
2994'') d_sitelib=undef ;;
2995*) d_sitelib=define ;;
2996esac
2997
2998: determine where manual pages go
2999set man1dir man1dir none
3000eval $prefixit
3001$cat <<EOM
3002
3003$spackage has manual pages available in source form.
3004EOM
3005case "$nroff" in
3006nroff)
3007 echo "However, you don't have nroff, so they're probably useless to you."
3008 case "$man1dir" in
3009 '') man1dir="none";;
3010 esac;;
3011esac
3012echo "If you don't want the manual sources installed, answer 'none'."
3013case "$man1dir" in
3014'')
3015 lookpath="$prefixexp/man/man1 $prefixexp/man/u_man/man1"
3016 lookpath="$lookpath $prefixexp/man/l_man/man1"
3017 lookpath="$lookpath /usr/local/man/man1 /opt/man/man1 /usr/man/manl"
3018 lookpath="$lookpath /usr/man/local/man1 /usr/man/l_man/man1"
3019 lookpath="$lookpath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
3020 lookpath="$lookpath /usr/man/man.L"
3021 man1dir=`./loc . $prefixexp/man/man1 $lookpath`
3022 if $test -d "$man1dir"; then
3023 dflt="$man1dir"
3024 else
3025 dflt="$sysman"
3026 fi
3027 set dflt
3028 eval $prefixup
3029 ;;
3030' ') dflt=none;;
3031*) dflt="$man1dir"
3032 ;;
3033esac
3034echo " "
3035fn=dn~
3036rp="Where do the main $spackage manual pages (source) go?"
3037. ./getfile
3038if test "X$man1direxp" != "X$ansexp"; then
3039 installman1dir=''
3040fi
3041man1dir="$ans"
3042man1direxp="$ansexp"
3043case "$man1dir" in
3044'') man1dir=' '
3045 installman1dir='';;
3046esac
3047if $afs; then
3048 $cat <<EOM
3049
3050Since you are running AFS, I need to distinguish the directory in which
3051manual pages reside from the directory in which they are installed (and from
3052which they are presumably copied to the former directory by occult means).
3053
3054EOM
3055 case "$installman1dir" in
3056 '') dflt=`echo $man1direxp | sed 's#^/afs/#/afs/.#'`;;
3057 *) dflt="$installman1dir";;
3058 esac
3059 fn=de~
3060 rp='Where will man pages be installed?'
3061 . ./getfile
3062 installman1dir="$ans"
3063else
3064 installman1dir="$man1direxp"
3065fi
3066
3067: What suffix to use on installed man pages
3068
3069case "$man1dir" in
3070' ')
3071 man1ext='0'
3072 ;;
3073*)
3074 rp="What suffix should be used for the main $spackage man pages?"
3075 case "$man1dir" in
3076 *1) dflt=1 ;;
3077 *1p) dflt=1p ;;
3078 *1pm) dflt=1pm ;;
3079 *l) dflt=l;;
3080 *n) dflt=n;;
3081 *o) dflt=o;;
3082 *p) dflt=p;;
3083 *C) dflt=C;;
3084 *L) dflt=L;;
3085 *L1) dflt=L1;;
3086 *) dflt=1;;
3087 esac
3088 . ./myread
3089 man1ext="$ans"
3090 ;;
3091esac
3092
3093: set up the script used to warn in case of inconsistency
3094cat <<'EOSC' >whoa
3095dflt=y
3096echo " "
3097echo "*** WHOA THERE!!! ***" >&4
3098echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
3099rp=" Keep the $hint value?"
3100. ./myread
3101case "$ans" in
3102y) td=$was; tu=$was;;
3103esac
3104EOSC
3105
3106: function used to set $1 to $val
3107setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3108case "$val$was" in
3109$define$undef) . ./whoa; eval "$var=\$td";;
3110$undef$define) . ./whoa; eval "$var=\$tu";;
3111*) eval "$var=$val";;
3112esac'
3113
3114: see if we can have long filenames
3115echo " "
3116rmlist="$rmlist /tmp/cf$$"
3117$test -d /tmp/cf$$ || mkdir /tmp/cf$$
3118first=123456789abcdef
3119second=/tmp/cf$$/$first
3120$rm -f $first $second
3121if (echo hi >$first) 2>/dev/null; then
3122 if $test -f 123456789abcde; then
3123 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
3124 val="$undef"
3125 else
3126 if (echo hi >$second) 2>/dev/null; then
3127 if $test -f /tmp/cf$$/123456789abcde; then
3128 $cat <<'EOM'
3129That's peculiar... You can have filenames longer than 14 characters, but only
3130on some of the filesystems. Maybe you are using NFS. Anyway, to avoid problems
3131I shall consider your system cannot support long filenames at all.
3132EOM
3133 val="$undef"
3134 else
3135 echo 'You can have filenames longer than 14 characters.' >&4
3136 val="$define"
3137 fi
3138 else
3139 $cat <<'EOM'
3140How confusing! Some of your filesystems are sane enough to allow filenames
3141longer than 14 characters but some others like /tmp can't even think about them.
3142So, for now on, I shall assume your kernel does not allow them at all.
3143EOM
3144 val="$undef"
3145 fi
3146 fi
3147else
3148 $cat <<'EOM'
3149You can't have filenames longer than 14 chars. You can't even think about them!
3150EOM
3151 val="$undef"
3152fi
3153set d_flexfnam
3154eval $setvar
3155$rm -rf /tmp/cf$$ 123456789abcde*
3156
3157: determine where library module manual pages go
3158set man3dir man3dir none
3159eval $prefixit
3160$cat <<EOM
3161
3162$spackage has manual pages for many of the library modules.
3163EOM
3164
3165case "$nroff" in
3166nroff)
3167 $cat <<'EOM'
3168However, you don't have nroff, so they're probably useless to you.
3169You can use the supplied perldoc script instead.
3170EOM
3171 case "$man3dir" in
3172 '') man3dir="none";;
3173 esac;;
3174esac
3175
3176case "$d_flexfnam" in
3177undef)
3178 $cat <<'EOM'
3179However, your system can't handle the long file names like File::Basename.3.
3180You can use the supplied perldoc script instead.
3181EOM
3182 case "$man3dir" in
3183 '') man3dir="none";;
3184 esac;;
3185esac
3186
3187echo "If you don't want the manual sources installed, answer 'none'."
3188case "$man3dir" in
3189'') dflt="$privlib/man/man3" ;;
3190' ') dflt=none;;
3191*) dflt="$man3dir" ;;
3192esac
3193echo " "
3194
3195fn=dn~
3196rp="Where do the $spackage library man pages (source) go?"
3197. ./getfile
3198if test "X$man3direxp" != "X$ansexp"; then
3199 installman3dir=''
3200fi
3201
3202man3dir="$ans"
3203man3direxp="$ansexp"
3204case "$man3dir" in
3205'') man3dir=' '
3206 installman3dir='';;
3207esac
3208if $afs; then
3209 $cat <<EOM
3210
3211Since you are running AFS, I need to distinguish the directory in which
3212manual pages reside from the directory in which they are installed (and from
3213which they are presumably copied to the former directory by occult means).
3214
3215EOM
3216 case "$installman3dir" in
3217 '') dflt=`echo $man3direxp | sed 's#^/afs/#/afs/.#'`;;
3218 *) dflt="$installman3dir";;
3219 esac
3220 fn=de~
3221 rp='Where will man pages be installed?'
3222 . ./getfile
3223 installman3dir="$ans"
3224else
3225 installman3dir="$man3direxp"
3226fi
3227
3228: What suffix to use on installed man pages
3229
3230case "$man3dir" in
3231' ')
3232 man3ext='0'
3233 ;;
3234*)
3235 rp="What suffix should be used for the $spackage library man pages?"
3236 case "$man3dir" in
3237 *3) dflt=3 ;;
3238 *3p) dflt=3p ;;
3239 *3pm) dflt=3pm ;;
3240 *l) dflt=l;;
3241 *n) dflt=n;;
3242 *o) dflt=o;;
3243 *p) dflt=p;;
3244 *C) dflt=C;;
3245 *L) dflt=L;;
3246 *L3) dflt=L3;;
3247 *) dflt=3;;
3248 esac
3249 . ./myread
3250 man3ext="$ans"
3251 ;;
3252esac
3253
3254: see if we have to deal with yellow pages, now NIS.
3255if $test -d /usr/etc/yp || $test -d /etc/yp; then
3256 if $test -f /usr/etc/nibindd; then
3257 echo " "
3258 echo "I'm fairly confident you're on a NeXT."
3259 echo " "
3260 rp='Do you get the hosts file via NetInfo?'
3261 dflt=y
3262 case "$hostcat" in
3263 nidump*) ;;
3264 '') ;;
3265 *) dflt=n;;
3266 esac
3267 . ./myread
3268 case "$ans" in
3269 y*) hostcat='nidump hosts .';;
3270 *) case "$hostcat" in
3271 nidump*) hostcat='';;
3272 esac
3273 ;;
3274 esac
3275 fi
3276 case "$hostcat" in
3277 nidump*) ;;
3278 *)
3279 case "$hostcat" in
3280 *ypcat*) dflt=y;;
3281 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
3282 dflt=y
3283 else
3284 dflt=n
3285 fi;;
3286 *) dflt=n;;
3287 esac
3288 echo " "
3289 rp='Are you getting the hosts file via yellow pages?'
3290 . ./myread
3291 case "$ans" in
3292 y*) hostcat='ypcat hosts';;
3293 *) hostcat='cat /etc/hosts';;
3294 esac
3295 ;;
3296 esac
3297fi
3298
3299: now get the host name
3300echo " "
3301echo "Figuring out host name..." >&4
3302case "$myhostname" in
3303'') cont=true
3304 echo 'Maybe "hostname" will work...'
3305 if tans=`sh -c hostname 2>&1` ; then
3306 myhostname=$tans
3307 phostname=hostname
3308 cont=''
3309 fi
3310 ;;
3311*) cont='';;
3312esac
3313if $test "$cont"; then
3314 if ./xenix; then
3315 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
3316 if tans=`cat /etc/systemid 2>&1` ; then
3317 myhostname=$tans
3318 phostname='cat /etc/systemid'
3319 echo "Whadyaknow. Xenix always was a bit strange..."
3320 cont=''
3321 fi
3322 elif $test -r /etc/systemid; then
3323 echo "(What is a non-Xenix system doing with /etc/systemid?)"
3324 fi
3325fi
3326if $test "$cont"; then
3327 echo 'No, maybe "uuname -l" will work...'
3328 if tans=`sh -c 'uuname -l' 2>&1` ; then
3329 myhostname=$tans
3330 phostname='uuname -l'
3331 else
3332 echo 'Strange. Maybe "uname -n" will work...'
3333 if tans=`sh -c 'uname -n' 2>&1` ; then
3334 myhostname=$tans
3335 phostname='uname -n'
3336 else
3337 echo 'Oh well, maybe I can mine it out of whoami.h...'
3338 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
3339 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
3340 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
3341 else
3342 case "$myhostname" in
3343 '') echo "Does this machine have an identity crisis or something?"
3344 phostname='';;
3345 *)
3346 echo "Well, you said $myhostname before..."
3347 phostname='echo $myhostname';;
3348 esac
3349 fi
3350 fi
3351 fi
3352fi
3353: you do not want to know about this
3354set $myhostname
3355myhostname=$1
3356
3357: verify guess
3358if $test "$myhostname" ; then
3359 dflt=y
3360 rp='Your host name appears to be "'$myhostname'".'" Right?"
3361 . ./myread
3362 case "$ans" in
3363 y*) ;;
3364 *) myhostname='';;
3365 esac
3366fi
3367
3368: bad guess or no guess
3369while $test "X$myhostname" = X ; do
3370 dflt=''
3371 rp="Please type the (one word) name of your host:"
3372 . ./myread
3373 myhostname="$ans"
3374done
3375
3376: translate upper to lower if necessary
3377case "$myhostname" in
3378*[A-Z]*)
3379 echo "(Normalizing case in your host name)"
3380 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
3381 ;;
3382esac
3383
3384case "$myhostname" in
3385*.*)
3386 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
3387 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
3388 echo "(Trimming domain name from host name--host name is now $myhostname)"
3389 ;;
3390*) case "$mydomain" in
3391 '')
3392 $hostcat >hosts
3393 dflt=.`$awk "/[0-9].*$myhostname/ {for(i=2; i<=NF;i++) print \\\$i}" \
3394 hosts | $sort | $uniq | \
3395 $sed -n -e "s/$myhostname\.\([a-zA-Z_.]\)/\1/p"`
3396 case "$dflt" in
3397 .) echo "(You do not have fully-qualified names in /etc/hosts)"
3398 tans=`./loc resolv.conf X /etc /usr/etc`
3399 if $test -f "$tans"; then
3400 echo "(Attempting domain name extraction from $tans)"
3401 dflt=.`egrep '^domain' $tans | $sed 's/domain[ ]*\(.*\)/\1/' \
3402 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
3403 fi
3404 ;;
3405 esac
3406 case "$dflt" in
3407 .) echo "(No help from resolv.conf either -- attempting clever guess)"
3408 dflt=.`sh -c domainname 2>/dev/null`
3409 case "$dflt" in
3410 '') dflt='.';;
3411 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
3412 esac
3413 ;;
3414 esac
3415 case "$dflt" in
3416 .) echo "(Lost all hope -- silly guess then)"
3417 dflt='.uucp'
3418 ;;
3419 esac
3420 $rm -f hosts
3421 ;;
3422 *) dflt="$mydomain";;
3423 esac;;
3424esac
3425echo " "
3426rp="What is your domain name?"
3427. ./myread
3428tans="$ans"
3429case "$ans" in
3430'') ;;
3431.*) ;;
3432*) tans=".$tans";;
3433esac
3434mydomain="$tans"
3435
3436: translate upper to lower if necessary
3437case "$mydomain" in
3438*[A-Z]*)
3439 echo "(Normalizing case in your domain name)"
3440 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
3441 ;;
3442esac
3443
3444: a little sanity check here
3445case "$phostname" in
3446'') ;;
3447*)
3448 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
3449 $myhostname$mydomain|$myhostname) ;;
3450 *)
3451 case "$phostname" in
3452 sed*)
3453 echo "(That doesn't agree with your whoami.h file, by the way.)"
3454 ;;
3455 *)
3456 echo "(That doesn't agree with your $phostname command, by the way.)"
3457 ;;
3458 esac
3459 ;;
3460 esac
3461 ;;
3462esac
3463
3464$cat <<EOM
3465
3466I need to get your e-mail address in Internet format if possible, i.e.
3467something like user@host.domain. Please answer accurately since I have
3468no easy means to double check it. The default value provided below
3469is most probably close to the reality but may not be valid from outside
3470your organization...
3471
3472EOM
3473cont=x
3474while test "$cont"; do
3475 case "$cf_email" in
3476 '') dflt="$cf_by@$myhostname$mydomain";;
3477 *) dflt="$cf_email";;
3478 esac
3479 rp='What is your e-mail address?'
3480 . ./myread
3481 cf_email="$ans"
3482 case "$cf_email" in
3483 *@*.*) cont='' ;;
3484 *)
3485 rp='Address does not look like an Internet one. Use it anyway?'
3486 case "$fastread" in
3487 yes) dflt=y ;;
3488 *) dflt=n ;;
3489 esac
3490 . ./myread
3491 case "$ans" in
3492 y*) cont='' ;;
3493 *) echo " " ;;
3494 esac
3495 ;;
3496 esac
3497done
3498
3499$cat <<EOM
3500
3501If you or somebody else will be maintaining perl at your site, please
3502fill in the correct e-mail address here so that they may be contacted
3503if necessary. Currently, the "perlbug" program included with perl
3504will send mail to this address in addition to perlbug@perl.com. You may
3505enter "none" for no administrator.
3506
3507EOM
3508case "$perladmin" in
3509'') dflt="$cf_email";;
3510*) dflt="$perladmin";;
3511esac
3512rp='Perl administrator e-mail address'
3513. ./myread
3514perladmin="$ans"
3515
3516
3517: determine optimize, if desired, or use for debug flag also
3518case "$optimize" in
3519' ') dflt='none';;
3520'') dflt='-O';;
3521*) dflt="$optimize";;
3522esac
3523$cat <<EOH
3524
3525Some C compilers have problems with their optimizers, by default, $package
3526compiles with the -O flag to use the optimizer. Alternately, you might want
3527to use the symbolic debugger, which uses the -g flag (on traditional Unix
3528systems). Either flag can be specified here. To use neither flag, specify
3529the word "none".
3530
3531EOH
3532rp="What optimizer/debugger flag should be used?"
3533. ./myread
3534optimize="$ans"
3535case "$optimize" in
3536'none') optimize=" ";;
3537esac
3538
3539dflt=''
3540case "$ccflags" in
3541'')
3542 case "$gccversion" in
3543 1*) dflt='-fpcc-struct-return' ;;
3544 esac
3545 case "$optimize" in
3546 *-g*) dflt="$dflt -DDEBUGGING";;
3547 esac
3548 case "$gccversion" in
3549 2*) if test -d /etc/conf/kconfig.d &&
3550 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3551 then
3552 dflt="$dflt -posix"
3553 fi
3554 ;;
3555 esac
3556 ;;
3557esac
3558
3559case "$mips_type" in
3560*BSD*|'') inclwanted="$locincpth $usrinc";;
3561*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3562esac
3563for thisincl in $inclwanted; do
3564 if $test -d $thisincl; then
3565 if $test x$thisincl != x$usrinc; then
3566 case "$dflt" in
3567 *$thisincl*);;
3568 *) dflt="$dflt -I$thisincl";;
3569 esac
3570 fi
3571 fi
3572done
3573
3574inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3575 xxx=true;
3576elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3577 xxx=true;
3578else
3579 xxx=false;
3580fi;
3581if $xxx; then
3582 case "$dflt" in
3583 *$2*);;
3584 *) dflt="$dflt -D$2";;
3585 esac;
3586fi'
3587
3588if ./osf1; then
3589 set signal.h __LANGUAGE_C__; eval $inctest
3590else
3591 set signal.h LANGUAGE_C; eval $inctest
3592fi
3593set signal.h NO_PROTOTYPE; eval $inctest
3594set signal.h _NO_PROTO; eval $inctest
3595
3596case "$dflt" in
3597'') dflt=none;;
3598esac
3599case "$ccflags" in
3600'') ;;
3601*) dflt="$ccflags";;
3602esac
3603$cat <<EOH
3604
3605Your C compiler may want other flags. For this question you should include
3606-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3607but you should NOT include libraries or ld flags like -lwhatever. If you
3608want $package to honor its debug switch, you should include -DDEBUGGING here.
3609Your C compiler might also need additional flags, such as -D_POSIX_SOURCE,
3610-DHIDEMYMALLOC or -DCRIPPLED_CC.
3611
3612To use no flags, specify the word "none".
3613
3614EOH
3615set X $dflt
3616shift
3617dflt=${1+"$@"}
3618rp="Any additional cc flags?"
3619. ./myread
3620case "$ans" in
3621none) ccflags='';;
3622*) ccflags="$ans";;
3623esac
2304df62
AD
3624
3625: the following weeds options from ccflags that are of no interest to cpp
3626cppflags="$ccflags"
a0d0e21e
LW
3627case "$gccversion" in
36281*) cppflags="$cppflags -D__GNUC__"
2304df62
AD
3629esac
3630case "$mips_type" in
3631'');;
3632*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3633esac
3634case "$cppflags" in
3635'');;
a0d0e21e
LW
3636*)
3637 echo " "
3638 echo "Let me guess what the preprocessor flags are..." >&4
3639 set X $cppflags
3640 shift
2304df62 3641 cppflags=''
a0d0e21e
LW
3642 $cat >cpp.c <<'EOM'
3643#define BLURFL foo
3644
3645BLURFL xx LFRULB
3646EOM
3647 previous=''
3648 for flag in $*
2304df62 3649 do
a0d0e21e
LW
3650 case "$flag" in
3651 -*) ftry="$flag";;
3652 *) ftry="$previous $flag";;
2304df62 3653 esac
a0d0e21e
LW
3654 if $cppstdin -DLFRULB=bar $ftry $cppminus <cpp.c \
3655 >cpp1.out 2>/dev/null && \
3656 $cpprun -DLFRULB=bar $ftry $cpplast <cpp.c \
3657 >cpp2.out 2>/dev/null && \
3658 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3659 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3660 then
3661 cppflags="$cppflags $ftry"
3662 previous=''
3663 else
3664 previous="$flag"
3665 fi
2304df62 3666 done
a0d0e21e
LW
3667 set X $cppflags
3668 shift
3669 cppflags=${1+"$@"}
2304df62 3670 case "$cppflags" in
a0d0e21e 3671 *-*) echo "They appear to be: $cppflags";;
2304df62 3672 esac
a0d0e21e 3673 $rm -f cpp.c cpp?.out
2304df62
AD
3674 ;;
3675esac
3676
3677: flags used in final linking phase
8e07c86e 3678
2304df62 3679case "$ldflags" in
ecfc5424 3680'') if ./venix; then
2304df62
AD
3681 dflt='-i -z'
3682 else
a0d0e21e 3683 dflt=''
2304df62 3684 fi
a0d0e21e
LW
3685 case "$ccflags" in
3686 *-posix*) dflt="$dflt -posix" ;;
3687 esac
2304df62
AD
3688 ;;
3689*) dflt="$ldflags";;
3690esac
8e07c86e
AD
3691
3692: Try to guess additional flags to pick up local libraries.
3693for thislibdir in $libpth; do
3694 case " $loclibpth " in
3695 *" $thislibdir "*)
3696 case "$dflt " in
3697 "-L$thislibdir ") ;;
3698 *) dflt="$dflt -L$thislibdir" ;;
3699 esac
3700 ;;
3701 esac
3702done
3703
3704case "$dflt" in
3705'') dflt='none' ;;
3706esac
3707
3708$cat <<EOH
3709
3710Your C linker may need flags. For this question you should
3711include -L/whatever and any other flags used by the C linker, but you
3712should NOT include libraries like -lwhatever.
3713
3714Make sure you include the appropriate -L/path flags if your C linker
3715does not normally search all of the directories you specified above,
3716namely
3717 $libpth
3718To use no flags, specify the word "none".
3719
3720EOH
3721
2304df62
AD
3722rp="Any additional ld flags (NOT including libraries)?"
3723. ./myread
3724case "$ans" in
3725none) ldflags='';;
3726*) ldflags="$ans";;
3727esac
3728rmlist="$rmlist pdp11"
3729
16d20bd9
AD
3730: coherency check
3731echo " "
3732echo "Checking your choice of C compiler and flags for coherency..." >&4
8e07c86e 3733set X $cc $optimize $ccflags $ldflags try.c -o try
16d20bd9
AD
3734shift
3735$cat >try.msg <<EOM
3736I've tried to compile and run a simple program with:
3737
3738 $*
3739 ./try
3740
3741and I got the following output:
3742
3743EOM
3744$cat > try.c <<'EOF'
3745#include <stdio.h>
3746main() { exit(0); }
3747EOF
3748dflt=y
3749if sh -c "$cc $optimize $ccflags try.c -o try $ldflags" >>try.msg 2>&1; then
3750 if sh -c './try' >>try.msg 2>&1; then
3751 dflt=n
3752 else
3753 echo "The program compiled OK, but exited with status $?." >>try.msg
3754 rp="You have a problem. Shall I abort Configure"
3755 dflt=y
3756 fi
3757else
3758 echo "I can't compile the test program." >>try.msg
3759 rp="You have a BIG problem. Shall I abort Configure"
3760 dflt=y
3761fi
3762case "$dflt" in
3763y)
3764 $cat try.msg
3765 case "$knowitall" in
3766 '')
3767 echo "(The supplied flags might be incorrect with this C compiler.)"
3768 ;;
3769 *) dflt=n;;
3770 esac
3771 echo " "
3772 . ./myread
3773 case "$ans" in
3774 n*|N*) ;;
3775 *) echo "Ok. Stopping Configure." >&4
3776 exit 1
3777 ;;
3778 esac
3779 ;;
3780n) echo "OK, that should do.";;
3781esac
3782$rm -f try try.* core
3783
a0d0e21e
LW
3784: compute shared library extension
3785case "$so" in
3786'')
3787 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3788 dflt='sl'
3789 else
3790 dflt='so'
3791 fi
3792 ;;
3793*) dflt="$so";;
3794esac
ecfc5424 3795$cat <<EOM
a0d0e21e
LW
3796
3797On some systems, shared libraries may be available. Answer 'none' if
ecfc5424
AD
3798you want to suppress searching of shared libraries for the remaining
3799of this configuration.
3800
a0d0e21e
LW
3801EOM
3802rp='What is the file extension used for shared libraries?'
3803. ./myread
3804so="$ans"
3805
2304df62
AD
3806: Looking for optional libraries
3807echo " "
3808echo "Checking for optional libraries..." >&4
3809case "$libs" in
3810' '|'') dflt='';;
3811*) dflt="$libs";;
3812esac
3813case "$libswanted" in
3814'') libswanted='c_s';;
3815esac
3816for thislib in $libswanted; do
a0d0e21e
LW
3817
3818 if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`; $test -f "$xxx"; then
3819 echo "Found -l$thislib (shared)."
3820 case " $dflt " in
3821 *"-l$thislib "*);;
3822 *) dflt="$dflt -l$thislib";;
3823 esac
3824 elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3825 echo "Found -l$thislib (shared)."
3826 case " $dflt " in
3827 *"-l$thislib "*);;
3828 *) dflt="$dflt -l$thislib";;
3829 esac
3830 elif xxx=`./loc lib$thislib.a X $libpth`; $test -f "$xxx"; then
2304df62 3831 echo "Found -l$thislib."
a0d0e21e
LW
3832 case " $dflt " in
3833 *"-l$thislib "*);;
2304df62
AD
3834 *) dflt="$dflt -l$thislib";;
3835 esac
8e07c86e
AD
3836 elif xxx=`./loc $thislib.a X $libpth`; $test -f "$xxx"; then
3837 echo "Found -l$thislib."
3838 case " $dflt " in
3839 *"-l$thislib "*);;
3840 *) dflt="$dflt -l$thislib";;
3841 esac
a0d0e21e
LW
3842 elif xxx=`./loc lib${thislib}_s.a X $libpth`; $test -f "$xxx"; then
3843 echo "Found -l${thislib}_s."
3844 case " $dflt " in
3845 *"-l$thislib "*);;
3846 *) dflt="$dflt -l${thislib}_s";;
2304df62 3847 esac
a0d0e21e
LW
3848 elif xxx=`./loc Slib$thislib.a X $xlibpth`; $test -f "$xxx"; then
3849 echo "Found -l$thislib."
3850 case " $dflt " in
3851 *"-l$thislib "*);;
2304df62
AD
3852 *) dflt="$dflt -l$thislib";;
3853 esac
3854 else
a0d0e21e 3855 echo "No -l$thislib."
2304df62
AD
3856 fi
3857done
3858set X $dflt
3859shift
3860dflt="$*"
3861case "$libs" in
3862'') dflt="$dflt";;
3863*) dflt="$libs";;
3864esac
3865case "$dflt" in
3866' '|'') dflt='none';;
3867esac
3868
3869$cat <<EOM
3870
3871Some versions of Unix support shared libraries, which make executables smaller
3872but make load time slightly longer.
3873
3874On some systems, mostly newer Unix System V's, the shared library is included
3875by putting the option "-lc_s" as the last thing on the cc command line when
3876linking. Other systems use shared libraries by default. There may be other
3877libraries needed to compile $package on your machine as well. If your system
3878needs the "-lc_s" option, include it here. Include any other special libraries
3879here as well. Say "none" for none.
3880EOM
3881
3882echo " "
3883rp="Any additional libraries?"
3884. ./myread
3885case "$ans" in
3886none) libs=' ';;
3887*) libs="$ans";;
3888esac
3889
3890: see if nm is to be used to determine whether a symbol is defined or not
3891case "$usenm" in
3892'')
3893 dflt=`egrep 'inlibc|csym' ../Configure | wc -l 2>/dev/null`
3894 if $test $dflt -gt 20; then
3895 dflt=y
3896 else
3897 dflt=n
3898 fi
3899 ;;
3900*)
3901 case "$usenm" in
3902 true) dflt=y;;
3903 *) dflt=n;;
3904 esac
3905 ;;
3906esac
3907$cat <<EOM
3908
3909I can use 'nm' to extract the symbols from your C libraries. This is a time
3910consuming task which may generate huge output on the disk (up to 3 megabytes)
3911but that should make the symbols extraction faster. The alternative is to skip
3912the 'nm' extraction part and to compile a small test program instead to
3913determine whether each symbol is present. If you have a fast C compiler and/or
3914if your 'nm' output cannot be parsed, this may be the best solution.
3915
3916EOM
3917rp='Shall I use nm to extract C symbols from the libraries?'
3918. ./myread
3919case "$ans" in
3920n|N) usenm=false;;
3921*) usenm=true;;
3922esac
3923
3924runnm=$usenm
3925case "$reuseval" in
3926true) runnm=false;;
3927esac
3928
3929: nm options which may be necessary
3930case "$nm_opt" in
3931'') if $test -f /mach_boot; then
3932 nm_opt=''
3933 elif $test -d /usr/ccs/lib; then
3934 nm_opt='-p'
3935 elif $test -f /dgux; then
3936 nm_opt='-p'
3937 else
3938 nm_opt=''
3939 fi;;
3940esac
3941
3942case "$runnm" in
3943true)
3944: get list of predefined functions in a handy place
3945echo " "
3946case "$libc" in
3947'') libc=unknown
3948 case "$libs" in
3949 *-lc_s*) libc=`./loc libc_s.a $libc $libpth`
3950 esac
3951 ;;
3952esac
2304df62
AD
3953libnames='';
3954case "$libs" in
3955'') ;;
3956*) for thislib in $libs; do
3957 case "$thislib" in
a0d0e21e
LW
3958 -lc|-lc_s)
3959 : Handle C library specially below.
3960 ;;
2304df62 3961 -l*)
ecfc5424 3962 thislib=`echo $thislib | $sed -e 's/^-l//'`
a0d0e21e
LW
3963 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
3964 :
3965 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
3966 :
3967 elif try=`./loc lib$thislib.a X $libpth`; $test -f "$try"; then
3968 :
3969 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
3970 :
3971 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
3972 :
3973 elif try=`./loc Slib$thislib.a X $xlibpth`; $test -f "$try"; then
3974 :
3975 else
3976 try=''
2304df62
AD
3977 fi
3978 libnames="$libnames $try"
3979 ;;
3980 *) libnames="$libnames $thislib" ;;
3981 esac
3982 done
3983 ;;
3984esac
3985xxx=normal
3986case "$libc" in
3987unknown)
a0d0e21e
LW
3988 set /usr/ccs/lib/libc.$so
3989 $test -r $1 || set /usr/lib/libc.$so
3990 $test -r $1 || set /usr/shlib/libc.$so
16d20bd9
AD
3991 $test -r $1 || \
3992 set `echo blurfl; echo /usr/lib/libc.$so.[0-9]* | \
3993 tr ' ' '\012' | egrep -v '\.[A-Za-z]*$' | $sed -e '
3994 h
3995 s/[0-9][0-9]*/0000&/g
3996 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
3997 G
3998 s/\n/ /' | \
3999 sort | $sed -e 's/^.* //'`
4000 eval set \$$#
a0d0e21e 4001 $test -r $1 || set /lib/libc.$so
2304df62 4002 $test -r $1 || set /lib/libsys_s.a
2304df62
AD
4003 ;;
4004*)
4005 set blurfl
4006 ;;
4007esac
4008if $test -r "$1"; then
4009 echo "Your (shared) C library seems to be in $1."
4010 libc="$1"
4011elif $test -r /lib/libc && $test -r /lib/clib; then
4012 echo "Your C library seems to be in both /lib/clib and /lib/libc."
4013 xxx=apollo
4014 libc='/lib/clib /lib/libc'
4015 if $test -r /lib/syslib; then
4016 echo "(Your math library is in /lib/syslib.)"
4017 libc="$libc /lib/syslib"
4018 fi
4019elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4020 echo "Your C library seems to be in $libc, as you said before."
4021elif $test -r $incpath/usr/lib/libc.a; then
4022 libc=$incpath/usr/lib/libc.a;
4023 echo "Your C library seems to be in $libc. That's fine."
4024elif $test -r /lib/libc.a; then
4025 libc=/lib/libc.a;
4026 echo "Your C library seems to be in $libc. You're normal."
4027else
4028 if tans=`./loc libc.a blurfl/dyick $libpth`; $test -r "$tans"; then
4029 :
4030 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4031 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4032 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4033 :
4034 elif tans=`./loc Slibc.a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4035 :
4036 elif tans=`./loc Mlibc.a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4037 :
4038 else
4039 tans=`./loc Llibc.a blurfl/dyick $xlibpth`
4040 fi
4041 if $test -r "$tans"; then
4042 echo "Your C library seems to be in $tans, of all places."
4043 libc=$tans
4044 else
4045 libc='blurfl'
4046 fi
4047fi
4048if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4049 dflt="$libc"
4050 cat <<EOM
4051
4052If the guess above is wrong (which it might be if you're using a strange
4053compiler, or your machine supports multiple models), you can override it here.
4054
4055EOM
4056else
4057 dflt=''
4058 echo $libpth | tr ' ' '\012' | sort | uniq > libpath
4059 cat >&4 <<EOM
4060I can't seem to find your C library. I've looked in the following places:
4061
4062EOM
4063 $sed 's/^/ /' libpath
4064 cat <<EOM
4065
4066None of these seems to contain your C library. I need to get its name...
4067
4068EOM
4069fi
4070fn=f
4071rp='Where is your C library?'
4072. ./getfile
4073libc="$ans"
4074
4075echo " "
4076echo $libc $libnames | tr ' ' '\012' | sort | uniq > libnames
4077set X `cat libnames`
4078shift
4079xxx=files
4080case $# in 1) xxx=file; esac
4081echo "Extracting names from the following $xxx for later perusal:" >&4
4082echo " "
4083$sed 's/^/ /' libnames >&4
4084echo " "
4085$echo $n "This may take a while...$c" >&4
ecfc5424 4086
2304df62
AD
4087nm $nm_opt $* 2>/dev/null >libc.tmp
4088$echo $n ".$c"
4089$grep fprintf libc.tmp > libc.ptf
4090xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4091xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
16d20bd9
AD
4092xxx='[ADTSIW]'
4093if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx //p'";\
2304df62
AD
4094 eval $xscan;\
4095 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4096 eval $xrun
4097elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4098 eval $xscan;\
4099 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4100 eval $xrun
4101elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4102 eval $xscan;\
4103 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4104 eval $xrun
4105elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4106 eval $xscan;\
4107 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4108 eval $xrun
4109elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4110 eval $xscan;\
4111 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4112 eval $xrun
4113elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4114 eval $xscan;\
4115 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4116 eval $xrun
4117elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4118 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
4119 eval $xscan;\
4120 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4121 eval $xrun
4122elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4123 eval $xscan;\
4124 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4125 eval $xrun
4126elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4127 eval $xscan;\
4128 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4129 eval $xrun
a0d0e21e
LW
4130elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
4131 eval $xscan;\
4132 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4133 eval $xrun
8e07c86e
AD
4134elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
4135 eval $xscan;\
4136 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4137 eval $xrun
2304df62
AD
4138else
4139 nm -p $* 2>/dev/null >libc.tmp
16d20bd9
AD
4140 $grep fprintf libc.tmp > libc.ptf
4141 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
4142 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
4143 then
2304df62 4144 nm_opt='-p'
16d20bd9 4145 eval $xrun
2304df62
AD
4146 else
4147 echo " "
4148 echo "nm didn't seem to work right. Trying ar instead..." >&4
4149 com=''
4150 if ar t $libc > libc.tmp; then
4151 for thisname in $libnames; do
4152 ar t $thisname >>libc.tmp
4153 done
4154 $sed -e 's/\.o$//' < libc.tmp > libc.list
4155 echo "Ok." >&4
4156 else
4157 echo "ar didn't seem to work right." >&4
4158 echo "Maybe this is a Cray...trying bld instead..." >&4
16d20bd9
AD
4159 if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list
4160 then
2304df62
AD
4161 for thisname in $libnames; do
4162 bld t $libnames | \
4163 $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
4164 ar t $thisname >>libc.tmp
4165 done
4166 echo "Ok." >&4
4167 else
4168 echo "That didn't work either. Giving up." >&4
4169 exit 1
4170 fi
4171 fi
4172 fi
4173fi
4174nm_extract="$com"
4175if $test -f /lib/syscalls.exp; then
4176 echo " "
4177 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
4178 $sed -n 's/^\([^ ]*\)[ ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list
4179fi
4180;;
4181esac
4182$rm -f libnames libpath
4183
4184: is a C symbol defined?
4185csym='tlook=$1;
4186case "$3" in
4187-v) tf=libc.tmp; tc=""; tdc="";;
8e07c86e 4188-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
2304df62
AD
4189*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
4190esac;
4191tx=yes;
4192case "$reuseval-$4" in
4193true-) ;;
4194true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
4195esac;
4196case "$tx" in
4197yes)
4198 case "$runnm" in
4199 true)
4200 if $contains $tlook $tf >/dev/null 2>&1;
4201 then tval=true;
4202 else tval=false;
4203 fi;;
4204 *)
16d20bd9 4205 echo "main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
8e07c86e 4206 if $cc $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
2304df62
AD
4207 then tval=true;
4208 else tval=false;
4209 fi;
4210 $rm -f t t.c;;
4211 esac;;
4212*)
8e07c86e
AD
4213 case "$tval" in
4214 $define) tval=true;;
4215 *) tval=false;;
4216 esac;;
4217esac;
4218eval "$2=$tval"'
2304df62
AD
4219
4220: define an is-in-libc? function
4221inlibc='echo " "; td=$define; tu=$undef;
4222sym=$1; var=$2; eval "was=\$$2";
4223tx=yes;
4224case "$reuseval$was" in
4225true) ;;
4226true*) tx=no;;
4227esac;
4228case "$tx" in
4229yes)
4230 set $sym tres -f;
4231 eval $csym;
4232 case "$tres" in
4233 true)
4234 echo "$sym() found." >&4;
ecfc5424 4235 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
2304df62
AD
4236 *)
4237 echo "$sym() NOT found." >&4;
ecfc5424 4238 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
2304df62
AD
4239 esac;;
4240*)
4241 case "$was" in
4242 $define) echo "$sym() found." >&4;;
4243 *) echo "$sym() NOT found." >&4;;
4244 esac;;
4245esac'
4246
8e07c86e
AD
4247: Check how to convert floats to strings.
4248echo " "
4249echo "Checking for an efficient way to convert floats to strings."
4250$cat >try.c <<'EOP'
4251#ifdef TRY_gconvert
4252#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
4253#endif
4254#ifdef TRY_gcvt
4255#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
4256#endif
4257#ifdef TRY_sprintf
4258#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
4259#endif
a0d0e21e 4260main() {
ecfc5424 4261 char buf[64];
8e07c86e 4262 Gconvert(1.0, 8, 0, buf);
ecfc5424
AD
4263 if (buf[0] != '1' || buf[1] != '\0')
4264 exit(1);
8e07c86e 4265 Gconvert(0.0, 8, 0, buf);
ecfc5424
AD
4266 if (buf[0] != '0' || buf[1] != '\0')
4267 exit(1);
8e07c86e 4268 Gconvert(-1.0, 8, 0, buf);
ecfc5424
AD
4269 if (buf[0] != '-' || buf[1] != '1' || buf[2] != '\0')
4270