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