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