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