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