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