This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade to MakeMaker 6.13.
[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#
15431986 23# Generated on Tue Jul 1 10:09:27 EEST 2003 [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=''
3ea77556
JH
1075installsitehtml1=''
1076sitehtml1=''
6e1038e0 1077sitehtml1exp=''
3ea77556
JH
1078installsitehtml3=''
1079sitehtml3=''
6e1038e0 1080sitehtml3exp=''
b4eb6b3d
JH
1081installsitelib=''
1082sitelib=''
1083sitelib_stem=''
1084sitelibexp=''
3ea77556
JH
1085installsiteman1=''
1086siteman1=''
6e1038e0 1087siteman1exp=''
3ea77556
JH
1088installsiteman3=''
1089siteman3=''
6e1038e0 1090siteman3exp=''
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=''
3ea77556
JH
1149installvendorhtml1=''
1150vendorhtml1=''
6e1038e0 1151vendorhtml1exp=''
3ea77556
JH
1152installvendorhtml3=''
1153vendorhtml3=''
6e1038e0 1154vendorhtml3exp=''
b4eb6b3d
JH
1155d_vendorlib=''
1156installvendorlib=''
1157vendorlib=''
1158vendorlib_stem=''
1159vendorlibexp=''
3ea77556
JH
1160installvendorman1=''
1161vendorman1=''
6e1038e0 1162vendorman1exp=''
3ea77556
JH
1163installvendorman3=''
1164vendorman3=''
6e1038e0 1165vendorman3exp=''
b4eb6b3d
JH
1166usevendorprefix=''
1167vendorprefix=''
1168vendorprefixexp=''
6e1038e0
MB
1169d_vendorscript=''
1170installvendorscript=''
1171vendorscript=''
1172vendorscriptexp=''
d56c5707 1173versiononly=''
b4eb6b3d
JH
1174defvoidused=''
1175voidflags=''
1176pm_apiversion=''
1177xs_apiversion=''
3659ebf1
JH
1178yacc=''
1179yaccflags=''
2304df62
AD
1180CONFIG=''
1181
ecfc5424
AD
1182define='define'
1183undef='undef'
1184smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1185rmlist=''
1186
1187: We must find out about Eunice early
1188eunicefix=':'
1189if test -f /etc/unixtovms; then
1190 eunicefix=/etc/unixtovms
1191fi
1192if test -f /etc/unixtovms.exe; then
1193 eunicefix=/etc/unixtovms.exe
1194fi
1195
cfb04860 1196: Set executable suffix now -- needed before hints available
6153ba32
PG
1197if test -f "/libs/version.library"; then
1198: Amiga OS
1199 _exe=""
1200elif test -f "/system/gnu_library/bin/ar.pm"; then
1201: Stratus VOS
cfb04860 1202 _exe=".pm"
6153ba32
PG
1203elif test -n "$DJGPP"; then
1204: DOS DJGPP
cfb04860 1205 _exe=".exe"
5c728af0 1206elif test -d c:/. -o -n "$is_os2" ; then
506faf56 1207: OS/2 or cygwin
ba863942
JH
1208 _exe=".exe"
1209fi
868439a2 1210
b4eb6b3d 1211i_whoami=''
ff935051
JH
1212: Possible local include directories to search.
1213: Set locincpth to "" in a hint file to defeat local include searches.
1214locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1215locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1216:
1217: no include file wanted by default
1218inclwanted=''
1219
3ea77556
JH
1220siteman1=''
1221siteman3=''
76f47787
JH
1222sitescript=''
1223: Trailing extension. Override this in a hint file, if needed.
1224: Extra object files, if any, needed on this platform.
1225archobjs=''
b4eb6b3d 1226groupstype=''
64615a5e 1227libnames=''
732c9516
JH
1228: change the next line if compiling for Xenix/286 on Xenix/386
1229xlibpth='/usr/lib/386 /lib/386'
732c9516
JH
1230: Possible local library directories to search.
1231loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1232loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1233
1234: general looking path for locating libraries
5869b1f1 1235glibpth="/lib /usr/lib $xlibpth"
732c9516 1236glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
f7dd4e7f
JH
1237test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1238test -f /shlib/libc.so && glibpth="/shlib $glibpth"
732c9516
JH
1239
1240: Private path used by Configure to find libraries. Its value
1241: is prepended to libpth. This variable takes care of special
1242: machines, like the mips. Usually, it should be empty.
1243plibpth=''
1244
1cfa4ec7
GS
1245: default library list
1246libswanted=''
921b2963 1247: some systems want to use only the non-versioned libso:s
1cfa4ec7 1248ignore_versioned_solibs=''
76f47787
JH
1249: full support for void wanted by default
1250defvoidused=15
1251
1252ccname=''
1253ccversion=''
1254perllibs=''
1255: set useposix=false in your hint file to disable the POSIX extension.
1256useposix=true
1257: set useopcode=false in your hint file to disable the Opcode extension.
1258useopcode=true
b4eb6b3d
JH
1259archname64=''
1260ccflags_uselargefiles=''
1261ldflags_uselargefiles=''
1262libswanted_uselargefiles=''
1263: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1264: set usesocks on the Configure command line to enable socks.
76f47787 1265archname=''
b4eb6b3d 1266: set usethreads on the Configure command line to enable threads.
cd040c5e 1267usereentrant='undef'
ecfc5424 1268: List of libraries we want.
15431986 1269: If anyone needs extra -lxxx, put those in a hint file.
6bdd71ef
AB
1270libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1271libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1aef975c 1272: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1273: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1274glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1275glibpth="/usr/shlib $glibpth"
1276: Do not use vfork unless overridden by a hint file.
1277usevfork=false
1278
8ff267be 1279: Find the basic shell for Bourne shell scripts
1280case "$sh" in
1281'')
8ff267be 1282 case "$SYSTYPE" in
1283 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1284 *) xxx='/bin/sh';;
1285 esac
1286 if test -f "$xxx"; then
1287 sh="$xxx"
1288 else
1289 : Build up a list and do a single loop so we can 'break' out.
1290 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1291 for xxx in sh bash ksh pdksh ash; do
1292 for p in $pth; do
1293 try="$try ${p}/${xxx}"
1294 done
1295 done
1296 for xxx in $try; do
1297 if test -f "$xxx"; then
1298 sh="$xxx";
8ff267be 1299 break
a5a94ea5
JH
1300 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1301 sh="$xxx";
1302 break
8ff267be 1303 elif test -f "$xxx.exe"; then
1304 sh="$xxx";
8ff267be 1305 break
1306 fi
1307 done
1308 fi
1309 ;;
1310esac
1311
1312case "$sh" in
a33c94aa 1313'') cat >&2 <<EOM
8ff267be 1314$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1315
8ff267be 1316Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1317Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1318we'll try to straighten this all out.
8ff267be 1319EOM
1320 exit 1
1321 ;;
1322esac
1323
760ac839 1324: see if sh knows # comments
73614538 1325if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1326 shsharp=true
1327 spitshell=cat
760ac839 1328 xcat=/bin/cat
a931254c
JH
1329 test -f $xcat$_exe || xcat=/usr/bin/cat
1330 if test ! -f $xcat$_exe; then
4bdb8fb5 1331 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
a931254c 1332 if test -f $p/cat$_exe; then
1deb0a86 1333 xcat=$p/cat
3c728e00
JH
1334 break
1335 fi
1336 done
1deb0a86
JH
1337 if test ! -f $xcat$_exe; then
1338 echo "Can't find cat anywhere!"
3c728e00
JH
1339 exit 1
1340 fi
1341 fi
5440bc8e
JH
1342 echo "#!$xcat" >sharp
1343 $eunicefix sharp
1344 chmod +x sharp
1345 ./sharp > today
760ac839 1346 if test -s today; then
760ac839
LW
1347 sharpbang='#!'
1348 else
5440bc8e
JH
1349 echo "#! $xcat" > sharp
1350 $eunicefix sharp
1351 chmod +x sharp
1352 ./sharp > today
760ac839 1353 if test -s today; then
760ac839
LW
1354 sharpbang='#! '
1355 else
760ac839
LW
1356 sharpbang=': use '
1357 fi
1358 fi
1359else
dfe9444c 1360 echo " "
8ff267be 1361 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1362 shsharp=false
1363 cd ..
1364 echo "exec grep -v '^[ ]*#'" >spitshell
1365 chmod +x spitshell
1366 $eunicefix spitshell
1367 spitshell=`pwd`/spitshell
1368 cd UU
1369 echo "I presume that if # doesn't work, #! won't work either!"
1370 sharpbang=': use '
1371fi
5440bc8e 1372rm -f sharp today
760ac839
LW
1373
1374: figure out how to guarantee sh startup
8ff267be 1375case "$startsh" in
1376'') startsh=${sharpbang}${sh} ;;
1377*)
760ac839 1378esac
5440bc8e 1379cat >sharp <<EOSS
760ac839
LW
1380$startsh
1381set abc
1382test "$?abc" != 1
1383EOSS
1384
5440bc8e
JH
1385chmod +x sharp
1386$eunicefix sharp
1387if ./sharp; then
8ff267be 1388 : echo "Yup, it does."
760ac839 1389else
dfe9444c
AD
1390 echo "Hmm... '$startsh' does not guarantee sh startup..."
1391 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1392fi
5440bc8e 1393rm -f sharp
760ac839 1394
aebf16e7
AD
1395
1396: Save command line options in file UU/cmdline.opt for later use in
1397: generating config.sh.
1398cat > cmdline.opt <<EOSH
1399# Configure command line arguments.
1400config_arg0='$0'
1401config_args='$*'
1402config_argc=$#
1403EOSH
1404argn=1
ee45ea83
IZ
1405args_exp=''
1406args_sep=''
aebf16e7
AD
1407for arg in "$@"; do
1408 cat >>cmdline.opt <<EOSH
1409config_arg$argn='$arg'
1410EOSH
ee45ea83
IZ
1411 # Extreme backslashitis: replace each ' by '"'"'
1412 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1413$arg
1414EOC
1415 arg_exp=`cat cmdl.opt`
1416 args_exp="$args_exp$args_sep'$arg_exp'"
aebf16e7 1417 argn=`expr $argn + 1`
ee45ea83 1418 args_sep=' '
aebf16e7 1419done
ee45ea83
IZ
1420# args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1421# used by ./hints/os2.sh
1422rm -f cmdl.opt
aebf16e7 1423
2304df62
AD
1424: produce awk script to parse command line options
1425cat >options.awk <<'EOF'
1426BEGIN {
02e93a22 1427 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1428
1429 len = length(optstr);
1430 for (i = 1; i <= len; i++) {
1431 c = substr(optstr, i, 1);
1432 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1433 if (a == ":") {
1434 arg[c] = 1;
1435 i++;
1436 }
1437 opt[c] = 1;
1438 }
1439}
1440{
1441 expect = 0;
1442 str = $0;
1443 if (substr(str, 1, 1) != "-") {
1444 printf("'%s'\n", str);
1445 next;
1446 }
1447 len = length($0);
1448 for (i = 2; i <= len; i++) {
1449 c = substr(str, i, 1);
1450 if (!opt[c]) {
1451 printf("-%s\n", substr(str, i));
1452 next;
1453 }
1454 printf("-%s\n", c);
1455 if (arg[c]) {
1456 if (i < len)
1457 printf("'%s'\n", substr(str, i + 1));
1458 else
1459 expect = 1;
1460 next;
1461 }
1462 }
1463}
1464END {
1465 if (expect)
1466 print "?";
1467}
1468EOF
1469
1470: process the command line options
4633a7c4
LW
1471set X `for arg in "$@"; do echo "X$arg"; done |
1472 sed -e s/X// | awk -f options.awk`
2304df62
AD
1473eval "set $*"
1474shift
1475rm -f options.awk
1476
1477: set up default values
1478fastread=''
1479reuseval=false
1480config_sh=''
1481alldone=''
1482error=''
1483silent=''
1484extractsh=''
ecfc5424 1485override=''
16d20bd9 1486knowitall=''
02e93a22 1487rm -f optdef.sh posthint.sh
28757baa 1488cat >optdef.sh <<EOS
1489$startsh
1490EOS
2304df62 1491
dfe9444c 1492
2304df62
AD
1493: option parsing
1494while test $# -gt 0; do
1495 case "$1" in
1496 -d) shift; fastread=yes;;
1497 -e) shift; alldone=cont;;
1498 -f)
1499 shift
1500 cd ..
1501 if test -r "$1"; then
1502 config_sh="$1"
1503 else
a0d0e21e 1504 echo "$me: cannot read config file $1." >&2
2304df62
AD
1505 error=true
1506 fi
1507 cd UU
1508 shift;;
1509 -h) shift; error=true;;
1510 -r) shift; reuseval=true;;
dfe9444c 1511 -s) shift; silent=true; realsilent=true;;
2304df62 1512 -E) shift; alldone=exit;;
16d20bd9 1513 -K) shift; knowitall=true;;
ecfc5424 1514 -O) shift; override=true;;
dfe9444c 1515 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1516 -D)
1517 shift
1518 case "$1" in
1519 *=)
1520 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1521 echo "$me: ignoring -D $1" >&2
1522 ;;
ecfc5424 1523 *=*) echo "$1" | \
1aef975c
AD
1524 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1525 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1526 esac
1527 shift
1528 ;;
1529 -U)
1530 shift
1531 case "$1" in
1aef975c 1532 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1533 *=*)
1534 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1535 echo "$me: ignoring -U $1" >&2
1536 ;;
1aef975c 1537 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1538 esac
1539 shift
1540 ;;
02e93a22
JH
1541 -A)
1542 shift
1543 xxx=''
1544 yyy="$1"
02e93a22 1545 zzz=''
5f83a3e9 1546 uuu=undef
02e93a22 1547 case "$yyy" in
f7c31117 1548 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
5f83a3e9
JH
1549 case "$zzz" in
1550 *:*) zzz='' ;;
1551 *) xxx=append
f7c31117
JH
1552 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1553 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
5f83a3e9
JH
1554 esac
1555 ;;
1556 esac
1557 case "$xxx" in
1558 '') case "$yyy" in
f7c31117
JH
1559 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1560 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1561 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1562 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1563 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
1564 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
5f83a3e9
JH
1565 esac
1566 ;;
1567 esac
02e93a22
JH
1568 case "$xxx" in
1569 append)
5f83a3e9 1570 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1571 clear)
5f83a3e9 1572 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1573 define)
1574 case "$zzz" in
1575 '') zzz=define ;;
1576 esac
5f83a3e9 1577 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1578 eval)
5f83a3e9 1579 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1580 prepend)
5f83a3e9 1581 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1582 undef)
1583 case "$zzz" in
1584 '') zzz="$uuu" ;;
1585 esac
5f83a3e9
JH
1586 echo "$yyy=$zzz" >> posthint.sh ;;
1587 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1588 esac
bde6b06b 1589 shift
02e93a22 1590 ;;
dfe9444c 1591 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1592 exit 0;;
2304df62 1593 --) break;;
a0d0e21e 1594 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1595 *) break;;
1596 esac
1597done
1598
1599case "$error" in
1600true)
1601 cat >&2 <<EOM
2afac517 1602Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1603 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1604 -d : use defaults for all answers.
1605 -e : go on without questioning past the production of config.sh.
1606 -f : specify an alternate default configuration file.
1607 -h : print this help message and exit (with an error status).
1608 -r : reuse C symbols value if possible (skips costly nm extraction).
1609 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1610 -D : define symbol to have some value:
1611 -D symbol symbol gets the value 'define'
1612 -D symbol=value symbol gets the value 'value'
2304df62 1613 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1614 -K : do not use unless you know what you are doing.
ecfc5424 1615 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1616 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1617 -U : undefine symbol:
1618 -U symbol symbol gets the value 'undef'
1619 -U symbol= symbol gets completely empty
02e93a22 1620 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1621 -A symbol=value append " "value to symbol
02e93a22
JH
1622 -A append:symbol=value append value to symbol
1623 -A define:symbol=value define symbol to have value
02e93a22
JH
1624 -A clear:symbol define symbol to be ''
1625 -A define:symbol define symbol to be 'define'
1626 -A eval:symbol=value define symbol to be eval of value
1627 -A prepend:symbol=value prepend value to symbol
1628 -A undef:symbol define symbol to be 'undef'
1629 -A undef:symbol= define symbol to be ''
2304df62
AD
1630 -V : print version number and exit (with a zero status).
1631EOM
1632 exit 1
1633 ;;
1634esac
1635
dfe9444c
AD
1636: Sanity checks
1637case "$fastread$alldone" in
1638yescont|yesexit) ;;
1639*)
aaeb8e51
GS
1640 case "$extractsh" in
1641 true) ;;
1642 *)
1643 if test ! -t 0; then
1644 echo "Say 'sh Configure', not 'sh <Configure'"
1645 exit 1
1646 fi
1647 ;;
1648 esac
dfe9444c
AD
1649 ;;
1650esac
1651
2304df62
AD
1652exec 4>&1
1653case "$silent" in
1654true) exec 1>/dev/null;;
1655esac
1656
ecfc5424 1657: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1658touch optdef.sh
1659. ./optdef.sh
02e93a22
JH
1660: create the posthint manipulation script and leave the file out there...
1661touch posthint.sh
a0d0e21e 1662
2304df62 1663: set package name
85e6fe83 1664package=perl5
b4eb6b3d
JH
1665first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1666last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1667case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1668ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1669*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1670esac
2304df62 1671
2304df62
AD
1672: Some greps do not return status, grrr.
1673echo "grimblepritz" >grimble
1674if grep blurfldyick grimble >/dev/null 2>&1 ; then
1675 contains=contains
1676elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1677 contains=grep
1678else
1679 contains=contains
1680fi
1681rm -f grimble
1682: the following should work in any shell
1683case "$contains" in
1684contains*)
1685 echo " "
1686 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1687 cat >contains <<'EOSS'
1688grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1689EOSS
1690chmod +x contains
1691esac
1692
dfe9444c
AD
1693: Find the path to the source tree
1694case "$src" in
1695'') case "$0" in
b233458b
JH
1696 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1697 case "$src" in
1698 /*) ;;
8504afb7 1699 .) ;;
b233458b
JH
1700 *) src=`cd ../$src && pwd` ;;
1701 esac
1702 ;;
dfe9444c
AD
1703 *) src='.';;
1704 esac;;
1705esac
1706case "$src" in
1707'') src=/
1708 rsrc=/
1709 ;;
1710/*) rsrc="$src";;
1711*) rsrc="../$src";;
1712esac
1713if test -f $rsrc/Configure && \
1714 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1715then
1716 : found it, so we are ok.
1717else
1718 rsrc=''
1719 for src in . .. ../.. ../../.. ../../../..; do
1720 if test -f ../$src/Configure && \
1721 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1722 then
1723 rsrc=../$src
1724 break
1725 fi
1726 done
1727fi
1728case "$rsrc" in
1729'')
1730 cat <<EOM >&4
1731
1732Sorry, I can't seem to locate the source dir for $package. Please start
1733Configure with an explicit path -- i.e. /some/path/Configure.
1734
1735EOM
1736 exit 1
1737 ;;
1738../.) rsrc='..';;
1739*)
1740 echo " "
1741 echo "Sources for $package found in \"$src\"." >&4
1742 ;;
1743esac
1744
1745: script used to extract .SH files with variable substitutions
1746cat >extract <<'EOS'
a02608de 1747PERL_CONFIG_SH=true
dfe9444c 1748echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1749if test -f MANIFEST; then
1750 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1751else
1752 echo "(Looking for .SH files under the source directory.)"
6904989c 1753 set x `(cd "$src"; find . -name "*.SH" -print)`
dfe9444c
AD
1754fi
1755shift
1756case $# in
6904989c 17570) set x `(cd "$src"; echo *.SH)`; shift;;
dfe9444c 1758esac
6904989c 1759if test ! -f "$src/$1"; then
dfe9444c
AD
1760 shift
1761fi
1762mkdir_p='
1763name=$1;
1764create="";
1765while test $name; do
1766 if test ! -d "$name"; then
1767 create="$name $create";
1768 name=`echo $name | sed -e "s|^[^/]*$||"`;
1769 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1770 else
1771 name="";
1772 fi;
1773done;
1774for file in $create; do
1775 mkdir $file;
1776done
1777'
1778for file in $*; do
1779 case "$src" in
1780 ".")
1781 case "$file" in
1782 */*)
1783 dir=`expr X$file : 'X\(.*\)/'`
1784 file=`expr X$file : 'X.*/\(.*\)'`
6904989c 1785 (cd "$dir" && . ./$file)
dfe9444c
AD
1786 ;;
1787 *)
1788 . ./$file
1789 ;;
1790 esac
1791 ;;
1792 *)
1793 case "$file" in
1794 */*)
1795 dir=`expr X$file : 'X\(.*\)/'`
1796 file=`expr X$file : 'X.*/\(.*\)'`
1797 (set x $dir; shift; eval $mkdir_p)
6904989c 1798 sh <"$src/$dir/$file"
dfe9444c
AD
1799 ;;
1800 *)
6904989c 1801 sh <"$src/$file"
dfe9444c
AD
1802 ;;
1803 esac
1804 ;;
1805 esac
1806done
6904989c 1807if test -f "$src/config_h.SH"; then
dfe9444c
AD
1808 if test ! -f config.h; then
1809 : oops, they left it out of MANIFEST, probably, so do it anyway.
6904989c 1810 . "$src/config_h.SH"
dfe9444c
AD
1811 fi
1812fi
1813EOS
1814
1815: extract files and exit if asked to do so
1816case "$extractsh" in
1817true)
1818 case "$realsilent" in
1819 true) ;;
1820 *) exec 1>&4;;
1821 esac
1822 case "$config_sh" in
1823 '') config_sh='config.sh';;
1824 esac
1825 echo " "
1826 echo "Fetching answers from $config_sh..."
1827 cd ..
1828 . $config_sh
1829 test "$override" && . ./optdef.sh
1830 echo " "
1831 . UU/extract
1832 rm -rf UU
24ccb310 1833 echo "Extraction done."
dfe9444c
AD
1834 exit 0
1835 ;;
1836esac
1837
1838: Eunice requires " " instead of "", can you believe it
1839echo " "
1840: Here we go...
1841echo "Beginning of configuration questions for $package."
1842
1843trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1844
2304df62
AD
1845: first determine how to suppress newline on echo command
1846echo " "
1847echo "Checking echo to see how to suppress newlines..."
1848(echo "hi there\c" ; echo " ") >.echotmp
1849if $contains c .echotmp >/dev/null 2>&1 ; then
1850 echo "...using -n."
1851 n='-n'
1852 c=''
1853else
1854 cat <<'EOM'
1855...using \c
1856EOM
1857 n=''
1858 c='\c'
1859fi
1860echo $n "The star should be here-->$c"
1861echo '*'
1862rm -f .echotmp
1863
1864: Now test for existence of everything in MANIFEST
1865echo " "
6904989c 1866if test -f "$rsrc/MANIFEST"; then
2304df62 1867 echo "First let's make sure your kit is complete. Checking..." >&4
4242830c 1868 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
2304df62 1869 rm -f missing
dfe9444c 1870 tmppwd=`pwd`
2304df62 1871 for filelist in x??; do
6904989c 1872 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
2304df62
AD
1873 done
1874 if test -s missing; then
1875 cat missing >&4
1876 cat >&4 <<'EOM'
1877
1878THIS PACKAGE SEEMS TO BE INCOMPLETE.
1879
1880You have the option of continuing the configuration process, despite the
1881distinct possibility that your kit is damaged, by typing 'y'es. If you
1882do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1883and contact the author (perlbug@perl.org).
2304df62
AD
1884
1885EOM
1886 echo $n "Continue? [n] $c" >&4
1887 read ans
1888 case "$ans" in
1889 y*)
1890 echo "Continuing..." >&4
1891 rm -f missing
1892 ;;
1893 *)
1894 echo "ABORTING..." >&4
1895 kill $$
1896 ;;
1897 esac
1898 else
dfe9444c 1899 echo "Looks good..."
2304df62
AD
1900 fi
1901else
1902 echo "There is no MANIFEST file. I hope your kit is complete !"
1903fi
1904rm -f missing x??
1905
5ff3f7a4
GS
1906echo " "
1907: Find the appropriate value for a newline for tr
1908if test -n "$DJGPP"; then
1909 trnl='\012'
1910fi
1911if test X"$trnl" = X; then
1912 case "`echo foo|tr '\n' x 2>/dev/null`" in
1913 foox) trnl='\n' ;;
1914 esac
1915fi
1916if test X"$trnl" = X; then
1917 case "`echo foo|tr '\012' x 2>/dev/null`" in
1918 foox) trnl='\012' ;;
1919 esac
1920fi
1921if test X"$trnl" = X; then
8be2c24c
JH
1922 case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1923 fooxy) trnl='\n\r' ;;
1924 esac
1925fi
1926if test X"$trnl" = X; then
5ff3f7a4
GS
1927 cat <<EOM >&2
1928
1929$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1930
1931EOM
1932 exit 1
1933fi
1934
2304df62
AD
1935: compute the number of columns on the terminal for proper question formatting
1936case "$COLUMNS" in
1937'') COLUMNS='80';;
1938esac
1939
1940: set up the echo used in my read
1941myecho="case \"\$xxxm\" in
1942'') echo $n \"\$rp $c\" >&4;;
1943*) case \"\$rp\" in
1944 '') echo $n \"[\$xxxm] $c\";;
1945 *)
1946 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1947 echo \"\$rp\" >&4
1948 echo $n \"[\$xxxm] $c\" >&4
1949 else
1950 echo $n \"\$rp [\$xxxm] $c\" >&4
1951 fi
1952 ;;
1953 esac;;
1954esac"
1955
1956: now set up to do reads with possible shell escape and default assignment
1957cat <<EOSC >myread
28757baa 1958$startsh
2304df62
AD
1959xxxm=\$dflt
1960$myecho
1961ans='!'
1962case "\$fastread" in
1963yes) case "\$dflt" in
1964 '') ;;
1965 *) ans='';
1966 case "\$silent-\$rp" in
1967 true-) ;;
1968 *) echo " " >&4;;
1969 esac;;
1970 esac;;
1971*) case "\$silent" in
1972 true) case "\$rp" in
1973 '') ans='';;
1974 esac;;
1975 esac;;
1976esac
1977while expr "X\$ans" : "X!" >/dev/null; do
1978 read answ
1979 set x \$xxxm
1980 shift
dfe9444c 1981 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 1982 case "\$answ" in
dfe9444c
AD
1983 "!")
1984 sh 1>&4
1985 echo " "
1986 $myecho
1987 ;;
1988 !*)
1989 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1990 shift
1991 sh 1>&4 -c "\$*"
1992 echo " "
1993 $myecho
1994 ;;
2304df62
AD
1995 "\$ans")
1996 case "\$ans" in
ecfc5424
AD
1997 \\&*)
1998 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1999 shift
2000 case "\$1" in
2001 -d)
2002 fastread=yes
40a7a20a 2003 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
2004 ;;
2005 -*)
40a7a20a 2006 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
2007 ;;
2008 esac
2009 $myecho
2010 ans=!
2011 ;;
2304df62
AD
2012 esac;;
2013 *)
2014 case "\$aok" in
2015 y)
2016 echo "*** Substitution done -- please confirm."
2017 xxxm="\$ans"
c9795ab7 2018 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
2019 xxxm="\$ans"
2020 ans=!
2021 ;;
2022 *)
2023 echo "*** Error -- try again."
2024 ans=!
2025 ;;
2026 esac
2027 $myecho
2028 ;;
2029 esac
2030 case "\$ans\$xxxm\$nostick" in
2031 '')
2032 ans=!
2033 $myecho
2034 ;;
2035 esac
2036done
2037case "\$ans" in
2038'') ans="\$xxxm";;
2039esac
2040EOSC
2041
2042: create .config dir to save info across Configure sessions
2043test -d ../.config || mkdir ../.config
2044cat >../.config/README <<EOF
2045This directory created by Configure to save information that should
dfe9444c 2046persist across sessions for $package.
2304df62
AD
2047
2048You may safely delete it if you wish.
2049EOF
2050
9507cadf 2051xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 2052case "$usedevel" in
0107c034 2053$define|true|[yY]*) ;;
9507cadf 2054*) case "$xversion" in
0107c034
JH
2055 *[13579])
2056 cat >&4 <<EOH
2057*** WHOA THERE!!! ***
2058
2059 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
2060 The version of this $package distribution is $xversion, that is, odd,
2061 (as opposed to even) and that signifies a development release.
3d5d58b1 2062 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
2063
2064 Do ***NOT*** install this into production use.
2065 Data corruption and crashes are possible.
2066
2067 It is most seriously suggested that you do not continue any further
2068 unless you want to help in developing and debugging Perl.
2069
6adc6a45
JH
2070 If you *still* want to build perl, you can answer 'y' now,
2071 or pass -Dusedevel to Configure.
2072
0107c034
JH
2073EOH
2074 rp='Do you really want to continue?'
2075 dflt='n'
2076 . ./myread
2077 case "$ans" in
8feeef0e
JH
2078 [yY]) echo >&4 "Okay, continuing."
2079 usedevel="$define" ;;
0107c034
JH
2080 *) echo >&4 "Okay, bye."
2081 exit 1
2082 ;;
2083 esac
2084 ;;
2085 esac
2086 ;;
2087esac
8feeef0e
JH
2088case "$usedevel" in
2089$define|true|[yY]*)
2090 case "$versiononly" in
2091 '') versiononly="$define" ;;
2092 esac
2093 case "$installusrbinperl" in
2094 '') installusrbinperl="$undef" ;;
2095 esac
2096 ;;
2097esac
0107c034 2098
2304df62
AD
2099: general instructions
2100needman=true
2101firsttime=true
760ac839 2102user=`(logname) 2>/dev/null`
dfe9444c
AD
2103case "$user" in
2104'') user=`whoami 2>&1`;;
760ac839 2105esac
2304df62
AD
2106if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2107 firsttime=false
2108 echo " "
2109 rp='Would you like to see the instructions?'
2110 dflt=n
2111 . ./myread
2112 case "$ans" in
2113 [yY]*) ;;
2114 *) needman=false;;
2115 esac
2116fi
2117if $needman; then
2118 cat <<EOH
4e2a5f63 2119
2304df62 2120This installation shell script will examine your system and ask you questions
a0d0e21e 2121to determine how the perl5 package should be installed. If you get
2304df62
AD
2122stuck on a question, you may use a ! shell escape to start a subshell or
2123execute a command. Many of the questions will have default answers in square
2124brackets; typing carriage return will give you the default.
2125
2126On some of the questions which ask for file or directory names you are allowed
2127to use the ~name construct to specify the login directory belonging to "name",
2128even if you don't have a shell which knows about that. Questions where this is
2129allowed will be marked "(~name ok)".
2130
2131EOH
2132 rp=''
2133 dflt='Type carriage return to continue'
2134 . ./myread
2135 cat <<'EOH'
2136
2137The prompter used in this script allows you to use shell variables and
2138backticks in your answers. You may use $1, $2, etc... to refer to the words
2139in the default answer, as if the default line was a set of arguments given to a
2140script shell. This means you may also use $* to repeat the whole default line,
2141so you do not have to re-type everything to add something to the default.
2142
2143Everytime there is a substitution, you will have to confirm. If there is an
2144error (e.g. an unmatched backtick), the default answer will remain unchanged
2145and you will be prompted again.
2146
2147If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2148the questions and use the computed defaults (or the previous answers if there
2149was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 2150You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 2151on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
2152
2153EOH
2154 . ./myread
2155 cat <<EOH
2156
2157Much effort has been expended to ensure that this shell script will run on any
2158Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
2159Configure and run it again. If you can't run Configure for some reason,
2160you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 2161have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
2162
2163This installation script affects things in two ways:
2164
21651) it may do direct variable substitutions on some of the files included
2166 in this kit.
21672) it builds a config.h file for inclusion in C programs. You may edit
2168 any of these files as the need arises after running this script.
2169
2170If you make a mistake on a question, there is no easy way to back up to it
2171currently. The easiest thing to do is to edit config.sh and rerun all the SH
2172files. Configure will offer to let you do this before it runs the SH files.
2173
2174EOH
2175 dflt='Type carriage return to continue'
2176 . ./myread
2177 case "$firsttime" in
2178 true) echo $user >>../.config/instruct;;
2179 esac
2180fi
2181
2304df62
AD
2182: find out where common programs are
2183echo " "
2184echo "Locating common programs..." >&4
2185cat <<EOSC >loc
2186$startsh
2187case \$# in
21880) exit 1;;
2189esac
2190thing=\$1
2191shift
2192dflt=\$1
2193shift
2194for dir in \$*; do
2195 case "\$thing" in
2196 .)
2197 if test -d \$dir/\$thing; then
2198 echo \$dir
2199 exit 0
2200 fi
2201 ;;
2202 *)
a0d0e21e 2203 for thisthing in \$dir/\$thing; do
ecfc5424 2204 : just loop through to pick last item
a0d0e21e 2205 done
25f94b33 2206 if test -f \$thisthing; then
a0d0e21e 2207 echo \$thisthing
2304df62 2208 exit 0
a5a94ea5
JH
2209 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2210 echo \$thisthing
2211 exit 0
2304df62 2212 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2213 if test -n "$DJGPP"; then
2214 echo \$dir/\$thing.exe
b921d661 2215 elif test "$eunicefix" != ":"; then
c4f23d77
AD
2216 : on Eunice apparently
2217 echo \$dir/\$thing
b921d661 2218 exit 0
c4f23d77 2219 fi
2d736872 2220 exit 0
2304df62
AD
2221 fi
2222 ;;
2223 esac
2224done
2225echo \$dflt
2226exit 1
2227EOSC
2228chmod +x loc
2229$eunicefix loc
2230loclist="
2231awk
2232cat
f8006fac 2233chmod
b4eb6b3d
JH
2234comm
2235cp
2304df62
AD
2236echo
2237expr
2238grep
a0d0e21e 2239ls
b4eb6b3d 2240mkdir
2304df62
AD
2241rm
2242sed
b4eb6b3d 2243sort
85e6fe83 2244touch
2304df62 2245tr
b4eb6b3d 2246uniq
2304df62
AD
2247"
2248trylist="
2249Mcc
dfe9444c 2250ar
3659ebf1 2251bison
b4eb6b3d 2252byacc
2304df62 2253cpp
b4eb6b3d 2254csh
2304df62
AD
2255date
2256egrep
1fef16b3 2257gmake
8ff267be 2258gzip
b4eb6b3d 2259less
8ff267be 2260ln
3c728e00 2261make
b4eb6b3d 2262more
693762b4 2263nm
b4eb6b3d
JH
2264nroff
2265pg
2304df62
AD
2266test
2267uname
8ff267be 2268zip
2304df62 2269"
8e07c86e 2270pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2271pth="$pth /lib /usr/lib"
2272for file in $loclist; do
dfe9444c
AD
2273 eval xxx=\$$file
2274 case "$xxx" in
2275 /*|?:[\\/]*)
2276 if test -f "$xxx"; then
2277 : ok
2278 else
2279 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2280 xxx=`./loc $file $file $pth`
2281 fi
2282 ;;
2283 '') xxx=`./loc $file $file $pth`;;
2284 *) xxx=`./loc $xxx $xxx $pth`;;
2285 esac
a5a94ea5 2286 eval $file=$xxx$_exe
2304df62
AD
2287 eval _$file=$xxx
2288 case "$xxx" in
2289 /*)
2290 echo $file is in $xxx.
2291 ;;
8e07c86e
AD
2292 ?:[\\/]*)
2293 echo $file is in $xxx.
2294 ;;
2304df62 2295 *)
25f94b33
AD
2296 echo "I don't know where '$file' is, and my life depends on it." >&4
2297 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2298 exit 1
2304df62
AD
2299 ;;
2300 esac
2301done
2302echo " "
2303echo "Don't worry if any of the following aren't found..."
2304say=offhand
2305for file in $trylist; do
dfe9444c
AD
2306 eval xxx=\$$file
2307 case "$xxx" in
2308 /*|?:[\\/]*)
2309 if test -f "$xxx"; then
2310 : ok
2311 else
2312 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2313 xxx=`./loc $file $file $pth`
2314 fi
2315 ;;
2316 '') xxx=`./loc $file $file $pth`;;
2317 *) xxx=`./loc $xxx $xxx $pth`;;
2318 esac
306a8474 2319 eval $file=$xxx$_exe
2304df62
AD
2320 eval _$file=$xxx
2321 case "$xxx" in
2322 /*)
2323 echo $file is in $xxx.
2324 ;;
8e07c86e
AD
2325 ?:[\\/]*)
2326 echo $file is in $xxx.
2327 ;;
2304df62
AD
2328 *)
2329 echo "I don't see $file out there, $say."
2330 say=either
2331 ;;
2332 esac
2333done
2334case "$egrep" in
1fef16b3 2335egrep)
2304df62
AD
2336 echo "Substituting grep for egrep."
2337 egrep=$grep
868439a2 2338 _egrep=$grep
2304df62
AD
2339 ;;
2340esac
8ff267be 2341case "$ln" in
1fef16b3 2342ln)
8ff267be 2343 echo "Substituting cp for ln."
2344 ln=$cp
868439a2 2345 _ln=$cp
8ff267be 2346 ;;
2347esac
2e26f1d5
JH
2348case "$make" in
2349make)
2350 case "$gmake" in
2351 gmake)
2352 echo "I can't find make or gmake, and my life depends on it." >&4
2353 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2354 exit 1
2355 ;;
2356 esac
2357 ;;
2358esac
2359case "$gmake" in
2360gmake) ;;
2361*) # We can't have osname yet.
1fef16b3
JH
2362 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2363 # Assume that gmake, if found, is definitely GNU make
2364 # and prefer it over the system make.
2365 echo "Substituting gmake for make."
2366 make=$gmake
868439a2 2367 _make=$gmake
1fef16b3
JH
2368 fi
2369 ;;
a5a94ea5 2370esac
2304df62
AD
2371case "$test" in
2372test)
2373 echo "Hopefully test is built into your sh."
2374 ;;
2375*)
73614538 2376 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2377 echo "Using the test built into your sh."
2304df62
AD
2378 test=test
2379 _test=test
2380 fi
2381 ;;
2382esac
2383case "$echo" in
2384echo)
2385 echo "Hopefully echo is built into your sh."
2386 ;;
2387'') ;;
2388*)
2389 echo " "
2390echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2391 $echo $n "hi there$c" >foo1
2392 echo $n "hi there$c" >foo2
2393 if cmp foo1 foo2 >/dev/null 2>&1; then
2394 echo "They are compatible. In fact, they may be identical."
2395 else
2396 case "$n" in
2397 '-n') n='' c='\c';;
2398 *) n='-n' c='';;
2399 esac
2400 cat <<FOO
2401They are not compatible! You are probably running ksh on a non-USG system.
2402I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2403have echo built in and we may have to run some Bourne shell scripts. That
2404means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2405
2406FOO
2407 $echo $n "The star should be here-->$c"
2408 $echo "*"
2409 fi
2410 $rm -f foo1 foo2
2411 ;;
2412esac
2413
6b769f8f 2414cat <<EOS >trygcc
2573c5f9
JH
2415$startsh
2416EOS
6b769f8f 2417cat <<'EOSC' >>trygcc
2573c5f9
JH
2418case "$cc" in
2419'') ;;
2420*) $rm -f try try.*
2421 $cat >try.c <<EOM
2422int main(int argc, char *argv[]) {
2423 return 0;
2424}
2425EOM
e4778687 2426 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2427 :
2428 else
2429 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2430 despair=yes
2431 trygcc=yes
2432 case "$cc" in
2433 *gcc*) trygcc=no ;;
2434 esac
2435 case "`$cc -v -c try.c 2>&1`" in
2436 *gcc*) trygcc=no ;;
2437 esac
2438 if $test X"$trygcc" = Xyes; then
2439 if gcc -o try -c try.c; then
2440 echo " "
2441 echo "You seem to have a working gcc, though." >&4
2442 rp="Would you like to use it?"
2443 dflt=y
2444 if $test -f myread; then
2445 . ./myread
2446 else
2447 if $test -f UU/myread; then
2448 . ./UU/myread
2449 else
2450 echo "Cannot find myread, sorry. Aborting." >&2
2451 exit 1
2452 fi
2453 fi
2454 case "$ans" in
6371411c
RB
2455 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2456 if $test -f usethreads.cbu; then
2457 $cat >&4 <<EOM
2458
2459*** However, any setting of the C compiler flags (e.g. for thread support)
2460*** has been lost. It may be necessary to pass -Dcc=gcc to Configure
2461*** (together with e.g. -Dusethreads).
2462
2463EOM
2464 fi;;
2573c5f9
JH
2465 esac
2466 fi
2467 fi
6b769f8f
RB
2468 fi
2469 $rm -f try try.*
2470 ;;
2471esac
2472EOSC
2473
2474cat <<EOS >checkcc
2475$startsh
2476EOS
2477cat <<'EOSC' >>checkcc
2478case "$cc" in
2479'') ;;
2480*) $rm -f try try.*
2481 $cat >try.c <<EOM
2482int main(int argc, char *argv[]) {
2483 return 0;
2484}
2485EOM
2486 if $cc -o try $ccflags $ldflags try.c; then
2487 :
2488 else
2573c5f9 2489 if $test X"$despair" = Xyes; then
6b769f8f
RB
2490 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2491 fi
2492 $cat >&4 <<EOM
5dd4fbdf
MB
2493You need to find a working C compiler.
2494Either (purchase and) install the C compiler supplied by your OS vendor,
2495or for a free C compiler try http://gcc.gnu.org/
2496I cannot continue any further, aborting.
2497EOM
6b769f8f 2498 exit 1
2573c5f9
JH
2499 fi
2500 $rm -f try try.*
2501 ;;
2502esac
2503EOSC
2504
a0d0e21e
LW
2505: determine whether symbolic links are supported
2506echo " "
2507$touch blurfl
2508if $ln -s blurfl sym > /dev/null 2>&1 ; then
2509 echo "Symbolic links are supported." >&4
818f00be 2510 lns="$ln -s"
a0d0e21e
LW
2511else
2512 echo "Symbolic links are NOT supported." >&4
2513 lns="$ln"
2514fi
2515$rm -f blurfl sym
2516
dafca956
JH
2517: determine whether symbolic links are supported
2518echo " "
2519case "$lns" in
18ea2752 2520*"ln"*" -s")
dafca956
JH
2521 echo "Checking how to test for symbolic links..." >&4
2522 $lns blurfl sym
4b661809 2523 if $test "X$issymlink" = X; then
2e2a97a6
JH
2524 case "$newsh" in
2525 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2526 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2527 esac
5d644a95
MB
2528 if test $? = 0; then
2529 issymlink="test -h"
2e2a97a6
JH
2530 else
2531 echo "Your builtin 'test -h' may be broken." >&4
2532 case "$test" in
2533 /*) ;;
2534 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2535 for p in $pth
2536 do
2537 if test -f "$p/$test"; then
2538 test="$p/$test"
2539 break
2540 fi
2541 done
2542 ;;
2543 esac
2544 case "$test" in
2545 /*)
2546 echo "Trying external '$test -h'." >&4
2547 issymlink="$test -h"
2548 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2549 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2550 issymlink=''
2551 fi
2552 ;;
2553 *) issymlink='' ;;
2554 esac
5d644a95
MB
2555 fi
2556 fi
4b661809 2557 if $test "X$issymlink" = X; then
dafca956 2558 if $test -L sym 2>/dev/null; then
5d644a95 2559 issymlink="$test -L"
2e2a97a6 2560 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2561 fi
2562 fi
4b661809 2563 if $test "X$issymlink" != X; then
5d644a95 2564 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2565 else
2566 echo "I do not know how you can test for symbolic links." >&4
2567 fi
2568 $rm -f blurfl sym
2569 ;;
2570*) echo "No symbolic links, so not testing for their testing..." >&4
2571 ;;
2572esac
2573echo " "
2574
2575
2576case "$mksymlinks" in
2577$define|true|[yY]*)
2578 case "$src" in
2579 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2580 exit 1
2581 ;;
4b661809 2582 *) case "$lns:$issymlink" in
f314eb9f 2583 *"ln"*" -s:"*"test -"?)
dafca956
JH
2584 echo "Creating the symbolic links..." >&4
2585 echo "(First creating the subdirectories...)" >&4
2586 cd ..
2587 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2588 read directory
2589 test -z "$directory" && break
2590 mkdir -p $directory
2591 done
2592 # Sanity check 1.
2593 if test ! -d t/base; then
2594 echo "Failed to create the subdirectories. Aborting." >&4
2595 exit 1
2596 fi
2597 echo "(Then creating the symlinks...)" >&4
2598 awk '{print $1}' $src/MANIFEST | while true; do
2599 read filename
2600 test -z "$filename" && break
2601 if test -f $filename; then
5d644a95 2602 if $issymlink $filename; then
dafca956
JH
2603 rm -f $filename
2604 fi
2605 fi
2606 if test -f $filename; then
2607 echo "$filename already exists, not symlinking."
2608 else
2609 ln -s $src/$filename $filename
2610 fi
2611 done
2612 # Sanity check 2.
a0d24b8a
JH
2613 if test ! -f t/base/lex.t; then
2614 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2615 exit 1
2616 fi
2617 cd UU
2618 ;;
2619 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2620 ;;
2621 esac
2622 ;;
2623 esac
2624 ;;
2625esac
2626
5440bc8e
JH
2627
2628case "$usecrosscompile" in
2629$define|true|[yY]*)
93bc48fa 2630 $echo "Cross-compiling..."
5440bc8e
JH
2631 croak=''
2632 case "$cc" in
2633 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2634 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2635 ar=$targetarch-ar
2636 # leave out ld, choosing it is more complex
2637 nm=$targetarch-nm
2638 ranlib=$targetarch-ranlib
93bc48fa 2639 $echo 'extern int foo;' > try.c
f8006fac 2640 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2641 shift
2642 if $test $# -gt 0; then
2643 incpth="$incpth $*"
f8006fac
JH
2644 incpth="`$echo $incpth|$sed 's/^ //'`"
2645 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2646 for i in $*; do
f8006fac 2647 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2648 if $test -d $j; then
2649 libpth="$libpth $j"
2650 fi
2651 done
f8006fac
JH
2652 libpth="`$echo $libpth|$sed 's/^ //'`"
2653 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2654 fi
2655 $rm -f try.c
5440bc8e
JH
2656 ;;
2657 esac
2658 case "$targetarch" in
93bc48fa
JH
2659 '') echo "Targetarch not defined." >&4; croak=y ;;
2660 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2661 esac
2662 case "$incpth" in
93bc48fa 2663 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2664 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2665 esac
2666 case "$libpth" in
93bc48fa 2667 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2668 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2669 esac
93bc48fa
JH
2670 case "$usrinc" in
2671 '') for i in $incpth; do
2672 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2673 usrinc=$i
2674 echo "Guessing usrinc $usrinc." >&4
2675 break
2676 fi
2677 done
2678 case "$usrinc" in
2679 '') echo "Usrinc not defined." >&4; croak=y ;;
2680 esac
2681 ;;
2682 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2683 esac
93bc48fa
JH
2684 case "$targethost" in
2685 '') echo "Targethost not defined." >&4; croak=y ;;
2686 *) echo "Using targethost $targethost." >&4
5440bc8e 2687 esac
93bc48fa
JH
2688 locincpth=' '
2689 loclibpth=' '
5440bc8e 2690 case "$croak" in
93bc48fa 2691 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2692 esac
2693 case "$src" in
2694 /*) run=$src/Cross/run
93c0359c 2695 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2696 to=$src/Cross/to
2697 from=$src/Cross/from
2698 ;;
93bc48fa 2699 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2700 run=$pwd/Cross/run
f8006fac 2701 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2702 to=$pwd/Cross/to
2703 from=$pwd/Cross/from
2704 ;;
2705 esac
2706 case "$targetrun" in
2707 '') targetrun=ssh ;;
2708 esac
2709 case "$targetto" in
2710 '') targetto=scp ;;
2711 esac
2712 case "$targetfrom" in
2713 '') targetfrom=scp ;;
2714 esac
2715 run=$run-$targetrun
2716 to=$to-$targetto
2717 from=$from-$targetfrom
93bc48fa
JH
2718 case "$targetdir" in
2719 '') targetdir=/tmp
2720 echo "Guessing targetdir $targetdir." >&4
2721 ;;
2722 esac
5440bc8e 2723 case "$targetuser" in
93bc48fa
JH
2724 '') targetuser=root
2725 echo "Guessing targetuser $targetuser." >&4
2726 ;;
5440bc8e
JH
2727 esac
2728 case "$targetfrom" in
2729 scp) q=-q ;;
2730 *) q='' ;;
2731 esac
2732 case "$targetrun" in
2733 ssh|rsh)
2734 cat >$run <<EOF
2735#!/bin/sh
93c0359c
JH
2736case "\$1" in
2737-cwd)
2738 shift
2739 cwd=\$1
2740 shift
2741 ;;
2742esac
2743case "\$cwd" in
2744'') cwd=$targetdir ;;
2745esac
5440bc8e
JH
2746exe=\$1
2747shift
93c0359c
JH
2748if $test ! -f \$exe.xok; then
2749 $to \$exe
2750 $touch \$exe.xok
2751fi
2752$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2753EOF
2754 ;;
93bc48fa 2755 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2756 exit 1
2757 ;;
2758 esac
93c0359c
JH
2759 case "$targetmkdir" in
2760 */Cross/mkdir)
2761 cat >$targetmkdir <<EOF
2762#!/bin/sh
2763$targetrun -l $targetuser $targethost "mkdir -p \$@"
2764EOF
f8006fac 2765 $chmod a+rx $targetmkdir
93c0359c
JH
2766 ;;
2767 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2768 exit 1
2769 ;;
2770 esac
5440bc8e
JH
2771 case "$targetto" in
2772 scp|rcp)
2773 cat >$to <<EOF
2774#!/bin/sh
2775for f in \$@
2776do
93c0359c
JH
2777 case "\$f" in
2778 /*)
2779 $targetmkdir \`dirname \$f\`
2780 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2781 ;;
2782 *)
2783 $targetmkdir $targetdir/\`dirname \$f\`
2784 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2785 ;;
2786 esac
5440bc8e
JH
2787done
2788exit 0
2789EOF
2790 ;;
2791 cp) cat >$to <<EOF
2792#!/bin/sh
93c0359c
JH
2793for f in \$@
2794do
2795 case "\$f" in
2796 /*)
2797 $mkdir -p $targetdir/\`dirname \$f\`
2798 $cp \$f $targetdir/\$f || exit 1
2799 ;;
2800 *)
2801 $targetmkdir $targetdir/\`dirname \$f\`
2802 $cp \$f $targetdir/\$f || exit 1
2803 ;;
2804 esac
2805done
2806exit 0
5440bc8e
JH
2807EOF
2808 ;;
93bc48fa 2809 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2810 exit 1
2811 ;;
2812 esac
2813 case "$targetfrom" in
2814 scp|rcp)
2815 cat >$from <<EOF
2816#!/bin/sh
2817for f in \$@
2818do
93c0359c 2819 $rm -f \$f
5440bc8e
JH
2820 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2821done
2822exit 0
2823EOF
2824 ;;
2825 cp) cat >$from <<EOF
2826#!/bin/sh
2827for f in \$@
2828do
93c0359c 2829 $rm -f \$f
5440bc8e
JH
2830 cp $targetdir/\$f . || exit 1
2831done
2832exit 0
2833EOF
2834 ;;
93bc48fa 2835 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2836 exit 1
2837 ;;
2838 esac
93bc48fa
JH
2839 if $test ! -f $run; then
2840 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2841 else
f8006fac 2842 $chmod a+rx $run
5440bc8e 2843 fi
93bc48fa
JH
2844 if $test ! -f $to; then
2845 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2846 else
f8006fac 2847 $chmod a+rx $to
5440bc8e 2848 fi
93bc48fa
JH
2849 if $test ! -f $from; then
2850 echo "Target 'from' script '$from' not found." >&4
5440bc8e 2851 else
f8006fac 2852 $chmod a+rx $from
5440bc8e 2853 fi
93bc48fa 2854 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
2855 exit 1
2856 fi
2857 cat >&4 <<EOF
f8006fac
JH
2858Using '$run' for remote execution,
2859and '$from' and '$to'
93bc48fa 2860for remote file transfer.
5440bc8e
JH
2861EOF
2862 ;;
2863*) run=''
2864 to=:
2865 from=:
2866 usecrosscompile='undef'
2867 targetarch=''
2868 ;;
2869esac
2870
ecfc5424
AD
2871: see whether [:lower:] and [:upper:] are supported character classes
2872echo " "
ecfc5424
AD
2873case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2874ABYZ)
2875 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2876 up='[:upper:]'
2877 low='[:lower:]'
2878 ;;
28e8609d
JH
2879*) # There is a discontinuity in EBCDIC between 'I' and 'J'
2880 # (0xc9 and 0xd1), therefore that is a nice testing point.
2881 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2882 case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
28e8609d
JH
2883 ij) up='[A-Z]'
2884 low='[a-z]'
2885 ;;
2886 esac
2887 fi
2888 if test "X$up" = X -o "X$low" = X; then
3eaeeeae 2889 case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
28e8609d
JH
2890 ij) up='A-Z'
2891 low='a-z'
2892 ;;
2893 esac
2894 fi
2895 if test "X$up" = X -o "X$low" = X; then
2896 case "`echo IJ | od -x 2>/dev/null`" in
2897 *C9D1*|*c9d1*)
2898 echo "Hey, this might be EBCDIC." >&4
2899 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2900 case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
28e8609d
JH
2901 ij) up='[A-IJ-RS-Z]'
2902 low='[a-ij-rs-z]'
2903 ;;
2904 esac
2905 fi
2906 if test "X$up" = X -o "X$low" = X; then
5ff3f7a4 2907 case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
28e8609d
JH
2908 ij) up='A-IJ-RS-Z'
2909 low='a-ij-rs-z'
2910 ;;
2911 esac
2912 fi
2913 ;;
2914 esac
2915 fi
2916esac
3eaeeeae 2917case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
28e8609d
JH
2918ij)
2919 echo "Using $up and $low to convert case." >&4
2920 ;;
ecfc5424 2921*)
28e8609d
JH
2922 echo "I don't know how to translate letters from upper to lower case." >&4
2923 echo "Your tr is not acting any way I know of." >&4
2924 exit 1
2925 ;;
ecfc5424
AD
2926esac
2927: set up the translation script tr, must be called with ./tr of course
2928cat >tr <<EOSC
2929$startsh
2930case "\$1\$2" in
2931'[A-Z][a-z]') exec $tr '$up' '$low';;
2932'[a-z][A-Z]') exec $tr '$low' '$up';;
2933esac
2934exec $tr "\$@"
2935EOSC
2936chmod +x tr
2937$eunicefix tr
2938
2304df62
AD
2939: Try to determine whether config.sh was made on this system
2940case "$config_sh" in
2941'')
43999f95
JH
2942myuname=`$uname -a 2>/dev/null`
2943$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
2944# tr '[A-Z]' '[a-z]' would not work in EBCDIC
2945# because the A-Z/a-z are not consecutive.
a0d0e21e 2946myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 2947 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 2948newmyuname="$myuname"
2304df62 2949dflt=n
16d20bd9
AD
2950case "$knowitall" in
2951'')
2952 if test -f ../config.sh; then
2953 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2954 eval "`grep myuname= ../config.sh`"
2955 fi
2956 if test "X$myuname" = "X$newmyuname"; then
2957 dflt=y
2958 fi
2304df62 2959 fi
16d20bd9
AD
2960 ;;
2961*) dflt=y;;
2962esac
2304df62
AD
2963
2964: Get old answers from old config file if Configure was run on the
2965: same system, otherwise use the hints.
2966hint=default
2967cd ..
2968if test -f config.sh; then
16d20bd9
AD
2969 echo " "
2970 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
2971 . UU/myread
2972 case "$ans" in
f83701cd
AD
2973 n*|N*) echo "OK, I'll ignore it."
2974 mv config.sh config.sh.old
2975 myuname="$newmyuname"
2976 ;;
2304df62 2977 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
2978 tmp_n="$n"
2979 tmp_c="$c"
85cad39c 2980 tmp_sh="$sh"
2304df62
AD
2981 . ./config.sh
2982 cp config.sh UU
ecfc5424
AD
2983 n="$tmp_n"
2984 c="$tmp_c"
85cad39c 2985 : Older versions did not always set $sh. Catch re-use of such
2986 : an old config.sh.
2987 case "$sh" in
2988 '') sh="$tmp_sh" ;;
2989 esac
2304df62
AD
2990 hint=previous
2991 ;;
2992 esac
2993fi
2573c5f9 2994. ./UU/checkcc
2304df62
AD
2995if test ! -f config.sh; then
2996 $cat <<EOM
2997
4e2a5f63
AD
2998First time through, eh? I have some defaults handy for some systems
2999that need some extra help getting the Configure answers right:
2304df62
AD
3000
3001EOM
dfe9444c 3002 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
3003 dflt=''
3004 : Half the following guesses are probably wrong... If you have better
7f2de2d2 3005 : tests or hints, please send them to perlbug@perl.org
2304df62 3006 : The metaconfig authors would also appreciate a copy...
a0d0e21e 3007 $test -f /irix && osname=irix
85e6fe83
LW
3008 $test -f /xenix && osname=sco_xenix
3009 $test -f /dynix && osname=dynix
3010 $test -f /dnix && osname=dnix
5f05dabc 3011 $test -f /lynx.os && osname=lynxos
3012 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 3013 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 3014 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 3015 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
3016 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3017 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
3018 $test -d /usr/apollo/bin && osname=apollo
3019 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 3020 $test -d /usr/include/minix && osname=minix
d54344fc 3021 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 3022 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 3023 osname=machten
4633a7c4 3024 if $test -x /sbin/version; then
dfe9444c 3025 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
3026 $sed -e 's/[A-Za-z]$//'`
3027 elif $test -x /usr/etc/version; then
dfe9444c 3028 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
3029 $sed -e 's/[A-Za-z]$//'`
3030 else
3031 osvers="$2.$3"
3032 fi
3033 fi
aaacdc8b
GS
3034
3035 $test -f /sys/posix.dll &&
3036 $test -f /usr/bin/what &&
3037 set X `/usr/bin/what /sys/posix.dll` &&
3038 $test "$3" = UWIN &&
3039 osname=uwin &&
3040 osvers="$5"
3041
2304df62
AD
3042 if $test -f $uname; then
3043 set X $myuname
3044 shift
3045
2304df62 3046 case "$5" in
85e6fe83 3047 fps*) osname=fps ;;
2304df62
AD
3048 mips*)
3049 case "$4" in
85e6fe83
LW
3050 umips) osname=umips ;;
3051 *) osname=mips ;;
2304df62 3052 esac;;
85e6fe83
LW
3053 [23]100) osname=mips ;;
3054 next*) osname=next ;;
ecfc5424 3055 i386*)
c6912327
JH
3056 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3057 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
3058 osname='sco'
3059 osvers=$tmp
3060 elif $test -f /etc/kconfig; then
ecfc5424 3061 osname=isc
bd628c73 3062 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
3063 osvers=4
3064 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3065 osvers=3
2304df62 3066 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 3067 osvers=2
ecfc5424
AD
3068 fi
3069 fi
2000072c 3070 tmp=''
ecfc5424 3071 ;;
c4f23d77
AD
3072 pc*)
3073 if test -n "$DJGPP"; then
3074 osname=dos
3075 osvers=djgpp
3076 fi
3077 ;;
2304df62
AD
3078 esac
3079
3080 case "$1" in
a0d0e21e
LW
3081 aix) osname=aix
3082 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3083 case "$tmp" in
1aef975c 3084 'not found') osvers="$4"."$3" ;;
a0d0e21e
LW
3085 '<3240'|'<>3240') osvers=3.2.0 ;;
3086 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3087 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 3088 *) osvers=$tmp;;
a0d0e21e
LW
3089 esac
3090 ;;
aaacdc8b
GS
3091 bsd386) osname=bsd386
3092 osvers=`$uname -r`
3093 ;;
3094 cygwin*) osname=cygwin
3095 osvers="$3"
3096 ;;
23f87696
SZ
3097 *dc.osx) osname=dcosx
3098 osvers="$3"
3099 ;;
a0d0e21e
LW
3100 dnix) osname=dnix
3101 osvers="$3"
3102 ;;
3103 domainos) osname=apollo
3104 osvers="$3"
3105 ;;
3106 dgux) osname=dgux
3107 osvers="$3"
3108 ;;
760ac839 3109 dynixptx*) osname=dynixptx
e58e581d 3110 osvers=`echo "$4"|sed 's/^v//'`
760ac839 3111 ;;
a0d0e21e
LW
3112 freebsd) osname=freebsd
3113 osvers="$3" ;;
3114 genix) osname=genix ;;
3115 hp*) osname=hpux
bfb7748a 3116 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 3117 ;;
a78b0d02 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 ;;
3125 linux) osname=linux
3126 case "$3" in
a0d0e21e
LW
3127 *) osvers="$3" ;;
3128 esac
3129 ;;
28e8609d
JH
3130 MiNT) osname=mint
3131 ;;
3132 netbsd*) osname=netbsd
ecfc5424
AD
3133 osvers="$3"
3134 ;;
4e81affe
MM
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
BG
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 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`
8ff267be 3461cf_by=`(logname) 2>/dev/null`
dfe9444c
AD
3462case "$cf_by" in
3463"")
8ff267be 3464 cf_by=`(whoami) 2>/dev/null`
dfe9444c
AD
3465 case "$cf_by" in
3466 "") cf_by=unknown ;;
8ff267be 3467 esac ;;
3468esac
2304df62 3469
b4eb6b3d
JH
3470: set up the script used to warn in case of inconsistency
3471cat <<EOS >whoa
3472$startsh
3473EOS
3474cat <<'EOSC' >>whoa
3475dflt=y
3476echo " "
3477echo "*** WHOA THERE!!! ***" >&4
3478echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
3479rp=" Keep the $hint value?"
3480. ./myread
3481case "$ans" in
3482y) td=$was; tu=$was;;
3483esac
3484EOSC
3485
3486: function used to set $1 to $val
3487setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3488case "$val$was" in
3489$define$undef) . ./whoa; eval "$var=\$td";;
3490$undef$define) . ./whoa; eval "$var=\$tu";;
3491*) eval "$var=$val";;
3492esac'
3493
b29b105d
JH
3494case "$usesocks" in
3495$define|true|[yY]*) dflt='y';;
3496*) dflt='n';;
3497esac
3498cat <<EOM
3499
3500Perl can be built to use the SOCKS proxy protocol library. To do so,
3501Configure must be run with -Dusesocks. If you use SOCKS you also need
3502to use the PerlIO abstraction layer, this will be implicitly selected.
3503
3504If this doesn't make any sense to you, just accept the default '$dflt'.
3505EOM
3506rp='Build Perl for SOCKS?'
3507. ./myread
3508case "$ans" in
3509y|Y) val="$define" ;;
3510*) val="$undef" ;;
3511esac
3512set usesocks
3513eval $setvar
3514
3515case "$usesocks" in
3516$define|true|[yY]*) useperlio="$define";;
3517esac
3518
3519case "$useperlio" in
3520$define|true|[yY]*|'') dflt='y';;
3521*) dflt='n';;
3522esac
3523cat <<EOM
3524
3525Previous version of $package used the standard IO mechanisms as
3526defined in <stdio.h>. Versions 5.003_02 and later of $package allow
3527alternate IO mechanisms via the PerlIO abstraction layer, but the
3528stdio mechanism is still available if needed. The abstraction layer
3529can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3530Using PerlIO with sfio may cause problems with some extension modules.
3531
3532If this doesn't make any sense to you, just accept the default '$dflt'.
3533EOM
3534rp='Use the PerlIO abstraction layer?'
3535. ./myread
3536case "$ans" in
3537y|Y)
3538 val="$define"
3539 ;;
3540*)
3541 echo "Ok, doing things the stdio way."
3542 val="$undef"
3543 ;;
3544esac
3545set useperlio
3546eval $setvar
3547
3548case "$usesocks" in
3549$define|true|[yY]*)
3550 case "$useperlio" in
3551 $define|true|[yY]*) ;;
3552 *) cat >&4 <<EOM
3553
3554You are using the SOCKS proxy protocol library which means that you
3555should also use the PerlIO layer. You may be headed for trouble.
3556
3557EOM
3558 ;;
3559 esac
3560 ;;
3561esac
3562
3563
b4eb6b3d
JH
3564case "$usethreads" in
3565$define|true|[yY]*) dflt='y';;
8e285145
AD
3566*) # Catch case where user specified ithreads or 5005threads but
3567 # forgot -Dusethreads (A.D. 4/2002)
3568 case "$useithreads$use5005threads" in
b29b105d
JH
3569 *$define*)
3570 case "$useperlio" in
3571 "$define") dflt='y' ;;
3572 *) dflt='n' ;;
3573 esac
3574 ;;
3575 *) dflt='n';;
8e285145
AD
3576 esac
3577 ;;
b4eb6b3d
JH
3578esac
3579cat <<EOM
3580
3581Perl can be built to take advantage of threads on some systems.
3582To do so, Configure can be run with -Dusethreads.
3583
bfce6503
DM
3584Note that Perl built with threading support runs slightly slower
3585and uses more memory than plain Perl. The current implementation
3586is believed to be stable, but it is fairly new, and so should be
3587treated with caution.
b4eb6b3d
JH
3588
3589If this doesn't make any sense to you, just accept the default '$dflt'.
3590EOM
3591rp='Build a threading Perl?'
3592. ./myread
3593case "$ans" in
3594y|Y) val="$define" ;;
3595*) val="$undef" ;;
3596esac
3597set usethreads
3598eval $setvar
3599
3600case "$usethreads" in
3601$define)
3602 $cat <<EOM
3603
bfce6503
DM
3604Since release 5.6, Perl has had two different threading implementations,
3605the newer interpreter-based version (ithreads) with one interpreter per
3606thread, and the older 5.005 version (5005threads).
3607The 5005threads version is effectively unmaintained and will probably be
3608removed in Perl 5.10, so there should be no need to build a Perl using it
3609unless needed for backwards compatibility with some existing 5.005threads
3610code.
b4eb6b3d 3611
b4eb6b3d
JH
3612EOM
3613 : Default to ithreads unless overridden on command line or with
3614 : old config.sh
3615 dflt='y'
3616 case "$use5005threads" in
3617 $define|true|[yY]*) dflt='n';;
3618 esac
3619 case "$useithreads" in
3620 $undef|false|[nN]*) dflt='n';;
3621 esac
bfce6503 3622 rp='Use the newer interpreter-based ithreads?'
b4eb6b3d
JH
3623 . ./myread
3624 case "$ans" in
3625 y|Y) val="$define" ;;
3626 *) val="$undef" ;;
3627 esac
3628 set useithreads
3629 eval $setvar
3630 : Now set use5005threads to the opposite value.
3631 case "$useithreads" in
3632 $define) val="$undef" ;;
3633 *) val="$define" ;;
3634 esac
3635 set use5005threads
3636 eval $setvar
3637 ;;
3638*)
3639 useithreads="$undef"
3640 use5005threads="$undef"
3641 ;;
3642esac
3643
c915ce7f
JH
3644case "$useithreads$use5005threads" in
3645"$define$define")
3646 $cat >&4 <<EOM
3647
3648You cannot have both the ithreads and the 5.005 threads enabled
3649at the same time. Disabling the 5.005 threads since they are
3650much less stable than the ithreads.
3651
3652EOM
3653 use5005threads="$undef"
3654 ;;
3655esac
3656
b29b105d
JH
3657if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3658 cat >&4 <<EOF
3659***
3660*** To build with ithreads you must also use the PerlIO layer.
3661*** Cannot continue, aborting.
3662***
3663EOF
3664 exit 1
3665fi
3666
b4eb6b3d
JH
3667case "$d_oldpthreads" in
3668'') : Configure tests would be welcome here. For now, assume undef.
3669 val="$undef" ;;
3670*) val="$d_oldpthreads" ;;
3671esac
3672set d_oldpthreads
3673eval $setvar
3674
3675
3676case "$usethreads" in
3677"$define"|true|[yY]*)
3678: Look for a hint-file generated 'call-back-unit'. If the
3679: user has specified that a threading perl is to be built,
3680: we may need to set or change some other defaults.
3681 if $test -f usethreads.cbu; then
3682 echo "Your platform has some specific hints for threaded builds, using them..."
3683 . ./usethreads.cbu
3684 else
3685 $cat <<EOM
3686(Your platform doesn't have any specific hints for threaded builds.
3687 Assuming POSIX threads, then.)
3688EOM
3689 fi
3690 ;;
3691esac
3692
3693cat <<EOM
3694
3695Perl can be built so that multiple Perl interpreters can coexist
3696within the same Perl executable.
3697EOM
3698
3699case "$useithreads" in
3700$define)
3701 cat <<EOM
3702This multiple interpreter support is required for interpreter-based threads.
3703EOM
3704 val="$define"
3705 ;;
3706*) case "$usemultiplicity" in
3707 $define|true|[yY]*) dflt='y';;
3708 *) dflt='n';;
3709 esac
3710 echo " "
3711 echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3712 rp='Build Perl for multiplicity?'
3713 . ./myread
3714 case "$ans" in
3715 y|Y) val="$define" ;;
3716 *) val="$undef" ;;
3717 esac
3718 ;;
3719esac
3720set usemultiplicity
3721eval $setvar
3722
96056487
JH
3723
3724case "$usemorebits" in
3725"$define"|true|[yY]*)
3726 use64bitint="$define"
3727 uselongdouble="$define"
3728 usemorebits="$define"
3729 ;;
3730*) usemorebits="$undef"
3731 ;;
3732esac
3733
e5e20432
JH
3734: make some quick guesses about what we are up against
3735echo " "
3736$echo $n "Hmm... $c"
3737echo exit 1 >bsd
3738echo exit 1 >usg
3739echo exit 1 >v7
3740echo exit 1 >osf1
3741echo exit 1 >eunice
3742echo exit 1 >xenix
3743echo exit 1 >venix
3744echo exit 1 >os2
3745d_bsd="$undef"
3746$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3747if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3748then
3749 echo "Looks kind of like an OSF/1 system, but we'll see..."
3750 echo exit 0 >osf1
381aa1ff 3751elif test `echo abc | $tr a-z A-Z` = Abc ; then
e5e20432
JH
3752 xxx=`./loc addbib blurfl $pth`
3753 if $test -f $xxx; then
3754 echo "Looks kind of like a USG system with BSD features, but we'll see..."
3755 echo exit 0 >bsd
3756 echo exit 0 >usg
3757 else
3758 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3759 echo "Looks kind of like an extended USG system, but we'll see..."
3760 else
3761 echo "Looks kind of like a USG system, but we'll see..."
3762 fi
3763 echo exit 0 >usg
3764 fi
3765elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3766 echo "Looks kind of like a BSD system, but we'll see..."
3767 d_bsd="$define"
3768 echo exit 0 >bsd
3769else
3770 echo "Looks kind of like a Version 7 system, but we'll see..."
3771 echo exit 0 >v7
3772fi
3773case "$eunicefix" in
3774*unixtovms*)
3775 $cat <<'EOI'
3776There is, however, a strange, musty smell in the air that reminds me of
3777something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3778EOI
3779 echo exit 0 >eunice
3780 d_eunice="$define"
3781: it so happens the Eunice I know will not run shell scripts in Unix format
3782 ;;
3783*)
3784 echo " "
3785 echo "Congratulations. You aren't running Eunice."
3786 d_eunice="$undef"
3787 ;;
3788esac
3789: Detect OS2. The p_ variable is set above in the Head.U unit.
3d5d58b1
JH
3790: Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3791: semicolon as a patch separator
e5e20432
JH
3792case "$p_" in
3793:) ;;
3794*)
3795 $cat <<'EOI'
3796I have the feeling something is not exactly right, however...don't tell me...
3797lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3d5d58b1 3798(Or you may be running DOS with DJGPP.)
e5e20432
JH
3799EOI
3800 echo exit 0 >os2
3801 ;;
3802esac
3803if test -f /xenix; then
3804 echo "Actually, this looks more like a XENIX system..."
3805 echo exit 0 >xenix
3806 d_xenix="$define"
3807else
3808 echo " "
3809 echo "It's not Xenix..."
3810 d_xenix="$undef"
3811fi
3812chmod +x xenix
3813$eunicefix xenix
3814if test -f /venix; then
3815 echo "Actually, this looks more like a VENIX system..."
3816 echo exit 0 >venix
3817else
3818 echo " "
3819 if ./xenix; then
3820 : null
3821 else
3822 echo "Nor is it Venix..."
3823 fi
3824fi
3825chmod +x bsd usg v7 osf1 eunice xenix venix os2
3826$eunicefix bsd usg v7 osf1 eunice xenix venix os2
3827$rm -f foo
3828
5869b1f1
JH
3829case "$cc" in
3830'') dflt=cc;;
3831*) dflt="$cc";;
3832esac
3833rp="Use which C compiler?"
3834. ./myread
3835cc="$ans"
6b769f8f
RB
3836
3837: See if they have not cc but they do have gcc
3838. ./trygcc
e5e20432
JH
3839: Look for a hint-file generated 'call-back-unit'. Now that the
3840: user has specified the compiler, we may need to set or change some
3841: other defaults.
3842if $test -f cc.cbu; then
3843 . ./cc.cbu
3844fi
2573c5f9 3845. ./checkcc
8a27cf78 3846
e5e20432
JH
3847echo " "
3848echo "Checking for GNU cc in disguise and/or its version number..." >&4
5440bc8e 3849$cat >try.c <<EOM
e5e20432
JH
3850#include <stdio.h>
3851int main() {
3852#ifdef __GNUC__
3853#ifdef __VERSION__
3854 printf("%s\n", __VERSION__);
3855#else
3856 printf("%s\n", "1");
3857#endif
3858#endif
073b6de5 3859 return(0);
e5e20432
JH
3860}
3861EOM
5440bc8e
JH
3862if $cc -o try $ccflags $ldflags try.c; then
3863 gccversion=`$run ./try`
e5e20432
JH
3864 case "$gccversion" in
3865 '') echo "You are not using GNU cc." ;;
fc68435e 3866 *) echo "You are using GNU cc $gccversion."
48fe685d 3867 ccname=gcc
fc68435e 3868 ;;
e5e20432
JH
3869 esac
3870else
3871 echo " "
3872 echo "*** WHOA THERE!!! ***" >&4
3873 echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4
3874 case "$knowitall" in
3875 '')
3876 echo " You'd better start hunting for one and let me know about it." >&4
3877 exit 1
3878 ;;
3879 esac
3880fi
5440bc8e 3881$rm -f try try.*
e5e20432
JH
3882case "$gccversion" in
38831*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3884esac
5b463ca7
KS
3885case "$gccversion" in
3886'') gccosandvers='' ;;
10b4ebb5
JH
3887*) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3888 gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3889 gccshortvers=''
5b463ca7 3890 case "$gccosandvers" in
02903077
JH
3891 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3892 $osname$osvers) ;; # looking good
5b463ca7
KS
3893 $osname*) cat <<EOM >&4
3894
3895*** WHOA THERE!!! ***
3896
3897 Your gcc has not been compiled for the exact release of
3898 your operating system ($gccosandvers versus $osname$osvers).
3899
3900 In general it is a good idea to keep gcc synchronized with
3901 the operating system because otherwise serious problems
3902 may ensue when trying to compile software, like Perl.
3903
3904 I'm trying to be optimistic here, though, and will continue.
3905 If later during the configuration and build icky compilation
02903077
JH
3906 problems appear (headerfile conflicts being the most common
3907 manifestation), I suggest reinstalling the gcc to match
5b463ca7
KS
3908 your operating system release.
3909
3910EOM
3911 ;;
81575342 3912 *) gccosandvers='' ;; # failed to parse, better be silent
5b463ca7
KS
3913 esac
3914 ;;
3915esac
e723fc21
JH
3916case "$ccname" in
3917'') ccname="$cc" ;;
3918esac
e5e20432 3919
224cb7cb 3920# gcc 3.* complain about adding -Idirectories that they already know about,
76589481
JH
3921# so we will take those off from locincpth.
3922case "$gccversion" in
39233*)
3924 echo "main(){}">try.c
224cb7cb
JH
3925 for incdir in $locincpth; do
3926 warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
48fe685d 3927 grep '^c[cp]p*[01]: warning: changing search order '`
224cb7cb 3928 if test "X$warn" != X; then
44b94491 3929 locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
224cb7cb 3930 fi
76589481
JH
3931 done
3932 $rm -f try try.*
3933esac
640374d0 3934
bd9b35c9
JH
3935: decide how portable to be. Allow command line overrides.
3936case "$d_portable" in
3937"$undef") ;;
3938*) d_portable="$define" ;;
104d25b7 3939esac
85ab1d1d 3940
bd9b35c9
JH
3941: set up shell script to do ~ expansion
3942cat >filexp <<EOSS
3943$startsh
3944: expand filename
3945case "\$1" in
3946 ~/*|~)
3947 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3948 ;;
3949 ~*)
3950 if $test -f /bin/csh; then
3951 /bin/csh -f -c "glob \$1"
3952 failed=\$?
3953 echo ""
3954 exit \$failed
e5e20432