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