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