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