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