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