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