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