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