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