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