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