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