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