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