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