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