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