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