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