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