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