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