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