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