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