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