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