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