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