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