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