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