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