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