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