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