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