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