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