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