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