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