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