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