This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Introduction of d_pseudofork
[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#
233e16ce 29# Generated on Tue Dec 5 15:35:51 CET 2006 [metaconfig 3.0 PL70]
7f2de2d2 30# (with additional metaconfig patches by perlbug@perl.org)
2304df62 31
283fdd21 32cat >c1$$ <<EOF
2304df62
AD
33ARGGGHHHH!!!!!
34
35SCO csh still thinks true is false. Write to SCO today and tell them that next
36year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
37
38(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
39we'd have to do is go in and swap the && and || tokens, wherever they are.)
40
41[End of diatribe. We now return you to your regularly scheduled programming...]
42EOF
283fdd21 43cat >c2$$ <<EOF
2304df62
AD
44
45OOPS! You naughty creature! You didn't run Configure with sh!
46I will attempt to remedy the situation by running sh for you...
47EOF
48
283fdd21 49true || cat c1$$ c2$$
2304df62
AD
50true || exec sh $0 $argv:q
51
283fdd21 52(exit $?0) || cat c2$$
2304df62 53(exit $?0) || exec sh $0 $argv:q
283fdd21 54rm -f c1$$ c2$$
2304df62 55
f6538904 56if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
cbee2ce6
JH
57 cat >&4 <<EOF
58***
59*** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
60*** Configure that well. (Plan 9 is close to UNIX but not close enough.)
61*** Please read the README.plan9 for further instructions.
62*** Cannot continue, aborting.
63***
64EOF
65 exit 1
66fi
67
f8e2af1d
MC
68if test ! -c /dev/null ; then
69 cat >&4 <<EOF
70***
71*** I'm sorry, but /dev/null appears to be a file rather than a device.
72*** Please consult your operating sytem's notes for making a device
73*** in /dev.
74*** Cannot continue, aborting.
75***
76EOF
77 exit 1
78fi
79
a0d0e21e
LW
80: compute my invocation name
81me=$0
82case "$0" in
83*/*)
84 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
85 test "$me" || me=$0
86 ;;
87esac
88
dfe9444c 89: Proper separator for the PATH environment variable
8e07c86e
AD
90p_=:
91: On OS/2 this directory should exist if this is not floppy only system :-]
5c728af0 92if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
dfe9444c
AD
93 if test -n "$OS2_SHELL"; then
94 p_=\;
95 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
96 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
5c728af0 97 is_os2=yes
c4f23d77 98 elif test -n "$DJGPP"; then
495e2cbe
MB
99 case "X${MACHTYPE:-nonesuchmach}" in
100 *cygwin) ;;
101 *) p_=\; ;;
102 esac
dfe9444c 103 fi
39e571d4 104fi
a0d0e21e
LW
105
106: Proper PATH setting
107paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
16d20bd9 108paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
232e078e 109paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
16d20bd9 110paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
232e078e 111paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
87bdd940 112paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
232e078e
AD
113paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
114paths="$paths /sbin /usr/sbin /usr/libexec"
3c728e00 115paths="$paths /system/gnu_library/bin"
a0d0e21e
LW
116
117for p in $paths
118do
8e07c86e
AD
119 case "$p_$PATH$p_" in
120 *$p_$p$p_*) ;;
121 *) test -d $p && PATH=$PATH$p_$p ;;
a0d0e21e
LW
122 esac
123done
124
8e07c86e 125PATH=.$p_$PATH
2304df62
AD
126export PATH
127
dfe9444c
AD
128: shall we be using ksh?
129inksh=''
130needksh=''
131avoidksh=''
132newsh=/bin/ksh
133changesh=''
ff0cee69 134if (PATH=.; alias -x) >/dev/null 2>&1; then
dfe9444c
AD
135 inksh=true
136fi
137if test -f /hp-ux -a -f /bin/ksh; then
138 needksh='to avoid sh bug in "here document" expansion'
139fi
140if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
141 if test X`/usr/bin/uname -v` = X4; then
142 avoidksh="to avoid AIX 4's /bin/sh"
143 newsh=/usr/bin/bsh
2304df62 144 fi
dfe9444c 145fi
cf04f91f
JH
146if test -f /osf_boot -a -f /usr/sbin/setld; then
147 if test X`/usr/bin/uname -s` = XOSF1; then
148 avoidksh="to avoid Digital UNIX' ksh"
149 newsh=/bin/sh
150 unset BIN_SH # if this is 'xpg4' sh will start up ksh
151 fi
152fi
dfe9444c
AD
153case "$inksh/$needksh" in
154/[a-z]*)
c4f23d77 155 ENV=''
dfe9444c
AD
156 changesh=true
157 reason="$needksh"
158 ;;
159esac
160case "$inksh/$avoidksh" in
161true/[a-z]*)
162 changesh=true
163 reason="$avoidksh"
164 ;;
165esac
166case "$inksh/$needksh-$avoidksh-" in
167true/--)
a0d0e21e
LW
168 cat <<EOM
169(I see you are using the Korn shell. Some ksh's blow up on $me,
dfe9444c 170mainly on older exotic systems. If yours does, try the Bourne shell instead.)
ff0cee69 171EOM
dfe9444c
AD
172 ;;
173esac
174case "$changesh" in
175true)
2e2a97a6 176 export newsh
dfe9444c
AD
177 echo "(Feeding myself to $newsh $reason.)"
178 case "$0" in
179 Configure|*/Configure) exec $newsh $0 "$@";;
180 *) exec $newsh Configure "$@";;
181 esac
182 ;;
183esac
2304df62 184
bfb7748a
AD
185: if needed set CDPATH to a harmless value that is not chatty
186: avoid bash 2.02 problems with empty CDPATH.
187case "$CDPATH" in
188'') ;;
189*) case "$SHELL" in
190 *bash*) CDPATH='.' ;;
191 *) CDPATH='' ;;
192 esac
193 ;;
194esac
2304df62
AD
195: Configure runs within the UU subdirectory
196test -d UU || mkdir UU
8e07c86e 197cd UU && rm -f ./*
2304df62 198
6b356c8e
JH
199ccname=''
200ccversion=''
b4eb6b3d
JH
201ccsymbols=''
202cppccsymbols=''
203cppsymbols=''
5440bc8e
JH
204from=''
205run=''
206targetarch=''
207to=''
208usecrosscompile=''
6b34ded5 209mistrustnm=''
9c839522 210perllibs=''
b4eb6b3d
JH
211dynamic_ext=''
212extensions=''
213known_extensions=''
214nonxs_ext=''
215static_ext=''
216useopcode=''
217useposix=''
6fcddf3b 218extras=''
ecfc5424 219d_bsd=''
40a7a20a 220d_eunice=''
2304df62
AD
221d_xenix=''
222eunicefix=''
223Mcc=''
dfe9444c 224ar=''
2304df62
AD
225awk=''
226bash=''
227bison=''
228byacc=''
229cat=''
230chgrp=''
231chmod=''
232chown=''
ecfc5424 233comm=''
2304df62
AD
234compress=''
235cp=''
236cpio=''
237cpp=''
238csh=''
239date=''
240echo=''
241egrep=''
242emacs=''
243expr=''
244find=''
245flex=''
3c728e00 246gmake=''
2304df62 247grep=''
8ff267be 248gzip=''
2304df62
AD
249inews=''
250ksh=''
251less=''
252line=''
253lint=''
254ln=''
255lp=''
256lpr=''
257ls=''
258mail=''
259mailx=''
dfe9444c 260make=''
2304df62
AD
261mkdir=''
262more=''
263mv=''
693762b4 264nm=''
2304df62
AD
265nroff=''
266perl=''
267pg=''
268pmake=''
269pr=''
270rm=''
271rmail=''
272sed=''
273sendmail=''
2304df62
AD
274shar=''
275sleep=''
276smail=''
277sort=''
278submit=''
279tail=''
280tar=''
281tbl=''
693762b4 282tee=''
2304df62
AD
283test=''
284touch=''
285tr=''
286troff=''
287uname=''
288uniq=''
289uuname=''
290vi=''
291zcat=''
8ff267be 292zip=''
b4eb6b3d
JH
293full_ar=''
294full_sed=''
a0d0e21e 295libswanted=''
2304df62
AD
296hint=''
297myuname=''
85e6fe83
LW
298osname=''
299osvers=''
2304df62
AD
300Author=''
301Date=''
302Header=''
303Id=''
304Locker=''
305Log=''
306RCSfile=''
307Revision=''
308Source=''
309State=''
dfe9444c
AD
310_a=''
311_exe=''
312_o=''
4633a7c4
LW
313archobjs=''
314exe_ext=''
315firstmakefile=''
316lib_ext=''
317obj_ext=''
318path_sep=''
b4eb6b3d 319afs=''
a6d26a0d 320afsroot=''
b4eb6b3d
JH
321alignbytes=''
322ansi2knr=''
323archlib=''
324archlibexp=''
325d_archlib=''
326installarchlib=''
327archname=''
328myarchname=''
329d_atolf=''
330d_atoll=''
331baserev=''
332bin=''
333binexp=''
f3f1a2d8 334initialinstalllocation=''
b4eb6b3d 335installbin=''
f3f1a2d8 336userelocatableinc=''
b4eb6b3d 337byteorder=''
2304df62 338cc=''
2304df62
AD
339ccflags=''
340cppflags=''
341ldflags=''
342lkflags=''
8e07c86e 343locincpth=''
2304df62 344optimize=''
b4eb6b3d 345cf_email=''
2304df62
AD
346cf_by=''
347cf_time=''
b4eb6b3d 348charsize=''
2304df62 349contains=''
b4eb6b3d 350cpp_stuff=''
2304df62
AD
351cpplast=''
352cppminus=''
353cpprun=''
354cppstdin=''
74cac757 355d__fwalk=''
b4eb6b3d
JH
356d_access=''
357d_accessx=''
55954f19 358d_aintl=''
b4eb6b3d 359d_alarm=''
10bc17b6
JH
360asctime_r_proto=''
361d_asctime_r=''
0dbb1585
AL
362d_attribute_format=''
363d_attribute_malloc=''
364d_attribute_nonnull=''
365d_attribute_noreturn=''
366d_attribute_pure=''
367d_attribute_unused=''
368d_attribute_warn_unused_result=''
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"
732c9516
JH
1301
1302: Private path used by Configure to find libraries. Its value
1303: is prepended to libpth. This variable takes care of special
1304: machines, like the mips. Usually, it should be empty.
1305plibpth=''
1306
1cfa4ec7
GS
1307: default library list
1308libswanted=''
921b2963 1309: some systems want to use only the non-versioned libso:s
1cfa4ec7 1310ignore_versioned_solibs=''
9da7673b
MB
1311siteman1dir=''
1312siteman3dir=''
1313sitescript=''
b4eb6b3d
JH
1314archname64=''
1315ccflags_uselargefiles=''
1316ldflags_uselargefiles=''
1317libswanted_uselargefiles=''
1318: set usemultiplicity on the Configure command line to enable multiplicity.
29209bc5 1319: set usesocks on the Configure command line to enable socks.
b4eb6b3d 1320: set usethreads on the Configure command line to enable threads.
cd040c5e 1321usereentrant='undef'
9da7673b
MB
1322: full support for void wanted by default
1323defvoidused=15
1324
ecfc5424 1325: List of libraries we want.
15431986 1326: If anyone needs extra -lxxx, put those in a hint file.
6bdd71ef
AB
1327libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1328libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1aef975c 1329: We probably want to search /usr/shlib before most other libraries.
94b6baf5 1330: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
ecfc5424
AD
1331glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1332glibpth="/usr/shlib $glibpth"
1333: Do not use vfork unless overridden by a hint file.
1334usevfork=false
1335
8ff267be
PP
1336: Find the basic shell for Bourne shell scripts
1337case "$sh" in
1338'')
8ff267be
PP
1339 case "$SYSTYPE" in
1340 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1341 *) xxx='/bin/sh';;
1342 esac
1343 if test -f "$xxx"; then
1344 sh="$xxx"
1345 else
1346 : Build up a list and do a single loop so we can 'break' out.
1347 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1348 for xxx in sh bash ksh pdksh ash; do
1349 for p in $pth; do
1350 try="$try ${p}/${xxx}"
1351 done
1352 done
1353 for xxx in $try; do
1354 if test -f "$xxx"; then
1355 sh="$xxx";
8ff267be 1356 break
a5a94ea5
JH
1357 elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1358 sh="$xxx";
1359 break
8ff267be
PP
1360 elif test -f "$xxx.exe"; then
1361 sh="$xxx";
8ff267be
PP
1362 break
1363 fi
1364 done
1365 fi
1366 ;;
1367esac
1368
1369case "$sh" in
a33c94aa 1370'') cat >&2 <<EOM
8ff267be 1371$me: Fatal Error: I can't find a Bourne Shell anywhere.
dfe9444c 1372
8ff267be 1373Usually it's in /bin/sh. How did you even get this far?
7f2de2d2 1374Please contact me (Perl Maintainers) at perlbug@perl.org and
dfe9444c 1375we'll try to straighten this all out.
8ff267be
PP
1376EOM
1377 exit 1
1378 ;;
1379esac
1380
760ac839 1381: see if sh knows # comments
73614538 1382if `$sh -c '#' >/dev/null 2>&1`; then
760ac839
LW
1383 shsharp=true
1384 spitshell=cat
760ac839 1385 xcat=/bin/cat
a931254c
JH
1386 test -f $xcat$_exe || xcat=/usr/bin/cat
1387 if test ! -f $xcat$_exe; then
4bdb8fb5 1388 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
a931254c 1389 if test -f $p/cat$_exe; then
1deb0a86 1390 xcat=$p/cat
3c728e00
JH
1391 break
1392 fi
1393 done
1deb0a86
JH
1394 if test ! -f $xcat$_exe; then
1395 echo "Can't find cat anywhere!"
3c728e00
JH
1396 exit 1
1397 fi
1398 fi
5440bc8e
JH
1399 echo "#!$xcat" >sharp
1400 $eunicefix sharp
1401 chmod +x sharp
1402 ./sharp > today
760ac839 1403 if test -s today; then
760ac839
LW
1404 sharpbang='#!'
1405 else
5440bc8e
JH
1406 echo "#! $xcat" > sharp
1407 $eunicefix sharp
1408 chmod +x sharp
1409 ./sharp > today
760ac839 1410 if test -s today; then
760ac839
LW
1411 sharpbang='#! '
1412 else
760ac839
LW
1413 sharpbang=': use '
1414 fi
1415 fi
1416else
dfe9444c 1417 echo " "
8ff267be 1418 echo "Your $sh doesn't grok # comments--I will strip them later on."
760ac839
LW
1419 shsharp=false
1420 cd ..
1421 echo "exec grep -v '^[ ]*#'" >spitshell
1422 chmod +x spitshell
1423 $eunicefix spitshell
1424 spitshell=`pwd`/spitshell
1425 cd UU
1426 echo "I presume that if # doesn't work, #! won't work either!"
1427 sharpbang=': use '
1428fi
5440bc8e 1429rm -f sharp today
760ac839
LW
1430
1431: figure out how to guarantee sh startup
8ff267be
PP
1432case "$startsh" in
1433'') startsh=${sharpbang}${sh} ;;
1434*)
760ac839 1435esac
5440bc8e 1436cat >sharp <<EOSS
760ac839
LW
1437$startsh
1438set abc
1439test "$?abc" != 1
1440EOSS
1441
5440bc8e
JH
1442chmod +x sharp
1443$eunicefix sharp
1444if ./sharp; then
8ff267be 1445 : echo "Yup, it does."
760ac839 1446else
dfe9444c
AD
1447 echo "Hmm... '$startsh' does not guarantee sh startup..."
1448 echo "You may have to fix up the shell scripts to make sure $sh runs them."
760ac839 1449fi
5440bc8e 1450rm -f sharp
760ac839 1451
aebf16e7
AD
1452
1453: Save command line options in file UU/cmdline.opt for later use in
1454: generating config.sh.
1455cat > cmdline.opt <<EOSH
1456# Configure command line arguments.
1457config_arg0='$0'
1458config_args='$*'
1459config_argc=$#
1460EOSH
1461argn=1
ee45ea83
IZ
1462args_exp=''
1463args_sep=''
aebf16e7
AD
1464for arg in "$@"; do
1465 cat >>cmdline.opt <<EOSH
1466config_arg$argn='$arg'
1467EOSH
ee45ea83
IZ
1468 # Extreme backslashitis: replace each ' by '"'"'
1469 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1470$arg
1471EOC
1472 arg_exp=`cat cmdl.opt`
1473 args_exp="$args_exp$args_sep'$arg_exp'"
aebf16e7 1474 argn=`expr $argn + 1`
ee45ea83 1475 args_sep=' '
aebf16e7 1476done
ee45ea83
IZ
1477# args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1478# used by ./hints/os2.sh
1479rm -f cmdl.opt
aebf16e7 1480
2304df62
AD
1481: produce awk script to parse command line options
1482cat >options.awk <<'EOF'
1483BEGIN {
02e93a22 1484 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
2304df62
AD
1485
1486 len = length(optstr);
1487 for (i = 1; i <= len; i++) {
1488 c = substr(optstr, i, 1);
1489 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1490 if (a == ":") {
1491 arg[c] = 1;
1492 i++;
1493 }
1494 opt[c] = 1;
1495 }
1496}
1497{
1498 expect = 0;
1499 str = $0;
1500 if (substr(str, 1, 1) != "-") {
1501 printf("'%s'\n", str);
1502 next;
1503 }
1504 len = length($0);
1505 for (i = 2; i <= len; i++) {
1506 c = substr(str, i, 1);
1507 if (!opt[c]) {
1508 printf("-%s\n", substr(str, i));
1509 next;
1510 }
1511 printf("-%s\n", c);
1512 if (arg[c]) {
1513 if (i < len)
1514 printf("'%s'\n", substr(str, i + 1));
1515 else
1516 expect = 1;
1517 next;
1518 }
1519 }
1520}
1521END {
1522 if (expect)
1523 print "?";
1524}
1525EOF
1526
1527: process the command line options
4633a7c4
LW
1528set X `for arg in "$@"; do echo "X$arg"; done |
1529 sed -e s/X// | awk -f options.awk`
2304df62
AD
1530eval "set $*"
1531shift
1532rm -f options.awk
1533
1534: set up default values
1535fastread=''
1536reuseval=false
1537config_sh=''
1538alldone=''
1539error=''
1540silent=''
1541extractsh=''
ecfc5424 1542override=''
16d20bd9 1543knowitall=''
02e93a22 1544rm -f optdef.sh posthint.sh
28757baa
PP
1545cat >optdef.sh <<EOS
1546$startsh
1547EOS
2304df62 1548
dfe9444c 1549
2304df62
AD
1550: option parsing
1551while test $# -gt 0; do
1552 case "$1" in
1553 -d) shift; fastread=yes;;
1554 -e) shift; alldone=cont;;
1555 -f)
1556 shift
1557 cd ..
1558 if test -r "$1"; then
1559 config_sh="$1"
1560 else
a0d0e21e 1561 echo "$me: cannot read config file $1." >&2
2304df62
AD
1562 error=true
1563 fi
1564 cd UU
1565 shift;;
1566 -h) shift; error=true;;
1567 -r) shift; reuseval=true;;
dfe9444c 1568 -s) shift; silent=true; realsilent=true;;
2304df62 1569 -E) shift; alldone=exit;;
16d20bd9 1570 -K) shift; knowitall=true;;
ecfc5424 1571 -O) shift; override=true;;
dfe9444c 1572 -S) shift; silent=true; extractsh=true;;
a0d0e21e
LW
1573 -D)
1574 shift
1575 case "$1" in
1576 *=)
1577 echo "$me: use '-U symbol=', not '-D symbol='." >&2
1578 echo "$me: ignoring -D $1" >&2
1579 ;;
ecfc5424 1580 *=*) echo "$1" | \
1aef975c
AD
1581 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1582 *) echo "$1='define'" >> optdef.sh;;
a0d0e21e
LW
1583 esac
1584 shift
1585 ;;
1586 -U)
1587 shift
1588 case "$1" in
1aef975c 1589 *=) echo "$1" >> optdef.sh;;
a0d0e21e
LW
1590 *=*)
1591 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1592 echo "$me: ignoring -U $1" >&2
1593 ;;
1aef975c 1594 *) echo "$1='undef'" >> optdef.sh;;
a0d0e21e
LW
1595 esac
1596 shift
1597 ;;
02e93a22
JH
1598 -A)
1599 shift
1600 xxx=''
1601 yyy="$1"
02e93a22 1602 zzz=''
5f83a3e9 1603 uuu=undef
02e93a22 1604 case "$yyy" in
f7c31117 1605 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
5f83a3e9
JH
1606 case "$zzz" in
1607 *:*) zzz='' ;;
1608 *) xxx=append
f7c31117
JH
1609 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1610 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
5f83a3e9
JH
1611 esac
1612 ;;
1613 esac
1614 case "$xxx" in
1615 '') case "$yyy" in
f7c31117
JH
1616 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1617 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1618 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1619 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1620 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
1621 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
5f83a3e9
JH
1622 esac
1623 ;;
1624 esac
02e93a22
JH
1625 case "$xxx" in
1626 append)
5f83a3e9 1627 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
02e93a22 1628 clear)
5f83a3e9 1629 echo "$yyy=''" >> posthint.sh ;;
02e93a22
JH
1630 define)
1631 case "$zzz" in
1632 '') zzz=define ;;
1633 esac
5f83a3e9 1634 echo "$yyy='$zzz'" >> posthint.sh ;;
02e93a22 1635 eval)
5f83a3e9 1636 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
02e93a22 1637 prepend)
5f83a3e9 1638 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
02e93a22
JH
1639 undef)
1640 case "$zzz" in
1641 '') zzz="$uuu" ;;
1642 esac
5f83a3e9
JH
1643 echo "$yyy=$zzz" >> posthint.sh ;;
1644 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
02e93a22 1645 esac
bde6b06b 1646 shift
02e93a22 1647 ;;
dfe9444c 1648 -V) echo "$me generated by metaconfig 3.0 PL70." >&2
5f83a3e9 1649 exit 0;;
2304df62 1650 --) break;;
a0d0e21e 1651 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
2304df62
AD
1652 *) break;;
1653 esac
1654done
1655
1656case "$error" in
1657true)
1658 cat >&2 <<EOM
2afac517 1659Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
02e93a22 1660 [-U symbol] [-U symbol=] [-A command:symbol...]
2304df62
AD
1661 -d : use defaults for all answers.
1662 -e : go on without questioning past the production of config.sh.
1663 -f : specify an alternate default configuration file.
1664 -h : print this help message and exit (with an error status).
1665 -r : reuse C symbols value if possible (skips costly nm extraction).
1666 -s : silent mode, only echoes questions and essential information.
a0d0e21e
LW
1667 -D : define symbol to have some value:
1668 -D symbol symbol gets the value 'define'
1669 -D symbol=value symbol gets the value 'value'
2304df62 1670 -E : stop at the end of questions, after having produced config.sh.
16d20bd9 1671 -K : do not use unless you know what you are doing.
ecfc5424 1672 -O : let -D and -U override definitions from loaded configuration file.
2304df62 1673 -S : perform variable substitutions on all .SH files (can mix with -f)
a0d0e21e
LW
1674 -U : undefine symbol:
1675 -U symbol symbol gets the value 'undef'
1676 -U symbol= symbol gets completely empty
02e93a22 1677 -A : manipulate symbol after the platform specific hints have been applied:
5f83a3e9 1678 -A symbol=value append " "value to symbol
02e93a22
JH
1679 -A append:symbol=value append value to symbol
1680 -A define:symbol=value define symbol to have value
02e93a22
JH
1681 -A clear:symbol define symbol to be ''
1682 -A define:symbol define symbol to be 'define'
1683 -A eval:symbol=value define symbol to be eval of value
1684 -A prepend:symbol=value prepend value to symbol
1685 -A undef:symbol define symbol to be 'undef'
1686 -A undef:symbol= define symbol to be ''
2304df62
AD
1687 -V : print version number and exit (with a zero status).
1688EOM
1689 exit 1
1690 ;;
1691esac
1692
dfe9444c
AD
1693: Sanity checks
1694case "$fastread$alldone" in
1695yescont|yesexit) ;;
1696*)
aaeb8e51
GS
1697 case "$extractsh" in
1698 true) ;;
1699 *)
1700 if test ! -t 0; then
1701 echo "Say 'sh Configure', not 'sh <Configure'"
1702 exit 1
1703 fi
1704 ;;
1705 esac
dfe9444c
AD
1706 ;;
1707esac
1708
2304df62
AD
1709exec 4>&1
1710case "$silent" in
1711true) exec 1>/dev/null;;
1712esac
1713
ecfc5424 1714: run the defines and the undefines, if any, but leave the file out there...
1aef975c
AD
1715touch optdef.sh
1716. ./optdef.sh
02e93a22
JH
1717: create the posthint manipulation script and leave the file out there...
1718touch posthint.sh
a0d0e21e 1719
2304df62 1720: set package name
85e6fe83 1721package=perl5
b4eb6b3d
JH
1722first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1723last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1724case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1725ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1726*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1727esac
2304df62 1728
2304df62
AD
1729: Some greps do not return status, grrr.
1730echo "grimblepritz" >grimble
1731if grep blurfldyick grimble >/dev/null 2>&1 ; then
1732 contains=contains
1733elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1734 contains=grep
1735else
1736 contains=contains
1737fi
1738rm -f grimble
1739: the following should work in any shell
1740case "$contains" in
1741contains*)
1742 echo " "
1743 echo "AGH! Grep doesn't return a status. Attempting remedial action."
1744 cat >contains <<'EOSS'
1745grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1746EOSS
1747chmod +x contains
1748esac
1749
dfe9444c
AD
1750: Find the path to the source tree
1751case "$src" in
1752'') case "$0" in
b233458b
JH
1753 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1754 case "$src" in
1755 /*) ;;
8504afb7 1756 .) ;;
b233458b
JH
1757 *) src=`cd ../$src && pwd` ;;
1758 esac
1759 ;;
dfe9444c
AD
1760 *) src='.';;
1761 esac;;
1762esac
1763case "$src" in
1764'') src=/
1765 rsrc=/
1766 ;;
1767/*) rsrc="$src";;
1768*) rsrc="../$src";;
1769esac
1770if test -f $rsrc/Configure && \
1771 $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1772then
1773 : found it, so we are ok.
1774else
1775 rsrc=''
1776 for src in . .. ../.. ../../.. ../../../..; do
1777 if test -f ../$src/Configure && \
1778 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1779 then
1780 rsrc=../$src
1781 break
1782 fi
1783 done
1784fi
1785case "$rsrc" in
1786'')
1787 cat <<EOM >&4
1788
1789Sorry, I can't seem to locate the source dir for $package. Please start
1790Configure with an explicit path -- i.e. /some/path/Configure.
1791
1792EOM
1793 exit 1
1794 ;;
1795../.) rsrc='..';;
1796*)
1797 echo " "
1798 echo "Sources for $package found in \"$src\"." >&4
1799 ;;
1800esac
1801
1802: script used to extract .SH files with variable substitutions
1803cat >extract <<'EOS'
a02608de 1804PERL_CONFIG_SH=true
dfe9444c 1805echo "Doing variable substitutions on .SH files..."
24ccb310
JH
1806if test -f MANIFEST; then
1807 set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
dfe9444c
AD
1808else
1809 echo "(Looking for .SH files under the source directory.)"
6904989c 1810 set x `(cd "$src"; find . -name "*.SH" -print)`
dfe9444c
AD
1811fi
1812shift
1813case $# in
6904989c 18140) set x `(cd "$src"; echo *.SH)`; shift;;
dfe9444c 1815esac
6904989c 1816if test ! -f "$src/$1"; then
dfe9444c
AD
1817 shift
1818fi
1819mkdir_p='
1820name=$1;
1821create="";
1822while test $name; do
1823 if test ! -d "$name"; then
1824 create="$name $create";
1825 name=`echo $name | sed -e "s|^[^/]*$||"`;
1826 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1827 else
1828 name="";
1829 fi;
1830done;
1831for file in $create; do
1832 mkdir $file;
1833done
1834'
1835for file in $*; do
1836 case "$src" in
1837 ".")
1838 case "$file" in
1839 */*)
1840 dir=`expr X$file : 'X\(.*\)/'`
1841 file=`expr X$file : 'X.*/\(.*\)'`
6904989c 1842 (cd "$dir" && . ./$file)
dfe9444c
AD
1843 ;;
1844 *)
1845 . ./$file
1846 ;;
1847 esac
1848 ;;
1849 *)
1850 case "$file" in
1851 */*)
1852 dir=`expr X$file : 'X\(.*\)/'`
1853 file=`expr X$file : 'X.*/\(.*\)'`
1854 (set x $dir; shift; eval $mkdir_p)
6904989c 1855 sh <"$src/$dir/$file"
dfe9444c
AD
1856 ;;
1857 *)
6904989c 1858 sh <"$src/$file"
dfe9444c
AD
1859 ;;
1860 esac
1861 ;;
1862 esac
1863done
6904989c 1864if test -f "$src/config_h.SH"; then
dfe9444c
AD
1865 if test ! -f config.h; then
1866 : oops, they left it out of MANIFEST, probably, so do it anyway.
6904989c 1867 . "$src/config_h.SH"
dfe9444c
AD
1868 fi
1869fi
1870EOS
1871
1872: extract files and exit if asked to do so
1873case "$extractsh" in
1874true)
1875 case "$realsilent" in
1876 true) ;;
1877 *) exec 1>&4;;
1878 esac
1879 case "$config_sh" in
1880 '') config_sh='config.sh';;
1881 esac
1882 echo " "
1883 echo "Fetching answers from $config_sh..."
1884 cd ..
1885 . $config_sh
1886 test "$override" && . ./optdef.sh
1887 echo " "
1888 . UU/extract
1889 rm -rf UU
24ccb310 1890 echo "Extraction done."
dfe9444c
AD
1891 exit 0
1892 ;;
1893esac
1894
1895: Eunice requires " " instead of "", can you believe it
1896echo " "
1897: Here we go...
1898echo "Beginning of configuration questions for $package."
1899
1900trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1901
2304df62
AD
1902: first determine how to suppress newline on echo command
1903echo " "
1904echo "Checking echo to see how to suppress newlines..."
1905(echo "hi there\c" ; echo " ") >.echotmp
1906if $contains c .echotmp >/dev/null 2>&1 ; then
1907 echo "...using -n."
1908 n='-n'
1909 c=''
1910else
1911 cat <<'EOM'
1912...using \c
1913EOM
1914 n=''
1915 c='\c'
1916fi
1917echo $n "The star should be here-->$c"
1918echo '*'
1919rm -f .echotmp
1920
1921: Now test for existence of everything in MANIFEST
1922echo " "
6904989c 1923if test -f "$rsrc/MANIFEST"; then
2304df62 1924 echo "First let's make sure your kit is complete. Checking..." >&4
4242830c 1925 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
2304df62 1926 rm -f missing
dfe9444c 1927 tmppwd=`pwd`
2304df62 1928 for filelist in x??; do
6904989c 1929 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
2304df62
AD
1930 done
1931 if test -s missing; then
1932 cat missing >&4
1933 cat >&4 <<'EOM'
1934
1935THIS PACKAGE SEEMS TO BE INCOMPLETE.
1936
1937You have the option of continuing the configuration process, despite the
1938distinct possibility that your kit is damaged, by typing 'y'es. If you
1939do, don't blame me if something goes wrong. I advise you to type 'n'o
7f2de2d2 1940and contact the author (perlbug@perl.org).
2304df62
AD
1941
1942EOM
1943 echo $n "Continue? [n] $c" >&4
1944 read ans
1945 case "$ans" in
1946 y*)
1947 echo "Continuing..." >&4
1948 rm -f missing
1949 ;;
1950 *)
1951 echo "ABORTING..." >&4
1952 kill $$
1953 ;;
1954 esac
1955 else
dfe9444c 1956 echo "Looks good..."
2304df62
AD
1957 fi
1958else
1959 echo "There is no MANIFEST file. I hope your kit is complete !"
1960fi
1961rm -f missing x??
1962
5ff3f7a4
GS
1963echo " "
1964: Find the appropriate value for a newline for tr
1965if test -n "$DJGPP"; then
1966 trnl='\012'
1967fi
1968if test X"$trnl" = X; then
1969 case "`echo foo|tr '\n' x 2>/dev/null`" in
1970 foox) trnl='\n' ;;
1971 esac
1972fi
1973if test X"$trnl" = X; then
1974 case "`echo foo|tr '\012' x 2>/dev/null`" in
1975 foox) trnl='\012' ;;
1976 esac
1977fi
1978if test X"$trnl" = X; then
8be2c24c
JH
1979 case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1980 fooxy) trnl='\n\r' ;;
1981 esac
1982fi
1983if test X"$trnl" = X; then
5ff3f7a4
GS
1984 cat <<EOM >&2
1985
1986$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1987
1988EOM
1989 exit 1
1990fi
1991
2304df62
AD
1992: compute the number of columns on the terminal for proper question formatting
1993case "$COLUMNS" in
1994'') COLUMNS='80';;
1995esac
1996
1997: set up the echo used in my read
1998myecho="case \"\$xxxm\" in
1999'') echo $n \"\$rp $c\" >&4;;
2000*) case \"\$rp\" in
2001 '') echo $n \"[\$xxxm] $c\";;
2002 *)
2003 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
2004 echo \"\$rp\" >&4
2005 echo $n \"[\$xxxm] $c\" >&4
2006 else
2007 echo $n \"\$rp [\$xxxm] $c\" >&4
2008 fi
2009 ;;
2010 esac;;
2011esac"
2012
2013: now set up to do reads with possible shell escape and default assignment
2014cat <<EOSC >myread
28757baa 2015$startsh
2304df62
AD
2016xxxm=\$dflt
2017$myecho
2018ans='!'
2019case "\$fastread" in
2020yes) case "\$dflt" in
2021 '') ;;
2022 *) ans='';
2023 case "\$silent-\$rp" in
2024 true-) ;;
2025 *) echo " " >&4;;
2026 esac;;
2027 esac;;
2028*) case "\$silent" in
2029 true) case "\$rp" in
2030 '') ans='';;
2031 esac;;
2032 esac;;
2033esac
2034while expr "X\$ans" : "X!" >/dev/null; do
2035 read answ
2036 set x \$xxxm
2037 shift
dfe9444c 2038 aok=''; eval "ans=\\"\$answ\\"" && aok=y
2304df62 2039 case "\$answ" in
dfe9444c
AD
2040 "!")
2041 sh 1>&4
2042 echo " "
2043 $myecho
2044 ;;
2045 !*)
2046 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2047 shift
2048 sh 1>&4 -c "\$*"
2049 echo " "
2050 $myecho
2051 ;;
2304df62
AD
2052 "\$ans")
2053 case "\$ans" in
ecfc5424
AD
2054 \\&*)
2055 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2056 shift
2057 case "\$1" in
2058 -d)
2059 fastread=yes
40a7a20a 2060 echo "(OK, I'll run with -d after this question.)" >&4
ecfc5424
AD
2061 ;;
2062 -*)
40a7a20a 2063 echo "*** Sorry, \$1 not supported yet." >&4
ecfc5424
AD
2064 ;;
2065 esac
2066 $myecho
2067 ans=!
2068 ;;
2304df62
AD
2069 esac;;
2070 *)
2071 case "\$aok" in
2072 y)
2073 echo "*** Substitution done -- please confirm."
2074 xxxm="\$ans"
c9795ab7 2075 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2304df62
AD
2076 xxxm="\$ans"
2077 ans=!
2078 ;;
2079 *)
2080 echo "*** Error -- try again."
2081 ans=!
2082 ;;
2083 esac
2084 $myecho
2085 ;;
2086 esac
2087 case "\$ans\$xxxm\$nostick" in
2088 '')
2089 ans=!
2090 $myecho
2091 ;;
2092 esac
2093done
2094case "\$ans" in
2095'') ans="\$xxxm";;
2096esac
2097EOSC
2098
2099: create .config dir to save info across Configure sessions
2100test -d ../.config || mkdir ../.config
2101cat >../.config/README <<EOF
2102This directory created by Configure to save information that should
dfe9444c 2103persist across sessions for $package.
2304df62
AD
2104
2105You may safely delete it if you wish.
2106EOF
2107
9507cadf 2108xversion=`awk '/define[ ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
af960fef 2109case "$usedevel" in
0107c034 2110$define|true|[yY]*) ;;
9507cadf 2111*) case "$xversion" in
0107c034
JH
2112 *[13579])
2113 cat >&4 <<EOH
2114*** WHOA THERE!!! ***
2115
2116 This is an UNSTABLE DEVELOPMENT release.
9507cadf
JH
2117 The version of this $package distribution is $xversion, that is, odd,
2118 (as opposed to even) and that signifies a development release.
3d5d58b1 2119 If you want a maintenance release, you want an even-numbered version.
0107c034
JH
2120
2121 Do ***NOT*** install this into production use.
2122 Data corruption and crashes are possible.
2123
2124 It is most seriously suggested that you do not continue any further
2125 unless you want to help in developing and debugging Perl.
2126
6adc6a45
JH
2127 If you *still* want to build perl, you can answer 'y' now,
2128 or pass -Dusedevel to Configure.
2129
0107c034
JH
2130EOH
2131 rp='Do you really want to continue?'
2132 dflt='n'
2133 . ./myread
2134 case "$ans" in
8feeef0e
JH
2135 [yY]) echo >&4 "Okay, continuing."
2136 usedevel="$define" ;;
0107c034
JH
2137 *) echo >&4 "Okay, bye."
2138 exit 1
2139 ;;
2140 esac
2141 ;;
2142 esac
2143 ;;
2144esac
8feeef0e
JH
2145case "$usedevel" in
2146$define|true|[yY]*)
2147 case "$versiononly" in
2148 '') versiononly="$define" ;;
2149 esac
2150 case "$installusrbinperl" in
2151 '') installusrbinperl="$undef" ;;
2152 esac
2153 ;;
2154esac
0107c034 2155
2304df62
AD
2156: general instructions
2157needman=true
2158firsttime=true
760ac839 2159user=`(logname) 2>/dev/null`
dfe9444c
AD
2160case "$user" in
2161'') user=`whoami 2>&1`;;
760ac839 2162esac
2304df62
AD
2163if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2164 firsttime=false
2165 echo " "
2166 rp='Would you like to see the instructions?'
2167 dflt=n
2168 . ./myread
2169 case "$ans" in
2170 [yY]*) ;;
2171 *) needman=false;;
2172 esac
2173fi
2174if $needman; then
2175 cat <<EOH
4e2a5f63 2176
2304df62 2177This installation shell script will examine your system and ask you questions
a0d0e21e 2178to determine how the perl5 package should be installed. If you get
2304df62
AD
2179stuck on a question, you may use a ! shell escape to start a subshell or
2180execute a command. Many of the questions will have default answers in square
2181brackets; typing carriage return will give you the default.
2182
2183On some of the questions which ask for file or directory names you are allowed
2184to use the ~name construct to specify the login directory belonging to "name",
2185even if you don't have a shell which knows about that. Questions where this is
2186allowed will be marked "(~name ok)".
2187
2188EOH
2189 rp=''
2190 dflt='Type carriage return to continue'
2191 . ./myread
2192 cat <<'EOH'
2193
2194The prompter used in this script allows you to use shell variables and
2195backticks in your answers. You may use $1, $2, etc... to refer to the words
2196in the default answer, as if the default line was a set of arguments given to a
2197script shell. This means you may also use $* to repeat the whole default line,
2198so you do not have to re-type everything to add something to the default.
2199
2200Everytime there is a substitution, you will have to confirm. If there is an
2201error (e.g. an unmatched backtick), the default answer will remain unchanged
2202and you will be prompted again.
2203
2204If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
2205the questions and use the computed defaults (or the previous answers if there
2206was already a config.sh file). Type 'Configure -h' for a list of options.
ecfc5424 2207You may also start interactively and then answer '& -d' at any prompt to turn
dfe9444c 2208on the non-interactive behaviour for the remainder of the execution.
2304df62
AD
2209
2210EOH
2211 . ./myread
2212 cat <<EOH
2213
2214Much effort has been expended to ensure that this shell script will run on any
2215Unix system. If despite that it blows up on yours, your best bet is to edit
40000a8c
AD
2216Configure and run it again. If you can't run Configure for some reason,
2217you'll have to generate a config.sh file by hand. Whatever problems you
7f2de2d2 2218have, let me (perlbug@perl.org) know how I blew it.
2304df62
AD
2219
2220This installation script affects things in two ways:
2221
22221) it may do direct variable substitutions on some of the files included
2223 in this kit.
22242) it builds a config.h file for inclusion in C programs. You may edit
2225 any of these files as the need arises after running this script.
2226
2227If you make a mistake on a question, there is no easy way to back up to it
2228currently. The easiest thing to do is to edit config.sh and rerun all the SH
2229files. Configure will offer to let you do this before it runs the SH files.
2230
2231EOH
2232 dflt='Type carriage return to continue'
2233 . ./myread
2234 case "$firsttime" in
2235 true) echo $user >>../.config/instruct;;
2236 esac
2237fi
2238
2304df62
AD
2239: find out where common programs are
2240echo " "
2241echo "Locating common programs..." >&4
2242cat <<EOSC >loc
2243$startsh
2244case \$# in
22450) exit 1;;
2246esac
2247thing=\$1
2248shift
2249dflt=\$1
2250shift
2251for dir in \$*; do
2252 case "\$thing" in
2253 .)
2254 if test -d \$dir/\$thing; then
2255 echo \$dir
2256 exit 0
2257 fi
2258 ;;
2259 *)
a0d0e21e 2260 for thisthing in \$dir/\$thing; do
ecfc5424 2261 : just loop through to pick last item
a0d0e21e 2262 done
25f94b33 2263 if test -f \$thisthing; then
a0d0e21e 2264 echo \$thisthing
2304df62 2265 exit 0
a5a94ea5
JH
2266 elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2267 echo \$thisthing
2268 exit 0
2304df62 2269 elif test -f \$dir/\$thing.exe; then
c4f23d77
AD
2270 if test -n "$DJGPP"; then
2271 echo \$dir/\$thing.exe
b921d661 2272 elif test "$eunicefix" != ":"; then
c4f23d77
AD
2273 : on Eunice apparently
2274 echo \$dir/\$thing
b921d661 2275 exit 0
c4f23d77 2276 fi
2d736872 2277 exit 0
2304df62
AD
2278 fi
2279 ;;
2280 esac
2281done
2282echo \$dflt
2283exit 1
2284EOSC
2285chmod +x loc
2286$eunicefix loc
2287loclist="
2288awk
2289cat
f8006fac 2290chmod
b4eb6b3d
JH
2291comm
2292cp
2304df62
AD
2293echo
2294expr
2295grep
a0d0e21e 2296ls
b4eb6b3d 2297mkdir
2304df62
AD
2298rm
2299sed
b4eb6b3d 2300sort
85e6fe83 2301touch
2304df62 2302tr
b4eb6b3d 2303uniq
2304df62
AD
2304"
2305trylist="
2306Mcc
dfe9444c 2307ar
3659ebf1 2308bison
b4eb6b3d 2309byacc
2304df62 2310cpp
b4eb6b3d 2311csh
2304df62
AD
2312date
2313egrep
1fef16b3 2314gmake
8ff267be 2315gzip
b4eb6b3d 2316less
8ff267be 2317ln
3c728e00 2318make
b4eb6b3d 2319more
693762b4 2320nm
b4eb6b3d
JH
2321nroff
2322pg
2304df62
AD
2323test
2324uname
8ff267be 2325zip
2304df62 2326"
8e07c86e 2327pth=`echo $PATH | sed -e "s/$p_/ /g"`
2304df62
AD
2328pth="$pth /lib /usr/lib"
2329for file in $loclist; do
dfe9444c
AD
2330 eval xxx=\$$file
2331 case "$xxx" in
2332 /*|?:[\\/]*)
2333 if test -f "$xxx"; then
2334 : ok
2335 else
2336 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2337 xxx=`./loc $file $file $pth`
2338 fi
2339 ;;
2340 '') xxx=`./loc $file $file $pth`;;
2341 *) xxx=`./loc $xxx $xxx $pth`;;
2342 esac
a5a94ea5 2343 eval $file=$xxx$_exe
2304df62
AD
2344 eval _$file=$xxx
2345 case "$xxx" in
2346 /*)
2347 echo $file is in $xxx.
2348 ;;
8e07c86e
AD
2349 ?:[\\/]*)
2350 echo $file is in $xxx.
2351 ;;
2304df62 2352 *)
25f94b33
AD
2353 echo "I don't know where '$file' is, and my life depends on it." >&4
2354 echo "Go find a public domain implementation or fix your PATH setting!" >&4
4633a7c4 2355 exit 1
2304df62
AD
2356 ;;
2357 esac
2358done
2359echo " "
2360echo "Don't worry if any of the following aren't found..."
2361say=offhand
2362for file in $trylist; do
dfe9444c
AD
2363 eval xxx=\$$file
2364 case "$xxx" in
2365 /*|?:[\\/]*)
2366 if test -f "$xxx"; then
2367 : ok
2368 else
2369 echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2370 xxx=`./loc $file $file $pth`
2371 fi
2372 ;;
2373 '') xxx=`./loc $file $file $pth`;;
2374 *) xxx=`./loc $xxx $xxx $pth`;;
2375 esac
306a8474 2376 eval $file=$xxx$_exe
2304df62
AD
2377 eval _$file=$xxx
2378 case "$xxx" in
2379 /*)
2380 echo $file is in $xxx.
2381 ;;
8e07c86e
AD
2382 ?:[\\/]*)
2383 echo $file is in $xxx.
2384 ;;
2304df62
AD
2385 *)
2386 echo "I don't see $file out there, $say."
2387 say=either
2388 ;;
2389 esac
2390done
2391case "$egrep" in
1fef16b3 2392egrep)
2304df62
AD
2393 echo "Substituting grep for egrep."
2394 egrep=$grep
868439a2 2395 _egrep=$grep
2304df62
AD
2396 ;;
2397esac
8ff267be 2398case "$ln" in
1fef16b3 2399ln)
8ff267be
PP
2400 echo "Substituting cp for ln."
2401 ln=$cp
868439a2 2402 _ln=$cp
8ff267be
PP
2403 ;;
2404esac
2e26f1d5
JH
2405case "$make" in
2406make)
2407 case "$gmake" in
2408 gmake)
2409 echo "I can't find make or gmake, and my life depends on it." >&4
2410 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2411 exit 1
2412 ;;
2413 esac
2414 ;;
2415esac
2416case "$gmake" in
2417gmake) ;;
2418*) # We can't have osname yet.
1fef16b3
JH
2419 if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2420 # Assume that gmake, if found, is definitely GNU make
2421 # and prefer it over the system make.
2422 echo "Substituting gmake for make."
2423 make=$gmake
868439a2 2424 _make=$gmake
1fef16b3
JH
2425 fi
2426 ;;
a5a94ea5 2427esac
2304df62
AD
2428case "$test" in
2429test)
2430 echo "Hopefully test is built into your sh."
2431 ;;
2432*)
73614538 2433 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
5d644a95 2434 echo "Using the test built into your sh."
2304df62
AD
2435 test=test
2436 _test=test
2437 fi
2438 ;;
2439esac
2440case "$echo" in
2441echo)
2442 echo "Hopefully echo is built into your sh."
2443 ;;
2444'') ;;
2445*)
2446 echo " "
2447echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2448 $echo $n "hi there$c" >foo1
2449 echo $n "hi there$c" >foo2
2450 if cmp foo1 foo2 >/dev/null 2>&1; then
2451 echo "They are compatible. In fact, they may be identical."
2452 else
2453 case "$n" in
2454 '-n') n='' c='\c';;
2455 *) n='-n' c='';;
2456 esac
2457 cat <<FOO
2458They are not compatible! You are probably running ksh on a non-USG system.
2459I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2460have echo built in and we may have to run some Bourne shell scripts. That
2461means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
2462
2463FOO
2464 $echo $n "The star should be here-->$c"
2465 $echo "*"
2466 fi
2467 $rm -f foo1 foo2
2468 ;;
2469esac
2470
6b769f8f 2471cat <<EOS >trygcc
2573c5f9
JH
2472$startsh
2473EOS
6b769f8f 2474cat <<'EOSC' >>trygcc
2573c5f9
JH
2475case "$cc" in
2476'') ;;
2477*) $rm -f try try.*
2478 $cat >try.c <<EOM
2479int main(int argc, char *argv[]) {
2480 return 0;
2481}
2482EOM
e4778687 2483 if $cc -o try $ccflags $ldflags try.c; then
2573c5f9
JH
2484 :
2485 else
2486 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2487 despair=yes
2488 trygcc=yes
2489 case "$cc" in
2490 *gcc*) trygcc=no ;;
2491 esac
2492 case "`$cc -v -c try.c 2>&1`" in
2493 *gcc*) trygcc=no ;;
2494 esac
2495 if $test X"$trygcc" = Xyes; then
2496 if gcc -o try -c try.c; then
2497 echo " "
2498 echo "You seem to have a working gcc, though." >&4
2499 rp="Would you like to use it?"
2500 dflt=y
2501 if $test -f myread; then
2502 . ./myread
2503 else
2504 if $test -f UU/myread; then
2505 . ./UU/myread
2506 else
2507 echo "Cannot find myread, sorry. Aborting." >&2
2508 exit 1
2509 fi
2510 fi
2511 case "$ans" in
6371411c
RB
2512 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2513 if $test -f usethreads.cbu; then
2514 $cat >&4 <<EOM
2515
2516*** However, any setting of the C compiler flags (e.g. for thread support)
2517*** has been lost. It may be necessary to pass -Dcc=gcc to Configure
2518*** (together with e.g. -Dusethreads).
2519
2520EOM
2521 fi;;
2573c5f9
JH
2522 esac
2523 fi
2524 fi
6b769f8f
RB
2525 fi
2526 $rm -f try try.*
2527 ;;
2528esac
2529EOSC
2530
2531cat <<EOS >checkcc
2532$startsh
2533EOS
2534cat <<'EOSC' >>checkcc
2535case "$cc" in
2536'') ;;
2537*) $rm -f try try.*
2538 $cat >try.c <<EOM
2539int main(int argc, char *argv[]) {
2540 return 0;
2541}
2542EOM
2543 if $cc -o try $ccflags $ldflags try.c; then
2544 :
2545 else
2573c5f9 2546 if $test X"$despair" = Xyes; then
6b769f8f
RB
2547 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2548 fi
2549 $cat >&4 <<EOM
5dd4fbdf
MB
2550You need to find a working C compiler.
2551Either (purchase and) install the C compiler supplied by your OS vendor,
2552or for a free C compiler try http://gcc.gnu.org/
2553I cannot continue any further, aborting.
2554EOM
6b769f8f 2555 exit 1
2573c5f9
JH
2556 fi
2557 $rm -f try try.*
2558 ;;
2559esac
2560EOSC
2561
a0d0e21e
LW
2562: determine whether symbolic links are supported
2563echo " "
2564$touch blurfl
2565if $ln -s blurfl sym > /dev/null 2>&1 ; then
2566 echo "Symbolic links are supported." >&4
818f00be 2567 lns="$ln -s"
a0d0e21e
LW
2568else
2569 echo "Symbolic links are NOT supported." >&4
2570 lns="$ln"
2571fi
2572$rm -f blurfl sym
2573
dafca956
JH
2574: determine whether symbolic links are supported
2575echo " "
2576case "$lns" in
18ea2752 2577*"ln"*" -s")
dafca956
JH
2578 echo "Checking how to test for symbolic links..." >&4
2579 $lns blurfl sym
4b661809 2580 if $test "X$issymlink" = X; then
2e2a97a6
JH
2581 case "$newsh" in
2582 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2583 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2584 esac
5d644a95
MB
2585 if test $? = 0; then
2586 issymlink="test -h"
2e2a97a6
JH
2587 else
2588 echo "Your builtin 'test -h' may be broken." >&4
2589 case "$test" in
2590 /*) ;;
2591 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
2592 for p in $pth
2593 do
2594 if test -f "$p/$test"; then
2595 test="$p/$test"
2596 break
2597 fi
2598 done
2599 ;;
2600 esac
2601 case "$test" in
2602 /*)
2603 echo "Trying external '$test -h'." >&4
2604 issymlink="$test -h"
2605 if $test ! -h sym >/dev/null 2>&1; then
3c728e00 2606 echo "External '$test -h' is broken, too." >&4
2e2a97a6
JH
2607 issymlink=''
2608 fi
2609 ;;
2610 *) issymlink='' ;;
2611 esac
5d644a95
MB
2612 fi
2613 fi
4b661809 2614 if $test "X$issymlink" = X; then
dafca956 2615 if $test -L sym 2>/dev/null; then
5d644a95 2616 issymlink="$test -L"
2e2a97a6 2617 echo "The builtin '$test -L' worked." >&4
dafca956
JH
2618 fi
2619 fi
4b661809 2620 if $test "X$issymlink" != X; then
5d644a95 2621 echo "You can test for symbolic links with '$issymlink'." >&4
dafca956
JH
2622 else
2623 echo "I do not know how you can test for symbolic links." >&4
2624 fi
2625 $rm -f blurfl sym
2626 ;;
2627*) echo "No symbolic links, so not testing for their testing..." >&4
2628 ;;
2629esac
2630echo " "
2631
2632
2633case "$mksymlinks" in
2634$define|true|[yY]*)
2635 case "$src" in
2636 ''|'.') echo "Cannot create symlinks in the original directory." >&4
2637 exit 1
2638 ;;
4b661809 2639 *) case "$lns:$issymlink" in
f314eb9f 2640 *"ln"*" -s:"*"test -"?)
dafca956
JH
2641 echo "Creating the symbolic links..." >&4
2642 echo "(First creating the subdirectories...)" >&4
2643 cd ..
2644 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2645 read directory
2646 test -z "$directory" && break
2647 mkdir -p $directory
2648 done
2649 # Sanity check 1.
2650 if test ! -d t/base; then
2651 echo "Failed to create the subdirectories. Aborting." >&4
2652 exit 1
2653 fi
2654 echo "(Then creating the symlinks...)" >&4
2655 awk '{print $1}' $src/MANIFEST | while true; do
2656 read filename
2657 test -z "$filename" && break
2658 if test -f $filename; then
5d644a95 2659 if $issymlink $filename; then
dafca956
JH
2660 rm -f $filename
2661 fi
2662 fi
2663 if test -f $filename; then
2664 echo "$filename already exists, not symlinking."
2665 else
2666 ln -s $src/$filename $filename
2667 fi
2668 done
2669 # Sanity check 2.
a0d24b8a
JH
2670 if test ! -f t/base/lex.t; then
2671 echo "Failed to create the symlinks (t/base/lex.t missing). Aborting." >&4
dafca956
JH
2672 exit 1
2673 fi
2674 cd UU
2675 ;;
2676 *) echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2677 ;;
2678 esac
2679 ;;
2680 esac
2681 ;;
2682esac
2683
5440bc8e
JH
2684
2685case "$usecrosscompile" in
2686$define|true|[yY]*)
93bc48fa 2687 $echo "Cross-compiling..."
5440bc8e
JH
2688 croak=''
2689 case "$cc" in
2690 *-*-gcc) # A cross-compiling gcc, probably.
93bc48fa 2691 targetarch=`$echo $cc|$sed 's/-gcc$//'`
5440bc8e
JH
2692 ar=$targetarch-ar
2693 # leave out ld, choosing it is more complex
2694 nm=$targetarch-nm
2695 ranlib=$targetarch-ranlib
93bc48fa 2696 $echo 'extern int foo;' > try.c
f8006fac 2697 set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
93bc48fa
JH
2698 shift
2699 if $test $# -gt 0; then
2700 incpth="$incpth $*"
f8006fac
JH
2701 incpth="`$echo $incpth|$sed 's/^ //'`"
2702 echo "Guessing incpth '$incpth'." >&4
93bc48fa 2703 for i in $*; do
f8006fac 2704 j="`$echo $i|$sed 's,/include$,/lib,'`"
93bc48fa
JH
2705 if $test -d $j; then
2706 libpth="$libpth $j"
2707 fi
2708 done
f8006fac
JH
2709 libpth="`$echo $libpth|$sed 's/^ //'`"
2710 echo "Guessing libpth '$libpth'." >&4
93bc48fa
JH
2711 fi
2712 $rm -f try.c
5440bc8e
JH
2713 ;;
2714 esac
2715 case "$targetarch" in
93bc48fa
JH
2716 '') echo "Targetarch not defined." >&4; croak=y ;;
2717 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e
JH
2718 esac
2719 case "$incpth" in
93bc48fa 2720 '') echo "Incpth not defined." >&4; croak=y ;;
f8006fac 2721 *) echo "Using incpth '$incpth'." >&4 ;;
5440bc8e
JH
2722 esac
2723 case "$libpth" in
93bc48fa 2724 '') echo "Libpth not defined." >&4; croak=y ;;
f8006fac 2725 *) echo "Using libpth '$libpth'." >&4 ;;
5440bc8e 2726 esac
93bc48fa
JH
2727 case "$usrinc" in
2728 '') for i in $incpth; do
2729 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2730 usrinc=$i
2731 echo "Guessing usrinc $usrinc." >&4
2732 break
2733 fi
2734 done
2735 case "$usrinc" in
2736 '') echo "Usrinc not defined." >&4; croak=y ;;
2737 esac
2738 ;;
2739 *) echo "Using usrinc $usrinc." >&4 ;;
5440bc8e 2740 esac
93bc48fa
JH
2741 case "$targethost" in
2742 '') echo "Targethost not defined." >&4; croak=y ;;
2743 *) echo "Using targethost $targethost." >&4
5440bc8e 2744 esac
93bc48fa
JH
2745 locincpth=' '
2746 loclibpth=' '
5440bc8e 2747 case "$croak" in
93bc48fa 2748 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e
JH
2749 esac
2750 case "$src" in
2751 /*) run=$src/Cross/run
93c0359c 2752 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2753 to=$src/Cross/to
2754 from=$src/Cross/from
2755 ;;
93bc48fa 2756 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2757 run=$pwd/Cross/run
f8006fac 2758 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2759 to=$pwd/Cross/to
2760 from=$pwd/Cross/from
2761 ;;
2762 esac
2763 case "$targetrun" in
2764 '') targetrun=ssh ;;
2765 esac
2766 case "$targetto" in
2767 '') targetto=scp ;;
2768 esac
2769 case "$targetfrom" in
2770 '') targetfrom=scp ;;
2771 esac
2772 run=$run-$targetrun
2773 to=$to-$targetto
2774 from=$from-$targetfrom
93bc48fa
JH
2775 case "$targetdir" in
2776 '') targetdir=/tmp
2777 echo "Guessing targetdir $targetdir." >&4
2778 ;;
2779 esac
5440bc8e 2780 case "$targetuser" in
93bc48fa
JH
2781 '') targetuser=root
2782 echo "Guessing targetuser $targetuser." >&4
2783 ;;
5440bc8e
JH
2784 esac
2785 case "$targetfrom" in
2786 scp) q=-q ;;
2787 *) q='' ;;
2788 esac
2789 case "$targetrun" in
2790 ssh|rsh)
2791 cat >$run <<EOF
2792#!/bin/sh
93c0359c
JH
2793case "\$1" in
2794-cwd)
2795 shift
2796 cwd=\$1
2797 shift
2798 ;;
2799esac
2800case "\$cwd" in
2801'') cwd=$targetdir ;;
2802esac
5440bc8e
JH
2803exe=\$1
2804shift
93c0359c
JH
2805if $test ! -f \$exe.xok; then
2806 $to \$exe
2807 $touch \$exe.xok
2808fi
2809$targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
5440bc8e
JH
2810EOF
2811 ;;
93bc48fa 2812 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
2813 exit 1
2814 ;;
2815 esac
93c0359c
JH
2816 case "$targetmkdir" in
2817 */Cross/mkdir)
2818 cat >$targetmkdir <<EOF
2819#!/bin/sh
2820$targetrun -l $targetuser $targethost "mkdir -p \$@"
2821EOF
f8006fac 2822 $chmod a+rx $targetmkdir
93c0359c
JH
2823 ;;
2824 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
2825 exit 1
2826 ;;
2827 esac
5440bc8e
JH
2828 case "$targetto" in
2829 scp|rcp)
2830 cat >$to <<EOF
2831#!/bin/sh
2832for f in \$@
2833do
93c0359c
JH
2834 case "\$f" in
2835 /*)
2836 $targetmkdir \`dirname \$f\`
2837 $targetto $q \$f $targetuser@$targethost:\$f || exit 1
2838 ;;
2839 *)
2840 $targetmkdir $targetdir/\`dirname \$f\`
2841 $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2842 ;;
2843 esac
5440bc8e
JH
2844done
2845exit 0
2846EOF
2847 ;;
2848 cp) cat >$to <<EOF
2849#!/bin/sh
93c0359c
JH
2850for f in \$@
2851do
2852 case "\$f" in
2853 /*)
2854 $mkdir -p $targetdir/\`dirname \$f\`
2855 $cp \$f $targetdir/\$f || exit 1
2856 ;;
2857 *)
2858 $targetmkdir $targetdir/\`dirname \$f\`
2859 $cp \$f $targetdir/\$f || exit 1
2860 ;;
2861 esac
2862done
2863exit 0
5440bc8e
JH
2864EOF
2865 ;;
93bc48fa 2866 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
2867 exit 1
2868 ;;
2869 esac
2870 case "$targetfrom" in
2871 scp|rcp)
2872 cat >$from <<EOF
2873#!/bin/sh
2874for f in \$@
2875do
93c0359c 2876 $rm -f \$f
5440bc8e
JH
2877 $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2878done
2879exit 0
2880EOF
2881 ;;
2882 cp) cat >$from <<EOF
2883#!/bin/sh
2884for f in \$@
2885do
93c0359c 2886 $rm -f \$f
5440bc8e
JH
2887 cp $targetdir/\$f . || exit 1
2888done
2889exit 0
2890EOF
2891 ;;
93bc48fa 2892 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
2893 exit 1
2894 ;;
2895 esac
93bc48fa
JH
2896 if $test ! -f $run; then
2897 echo "Target 'run' script '$run' not found." >&4
5440bc8e 2898 else
f8006fac 2899 $chmod a+rx $run
5440bc8e 2900 fi
93bc48fa
JH
2901 if $test ! -f $to; then
2902 echo "Target 'to' script '$to' not found." >&4
5440bc8e 2903 else
f8006fac 2904 $chmod a+rx $to
5440bc8e 2905 fi
93bc48fa
JH
2906 if $test ! -f $from; then
2907 echo "Target 'from' script '$from' not found." >&4
5440bc8e 2908 else
f8006fac 2909 $chmod a+rx $from
5440bc8e 2910 fi
93bc48fa 2911 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
2912 exit 1
2913 fi
2914 cat >&4 <<EOF
f8006fac
JH
2915Using '$run' for remote execution,
2916and '$from' and '$to'
93bc48fa 2917for remote file transfer.
5440bc8e
JH
2918EOF
2919 ;;
2920*) run=''
2921 to=:
2922 from=:
2923 usecrosscompile='undef'
2924 targetarch=''
2925 ;;
2926esac
2927
ecfc5424
AD
2928: see whether [:lower:] and [:upper:] are supported character classes
2929echo " "
ecfc5424
AD
2930case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2931ABYZ)
2932 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2933 up='[:upper:]'
2934 low='[:lower:]'
2935 ;;
416d0bea
MB
2936*) # There is a discontinuity in EBCDIC between 'R' and 'S'
2937 # (0xd9 and 0xe2), therefore that is a nice testing point.
2938 if test "X$up" = X -o "X$low" = X; then
2939 case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2940 rs) up='[A-Z]'
2941 low='[a-z]'
28e8609d
JH
2942 ;;
2943 esac
416d0bea 2944 fi
28e8609d 2945 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2946 case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2947 rs) up='A-Z'
28e8609d
JH
2948 low='a-z'
2949 ;;
2950 esac
416d0bea 2951 fi
28e8609d 2952 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2953 case "`echo RS | od -x 2>/dev/null`" in
2954 *D9E2*|*d9e2*)
28e8609d
JH
2955 echo "Hey, this might be EBCDIC." >&4
2956 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2957 case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2958 rs) up='[A-IJ-RS-Z]'
2959 low='[a-ij-rs-z]'
28e8609d
JH
2960 ;;
2961 esac
2962 fi
2963 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
2964 case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2965 rs) up='A-IJ-RS-Z'
2966 low='a-ij-rs-z'
28e8609d
JH
2967 ;;
2968 esac
2969 fi
2970 ;;
2971 esac
2972 fi
2973esac
416d0bea
MB
2974case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2975rs)
28e8609d
JH
2976 echo "Using $up and $low to convert case." >&4
2977 ;;
ecfc5424 2978*)
28e8609d
JH
2979 echo "I don't know how to translate letters from upper to lower case." >&4
2980 echo "Your tr is not acting any way I know of." >&4
2981 exit 1
2982 ;;
ecfc5424
AD
2983esac
2984: set up the translation script tr, must be called with ./tr of course
2985cat >tr <<EOSC
2986$startsh
2987case "\$1\$2" in
2988'[A-Z][a-z]') exec $tr '$up' '$low';;
2989'[a-z][A-Z]') exec $tr '$low' '$up';;
2990esac
2991exec $tr "\$@"
2992EOSC
2993chmod +x tr
2994$eunicefix tr
2995
2304df62
AD
2996: Try to determine whether config.sh was made on this system
2997case "$config_sh" in
2998'')
43999f95
JH
2999myuname=`$uname -a 2>/dev/null`
3000$test -z "$myuname" && myuname=`hostname 2>/dev/null`
28e8609d
JH
3001# tr '[A-Z]' '[a-z]' would not work in EBCDIC
3002# because the A-Z/a-z are not consecutive.
a0d0e21e 3003myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3eaeeeae 3004 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 3005newmyuname="$myuname"
2304df62 3006dflt=n
16d20bd9
AD
3007case "$knowitall" in
3008'')
3009 if test -f ../config.sh; then
3010 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3011 eval "`grep myuname= ../config.sh`"
3012 fi
3013 if test "X$myuname" = "X$newmyuname"; then
3014 dflt=y
3015 fi
2304df62 3016 fi
16d20bd9
AD
3017 ;;
3018*) dflt=y;;
3019esac
2304df62
AD
3020
3021: Get old answers from old config file if Configure was run on the
3022: same system, otherwise use the hints.
3023hint=default
3024cd ..
3025if test -f config.sh; then
16d20bd9
AD
3026 echo " "
3027 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
3028 . UU/myread
3029 case "$ans" in
f83701cd
AD
3030 n*|N*) echo "OK, I'll ignore it."
3031 mv config.sh config.sh.old
3032 myuname="$newmyuname"
3033 ;;
2304df62 3034 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
3035 tmp_n="$n"
3036 tmp_c="$c"
85cad39c 3037 tmp_sh="$sh"
2304df62
AD
3038 . ./config.sh
3039 cp config.sh UU
ecfc5424
AD
3040 n="$tmp_n"
3041 c="$tmp_c"
85cad39c
PP
3042 : Older versions did not always set $sh. Catch re-use of such
3043 : an old config.sh.
3044 case "$sh" in
3045 '') sh="$tmp_sh" ;;
3046 esac
2304df62
AD
3047 hint=previous
3048 ;;
3049 esac
3050fi
2573c5f9 3051. ./UU/checkcc
2304df62
AD
3052if test ! -f config.sh; then
3053 $cat <<EOM
3054
4e2a5f63
AD
3055First time through, eh? I have some defaults handy for some systems
3056that need some extra help getting the Configure answers right:
2304df62
AD
3057
3058EOM
dfe9444c 3059 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
3060 dflt=''
3061 : Half the following guesses are probably wrong... If you have better
7f2de2d2 3062 : tests or hints, please send them to perlbug@perl.org
2304df62 3063 : The metaconfig authors would also appreciate a copy...
a0d0e21e 3064 $test -f /irix && osname=irix
85e6fe83
LW
3065 $test -f /xenix && osname=sco_xenix
3066 $test -f /dynix && osname=dynix
3067 $test -f /dnix && osname=dnix
5f05dabc
PP
3068 $test -f /lynx.os && osname=lynxos
3069 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 3070 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 3071 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 3072 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
3073 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3074 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
3075 $test -d /usr/apollo/bin && osname=apollo
3076 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 3077 $test -d /usr/include/minix && osname=minix
d54344fc 3078 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 3079 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 3080 osname=machten
4633a7c4 3081 if $test -x /sbin/version; then
dfe9444c 3082 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
3083 $sed -e 's/[A-Za-z]$//'`
3084 elif $test -x /usr/etc/version; then
dfe9444c 3085 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
3086 $sed -e 's/[A-Za-z]$//'`
3087 else
3088 osvers="$2.$3"
3089 fi
3090 fi
aaacdc8b
GS
3091
3092 $test -f /sys/posix.dll &&
3093 $test -f /usr/bin/what &&
3094 set X `/usr/bin/what /sys/posix.dll` &&
3095 $test "$3" = UWIN &&
3096 osname=uwin &&
3097 osvers="$5"
3098
2304df62
AD
3099 if $test -f $uname; then
3100 set X $myuname
3101 shift
3102
2304df62 3103 case "$5" in
85e6fe83 3104 fps*) osname=fps ;;
2304df62
AD
3105 mips*)
3106 case "$4" in
85e6fe83
LW
3107 umips) osname=umips ;;
3108 *) osname=mips ;;
2304df62 3109 esac;;
85e6fe83
LW
3110 [23]100) osname=mips ;;
3111 next*) osname=next ;;
ecfc5424 3112 i386*)
c6912327
JH
3113 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3114 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
3115 osname='sco'
3116 osvers=$tmp
3117 elif $test -f /etc/kconfig; then
ecfc5424 3118 osname=isc
bd628c73 3119 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
3120 osvers=4
3121 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3122 osvers=3
2304df62 3123 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 3124 osvers=2
ecfc5424
AD
3125 fi
3126 fi
2000072c 3127 tmp=''
ecfc5424 3128 ;;
c4f23d77
AD
3129 pc*)
3130 if test -n "$DJGPP"; then
3131 osname=dos
3132 osvers=djgpp
3133 fi
3134 ;;
2304df62
AD
3135 esac
3136
3137 case "$1" in
a0d0e21e
LW
3138 aix) osname=aix
3139 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3140 case "$tmp" in
e81c5c2a
NC
3141 # oslevel can fail with:
3142 # oslevel: Unable to acquire lock.
3143 *not\ found) osvers="$4"."$3" ;;
a0d0e21e
LW
3144 '<3240'|'<>3240') osvers=3.2.0 ;;
3145 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3146 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 3147 *) osvers=$tmp;;
a0d0e21e
LW
3148 esac
3149 ;;
aaacdc8b
GS
3150 bsd386) osname=bsd386
3151 osvers=`$uname -r`
3152 ;;
3153 cygwin*) osname=cygwin
3154 osvers="$3"
3155 ;;
23f87696
SZ
3156 *dc.osx) osname=dcosx
3157 osvers="$3"
3158 ;;
a0d0e21e
LW
3159 dnix) osname=dnix
3160 osvers="$3"
3161 ;;
3162 domainos) osname=apollo
3163 osvers="$3"
3164 ;;
a774dfe6
RSG
3165 dgux) osname=dgux
3166 osvers="$3"
3167 ;;
3168 dragonfly) osname=dragonfly
a0d0e21e
LW
3169 osvers="$3"
3170 ;;
760ac839 3171 dynixptx*) osname=dynixptx
e58e581d 3172 osvers=`echo "$4"|sed 's/^v//'`
760ac839 3173 ;;
a774dfe6 3174 freebsd) osname=freebsd
a0d0e21e 3175 osvers="$3" ;;
761ee4e8
BD
3176 genix) osname=genix ;;
3177 gnu) osname=gnu
3178 osvers="$3" ;;
a774dfe6 3179 hp*) osname=hpux
bfb7748a 3180 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 3181 ;;
761ee4e8 3182 irix*) osname=irix
a0d0e21e
LW
3183 case "$3" in
3184 4*) osvers=4 ;;
3185 5*) osvers=5 ;;
ecfc5424 3186 *) osvers="$3" ;;
a0d0e21e
LW
3187 esac
3188 ;;
761ee4e8 3189 linux) osname=linux
a0d0e21e 3190 case "$3" in
a0d0e21e
LW
3191 *) osvers="$3" ;;
3192 esac
3193 ;;
761ee4e8 3194 MiNT) osname=mint
28e8609d
JH
3195 ;;
3196 netbsd*) osname=netbsd
ecfc5424
AD
3197 osvers="$3"
3198 ;;
4e81affe
MMIJG
3199 news-os) osvers="$3"
3200 case "$3" in
3201 4*) osname=newsos4 ;;
3202 *) osname=newsos ;;
3203 esac
3204 ;;
aaacdc8b 3205 next*) osname=next ;;
28bb1e2c 3206 nonstop-ux) osname=nonstopux ;;
65dc58a1
TM
3207 openbsd) osname=openbsd
3208 osvers="$3"
3209 ;;
5c728af0
IZ
3210 os2) osname=os2
3211 osvers="$4"
3212 ;;
aaacdc8b
GS
3213 POSIX-BC | posix-bc ) osname=posix-bc
3214 osvers="$3"
a0d0e21e 3215 ;;
ae3afa4e
TH
3216 powerux | power_ux | powermax_os | powermaxos | \
3217 powerunix | power_unix) osname=powerux
3218 osvers="$3"
3219 ;;
aaacdc8b
GS
3220 qnx) osname=qnx
3221 osvers="$4"
3222 ;;
a0d0e21e
LW
3223 solaris) osname=solaris
3224 case "$3" in
3225 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 3226 *) osvers="$3" ;;
a0d0e21e
LW
3227 esac
3228 ;;
85e6fe83
LW
3229 sunos) osname=sunos
3230 case "$3" in
85e6fe83
LW
3231 5*) osname=solaris
3232 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 3233 *) osvers="$3" ;;
2304df62
AD
3234 esac
3235 ;;
a0d0e21e 3236 titanos) osname=titanos
85e6fe83 3237 case "$3" in
a0d0e21e
LW
3238 1*) osvers=1 ;;
3239 2*) osvers=2 ;;
3240 3*) osvers=3 ;;
3241 4*) osvers=4 ;;
ecfc5424 3242 *) osvers="$3" ;;
2304df62
AD
3243 esac
3244 ;;
85e6fe83 3245 ultrix) osname=ultrix
ecfc5424 3246 osvers="$3"
2304df62 3247 ;;
28757baa 3248 osf1|mls+) case "$5" in
fed7345c
AD
3249 alpha)
3250 osname=dec_osf
fdd85a03 3251 osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2aa76180
JH
3252 case "$osvers" in
3253 [1-9].[0-9]*) ;;
3254 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3255 esac
ecfc5424
AD
3256 ;;
3257 hp*) osname=hp_osf1 ;;
3258 mips) osname=mips_osf1 ;;
85e6fe83
LW
3259 esac
3260 ;;
af1ff193 3261 # UnixWare 7.1.2 is known as Open UNIX 8
381c1bae 3262 openunix|unixware) osname=svr5
0337d152
A
3263 osvers="$4"
3264 ;;
3c728e00 3265 uts) osname=uts
a0d0e21e
LW
3266 osvers="$3"
3267 ;;
3c728e00
JH
3268 vos) osvers="$3"
3269 ;;
85e6fe83 3270 $2) case "$osname" in
2304df62 3271 *isc*) ;;
a0d0e21e 3272 *freebsd*) ;;
5f05dabc 3273 svr*)
a0d0e21e 3274 : svr4.x or possibly later
a774dfe6 3275 case "svr$3" in
a0d0e21e
LW
3276 ${osname}*)
3277 osname=svr$3
3278 osvers=$4
3279 ;;
3280 esac
3281 case "$osname" in
3282 svr4.0)
3283 : Check for ESIX
3284 if test -f /stand/boot ; then
3285 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3286 if test -n "$INITPROG" -a -f "$INITPROG"; then
3287 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3288 if test -n "$isesix"; then
a0d0e21e
LW
3289 osname=esix4
3290 fi
3291 fi
3292 fi
3293 ;;
3294 esac
3295 ;;
2304df62 3296 *) if test -f /etc/systemid; then
a0d0e21e
LW
3297 osname=sco
3298 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3299 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3300 osvers=$1.$2.$3
c4f23d77 3301 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3302 osvers=$1.$2
c4f23d77 3303 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3304 osvers=$1
2304df62 3305 fi
a0d0e21e
LW
3306 else
3307 case "$osname" in
3308 '') : Still unknown. Probably a generic Sys V.
3309 osname="sysv"
3310 osvers="$3"
3311 ;;
3312 esac
2304df62
AD
3313 fi
3314 ;;
3315 esac
3316 ;;
a0d0e21e
LW
3317 *) case "$osname" in
3318 '') : Still unknown. Probably a generic BSD.
3319 osname="$1"
3320 osvers="$3"
3321 ;;
3322 esac
3323 ;;
2304df62
AD
3324 esac
3325 else
dfe9444c
AD
3326 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3327 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3328 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3329 osname=news_os
2304df62 3330 fi
dfe9444c 3331 $rm -f UU/kernel.what
5c728af0 3332 elif test -d c:/. -o -n "$is_os2" ; then
8e07c86e
AD
3333 set X $myuname
3334 osname=os2
3335 osvers="$5"
2304df62
AD
3336 fi
3337 fi
a774dfe6 3338
5440bc8e
JH
3339 case "$targetarch" in
3340 '') ;;
3341 *) hostarch=$osname
3342 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3343 osvers=''
3344 ;;
3345 esac
3346
a0d0e21e
LW
3347 : Now look for a hint file osname_osvers, unless one has been
3348 : specified already.
3349 case "$hintfile" in
3350 ''|' ')
1e127011 3351 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3352 : Also try without trailing minor version numbers.
1e127011
DD
3353 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3354 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3355 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3356 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3357 case "$file" in
3358 '') dflt=none ;;
3359 *) case "$osvers" in
3360 '') dflt=$file
3361 ;;
dfe9444c 3362 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3363 dflt=$file
dfe9444c 3364 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3365 dflt=$xfile
dfe9444c 3366 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3367 dflt=$xxfile
dfe9444c 3368 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3369 dflt=$xxxfile
dfe9444c 3370 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3371 dflt=$xxxxfile
dfe9444c 3372 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3373 dflt="${osname}"
3374 else
3375 dflt=none
3376 fi
3377 ;;
3378 esac
85e6fe83
LW
3379 ;;
3380 esac
4e2a5f63
AD
3381 if $test -f Policy.sh ; then
3382 case "$dflt" in
3383 *Policy*) ;;
3384 none) dflt="Policy" ;;
3385 *) dflt="Policy $dflt" ;;
3386 esac
3387 fi
85e6fe83 3388 ;;
a0d0e21e 3389 *)
ecfc5424 3390 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3391 ;;
2304df62 3392 esac
1aef975c 3393
4e2a5f63
AD
3394 if $test -f Policy.sh ; then
3395 $cat <<EOM
3396
3397There's also a Policy hint file available, which should make the
3398site-specific (policy) questions easier to answer.
3399EOM
3400
3401 fi
3402
2304df62
AD
3403 $cat <<EOM
3404
3405You may give one or more space-separated answers, or "none" if appropriate.
a2d23ec2
MB
3406If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3407previous run of Configure, you may specify it as well as or instead of
3408OS-specific hints. If hints are provided for your OS, you should use them:
3409although Perl can probably be built without hints on many platforms, using
3410hints often improve performance and may enable features that Configure can't
3411set up on its own. If there are no hints that match your OS, specify "none";
3412DO NOT give a wrong version or a wrong OS.
2304df62
AD
3413
3414EOM
4e2a5f63 3415
2304df62 3416 rp="Which of these apply, if any?"
dfe9444c 3417 . UU/myread
85e6fe83
LW
3418 tans=$ans
3419 for file in $tans; do
4e2a5f63
AD
3420 if $test X$file = XPolicy -a -f Policy.sh; then
3421 . Policy.sh
3422 $cat Policy.sh >> UU/config.sh
3423 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3424 . $src/hints/$file.sh
3425 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3426 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3427 : nothing
3428 else
85e6fe83
LW
3429 : Give one chance to correct a possible typo.
3430 echo "$file.sh does not exist"
3431 dflt=$file
3432 rp="hint to use instead?"
dfe9444c 3433 . UU/myread
85e6fe83 3434 for file in $ans; do
dfe9444c
AD
3435 if $test -f "$src/hints/$file.sh"; then
3436 . $src/hints/$file.sh
3437 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3438 elif $test X$ans = X -o X$ans = Xnone ; then
3439 : nothing
3440 else
3441 echo "$file.sh does not exist -- ignored."
3442 fi
3443 done
2304df62
AD
3444 fi
3445 done
85e6fe83 3446
2304df62 3447 hint=recommended
85e6fe83 3448 : Remember our hint file for later.
dfe9444c 3449 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3450 hintfile="$file"
85e6fe83 3451 else
a0d0e21e 3452 hintfile=''
85e6fe83 3453 fi
2304df62
AD
3454fi
3455cd UU
3456;;
3457*)
3458 echo " "
3459 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3460 tmp_n="$n"
3461 tmp_c="$c"
2304df62
AD
3462 cd ..
3463 cp $config_sh config.sh 2>/dev/null
a78b0d02 3464 chmod +w config.sh
2304df62
AD
3465 . ./config.sh
3466 cd UU
3467 cp ../config.sh .
ecfc5424
AD
3468 n="$tmp_n"
3469 c="$tmp_c"
2304df62
AD
3470 hint=previous
3471 ;;
3472esac
1aef975c 3473test "$override" && . ./optdef.sh
2304df62
AD
3474
3475: Restore computed paths
3476for file in $loclist $trylist; do
3477 eval $file="\$_$file"
3478done
3479
85e6fe83 3480cat << EOM
a0d0e21e 3481
85e6fe83 3482Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3483The default value is probably right if the name rings a bell. Otherwise,
3484since spelling matters for me, either accept the default or answer "none"
3485to leave it blank.
a0d0e21e 3486
85e6fe83 3487EOM
85e6fe83 3488case "$osname" in
a0d0e21e 3489 ''|' ')
85e6fe83 3490 case "$hintfile" in
a0d0e21e 3491 ''|' '|none) dflt=none ;;
ecfc5424 3492 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3493 esac
3494 ;;
3495 *) dflt="$osname" ;;
3496esac
3497rp="Operating system name?"
3498. ./myread
3499case "$ans" in
ecfc5424
AD
3500none) osname='' ;;
3501*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3502esac
8ff267be
PP
3503echo " "
3504case "$osvers" in
3505 ''|' ')
3506 case "$hintfile" in
3507 ''|' '|none) dflt=none ;;
3508 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3509 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3510 case "$dflt" in
3511 ''|' ') dflt=none ;;
3512 esac
3513 ;;
3514 esac
3515 ;;
3516 *) dflt="$osvers" ;;
3517esac
3518rp="Operating system version?"
3519. ./myread
3520case "$ans" in
3521none) osvers='' ;;
3522*) osvers="$ans" ;;
3523esac
3524
02e93a22
JH
3525
3526. ./posthint.sh
3527
2304df62 3528: who configured the system
59b83a6f 3529cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
dfe9444c
AD
3530case "$cf_by" in
3531"")
7c04078e 3532 cf_by=`(logname) 2>/dev/null`
dfe9444c 3533 case "$cf_by" in
7c04078e
GA
3534 "")
3535 cf_by=`(whoami) 2>/dev/null`
3536 case "$cf_by" in
3537 "") cf_by=unknown ;;
3538 esac ;;
8ff267be
PP
3539 esac ;;
3540esac
2304df62 3541
f3f1a2d8
MB
3542: decide how portable to be. Allow command line overrides.
3543case "$d_portable" in
3544"$undef") ;;
3545*) d_portable="$define" ;;
b4eb6b3d 3546esac
b4eb6b3d 3547
f3f1a2d8
MB
3548: set up shell script to do ~ expansion
3549cat >filexp <<EOSS
3550$startsh
3551: expand filename
3552case "\$1" in
3553 ~/*|~)
3554 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3555 ;;
3556 ~*)
3557 if $test -f /bin/csh; then
3558 /bin/csh -f -c "glob \$1"
3559 failed=\$?
3560 echo ""
3561 exit \$failed
3562 else
3563 name=\`$expr x\$1 : '..\([^/]*\)'\`
3564 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3565 if $test ! -d "\$dir"; then
3566 me=\`basename \$0\`
3567 echo "\$me: can't locate home directory for: \$name" >&2
3568 exit 1
3569 fi
3570 case "\$1" in
3571 */*)
3572 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3573 ;;
3574 *)
3575 echo \$dir
3576 ;;
3577 esac
3578 fi
3579 ;;
3580*)
3581 echo \$1
3582 ;;
b29b105d 3583esac
f3f1a2d8
MB
3584EOSS
3585chmod +x filexp
3586$eunicefix filexp
b29b105d 3587
f3f1a2d8
MB
3588: now set up to get a file name
3589cat <<EOS >getfile
3590$startsh
3591EOS
3592cat <<'EOSC' >>getfile
3593tilde=''
3594fullpath=''
3595already=''
3596skip=''
3597none_ok=''
3598exp_file=''
3599nopath_ok=''
3600orig_rp="$rp"
3601orig_dflt="$dflt"
3602case "$gfpth" in
3603'') gfpth='.' ;;
b29b105d 3604esac
b29b105d 3605
f3f1a2d8
MB
3606case "$fn" in
3607*\(*)
3608 : getfile will accept an answer from the comma-separated list
3609 : enclosed in parentheses even if it does not meet other criteria.
3610 expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3611 fn=`echo $fn | sed 's/(.*)//'`
3612 ;;
b29b105d
JH
3613esac
3614
f3f1a2d8
MB
3615case "$fn" in
3616*:*)
3617 loc_file=`expr $fn : '.*:\(.*\)'`
3618 fn=`expr $fn : '\(.*\):.*'`
3619 ;;
b29b105d 3620esac
b29b105d 3621
f3f1a2d8
MB
3622case "$fn" in
3623*~*) tilde=true;;
3624esac
3625case "$fn" in
3626*/*) fullpath=true;;
3627esac
3628case "$fn" in
3629*+*) skip=true;;
3630esac
3631case "$fn" in
3632*n*) none_ok=true;;
3633esac
3634case "$fn" in
3635*e*) exp_file=true;;
3636esac
3637case "$fn" in
3638*p*) nopath_ok=true;;
b29b105d 3639esac
b29b105d 3640
f3f1a2d8
MB
3641case "$fn" in
3642*f*) type='File';;
3643*d*) type='Directory';;
3644*l*) type='Locate';;
3645esac
b29b105d 3646
f3f1a2d8
MB
3647what="$type"
3648case "$what" in
3649Locate) what='File';;
3650esac
b29b105d 3651
f3f1a2d8
MB
3652case "$exp_file" in
3653'')
3654 case "$d_portable" in
3655 "$define") ;;
3656 *) exp_file=true;;
b29b105d
JH
3657 esac
3658 ;;
3659esac
3660
f3f1a2d8
MB
3661cd ..
3662while test "$type"; do
3663 redo=''
3664 rp="$orig_rp"
3665 dflt="$orig_dflt"
3666 case "$tilde" in
3667 true) rp="$rp (~name ok)";;
3668 esac
3669 . UU/myread
3670 if test -f UU/getfile.ok && \
3671 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3672 then
3673 value="$ans"
3674 ansexp="$ans"
3675 break
3676 fi
3677 case "$ans" in
3678 none)
3679 value=''
3680 ansexp=''
3681 case "$none_ok" in
3682 true) type='';;
b29b105d
JH
3683 esac
3684 ;;
f3f1a2d8
MB
3685 *)
3686 case "$tilde" in
3687 '') value="$ans"
3688 ansexp="$ans";;
3689 *)
3690 value=`UU/filexp $ans`
3691 case $? in
3692 0)
3693 if test "$ans" != "$value"; then
3694 echo "(That expands to $value on this system.)"
3695 fi
3696 ;;
3697 *) value="$ans";;
3698 esac
3699 ansexp="$value"
3700 case "$exp_file" in
3701 '') value="$ans";;
3702 esac
3703 ;;
3704 esac
3705 case "$fullpath" in
3706 true)
3707 case "$ansexp" in
3708 /*) value="$ansexp" ;;
3709 [a-zA-Z]:/*) value="$ansexp" ;;
3710 *)
3711 redo=true
3712 case "$already" in
3713 true)
3714 echo "I shall only accept a full path name, as in /bin/ls." >&4
3715 echo "Use a ! shell escape if you wish to check pathnames." >&4
3716 ;;
3717 *)
3718 echo "Please give a full path name, starting with slash." >&4
3719 case "$tilde" in
3720 true)
3721 echo "Note that using ~name is ok provided it expands well." >&4
3722 already=true
3723 ;;
3724 esac
3725 esac
3726 ;;
3727 esac
3728 ;;
3729 esac
3730 case "$redo" in
3731 '')
3732 case "$type" in
3733 File)
3734 for fp in $gfpth; do
3735 if test "X$fp" = X.; then
3736 pf="$ansexp"
3737 else
3738 pf="$fp/$ansexp"
3739 fi
3740 if test -f "$pf"; then
3741 type=''
3742 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3743 then
3744 echo "($value is not a plain file, but that's ok.)"
3745 type=''
3746 fi
3747 if test X"$type" = X; then
3748 value="$pf"
3749 break
3750 fi
3751 done
3752 ;;
3753 Directory)
3754 for fp in $gfpth; do
3755 if test "X$fp" = X.; then
3756 dir="$ans"
3757 direxp="$ansexp"
3758 else
3759 dir="$fp/$ansexp"
3760 direxp="$fp/$ansexp"
3761 fi
3762 if test -d "$direxp"; then
3763 type=''
3764 value="$dir"
3765 break
3766 fi
3767 done
3768 ;;
3769 Locate)
3770 if test -d "$ansexp"; then
3771 echo "(Looking for $loc_file in directory $value.)"
3772 value="$value/$loc_file"
3773 ansexp="$ansexp/$loc_file"
3774 fi
3775 if test -f "$ansexp"; then
3776 type=''
3777 fi
3778 case "$nopath_ok" in
3779 true) case "$value" in
3780 */*) ;;
3781 *) echo "Assuming $value will be in people's path."
3782 type=''
3783 ;;
3784 esac
3785 ;;
3786 esac
3787 ;;
3788 esac
b4eb6b3d 3789
f3f1a2d8
MB
3790 case "$skip" in
3791 true) type='';
3792 esac
3793
3794 case "$type" in
3795 '') ;;
3796 *)
3797 if test "$fastread" = yes; then
3798 dflt=y
3799 else
3800 dflt=n
3801 fi
3802 rp="$what $value doesn't exist. Use that name anyway?"
3803 . UU/myread
3804 dflt=''
3805 case "$ans" in
3806 y*) type='';;
3807 *) echo " ";;
3808 esac
3809 ;;
3810 esac
3811 ;;
3812 esac
3813 ;;
b4eb6b3d 3814 esac
f3f1a2d8
MB
3815done
3816cd UU
3817ans="$value"
3818rp="$orig_rp"
3819dflt="$orig_dflt"
3820rm -f getfile.ok
3821test "X$gfpthkeep" != Xy && gfpth=""
3822EOSC
3823
3824: determine root of directory hierarchy where package will be installed.
3825case "$prefix" in
3826'')
3827 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3828 ;;
3829*?/)
3830 dflt=`echo "$prefix" | sed 's/.$//'`
b4eb6b3d
JH
3831 ;;
3832*)
f3f1a2d8 3833 dflt="$prefix"
b4eb6b3d
JH
3834 ;;
3835esac
f3f1a2d8 3836$cat <<EOM
b4eb6b3d 3837
f3f1a2d8
MB
3838By default, $package will be installed in $dflt/bin, manual pages
3839under $dflt/man, etc..., i.e. with $dflt as prefix for all
3840installation directories. Typically this is something like /usr/local.
3841If you wish to have binaries under /usr/bin but other parts of the
3842installation under /usr/local, that's ok: you will be prompted
3843separately for each of the installation directories, the prefix being
3844only used to set the defaults.
c915ce7f
JH
3845
3846EOM
f3f1a2d8
MB
3847fn=d~
3848rp='Installation prefix to use?'
3849. ./getfile
3850oldprefix=''
3851case "$prefix" in
3852'') ;;
3853*)
3854 case "$ans" in
3855 "$prefix") ;;
3856 *) oldprefix="$prefix";;
3857 esac
c915ce7f
JH
3858 ;;
3859esac
f3f1a2d8
MB
3860prefix="$ans"
3861prefixexp="$ansexp"
c915ce7f 3862
f3f1a2d8
MB
3863case "$afsroot" in
3864'') afsroot=/afs ;;
3865*) afsroot=$afsroot ;;
b4eb6b3d 3866esac
b4eb6b3d 3867
f3f1a2d8
MB
3868: is AFS running?
3869echo " "
3870case "$afs" in
3871$define|true) afs=true ;;
3872$undef|false) afs=false ;;
3873*) if test -d $afsroot; then
3874 afs=true
3875 else
3876 afs=false
3877 fi
b4eb6b3d 3878 ;;
f3f1a2d8
MB
3879esac
3880if $afs; then
3881 echo "AFS may be running... I'll be extra cautious then..." >&4
3882else
3883 echo "AFS does not seem to be running..." >&4
9da7673b 3884fi
b4eb6b3d 3885
f3f1a2d8
MB
3886: determine installation prefix for where package is to be installed.
3887if $afs; then
3888$cat <<EOM
3889
3890Since you are running AFS, I need to distinguish the directory in which
3891files will reside from the directory in which they are installed (and from
3892which they are presumably copied to the former directory by occult means).
b4eb6b3d 3893
b4eb6b3d 3894EOM
f3f1a2d8
MB
3895 case "$installprefix" in
3896 '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3897 *) dflt="$installprefix";;
3898 esac
3899else
3900$cat <<EOM
b4eb6b3d 3901
f3f1a2d8
MB
3902In some special cases, particularly when building $package for distribution,
3903it is convenient to distinguish the directory in which files should be
3904installed from the directory ($prefix) in which they will
3905eventually reside. For most users, these two directories are the same.
3906
3907EOM
3908 case "$installprefix" in
3909 '') dflt=$prefix ;;
3910 *) dflt=$installprefix;;
3911 esac
3912fi
3913fn=d~
3914rp='What installation prefix should I use for installing files?'
3915. ./getfile
3916installprefix="$ans"
3917installprefixexp="$ansexp"
3918
3919: Perform the prefixexp/installprefixexp correction if necessary
3920cat <<EOS >installprefix
3921$startsh
3922EOS
3923cat <<'EOSC' >>installprefix
3924: Change installation prefix, if necessary.
3925if $test X"$prefix" != X"$installprefix"; then
3926 eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3927else
3928 eval "install${prefixvar}=\"\$${prefixvar}exp\""
3929fi
3930EOSC
3931chmod +x installprefix
3932$eunicefix installprefix
3933
3934: Set variables such as privlib and privlibexp from the output of ./getfile
3935: performing the prefixexp/installprefixexp correction if necessary.
3936cat <<EOS >setprefixvar