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