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