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