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