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