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