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