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