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