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