This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.001 patch.1h: [re-organisations and patch description]
[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#
37120919 23# Generated on Fri Dec 8 11:19:33 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
85e6fe83 1346touch
2304df62
AD
1347tr
1348uniq
1349"
1350trylist="
1351Mcc
2304df62
AD
1352byacc
1353cpp
1354csh
1355date
1356egrep
2304df62
AD
1357line
1358nroff
1359perl
1360test
1361uname
1362"
8e07c86e 1363pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
1364pth="$pth /lib /usr/lib"
1365for file in $loclist; do
1366 xxx=`./loc $file $file $pth`
1367 eval $file=$xxx
1368 eval _$file=$xxx
1369 case "$xxx" in
1370 /*)
1371 echo $file is in $xxx.
1372 ;;
8e07c86e
AD
1373 ?:[\\/]*)
1374 echo $file is in $xxx.
1375 ;;
2304df62 1376 *)
25f94b33
AD
1377 echo "I don't know where '$file' is, and my life depends on it." >&4
1378 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 1379 exit 1
2304df62
AD
1380 ;;
1381 esac
1382done
1383echo " "
1384echo "Don't worry if any of the following aren't found..."
1385say=offhand
1386for file in $trylist; do
1387 xxx=`./loc $file $file $pth`
1388 eval $file=$xxx
1389 eval _$file=$xxx
1390 case "$xxx" in
1391 /*)
1392 echo $file is in $xxx.
1393 ;;
8e07c86e
AD
1394 ?:[\\/]*)
1395 echo $file is in $xxx.
1396 ;;
2304df62
AD
1397 *)
1398 echo "I don't see $file out there, $say."
1399 say=either
1400 ;;
1401 esac
1402done
1403case "$egrep" in
1404egrep)
1405 echo "Substituting grep for egrep."
1406 egrep=$grep
1407 ;;
1408esac
1409case "$test" in
1410test)
1411 echo "Hopefully test is built into your sh."
1412 ;;
1413*)
ecfc5424 1414 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2304df62
AD
1415 echo "Using the test built into your sh."
1416 test=test
1417 _test=test
1418 fi
1419 ;;
1420esac
1421case "$echo" in
1422echo)
1423 echo "Hopefully echo is built into your sh."
1424 ;;
1425'') ;;
1426*)
1427 echo " "
1428echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1429 $echo $n "hi there$c" >foo1
1430 echo $n "hi there$c" >foo2
1431 if cmp foo1 foo2 >/dev/null 2>&1; then
1432 echo "They are compatible. In fact, they may be identical."
1433 else
1434 case "$n" in
1435 '-n') n='' c='\c';;
1436 *) n='-n' c='';;
1437 esac
1438 cat <<FOO
1439They are not compatible! You are probably running ksh on a non-USG system.
1440I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1441have echo built in and we may have to run some Bourne shell scripts. That
1442means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
1443
1444FOO
1445 $echo $n "The star should be here-->$c"
1446 $echo "*"
1447 fi
1448 $rm -f foo1 foo2
1449 ;;
1450esac
1451
a0d0e21e
LW
1452: determine whether symbolic links are supported
1453echo " "
1454$touch blurfl
1455if $ln -s blurfl sym > /dev/null 2>&1 ; then
1456 echo "Symbolic links are supported." >&4
1457 lns="$ln -s"
1458else
1459 echo "Symbolic links are NOT supported." >&4
1460 lns="$ln"
1461fi
1462$rm -f blurfl sym
1463
ecfc5424
AD
1464: see whether [:lower:] and [:upper:] are supported character classes
1465echo " "
1466up='[A-Z]'
1467low='[a-z]'
1468case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1469ABYZ)
1470 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
1471 up='[:upper:]'
1472 low='[:lower:]'
1473 ;;
1474*)
1475 echo "Your tr only supports [a-z] and [A-Z] to convert case." >&4
1476 ;;
1477esac
1478: set up the translation script tr, must be called with ./tr of course
1479cat >tr <<EOSC
1480$startsh
1481case "\$1\$2" in
1482'[A-Z][a-z]') exec $tr '$up' '$low';;
1483'[a-z][A-Z]') exec $tr '$low' '$up';;
1484esac
1485exec $tr "\$@"
1486EOSC
1487chmod +x tr
1488$eunicefix tr
1489
2304df62
AD
1490: Try to determine whether config.sh was made on this system
1491case "$config_sh" in
1492'')
1493myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
a0d0e21e 1494myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
ecfc5424 1495 ./tr '[A-Z]' '[a-z]' | tr '\012' ' '`
1aef975c 1496newmyuname="$myuname"
2304df62 1497dflt=n
16d20bd9
AD
1498case "$knowitall" in
1499'')
1500 if test -f ../config.sh; then
1501 if $contains myuname= ../config.sh >/dev/null 2>&1; then
1502 eval "`grep myuname= ../config.sh`"
1503 fi
1504 if test "X$myuname" = "X$newmyuname"; then
1505 dflt=y
1506 fi
2304df62 1507 fi
16d20bd9
AD
1508 ;;
1509*) dflt=y;;
1510esac
2304df62
AD
1511
1512: Get old answers from old config file if Configure was run on the
1513: same system, otherwise use the hints.
1514hint=default
1515cd ..
1516if test -f config.sh; then
16d20bd9
AD
1517 echo " "
1518 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
1519 . UU/myread
1520 case "$ans" in
1521 n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
1522 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
1523 tmp_n="$n"
1524 tmp_c="$c"
2304df62
AD
1525 . ./config.sh
1526 cp config.sh UU
ecfc5424
AD
1527 n="$tmp_n"
1528 c="$tmp_c"
2304df62
AD
1529 hint=previous
1530 ;;
1531 esac
1532fi
1533if test ! -f config.sh; then
1534 $cat <<EOM
1535
1536First time through, eh? I have some defaults handy for the following systems:
1537
1538EOM
1539 cd hints; ls -C *.sh | $sed 's/\.sh/ /g' >&4
1540 dflt=''
1541 : Half the following guesses are probably wrong... If you have better
1542 : tests or hints, please send them to lwall@netlabs.com
1543 : The metaconfig authors would also appreciate a copy...
a0d0e21e 1544 $test -f /irix && osname=irix
85e6fe83
LW
1545 $test -f /xenix && osname=sco_xenix
1546 $test -f /dynix && osname=dynix
1547 $test -f /dnix && osname=dnix
a0d0e21e 1548 $test -f /unicos && osname=unicos && osvers=`$uname -r`
85e6fe83 1549 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
1550 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
1551 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
1552 $test -d /usr/apollo/bin && osname=apollo
1553 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 1554 $test -d /usr/include/minix && osname=minix
4633a7c4
LW
1555 if $test -d /MachTen; then
1556 osname=machten
1557 if $test -x /sbin/version; then
1558 osvers=`/sbin/version | $awk '{print $2}' |
1559 $sed -e 's/[A-Za-z]$//'`
1560 elif $test -x /usr/etc/version; then
1561 osvers=`/usr/etc/version | $awk '{print $2}' |
1562 $sed -e 's/[A-Za-z]$//'`
1563 else
1564 osvers="$2.$3"
1565 fi
1566 fi
2304df62
AD
1567 if $test -f $uname; then
1568 set X $myuname
1569 shift
1570
2304df62 1571 case "$5" in
85e6fe83 1572 fps*) osname=fps ;;
2304df62
AD
1573 mips*)
1574 case "$4" in
85e6fe83
LW
1575 umips) osname=umips ;;
1576 *) osname=mips ;;
2304df62 1577 esac;;
85e6fe83
LW
1578 [23]100) osname=mips ;;
1579 next*) osname=next ;;
1580 news*) osname=news ;;
ecfc5424
AD
1581 i386*)
1582 if $test -f /etc/kconfig; then
1583 osname=isc
a0d0e21e
LW
1584 if test "$lns" = "ln -s"; then
1585 osvers=4
1586 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
1587 osvers=3
2304df62 1588 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 1589 osvers=2
ecfc5424
AD
1590 fi
1591 fi
1592 ;;
2304df62
AD
1593 esac
1594
1595 case "$1" in
a0d0e21e
LW
1596 aix) osname=aix
1597 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
1598 case "$tmp" in
1aef975c 1599 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
1600 '<3240'|'<>3240') osvers=3.2.0 ;;
1601 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
1602 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 1603 *) osvers=$tmp;;
a0d0e21e
LW
1604 esac
1605 ;;
1606 dnix) osname=dnix
1607 osvers="$3"
1608 ;;
1609 domainos) osname=apollo
1610 osvers="$3"
1611 ;;
1612 dgux) osname=dgux
1613 osvers="$3"
1614 ;;
1615 freebsd) osname=freebsd
1616 osvers="$3" ;;
1617 genix) osname=genix ;;
1618 hp*) osname=hpux
1619 case "$3" in
1620 *.08.*) osvers=9 ;;
1621 *.09.*) osvers=9 ;;
1622 *.10.*) osvers=10 ;;
ecfc5424 1623 *) osvers="$3" ;;
a0d0e21e
LW
1624 esac
1625 ;;
1626 irix) osname=irix
1627 case "$3" in
1628 4*) osvers=4 ;;
1629 5*) osvers=5 ;;
ecfc5424 1630 *) osvers="$3" ;;
a0d0e21e
LW
1631 esac
1632 ;;
1633 linux) osname=linux
1634 case "$3" in
1635 1*) osvers=1 ;;
1636 *) osvers="$3" ;;
1637 esac
1638 ;;
1639 netbsd*) osname=netbsd
ecfc5424
AD
1640 osvers="$3"
1641 ;;
a0d0e21e
LW
1642 bsd386) osname=bsd386
1643 osvers=`$uname -r`
1644 ;;
1645 next*) osname=next ;;
1646 solaris) osname=solaris
1647 case "$3" in
1648 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 1649 *) osvers="$3" ;;
a0d0e21e
LW
1650 esac
1651 ;;
85e6fe83
LW
1652 sunos) osname=sunos
1653 case "$3" in
85e6fe83
LW
1654 5*) osname=solaris
1655 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 1656 *) osvers="$3" ;;
2304df62
AD
1657 esac
1658 ;;
a0d0e21e 1659 titanos) osname=titanos
85e6fe83 1660 case "$3" in
a0d0e21e
LW
1661 1*) osvers=1 ;;
1662 2*) osvers=2 ;;
1663 3*) osvers=3 ;;
1664 4*) osvers=4 ;;
ecfc5424 1665 *) osvers="$3" ;;
2304df62
AD
1666 esac
1667 ;;
85e6fe83 1668 ultrix) osname=ultrix
ecfc5424 1669 osvers="$3"
2304df62 1670 ;;
85e6fe83 1671 osf1) case "$5" in
fed7345c
AD
1672 alpha)
1673 osname=dec_osf
1674 osvers=`echo "$3" | sed 's/^[vt]//'`
ecfc5424
AD
1675 ;;
1676 hp*) osname=hp_osf1 ;;
1677 mips) osname=mips_osf1 ;;
85e6fe83
LW
1678 esac
1679 ;;
a0d0e21e
LW
1680 uts) osname=uts
1681 osvers="$3"
1682 ;;
85e6fe83 1683 $2) case "$osname" in
2304df62 1684 *isc*) ;;
a0d0e21e
LW
1685 *freebsd*) ;;
1686 svr*)
1687 : svr4.x or possibly later
1688 case "svr$3" in
1689 ${osname}*)
1690 osname=svr$3
1691 osvers=$4
1692 ;;
1693 esac
1694 case "$osname" in
1695 svr4.0)
1696 : Check for ESIX
1697 if test -f /stand/boot ; then
1698 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
1699 if test -n "$INITPROG" -a -f "$INITPROG"; then
1700 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
1701 if test -n "$isesix"; then
a0d0e21e
LW
1702 osname=esix4
1703 fi
1704 fi
1705 fi
1706 ;;
1707 esac
1708 ;;
2304df62 1709 *) if test -f /etc/systemid; then
a0d0e21e
LW
1710 osname=sco
1711 set `echo $3 | $sed 's/\./ /g'` $4
2304df62 1712 if $test -f sco_$1_$2_$3.sh; then
85e6fe83 1713 osvers=$1.$2.$3
2304df62 1714 elif $test -f sco_$1_$2.sh; then
85e6fe83 1715 osvers=$1.$2
2304df62 1716 elif $test -f sco_$1.sh; then
85e6fe83 1717 osvers=$1
2304df62 1718 fi
a0d0e21e
LW
1719 else
1720 case "$osname" in
1721 '') : Still unknown. Probably a generic Sys V.
1722 osname="sysv"
1723 osvers="$3"
1724 ;;
1725 esac
2304df62
AD
1726 fi
1727 ;;
1728 esac
1729 ;;
a0d0e21e
LW
1730 *) case "$osname" in
1731 '') : Still unknown. Probably a generic BSD.
1732 osname="$1"
1733 osvers="$3"
1734 ;;
1735 esac
1736 ;;
2304df62
AD
1737 esac
1738 else
1739 if test -f /vmunix -a -f news_os.sh; then
ecfc5424 1740 (what /vmunix | ../UU/tr '[A-Z]' '[a-z]') > ../UU/kernel.what 2>&1
2304df62 1741 if $contains news-os ../UU/kernel.what >/dev/null 2>&1; then
85e6fe83 1742 osname=news_os
2304df62
AD
1743 fi
1744 $rm -f ../UU/kernel.what
8e07c86e
AD
1745 elif test -d c:/.; then
1746 set X $myuname
1747 osname=os2
1748 osvers="$5"
2304df62
AD
1749 fi
1750 fi
85e6fe83 1751
a0d0e21e
LW
1752 : Now look for a hint file osname_osvers, unless one has been
1753 : specified already.
1754 case "$hintfile" in
1755 ''|' ')
ecfc5424 1756 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
a0d0e21e 1757 : Also try without trailing minor version numbers.
ecfc5424
AD
1758 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
1759 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
1760 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
1761 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
a0d0e21e
LW
1762 case "$file" in
1763 '') dflt=none ;;
1764 *) case "$osvers" in
1765 '') dflt=$file
1766 ;;
1767 *) if $test -f $file.sh ; then
1768 dflt=$file
1769 elif $test -f $xfile.sh ; then
1770 dflt=$xfile
1771 elif $test -f $xxfile.sh ; then
1772 dflt=$xxfile
1773 elif $test -f $xxxfile.sh ; then
1774 dflt=$xxxfile
1775 elif $test -f $xxxxfile.sh ; then
1776 dflt=$xxxxfile
1777 elif $test -f "${osname}.sh" ; then
1778 dflt="${osname}"
1779 else
1780 dflt=none
1781 fi
1782 ;;
1783 esac
85e6fe83
LW
1784 ;;
1785 esac
1786 ;;
a0d0e21e 1787 *)
ecfc5424 1788 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 1789 ;;
2304df62 1790 esac
1aef975c 1791
2304df62
AD
1792 $cat <<EOM
1793
1794You may give one or more space-separated answers, or "none" if appropriate.
1795If your OS version has no hints, DO NOT give a wrong version -- say "none".
1796
1797EOM
1798 rp="Which of these apply, if any?"
1799 . ../UU/myread
85e6fe83
LW
1800 tans=$ans
1801 for file in $tans; do
2304df62
AD
1802 if $test -f $file.sh; then
1803 . ./$file.sh
1804 $cat $file.sh >> ../UU/config.sh
85e6fe83 1805 elif $test X$tans = X -o X$tans = Xnone ; then
2304df62
AD
1806 : nothing
1807 else
85e6fe83
LW
1808 : Give one chance to correct a possible typo.
1809 echo "$file.sh does not exist"
1810 dflt=$file
1811 rp="hint to use instead?"
1812 . ../UU/myread
1813 for file in $ans; do
1814 if $test -f "$file.sh"; then
1815 . ./$file.sh
1816 $cat $file.sh >> ../UU/config.sh
1817 elif $test X$ans = X -o X$ans = Xnone ; then
1818 : nothing
1819 else
1820 echo "$file.sh does not exist -- ignored."
1821 fi
1822 done
2304df62
AD
1823 fi
1824 done
85e6fe83 1825
2304df62 1826 hint=recommended
85e6fe83
LW
1827 : Remember our hint file for later.
1828 if $test -f "$file.sh" ; then
a0d0e21e 1829 hintfile="$file"
85e6fe83 1830 else
a0d0e21e 1831 hintfile=''
85e6fe83
LW
1832 fi
1833
2304df62
AD
1834 cd ..
1835fi
1836cd UU
1837;;
1838*)
1839 echo " "
1840 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
1841 tmp_n="$n"
1842 tmp_c="$c"
2304df62
AD
1843 cd ..
1844 cp $config_sh config.sh 2>/dev/null
1845 . ./config.sh
1846 cd UU
1847 cp ../config.sh .
ecfc5424
AD
1848 n="$tmp_n"
1849 c="$tmp_c"
2304df62
AD
1850 hint=previous
1851 ;;
1852esac
1aef975c
AD
1853test "$override" && . ./optdef.sh
1854myuname="$newmyuname"
2304df62
AD
1855
1856: Restore computed paths
1857for file in $loclist $trylist; do
1858 eval $file="\$_$file"
1859done
1860
85e6fe83 1861cat << EOM
a0d0e21e 1862
85e6fe83 1863Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
1864The default value is probably right if the name rings a bell. Otherwise,
1865since spelling matters for me, either accept the default or answer "none"
1866to leave it blank.
a0d0e21e 1867
85e6fe83 1868EOM
85e6fe83 1869case "$osname" in
a0d0e21e 1870 ''|' ')
85e6fe83 1871 case "$hintfile" in
a0d0e21e 1872 ''|' '|none) dflt=none ;;
ecfc5424 1873 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
1874 esac
1875 ;;
1876 *) dflt="$osname" ;;
1877esac
1878rp="Operating system name?"
1879. ./myread
1880case "$ans" in
ecfc5424
AD
1881none) osname='' ;;
1882*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 1883esac
2304df62
AD
1884: who configured the system
1885cf_time=`$date 2>&1`
a0d0e21e
LW
1886(logname > .temp) >/dev/null 2>&1
1887$test -s .temp || (whoami > .temp) >/dev/null 2>&1
1888$test -s .temp || echo unknown > .temp
1889cf_by=`$cat .temp`
1890$rm -f .temp
2304df62 1891
4633a7c4 1892: determine the architecture name
2304df62 1893echo " "
4633a7c4
LW
1894if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
1895 tarch=`arch`"-$osname"
1896elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
1897 if uname -m > tmparch 2>&1 ; then
1898 tarch=`$sed -e 's/ /_/g' -e 's/$/'"-$osname/" tmparch`
1899 else
1900 tarch="$osname"
1901 fi
1902 $rm -f tmparch
1903else
1904 tarch="$osname"
1905fi
1906case "$myarchname" in
1907''|"$tarch") ;;
1908*)
1909 echo "(Your architecture name used to be $myarchname.)"
1910 archname=''
2304df62
AD
1911 ;;
1912esac
4633a7c4
LW
1913case "$archname" in
1914'') dflt="$tarch";;
1915*) dflt="$archname";;
1916esac
1917rp='What is your architecture name'
1918. ./myread
1919archname="$ans"
1920myarchname="$tarch"
1921
1922: is AFS running?
1923echo " "
1924if test -d /afs; then
1925 echo "AFS may be running... I'll be extra cautious then..." >&4
1926 afs=true
2304df62 1927else
4633a7c4
LW
1928 echo "AFS does not seem to be running..." >&4
1929 afs=false
2304df62
AD
1930fi
1931
4633a7c4
LW
1932: decide how portable to be. Allow command line overrides.
1933case "$d_portable" in
1934"$undef") ;;
1935*) d_portable="$define" ;;
2304df62 1936esac
2304df62 1937
4633a7c4
LW
1938: set up shell script to do ~ expansion
1939cat >filexp <<EOSS
1940$startsh
1941: expand filename
1942case "\$1" in
1943 ~/*|~)
1944 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
2304df62 1945 ;;
4633a7c4
LW
1946 ~*)
1947 if $test -f /bin/csh; then
1948 /bin/csh -f -c "glob \$1"
1949 failed=\$?
1950 echo ""
1951 exit \$failed
1952 else
1953 name=\`$expr x\$1 : '..\([^/]*\)'\`
1954 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
1955 if $test ! -d "\$dir"; then
1956 me=\`basename \$0\`
1957 echo "\$me: can't locate home directory for: \$name" >&2
1958 exit 1
1959 fi
1960 case "\$1" in
1961 */*)
1962 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
1963 ;;
1964 *)
1965 echo \$dir
1966 ;;
2304df62 1967 esac
4633a7c4 1968 fi
2304df62
AD
1969 ;;
1970*)
4633a7c4 1971 echo \$1
2304df62
AD
1972 ;;
1973esac
4633a7c4
LW
1974EOSS
1975chmod +x filexp
1976$eunicefix filexp
2304df62
AD
1977
1978: now set up to get a file name
1979cat <<'EOSC' >getfile
1980tilde=''
1981fullpath=''
1982already=''
1983skip=''
1984none_ok=''
1985exp_file=''
a0d0e21e 1986nopath_ok=''
2304df62
AD
1987orig_rp="$rp"
1988orig_dflt="$dflt"
1989
1990case "$fn" in
ecfc5424
AD
1991*\(*)
1992 expr $fn : '.*(\(.*\)).*' | tr ',' '\012' >getfile.ok
1993 fn=`echo $fn | sed 's/(.*)//'`
1994 ;;
1995esac
1996
1997case "$fn" in
a0d0e21e
LW
1998*:*)
1999 loc_file=`expr $fn : '.*:\(.*\)'`
2000 fn=`expr $fn : '\(.*\):.*'`
2001 ;;
2002esac
2003
2004case "$fn" in
2304df62
AD
2005*~*) tilde=true;;
2006esac
2007case "$fn" in
2008*/*) fullpath=true;;
2009esac
2010case "$fn" in
2011*+*) skip=true;;
2012esac
2013case "$fn" in
2014*n*) none_ok=true;;
2015esac
2016case "$fn" in
2017*e*) exp_file=true;;
2018esac
a0d0e21e
LW
2019case "$fn" in
2020*p*) nopath_ok=true;;
2021esac
2304df62
AD
2022
2023case "$fn" in
2024*f*) type='File';;
2025*d*) type='Directory';;
a0d0e21e 2026*l*) type='Locate';;
2304df62
AD
2027esac
2028
2029what="$type"
2030case "$what" in
2031Locate) what='File';;
2032esac
2033
2034case "$exp_file" in
2035'')
2036 case "$d_portable" in
2037 "$define") ;;
2038 *) exp_file=true;;
2039 esac
2040 ;;
2041esac
2042
2043cd ..
2044while test "$type"; do
2045 redo=''
2046 rp="$orig_rp"
2047 dflt="$orig_dflt"
2048 case "$tilde" in
2049 true) rp="$rp (~name ok)";;
2050 esac
2051 . UU/myread
ecfc5424
AD
2052 if test -f UU/getfile.ok && \
2053 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
2054 then
2055 value="$ans"
2056 ansexp="$ans"
2057 break
2058 fi
2304df62
AD
2059 case "$ans" in
2060 none)
2061 value=''
2062 ansexp=''
2063 case "$none_ok" in
2064 true) type='';;
2065 esac
2066 ;;
2067 *)
2068 case "$tilde" in
2069 '') value="$ans"
2070 ansexp="$ans";;
2071 *)
2072 value=`UU/filexp $ans`
2073 case $? in
2074 0)
2075 if test "$ans" != "$value"; then
ecfc5424 2076 echo "(That expands to $value on this system.)"
2304df62
AD
2077 fi
2078 ;;
2079 *) value="$ans";;
2080 esac
2081 ansexp="$value"
2082 case "$exp_file" in
2083 '') value="$ans";;
2084 esac
2085 ;;
2086 esac
2087 case "$fullpath" in
2088 true)
2089 case "$ansexp" in
2090 /*) value="$ansexp" ;;
2091 *)
2092 redo=true
2093 case "$already" in
2094 true)
2095 echo "I shall only accept a full path name, as in /bin/ls." >&4
2096 echo "Use a ! shell escape if you wish to check pathnames." >&4
2097 ;;
2098 *)
2099 echo "Please give a full path name, starting with slash." >&4
2100 case "$tilde" in
2101 true)
2102 echo "Note that using ~name is ok provided it expands well." >&4
2103 already=true
2104 ;;
2105 esac
2106 esac
2107 ;;
2108 esac
2109 ;;
2110 esac
2111 case "$redo" in
2112 '')
2113 case "$type" in
2114 File)
2115 if test -f "$ansexp"; then
2116 type=''
2117 elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1
2118 then
2119 echo "($value is not a plain file, but that's ok.)"
2120 type=''
2121 fi
2122 ;;
2123 Directory)
2124 if test -d "$ansexp"; then
2125 type=''
2126 fi
2127 ;;
2128 Locate)
40000a8c 2129 if test -d "$ansexp"; then
a0d0e21e
LW
2130 echo "(Looking for $loc_file in directory $value.)"
2131 value="$value/$loc_file"
40000a8c 2132 ansexp="$ansexp/$loc_file"
2304df62 2133 fi
40000a8c 2134 if test -f "$ansexp"; then
2304df62
AD
2135 type=''
2136 fi
a0d0e21e
LW
2137 case "$nopath_ok" in
2138 true) case "$value" in
2139 */*) ;;
2140 *) echo "Assuming $value will be in people's path."
2141 type=''
2142 ;;
2143 esac
2144 ;;
2145 esac
2304df62
AD
2146 ;;
2147 esac
2148
2149 case "$skip" in
2150 true) type='';
2151 esac
2152
2153 case "$type" in
2154 '') ;;
2155 *)
2156 if test "$fastread" = yes; then
2157 dflt=y
2158 else
2159 dflt=n
2160 fi
2161 rp="$what $value doesn't exist. Use that name anyway?"
2162 . UU/myread
2163 dflt=''
2164 case "$ans" in
2165 y*) type='';;
2166 *) echo " ";;
2167 esac
2168 ;;
2169 esac
2170 ;;
2171 esac
2172 ;;
2173 esac
2174done
2175cd UU
2176ans="$value"
2177rp="$orig_rp"
2178dflt="$orig_dflt"
ecfc5424 2179rm -f getfile.ok
2304df62
AD
2180EOSC
2181
4633a7c4
LW
2182: determine root of directory hierarchy where package will be installed.
2183case "$prefix" in
2184'')
2185 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
8e07c86e 2186 ;;
4633a7c4
LW
2187*)
2188 dflt="$prefix"
8e07c86e
AD
2189 ;;
2190esac
4633a7c4 2191$cat <<EOM
2304df62 2192
4633a7c4
LW
2193By default, $package will be installed in $dflt/bin, manual
2194pages under $dflt/man, etc..., i.e. with $dflt as prefix for
2195all installation directories. Typically set to /usr/local, but you
2196may choose /usr if you wish to install $package among your system
2197binaries. If you wish to have binaries under /bin but manual pages
2198under /usr/local/man, that's ok: you will be prompted separately
2199for each of the installation directories, the prefix being only used
2200to set the defaults.
8e07c86e
AD
2201
2202EOM
2203fn=d~
2204rp='Installation prefix to use?'
2205. ./getfile
2206oldprefix=''
2207case "$prefix" in
a0d0e21e 2208'') ;;
8e07c86e
AD
2209*)
2210 case "$ans" in
2211 "$prefix") ;;
2212 *) oldprefix="$prefix";;
2213 esac
2214 ;;
a0d0e21e 2215esac
8e07c86e
AD
2216prefix="$ans"
2217prefixexp="$ansexp"
a0d0e21e 2218
8e07c86e
AD
2219: set the prefixit variable, to compute a suitable default value
2220prefixit='case "$3" in
2221""|none)
2222 case "$oldprefix" in
2223 "") eval "$1=\"\$$2\"";;
2224 *)
2225 case "$3" in
2226 "") eval "$1=";;
2227 none)
2228 eval "tp=\"\$$2\"";
2229 case "$tp" in
2230 ""|" ") eval "$1=\"\$$2\"";;
2231 *) eval "$1=";;
2232 esac;;
2233 esac;;
2234 esac;;
2235*)
2236 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
2237 case "$tp" in
2238 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
2239 /*-$oldprefix/*|\~*-$oldprefix/*)
2240 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
2241 *) eval "$1=\"\$$2\"";;
2242 esac;;
2243esac'
a0d0e21e 2244
4633a7c4
LW
2245: determine where private library files go
2246: Usual default is /usr/local/lib/perl5. Also allow things like
2247: /opt/perl/lib, since /opt/perl/lib/perl5 would be redundant.
2248case "$prefix" in
2249*perl*) set dflt privlib lib ;;
2250*) set dflt privlib lib/$package ;;
2251esac
8e07c86e 2252eval $prefixit
4633a7c4
LW
2253$cat <<EOM
2254
2255There are some auxiliary files for $package that need to be put into a
2256private library directory that is accessible by everyone.
2257
2258EOM
2259fn=d~+
2260rp='Pathname where the private library files will reside?'
8e07c86e 2261. ./getfile
4633a7c4
LW
2262if $test "X$privlibexp" != "X$ansexp"; then
2263 installprivlib=''
8e07c86e 2264fi
4633a7c4
LW
2265privlib="$ans"
2266privlibexp="$ansexp"
8e07c86e
AD
2267if $afs; then
2268 $cat <<EOM
2304df62 2269
8e07c86e 2270Since you are running AFS, I need to distinguish the directory in which
4633a7c4 2271private files reside from the directory in which they are installed (and from
8e07c86e 2272which they are presumably copied to the former directory by occult means).
a0d0e21e 2273
8e07c86e 2274EOM
4633a7c4
LW
2275 case "$installprivlib" in
2276 '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;;
2277 *) dflt="$installprivlib";;
8e07c86e
AD
2278 esac
2279 fn=de~
4633a7c4 2280 rp='Where will private files be installed?'
8e07c86e 2281 . ./getfile
4633a7c4 2282 installprivlib="$ans"
8e07c86e 2283else
4633a7c4
LW
2284 installprivlib="$privlibexp"
2285fi
2286
2287: set the base revision
2288baserev=5.0
2289
2290: get the patchlevel
2291echo " "
2292echo "Getting the current patchlevel..." >&4
2293if $test -r ../patchlevel.h;then
2294 patchlevel=`awk '/PATCHLEVEL/ {print $3}' < ../patchlevel.h`
2295else
2296 patchlevel=0
8e07c86e 2297fi
4633a7c4 2298echo "(You have $package $baserev PL$patchlevel.)"
2304df62 2299
8e07c86e
AD
2300: set the prefixup variable, to restore leading tilda escape
2301prefixup='case "$prefixexp" in
2302"$prefix") ;;
2303*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
2304esac'
2305
4633a7c4
LW
2306: determine where public architecture dependent libraries go
2307set archlib archlib
8e07c86e 2308eval $prefixit
4633a7c4 2309case "$archlib" in
8e07c86e 2310'')
4633a7c4
LW
2311 case "$privlib" in
2312 '')
2313 dflt=`./loc . "." $prefixexp/lib /usr/local/lib /usr/lib /lib`
2314 set dflt
2315 eval $prefixup
2316 ;;
2317 *) version=`echo $baserev $patchlevel | $awk '{print $1 + $2/1000.0}'`
2318 dflt="$privlib/$archname/$version"
2319 ;;
2320 esac
8e07c86e 2321 ;;
4633a7c4 2322*) dflt="$archlib";;
8e07c86e 2323esac
4633a7c4
LW
2324cat <<EOM
2325
2326$spackage contains architecture-dependent library files. If you are
2327sharing libraries in a heterogeneous environment, you might store
2328these files in a separate location. Otherwise, you can just include
2329them with the rest of the public library files.
2330
8e07c86e 2331EOM
4633a7c4
LW
2332fn=d+~
2333rp='Where do you want to put the public architecture-dependent libraries?'
8e07c86e 2334. ./getfile
4633a7c4
LW
2335archlib="$ans"
2336archlibexp="$ansexp"
2337
8e07c86e
AD
2338if $afs; then
2339 $cat <<EOM
2340
2341Since you are running AFS, I need to distinguish the directory in which
4633a7c4 2342private files reside from the directory in which they are installed (and from
8e07c86e
AD
2343which they are presumably copied to the former directory by occult means).
2344
2345EOM
4633a7c4
LW
2346 case "$installarchlib" in
2347 '') dflt=`echo $archlibexp | sed 's#^/afs/#/afs/.#'`;;
2348 *) dflt="$installarchlib";;
8e07c86e
AD
2349 esac
2350 fn=de~
4633a7c4 2351 rp='Where will architecture-dependent library files be installed?'
8e07c86e 2352 . ./getfile
4633a7c4 2353 installarchlib="$ans"
8e07c86e 2354else
4633a7c4
LW
2355 installarchlib="$archlibexp"
2356fi
2357if $test X"$archlib" = X"$privlib"; then
2358 d_archlib="$undef"
2359else
2360 d_archlib="$define"
8e07c86e
AD
2361fi
2362
37120919
AD
2363: determine where site specific libraries go.
2364set sitelib sitelib
2365eval $prefixit
2366case "$sitelib" in
2367'') dflt="$privlib/site_perl" ;;
2368*) dflt="$sitelib" ;;
2369esac
2370$cat <<EOM
2371
2372The installation process will also create a directory for
2373site-specific extensions and modules. Some users find it convenient
2374to place all local files in this directory rather than in the main
2375distribution directory.
2376
2377EOM
2378fn=d~+
2379rp='Pathname for the site-specific library files?'
2380. ./getfile
2381if $test "X$sitelibexp" != "X$ansexp"; then
2382 installsitelib=''
2383fi
2384sitelib="$ans"
2385sitelibexp="$ansexp"
2386if $afs; then
2387 $cat <<EOM
2388
2389Since you are running AFS, I need to distinguish the directory in which
2390private files reside from the directory in which they are installed (and from
2391which they are presumably copied to the former directory by occult means).
2392
2393EOM
2394 case "$installsitelib" in
2395 '') dflt=`echo $sitelibexp | sed 's#^/afs/#/afs/.#'`;;
2396 *) dflt="$installsitelib";;
2397 esac
2398 fn=de~
2399 rp='Where will private files be installed?'
2400 . ./getfile
2401 installsitelib="$ans"
2402else
2403 installsitelib="$sitelibexp"
2404fi
4633a7c4 2405
37120919
AD
2406: determine where site specific architecture-dependent libraries go.
2407xxx=`echo $sitelib/$archname | sed 's!^$prefix!!'`
2408: xxx is usuually lib/site_perl/archname.
2409set sitearch sitearch none
8e07c86e 2410eval $prefixit
37120919
AD
2411case "$sitearch" in
2412'') dflt="$sitelib/$archname" ;;
2413*) dflt="$sitearch" ;;
2414esac
8e07c86e
AD
2415$cat <<EOM
2416
4633a7c4
LW
2417The installation process will also create a directory for
2418architecture-dependent site-specific extensions and modules.
8e07c86e
AD
2419
2420EOM
4633a7c4
LW
2421fn=nd~+
2422rp='Pathname for the site-specific architecture-dependent library files?'
8e07c86e 2423. ./getfile
4633a7c4
LW
2424if $test "X$sitearchexp" != "X$ansexp"; then
2425 installsitearch=''
8e07c86e 2426fi
4633a7c4
LW
2427sitearch="$ans"
2428sitearchexp="$ansexp"
8e07c86e
AD
2429if $afs; then
2430 $cat <<EOM
2431
2432Since you are running AFS, I need to distinguish the directory in which
2433private files reside from the directory in which they are installed (and from
2434which they are presumably copied to the former directory by occult means).
2435
2436EOM
4633a7c4
LW
2437 case "$installsitearch" in
2438 '') dflt=`echo $sitearchexp | sed 's#^/afs/#/afs/.#'`;;
2439 *) dflt="$installsitearch";;
8e07c86e
AD
2440 esac
2441 fn=de~
2442 rp='Where will private files be installed?'
2443 . ./getfile
4633a7c4 2444 installsitearch="$ans"
8e07c86e 2445else
4633a7c4 2446 installsitearch="$sitearchexp"
8e07c86e
AD
2447fi
2448
4633a7c4
LW
2449: set up the script used to warn in case of inconsistency
2450cat <<'EOSC' >whoa
2451dflt=y
8e07c86e 2452echo " "
4633a7c4
LW
2453echo "*** WHOA THERE!!! ***" >&4
2454echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
2455rp=" Keep the $hint value?"
8e07c86e 2456. ./myread
4633a7c4
LW
2457case "$ans" in
2458y) td=$was; tu=$was;;
2459esac
2460EOSC
8e07c86e 2461
4633a7c4
LW
2462: function used to set $1 to $val
2463setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2464case "$val$was" in
2465$define$undef) . ./whoa; eval "$var=\$td";;
2466$undef$define) . ./whoa; eval "$var=\$tu";;
2467*) eval "$var=$val";;
2468esac'
2469
2470: determine where old public architecture dependent libraries might be
2471case "$oldarchlib" in
2472'') case "$privlib" in
2473 '') ;;
2474 *) dflt="$privlib/$archname"
8e07c86e 2475 ;;
8e07c86e
AD
2476 esac
2477 ;;
4633a7c4
LW
2478*) dflt="$oldarchlib"
2479 ;;
8e07c86e 2480esac
4633a7c4
LW
2481if $test ! -d "$dflt/auto"; then
2482 dflt=none
2483fi
8e07c86e
AD
2484cat <<EOM
2485
4633a7c4
LW
2486In 5.001, Perl stored architecutre-dependent library files in a library
2487with a name such as $privlib/$archname,
2488and this directory contained files from the standard extensions and
2489files from any additional extensions you might have added. Starting
2490with version 5.002, all the architecture-dependent standard extensions
2491will go into $archlib,
2492while locally-added extensions will go into
2493$sitearch.
2494
2495If you wish Perl to continue to search the old architecture-dependent
2496library for your local extensions, give the path to that directory.
2497If you do not wish to use your old architecture-dependent library
2498files, answer 'none'.
8e07c86e
AD
2499
2500EOM
4633a7c4
LW
2501fn=dn~
2502rp='Directory for your old 5.001 architecture-dependent libraries?'
8e07c86e 2503. ./getfile
4633a7c4
LW
2504oldarchlib="$ans"
2505oldarchlibexp="$ansexp"
2506case "$oldarchlib" in
2507''|' ') val="$undef" ;;
2508*) val="$define" ;;
2509esac
2510set d_oldarchlib
2511eval $setvar
8e07c86e 2512
4633a7c4
LW
2513: determine where public executables go
2514echo " "
2515set dflt bin bin
2516eval $prefixit
2517fn=d~
2518rp='Pathname where the public executables will reside?'
2519. ./getfile
2520if $test "X$ansexp" != "X$binexp"; then
2521 installbin=''
2522fi
2523bin="$ans"
2524binexp="$ansexp"
8e07c86e
AD
2525if $afs; then
2526 $cat <<EOM
2527
2528Since you are running AFS, I need to distinguish the directory in which
4633a7c4 2529executables reside from the directory in which they are installed (and from
8e07c86e
AD
2530which they are presumably copied to the former directory by occult means).
2531
2532EOM
4633a7c4
LW
2533 case "$installbin" in
2534 '') dflt=`echo $binexp | sed 's#^/afs/#/afs/.#'`;;
2535 *) dflt="$installbin";;
8e07c86e
AD
2536 esac
2537 fn=de~
4633a7c4 2538 rp='Where will public executables be installed?'
8e07c86e 2539 . ./getfile
4633a7c4 2540 installbin="$ans"
8e07c86e 2541else
4633a7c4 2542 installbin="$binexp"
8e07c86e
AD
2543fi
2544
8e07c86e
AD
2545: determine where manual pages go
2546set man1dir man1dir none
2547eval $prefixit
2548$cat <<EOM
2549
2550$spackage has manual pages available in source form.
2551EOM
2552case "$nroff" in
2553nroff)
2554 echo "However, you don't have nroff, so they're probably useless to you."
2555 case "$man1dir" in
2556 '') man1dir="none";;
2557 esac;;
2558esac
2559echo "If you don't want the manual sources installed, answer 'none'."
2560case "$man1dir" in
2561'')
25f94b33
AD
2562 lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
2563 lookpath="$lookpath $prefixexp/man/p_man/man1"
2564 lookpath="$lookpath $prefixexp/man/u_man/man1"
2565 : If prefix contains 'perl' then we want to keep the man pages
2566 : under the prefix directory. Otherwise, look in a variety of
2567 : other possible places. This is debatable, but probably a
2568 : good compromise.
2569 case "$prefix" in
2570 *perl*) ;;
2571 *) lookpath="$lookpath /usr/local/man/man1"
2572 lookpath="$lookpath /opt/local/man/man1"
2573 lookpath="$lookpath /usr/local/man/man.1"
2574 lookpath="$lookpath /opt/local/man/man.1"
2575 lookpath="$lookpath /usr/man/local/man1"
2576 lookpath="$lookpath /usr/man/l_man/man1"
2577 lookpath="$lookpath /usr/man/p_man/man1"
2578 lookpath="$lookpath /usr/man/u_man/man1"
2579 lookpath="$lookpath /usr/man/man.L"
2580 lookpath="$lookpath /usr/man/man.l"
2581 ;;
2582 esac
2583 dflt=`./loc . $prefixexp/man/man1 $lookpath`
8e07c86e
AD
2584 set dflt
2585 eval $prefixup
2586 ;;
2587' ') dflt=none;;
2588*) dflt="$man1dir"
2589 ;;
2590esac
2591echo " "
4633a7c4 2592fn=dn+~
8e07c86e
AD
2593rp="Where do the main $spackage manual pages (source) go?"
2594. ./getfile
25f94b33 2595if $test "X$man1direxp" != "X$ansexp"; then
8e07c86e
AD
2596 installman1dir=''
2597fi
2598man1dir="$ans"
2599man1direxp="$ansexp"
2600case "$man1dir" in
2601'') man1dir=' '
2602 installman1dir='';;
2603esac
2604if $afs; then
2605 $cat <<EOM
2606
2607Since you are running AFS, I need to distinguish the directory in which
2608manual pages reside from the directory in which they are installed (and from
2609which they are presumably copied to the former directory by occult means).
2610
2611EOM
2612 case "$installman1dir" in
2613 '') dflt=`echo $man1direxp | sed 's#^/afs/#/afs/.#'`;;
2614 *) dflt="$installman1dir";;
2615 esac
2616 fn=de~
2617 rp='Where will man pages be installed?'
2618 . ./getfile
2619 installman1dir="$ans"
2620else
2621 installman1dir="$man1direxp"
2622fi
2623
2624: What suffix to use on installed man pages
2625
2626case "$man1dir" in
2627' ')
2628 man1ext='0'
2629 ;;
2630*)
2631 rp="What suffix should be used for the main $spackage man pages?"
2632 case "$man1dir" in
2633 *1) dflt=1 ;;
2634 *1p) dflt=1p ;;
2635 *1pm) dflt=1pm ;;
2636 *l) dflt=l;;
2637 *n) dflt=n;;
2638 *o) dflt=o;;
2639 *p) dflt=p;;
2640 *C) dflt=C;;
2641 *L) dflt=L;;
2642 *L1) dflt=L1;;
2643 *) dflt=1;;
2644 esac
2645 . ./myread
2646 man1ext="$ans"
2647 ;;
2648esac
2649
8e07c86e
AD
2650: see if we can have long filenames
2651echo " "
2652rmlist="$rmlist /tmp/cf$$"
2653$test -d /tmp/cf$$ || mkdir /tmp/cf$$
2654first=123456789abcdef
2655second=/tmp/cf$$/$first
2656$rm -f $first $second
2657if (echo hi >$first) 2>/dev/null; then
2658 if $test -f 123456789abcde; then
2659 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
2660 val="$undef"
2661 else
2662 if (echo hi >$second) 2>/dev/null; then
2663 if $test -f /tmp/cf$$/123456789abcde; then
2664 $cat <<'EOM'
2665That's peculiar... You can have filenames longer than 14 characters, but only
2666on some of the filesystems. Maybe you are using NFS. Anyway, to avoid problems
2667I shall consider your system cannot support long filenames at all.
2668EOM
2669 val="$undef"
2670 else
2671 echo 'You can have filenames longer than 14 characters.' >&4
2672 val="$define"
2673 fi
2674 else
2675 $cat <<'EOM'
2676How confusing! Some of your filesystems are sane enough to allow filenames
2677longer than 14 characters but some others like /tmp can't even think about them.
2678So, for now on, I shall assume your kernel does not allow them at all.
2679EOM
2680 val="$undef"
2681 fi
2682 fi
2683else
2684 $cat <<'EOM'
2685You can't have filenames longer than 14 chars. You can't even think about them!
2686EOM
2687 val="$undef"
2688fi
2689set d_flexfnam
2690eval $setvar
2691$rm -rf /tmp/cf$$ 123456789abcde*
2692
2693: determine where library module manual pages go
2694set man3dir man3dir none
2695eval $prefixit
2696$cat <<EOM
2697
2698$spackage has manual pages for many of the library modules.
2699EOM
2700
2701case "$nroff" in
2702nroff)
2703 $cat <<'EOM'
2704However, you don't have nroff, so they're probably useless to you.
2705You can use the supplied perldoc script instead.
2706EOM
2707 case "$man3dir" in
2708 '') man3dir="none";;
2709 esac;;
2710esac
2711
2712case "$d_flexfnam" in
2713undef)
2714 $cat <<'EOM'
2715However, your system can't handle the long file names like File::Basename.3.
2716You can use the supplied perldoc script instead.
2717EOM
2718 case "$man3dir" in
2719 '') man3dir="none";;
2720 esac;;
2721esac
2722
2723echo "If you don't want the manual sources installed, answer 'none'."
4633a7c4
LW
2724: We dont use /usr/local/man/man3 because some man programs will
2725: only show the /usr/local/man/man3 contents, and not the system ones,
2726: thus man less will show the perl module less.pm, but not the system
2727: less command. We might also conflict with TCL man pages.
2728: However, something like /opt/perl/man/man3 is fine.
8e07c86e 2729case "$man3dir" in
4633a7c4
LW
2730'') case "$prefix" in
2731 *perl*) dflt=`echo $man1dir | $sed 's/man1/man3/g'` ;;
2732 *) dflt="$privlib/man/man3" ;;
2733 esac
2734 ;;
8e07c86e
AD
2735' ') dflt=none;;
2736*) dflt="$man3dir" ;;
2737esac
2738echo " "
2739
4633a7c4 2740fn=dn+~
8e07c86e
AD
2741rp="Where do the $spackage library man pages (source) go?"
2742. ./getfile
2743if test "X$man3direxp" != "X$ansexp"; then
2744 installman3dir=''
2745fi
2746
2747man3dir="$ans"
2748man3direxp="$ansexp"
2749case "$man3dir" in
2750'') man3dir=' '
2751 installman3dir='';;
2752esac
2753if $afs; then
2754 $cat <<EOM
2755
2756Since you are running AFS, I need to distinguish the directory in which
2757manual pages reside from the directory in which they are installed (and from
2758which they are presumably copied to the former directory by occult means).
2759
2760EOM
2761 case "$installman3dir" in
2762 '') dflt=`echo $man3direxp | sed 's#^/afs/#/afs/.#'`;;
2763 *) dflt="$installman3dir";;
2764 esac
2765 fn=de~
2766 rp='Where will man pages be installed?'
2767 . ./getfile
2768 installman3dir="$ans"
2769else
2770 installman3dir="$man3direxp"
2771fi
2772
2773: What suffix to use on installed man pages
2774
2775case "$man3dir" in
2776' ')
2777 man3ext='0'
2778 ;;
2779*)
2780 rp="What suffix should be used for the $spackage library man pages?"
2781 case "$man3dir" in
2782 *3) dflt=3 ;;
2783 *3p) dflt=3p ;;
2784 *3pm) dflt=3pm ;;
2785 *l) dflt=l;;
2786 *n) dflt=n;;
2787 *o) dflt=o;;
2788 *p) dflt=p;;
2789 *C) dflt=C;;
2790 *L) dflt=L;;
2791 *L3) dflt=L3;;
2792 *) dflt=3;;
2793 esac
2794 . ./myread
2795 man3ext="$ans"
2796 ;;
2797esac
2798
4633a7c4
LW
2799: determine where public executable scripts go
2800set scriptdir scriptdir
2801eval $prefixit
2802case "$scriptdir" in
2803'')
2804 dflt="$bin"
2805 : guess some guesses
2806 $test -d /usr/share/scripts && dflt=/usr/share/scripts
2807 $test -d /usr/share/bin && dflt=/usr/share/bin
2808 $test -d /usr/local/script && dflt=/usr/local/script
2809 $test -d $prefixexp/script && dflt=$prefixexp/script
2810 set dflt
2811 eval $prefixup
2812 ;;
2813*) dflt="$scriptdir"
8e07c86e 2814 ;;
8e07c86e 2815esac
4633a7c4
LW
2816$cat <<EOM
2817
2818Some installations have a separate directory just for executable scripts so
2819that they can mount it across multiple architectures but keep the scripts in
2820one spot. You might, for example, have a subdirectory of /usr/share for this.
2821Or you might just lump your scripts in with all your other executables.
2822
2823EOM
2824fn=d~
2825rp='Where do you keep publicly executable scripts?'
2826. ./getfile
2827if $test "X$ansexp" != "X$scriptdirexp"; then
2828 installscript=''
8e07c86e 2829fi
4633a7c4
LW
2830scriptdir="$ans"
2831scriptdirexp="$ansexp"
2832if $afs; then
2833 $cat <<EOM
8e07c86e 2834
4633a7c4
LW
2835Since you are running AFS, I need to distinguish the directory in which
2836scripts reside from the directory in which they are installed (and from
2837which they are presumably copied to the former directory by occult means).
2838
2839EOM
2840 case "$installscript" in
2841 '') dflt=`echo $scriptdirexp | sed 's#^/afs/#/afs/.#'`;;
2842 *) dflt="$installscript";;
8e07c86e 2843 esac
4633a7c4
LW
2844 fn=de~
2845 rp='Where will public scripts be installed?'
2846 . ./getfile
2847 installscript="$ans"
2848else
2849 installscript="$scriptdirexp"
8e07c86e
AD
2850fi
2851
4633a7c4
LW
2852: determine perl absolute location
2853case "$perlpath" in
2854'') perlpath=$binexp/perl ;;
8e07c86e
AD
2855esac
2856
4633a7c4
LW
2857: figure out how to guarantee perl startup
2858case "$startperl" in
2859'')
2860 case "$sharpbang" in
2861 *!)
2862 $cat <<EOH
8e07c86e 2863
4633a7c4
LW
2864I can use the #! construct to start perl on your system. This will
2865make startup of perl scripts faster, but may cause problems if you
2866want to share those scripts and perl is not in a standard place
2867($perlpath) on all your platforms. The alternative is to force
2868a shell by starting the script with a single ':' character.
8e07c86e 2869
4633a7c4 2870EOH
37120919
AD
2871 dflt=$perlpath
2872 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8e07c86e
AD
2873 . ./myread
2874 case "$ans" in
37120919
AD
2875 none) startperl=": # use perl";;
2876 *) startperl="#!$ans";;
8e07c86e
AD
2877 esac
2878 ;;
4633a7c4
LW
2879 *) startperl=": # use perl"
2880 ;;
8e07c86e 2881 esac
4633a7c4
LW
2882 ;;
2883esac
2884echo "I'll use $startperl to start perl scripts."
8e07c86e 2885
25f94b33
AD
2886: determine where manual pages are on this system
2887echo " "
2888case "$sysman" in
2889'')
2890 syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2891 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2892 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2893 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2894 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2895 sysman=`./loc . /usr/man/man1 $syspath`
2896 ;;
2897esac
2898if $test -d "$sysman"; then
2899 echo "System manual is in $sysman." >&4
2900else
2901 echo "Could not find manual pages in source form." >&4
2902fi
2903
4633a7c4
LW
2904: see what memory models we can support
2905case "$models" in
2906'')
2907 $cat >pdp11.c <<'EOP'
2908main() {
2909#ifdef pdp11
2910 exit(0);
2911#else
2912 exit(1);
2913#endif
2914}
2915EOP
2916 cc -o pdp11 pdp11.c >/dev/null 2>&1
2917 if ./pdp11 2>/dev/null; then
2918 dflt='unsplit split'
2919 else
2920 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2921 case "$tans" in
2922 X) dflt='none';;
2923 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2924 dflt='small'
2925 else
2926 dflt=''
2927 fi
2928 if $test -d /lib/medium || $test -d /usr/lib/medium; then
2929 dflt="$dflt medium"
2930 fi
2931 if $test -d /lib/large || $test -d /usr/lib/large; then
2932 dflt="$dflt large"
2933 fi
2934 if $test -d /lib/huge || $test -d /usr/lib/huge; then
2935 dflt="$dflt huge"
2936 fi
2937 esac
2938 fi;;
2939*) dflt="$models";;
8e07c86e 2940esac
4633a7c4
LW
2941$cat <<EOM
2942
2943Some systems have different model sizes. On most systems they are called
2944small, medium, large, and huge. On the PDP11 they are called unsplit and
2945split. If your system doesn't support different memory models, say "none".
2946If you wish to force everything to one memory model, say "none" here and
2947put the appropriate flags later when it asks you for other cc and ld flags.
2948Venix systems may wish to put "none" and let the compiler figure things out.
2949(In the following question multiple model names should be space separated.)
8e07c86e 2950
4633a7c4
LW
2951EOM
2952rp="Which memory models are supported?"
8e07c86e 2953. ./myread
4633a7c4 2954models="$ans"
8e07c86e 2955
4633a7c4
LW
2956case "$models" in
2957none)
2958 small=''
2959 medium=''
2960 large=''
2961 huge=''
2962 unsplit=''
2963 split=''
2964 ;;
2965*split)
2966 case "$split" in
2967 '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2968 $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2969 dflt='-i'
2970 else
2971 dflt='none'
2972 fi;;
2973 *) dflt="$split";;
8e07c86e 2974 esac
4633a7c4
LW
2975 rp="What flag indicates separate I and D space?"
2976 . ./myread
2977 tans="$ans"
2978 case "$tans" in
2979 none) tans='';;
8e07c86e 2980 esac
4633a7c4
LW
2981 split="$tans"
2982 unsplit='';;
2983*large*|*small*|*medium*|*huge*)
2984 case "$models" in
2985 *large*)
2986 case "$large" in
2987 '') dflt='-Ml';;
2988 *) dflt="$large";;
2989 esac
2990 rp="What flag indicates large model?"
2991 . ./myread
2992 tans="$ans"
2993 case "$tans" in
2994 none) tans='';
2995 esac
2996 large="$tans";;
2997 *) large='';;
8e07c86e 2998 esac
4633a7c4
LW
2999 case "$models" in
3000 *huge*) case "$huge" in
3001 '') dflt='-Mh';;
3002 *) dflt="$huge";;
3003 esac
3004 rp="What flag indicates huge model?"
3005 . ./myread
3006 tans="$ans"
3007 case "$tans" in
3008 none) tans='';
3009 esac
3010 huge="$tans";;
3011 *) huge="$large";;
3012 esac
3013 case "$models" in
3014 *medium*) case "$medium" in
3015 '') dflt='-Mm';;
3016 *) dflt="$medium";;
3017 esac
3018 rp="What flag indicates medium model?"
3019 . ./myread
3020 tans="$ans"
3021 case "$tans" in
3022 none) tans='';
3023 esac
3024 medium="$tans";;
3025 *) medium="$large";;
3026 esac
3027 case "$models" in
3028 *small*) case "$small" in
3029 '') dflt='none';;
3030 *) dflt="$small";;
3031 esac
3032 rp="What flag indicates small model?"
3033 . ./myread
3034 tans="$ans"
3035 case "$tans" in
3036 none) tans='';
3037 esac
3038 small="$tans";;
3039 *) small='';;
3040 esac
3041 ;;
3042*)
3043 echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
8e07c86e
AD
3044 ;;
3045esac
3046
4633a7c4
LW
3047: make some quick guesses about what we are up against
3048echo " "
3049$echo $n "Hmm... $c"
3050echo exit 1 >bsd
3051echo exit 1 >usg
3052echo exit 1 >v7
3053echo exit 1 >osf1
3054echo exit 1 >eunice
3055echo exit 1 >xenix
3056echo exit 1 >venix
3057d_bsd="$undef"
3058$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3059if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3060then
3061 echo "Looks kind of like an OSF/1 system, but we'll see..."
3062 echo exit 0 >osf1
3063elif test `echo abc | tr a-z A-Z` = Abc ; then
3064 xxx=`./loc addbib blurfl $pth`
3065 if $test -f $xxx; then
3066 echo "Looks kind of like a USG system with BSD features, but we'll see..."
3067 echo exit 0 >bsd
3068 echo exit 0 >usg
3069 else
3070 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3071 echo "Looks kind of like an extended USG system, but we'll see..."
3072 else
3073 echo "Looks kind of like a USG system, but we'll see..."
8e07c86e 3074 fi
4633a7c4 3075 echo exit 0 >usg
8e07c86e 3076 fi
4633a7c4
LW
3077elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3078 echo "Looks kind of like a BSD system, but we'll see..."
3079 d_bsd="$define"
3080 echo exit 0 >bsd
8e07c86e 3081else
4633a7c4
LW
3082 echo "Looks kind of like a Version 7 system, but we'll see..."
3083 echo exit 0 >v7
8e07c86e 3084fi
4633a7c4
LW
3085case "$eunicefix" in
3086*unixtovms*)
3087 $cat <<'EOI'
3088There is, however, a strange, musty smell in the air that reminds me of
3089something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3090EOI
3091 echo exit 0 >eunice
3092 d_eunice="$define"
3093: it so happens the Eunice I know will not run shell scripts in Unix format
3094 ;;
a0d0e21e
LW
3095*)
3096 echo " "
4633a7c4
LW
3097 echo "Congratulations. You aren't running Eunice."
3098 d_eunice="$undef"
2304df62
AD
3099 ;;
3100esac
4633a7c4
LW
3101if test -f /xenix; then
3102 echo "Actually, this looks more like a XENIX system..."
3103 echo exit 0 >xenix
3104 d_xenix="$define"
3105else
3106 echo " "
3107 echo "It's not Xenix..."
3108 d_xenix="$undef"
3109fi
3110chmod +x xenix
3111$eunicefix xenix
3112if test -f /venix; then
3113 echo "Actually, this looks more like a VENIX system..."
3114 echo exit 0 >venix
3115else
3116 echo " "
3117 if ./xenix; then
3118 : null
2304df62 3119 else
4633a7c4 3120 echo "Nor is it Venix..."
2304df62 3121 fi
4633a7c4
LW
3122fi
3123chmod +x bsd usg v7 osf1 eunice xenix venix
3124$eunicefix bsd usg v7 osf1 eunice xenix venix
3125$rm -f foo
2304df62 3126
4633a7c4 3127: see if we need a special compiler
16d20bd9 3128echo " "
4633a7c4
LW
3129if ./usg; then
3130 case "$cc" in
3131 '') case "$Mcc" in
3132 /*) dflt='Mcc';;
3133 *) case "$large" in
3134 -M*) dflt='cc';;
3135 *) if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3136 if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3137 dflt='cc'
3138 else
3139 dflt='cc -M'
3140 fi
3141 else
3142 dflt='cc'
3143 fi;;
3144 esac;;
3145 esac;;
3146 *) dflt="$cc";;
3147 esac
3148 $cat <<'EOM'
3149On some systems the default C compiler will not resolve multiple global
3150references that happen to have the same name. On some such systems the "Mcc"
3151command may be used to force these to be resolved. On other systems a "cc -M"
3152command is required. (Note that the -M flag on other systems indicates a
3153memory model to use!) If you have the Gnu C compiler, you might wish to use
3154that instead.
16d20bd9
AD
3155
3156EOM
4633a7c4
LW
3157 rp="What command will force resolution on this system?"
3158 . ./myread
3159 cc="$ans"
16d20bd9 3160else
4633a7c4
LW
3161 case "$cc" in
3162 '') dflt=cc;;
3163 *) dflt="$cc";;
3164 esac
3165 rp="Use which C compiler?"
3166 . ./myread
3167 cc="$ans"
16d20bd9 3168fi
4633a7c4
LW
3169echo " "
3170echo "Checking for GNU cc in disguise and/or its version number..." >&4
3171$cat >gccvers.c <<EOM
3172#include <stdio.h>
3173int main() {
3174#ifdef __GNUC__
3175#ifdef __VERSION__
3176 printf("%s\n", __VERSION__);
3177#else
3178 printf("%s\n", "1");
3179#endif
3180#endif
3181 exit(0);
3182}
3183EOM
3184if $cc -o gccvers gccvers.c >/dev/null 2>&1; then
3185 gccversion=`./gccvers`
3186 case "$gccversion" in
3187 '') echo "You are not using GNU cc." ;;
3188 *) echo "You are using GNU cc $gccversion." ;;
16d20bd9 3189 esac
4633a7c4 3190else
16d20bd9 3191 echo " "
4633a7c4
LW
3192 echo "*** WHOA THERE!!! ***" >&4
3193 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3194 case "$knowitall" in
3195 '')
3196 echo " You'd better start hunting for one and let me know about it." >&4
16d20bd9
AD
3197 exit 1
3198 ;;
3199 esac
4633a7c4
LW
3200fi
3201$rm -f gccvers*
3202case "$gccversion" in
32031*) cpp=`./loc gcc-cpp $cpp $pth` ;;
16d20bd9 3204esac
16d20bd9 3205
4633a7c4 3206: What should the include directory be ?
2304df62 3207echo " "
4633a7c4
LW
3208$echo $n "Hmm... $c"
3209dflt='/usr/include'
3210incpath=''
3211mips_type=''
3212if $test -f /bin/mips && /bin/mips; then
3213 echo "Looks like a MIPS system..."
3214 $cat >usr.c <<'EOCP'
3215#ifdef SYSTYPE_BSD43
3216/bsd43
3217#endif
3218EOCP
3219 if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3220 dflt='/bsd43/usr/include'
3221 incpath='/bsd43'
3222 mips_type='BSD 4.3'
2304df62 3223 else
4633a7c4 3224 mips_type='System V'
2304df62 3225 fi
4633a7c4
LW
3226 $rm -f usr.c usr.out
3227 echo "and you're compiling with the $mips_type compiler and libraries."
3228 xxx_prompt=y
3229 echo "exit 0" >mips
3230else
3231 echo "Doesn't look like a MIPS system."
3232 xxx_prompt=n
3233 echo "exit 1" >mips
3234fi
3235chmod +x mips
3236$eunicefix mips
2304df62 3237echo " "
4633a7c4
LW
3238case "$usrinc" in
3239'') ;;
3240*) dflt="$usrinc";;
2304df62 3241esac
4633a7c4
LW
3242case "$xxx_prompt" in
3243y) fn=d/
3244 rp='Where are the include files you want to use?'
3245 . ./getfile
3246 usrinc="$ans"
2304df62 3247 ;;
4633a7c4 3248*) usrinc="$dflt"
2304df62
AD
3249 ;;
3250esac
2304df62 3251
4633a7c4 3252: see how we invoke the C preprocessor
2304df62 3253echo " "
4633a7c4
LW
3254echo "Now, how can we feed standard input to your C preprocessor..." >&4
3255cat <<'EOT' >testcpp.c
3256#define ABC abc
3257#define XYZ xyz
3258ABC.XYZ
3259EOT
3260cd ..
3261echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3262chmod 755 cppstdin
3263wrapper=`pwd`/cppstdin
3264ok='false'
3265cd UU
3266
3267if $test "X$cppstdin" != "X" && \
3268 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3269 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3270then
3271 echo "You used to use $cppstdin $cppminus so we'll use that again."
3272 case "$cpprun" in
3273 '') echo "But let's see if we can live without a wrapper..." ;;
3274 *)
3275 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3276 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3277 then
3278 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3279 ok='true'
a0d0e21e 3280 else
4633a7c4 3281 echo "(However, $cpprun $cpplast does not work, let's see...)"
2304df62 3282 fi
2304df62 3283 ;;
2304df62 3284 esac
4633a7c4
LW
3285else
3286 case "$cppstdin" in
3287 '') ;;
3288 *)
3289 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3290 ;;
3291 esac
3292fi
3293
3294if $ok; then
3295 : nothing
3296elif echo 'Maybe "'"$cc"' -E" will work...'; \
3297 $cc -E <testcpp.c >testcpp.out 2>&1; \
3298 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3299 echo "Yup, it does."
3300 x_cpp="$cc -E"
3301 x_minus='';
3302elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3303 $cc -E - <testcpp.c >testcpp.out 2>&1; \
3304 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3305 echo "Yup, it does."
3306 x_cpp="$cc -E"
3307 x_minus='-';
3308elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3309 $cc -P <testcpp.c >testcpp.out 2>&1; \
3310 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3311 echo "Yipee, that works!"
3312 x_cpp="$cc -P"
3313 x_minus='';
3314elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3315 $cc -P - <testcpp.c >testcpp.out 2>&1; \
3316 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3317 echo "At long last!"
3318 x_cpp="$cc -P"
3319 x_minus='-';
3320elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3321 $cpp <testcpp.c >testcpp.out 2>&1; \
3322 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3323 echo "It works!"
3324 x_cpp="$cpp"
3325 x_minus='';
3326elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3327 $cpp - <testcpp.c >testcpp.out 2>&1; \
3328 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3329 echo "Hooray, it works! I was beginning to wonder."
3330 x_cpp="$cpp"
3331 x_minus='-';
3332elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
3333 $wrapper <testcpp.c >testcpp.out 2>&1; \
3334 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3335 x_cpp="$wrapper"
3336 x_minus=''
3337 echo "Eureka!"
3338else
3339 dflt=''
3340 rp="No dice. I can't find a C preprocessor. Name one:"
3341 . ./myread
3342 x_cpp="$ans"
3343 x_minus=''
3344 $x_cpp <testcpp.c >testcpp.out 2>&1
3345 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3346 echo "OK, that will do." >&4
3347 else
3348echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
3349 exit 1
3350 fi
3351fi
3352
3353case "$ok" in
3354false)
3355 cppstdin="$x_cpp"
3356 cppminus="$x_minus"
3357 cpprun="$x_cpp"
3358 cpplast="$x_minus"
3359 set X $x_cpp
3360 shift
3361 case "$1" in
3362 "$cpp")
3363 echo "Perhaps can we force $cc -E using a wrapper..."
3364 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3365 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3366 then
3367 echo "Yup, we can."
3368 cppstdin="$wrapper"
3369 cppminus='';
3370 else
3371 echo "Nope, we'll have to live without it..."
3372 fi
3373 ;;
3374 esac
3375 case "$cpprun" in
3376 "$wrapper")
3377 cpprun=''
3378 cpplast=''
3379 ;;
3380 esac
3381 ;;
3382esac
3383
3384case "$cppstdin" in
3385"$wrapper") ;;
3386*) $rm -f $wrapper;;
3387esac
3388$rm -f testcpp.c testcpp.out
3389
3390: Set private lib path
3391case "$plibpth" in
3392'') if ./mips; then
3393 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3394 fi;;
3395esac
3396case "$libpth" in
3397' ') dlist='';;
3398'') dlist="$loclibpth $plibpth $glibpth";;
3399*) dlist="$libpth";;
3400esac
3401
3402: Now check and see which directories actually exist, avoiding duplicates
3403libpth=''
3404for xxx in $dlist
3405do
3406 if $test -d $xxx; then
3407 case " $libpth " in
3408 *" $xxx "*) ;;
3409 *) libpth="$libpth $xxx";;
3410 esac
3411 fi
3412done
3413$cat <<'EOM'
3414
3415Some systems have incompatible or broken versions of libraries. Among
3416the directories listed in the question below, please remove any you
3417know not to be holding relevant libraries, and add any that are needed.
3418Say "none" for none.
3419
3420EOM
3421case "$libpth" in
3422'') dflt='none';;
3423*)
3424 set X $libpth
3425 shift
3426 dflt=${1+"$@"}
3427 ;;
3428esac
3429rp="Directories to use for library searches?"
3430. ./myread
3431case "$ans" in
3432none) libpth=' ';;
3433*) libpth="$ans";;
3434esac
3435
3436: determine optimize, if desired, or use for debug flag also
3437case "$optimize" in
3438' ') dflt='none';;
3439'') dflt='-O';;
3440*) dflt="$optimize";;
3441esac
3442$cat <<EOH
3443
3444Some C compilers have problems with their optimizers, by default, $package
3445compiles with the -O flag to use the optimizer. Alternately, you might want
3446to use the symbolic debugger, which uses the -g flag (on traditional Unix
3447systems). Either flag can be specified here. To use neither flag, specify
3448the word "none".
3449
3450EOH
3451rp="What optimizer/debugger flag should be used?"
3452. ./myread
3453optimize="$ans"
3454case "$optimize" in
3455'none') optimize=" ";;
3456esac
3457
3458dflt=''
25f94b33
AD
3459: We will not override a previous value, but we might want to
3460: augment a hint file
3461case "$hint" in
3462none|recommended)
4633a7c4
LW
3463 case "$gccversion" in
3464 1*) dflt='-fpcc-struct-return' ;;
3465 esac
3466 case "$optimize" in
3467 *-g*) dflt="$dflt -DDEBUGGING";;
3468 esac
3469 case "$gccversion" in
3470 2*) if test -d /etc/conf/kconfig.d &&
3471 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3472 then
3473 dflt="$dflt -posix"
3474 fi
3475 ;;
3476 esac
3477 ;;
3478esac
3479
3480case "$mips_type" in
3481*BSD*|'') inclwanted="$locincpth $usrinc";;
3482*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3483esac
3484for thisincl in $inclwanted; do
3485 if $test -d $thisincl; then
3486 if $test x$thisincl != x$usrinc; then
3487 case "$dflt" in
3488 *$thisincl*);;
3489 *) dflt="$dflt -I$thisincl";;
3490 esac
3491 fi
3492 fi
3493done
3494
3495inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3496 xxx=true;
3497elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3498 xxx=true;
3499else
3500 xxx=false;
3501fi;
3502if $xxx; then
3503 case "$dflt" in
3504 *$2*);;
3505 *) dflt="$dflt -D$2";;
3506 esac;
3507fi'
3508
3509if ./osf1; then
3510 set signal.h __LANGUAGE_C__; eval $inctest
3511else
3512 set signal.h LANGUAGE_C; eval $inctest
3513fi
3514set signal.h NO_PROTOTYPE; eval $inctest
3515set signal.h _NO_PROTO; eval $inctest
3516
25f94b33
AD
3517case "$hint" in
3518none|recommended) dflt="$ccflags $dflt" ;;
4633a7c4
LW
3519*) dflt="$ccflags";;
3520esac
25f94b33
AD
3521
3522case "$dflt" in
3523''|' ') dflt=none;;
3524esac
4633a7c4
LW
3525$cat <<EOH
3526
3527Your C compiler may want other flags. For this question you should include
3528-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3529but you should NOT include libraries or ld flags like -lwhatever. If you
3530want $package to honor its debug switch, you should include -DDEBUGGING here.
3531Your C compiler might also need additional flags, such as -D_POSIX_SOURCE,
3532-DHIDEMYMALLOC or -DCRIPPLED_CC.
3533
3534To use no flags, specify the word "none".
3535
3536EOH
3537set X $dflt
3538shift
3539dflt=${1+"$@"}
3540rp="Any additional cc flags?"
3541. ./myread
3542case "$ans" in
3543none) ccflags='';;
3544*) ccflags="$ans";;
3545esac
3546
3547: the following weeds options from ccflags that are of no interest to cpp
3548cppflags="$ccflags"
3549case "$gccversion" in
35501*) cppflags="$cppflags -D__GNUC__"
3551esac
3552case "$mips_type" in
3553'');;
3554*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3555esac
3556case "$cppflags" in
3557'');;
3558*)
3559 echo " "
3560 echo "Let me guess what the preprocessor flags are..." >&4
3561 set X $cppflags
3562 shift
3563 cppflags=''
3564 $cat >cpp.c <<'EOM'
3565#define BLURFL foo
3566
3567BLURFL xx LFRULB
3568EOM
3569 previous=''
3570 for flag in $*
3571 do
3572 case "$flag" in
3573 -*) ftry="$flag";;
3574 *) ftry="$previous $flag";;
3575 esac
3576 if $cppstdin -DLFRULB=bar $ftry $cppminus <cpp.c \
3577 >cpp1.out 2>/dev/null && \
3578 $cpprun -DLFRULB=bar $ftry $cpplast <cpp.c \
3579 >cpp2.out 2>/dev/null && \
3580 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3581 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3582 then
3583 cppflags="$cppflags $ftry"
3584 previous=''
3585 else
3586 previous="$flag"
3587 fi
3588 done
3589 set X $cppflags
3590 shift
3591 cppflags=${1+"$@"}
3592 case "$cppflags" in
3593 *-*) echo "They appear to be: $cppflags";;
3594 esac
3595 $rm -f cpp.c cpp?.out
3596 ;;
3597esac
3598
3599: flags used in final linking phase
3600
3601case "$ldflags" in
3602'') if ./venix; then
3603 dflt='-i -z'
3604 else
3605 dflt=''
3606 fi
3607 case "$ccflags" in
3608 *-posix*) dflt="$dflt -posix" ;;
3609 esac
3610 ;;
3611*) dflt="$ldflags";;
3612esac
3613
3614: Try to guess additional flags to pick up local libraries.
3615for thislibdir in $libpth; do
3616 case " $loclibpth " in
3617 *" $thislibdir "*)
3618 case "$dflt " in
25f94b33 3619 *"-L$thislibdir "*) ;;
4633a7c4
LW
3620 *) dflt="$dflt -L$thislibdir" ;;
3621 esac
3622 ;;
3623 esac
3624done
3625
3626case "$dflt" in
3627'') dflt='none' ;;
3628esac
3629
3630$cat <<EOH
3631
3632Your C linker may need flags. For this question you should
3633include -L/whatever and any other flags used by the C linker, but you
3634should NOT include libraries like -lwhatever.
3635
3636Make sure you include the appropriate -L/path flags if your C linker
3637does not normally search all of the directories you specified above,
3638namely
3639 $libpth
3640To use no flags, specify the word "none".
3641
3642EOH
3643
3644rp="Any additional ld flags (NOT including libraries)?"
3645. ./myread
3646case "$ans" in
3647none) ldflags='';;
3648*) ldflags="$ans";;
3649esac
3650rmlist="$rmlist pdp11"
3651
3652: coherency check
3653echo " "
3654echo "Checking your choice of C compiler and flags for coherency..." >&4
3655set X $cc $optimize $ccflags $ldflags try.c -o try
3656shift
3657$cat >try.msg <<EOM
3658I've tried to compile and run a simple program with:
3659
3660 $*
3661 ./try
3662
3663and I got the following output:
3664
3665EOM
3666$cat > try.c <<'EOF'
3667#include <stdio.h>
3668main() { exit(0); }
3669EOF
3670dflt=y
3671if sh -c "$cc $optimize $ccflags try.c -o try $ldflags" >>try.msg 2>&1; then
3672 if sh -c './try' >>try.msg 2>&1; then
3673 dflt=n
3674 else
3675 echo "The program compiled OK, but exited with status $?." >>try.msg
3676 rp="You have a problem. Shall I abort Configure"
3677 dflt=y
3678 fi
3679else
3680 echo "I can't compile the test program." >>try.msg
3681 rp="You have a BIG problem. Shall I abort Configure"
3682 dflt=y
3683fi
3684case "$dflt" in
3685y)
3686 $cat try.msg
3687 case "$knowitall" in
3688 '')
3689 echo "(The supplied flags might be incorrect with this C compiler.)"
3690 ;;
3691 *) dflt=n;;
3692 esac
3693 echo " "
3694 . ./myread
3695 case "$ans" in
3696 n*|N*) ;;
3697 *) echo "Ok. Stopping Configure." >&4
3698 exit 1
3699 ;;
3700 esac
3701 ;;
3702n) echo "OK, that should do.";;
3703esac
3704$rm -f try try.* core
3705
3706: compute shared library extension
3707case "$so" in
3708'')
3709 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3710 dflt='sl'
3711 else
3712 dflt='so'
3713 fi
3714 ;;
3715*) dflt="$so";;
3716esac
3717$cat <<EOM
3718
3719On some systems, shared libraries may be available. Answer 'none' if
3720you want to suppress searching of shared libraries for the remaining
3721of this configuration.
3722
3723EOM
3724rp='What is the file extension used for shared libraries?'
3725. ./myread
3726so="$ans"
3727
3728: Looking for optional libraries
3729echo " "
3730echo "Checking for optional libraries..." >&4
3731case "$libs" in
3732' '|'') dflt='';;
3733*) dflt="$libs";;
3734esac
3735case "$libswanted" in
3736'') libswanted='c_s';;
3737esac
3738for thislib in $libswanted; do
3739
3740 if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`; $test -f "$xxx"; then
3741 echo "Found -l$thislib (shared)."
3742 case " $dflt " in
3743 *"-l$thislib "*);;
3744 *) dflt="$dflt -l$thislib";;
3745 esac
3746 elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3747 echo "Found -l$thislib (shared)."
3748 case " $dflt " in
3749 *"-l$thislib "*);;
3750 *) dflt="$dflt -l$thislib";;
3751 esac
3752 elif xxx=`./loc lib$thislib.a X $libpth`; $test -f "$xxx"; then
3753 echo "Found -l$thislib."
3754 case " $dflt " in
3755 *"-l$thislib "*);;
3756 *) dflt="$dflt -l$thislib";;
3757 esac
3758 elif xxx=`./loc $thislib.a X $libpth`; $test -f "$xxx"; then
3759 echo "Found -l$thislib."
3760 case " $dflt " in
3761 *"-l$thislib "*);;
3762 *) dflt="$dflt -l$thislib";;
3763 esac
3764 elif xxx=`./loc lib${thislib}_s.a X $libpth`; $test -f "$xxx"; then
3765 echo "Found -l${thislib}_s."
3766 case " $dflt " in
3767 *"-l$thislib "*);;
3768 *) dflt="$dflt -l${thislib}_s";;
3769 esac
3770 elif xxx=`./loc Slib$thislib.a X $xlibpth`; $test -f "$xxx"; then
3771 echo "Found -l$thislib."
3772 case " $dflt " in
3773 *"-l$thislib "*);;
3774 *) dflt="$dflt -l$thislib";;
3775 esac
3776 else
3777 echo "No -l$thislib."
3778 fi
3779done
3780set X $dflt
3781shift
3782dflt="$*"
3783case "$libs" in
3784'') dflt="$dflt";;
3785*) dflt="$libs";;
3786esac
3787case "$dflt" in
3788' '|'') dflt='none';;
3789esac
3790
3791$cat <<EOM
3792
3793Some versions of Unix support shared libraries, which make executables smaller
3794but make load time slightly longer.
3795
3796On some systems, mostly newer Unix System V's, the shared library is included
3797by putting the option "-lc_s" as the last thing on the cc command line when
3798linking. Other systems use shared libraries by default. There may be other
3799libraries needed to compile $package on your machine as well. If your system
3800needs the "-lc_s" option, include it here. Include any other special libraries
3801here as well. Say "none" for none.
3802EOM
3803
3804echo " "
3805rp="Any additional libraries?"
3806. ./myread
3807case "$ans" in
3808none) libs=' ';;
3809*) libs="$ans";;
3810esac
3811
3812: see if nm is to be used to determine whether a symbol is defined or not
3813case "$usenm" in
3814'')
3815 dflt=`egrep 'inlibc|csym' ../Configure | wc -l 2>/dev/null`
3816 if $test $dflt -gt 20; then
3817 dflt=y
3818 else
3819 dflt=n
3820 fi
3821 ;;
3822*)
3823 case "$usenm" in
3824 true) dflt=y;;
3825 *) dflt=n;;
3826 esac
3827 ;;
3828esac
3829$cat <<EOM
3830
3831I can use 'nm' to extract the symbols from your C libraries. This is a time
3832consuming task which may generate huge output on the disk (up to 3 megabytes)
3833but that should make the symbols extraction faster. The alternative is to skip
3834the 'nm' extraction part and to compile a small test program instead to
3835determine whether each symbol is present. If you have a fast C compiler and/or
3836if your 'nm' output cannot be parsed, this may be the best solution.
3837
3838EOM
3839rp='Shall I use nm to extract C symbols from the libraries?'
3840. ./myread
3841case "$ans" in
3842n|N) usenm=false;;
3843*) usenm=true;;
3844esac
3845
3846runnm=$usenm
3847case "$reuseval" in
3848true) runnm=false;;
3849esac
3850
3851: nm options which may be necessary
3852case "$nm_opt" in
3853'') if $test -f /mach_boot; then
3854 nm_opt=''
3855 elif $test -d /usr/ccs/lib; then
3856 nm_opt='-p'
3857 elif $test -f /dgux; then
3858 nm_opt='-p'
3859 else
3860 nm_opt=''
3861 fi;;
3862esac
3863
3864case "$runnm" in
3865true)
3866: get list of predefined functions in a handy place
3867echo " "
3868case "$libc" in
3869'') libc=unknown
3870 case "$libs" in
3871 *-lc_s*) libc=`./loc libc_s.a $libc $libpth`
3872 esac
3873 ;;
3874esac
3875libnames='';
3876case "$libs" in
3877'') ;;
3878*) for thislib in $libs; do
3879 case "$thislib" in
3880 -lc|-lc_s)
3881 : Handle C library specially below.
3882 ;;
3883 -l*)
3884 thislib=`echo $thislib | $sed -e 's/^-l//'`
3885 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
3886 :
3887 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
3888 :
3889 elif try=`./loc lib$thislib.a X $libpth`; $test -f "$try"; then
3890 :
3891 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
3892 :
3893 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
3894 :
3895 elif try=`./loc Slib$thislib.a X $xlibpth`; $test -f "$try"; then
3896 :
3897 else
3898 try=''
3899 fi
3900 libnames="$libnames $try"
3901 ;;
3902 *) libnames="$libnames $thislib" ;;
3903 esac
3904 done
3905 ;;
3906esac
3907xxx=normal
3908case "$libc" in
3909unknown)
3910 set /usr/ccs/lib/libc.$so
3911 $test -r $1 || set /usr/lib/libc.$so
a0d0e21e 3912 $test -r $1 || set /usr/shlib/libc.$so
16d20bd9
AD
3913 $test -r $1 || \
3914 set `echo blurfl; echo /usr/lib/libc.$so.[0-9]* | \
3915 tr ' ' '\012' | egrep -v '\.[A-Za-z]*$' | $sed -e '
3916 h
3917 s/[0-9][0-9]*/0000&/g
3918 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
3919 G
3920 s/\n/ /' | \
3921 sort | $sed -e 's/^.* //'`
3922 eval set \$$#
a0d0e21e 3923 $test -r $1 || set /lib/libc.$so
2304df62 3924 $test -r $1 || set /lib/libsys_s.a
2304df62
AD
3925 ;;
3926*)
3927 set blurfl
3928 ;;
3929esac
3930if $test -r "$1"; then
3931 echo "Your (shared) C library seems to be in $1."
3932 libc="$1"
3933elif $test -r /lib/libc && $test -r /lib/clib; then
3934 echo "Your C library seems to be in both /lib/clib and /lib/libc."
3935 xxx=apollo
3936 libc='/lib/clib /lib/libc'
3937 if $test -r /lib/syslib; then
3938 echo "(Your math library is in /lib/syslib.)"
3939 libc="$libc /lib/syslib"
3940 fi
3941elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
3942 echo "Your C library seems to be in $libc, as you said before."
3943elif $test -r $incpath/usr/lib/libc.a; then
3944 libc=$incpath/usr/lib/libc.a;
3945 echo "Your C library seems to be in $libc. That's fine."
3946elif $test -r /lib/libc.a; then
3947 libc=/lib/libc.a;
3948 echo "Your C library seems to be in $libc. You're normal."
3949else
3950 if tans=`./loc libc.a blurfl/dyick $libpth`; $test -r "$tans"; then
3951 :
3952 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
3953 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
3954 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
3955 :
3956 elif tans=`./loc Slibc.a blurfl/dyick $xlibpth`; $test -r "$tans"; then
3957 :
3958 elif tans=`./loc Mlibc.a blurfl/dyick $xlibpth`; $test -r "$tans"; then
3959 :
3960 else
3961 tans=`./loc Llibc.a blurfl/dyick $xlibpth`
3962 fi
3963 if $test -r "$tans"; then
3964 echo "Your C library seems to be in $tans, of all places."
3965 libc=$tans
3966 else
3967 libc='blurfl'
3968 fi
3969fi
3970if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
3971 dflt="$libc"
3972 cat <<EOM
3973
3974If the guess above is wrong (which it might be if you're using a strange
3975compiler, or your machine supports multiple models), you can override it here.
3976
3977EOM
3978else
3979 dflt=''
3980 echo $libpth | tr ' ' '\012' | sort | uniq > libpath
3981 cat >&4 <<EOM
3982I can't seem to find your C library. I've looked in the following places:
3983
3984EOM
3985 $sed 's/^/ /' libpath
3986 cat <<EOM
3987
3988None of these seems to contain your C library. I need to get its name...
3989
3990EOM
3991fi
3992fn=f
3993rp='Where is your C library?'
3994. ./getfile
3995libc="$ans"
3996
3997echo " "
3998echo $libc $libnames | tr ' ' '\012' | sort | uniq > libnames
3999set X `cat libnames`
4000shift
4001xxx=files
4002case $# in 1) xxx=file; esac
4003echo "Extracting names from the following $xxx for later perusal:" >&4
4004echo " "
4005$sed 's/^/ /' libnames >&4
4006echo " "
4007$echo $n "This may take a while...$c" >&4
ecfc5424 4008
2304df62
AD
4009nm $nm_opt $* 2>/dev/null >libc.tmp
4010$echo $n ".$c"
4011$grep fprintf libc.tmp > libc.ptf
4012xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4013xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
16d20bd9
AD
4014xxx='[ADTSIW]'
4015if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx //p'";\
2304df62
AD
4016 eval $xscan;\
4017 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4018 eval $xrun
4019elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4020 eval $xscan;\
4021 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4022 eval $xrun
4023elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4024 eval $xscan;\
4025 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4026 eval $xrun
4027elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4028 eval $xscan;\
4029 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4030 eval $xrun
4031elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4032 eval $xscan;\
4033 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4034 eval $xrun
4035elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4036 eval $xscan;\
4037 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4038 eval $xrun
4039elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4040 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
4041 eval $xscan;\
4042 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4043 eval $xrun
4044elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4045 eval $xscan;\
4046 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4047 eval $xrun
4048elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4049 eval $xscan;\
4050 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4051 eval $xrun
a0d0e21e
LW
4052elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
4053 eval $xscan;\
4054 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4055 eval $xrun
8e07c86e
AD
4056elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
4057 eval $xscan;\
4058 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4059 eval $xrun
2304df62
AD
4060else
4061 nm -p $* 2>/dev/null >libc.tmp
16d20bd9
AD
4062 $grep fprintf libc.tmp > libc.ptf
4063 if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
4064 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
4065 then
2304df62 4066 nm_opt='-p'
16d20bd9 4067 eval $xrun
2304df62
AD
4068 else
4069 echo " "
4070 echo "nm didn't seem to work right. Trying ar instead..." >&4
4071 com=''
4072 if ar t $libc > libc.tmp; then
4073 for thisname in $libnames; do
4074 ar t $thisname >>libc.tmp
4075 done
4076 $sed -e 's/\.o$//' < libc.tmp > libc.list
4077 echo "Ok." >&4
4078 else
4079 echo "ar didn't seem to work right." >&4
4080 echo "Maybe this is a Cray...trying bld instead..." >&4
16d20bd9
AD
4081 if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list
4082 then
2304df62
AD
4083 for thisname in $libnames; do
4084 bld t $libnames | \
4085 $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
4086 ar t $thisname >>libc.tmp
4087 done
4088 echo "Ok." >&4
4089 else
4090 echo "That didn't work either. Giving up." >&4
4091 exit 1
4092 fi
4093 fi
4094 fi
4095fi
4096nm_extract="$com"
4097if $test -f /lib/syscalls.exp; then
4098 echo " "
4099 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
4100 $sed -n 's/^\([^ ]*\)[ ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list
4101fi
4102;;
4103esac
4104$rm -f libnames libpath
4105
4106: is a C symbol defined?
4107csym='tlook=$1;
4108case "$3" in
4109-v) tf=libc.tmp; tc=""; tdc="";;
8e07c86e 4110-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
2304df62
AD
4111*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
4112esac;
4113tx=yes;
4114case "$reuseval-$4" in
4115true-) ;;
4116true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
4117esac;
4118case "$tx" in
4119yes)
4120 case "$runnm" in
4121 true)
4122 if $contains $tlook $tf >/dev/null 2>&1;
4123 then tval=true;
4124 else tval=false;
4125 fi;;
4126 *)
16d20bd9 4127 echo "main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
8e07c86e 4128 if $cc $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
2304df62
AD
4129 then tval=true;
4130 else tval=false;
4131 fi;
4132 $rm -f t t.c;;
4133 esac;;
4134*)
8e07c86e
AD
4135 case "$tval" in
4136 $define) tval=true;;
4137 *) tval=false;;
4138 esac;;
4139esac;
4140eval "$2=$tval"'
2304df62
AD
4141
4142: define an is-in-libc? function
4143inlibc='echo " "; td=$define; tu=$undef;
4144sym=$1; var=$2; eval "was=\$$2";
4145tx=yes;
4146case "$reuseval$was" in
4147true) ;;
4148true*) tx=no;;
4149esac;
4150case "$tx" in
4151yes)
4152 set $sym tres -f;
4153 eval $csym;
4154 case "$tres" in
4155 true)
4156 echo "$sym() found." >&4;
ecfc5424 4157 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
2304df62
AD
4158 *)
4159 echo "$sym() NOT found." >&4;
ecfc5424 4160 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
2304df62
AD
4161 esac;;
4162*)
4163 case "$was" in
4164 $define) echo "$sym() found." >&4;;
4165 *) echo "$sym() NOT found." >&4;;
4166 esac;;
4167esac'
4168
8e07c86e
AD
4169: Check how to convert floats to strings.
4170echo " "
4171echo "Checking for an efficient way to convert floats to strings."
4172$cat >try.c <<'EOP'
4173#ifdef TRY_gconvert
4174#define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
4175#endif
4176#ifdef TRY_gcvt
4177#define Gconvert(x,n,t,b) gcvt((x),(n),(b))
4178#endif
4179#ifdef TRY_sprintf
4180#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
4181#endif
a0d0e21e 4182main() {
ecfc5424 4183 char buf[64];
8e07c86e 4184 Gconvert(1.0, 8, 0, buf);
ecfc5424
AD
4185 if (buf[0] != '1' || buf[1] != '\0')
4186 exit(1);
8e07c86e 4187 Gconvert(0.0, 8, 0, buf);
ecfc5424
AD
4188 if (buf[0] != '0' || buf[1] != '\0')
4189 exit(1);
8e07c86e 4190 Gconvert(-1.0, 8, 0, buf);
ecfc5424