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