This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
README.qnx: Add a section for cross-compilation
[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
56b575b9 31# Generated on Wed Jan 22 12:03:46 CET 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
JH
208from=''
209run=''
210targetarch=''
82a085a5 211targetdir=''
fa142983 212targetenv=''
82a085a5 213targethost=''
56b575b9 214targetmkdir=''
dad780ec 215targetport=''
5440bc8e
JH
216to=''
217usecrosscompile=''
b98f6b80
JR
218hostperl=''
219hostgenerate=''
b36f1e2d 220hostosname=''
871414da 221targetsh=''
61c26d18 222extern_C=''
6b34ded5 223mistrustnm=''
1be1b388 224usedevel=''
9c839522 225perllibs=''
b4eb6b3d
JH
226dynamic_ext=''
227extensions=''
228known_extensions=''
229nonxs_ext=''
230static_ext=''
231useopcode=''
232useposix=''
6fcddf3b 233extras=''
ecfc5424 234d_bsd=''
40a7a20a 235d_eunice=''
2304df62
AD
236d_xenix=''
237eunicefix=''
dfe9444c 238ar=''
2304df62
AD
239awk=''
240bash=''
241bison=''
242byacc=''
243cat=''
244chgrp=''
245chmod=''
246chown=''
ecfc5424 247comm=''
2304df62
AD
248compress=''
249cp=''
250cpio=''
251cpp=''
252csh=''
253date=''
254echo=''
255egrep=''
256emacs=''
257expr=''
258find=''
259flex=''
3c728e00 260gmake=''
2304df62 261grep=''
8ff267be 262gzip=''
2304df62
AD
263inews=''
264ksh=''
265less=''
266line=''
267lint=''
268ln=''
269lp=''
270lpr=''
271ls=''
272mail=''
273mailx=''
dfe9444c 274make=''
2304df62
AD
275mkdir=''
276more=''
277mv=''
693762b4 278nm=''
2304df62
AD
279nroff=''
280perl=''
281pg=''
282pmake=''
283pr=''
284rm=''
285rmail=''
286sed=''
287sendmail=''
2304df62
AD
288shar=''
289sleep=''
290smail=''
291sort=''
292submit=''
293tail=''
294tar=''
295tbl=''
693762b4 296tee=''
2304df62
AD
297test=''
298touch=''
299tr=''
300troff=''
301uname=''
302uniq=''
303uuname=''
304vi=''
305zcat=''
8ff267be 306zip=''
b4eb6b3d
JH
307full_ar=''
308full_sed=''
a0d0e21e 309libswanted=''
2304df62
AD
310hint=''
311myuname=''
85e6fe83
LW
312osname=''
313osvers=''
2304df62
AD
314Author=''
315Date=''
316Header=''
317Id=''
318Locker=''
319Log=''
320RCSfile=''
321Revision=''
322Source=''
323State=''
56b575b9 324sysroot=''
dfe9444c
AD
325_a=''
326_exe=''
327_o=''
4633a7c4
LW
328archobjs=''
329exe_ext=''
330firstmakefile=''
331lib_ext=''
332obj_ext=''
333path_sep=''
5b813a60 334rm_try=''
b4eb6b3d 335afs=''
a6d26a0d 336afsroot=''
b4eb6b3d
JH
337alignbytes=''
338ansi2knr=''
339archlib=''
340archlibexp=''
341d_archlib=''
342installarchlib=''
343archname=''
344myarchname=''
1a1287f4 345useversionedarchname=''
b4eb6b3d
JH
346d_atolf=''
347d_atoll=''
348baserev=''
349bin=''
350binexp=''
f3f1a2d8 351initialinstalllocation=''
b4eb6b3d 352installbin=''
f3f1a2d8 353userelocatableinc=''
b4eb6b3d 354byteorder=''
2304df62 355cc=''
2304df62
AD
356ccflags=''
357cppflags=''
358ldflags=''
359lkflags=''
8e07c86e 360locincpth=''
2304df62 361optimize=''
b4eb6b3d 362cf_email=''
2304df62
AD
363cf_by=''
364cf_time=''
c193ef60
MB
365charbits=''
366charsize=''
2304df62 367contains=''
b4eb6b3d 368cpp_stuff=''
2304df62
AD
369cpplast=''
370cppminus=''
371cpprun=''
372cppstdin=''
74cac757 373d__fwalk=''
b4eb6b3d
JH
374d_access=''
375d_accessx=''
55954f19 376d_aintl=''
b4eb6b3d 377d_alarm=''
10bc17b6
JH
378asctime_r_proto=''
379d_asctime_r=''
fcdf39cf 380d_attribute_deprecated=''
0dbb1585
AL
381d_attribute_format=''
382d_attribute_malloc=''
383d_attribute_nonnull=''
384d_attribute_noreturn=''
385d_attribute_pure=''
386d_attribute_unused=''
387d_attribute_warn_unused_result=''
dcb594bc 388d_printf_format_null=''
b4eb6b3d
JH
389d_bcmp=''
390d_bcopy=''
635aebb7
AL
391d_builtin_choose_expr=''
392d_builtin_expect=''
b4eb6b3d 393d_bzero=''
a2d23ec2 394d_c99_variadic_macros=''
b4eb6b3d
JH
395d_casti32=''
396castflags=''
397d_castneg=''
398d_chown=''
399d_chroot=''
400d_chsize=''
758a5d79 401d_class=''
b0a2e8e6 402d_clearenv=''
b4eb6b3d
JH
403d_closedir=''
404d_void_closedir=''
4e0554ec 405d_cmsghdr_s=''
b4eb6b3d 406d_const=''
36adc09b 407d_copysignl=''
666ea192 408d_cplusplus=''
b4eb6b3d
JH
409cryptlib=''
410d_crypt=''
10bc17b6
JH
411crypt_r_proto=''
412d_crypt_r=''
b4eb6b3d
JH
413d_csh=''
414full_csh=''
13cfc98d 415d_ctermid=''
10bc17b6
JH
416ctermid_r_proto=''
417d_ctermid_r=''
418ctime_r_proto=''
419d_ctime_r=''
b4eb6b3d
JH
420d_cuserid=''
421d_dbl_dig=''
2ef53570 422d_dbminitproto=''
b4eb6b3d 423d_difftime=''
de52168c 424d_dir_dd_fd=''
ae0e3d3b 425d_dirfd=''
b4eb6b3d 426d_dlerror=''
a0d0e21e 427d_dlopen=''
b4eb6b3d
JH
428d_dlsymun=''
429d_dosuid=''
430d_suidsafe=''
10bc17b6
JH
431d_drand48_r=''
432drand48_r_proto=''
b4eb6b3d
JH
433d_drand48proto=''
434d_dup2=''
435d_eaccess=''
436d_endgrent=''
10bc17b6
JH
437d_endgrent_r=''
438endgrent_r_proto=''
b4eb6b3d 439d_endhent=''
10bc17b6
JH
440d_endhostent_r=''
441endhostent_r_proto=''
b4eb6b3d 442d_endnent=''
10bc17b6
JH
443d_endnetent_r=''
444endnetent_r_proto=''
b4eb6b3d 445d_endpent=''
10bc17b6
JH
446d_endprotoent_r=''
447endprotoent_r_proto=''
b4eb6b3d 448d_endpwent=''
10bc17b6
JH
449d_endpwent_r=''
450endpwent_r_proto=''
b4eb6b3d 451d_endsent=''
10bc17b6
JH
452d_endservent_r=''
453endservent_r_proto=''
15b61c98 454d_faststdio=''
b363b713 455d_fchdir=''
b4eb6b3d
JH
456d_fchmod=''
457d_fchown=''
458d_fcntl=''
9d9004a9 459d_fcntl_can_lock=''
b4eb6b3d
JH
460d_fd_macros=''
461d_fd_set=''
462d_fds_bits=''
463d_fgetpos=''
758a5d79
JH
464d_finite=''
465d_finitel=''
b4eb6b3d
JH
466d_flexfnam=''
467d_flock=''
2ef53570 468d_flockproto=''
b4eb6b3d 469d_fork=''
758a5d79
JH
470d_fp_class=''
471d_fpclass=''
472d_fpclassify=''
473d_fpclassl=''
b4eb6b3d
JH
474d_fpos64_t=''
475d_frexpl=''
476d_fs_data_s=''
477d_fseeko=''
478d_fsetpos=''
479d_fstatfs=''
411ab01c 480d_fsync=''
b4eb6b3d
JH
481d_ftello=''
482d_ftime=''
483d_gettimeod=''
dc814df1 484d_futimes=''
b4eb6b3d 485d_Gconvert=''
5086dff9 486d_getaddrinfo=''
b4eb6b3d
JH
487d_getcwd=''
488d_getespwnam=''
489d_getfsstat=''
490d_getgrent=''
10bc17b6
JH
491d_getgrent_r=''
492getgrent_r_proto=''
493d_getgrgid_r=''
494getgrgid_r_proto=''
495d_getgrnam_r=''
496getgrnam_r_proto=''
b4eb6b3d
JH
497d_getgrps=''
498d_gethbyaddr=''
499d_gethbyname=''
500d_gethent=''
501aphostname=''
502d_gethname=''
503d_phostname=''
504d_uname=''
10bc17b6
JH
505d_gethostbyaddr_r=''
506gethostbyaddr_r_proto=''
507d_gethostbyname_r=''
508gethostbyname_r_proto=''
509d_gethostent_r=''
510gethostent_r_proto=''
b4eb6b3d 511d_gethostprotos=''
4e0554ec 512d_getitimer=''
b4eb6b3d 513d_getlogin=''
10bc17b6
JH
514d_getlogin_r=''
515getlogin_r_proto=''
b4eb6b3d
JH
516d_getmnt=''
517d_getmntent=''
5086dff9 518d_getnameinfo=''
b4eb6b3d
JH
519d_getnbyaddr=''
520d_getnbyname=''
521d_getnent=''
10bc17b6
JH
522d_getnetbyaddr_r=''
523getnetbyaddr_r_proto=''
524d_getnetbyname_r=''
525getnetbyname_r_proto=''
526d_getnetent_r=''
527getnetent_r_proto=''
b4eb6b3d 528d_getnetprotos=''
0c0643d0 529d_getpagsz=''
b4eb6b3d
JH
530d_getpent=''
531d_getpgid=''
532d_getpgrp2=''
533d_bsdgetpgrp=''
534d_getpgrp=''
535d_getppid=''
536d_getprior=''
537d_getpbyname=''
538d_getpbynumber=''
10bc17b6
JH
539d_getprotobyname_r=''
540getprotobyname_r_proto=''
541d_getprotobynumber_r=''
542getprotobynumber_r_proto=''
543d_getprotoent_r=''
544getprotoent_r_proto=''
b4eb6b3d
JH
545d_getprotoprotos=''
546d_getprpwnam=''
547d_getpwent=''
10bc17b6
JH
548d_getpwent_r=''
549getpwent_r_proto=''
550d_getpwnam_r=''
551getpwnam_r_proto=''
552d_getpwuid_r=''
553getpwuid_r_proto=''
b4eb6b3d 554d_getsent=''
10bc17b6
JH
555d_getservbyname_r=''
556getservbyname_r_proto=''
557d_getservbyport_r=''
558getservbyport_r_proto=''
559d_getservent_r=''
560getservent_r_proto=''
b4eb6b3d
JH
561d_getservprotos=''
562d_getspnam=''
10bc17b6
JH
563d_getspnam_r=''
564getspnam_r_proto=''
b4eb6b3d
JH
565d_getsbyname=''
566d_getsbyport=''
10bc17b6
JH
567d_gmtime_r=''
568gmtime_r_proto=''
a4f3eea9 569d_gnulibc=''
5f6e0ee4 570gnulibc_version=''
b4eb6b3d
JH
571d_hasmntopt=''
572d_htonl=''
55954f19 573d_ilogbl=''
b4eb6b3d 574d_inetaton=''
5086dff9
MB
575d_inetntop=''
576d_inetpton=''
b4eb6b3d
JH
577d_int64_t=''
578d_isascii=''
269a7913 579d_isblank=''
758a5d79
JH
580d_isfinite=''
581d_isinf=''
b4eb6b3d
JH
582d_isnan=''
583d_isnanl=''
584d_killpg=''
585d_lchown=''
586d_ldbl_dig=''
0a0abfba 587d_libm_lib_version=''
b4eb6b3d 588d_link=''
10bc17b6 589d_localtime_r=''
8572b25d 590d_localtime_r_needs_tzset=''
10bc17b6 591localtime_r_proto=''
b4eb6b3d
JH
592d_locconv=''
593d_lockf=''
594d_longdbl=''
595longdblsize=''
596d_longlong=''
597longlongsize=''
598d_lseekproto=''
599d_lstat=''
600d_madvise=''
7dd121ae
MB
601d_malloc_good_size=''
602d_malloc_size=''
b4eb6b3d
JH
603d_mblen=''
604d_mbstowcs=''
605d_mbtowc=''
606d_memchr=''
607d_memcmp=''
608d_memcpy=''
609d_memmove=''
610d_memset=''
611d_mkdir=''
612d_mkdtemp=''
613d_mkfifo=''
614d_mkstemp=''
615d_mkstemps=''
616d_mktime=''
617d_mmap=''
618mmaptype=''
619d_modfl=''
e67aeab1 620d_modfl_pow32_bug=''
bc9a1b2c 621d_modflproto=''
b4eb6b3d
JH
622d_mprotect=''
623d_msg=''
624d_msgctl=''
625d_msgget=''
4e0554ec 626d_msghdr_s=''
b4eb6b3d
JH
627d_msgrcv=''
628d_msgsnd=''
629d_msync=''
630d_munmap=''
631d_nice=''
2765b840 632d_nl_langinfo=''
b4eb6b3d
JH
633d_off64_t=''
634d_open3=''
635d_fpathconf=''
636d_pathconf=''
637d_pause=''
638d_pipe=''
639d_poll=''
2304df62 640d_portable=''
c796e3db
MB
641d_prctl=''
642d_prctl_set_name=''
a33c94aa 643d_procselfexe=''
f24dbf84 644procselfexe=''
b4eb6b3d
JH
645d_old_pthread_create_joinable=''
646old_pthread_create_joinable=''
d6483fcc 647d_pthread_atfork=''
58d975c3 648d_pthread_attr_setscope=''
b4eb6b3d
JH
649d_pthread_yield=''
650d_sched_yield=''
651sched_yield=''
652d_qgcvt=''
10bc17b6
JH
653d_random_r=''
654random_r_proto=''
655d_readdir64_r=''
656readdir64_r_proto=''
b4eb6b3d
JH
657d_readdir=''
658d_rewinddir=''
659d_seekdir=''
660d_telldir=''
10bc17b6
JH
661d_readdir_r=''
662readdir_r_proto=''
b4eb6b3d 663d_readlink=''
4e0554ec
JH
664d_readv=''
665d_recvmsg=''
b4eb6b3d
JH
666d_rename=''
667d_rmdir=''
668d_safebcpy=''
669d_safemcpy=''
670d_sanemcmp=''
ef9f17be 671d_sbrkproto=''
55954f19 672d_scalbnl=''
b4eb6b3d
JH
673d_select=''
674d_sem=''
675d_semctl=''
676d_semget=''
677d_semop=''
4e0554ec 678d_sendmsg=''
b4eb6b3d
JH
679d_setegid=''
680d_seteuid=''
681d_setgrent=''
10bc17b6
JH
682d_setgrent_r=''
683setgrent_r_proto=''
b4eb6b3d
JH
684d_setgrps=''
685d_sethent=''
10bc17b6
JH
686d_sethostent_r=''
687sethostent_r_proto=''
4e0554ec 688d_setitimer=''
b4eb6b3d
JH
689d_setlinebuf=''
690d_setlocale=''
10bc17b6
JH
691d_setlocale_r=''
692setlocale_r_proto=''
b4eb6b3d 693d_setnent=''
10bc17b6
JH
694d_setnetent_r=''
695setnetent_r_proto=''
b4eb6b3d
JH
696d_setpent=''
697d_setpgid=''
698d_setpgrp2=''
699d_bsdsetpgrp=''
700d_setpgrp=''
701d_setprior=''
702d_setproctitle=''
10bc17b6
JH
703d_setprotoent_r=''
704setprotoent_r_proto=''
b4eb6b3d 705d_setpwent=''
10bc17b6
JH
706d_setpwent_r=''
707setpwent_r_proto=''
b4eb6b3d
JH
708d_setregid=''
709d_setresgid=''
710d_setresuid=''
711d_setreuid=''
712d_setrgid=''
713d_setruid=''
714d_setsent=''
10bc17b6
JH
715d_setservent_r=''
716setservent_r_proto=''
b4eb6b3d
JH
717d_setsid=''
718d_setvbuf=''
b4eb6b3d
JH
719d_shm=''
720d_shmat=''
721d_shmatprototype=''
722shmattype=''
723d_shmctl=''
724d_shmdt=''
725d_shmget=''
726d_sigaction=''
ed140128 727d_signbit=''
983dbef6 728d_sigprocmask=''
b4eb6b3d 729d_sigsetjmp=''
5f106f9c 730usesitecustomize=''
4f5da3e9
SP
731d_snprintf=''
732d_vsnprintf=''
49a78c82 733d_sockatmark=''
2ef53570 734d_sockatmarkproto=''
122b9bf4 735d_ip_mreq=''
3e06601f 736d_ip_mreq_source=''
18126d98 737d_ipv6_mreq=''
3e06601f 738d_ipv6_mreq_source=''
b4eb6b3d
JH
739d_msg_ctrunc=''
740d_msg_dontroute=''
741d_msg_oob=''
742d_msg_peek=''
743d_msg_proxy=''
744d_oldsock=''
745d_scm_rights=''
f53580fe 746d_sin6_scope_id=''
18126d98 747d_sockaddr_in6=''
b8677e3b 748d_sockaddr_sa_len=''
b4eb6b3d
JH
749d_socket=''
750d_sockpair=''
751sockethdr=''
752socketlib=''
753d_socklen_t=''
754d_socks5_init=''
360321b3 755d_sprintf_returns_strlen=''
b4eb6b3d 756d_sqrtl=''
10bc17b6
JH
757d_srand48_r=''
758srand48_r_proto=''
759d_srandom_r=''
760srandom_r_proto=''
eef837ea 761d_sresgproto=''
640374d0 762d_sresuproto=''
b4eb6b3d
JH
763d_statblks=''
764d_statfs_f_flags=''
765d_statfs_s=''
17a6c8e3
AD
766d_static_inline=''
767perl_static_inline=''
b4eb6b3d
JH
768d_fstatvfs=''
769d_statvfs=''
770d_stdio_cnt_lval=''
771d_stdio_ptr_lval=''
a7ffa9b9
NC
772d_stdio_ptr_lval_nochange_cnt=''
773d_stdio_ptr_lval_sets_cnt=''
b4eb6b3d
JH
774d_stdiobase=''
775d_stdstdio=''
776stdio_base=''
777stdio_bufsiz=''
778stdio_cnt=''
779stdio_filbuf=''
780stdio_ptr=''
781d_index=''
782d_strchr=''
783d_strcoll=''
784d_strctcpy=''
785d_strerrm=''
786d_strerror=''
787d_sysernlst=''
788d_syserrlst=''
10bc17b6
JH
789d_strerror_r=''
790strerror_r_proto=''
b3c85772 791d_strftime=''
08c92000
MB
792d_strlcat=''
793d_strlcpy=''
b4eb6b3d
JH
794d_strtod=''
795d_strtol=''
796d_strtold=''
797d_strtoll=''
28e5dec8 798d_strtoq=''
b4eb6b3d
JH
799d_strtoul=''
800d_strtoull=''
801d_strtouq=''
802d_strxfrm=''
803d_symlink=''
804d_syscall=''
2ef53570 805d_syscallproto=''
b4eb6b3d
JH
806d_sysconf=''
807d_system=''
808d_tcgetpgrp=''
809d_tcsetpgrp=''
810d_telldirproto=''
811d_time=''
812timetype=''
96938616
MB
813d_asctime64=''
814d_ctime64=''
815d_difftime64=''
816d_gmtime64=''
817d_localtime64=''
818d_mktime64=''
cbb9e8a7 819d_timegm=''
b4eb6b3d
JH
820clocktype=''
821d_times=''
10bc17b6
JH
822d_tmpnam_r=''
823tmpnam_r_proto=''
b4eb6b3d 824d_truncate=''
10bc17b6
JH
825d_ttyname_r=''
826ttyname_r_proto=''
b4eb6b3d 827d_tzname=''
4e0554ec
JH
828d_u32align=''
829d_ualarm=''
b4eb6b3d
JH
830d_umask=''
831d_semctl_semid_ds=''
832d_semctl_semun=''
833d_union_semun=''
758a5d79 834d_unordered=''
bdf33aa7 835d_unsetenv=''
4e0554ec 836d_usleep=''
2ef53570 837d_usleepproto=''
b4eb6b3d 838d_ustat=''
233e16ce 839d_pseudofork=''
b4eb6b3d
JH
840d_vfork=''
841usevfork=''
842d_voidsig=''
843signal_t=''
844d_volatile=''
845d_charvspr=''
846d_vprintf=''
847d_wait4=''
848d_waitpid=''
849d_wcstombs=''
850d_wctomb=''
4e0554ec 851d_writev=''
b4eb6b3d 852dlext=''
f1ce3bf1 853bin_ELF=''
85e6fe83
LW
854cccdlflags=''
855ccdlflags=''
2304df62 856dlsrc=''
232e078e 857ld=''
9ec4dadf 858ld_can_script=''
85e6fe83 859lddlflags=''
2304df62 860usedl=''
b4eb6b3d 861doublesize=''
9d1a8da0 862bootstrap_charset=''
b4eb6b3d
JH
863ebcdic=''
864fflushNULL=''
865fflushall=''
866fpossize=''
867fpostype=''
2d736872 868gccansipedantic=''
5b463ca7 869gccosandvers=''
8a27cf78 870gccversion=''
b4eb6b3d
JH
871gidformat=''
872gidsign=''
873gidsize=''
874gidtype=''
875groupstype=''
876h_fcntl=''
877h_sysfile=''
6e1038e0
MB
878html1dir=''
879html1direxp=''
880installhtml1dir=''
881html3dir=''
882html3direxp=''
883installhtml3dir=''
b4eb6b3d 884i_arpainet=''
c0bacbef 885i_assert=''
10bc17b6 886i_crypt=''
b4eb6b3d
JH
887db_hashtype=''
888db_prefixtype=''
640374d0
JH
889db_version_major=''
890db_version_minor=''
891db_version_patch=''
b4eb6b3d
JH
892i_db=''
893i_dbm=''
894i_rpcsvcdbm=''
895d_dirnamlen=''
896direntrytype=''
897i_dirent=''
b4eb6b3d
JH
898i_dlfcn=''
899i_fcntl=''
900i_float=''
758a5d79
JH
901i_fp=''
902i_fp_class=''
b4eb6b3d
JH
903i_gdbm=''
904d_grpasswd=''
905i_grp=''
b4eb6b3d
JH
906i_ieeefp=''
907i_inttypes=''
2765b840 908i_langinfo=''
b4eb6b3d
JH
909i_libutil=''
910i_limits=''
911i_locale=''
912i_machcthr=''
913i_malloc=''
1cd66f7c 914i_mallocmalloc=''
b4eb6b3d
JH
915i_math=''
916i_memory=''
917i_mntent=''
e74475c7
MHM
918d_gdbm_ndbm_h_uses_prototypes=''
919d_gdbmndbm_h_uses_prototypes=''
a33f2d9f 920d_ndbm=''
e74475c7 921d_ndbm_h_uses_prototypes=''
a33f2d9f
AD
922i_gdbm_ndbm=''
923i_gdbmndbm=''
b4eb6b3d
JH
924i_ndbm=''
925i_netdb=''
926i_neterrno=''
927i_netinettcp=''
928i_niin=''
929i_sysin=''
930i_poll=''
931i_prot=''
932i_pthread=''
933d_pwage=''
934d_pwchange=''
935d_pwclass=''
936d_pwcomment=''
937d_pwexpire=''
938d_pwgecos=''
939d_pwpasswd=''
940d_pwquota=''
941i_pwd=''
b4eb6b3d
JH
942i_shadow=''
943i_socks=''
bd31be4b 944i_stdbool=''
b4eb6b3d
JH
945i_stddef=''
946i_stdlib=''
947i_string=''
948strings=''
949i_sunmath=''
950i_sysaccess=''
951i_sysdir=''
952i_sysfile=''
953d_voidtty=''
954i_bsdioctl=''
955i_sysfilio=''
956i_sysioctl=''
957i_syssockio=''
958i_syslog=''
959i_sysmman=''
960i_sysmode=''
961i_sysmount=''
962i_sysndir=''
963i_sysparam=''
216dac04 964i_syspoll=''
b4eb6b3d
JH
965i_sysresrc=''
966i_syssecrt=''
967i_sysselct=''
968i_sysstat=''
969i_sysstatfs=''
970i_sysstatvfs=''
971i_systimes=''
972i_systypes=''
973i_sysuio=''
974i_sysun=''
975i_sysutsname=''
976i_sysvfs=''
977i_syswait=''
978i_sgtty=''
979i_termio=''
980i_termios=''
14b90194
JH
981d_tm_tm_gmtoff=''
982d_tm_tm_zone=''
b4eb6b3d
JH
983i_systime=''
984i_systimek=''
985i_time=''
986timeincl=''
987i_unistd=''
988i_ustat=''
989i_utime=''
990i_values=''
991i_stdarg=''
992i_varargs=''
993i_varhdr=''
994i_vfork=''
f3f1a2d8 995d_inc_version_list=''
b4eb6b3d
JH
996inc_version_list=''
997inc_version_list_init=''
998installprefix=''
999installprefixexp=''
1000installstyle=''
1001installusrbinperl=''
1002intsize=''
1003longsize=''
1004shortsize=''
4b661809 1005issymlink=''
2304df62 1006libc=''
b4eb6b3d
JH
1007ldlibpthname=''
1008libperl=''
1009shrpenv=''
1010useshrplib=''
a0d0e21e 1011glibpth=''
56b575b9 1012incpth=''
2304df62 1013libpth=''
8e07c86e 1014loclibpth=''
2304df62
AD
1015plibpth=''
1016xlibpth=''
1cfa4ec7 1017ignore_versioned_solibs=''
2304df62 1018libs=''
43999f95
JH
1019libsdirs=''
1020libsfiles=''
1021libsfound=''
13b3f787 1022libspath=''
85e6fe83 1023lns=''
b4eb6b3d
JH
1024d_PRIEUldbl=''
1025d_PRIFUldbl=''
1026d_PRIGUldbl=''
1027d_PRIeldbl=''
1028d_PRIfldbl=''
1029d_PRIgldbl=''
1030d_SCNfldbl=''
1031sPRIEUldbl=''
1032sPRIFUldbl=''
1033sPRIGUldbl=''
1034sPRIeldbl=''
1035sPRIfldbl=''
1036sPRIgldbl=''
1037sSCNfldbl=''
1038lseeksize=''
1039lseektype=''
d620c7b3 1040mad=''
00e74f14
NC
1041madlyh=''
1042madlyobj=''
1043madlysrc=''
f3f1a2d8
MB
1044make_set_make=''
1045d_mymalloc=''
1046freetype=''
b4eb6b3d
JH
1047mallocobj=''
1048mallocsrc=''
1049malloctype=''
9df442c2 1050usemallocwrap=''
b4eb6b3d
JH
1051usemymalloc=''
1052installman1dir=''
1053man1dir=''
1054man1direxp=''
1055man1ext=''
1056installman3dir=''
1057man3dir=''
1058man3direxp=''
1059man3ext=''
1060modetype=''
1061multiarch=''
1062mydomain=''
1063myhostname=''
1064phostname=''
2304df62
AD
1065c=''
1066n=''
b4eb6b3d
JH
1067d_eofnblk=''
1068eagain=''
1069o_nonblock=''
1070rd_nodata=''
2cc61e15 1071need_va_copy=''
b4eb6b3d
JH
1072netdb_hlen_type=''
1073netdb_host_type=''
1074netdb_name_type=''
1075netdb_net_type=''
1076groupcat=''
1077hostcat=''
1078passcat=''
1079orderlib=''
1080ranlib=''
1081d_perl_otherlibdirs=''
1082otherlibdirs=''
2304df62
AD
1083package=''
1084spackage=''
b4eb6b3d
JH
1085pager=''
1086api_revision=''
1087api_subversion=''
1088api_version=''
1089api_versionstring=''
1090patchlevel=''
151e6568 1091perl_patchlevel=''
b4eb6b3d
JH
1092revision=''
1093subversion=''
1094version=''
861eb78d 1095version_patchlevel_string=''
b4eb6b3d
JH
1096perl5=''
1097perladmin=''
91f55cc7 1098perlpath=''
b4eb6b3d 1099d_nv_preserves_uv=''
f607920a 1100d_nv_zero_is_allbits_zero=''
b4eb6b3d
JH
1101i16size=''
1102i16type=''
1103i32size=''
1104i32type=''
1105i64size=''
1106i64type=''
1107i8size=''
1108i8type=''
1109ivsize=''
1110ivtype=''
b68c599a 1111nv_overflows_integers_at=''
4137585d 1112nv_preserves_uv_bits=''
b4eb6b3d
JH
1113nvsize=''
1114nvtype=''
1115u16size=''
1116u16type=''
1117u32size=''
1118u32type=''
1119u64size=''
1120u64type=''
1121u8size=''
1122u8type=''
1123uvsize=''
1124uvtype=''
1125ivdformat=''
1126nvEUformat=''
1127nvFUformat=''
1128nvGUformat=''
1129nveformat=''
1130nvfformat=''
1131nvgformat=''
1132uvXUformat=''
1133uvoformat=''
1134uvuformat=''
1135uvxformat=''
1136pidtype=''
1137prefix=''
1138prefixexp=''
1139installprivlib=''
1140privlib=''
1141privlibexp=''
1142prototype=''
1143ptrsize=''
1144d_PRIXU64=''
1145d_PRId64=''
1146d_PRIi64=''
1147d_PRIo64=''
1148d_PRIu64=''
1149d_PRIx64=''
1150sPRIXU64=''
1151sPRId64=''
1152sPRIi64=''
1153sPRIo64=''
1154sPRIu64=''
1155sPRIx64=''
1156d_quad=''
1157quadkind=''
1158quadtype=''
1159uquadtype=''
1160drand01=''
1161randbits=''
1162randfunc=''
1163randseedtype=''
1164seedfunc=''
1165installscript=''
1166scriptdir=''
1167scriptdirexp=''
1168selectminbits=''
1169selecttype=''
8ff267be 1170sh=''
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
5440bc8e
JH
2844case "$usecrosscompile" in
2845$define|true|[yY]*)
93bc48fa 2846 $echo "Cross-compiling..."
56b575b9
MB
2847 croak=''
2848 case "$cc" in
2849 *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2850 # arm-linux-androideabi-gcc -> arm-linux-androideabi
2851 # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2852 targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2853 ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2854 # leave out ld, choosing it is more complex
2855 nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2856 ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2857 # We are in a weird spot. Just before us, some values
2858 # were 'saved', to be restored after the hints are
2859 # run. This means that the changes we made to ar,
2860 # nm and ranlib will get reverted.
2861 # To avoid that, we hijack the saving mechanism and
2862 # have it save our new values.
2863 for file in ar nm ranlib; do
2864 eval xxx=\$$file
2865 eval $file=$xxx$_exe
2866 eval _$file=$xxx
2867 done
2868 ;;
5440bc8e
JH
2869 esac
2870 case "$targetarch" in
93bc48fa 2871 '') echo "Targetarch not defined." >&4; croak=y ;;
56b575b9 2872 *) echo "Using targetarch $targetarch." >&4 ;;
5440bc8e 2873 esac
93bc48fa
JH
2874 case "$targethost" in
2875 '') echo "Targethost not defined." >&4; croak=y ;;
56b575b9 2876 *) echo "Using targethost $targethost." >&4
5440bc8e 2877 esac
93bc48fa
JH
2878 locincpth=' '
2879 loclibpth=' '
5440bc8e 2880 case "$croak" in
93bc48fa 2881 y) echo "Cannot continue, aborting." >&4; exit 1 ;;
5440bc8e 2882 esac
b98f6b80
JR
2883 : compile a host miniperl and generate_uudmap, unless we got passed them
2884 if $test "X$hostperl" = X; then
2885 echo "Building host miniperl and generate_uudmap binaries" >&4
4346df8f 2886 before_host=`pwd`
b98f6b80 2887 cd ..
4346df8f
BF
2888 cd $src
2889 src=`pwd`
2890 test -d $src/host || mkdir $src/host
2891 cd $src/host && rm -rf ./*
2892 $src/Configure -des -Dusedevel -Dmksymlinks
1ca484ac
BF
2893 $make miniperl
2894 case "$hostgenerate" in
2895 '') $make generate_uudmap
2896 hostgenerate=$src/host/generate_uudmap
2897 ;;
2898 "$undef") hostgenerate=''
2899 ;;
2900 esac
4346df8f 2901 hostperl=$src/host/miniperl
4346df8f 2902 cd $before_host
b98f6b80 2903 fi
b36f1e2d 2904 hostosname=`$hostperl -le 'print $^O'`
cb87e003
JR
2905 ;;
2906*)
2907 usecrosscompile='undef'
2908 ;;
2909esac
2910
2911: Define -Dtargethost=somecomputer to run compiled tests on another machine
0eafc8c9 2912case "$targethost" in
97076f2d
NW
2913 '') echo "Checking for cross-compile" >&4
2914 case "$usecrosscompile$multiarch" in
dbb1f24e 2915 *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
97076f2d
NW
2916 if [ -f Makefile ]; then
2917 echo " "
2918 echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
2919 else
2920 echo "Configure done."
2921 fi
2922 exit 0
2923 ;;
97076f2d 2924 *) echo "No targethost for running compiler tests against defined, running locally" >&4
0eafc8c9
JR
2925 run=''
2926 to=:
2927 from=:
2928 ;;
dbb1f24e
NW
2929 esac
2930 ;;
0eafc8c9 2931 *) echo "Using targethost $targethost." >&4
5440bc8e
JH
2932 case "$src" in
2933 /*) run=$src/Cross/run
93c0359c 2934 targetmkdir=$src/Cross/mkdir
5440bc8e
JH
2935 to=$src/Cross/to
2936 from=$src/Cross/from
2937 ;;
93bc48fa 2938 *) pwd=`$test -f ../Configure & cd ..; pwd`
5440bc8e 2939 run=$pwd/Cross/run
f8006fac 2940 targetmkdir=$pwd/Cross/mkdir
5440bc8e
JH
2941 to=$pwd/Cross/to
2942 from=$pwd/Cross/from
2943 ;;
2944 esac
2945 case "$targetrun" in
2946 '') targetrun=ssh ;;
2947 esac
2948 case "$targetto" in
2949 '') targetto=scp ;;
2950 esac
2951 case "$targetfrom" in
2952 '') targetfrom=scp ;;
2953 esac
56b575b9
MB
2954 run=$run-$targetrun
2955 to=$to-$targetto
2956 from=$from-$targetfrom
93bc48fa
JH
2957 case "$targetdir" in
2958 '') targetdir=/tmp
56b575b9
MB
2959 echo "Guessing targetdir $targetdir." >&4
2960 ;;
93bc48fa 2961 esac
5440bc8e 2962 case "$targetuser" in
93bc48fa 2963 '') targetuser=root
56b575b9
MB
2964 echo "Guessing targetuser $targetuser." >&4
2965 ;;
5440bc8e 2966 esac
dad780ec
JR
2967 case "$targetport" in
2968 '') targetport=22
56b575b9
MB
2969 echo "Guessing targetport $targetport." >&4
2970 ;;
dad780ec 2971 esac
5440bc8e
JH
2972 case "$targetfrom" in
2973 scp) q=-q ;;
2974 *) q='' ;;
2975 esac
2976 case "$targetrun" in
2977 ssh|rsh)
2978 cat >$run <<EOF
2979#!/bin/sh
d1739b52 2980env=''
93c0359c
JH
2981case "\$1" in
2982-cwd)
2983 shift
2984 cwd=\$1
2985 shift
2986 ;;
2987esac
d1739b52
BF
2988case "\$1" in
2989-env)
2990 shift
2991 env=\$1
2992 shift
2993 ;;
2994esac
93c0359c
JH
2995case "\$cwd" in
2996'') cwd=$targetdir ;;
2997esac
5440bc8e
JH
2998exe=\$1
2999shift
dad780ec 3000$to \$exe
03deea9f 3001$targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
5440bc8e
JH
3002EOF
3003 ;;
e9867f21
BF
3004 adb)
3005 $touch $run
3006 ;;
93bc48fa 3007 *) echo "Unknown targetrun '$targetrun'" >&4
5440bc8e
JH
3008 exit 1
3009 ;;
3010 esac
93c0359c
JH
3011 case "$targetmkdir" in
3012 */Cross/mkdir)
3013 cat >$targetmkdir <<EOF
3014#!/bin/sh
dad780ec 3015$targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
93c0359c 3016EOF
f8006fac 3017 $chmod a+rx $targetmkdir
93c0359c
JH
3018 ;;
3019 *) echo "Unknown targetmkdir '$targetmkdir'" >&4
3020 exit 1
3021 ;;
3022 esac
5440bc8e
JH
3023 case "$targetto" in
3024 scp|rcp)
3025 cat >$to <<EOF
3026#!/bin/sh
3027for f in \$@
3028do
93c0359c
JH
3029 case "\$f" in
3030 /*)
3031 $targetmkdir \`dirname \$f\`
f63fc11b 3032 $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f || exit 1
93c0359c
JH
3033 ;;
3034 *)
3035 $targetmkdir $targetdir/\`dirname \$f\`
259234a7 3036 $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
93c0359c
JH
3037 ;;
3038 esac
5440bc8e
JH
3039done
3040exit 0
3041EOF
3042 ;;
3043 cp) cat >$to <<EOF
3044#!/bin/sh
93c0359c
JH
3045for f in \$@
3046do
3047 case "\$f" in
3048 /*)
3049 $mkdir -p $targetdir/\`dirname \$f\`
3050 $cp \$f $targetdir/\$f || exit 1
3051 ;;
3052 *)
3053 $targetmkdir $targetdir/\`dirname \$f\`
3054 $cp \$f $targetdir/\$f || exit 1
3055 ;;
3056 esac
3057done
3058exit 0
5440bc8e
JH
3059EOF
3060 ;;
93bc48fa 3061 *) echo "Unknown targetto '$targetto'" >&4
5440bc8e
JH
3062 exit 1
3063 ;;
3064 esac
3065 case "$targetfrom" in
3066 scp|rcp)
3067 cat >$from <<EOF
3068#!/bin/sh
3069for f in \$@
3070do
93c0359c 3071 $rm -f \$f
dad780ec 3072 $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
5440bc8e
JH
3073done
3074exit 0
3075EOF
3076 ;;
3077 cp) cat >$from <<EOF
3078#!/bin/sh
3079for f in \$@
3080do
93c0359c 3081 $rm -f \$f
5440bc8e
JH
3082 cp $targetdir/\$f . || exit 1
3083done
3084exit 0
3085EOF
3086 ;;
93bc48fa 3087 *) echo "Unknown targetfrom '$targetfrom'" >&4
5440bc8e
JH
3088 exit 1
3089 ;;
3090 esac
93bc48fa
JH
3091 if $test ! -f $run; then
3092 echo "Target 'run' script '$run' not found." >&4
5440bc8e 3093 else
f8006fac 3094 $chmod a+rx $run
5440bc8e 3095 fi
93bc48fa
JH
3096 if $test ! -f $to; then
3097 echo "Target 'to' script '$to' not found." >&4
5440bc8e 3098 else
f8006fac 3099 $chmod a+rx $to
5440bc8e 3100 fi
93bc48fa
JH
3101 if $test ! -f $from; then
3102 echo "Target 'from' script '$from' not found." >&4
5440bc8e 3103 else
f8006fac 3104 $chmod a+rx $from
5440bc8e 3105 fi
93bc48fa 3106 if $test ! -f $run -o ! -f $to -o ! -f $from; then
5440bc8e
JH
3107 exit 1
3108 fi
3109 cat >&4 <<EOF
f8006fac
JH
3110Using '$run' for remote execution,
3111and '$from' and '$to'
93bc48fa 3112for remote file transfer.
5440bc8e
JH
3113EOF
3114 ;;
3115*) run=''
3116 to=:
3117 from=:
3118 usecrosscompile='undef'
3119 targetarch=''
3120 ;;
3121esac
3122
ecfc5424
AD
3123: see whether [:lower:] and [:upper:] are supported character classes
3124echo " "
ecfc5424
AD
3125case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3126ABYZ)
3127 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3128 up='[:upper:]'
3129 low='[:lower:]'
3130 ;;
416d0bea
MB
3131*) # There is a discontinuity in EBCDIC between 'R' and 'S'
3132 # (0xd9 and 0xe2), therefore that is a nice testing point.
3133 if test "X$up" = X -o "X$low" = X; then
3134 case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3135 rs) up='[A-Z]'
3136 low='[a-z]'
28e8609d
JH
3137 ;;
3138 esac
416d0bea 3139 fi
28e8609d 3140 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3141 case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3142 rs) up='A-Z'
28e8609d
JH
3143 low='a-z'
3144 ;;
3145 esac
416d0bea 3146 fi
28e8609d 3147 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3148 case "`echo RS | od -x 2>/dev/null`" in
3149 *D9E2*|*d9e2*)
28e8609d
JH
3150 echo "Hey, this might be EBCDIC." >&4
3151 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3152 case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3153 rs) up='[A-IJ-RS-Z]'
3154 low='[a-ij-rs-z]'
28e8609d
JH
3155 ;;
3156 esac
3157 fi
3158 if test "X$up" = X -o "X$low" = X; then
416d0bea
MB
3159 case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3160 rs) up='A-IJ-RS-Z'
3161 low='a-ij-rs-z'
28e8609d
JH
3162 ;;
3163 esac
3164 fi
3165 ;;
3166 esac
3167 fi
3168esac
416d0bea
MB
3169case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3170rs)
28e8609d
JH
3171 echo "Using $up and $low to convert case." >&4
3172 ;;
ecfc5424 3173*)
28e8609d
JH
3174 echo "I don't know how to translate letters from upper to lower case." >&4
3175 echo "Your tr is not acting any way I know of." >&4
3176 exit 1
3177 ;;
ecfc5424
AD
3178esac
3179: set up the translation script tr, must be called with ./tr of course
3180cat >tr <<EOSC
3181$startsh
3182case "\$1\$2" in
3183'[A-Z][a-z]') exec $tr '$up' '$low';;
3184'[a-z][A-Z]') exec $tr '$low' '$up';;
3185esac
3186exec $tr "\$@"
3187EOSC
3188chmod +x tr
3189$eunicefix tr
3190
2304df62
AD
3191: Try to determine whether config.sh was made on this system
3192case "$config_sh" in
3193'')
43999f95
JH
3194myuname=`$uname -a 2>/dev/null`
3195$test -z "$myuname" && myuname=`hostname 2>/dev/null`
f4dc174a 3196# Downcase everything to avoid ambiguity.
1332606d 3197# Remove slashes and single quotes so we can use parts of this in
f4dc174a
AD
3198# directory and file names.
3199# Remove newlines so myuname is sane to use elsewhere.
28e8609d
JH
3200# tr '[A-Z]' '[a-z]' would not work in EBCDIC
3201# because the A-Z/a-z are not consecutive.
f4dc174a 3202myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3eaeeeae 3203 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1aef975c 3204newmyuname="$myuname"
2304df62 3205dflt=n
16d20bd9
AD
3206case "$knowitall" in
3207'')
3208 if test -f ../config.sh; then
3209 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3210 eval "`grep myuname= ../config.sh`"
3211 fi
3212 if test "X$myuname" = "X$newmyuname"; then
3213 dflt=y
3214 fi
2304df62 3215 fi
16d20bd9
AD
3216 ;;
3217*) dflt=y;;
3218esac
2304df62
AD
3219
3220: Get old answers from old config file if Configure was run on the
3221: same system, otherwise use the hints.
3222hint=default
3223cd ..
3224if test -f config.sh; then
16d20bd9
AD
3225 echo " "
3226 rp="I see a config.sh file. Shall I use it to set the defaults?"
2304df62
AD
3227 . UU/myread
3228 case "$ans" in
f83701cd
AD
3229 n*|N*) echo "OK, I'll ignore it."
3230 mv config.sh config.sh.old
3231 myuname="$newmyuname"
3232 ;;
2304df62 3233 *) echo "Fetching default answers from your old config.sh file..." >&4
ecfc5424
AD
3234 tmp_n="$n"
3235 tmp_c="$c"
85cad39c 3236 tmp_sh="$sh"
2304df62
AD
3237 . ./config.sh
3238 cp config.sh UU
ecfc5424
AD
3239 n="$tmp_n"
3240 c="$tmp_c"
85cad39c
PP
3241 : Older versions did not always set $sh. Catch re-use of such
3242 : an old config.sh.
3243 case "$sh" in
3244 '') sh="$tmp_sh" ;;
3245 esac
2304df62
AD
3246 hint=previous
3247 ;;
3248 esac
3249fi
2573c5f9 3250. ./UU/checkcc
2304df62
AD
3251if test ! -f config.sh; then
3252 $cat <<EOM
3253
4e2a5f63
AD
3254First time through, eh? I have some defaults handy for some systems
3255that need some extra help getting the Configure answers right:
2304df62
AD
3256
3257EOM
dfe9444c 3258 (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4
2304df62
AD
3259 dflt=''
3260 : Half the following guesses are probably wrong... If you have better
7f2de2d2 3261 : tests or hints, please send them to perlbug@perl.org
2304df62 3262 : The metaconfig authors would also appreciate a copy...
a0d0e21e 3263 $test -f /irix && osname=irix
85e6fe83
LW
3264 $test -f /xenix && osname=sco_xenix
3265 $test -f /dynix && osname=dynix
3266 $test -f /dnix && osname=dnix
5f05dabc
PP
3267 $test -f /lynx.os && osname=lynxos
3268 $test -f /unicos && osname=unicos && osvers=`$uname -r`
c71a9cee 3269 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
7a4c00b4 3270 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
85e6fe83 3271 $test -f /bin/mips && /bin/mips && osname=mips
ecfc5424
AD
3272 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3273 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
a0d0e21e
LW
3274 $test -d /usr/apollo/bin && osname=apollo
3275 $test -f /etc/saf/_sactab && osname=svr4
85e6fe83 3276 $test -d /usr/include/minix && osname=minix
d54344fc 3277 $test -f /system/gnu_library/bin/ar.pm && osname=vos
e060872b 3278 if $test -d /MachTen -o -d /MachTen_Folder; then
dfe9444c 3279 osname=machten
4633a7c4 3280 if $test -x /sbin/version; then
dfe9444c 3281 osvers=`/sbin/version | $awk '{print $2}' |
4633a7c4
LW
3282 $sed -e 's/[A-Za-z]$//'`
3283 elif $test -x /usr/etc/version; then
dfe9444c 3284 osvers=`/usr/etc/version | $awk '{print $2}' |
4633a7c4
LW
3285 $sed -e 's/[A-Za-z]$//'`
3286 else
3287 osvers="$2.$3"
3288 fi
3289 fi
aaacdc8b
GS
3290
3291 $test -f /sys/posix.dll &&
3292 $test -f /usr/bin/what &&
3293 set X `/usr/bin/what /sys/posix.dll` &&
3294 $test "$3" = UWIN &&
3295 osname=uwin &&
3296 osvers="$5"
3297
2304df62
AD
3298 if $test -f $uname; then
3299 set X $myuname
3300 shift
3301
2304df62 3302 case "$5" in
85e6fe83 3303 fps*) osname=fps ;;
2304df62
AD
3304 mips*)
3305 case "$4" in
85e6fe83
LW
3306 umips) osname=umips ;;
3307 *) osname=mips ;;
2304df62 3308 esac;;
85e6fe83
LW
3309 [23]100) osname=mips ;;
3310 next*) osname=next ;;
ecfc5424 3311 i386*)
c6912327
JH
3312 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3313 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
619ffc2b
JH
3314 osname='sco'
3315 osvers=$tmp
3316 elif $test -f /etc/kconfig; then
ecfc5424 3317 osname=isc
bd628c73 3318 if test "$lns" = "$ln -s"; then
a0d0e21e
LW
3319 osvers=4
3320 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3321 osvers=3
2304df62 3322 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
a0d0e21e 3323 osvers=2
ecfc5424
AD
3324 fi
3325 fi
2000072c 3326 tmp=''
ecfc5424 3327 ;;
c4f23d77
AD
3328 pc*)
3329 if test -n "$DJGPP"; then
3330 osname=dos
3331 osvers=djgpp
3332 fi
3333 ;;
2304df62
AD
3334 esac
3335
3336 case "$1" in
a0d0e21e
LW
3337 aix) osname=aix
3338 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3339 case "$tmp" in
e81c5c2a
NC
3340 # oslevel can fail with:
3341 # oslevel: Unable to acquire lock.
3342 *not\ found) osvers="$4"."$3" ;;
a0d0e21e
LW
3343 '<3240'|'<>3240') osvers=3.2.0 ;;
3344 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3345 '=3250'|'>3250') osvers=3.2.5 ;;
1aef975c 3346 *) osvers=$tmp;;
a0d0e21e
LW
3347 esac
3348 ;;
287574fe
MB
3349 bitrig) osname=bitrig
3350 osvers="$3"
3351 ;;
aaacdc8b
GS
3352 bsd386) osname=bsd386
3353 osvers=`$uname -r`
3354 ;;
3355 cygwin*) osname=cygwin
3356 osvers="$3"
3357 ;;
23f87696
SZ
3358 *dc.osx) osname=dcosx
3359 osvers="$3"
3360 ;;
a0d0e21e
LW
3361 dnix) osname=dnix
3362 osvers="$3"
3363 ;;
3364 domainos) osname=apollo
3365 osvers="$3"
3366 ;;
a774dfe6
RSG
3367 dgux) osname=dgux
3368 osvers="$3"
3369 ;;
3370 dragonfly) osname=dragonfly
a0d0e21e
LW
3371 osvers="$3"
3372 ;;
760ac839 3373 dynixptx*) osname=dynixptx
e58e581d 3374 osvers=`echo "$4"|sed 's/^v//'`
760ac839 3375 ;;
a774dfe6 3376 freebsd) osname=freebsd
a0d0e21e 3377 osvers="$3" ;;
761ee4e8
BD
3378 genix) osname=genix ;;
3379 gnu) osname=gnu
3380 osvers="$3" ;;
a774dfe6 3381 hp*) osname=hpux
bfb7748a 3382 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
a0d0e21e 3383 ;;
761ee4e8 3384 irix*) osname=irix
a0d0e21e
LW
3385 case "$3" in
3386 4*) osvers=4 ;;
3387 5*) osvers=5 ;;
ecfc5424 3388 *) osvers="$3" ;;
a0d0e21e
LW
3389 esac
3390 ;;
761ee4e8 3391 linux) osname=linux
a0d0e21e 3392 case "$3" in
a0d0e21e
LW
3393 *) osvers="$3" ;;
3394 esac
78ada538 3395 $test -f /system/lib/libandroid.so && osname=linux-android
a0d0e21e 3396 ;;
761ee4e8 3397 MiNT) osname=mint
28e8609d
JH
3398 ;;
3399 netbsd*) osname=netbsd
ecfc5424
AD
3400 osvers="$3"
3401 ;;
4e81affe
MMIJG
3402 news-os) osvers="$3"
3403 case "$3" in
3404 4*) osname=newsos4 ;;
3405 *) osname=newsos ;;
3406 esac
3407 ;;
aaacdc8b 3408 next*) osname=next ;;
28bb1e2c 3409 nonstop-ux) osname=nonstopux ;;
65dc58a1
TM
3410 openbsd) osname=openbsd
3411 osvers="$3"
3412 ;;
5c728af0
IZ
3413 os2) osname=os2
3414 osvers="$4"
3415 ;;
aaacdc8b
GS
3416 POSIX-BC | posix-bc ) osname=posix-bc
3417 osvers="$3"
a0d0e21e 3418 ;;
ae3afa4e
TH
3419 powerux | power_ux | powermax_os | powermaxos | \
3420 powerunix | power_unix) osname=powerux
3421 osvers="$3"
3422 ;;
aaacdc8b
GS
3423 qnx) osname=qnx
3424 osvers="$4"
3425 ;;
a0d0e21e
LW
3426 solaris) osname=solaris
3427 case "$3" in
3428 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
ecfc5424 3429 *) osvers="$3" ;;
a0d0e21e
LW
3430 esac
3431 ;;
85e6fe83
LW
3432 sunos) osname=sunos
3433 case "$3" in
85e6fe83
LW
3434 5*) osname=solaris
3435 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
a0d0e21e 3436 *) osvers="$3" ;;
2304df62
AD
3437 esac
3438 ;;
a0d0e21e 3439 titanos) osname=titanos
85e6fe83 3440 case "$3" in
a0d0e21e
LW
3441 1*) osvers=1 ;;
3442 2*) osvers=2 ;;
3443 3*) osvers=3 ;;
3444 4*) osvers=4 ;;
ecfc5424 3445 *) osvers="$3" ;;
2304df62
AD
3446 esac
3447 ;;
85e6fe83 3448 ultrix) osname=ultrix
ecfc5424 3449 osvers="$3"
2304df62 3450 ;;
28757baa 3451 osf1|mls+) case "$5" in
fed7345c
AD
3452 alpha)
3453 osname=dec_osf
fdd85a03 3454 osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2aa76180
JH
3455 case "$osvers" in
3456 [1-9].[0-9]*) ;;
3457 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3458 esac
ecfc5424
AD
3459 ;;
3460 hp*) osname=hp_osf1 ;;
3461 mips) osname=mips_osf1 ;;
85e6fe83
LW
3462 esac
3463 ;;
af1ff193 3464 # UnixWare 7.1.2 is known as Open UNIX 8
381c1bae 3465 openunix|unixware) osname=svr5
0337d152
A
3466 osvers="$4"
3467 ;;
3c728e00 3468 uts) osname=uts
a0d0e21e
LW
3469 osvers="$3"
3470 ;;
3c728e00
JH
3471 vos) osvers="$3"
3472 ;;
85e6fe83 3473 $2) case "$osname" in
2304df62 3474 *isc*) ;;
a0d0e21e 3475 *freebsd*) ;;
5f05dabc 3476 svr*)
a0d0e21e 3477 : svr4.x or possibly later
a774dfe6 3478 case "svr$3" in
a0d0e21e
LW
3479 ${osname}*)
3480 osname=svr$3
3481 osvers=$4
3482 ;;
3483 esac
3484 case "$osname" in
3485 svr4.0)
3486 : Check for ESIX
3487 if test -f /stand/boot ; then
3488 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
ecfc5424
AD
3489 if test -n "$INITPROG" -a -f "$INITPROG"; then
3490 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3491 if test -n "$isesix"; then
a0d0e21e
LW
3492 osname=esix4
3493 fi
3494 fi
3495 fi
3496 ;;
3497 esac
3498 ;;
2304df62 3499 *) if test -f /etc/systemid; then
a0d0e21e
LW
3500 osname=sco
3501 set `echo $3 | $sed 's/\./ /g'` $4
c4f23d77 3502 if $test -f $src/hints/sco_$1_$2_$3.sh; then
85e6fe83 3503 osvers=$1.$2.$3
c4f23d77 3504 elif $test -f $src/hints/sco_$1_$2.sh; then
85e6fe83 3505 osvers=$1.$2
c4f23d77 3506 elif $test -f $src/hints/sco_$1.sh; then
85e6fe83 3507 osvers=$1
2304df62 3508 fi
a0d0e21e
LW
3509 else
3510 case "$osname" in
3511 '') : Still unknown. Probably a generic Sys V.
3512 osname="sysv"
3513 osvers="$3"
3514 ;;
3515 esac
2304df62
AD
3516 fi
3517 ;;
3518 esac
3519 ;;
a0d0e21e
LW
3520 *) case "$osname" in
3521 '') : Still unknown. Probably a generic BSD.
3522 osname="$1"
3523 osvers="$3"
3524 ;;
3525 esac
3526 ;;
2304df62
AD
3527 esac
3528 else
dfe9444c
AD
3529 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3530 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3531 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3532 osname=news_os
2304df62 3533 fi
dfe9444c 3534 $rm -f UU/kernel.what
5c728af0 3535 elif test -d c:/. -o -n "$is_os2" ; then
8e07c86e
AD
3536 set X $myuname
3537 osname=os2
3538 osvers="$5"
2304df62
AD
3539 fi
3540 fi
a774dfe6 3541
5440bc8e
JH
3542 case "$targetarch" in
3543 '') ;;
3544 *) hostarch=$osname
82643807
BF
3545 case "$targetarch" in
3546 nto*|*-nto-*)
c413f034
BF
3547 # Will load qnx.sh, which should change osname to nto
3548 osname=qnx
0d460bac 3549 osvers=''
82643807
BF
3550 ;;
3551 *linux-android*)
3552 # Catch arm-linux-androideabi, mipsel-linux-android,
3553 # and i686-linux-android
3554 osname=linux-android
0d460bac 3555 osvers=''
82643807 3556 ;;
6f372547
BF
3557 *linux*)
3558 # Something like arm-linux-gnueabihf is really just
3559 # plain linux.
3560 osname=linux
0d460bac
BF
3561 osvers=''
3562 ;;
3563 *solaris*|*sunos*)
3564 osname=solaris
3565 # XXX perhaps we should just assume
3566 # osvers to be 2, or maybe take the value
3567 # from targetarch. Using $run before the
3568 # hints are run is somewhat icky.
3569 set X `$run $uname -a 2>/dev/null`
3570 shift
3571 case "$3" in
3572 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3573 *) osvers="$3" ;;
3574 esac
6f372547 3575 ;;
82643807
BF
3576 *)
3577 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
0d460bac 3578 osvers=''
82643807
BF
3579 ;;
3580 esac
5440bc8e
JH
3581 ;;
3582 esac
3583
a0d0e21e
LW
3584 : Now look for a hint file osname_osvers, unless one has been
3585 : specified already.
3586 case "$hintfile" in
3587 ''|' ')
1e127011 3588 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
a0d0e21e 3589 : Also try without trailing minor version numbers.
1e127011
DD
3590 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3591 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3592 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3593 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
a0d0e21e
LW
3594 case "$file" in
3595 '') dflt=none ;;
3596 *) case "$osvers" in
3597 '') dflt=$file
3598 ;;
dfe9444c 3599 *) if $test -f $src/hints/$file.sh ; then
a0d0e21e 3600 dflt=$file
dfe9444c 3601 elif $test -f $src/hints/$xfile.sh ; then
a0d0e21e 3602 dflt=$xfile
dfe9444c 3603 elif $test -f $src/hints/$xxfile.sh ; then
a0d0e21e 3604 dflt=$xxfile
dfe9444c 3605 elif $test -f $src/hints/$xxxfile.sh ; then
a0d0e21e 3606 dflt=$xxxfile
dfe9444c 3607 elif $test -f $src/hints/$xxxxfile.sh ; then
a0d0e21e 3608 dflt=$xxxxfile
dfe9444c 3609 elif $test -f "$src/hints/${osname}.sh" ; then
a0d0e21e
LW
3610 dflt="${osname}"
3611 else
3612 dflt=none
3613 fi
3614 ;;
3615 esac
85e6fe83
LW
3616 ;;
3617 esac
4e2a5f63
AD
3618 if $test -f Policy.sh ; then
3619 case "$dflt" in
3620 *Policy*) ;;
3621 none) dflt="Policy" ;;
3622 *) dflt="Policy $dflt" ;;
3623 esac
3624 fi
85e6fe83 3625 ;;
a0d0e21e 3626 *)
ecfc5424 3627 dflt=`echo $hintfile | $sed 's/\.sh$//'`
a0d0e21e 3628 ;;
2304df62 3629 esac
1aef975c 3630
4e2a5f63
AD
3631 if $test -f Policy.sh ; then
3632 $cat <<EOM
3633
3634There's also a Policy hint file available, which should make the
3635site-specific (policy) questions easier to answer.
3636EOM
3637
3638 fi
3639
2304df62
AD
3640 $cat <<EOM
3641
3642You may give one or more space-separated answers, or "none" if appropriate.
a2d23ec2
MB
3643If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3644previous run of Configure, you may specify it as well as or instead of
3645OS-specific hints. If hints are provided for your OS, you should use them:
3646although Perl can probably be built without hints on many platforms, using
3647hints often improve performance and may enable features that Configure can't
3648set up on its own. If there are no hints that match your OS, specify "none";
3649DO NOT give a wrong version or a wrong OS.
2304df62
AD
3650
3651EOM
4e2a5f63 3652
2304df62 3653 rp="Which of these apply, if any?"
dfe9444c 3654 . UU/myread
85e6fe83
LW
3655 tans=$ans
3656 for file in $tans; do
4e2a5f63
AD
3657 if $test X$file = XPolicy -a -f Policy.sh; then
3658 . Policy.sh
3659 $cat Policy.sh >> UU/config.sh
3660 elif $test -f $src/hints/$file.sh; then
dfe9444c
AD
3661 . $src/hints/$file.sh
3662 $cat $src/hints/$file.sh >> UU/config.sh
5440bc8e 3663 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
2304df62
AD
3664 : nothing
3665 else
85e6fe83
LW
3666 : Give one chance to correct a possible typo.
3667 echo "$file.sh does not exist"
3668 dflt=$file
3669 rp="hint to use instead?"
dfe9444c 3670 . UU/myread
85e6fe83 3671 for file in $ans; do
dfe9444c
AD
3672 if $test -f "$src/hints/$file.sh"; then
3673 . $src/hints/$file.sh
3674 $cat $src/hints/$file.sh >> UU/config.sh
85e6fe83
LW
3675 elif $test X$ans = X -o X$ans = Xnone ; then
3676 : nothing
3677 else
3678 echo "$file.sh does not exist -- ignored."
3679 fi
3680 done
2304df62
AD
3681 fi
3682 done
85e6fe83 3683
2304df62 3684 hint=recommended
85e6fe83 3685 : Remember our hint file for later.
dfe9444c 3686 if $test -f "$src/hints/$file.sh" ; then
a0d0e21e 3687 hintfile="$file"
85e6fe83 3688 else
a0d0e21e 3689 hintfile=''
85e6fe83 3690 fi
2304df62
AD
3691fi
3692cd UU
3693;;
3694*)
3695 echo " "
3696 echo "Fetching default answers from $config_sh..." >&4
ecfc5424
AD
3697 tmp_n="$n"
3698 tmp_c="$c"
2304df62
AD
3699 cd ..
3700 cp $config_sh config.sh 2>/dev/null
a78b0d02 3701 chmod +w config.sh
2304df62
AD
3702 . ./config.sh
3703 cd UU
3704 cp ../config.sh .
ecfc5424
AD
3705 n="$tmp_n"
3706 c="$tmp_c"
2304df62
AD
3707 hint=previous
3708 ;;
3709esac
1aef975c 3710test "$override" && . ./optdef.sh
2304df62
AD
3711
3712: Restore computed paths
3713for file in $loclist $trylist; do
3714 eval $file="\$_$file"
3715done
3716
85e6fe83 3717cat << EOM
a0d0e21e 3718
85e6fe83 3719Configure uses the operating system name and version to set some defaults.
ecfc5424
AD
3720The default value is probably right if the name rings a bell. Otherwise,
3721since spelling matters for me, either accept the default or answer "none"
3722to leave it blank.
a0d0e21e 3723
85e6fe83 3724EOM
85e6fe83 3725case "$osname" in
a0d0e21e 3726 ''|' ')
85e6fe83 3727 case "$hintfile" in
a0d0e21e 3728 ''|' '|none) dflt=none ;;
ecfc5424 3729 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
85e6fe83
LW
3730 esac
3731 ;;
3732 *) dflt="$osname" ;;
3733esac
3734rp="Operating system name?"
3735. ./myread
3736case "$ans" in
ecfc5424
AD
3737none) osname='' ;;
3738*) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
85e6fe83 3739esac
8ff267be
PP
3740echo " "
3741case "$osvers" in
3742 ''|' ')
3743 case "$hintfile" in
3744 ''|' '|none) dflt=none ;;
3745 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3746 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3747 case "$dflt" in
3748 ''|' ') dflt=none ;;
3749 esac
3750 ;;
3751 esac
3752 ;;
3753 *) dflt="$osvers" ;;
3754esac
3755rp="Operating system version?"
3756. ./myread
3757case "$ans" in
3758none) osvers='' ;;
3759*) osvers="$ans" ;;
3760esac
3761
02e93a22
JH
3762
3763. ./posthint.sh
3764
2304df62 3765: who configured the system
59b83a6f 3766cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
dfe9444c
AD
3767case "$cf_by" in
3768"")
7c04078e 3769 cf_by=`(logname) 2>/dev/null`
dfe9444c 3770 case "$cf_by" in
7c04078e
GA
3771 "")
3772 cf_by=`(whoami) 2>/dev/null`
3773 case "$cf_by" in
3774 "") cf_by=unknown ;;
3775 esac ;;
8ff267be
PP
3776 esac ;;
3777esac
2304df62 3778
f3f1a2d8
MB
3779: decide how portable to be. Allow command line overrides.
3780case "$d_portable" in
3781"$undef") ;;
3782*) d_portable="$define" ;;
b4eb6b3d 3783esac
b4eb6b3d 3784
f3f1a2d8
MB
3785: set up shell script to do ~ expansion
3786cat >filexp <<EOSS
3787$startsh
3788: expand filename
3789case "\$1" in
f16e9d76 3790 \~/*|\~)
f3f1a2d8
MB
3791 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3792 ;;
4137585d 3793 \~*)
f3f1a2d8
MB
3794 if $test -f /bin/csh; then
3795 /bin/csh -f -c "glob \$1"
3796 failed=\$?
3797 echo ""
3798 exit \$failed
3799 else
3800 name=\`$expr x\$1 : '..\([^/]*\)'\`
3801 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3802 if $test ! -d "\$dir"; then
3803 me=\`basename \$0\`
3804 echo "\$me: can't locate home directory for: \$name" >&2
3805 exit 1
3806 fi
3807 case "\$1" in
3808 */*)
3809 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3810 ;;
3811 *)
3812 echo \$dir
3813 ;;
3814 esac
3815 fi
3816 ;;
3817*)
3818 echo \$1
3819 ;;
b29b105d 3820esac
f3f1a2d8
MB
3821EOSS
3822chmod +x filexp
3823