Fix RT [perl #72156] Re: Perl 5.12.0 RC 0 - Pager detection
[perl.git] / Configure
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 package (which contains metaconfig) is available via SVN:
17 #     svn co https://svn.sourceforge.net/svnroot/dist/trunk/dist
18 #
19 # Though this script was generated by metaconfig from metaunits, it is
20 # OK to send patches against Configure itself. It's up to the Configure
21 # pumpkin to backport the patch to the metaunits if it is accepted.
22 # For more information on patching Configure, see pod/perlhack.pod
23 #
24 # The metaunits are also available from the public git repository:
25 #     http://perl5.git.perl.org/metaconfig.git/ or
26 #     $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
27 #
28 # See Porting/pumpkin.pod for more information on metaconfig.
29 #
30
31 # Generated on Wed Jul 11 16:58:32 CEST 2012 [metaconfig 3.5 PL0]
32 # (with additional metaconfig patches by perlbug@perl.org)
33
34 cat >c1$$ <<EOF
35 ARGGGHHHH!!!!!
36
37 SCO csh still thinks true is false.  Write to SCO today and tell them that next
38 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
39
40 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
41 we'd have to do is go in and swap the && and || tokens, wherever they are.)
42
43 [End of diatribe. We now return you to your regularly scheduled programming...]
44 EOF
45 cat >c2$$ <<EOF
46
47 OOPS!  You naughty creature!  You didn't run Configure with sh!
48 I will attempt to remedy the situation by running sh for you...
49 EOF
50
51 true || cat c1$$ c2$$
52 true || exec sh $0 $argv:q
53
54 (exit $?0) || cat c2$$
55 (exit $?0) || exec sh $0 $argv:q
56 rm -f c1$$ c2$$
57
58 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
59         cat <<EOF
60 ***
61 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
62 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
63 *** Please read the README.plan9 for further instructions.
64 *** Cannot continue, aborting.
65 ***
66 EOF
67         exit 1
68 fi
69
70 if test ! -c /dev/null ; then
71         cat <<EOF
72 ***
73 *** I'm sorry, but /dev/null appears to be a file rather than a device.
74 *** Please consult your operating sytem's notes for making a device
75 *** in /dev.
76 *** Cannot continue, aborting.
77 ***
78 EOF
79         exit 1
80 fi
81
82 : compute my invocation name
83 me=$0
84 case "$0" in
85 */*)
86         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
87         test "$me" || me=$0
88         ;;
89 esac
90
91 : Proper separator for the PATH environment variable
92 p_=:
93 : On OS/2 this directory should exist if this is not floppy only system ":-]"
94 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
95         if test -n "$OS2_SHELL"; then
96                 p_=\;
97                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
98                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
99                 is_os2=yes
100         elif test -n "$DJGPP"; then
101                 case "X${MACHTYPE:-nonesuchmach}" in
102                 *cygwin) ;;
103                 *) p_=\; ;;
104                 esac
105         fi
106 fi
107
108 : Proper PATH setting
109 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
110 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
111 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
112 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
113 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
114 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
115 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
116 paths="$paths /sbin /usr/sbin /usr/libexec"
117 paths="$paths /system/gnu_library/bin"
118
119 for p in $paths
120 do
121         case "$p_$PATH$p_" in
122         *$p_$p$p_*) ;;
123         *) test -d $p && PATH=$PATH$p_$p ;;
124         esac
125 done
126
127 PATH=.$p_$PATH
128 export PATH
129
130 : shall we be using ksh?
131 inksh=''
132 needksh=''
133 avoidksh=''
134 newsh=/bin/ksh
135 changesh=''
136 if (PATH=.; alias -x) >/dev/null 2>&1; then
137                 inksh=true
138 fi
139 if test -f /hp-ux -a -f /bin/ksh; then
140         needksh='to avoid sh bug in "here document" expansion'
141 fi
142 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
143         if test X`/usr/bin/uname -v` = X4; then
144                 avoidksh="to avoid AIX 4's /bin/sh"
145                 newsh=/usr/bin/bsh
146         fi
147 fi
148 if test -f /osf_boot -a -f /usr/sbin/setld; then
149         if test X`/usr/bin/uname -s` = XOSF1; then
150                 avoidksh="to avoid Digital UNIX' ksh"
151                 newsh=/bin/sh
152                 unset BIN_SH
153         fi
154 fi
155 case "$inksh/$needksh" in
156 /[a-z]*)
157                 ENV=''
158                 changesh=true
159                 reason="$needksh"
160         ;;
161 esac
162 case "$inksh/$avoidksh" in
163 true/[a-z]*)
164         changesh=true
165         reason="$avoidksh"
166         ;;
167 esac
168 case "$inksh/$needksh-$avoidksh-" in
169 true/--)
170                 cat <<EOM
171 (I see you are using the Korn shell.  Some ksh's blow up on $me,
172 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
173 EOM
174         ;;
175 esac
176 case "$changesh" in
177 true)
178         export newsh
179         echo "(Feeding myself to $newsh $reason.)"
180         case "$0" in
181         Configure|*/Configure) exec $newsh $0 "$@";;
182         *) exec $newsh Configure "$@";;
183         esac
184         ;;
185 esac
186 test -x "${newsh}" || unset newsh
187
188 : if needed, set CDPATH to a harmless value that is not chatty
189 : avoid bash 2.02 problems with empty CDPATH.
190 case "$CDPATH" in
191 '')     ;;
192 *)      case "$SHELL" in
193         *bash*) CDPATH='.' ;;
194         *) CDPATH='' ;;
195         esac
196         ;;
197 esac
198
199 : Configure runs within the UU subdirectory
200 test -d UU || mkdir UU
201 cd UU && rm -f ./*
202
203 ccname=''
204 ccversion=''
205 ccsymbols=''
206 cppccsymbols=''
207 cppsymbols=''
208 from=''
209 run=''
210 targetarch=''
211 to=''
212 usecrosscompile=''
213 extern_C=''
214 mistrustnm=''
215 usedevel=''
216 perllibs=''
217 dynamic_ext=''
218 extensions=''
219 known_extensions=''
220 nonxs_ext=''
221 static_ext=''
222 useopcode=''
223 useposix=''
224 extras=''
225 d_bsd=''
226 d_eunice=''
227 d_xenix=''
228 eunicefix=''
229 ar=''
230 awk=''
231 bash=''
232 bison=''
233 byacc=''
234 cat=''
235 chgrp=''
236 chmod=''
237 chown=''
238 comm=''
239 compress=''
240 cp=''
241 cpio=''
242 cpp=''
243 csh=''
244 date=''
245 echo=''
246 egrep=''
247 emacs=''
248 expr=''
249 find=''
250 flex=''
251 gmake=''
252 grep=''
253 gzip=''
254 inews=''
255 ksh=''
256 less=''
257 line=''
258 lint=''
259 ln=''
260 lp=''
261 lpr=''
262 ls=''
263 mail=''
264 mailx=''
265 make=''
266 mkdir=''
267 more=''
268 mv=''
269 nm=''
270 nroff=''
271 perl=''
272 pg=''
273 pmake=''
274 pr=''
275 rm=''
276 rmail=''
277 sed=''
278 sendmail=''
279 shar=''
280 sleep=''
281 smail=''
282 sort=''
283 submit=''
284 tail=''
285 tar=''
286 tbl=''
287 tee=''
288 test=''
289 touch=''
290 tr=''
291 troff=''
292 uname=''
293 uniq=''
294 uuname=''
295 vi=''
296 zcat=''
297 zip=''
298 full_ar=''
299 full_sed=''
300 libswanted=''
301 hint=''
302 myuname=''
303 osname=''
304 osvers=''
305 Author=''
306 Date=''
307 Header=''
308 Id=''
309 Locker=''
310 Log=''
311 RCSfile=''
312 Revision=''
313 Source=''
314 State=''
315 _a=''
316 _exe=''
317 _o=''
318 archobjs=''
319 exe_ext=''
320 firstmakefile=''
321 lib_ext=''
322 obj_ext=''
323 path_sep=''
324 rm_try=''
325 afs=''
326 afsroot=''
327 alignbytes=''
328 ansi2knr=''
329 archlib=''
330 archlibexp=''
331 d_archlib=''
332 installarchlib=''
333 archname=''
334 myarchname=''
335 d_atolf=''
336 d_atoll=''
337 baserev=''
338 bin=''
339 binexp=''
340 initialinstalllocation=''
341 installbin=''
342 userelocatableinc=''
343 byteorder=''
344 cc=''
345 ccflags=''
346 cppflags=''
347 ldflags=''
348 lkflags=''
349 locincpth=''
350 optimize=''
351 cf_email=''
352 cf_by=''
353 cf_time=''
354 charbits=''
355 charsize=''
356 contains=''
357 cpp_stuff=''
358 cpplast=''
359 cppminus=''
360 cpprun=''
361 cppstdin=''
362 d__fwalk=''
363 d_access=''
364 d_accessx=''
365 d_aintl=''
366 d_alarm=''
367 asctime_r_proto=''
368 d_asctime_r=''
369 d_attribute_deprecated=''
370 d_attribute_format=''
371 d_attribute_malloc=''
372 d_attribute_nonnull=''
373 d_attribute_noreturn=''
374 d_attribute_pure=''
375 d_attribute_unused=''
376 d_attribute_warn_unused_result=''
377 d_printf_format_null=''
378 d_bcmp=''
379 d_bcopy=''
380 d_builtin_choose_expr=''
381 d_builtin_expect=''
382 d_bzero=''
383 d_c99_variadic_macros=''
384 d_casti32=''
385 castflags=''
386 d_castneg=''
387 d_chown=''
388 d_chroot=''
389 d_chsize=''
390 d_class=''
391 d_clearenv=''
392 d_closedir=''
393 d_void_closedir=''
394 d_cmsghdr_s=''
395 d_const=''
396 d_copysignl=''
397 d_cplusplus=''
398 cryptlib=''
399 d_crypt=''
400 crypt_r_proto=''
401 d_crypt_r=''
402 d_csh=''
403 full_csh=''
404 d_ctermid=''
405 ctermid_r_proto=''
406 d_ctermid_r=''
407 ctime_r_proto=''
408 d_ctime_r=''
409 d_cuserid=''
410 d_dbl_dig=''
411 d_dbminitproto=''
412 d_difftime=''
413 d_dir_dd_fd=''
414 d_dirfd=''
415 d_dlerror=''
416 d_dlopen=''
417 d_dlsymun=''
418 d_dosuid=''
419 d_suidsafe=''
420 d_drand48_r=''
421 drand48_r_proto=''
422 d_drand48proto=''
423 d_dup2=''
424 d_eaccess=''
425 d_endgrent=''
426 d_endgrent_r=''
427 endgrent_r_proto=''
428 d_endhent=''
429 d_endhostent_r=''
430 endhostent_r_proto=''
431 d_endnent=''
432 d_endnetent_r=''
433 endnetent_r_proto=''
434 d_endpent=''
435 d_endprotoent_r=''
436 endprotoent_r_proto=''
437 d_endpwent=''
438 d_endpwent_r=''
439 endpwent_r_proto=''
440 d_endsent=''
441 d_endservent_r=''
442 endservent_r_proto=''
443 d_faststdio=''
444 d_fchdir=''
445 d_fchmod=''
446 d_fchown=''
447 d_fcntl=''
448 d_fcntl_can_lock=''
449 d_fd_macros=''
450 d_fd_set=''
451 d_fds_bits=''
452 d_fgetpos=''
453 d_finite=''
454 d_finitel=''
455 d_flexfnam=''
456 d_flock=''
457 d_flockproto=''
458 d_fork=''
459 d_fp_class=''
460 d_fpclass=''
461 d_fpclassify=''
462 d_fpclassl=''
463 d_fpos64_t=''
464 d_frexpl=''
465 d_fs_data_s=''
466 d_fseeko=''
467 d_fsetpos=''
468 d_fstatfs=''
469 d_fsync=''
470 d_ftello=''
471 d_ftime=''
472 d_gettimeod=''
473 d_futimes=''
474 d_Gconvert=''
475 d_getaddrinfo=''
476 d_getcwd=''
477 d_getespwnam=''
478 d_getfsstat=''
479 d_getgrent=''
480 d_getgrent_r=''
481 getgrent_r_proto=''
482 d_getgrgid_r=''
483 getgrgid_r_proto=''
484 d_getgrnam_r=''
485 getgrnam_r_proto=''
486 d_getgrps=''
487 d_gethbyaddr=''
488 d_gethbyname=''
489 d_gethent=''
490 aphostname=''
491 d_gethname=''
492 d_phostname=''
493 d_uname=''
494 d_gethostbyaddr_r=''
495 gethostbyaddr_r_proto=''
496 d_gethostbyname_r=''
497 gethostbyname_r_proto=''
498 d_gethostent_r=''
499 gethostent_r_proto=''
500 d_gethostprotos=''
501 d_getitimer=''
502 d_getlogin=''
503 d_getlogin_r=''
504 getlogin_r_proto=''
505 d_getmnt=''
506 d_getmntent=''
507 d_getnameinfo=''
508 d_getnbyaddr=''
509 d_getnbyname=''
510 d_getnent=''
511 d_getnetbyaddr_r=''
512 getnetbyaddr_r_proto=''
513 d_getnetbyname_r=''
514 getnetbyname_r_proto=''
515 d_getnetent_r=''
516 getnetent_r_proto=''
517 d_getnetprotos=''
518 d_getpagsz=''
519 d_getpent=''
520 d_getpgid=''
521 d_getpgrp2=''
522 d_bsdgetpgrp=''
523 d_getpgrp=''
524 d_getppid=''
525 d_getprior=''
526 d_getpbyname=''
527 d_getpbynumber=''
528 d_getprotobyname_r=''
529 getprotobyname_r_proto=''
530 d_getprotobynumber_r=''
531 getprotobynumber_r_proto=''
532 d_getprotoent_r=''
533 getprotoent_r_proto=''
534 d_getprotoprotos=''
535 d_getprpwnam=''
536 d_getpwent=''
537 d_getpwent_r=''
538 getpwent_r_proto=''
539 d_getpwnam_r=''
540 getpwnam_r_proto=''
541 d_getpwuid_r=''
542 getpwuid_r_proto=''
543 d_getsent=''
544 d_getservbyname_r=''
545 getservbyname_r_proto=''
546 d_getservbyport_r=''
547 getservbyport_r_proto=''
548 d_getservent_r=''
549 getservent_r_proto=''
550 d_getservprotos=''
551 d_getspnam=''
552 d_getspnam_r=''
553 getspnam_r_proto=''
554 d_getsbyname=''
555 d_getsbyport=''
556 d_gmtime_r=''
557 gmtime_r_proto=''
558 d_gnulibc=''
559 gnulibc_version=''
560 d_hasmntopt=''
561 d_htonl=''
562 d_ilogbl=''
563 d_inetaton=''
564 d_inetntop=''
565 d_inetpton=''
566 d_int64_t=''
567 d_isascii=''
568 d_isblank=''
569 d_isfinite=''
570 d_isinf=''
571 d_isnan=''
572 d_isnanl=''
573 d_killpg=''
574 d_lchown=''
575 d_ldbl_dig=''
576 d_libm_lib_version=''
577 d_link=''
578 d_localtime_r=''
579 d_localtime_r_needs_tzset=''
580 localtime_r_proto=''
581 d_locconv=''
582 d_lockf=''
583 d_longdbl=''
584 longdblsize=''
585 d_longlong=''
586 longlongsize=''
587 d_lseekproto=''
588 d_lstat=''
589 d_madvise=''
590 d_malloc_good_size=''
591 d_malloc_size=''
592 d_mblen=''
593 d_mbstowcs=''
594 d_mbtowc=''
595 d_memchr=''
596 d_memcmp=''
597 d_memcpy=''
598 d_memmove=''
599 d_memset=''
600 d_mkdir=''
601 d_mkdtemp=''
602 d_mkfifo=''
603 d_mkstemp=''
604 d_mkstemps=''
605 d_mktime=''
606 d_mmap=''
607 mmaptype=''
608 d_modfl=''
609 d_modfl_pow32_bug=''
610 d_modflproto=''
611 d_mprotect=''
612 d_msg=''
613 d_msgctl=''
614 d_msgget=''
615 d_msghdr_s=''
616 d_msgrcv=''
617 d_msgsnd=''
618 d_msync=''
619 d_munmap=''
620 d_nice=''
621 d_nl_langinfo=''
622 d_off64_t=''
623 d_open3=''
624 d_fpathconf=''
625 d_pathconf=''
626 d_pause=''
627 d_pipe=''
628 d_poll=''
629 d_portable=''
630 d_prctl=''
631 d_prctl_set_name=''
632 d_procselfexe=''
633 procselfexe=''
634 d_old_pthread_create_joinable=''
635 old_pthread_create_joinable=''
636 d_pthread_atfork=''
637 d_pthread_attr_setscope=''
638 d_pthread_yield=''
639 d_sched_yield=''
640 sched_yield=''
641 d_qgcvt=''
642 d_random_r=''
643 random_r_proto=''
644 d_readdir64_r=''
645 readdir64_r_proto=''
646 d_readdir=''
647 d_rewinddir=''
648 d_seekdir=''
649 d_telldir=''
650 d_readdir_r=''
651 readdir_r_proto=''
652 d_readlink=''
653 d_readv=''
654 d_recvmsg=''
655 d_rename=''
656 d_rmdir=''
657 d_safebcpy=''
658 d_safemcpy=''
659 d_sanemcmp=''
660 d_sbrkproto=''
661 d_scalbnl=''
662 d_select=''
663 d_sem=''
664 d_semctl=''
665 d_semget=''
666 d_semop=''
667 d_sendmsg=''
668 d_setegid=''
669 d_seteuid=''
670 d_setgrent=''
671 d_setgrent_r=''
672 setgrent_r_proto=''
673 d_setgrps=''
674 d_sethent=''
675 d_sethostent_r=''
676 sethostent_r_proto=''
677 d_setitimer=''
678 d_setlinebuf=''
679 d_setlocale=''
680 d_setlocale_r=''
681 setlocale_r_proto=''
682 d_setnent=''
683 d_setnetent_r=''
684 setnetent_r_proto=''
685 d_setpent=''
686 d_setpgid=''
687 d_setpgrp2=''
688 d_bsdsetpgrp=''
689 d_setpgrp=''
690 d_setprior=''
691 d_setproctitle=''
692 d_setprotoent_r=''
693 setprotoent_r_proto=''
694 d_setpwent=''
695 d_setpwent_r=''
696 setpwent_r_proto=''
697 d_setregid=''
698 d_setresgid=''
699 d_setresuid=''
700 d_setreuid=''
701 d_setrgid=''
702 d_setruid=''
703 d_setsent=''
704 d_setservent_r=''
705 setservent_r_proto=''
706 d_setsid=''
707 d_setvbuf=''
708 d_sfio=''
709 usesfio=''
710 d_shm=''
711 d_shmat=''
712 d_shmatprototype=''
713 shmattype=''
714 d_shmctl=''
715 d_shmdt=''
716 d_shmget=''
717 d_sigaction=''
718 d_signbit=''
719 d_sigprocmask=''
720 d_sigsetjmp=''
721 usesitecustomize=''
722 d_snprintf=''
723 d_vsnprintf=''
724 d_sockatmark=''
725 d_sockatmarkproto=''
726 d_ip_mreq=''
727 d_ipv6_mreq=''
728 d_msg_ctrunc=''
729 d_msg_dontroute=''
730 d_msg_oob=''
731 d_msg_peek=''
732 d_msg_proxy=''
733 d_oldsock=''
734 d_scm_rights=''
735 d_sin6_scope_id=''
736 d_sockaddr_in6=''
737 d_sockaddr_sa_len=''
738 d_socket=''
739 d_sockpair=''
740 sockethdr=''
741 socketlib=''
742 d_socklen_t=''
743 d_socks5_init=''
744 d_sprintf_returns_strlen=''
745 d_sqrtl=''
746 d_srand48_r=''
747 srand48_r_proto=''
748 d_srandom_r=''
749 srandom_r_proto=''
750 d_sresgproto=''
751 d_sresuproto=''
752 d_statblks=''
753 d_statfs_f_flags=''
754 d_statfs_s=''
755 d_static_inline=''
756 perl_static_inline=''
757 d_fstatvfs=''
758 d_statvfs=''
759 d_stdio_cnt_lval=''
760 d_stdio_ptr_lval=''
761 d_stdio_ptr_lval_nochange_cnt=''
762 d_stdio_ptr_lval_sets_cnt=''
763 d_stdiobase=''
764 d_stdstdio=''
765 stdio_base=''
766 stdio_bufsiz=''
767 stdio_cnt=''
768 stdio_filbuf=''
769 stdio_ptr=''
770 d_index=''
771 d_strchr=''
772 d_strcoll=''
773 d_strctcpy=''
774 d_strerrm=''
775 d_strerror=''
776 d_sysernlst=''
777 d_syserrlst=''
778 d_strerror_r=''
779 strerror_r_proto=''
780 d_strftime=''
781 d_strlcat=''
782 d_strlcpy=''
783 d_strtod=''
784 d_strtol=''
785 d_strtold=''
786 d_strtoll=''
787 d_strtoq=''
788 d_strtoul=''
789 d_strtoull=''
790 d_strtouq=''
791 d_strxfrm=''
792 d_symlink=''
793 d_syscall=''
794 d_syscallproto=''
795 d_sysconf=''
796 d_system=''
797 d_tcgetpgrp=''
798 d_tcsetpgrp=''
799 d_telldirproto=''
800 d_time=''
801 timetype=''
802 d_asctime64=''
803 d_ctime64=''
804 d_difftime64=''
805 d_gmtime64=''
806 d_localtime64=''
807 d_mktime64=''
808 d_timegm=''
809 clocktype=''
810 d_times=''
811 d_tmpnam_r=''
812 tmpnam_r_proto=''
813 d_truncate=''
814 d_ttyname_r=''
815 ttyname_r_proto=''
816 d_tzname=''
817 d_u32align=''
818 d_ualarm=''
819 d_umask=''
820 d_semctl_semid_ds=''
821 d_semctl_semun=''
822 d_union_semun=''
823 d_unordered=''
824 d_unsetenv=''
825 d_usleep=''
826 d_usleepproto=''
827 d_ustat=''
828 d_pseudofork=''
829 d_vfork=''
830 usevfork=''
831 d_voidsig=''
832 signal_t=''
833 d_volatile=''
834 d_charvspr=''
835 d_vprintf=''
836 d_wait4=''
837 d_waitpid=''
838 d_wcstombs=''
839 d_wctomb=''
840 d_writev=''
841 dlext=''
842 bin_ELF=''
843 cccdlflags=''
844 ccdlflags=''
845 dlsrc=''
846 ld=''
847 ld_can_script=''
848 lddlflags=''
849 usedl=''
850 doublesize=''
851 ebcdic=''
852 fflushNULL=''
853 fflushall=''
854 fpossize=''
855 fpostype=''
856 gccansipedantic=''
857 gccosandvers=''
858 gccversion=''
859 gidformat=''
860 gidsign=''
861 gidsize=''
862 gidtype=''
863 groupstype=''
864 h_fcntl=''
865 h_sysfile=''
866 html1dir=''
867 html1direxp=''
868 installhtml1dir=''
869 html3dir=''
870 html3direxp=''
871 installhtml3dir=''
872 i_arpainet=''
873 i_assert=''
874 i_crypt=''
875 db_hashtype=''
876 db_prefixtype=''
877 db_version_major=''
878 db_version_minor=''
879 db_version_patch=''
880 i_db=''
881 i_dbm=''
882 i_rpcsvcdbm=''
883 d_dirnamlen=''
884 direntrytype=''
885 i_dirent=''
886 i_dld=''
887 i_dlfcn=''
888 i_fcntl=''
889 i_float=''
890 i_fp=''
891 i_fp_class=''
892 i_gdbm=''
893 d_grpasswd=''
894 i_grp=''
895 i_ieeefp=''
896 i_inttypes=''
897 i_langinfo=''
898 i_libutil=''
899 i_limits=''
900 i_locale=''
901 i_machcthr=''
902 i_malloc=''
903 i_mallocmalloc=''
904 i_math=''
905 i_memory=''
906 i_mntent=''
907 d_gdbm_ndbm_h_uses_prototypes=''
908 d_gdbmndbm_h_uses_prototypes=''
909 d_ndbm=''
910 d_ndbm_h_uses_prototypes=''
911 i_gdbm_ndbm=''
912 i_gdbmndbm=''
913 i_ndbm=''
914 i_netdb=''
915 i_neterrno=''
916 i_netinettcp=''
917 i_niin=''
918 i_sysin=''
919 i_poll=''
920 i_prot=''
921 i_pthread=''
922 d_pwage=''
923 d_pwchange=''
924 d_pwclass=''
925 d_pwcomment=''
926 d_pwexpire=''
927 d_pwgecos=''
928 d_pwpasswd=''
929 d_pwquota=''
930 i_pwd=''
931 i_sfio=''
932 i_shadow=''
933 i_socks=''
934 i_stdbool=''
935 i_stddef=''
936 i_stdlib=''
937 i_string=''
938 strings=''
939 i_sunmath=''
940 i_sysaccess=''
941 i_sysdir=''
942 i_sysfile=''
943 d_voidtty=''
944 i_bsdioctl=''
945 i_sysfilio=''
946 i_sysioctl=''
947 i_syssockio=''
948 i_syslog=''
949 i_sysmman=''
950 i_sysmode=''
951 i_sysmount=''
952 i_sysndir=''
953 i_sysparam=''
954 i_syspoll=''
955 i_sysresrc=''
956 i_syssecrt=''
957 i_sysselct=''
958 i_sysstat=''
959 i_sysstatfs=''
960 i_sysstatvfs=''
961 i_systimes=''
962 i_systypes=''
963 i_sysuio=''
964 i_sysun=''
965 i_sysutsname=''
966 i_sysvfs=''
967 i_syswait=''
968 i_sgtty=''
969 i_termio=''
970 i_termios=''
971 d_tm_tm_gmtoff=''
972 d_tm_tm_zone=''
973 i_systime=''
974 i_systimek=''
975 i_time=''
976 timeincl=''
977 i_unistd=''
978 i_ustat=''
979 i_utime=''
980 i_values=''
981 i_stdarg=''
982 i_varargs=''
983 i_varhdr=''
984 i_vfork=''
985 d_inc_version_list=''
986 inc_version_list=''
987 inc_version_list_init=''
988 installprefix=''
989 installprefixexp=''
990 installstyle=''
991 installusrbinperl=''
992 intsize=''
993 longsize=''
994 shortsize=''
995 issymlink=''
996 libc=''
997 ldlibpthname=''
998 libperl=''
999 shrpenv=''
1000 useshrplib=''
1001 glibpth=''
1002 libpth=''
1003 loclibpth=''
1004 plibpth=''
1005 xlibpth=''
1006 ignore_versioned_solibs=''
1007 libs=''
1008 libsdirs=''
1009 libsfiles=''
1010 libsfound=''
1011 libspath=''
1012 lns=''
1013 d_PRIEUldbl=''
1014 d_PRIFUldbl=''
1015 d_PRIGUldbl=''
1016 d_PRIeldbl=''
1017 d_PRIfldbl=''
1018 d_PRIgldbl=''
1019 d_SCNfldbl=''
1020 sPRIEUldbl=''
1021 sPRIFUldbl=''
1022 sPRIGUldbl=''
1023 sPRIeldbl=''
1024 sPRIfldbl=''
1025 sPRIgldbl=''
1026 sSCNfldbl=''
1027 lseeksize=''
1028 lseektype=''
1029 mad=''
1030 madlyh=''
1031 madlyobj=''
1032 madlysrc=''
1033 make_set_make=''
1034 d_mymalloc=''
1035 freetype=''
1036 mallocobj=''
1037 mallocsrc=''
1038 malloctype=''
1039 usemallocwrap=''
1040 usemymalloc=''
1041 installman1dir=''
1042 man1dir=''
1043 man1direxp=''
1044 man1ext=''
1045 installman3dir=''
1046 man3dir=''
1047 man3direxp=''
1048 man3ext=''
1049 modetype=''
1050 multiarch=''
1051 mydomain=''
1052 myhostname=''
1053 phostname=''
1054 c=''
1055 n=''
1056 d_eofnblk=''
1057 eagain=''
1058 o_nonblock=''
1059 rd_nodata=''
1060 need_va_copy=''
1061 netdb_hlen_type=''
1062 netdb_host_type=''
1063 netdb_name_type=''
1064 netdb_net_type=''
1065 groupcat=''
1066 hostcat=''
1067 passcat=''
1068 orderlib=''
1069 ranlib=''
1070 d_perl_otherlibdirs=''
1071 otherlibdirs=''
1072 package=''
1073 spackage=''
1074 pager=''
1075 api_revision=''
1076 api_subversion=''
1077 api_version=''
1078 api_versionstring=''
1079 patchlevel=''
1080 perl_patchlevel=''
1081 revision=''
1082 subversion=''
1083 version=''
1084 version_patchlevel_string=''
1085 perl5=''
1086 perladmin=''
1087 perlpath=''
1088 d_nv_preserves_uv=''
1089 d_nv_zero_is_allbits_zero=''
1090 i16size=''
1091 i16type=''
1092 i32size=''
1093 i32type=''
1094 i64size=''
1095 i64type=''
1096 i8size=''
1097 i8type=''
1098 ivsize=''
1099 ivtype=''
1100 nv_overflows_integers_at=''
1101 nv_preserves_uv_bits=''
1102 nvsize=''
1103 nvtype=''
1104 u16size=''
1105 u16type=''
1106 u32size=''
1107 u32type=''
1108 u64size=''
1109 u64type=''
1110 u8size=''
1111 u8type=''
1112 uvsize=''
1113 uvtype=''
1114 ivdformat=''
1115 nvEUformat=''
1116 nvFUformat=''
1117 nvGUformat=''
1118 nveformat=''
1119 nvfformat=''
1120 nvgformat=''
1121 uvXUformat=''
1122 uvoformat=''
1123 uvuformat=''
1124 uvxformat=''
1125 pidtype=''
1126 prefix=''
1127 prefixexp=''
1128 installprivlib=''
1129 privlib=''
1130 privlibexp=''
1131 prototype=''
1132 ptrsize=''
1133 d_PRIXU64=''
1134 d_PRId64=''
1135 d_PRIi64=''
1136 d_PRIo64=''
1137 d_PRIu64=''
1138 d_PRIx64=''
1139 sPRIXU64=''
1140 sPRId64=''
1141 sPRIi64=''
1142 sPRIo64=''
1143 sPRIu64=''
1144 sPRIx64=''
1145 d_quad=''
1146 quadkind=''
1147 quadtype=''
1148 uquadtype=''
1149 drand01=''
1150 randbits=''
1151 randfunc=''
1152 randseedtype=''
1153 seedfunc=''
1154 installscript=''
1155 scriptdir=''
1156 scriptdirexp=''
1157 selectminbits=''
1158 selecttype=''
1159 sh=''
1160 sig_count=''
1161 sig_name=''
1162 sig_name_init=''
1163 sig_num=''
1164 sig_num_init=''
1165 sig_size=''
1166 d_sitearch=''
1167 installsitearch=''
1168 sitearch=''
1169 sitearchexp=''
1170 installsitebin=''
1171 sitebin=''
1172 sitebinexp=''
1173 installsitehtml1dir=''
1174 sitehtml1dir=''
1175 sitehtml1direxp=''
1176 installsitehtml3dir=''
1177 sitehtml3dir=''
1178 sitehtml3direxp=''
1179 installsitelib=''
1180 sitelib=''
1181 sitelib_stem=''
1182 sitelibexp=''
1183 installsiteman1dir=''
1184 siteman1dir=''
1185 siteman1direxp=''
1186 installsiteman3dir=''
1187 siteman3dir=''
1188 siteman3direxp=''
1189 siteprefix=''
1190 siteprefixexp=''
1191 installsitescript=''
1192 sitescript=''
1193 sitescriptexp=''
1194 sizesize=''
1195 sizetype=''
1196 so=''
1197 socksizetype=''
1198 sharpbang=''
1199 shsharp=''
1200 spitshell=''
1201 src=''
1202 ssizetype=''
1203 st_ino_sign=''
1204 st_ino_size=''
1205 startperl=''
1206 startsh=''
1207 stdchar=''
1208 d_stdio_stream_array=''
1209 stdio_stream_array=''
1210 sysman=''
1211 sGMTIME_max=''
1212 sGMTIME_min=''
1213 sLOCALTIME_max=''
1214 sLOCALTIME_min=''
1215 trnl=''
1216 uidformat=''
1217 uidsign=''
1218 uidsize=''
1219 uidtype=''
1220 archname64=''
1221 use64bitall=''
1222 use64bitint=''
1223 dtrace=''
1224 usedtrace=''
1225 usefaststdio=''
1226 usekernprocpathname=''
1227 ccflags_uselargefiles=''
1228 ldflags_uselargefiles=''
1229 libswanted_uselargefiles=''
1230 uselargefiles=''
1231 uselongdouble=''
1232 usemorebits=''
1233 usemultiplicity=''
1234 nm_opt=''
1235 nm_so_opt=''
1236 runnm=''
1237 usenm=''
1238 usensgetexecutablepath=''
1239 useperlio=''
1240 usesocks=''
1241 d_oldpthreads=''
1242 use5005threads=''
1243 useithreads=''
1244 usereentrant=''
1245 usethreads=''
1246 incpath=''
1247 mips_type=''
1248 usrinc=''
1249 vaproto=''
1250 d_vendorarch=''
1251 installvendorarch=''
1252 vendorarch=''
1253 vendorarchexp=''
1254 d_vendorbin=''
1255 installvendorbin=''
1256 vendorbin=''
1257 vendorbinexp=''
1258 installvendorhtml1dir=''
1259 vendorhtml1dir=''
1260 vendorhtml1direxp=''
1261 installvendorhtml3dir=''
1262 vendorhtml3dir=''
1263 vendorhtml3direxp=''
1264 d_vendorlib=''
1265 installvendorlib=''
1266 vendorlib=''
1267 vendorlib_stem=''
1268 vendorlibexp=''
1269 installvendorman1dir=''
1270 vendorman1dir=''
1271 vendorman1direxp=''
1272 installvendorman3dir=''
1273 vendorman3dir=''
1274 vendorman3direxp=''
1275 usevendorprefix=''
1276 vendorprefix=''
1277 vendorprefixexp=''
1278 d_vendorscript=''
1279 installvendorscript=''
1280 vendorscript=''
1281 vendorscriptexp=''
1282 versiononly=''
1283 defvoidused=''
1284 voidflags=''
1285 yacc=''
1286 yaccflags=''
1287 CONFIG=''
1288
1289 : Detect odd OSs
1290 define='define'
1291 undef='undef'
1292 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1293 rmlist=''
1294
1295 : We must find out about Eunice early
1296 eunicefix=':'
1297 if test -f /etc/unixtovms; then
1298         eunicefix=/etc/unixtovms
1299 fi
1300 if test -f /etc/unixtovms.exe; then
1301         eunicefix=/etc/unixtovms.exe
1302 fi
1303
1304 : Set executable suffix now -- needed before hints available
1305 if test -f "/libs/version.library"; then
1306 : Amiga OS
1307     _exe=""
1308 elif test -f "/system/gnu_library/bin/ar.pm"; then
1309 : Stratus VOS
1310     _exe=".pm"
1311 elif test -n "$DJGPP"; then
1312 : DOS DJGPP
1313     _exe=".exe"
1314 elif test -d c:/. -o -n "$is_os2" ; then
1315 : OS/2 or cygwin
1316     _exe=".exe"
1317 fi
1318
1319 groupstype=''
1320 i_whoami=''
1321 : Trailing extension.  Override this in a hint file, if needed.
1322 : Extra object files, if any, needed on this platform.
1323 archobjs=''
1324 archname=''
1325 : Possible local include directories to search.
1326 : Set locincpth to "" in a hint file to defeat local include searches.
1327 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1328 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1329 :
1330 : no include file wanted by default
1331 inclwanted=''
1332
1333 : Enable -DEBUGGING and -DDEBUGGING from the command line
1334 EBUGGING=''
1335 DEBUGGING=''
1336
1337 libnames=''
1338 : change the next line if compiling for Xenix/286 on Xenix/386
1339 xlibpth='/usr/lib/386 /lib/386'
1340 : Possible local library directories to search.
1341 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1342 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1343
1344 : general looking path for locating libraries
1345 glibpth="/lib /usr/lib $xlibpth"
1346 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1347 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1348 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1349 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1350
1351 : Private path used by Configure to find libraries.  Its value
1352 : is prepended to libpth. This variable takes care of special
1353 : machines, like the mips.  Usually, it should be empty.
1354 plibpth=''
1355
1356 : default library list
1357 libswanted=''
1358 : some systems want to use only the non-versioned libso:s
1359 ignore_versioned_solibs=''
1360 : set usethreads on the Configure command line to enable threads.
1361 usereentrant='undef'
1362 : full support for void wanted by default
1363 defvoidused=15
1364
1365 ccname=''
1366 ccversion=''
1367 perllibs=''
1368 : set useposix=false in your hint file to disable the POSIX extension.
1369 useposix=true
1370 : set useopcode=false in your hint file to disable the Opcode extension.
1371 useopcode=true
1372 archname64=''
1373 ccflags_uselargefiles=''
1374 ldflags_uselargefiles=''
1375 libswanted_uselargefiles=''
1376 : set usemultiplicity on the Configure command line to enable multiplicity.
1377 : set usesocks on the Configure command line to enable socks.
1378 : List of libraries we want.
1379 : If anyone needs extra -lxxx, put those in a hint file.
1380 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1381 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1382 : We probably want to search /usr/shlib before most other libraries.
1383 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1384 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1385 glibpth="/usr/shlib $glibpth"
1386 : Do not use vfork unless overridden by a hint file.
1387 usevfork=false
1388
1389 : Find the basic shell for Bourne shell scripts
1390 case "$sh" in
1391 '')
1392         case "$SYSTYPE" in
1393         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1394         *) xxx='/bin/sh';;
1395         esac
1396         if test -f "$xxx"; then
1397                 sh="$xxx"
1398         else
1399                 : Build up a list and do a single loop so we can 'break' out.
1400                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1401                 for xxx in sh bash ksh pdksh ash; do
1402                         for p in $pth; do
1403                                 try="$try ${p}/${xxx}"
1404                         done
1405                 done
1406                 for xxx in $try; do
1407                         if test -f "$xxx"; then
1408                                 sh="$xxx";
1409                                 break
1410                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1411                                 sh="$xxx";
1412                                 break
1413                         elif test -f "$xxx.exe"; then
1414                                 sh="$xxx";
1415                                 break
1416                         fi
1417                 done
1418         fi
1419         ;;
1420 esac
1421
1422 case "$sh" in
1423 '')     cat >&2 <<EOM
1424 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1425
1426 Usually it's in /bin/sh.  How did you even get this far?
1427 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1428 we'll try to straighten this all out.
1429 EOM
1430         exit 1
1431         ;;
1432 esac
1433
1434 : see if sh knows # comments
1435 if `$sh -c '#' >/dev/null 2>&1`; then
1436         shsharp=true
1437         spitshell=cat
1438         xcat=/bin/cat
1439         test -f $xcat$_exe || xcat=/usr/bin/cat
1440         if test ! -f $xcat$_exe; then
1441                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1442                         if test -f $p/cat$_exe; then
1443                                 xcat=$p/cat
1444                                 break
1445                         fi
1446                 done
1447                 if test ! -f $xcat$_exe; then
1448                         echo "Can't find cat anywhere!"
1449                         exit 1
1450                 fi
1451         fi
1452         echo "#!$xcat" >sharp
1453         $eunicefix sharp
1454         chmod +x sharp
1455         ./sharp > today 2>/dev/null
1456         if test -s today; then
1457                 sharpbang='#!'
1458         else
1459                 echo "#! $xcat" > sharp
1460                 $eunicefix sharp
1461                 chmod +x sharp
1462                 ./sharp > today 2>/dev/null
1463                 if test -s today; then
1464                         sharpbang='#! '
1465                 else
1466                         sharpbang=': use '
1467                 fi
1468         fi
1469 else
1470         echo " "
1471         echo "Your $sh doesn't grok # comments--I will strip them later on."
1472         shsharp=false
1473         cd ..
1474         echo "exec grep -v '^[  ]*#'" >spitshell
1475         chmod +x spitshell
1476         $eunicefix spitshell
1477         spitshell=`pwd`/spitshell
1478         cd UU
1479         echo "I presume that if # doesn't work, #! won't work either!"
1480         sharpbang=': use '
1481 fi
1482 rm -f sharp today
1483
1484 : figure out how to guarantee sh startup
1485 case "$startsh" in
1486 '') startsh=${sharpbang}${sh} ;;
1487 *)
1488 esac
1489 cat >sharp <<EOSS
1490 $startsh
1491 set abc
1492 test "$?abc" != 1
1493 EOSS
1494
1495 chmod +x sharp
1496 $eunicefix sharp
1497 if ./sharp; then
1498         : echo "Yup, it does."
1499 else
1500         echo "Hmm... '$startsh' does not guarantee sh startup..."
1501         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1502 fi
1503 rm -f sharp
1504
1505 : Save command line options in file UU/cmdline.opt for later use in
1506 : generating config.sh.
1507 cat > cmdline.opt <<EOSH
1508 : Configure command line arguments.
1509 config_arg0='$0'
1510 config_args='$*'
1511 config_argc=$#
1512 EOSH
1513 argn=1
1514 args_exp=''
1515 args_sep=''
1516 for arg in "$@"; do
1517         cat >>cmdline.opt <<EOSH
1518 config_arg$argn='$arg'
1519 EOSH
1520         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1521 $arg
1522 EOC
1523         arg_exp=`cat cmdl.opt`
1524         args_exp="$args_exp$args_sep'$arg_exp'"
1525         argn=`expr $argn + 1`
1526         args_sep=' '
1527 done
1528 rm -f cmdl.opt
1529
1530 : produce awk script to parse command line options
1531 cat >options.awk <<'EOF'
1532 BEGIN {
1533         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1534
1535         len = length(optstr);
1536         for (i = 1; i <= len; i++) {
1537                 c = substr(optstr, i, 1);
1538                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1539                 if (a == ":") {
1540                         arg[c] = 1;
1541                         i++;
1542                 }
1543                 opt[c] = 1;
1544         }
1545 }
1546 {
1547         expect = 0;
1548         str = $0;
1549         if (substr(str, 1, 1) != "-") {
1550                 printf("'%s'\n", str);
1551                 next;
1552         }
1553         len = length($0);
1554         for (i = 2; i <= len; i++) {
1555                 c = substr(str, i, 1);
1556                 if (!opt[c]) {
1557                         printf("-%s\n", substr(str, i));
1558                         next;
1559                 }
1560                 printf("-%s\n", c);
1561                 if (arg[c]) {
1562                         if (i < len)
1563                                 printf("'%s'\n", substr(str, i + 1));
1564                         else
1565                                 expect = 1;
1566                         next;
1567                 }
1568         }
1569 }
1570 END {
1571         if (expect)
1572                 print "?";
1573 }
1574 EOF
1575
1576 : process the command line options
1577 set X `for arg in "$@"; do echo "X$arg"; done |
1578         sed -e s/X// | awk -f options.awk`
1579 eval "set $*"
1580 shift
1581 rm -f options.awk
1582
1583 : set up default values
1584 fastread=''
1585 reuseval=false
1586 config_sh=''
1587 alldone=''
1588 error=''
1589 silent=''
1590 extractsh=''
1591 override=''
1592 knowitall=''
1593 rm -f optdef.sh posthint.sh
1594 cat >optdef.sh <<EOS
1595 $startsh
1596 EOS
1597
1598
1599 : option parsing
1600 while test $# -gt 0; do
1601         case "$1" in
1602         -d) shift; fastread=yes;;
1603         -e) shift; alldone=cont;;
1604         -f)
1605                 shift
1606                 cd ..
1607                 if test -r "$1"; then
1608                         config_sh="$1"
1609                 else
1610                         echo "$me: cannot read config file $1." >&2
1611                         error=true
1612                 fi
1613                 cd UU
1614                 shift;;
1615         --help|\
1616         -h) shift; error=true;;
1617         -r) shift; reuseval=true;;
1618         -s) shift; silent=true; realsilent=true;;
1619         -E) shift; alldone=exit;;
1620         -K) shift; knowitall=true;;
1621         -O) shift; override=true;;
1622         -S) shift; silent=true; extractsh=true;;
1623         -D)
1624                 shift
1625                 case "$1" in
1626                 *=)
1627                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1628                         echo "$me: ignoring -D $1" >&2
1629                         ;;
1630                 *=*) echo "$1" | \
1631                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1632                 *) echo "$1='define'" >> optdef.sh;;
1633                 esac
1634                 shift
1635                 ;;
1636         -U)
1637                 shift
1638                 case "$1" in
1639                 *=) echo "$1" >> optdef.sh;;
1640                 *=*)
1641                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1642                         echo "$me: ignoring -U $1" >&2
1643                         ;;
1644                 *) echo "$1='undef'" >> optdef.sh;;
1645                 esac
1646                 shift
1647                 ;;
1648         -A)
1649             shift
1650             xxx=''
1651             yyy="$1"
1652             zzz=''
1653             uuu=undef
1654             case "$yyy" in
1655             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1656                  case "$zzz" in
1657                  *:*) zzz='' ;;
1658                  *)   xxx=append
1659                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1660                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1661                  esac
1662                  ;;
1663             esac
1664             case "$xxx" in
1665             '')  case "$yyy" in
1666                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1667                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1668                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1669                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1670                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1671                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1672                  esac
1673                  ;;
1674             esac
1675             case "$xxx" in
1676             append)
1677                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1678             clear)
1679                 echo "$yyy=''"                  >> posthint.sh ;;
1680             define)
1681                 case "$zzz" in
1682                 '') zzz=define ;;
1683                 esac
1684                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1685             eval)
1686                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1687             prepend)
1688                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1689             undef)
1690                 case "$zzz" in
1691                 '') zzz="$uuu" ;;
1692                 esac
1693                 echo "$yyy=$zzz"                >> posthint.sh ;;
1694             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1695             esac
1696             shift
1697             ;;
1698         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1699             exit 0;;
1700         --) break;;
1701         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1702         *) break;;
1703         esac
1704 done
1705
1706 case "$error" in
1707 true)
1708         cat >&2 <<EOM
1709 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1710                  [-U symbol] [-U symbol=] [-A command:symbol...]
1711   -d : use defaults for all answers.
1712   -e : go on without questioning past the production of config.sh.
1713   -f : specify an alternate default configuration file.
1714   -h : print this help message and exit (with an error status).
1715   -r : reuse C symbols value if possible (skips costly nm extraction).
1716   -s : silent mode, only echoes questions and essential information.
1717   -D : define symbol to have some value:
1718          -D symbol         symbol gets the value 'define'
1719          -D symbol=value   symbol gets the value 'value'
1720        common used examples (see INSTALL for more info):
1721          -Duse64bitint            use 64bit integers
1722          -Duse64bitall            use 64bit integers and pointers
1723          -Dusethreads             use thread support
1724          -Dinc_version_list=none  do not include older perl trees in @INC
1725          -DEBUGGING=none          DEBUGGING options
1726          -Dcc=gcc                 choose your compiler
1727          -Dprefix=/opt/perl5      choose your destination
1728   -E : stop at the end of questions, after having produced config.sh.
1729   -K : do not use unless you know what you are doing.
1730   -O : let -D and -U override definitions from loaded configuration file.
1731   -S : perform variable substitutions on all .SH files (can mix with -f)
1732   -U : undefine symbol:
1733          -U symbol    symbol gets the value 'undef'
1734          -U symbol=   symbol gets completely empty
1735        e.g.:  -Uversiononly
1736   -A : manipulate symbol after the platform specific hints have been applied:
1737          -A append:symbol=value   append value to symbol
1738          -A symbol=value          like append:, but with a separating space
1739          -A define:symbol=value   define symbol to have value
1740          -A clear:symbol          define symbol to be ''
1741          -A define:symbol         define symbol to be 'define'
1742          -A eval:symbol=value     define symbol to be eval of value
1743          -A prepend:symbol=value  prepend value to symbol
1744          -A undef:symbol          define symbol to be 'undef'
1745          -A undef:symbol=         define symbol to be ''
1746        e.g.:  -A prepend:libswanted='cl pthread '
1747               -A ccflags=-DSOME_MACRO
1748   -V : print version number and exit (with a zero status).
1749 EOM
1750         exit 1
1751         ;;
1752 esac
1753
1754 : Sanity checks
1755 case "$fastread$alldone" in
1756 yescont|yesexit) ;;
1757 *)
1758         case "$extractsh" in
1759         true) ;;
1760         *)
1761                 if test ! -t 0; then
1762                         echo "Say 'sh Configure', not 'sh <Configure'"
1763                         exit 1
1764                 fi
1765                 ;;
1766         esac
1767         ;;
1768 esac
1769
1770 exec 4>&1
1771 case "$silent" in
1772 true) exec 1>/dev/null;;
1773 esac
1774
1775 : run the defines and the undefines, if any, but leave the file out there...
1776 touch optdef.sh
1777 . ./optdef.sh
1778 : create the posthint manipulation script and leave the file out there...
1779 touch posthint.sh
1780
1781 : set package name
1782 package='perl5'
1783 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1784 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1785 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1786 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1787 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1788 esac
1789
1790 : Some greps do not return status, grrr.
1791 echo "grimblepritz" >grimble
1792 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1793         contains=contains
1794 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1795         contains=grep
1796 else
1797         contains=contains
1798 fi
1799 rm -f grimble
1800 : the following should work in any shell
1801 case "$contains" in
1802 contains*)
1803         echo " "
1804         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1805         cat >contains <<'EOSS'
1806 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1807 EOSS
1808 chmod +x contains
1809 esac
1810
1811 : Find the path to the source tree
1812 case "$src" in
1813 '') case "$0" in
1814     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1815          case "$src" in
1816          /*)    ;;
1817          .)     ;;
1818          *)     src=`cd ../$src && pwd` ;;
1819          esac
1820          ;;
1821     *)   src='.';;
1822     esac;;
1823 esac
1824 case "$src" in
1825 '')     src=/
1826         rsrc=/
1827         ;;
1828 /*)     rsrc="$src";;
1829 *)      rsrc="../$src";;
1830 esac
1831 if test -f $rsrc/Configure && \
1832         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1833 then
1834    : found it, so we are ok.
1835 else
1836         rsrc=''
1837         for src in . .. ../.. ../../.. ../../../..; do
1838                 if test -f ../$src/Configure && \
1839                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1840                 then
1841                         rsrc=../$src
1842                         break
1843                 fi
1844         done
1845 fi
1846 case "$rsrc" in
1847 '')
1848         cat <<EOM >&4
1849
1850 Sorry, I can't seem to locate the source dir for $package.  Please start
1851 Configure with an explicit path -- i.e. /some/path/Configure.
1852
1853 EOM
1854         exit 1
1855         ;;
1856 ../.)   rsrc='..';;
1857 *)
1858         echo " "
1859         echo "Sources for $package found in \"$src\"." >&4
1860         ;;
1861 esac
1862
1863 : script used to extract .SH files with variable substitutions
1864 cat >extract <<'EOS'
1865 PERL_CONFIG_SH=true
1866 echo "Doing variable substitutions on .SH files..."
1867 if test -f MANIFEST; then
1868         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1869 else
1870         echo "(Looking for .SH files under the source directory.)"
1871         set x `(cd "$src"; find . -name "*.SH" -print)`
1872 fi
1873 shift
1874 case $# in
1875 0) set x `(cd "$src"; echo *.SH)`; shift;;
1876 esac
1877 if test ! -f "$src/$1"; then
1878         shift
1879 fi
1880 mkdir_p='
1881 name=$1;
1882 create="";
1883 while test $name; do
1884         if test ! -d "$name"; then
1885                 create="$name $create";
1886                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1887                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1888         else
1889                 name="";
1890         fi;
1891 done;
1892 for file in $create; do
1893         mkdir $file;
1894 done
1895 '
1896 for file in $*; do
1897         case "$src" in
1898         ".")
1899                 case "$file" in
1900                 */*)
1901                         dir=`expr X$file : 'X\(.*\)/'`
1902                         file=`expr X$file : 'X.*/\(.*\)'`
1903                         (cd "$dir" && . ./$file)
1904                         ;;
1905                 *)
1906                         . ./$file
1907                         ;;
1908                 esac
1909                 ;;
1910         *)
1911                 case "$file" in
1912                 */*)
1913                         dir=`expr X$file : 'X\(.*\)/'`
1914                         file=`expr X$file : 'X.*/\(.*\)'`
1915                         (set x $dir; shift; eval $mkdir_p)
1916                         sh <"$src/$dir/$file"
1917                         ;;
1918                 *)
1919                         sh <"$src/$file"
1920                         ;;
1921                 esac
1922                 ;;
1923         esac
1924 done
1925 if test -f "$src/config_h.SH"; then
1926         if test ! -f config.h; then
1927         : oops, they left it out of MANIFEST, probably, so do it anyway.
1928         . "$src/config_h.SH"
1929         fi
1930 fi
1931 EOS
1932
1933 : extract files and exit if asked to do so
1934 case "$extractsh" in
1935 true)
1936         case "$realsilent" in
1937         true) ;;
1938         *) exec 1>&4;;
1939         esac
1940         case "$config_sh" in
1941         '') config_sh='config.sh';;
1942         esac
1943         echo " "
1944         echo "Fetching answers from $config_sh..."
1945         cd ..
1946         . $config_sh
1947         test "$override" && . ./optdef.sh
1948         echo " "
1949         . UU/extract
1950         rm -rf UU
1951         echo "Extraction done."
1952         exit 0
1953         ;;
1954 esac
1955
1956 : Eunice requires " " instead of "", can you believe it
1957 echo " "
1958 : Here we go...
1959 echo "Beginning of configuration questions for $package."
1960
1961 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1962
1963 : first determine how to suppress newline on echo command
1964 echo " "
1965 echo "Checking echo to see how to suppress newlines..."
1966 (echo "hi there\c" ; echo " ") >.echotmp
1967 if $contains c .echotmp >/dev/null 2>&1 ; then
1968         echo "...using -n."
1969         n='-n'
1970         c=''
1971 else
1972         cat <<'EOM'
1973 ...using \c
1974 EOM
1975         n=''
1976         c='\c'
1977 fi
1978 echo $n "The star should be here-->$c"
1979 echo '*'
1980 rm -f .echotmp
1981
1982 : Now test for existence of everything in MANIFEST
1983 echo " "
1984 if test -f "$rsrc/MANIFEST"; then
1985         echo "First let's make sure your kit is complete.  Checking..." >&4
1986         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1987                 (split -l 50 2>/dev/null || split -50)
1988         rm -f missing
1989         tmppwd=`pwd`
1990         for filelist in x??; do
1991                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1992                         >/dev/null 2>>"$tmppwd/missing")
1993         done
1994         if test -s missing; then
1995                 cat missing >&4
1996                 cat >&4 <<'EOM'
1997
1998 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1999
2000 You have the option of continuing the configuration process, despite the
2001 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2002 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2003 and contact the author (perlbug@perl.org).
2004
2005 EOM
2006                 echo $n "Continue? [n] $c" >&4
2007                 read ans
2008                 case "$ans" in
2009                 y*)
2010                         echo "Continuing..." >&4
2011                         rm -f missing
2012                         ;;
2013                 *)
2014                         echo "ABORTING..." >&4
2015                         kill $$
2016                         ;;
2017                 esac
2018         else
2019                 echo "Looks good..."
2020         fi
2021 else
2022         echo "There is no MANIFEST file.  I hope your kit is complete !"
2023 fi
2024 rm -f missing x??
2025
2026 : Find the appropriate value for a newline for tr
2027 echo " "
2028 if test -n "$DJGPP"; then
2029        trnl='\012'
2030 fi
2031 if test X"$trnl" = X; then
2032         case "`echo foo|tr '\n' x 2>/dev/null`" in
2033         foox) trnl='\n' ;;
2034         esac
2035 fi
2036 if test X"$trnl" = X; then
2037         case "`echo foo|tr '\012' x 2>/dev/null`" in
2038         foox) trnl='\012' ;;
2039         esac
2040 fi
2041 if test X"$trnl" = X; then
2042        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2043        fooxy) trnl='\n\r' ;;
2044        esac
2045 fi
2046 if test X"$trnl" = X; then
2047         cat <<EOM >&2
2048
2049 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2050
2051 EOM
2052         exit 1
2053 fi
2054
2055 : compute the number of columns on the terminal for proper question formatting
2056 case "$COLUMNS" in
2057 '') COLUMNS='80';;
2058 esac
2059
2060 : set up the echo used in my read
2061 myecho="case \"\$xxxm\" in
2062 '') echo $n \"\$rp $c\" >&4;;
2063 *) case \"\$rp\" in
2064         '') echo $n \"[\$xxxm] $c\";;
2065         *)
2066                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2067                         echo \"\$rp\" >&4
2068                         echo $n \"[\$xxxm] $c\" >&4
2069                 else
2070                         echo $n \"\$rp [\$xxxm] $c\" >&4
2071                 fi
2072                 ;;
2073         esac;;
2074 esac"
2075
2076 : now set up to do reads with possible shell escape and default assignment
2077 cat <<EOSC >myread
2078 $startsh
2079 xxxm=\$dflt
2080 $myecho
2081 ans='!'
2082 case "\$fastread" in
2083 yes) case "\$dflt" in
2084         '') ;;
2085         *) ans='';
2086                 case "\$silent-\$rp" in
2087                 true-) ;;
2088                 *) echo " " >&4;;
2089                 esac;;
2090         esac;;
2091 *) case "\$silent" in
2092         true) case "\$rp" in
2093                 '') ans='';;
2094                 esac;;
2095         esac;;
2096 esac
2097 while expr "X\$ans" : "X!" >/dev/null; do
2098         read answ
2099         set x \$xxxm
2100         shift
2101         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2102         case  "\$answ" in
2103         "!")
2104                 sh 1>&4
2105                 echo " "
2106                 $myecho
2107                 ;;
2108         !*)
2109                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2110                 shift
2111                 sh 1>&4 -c "\$*"
2112                 echo " "
2113                 $myecho
2114                 ;;
2115         "\$ans")
2116                 case "\$ans" in
2117                 \\&*)
2118                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2119                         shift
2120                         case "\$1" in
2121                         -d)
2122                                 fastread=yes
2123                                 echo "(OK, I'll run with -d after this question.)" >&4
2124                                 ;;
2125                         -*)
2126                                 echo "*** Sorry, \$1 not supported yet." >&4
2127                                 ;;
2128                         esac
2129                         $myecho
2130                         ans=!
2131                         ;;
2132                 esac;;
2133         *)
2134                 case "\$aok" in
2135                 y)
2136                         echo "*** Substitution done -- please confirm."
2137                         xxxm="\$ans"
2138                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2139                         xxxm="\$ans"
2140                         ans=!
2141                         ;;
2142                 *)
2143                         echo "*** Error -- try again."
2144                         ans=!
2145                         ;;
2146                 esac
2147                 $myecho
2148                 ;;
2149         esac
2150         case "\$ans\$xxxm\$nostick" in
2151         '')
2152                 ans=!
2153                 $myecho
2154                 ;;
2155         esac
2156 done
2157 case "\$ans" in
2158 '') ans="\$xxxm";;
2159 esac
2160 EOSC
2161
2162 : create .config dir to save info across Configure sessions
2163 test -d ../.config || mkdir ../.config
2164 cat >../.config/README <<EOF
2165 This directory created by Configure to save information that should
2166 persist across sessions for $package.
2167
2168 You may safely delete it if you wish.
2169 EOF
2170
2171 : See if we are using a devel version and want that
2172 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2173 case "$usedevel" in
2174 $define|true|[yY]*)
2175     usedevel="$define" ;;
2176 *) case "$xversion" in
2177    *[13579])
2178         cat >&4 <<EOH
2179 *** WHOA THERE!!! ***
2180
2181     This is an UNSTABLE DEVELOPMENT release.
2182     The version of this $package distribution is $xversion, that is, odd,
2183     (as opposed to even) and that signifies a development release.
2184     If you want a maintenance release, you want an even-numbered version.
2185
2186     Do ***NOT*** install this into production use.
2187     Data corruption and crashes are possible.
2188
2189     It is most seriously suggested that you do not continue any further
2190     unless you want to help in developing and debugging Perl.
2191
2192     If you *still* want to build perl, you can answer 'y' now,
2193     or pass -Dusedevel to Configure.
2194
2195 EOH
2196         rp='Do you really want to continue?'
2197         dflt='n'
2198         . ./myread
2199         case "$ans" in
2200         [yY]) echo >&4 "Okay, continuing."
2201               usedevel="$define" ;;
2202         *) echo >&4 "Okay, bye."
2203            exit 1
2204            ;;
2205         esac
2206         ;;
2207     esac
2208     usedevel="$undef"
2209     ;;
2210 esac
2211 case "$usedevel" in
2212 $define|true|[yY]*)
2213         case "$versiononly" in
2214         '') versiononly="$define" ;;
2215         esac
2216         case "$installusrbinperl" in
2217         '') installusrbinperl="$undef" ;;
2218         esac
2219         ;;
2220 esac
2221
2222 : general instructions
2223 needman=true
2224 firsttime=true
2225 user=`(logname) 2>/dev/null`
2226 case "$user" in
2227 '') user=`whoami 2>&1`;;
2228 esac
2229 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2230         firsttime=false
2231         echo " "
2232         rp='Would you like to see the instructions?'
2233         dflt=n
2234         . ./myread
2235         case "$ans" in
2236         [yY]*) ;;
2237         *) needman=false;;
2238         esac
2239 fi
2240 if $needman; then
2241         cat <<EOH
2242
2243 This installation shell script will examine your system and ask you questions
2244 to determine how the perl5 package should be installed. If you get
2245 stuck on a question, you may use a ! shell escape to start a subshell or
2246 execute a command.  Many of the questions will have default answers in square
2247 brackets; typing carriage return will give you the default.
2248
2249 On some of the questions which ask for file or directory names you are allowed
2250 to use the ~name construct to specify the login directory belonging to "name",
2251 even if you don't have a shell which knows about that.  Questions where this is
2252 allowed will be marked "(~name ok)".
2253
2254 EOH
2255         rp=''
2256         dflt='Type carriage return to continue'
2257         . ./myread
2258         cat <<'EOH'
2259
2260 The prompter used in this script allows you to use shell variables and
2261 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2262 in the default answer, as if the default line was a set of arguments given to a
2263 script shell.  This means you may also use $* to repeat the whole default line,
2264 so you do not have to re-type everything to add something to the default.
2265
2266 Every time there is a substitution, you will have to confirm.  If there is an
2267 error (e.g. an unmatched backtick), the default answer will remain unchanged
2268 and you will be prompted again.
2269
2270 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2271 the questions and use the computed defaults (or the previous answers if there
2272 was already a config.sh file). Type 'Configure -h' for a list of options.
2273 You may also start interactively and then answer '& -d' at any prompt to turn
2274 on the non-interactive behaviour for the remainder of the execution.
2275
2276 EOH
2277         . ./myread
2278         cat <<EOH
2279
2280 Much effort has been expended to ensure that this shell script will run on any
2281 Unix system.  If despite that it blows up on yours, your best bet is to edit
2282 Configure and run it again.  If you can't run Configure for some reason,
2283 you'll have to generate a config.sh file by hand.  Whatever problems you
2284 have, let me (perlbug@perl.org) know how I blew it.
2285
2286 This installation script affects things in two ways:
2287
2288 1) it may do direct variable substitutions on some of the files included
2289    in this kit.
2290 2) it builds a config.h file for inclusion in C programs.  You may edit
2291    any of these files as the need arises after running this script.
2292
2293 If you make a mistake on a question, there is no easy way to back up to it
2294 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2295 files.  Configure will offer to let you do this before it runs the SH files.
2296
2297 EOH
2298         dflt='Type carriage return to continue'
2299         . ./myread
2300         case "$firsttime" in
2301         true) echo $user >>../.config/instruct;;
2302         esac
2303 fi
2304
2305 : find out where common programs are
2306 echo " "
2307 echo "Locating common programs..." >&4
2308 cat <<EOSC >loc
2309 $startsh
2310 case \$# in
2311 0) exit 1;;
2312 esac
2313 thing=\$1
2314 shift
2315 dflt=\$1
2316 shift
2317 for dir in \$*; do
2318         case "\$thing" in
2319         .)
2320         if test -d \$dir/\$thing; then
2321                 echo \$dir
2322                 exit 0
2323         fi
2324         ;;
2325         *)
2326         for thisthing in \$dir/\$thing; do
2327                 : just loop through to pick last item
2328         done
2329         if test -f \$thisthing; then
2330                 echo \$thisthing
2331                 exit 0
2332         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2333                 echo \$thisthing
2334                 exit 0
2335         elif test -f \$dir/\$thing.exe; then
2336                 if test -n "$DJGPP"; then
2337                         echo \$dir/\$thing.exe
2338                 elif test "$eunicefix" != ":"; then
2339                         : on Eunice apparently
2340                         echo \$dir/\$thing
2341                 fi
2342                 exit 0
2343         fi
2344         ;;
2345         esac
2346 done
2347 echo \$dflt
2348 exit 1
2349 EOSC
2350 chmod +x loc
2351 $eunicefix loc
2352 loclist="
2353 awk
2354 cat
2355 chmod
2356 comm
2357 cp
2358 echo
2359 expr
2360 grep
2361 ls
2362 mkdir
2363 rm
2364 sed
2365 sort
2366 touch
2367 tr
2368 uniq
2369 "
2370 trylist="
2371 ar
2372 bison
2373 byacc
2374 cpp
2375 csh
2376 date
2377 egrep
2378 gmake
2379 gzip
2380 less
2381 ln
2382 make
2383 more
2384 nm
2385 nroff
2386 perl
2387 pg
2388 test
2389 uname
2390 zip
2391 "
2392 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2393 pth="$pth /lib /usr/lib"
2394 for file in $loclist; do
2395         eval xxx=\$$file
2396         case "$xxx" in
2397         /*|?:[\\/]*)
2398                 if test -f "$xxx"; then
2399                         : ok
2400                 else
2401                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2402                         xxx=`./loc $file $file $pth`
2403                 fi
2404                 ;;
2405         '') xxx=`./loc $file $file $pth`;;
2406         *) xxx=`./loc $xxx $xxx $pth`;;
2407         esac
2408         eval $file=$xxx$_exe
2409         eval _$file=$xxx
2410         case "$xxx" in
2411         /*)
2412                 echo $file is in $xxx.
2413                 ;;
2414         ?:[\\/]*)
2415                 echo $file is in $xxx.
2416                 ;;
2417         *)
2418                 echo "I don't know where '$file' is, and my life depends on it." >&4
2419                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2420                 exit 1
2421                 ;;
2422         esac
2423 done
2424 echo " "
2425 echo "Don't worry if any of the following aren't found..."
2426 say=offhand
2427 for file in $trylist; do
2428         eval xxx=\$$file
2429         case "$xxx" in
2430         /*|?:[\\/]*)
2431                 if test -f "$xxx"; then
2432                         : ok
2433                 else
2434                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2435                         xxx=`./loc $file $file $pth`
2436                 fi
2437                 ;;
2438         '') xxx=`./loc $file $file $pth`;;
2439         *) xxx=`./loc $xxx $xxx $pth`;;
2440         esac
2441         eval $file=$xxx$_exe
2442         eval _$file=$xxx
2443         case "$xxx" in
2444         /*)
2445                 echo $file is in $xxx.
2446                 ;;
2447         ?:[\\/]*)
2448                 echo $file is in $xxx.
2449                 ;;
2450         *)
2451                 echo "I don't see $file out there, $say."
2452                 say=either
2453                 ;;
2454         esac
2455 done
2456 case "$egrep" in
2457 egrep)
2458         echo "Substituting grep for egrep."
2459         egrep=$grep
2460         _egrep=$grep
2461         ;;
2462 esac
2463 case "$less" in
2464 '')     ;;
2465 *)      if $less -R </dev/null >/dev/null; then
2466                echo "Substituting less -R for less."
2467                less="$less -R"
2468                _less=$less
2469         fi
2470         ;;
2471 esac
2472 case "$ln" in
2473 ln)
2474         echo "Substituting cp for ln."
2475         ln=$cp
2476         _ln=$cp
2477         ;;
2478 esac
2479 case "$make" in
2480 make)
2481         case "$gmake" in
2482         gmake)
2483         echo "I can't find make or gmake, and my life depends on it." >&4
2484         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2485         exit 1
2486         ;;
2487         esac
2488         ;;
2489 esac
2490 case "$gmake" in
2491 gmake)  ;;
2492 *)      # We can't have osname yet.
2493         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2494                 # Assume that gmake, if found, is definitely GNU make
2495                 # and prefer it over the system make.
2496                 echo "Substituting gmake for make."
2497                 make=$gmake
2498                 _make=$gmake
2499         fi
2500         ;;
2501 esac
2502 case "$test" in
2503 test)
2504         echo "Hopefully test is built into your sh."
2505         ;;
2506 *)
2507         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2508                 echo "Using the test built into your sh."
2509                 test=test
2510                 _test=test
2511         fi
2512         ;;
2513 esac
2514 case "$echo" in
2515 echo)
2516         echo "Hopefully echo is built into your sh."
2517         ;;
2518 '') ;;
2519 *)
2520         echo " "
2521 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2522         $echo $n "hi there$c" >foo1
2523         echo $n "hi there$c" >foo2
2524         if cmp foo1 foo2 >/dev/null 2>&1; then
2525                 echo "They are compatible.  In fact, they may be identical."
2526         else
2527                 case "$n" in
2528                 '-n') n='' c='\c';;
2529                 *) n='-n' c='';;
2530                 esac
2531                 cat <<FOO
2532 They are not compatible!  You are probably running ksh on a non-USG system.
2533 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2534 have echo built in and we may have to run some Bourne shell scripts.  That
2535 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2536
2537 FOO
2538                 $echo $n "The star should be here-->$c"
2539                 $echo "*"
2540         fi
2541         $rm -f foo1 foo2
2542         ;;
2543 esac
2544
2545 # This question was auctioned at YAPC::Europe-2007 in Vienna
2546 # I never promised you could answer it. I only auctioned the question.
2547 cat <<FOO
2548 The following message is sponsored by
2549
2550   Dresden.pm<--The stars should be here.
2551
2552 Dear Perl user, system administrator or package
2553 maintainer, the Perl community sends greetings to
2554 you. Do you (emblematical) greet back [Y/n]? n
2555
2556 FOO
2557
2558 : Check what type of C compiler we use
2559 cat <<EOS >trygcc
2560 $startsh
2561 EOS
2562 cat <<'EOSC' >>trygcc
2563 case "$cc" in
2564 '') ;;
2565 *)  $rm -f try try.*
2566     $cat >try.c <<EOM
2567 int main(int argc, char *argv[]) {
2568   return 0;
2569 }
2570 EOM
2571     if $cc -o try $ccflags $ldflags try.c; then
2572        :
2573     else
2574         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2575         despair=yes
2576         trygcc=yes
2577         case "$cc" in
2578         *gcc*) trygcc=no ;;
2579         esac
2580         # Skip this test because it gives a false match on output like:
2581         #    ./trygcc: line 23: cc: command not found
2582         # case "`$cc -v -c try.c 2>&1`" in
2583         # *gcc*) trygcc=no ;;
2584         # esac
2585         if $test X"$trygcc" = Xyes; then
2586             if gcc -o try -c try.c; then
2587                 echo " "
2588                 echo "You seem to have a working gcc, though." >&4
2589                 # Switching compilers may undo the work of hints files.
2590                 # The most common problem is -D_REENTRANT for threads.
2591                 # This heuristic catches that case, but gets false positives
2592                 # if -Dusethreads was not actually specified.  Better to
2593                 # bail out here with a useful message than fail 
2594                 # mysteriously later. Should we perhaps just try to
2595                 # re-invoke Configure -Dcc=gcc config_args ?
2596                 if $test -f usethreads.cbu; then
2597                         $cat >&4 <<EOM 
2598
2599 *** However, any setting of the C compiler flags (e.g. for thread support)
2600 *** will be lost.  It may be necessary for you to restart Configure and
2601 *** add -Dcc=gcc to your Configure command line.
2602
2603 EOM
2604                         rp="Would you like to go ahead and try gcc anyway?"
2605                         dflt=n
2606                 else
2607                         rp="Would you like to use it?"
2608                         dflt=y
2609                 fi
2610                 if $test -f myread; then
2611                     . ./myread
2612                 else
2613                     if $test -f UU/myread; then
2614                         . ./UU/myread
2615                     else
2616                         echo "Cannot find myread, sorry.  Aborting." >&2
2617                         exit 1
2618                     fi
2619                 fi  
2620                 case "$ans" in
2621                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2622                 esac
2623             fi
2624         fi
2625     fi
2626     $rm -f try try.*
2627     ;;
2628 esac
2629 EOSC
2630
2631 cat <<EOS >checkcc
2632 $startsh
2633 EOS
2634 cat <<'EOSC' >>checkcc
2635 case "$cc" in        
2636 '') ;;
2637 *)  $rm -f try try.*              
2638     $cat >try.c <<EOM
2639 int main(int argc, char *argv[]) {
2640   return 0;
2641 }
2642 EOM
2643     if $cc -o try $ccflags $ldflags try.c; then
2644        :
2645     else
2646         if $test X"$despair" = Xyes; then
2647            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2648         fi
2649         $cat >&4 <<EOM         
2650 You need to find a working C compiler.
2651 Either (purchase and) install the C compiler supplied by your OS vendor,
2652 or for a free C compiler try http://gcc.gnu.org/
2653 I cannot continue any further, aborting.
2654 EOM
2655         exit 1
2656     fi
2657     $rm -f try try.*
2658     ;;
2659 esac
2660 EOSC
2661
2662 : determine whether symbolic links are supported
2663 echo " "
2664 $touch blurfl
2665 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2666         echo "Symbolic links are supported." >&4
2667         lns="$ln -s"
2668 else
2669         echo "Symbolic links are NOT supported." >&4
2670         lns="$ln"
2671 fi
2672 $rm -f blurfl sym
2673
2674 : determine whether symbolic links are supported
2675 echo " "
2676 case "$lns" in
2677 *"ln"*" -s")
2678         echo "Checking how to test for symbolic links..." >&4
2679         $lns blurfl sym
2680         if $test "X$issymlink" = X; then
2681                 case "$newsh" in
2682                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2683                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2684                 esac
2685                 if test $? = 0; then
2686                         issymlink="test -h"
2687                 else
2688                         echo "Your builtin 'test -h' may be broken." >&4
2689                         case "$test" in
2690                         /*)     ;;
2691                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2692                                 for p in $pth
2693                                 do
2694                                         if test -f "$p/$test"; then
2695                                                 test="$p/$test"
2696                                                 break
2697                                         fi
2698                                 done
2699                                 ;;
2700                         esac
2701                         case "$test" in
2702                         /*)
2703                                 echo "Trying external '$test -h'." >&4
2704                                 issymlink="$test -h"
2705                                 if $test ! -h sym >/dev/null 2>&1; then
2706                                         echo "External '$test -h' is broken, too." >&4
2707                                         issymlink=''
2708                                 fi
2709                                 ;;
2710                         *)      issymlink='' ;;
2711                         esac
2712                 fi              
2713         fi
2714         if $test "X$issymlink" = X; then
2715                 if $test -L sym 2>/dev/null; then
2716                         issymlink="$test -L"
2717                         echo "The builtin '$test -L' worked." >&4
2718                 fi
2719         fi
2720         if $test "X$issymlink" != X; then
2721                 echo "You can test for symbolic links with '$issymlink'." >&4
2722         else
2723                 echo "I do not know how you can test for symbolic links." >&4
2724         fi
2725         $rm -f blurfl sym
2726         ;;
2727 *)      echo "No symbolic links, so not testing for their testing..." >&4
2728         ;;
2729 esac
2730 echo " "
2731
2732 : Make symlinks util
2733 case "$mksymlinks" in
2734 $define|true|[yY]*)
2735         case "$src" in
2736         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2737                 exit 1
2738                 ;;
2739         *)      case "$lns:$issymlink" in
2740                 *"ln"*" -s:"*"test -"?)
2741                         echo "Creating the symbolic links..." >&4
2742                         echo "(First creating the subdirectories...)" >&4
2743                         cd ..
2744                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2745                                 read directory
2746                                 test -z "$directory" && break
2747                                 mkdir -p $directory
2748                         done
2749                         # Sanity check 1.
2750                         if test ! -d t/base; then
2751                                 echo "Failed to create the subdirectories.  Aborting." >&4
2752                                 exit 1
2753                         fi
2754                         echo "(Then creating the symlinks...)" >&4
2755                         awk '{print $1}' $src/MANIFEST | while true; do
2756                                 read filename
2757                                 test -z "$filename" && break
2758                                 if test -f $filename; then
2759                                         if $issymlink $filename; then
2760                                                 rm -f $filename
2761                                         fi
2762                                 fi
2763                                 if test -f $filename; then
2764                                         echo "$filename already exists, not symlinking."
2765                                 else
2766                                         ln -s $src/$filename $filename
2767                                 fi
2768                         done
2769                         # Sanity check 2.
2770                         if test ! -f t/base/lex.t; then
2771                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2772                                 exit 1
2773                         fi
2774                         cd UU
2775                         ;;
2776                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2777                         ;;
2778                 esac
2779                 ;;
2780         esac
2781         ;;
2782 esac
2783
2784 : Check for Cross-Compilation
2785 case "$usecrosscompile" in
2786 $define|true|[yY]*)
2787         $echo "Cross-compiling..."
2788         croak=''
2789         case "$cc" in
2790         *-*-gcc) # A cross-compiling gcc, probably.
2791             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2792             ar=$targetarch-ar
2793             # leave out ld, choosing it is more complex
2794             nm=$targetarch-nm
2795             ranlib=$targetarch-ranlib
2796             $echo 'extern int foo;' > try.c
2797             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2798             shift
2799             if $test $# -gt 0; then
2800                 incpth="$incpth $*"
2801                 incpth="`$echo $incpth|$sed 's/^ //'`"
2802                 echo "Guessing incpth '$incpth'." >&4
2803                 for i in $*; do
2804                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2805                     if $test -d $j; then
2806                         libpth="$libpth $j"
2807                     fi
2808                 done   
2809                 libpth="`$echo $libpth|$sed 's/^ //'`"
2810                 echo "Guessing libpth '$libpth'." >&4
2811             fi
2812             $rm -f try.c
2813             ;;
2814         esac
2815         case "$targetarch" in
2816         '') echo "Targetarch not defined." >&4; croak=y ;;
2817         *)  echo "Using targetarch $targetarch." >&4 ;;
2818         esac
2819         case "$incpth" in
2820         '') echo "Incpth not defined." >&4; croak=y ;;
2821         *)  echo "Using incpth '$incpth'." >&4 ;;
2822         esac
2823         case "$libpth" in
2824         '') echo "Libpth not defined." >&4; croak=y ;;
2825         *)  echo "Using libpth '$libpth'." >&4 ;;
2826         esac
2827         case "$usrinc" in
2828         '') for i in $incpth; do
2829                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2830                     usrinc=$i
2831                     echo "Guessing usrinc $usrinc." >&4
2832                     break
2833                 fi
2834             done
2835             case "$usrinc" in
2836             '') echo "Usrinc not defined." >&4; croak=y ;;
2837             esac
2838             ;;
2839         *)  echo "Using usrinc $usrinc." >&4 ;;
2840         esac
2841         case "$targethost" in
2842         '') echo "Targethost not defined." >&4; croak=y ;;
2843         *)  echo "Using targethost $targethost." >&4
2844         esac
2845         locincpth=' '
2846         loclibpth=' '
2847         case "$croak" in
2848         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2849         esac
2850         case "$src" in
2851         /*) run=$src/Cross/run
2852             targetmkdir=$src/Cross/mkdir
2853             to=$src/Cross/to
2854             from=$src/Cross/from
2855             ;;
2856         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2857             run=$pwd/Cross/run
2858             targetmkdir=$pwd/Cross/mkdir
2859             to=$pwd/Cross/to
2860             from=$pwd/Cross/from
2861             ;;
2862         esac
2863         case "$targetrun" in
2864         '') targetrun=ssh ;;
2865         esac
2866         case "$targetto" in
2867         '') targetto=scp ;;
2868         esac
2869         case "$targetfrom" in
2870         '') targetfrom=scp ;;
2871         esac
2872         run=$run-$targetrun
2873         to=$to-$targetto
2874         from=$from-$targetfrom
2875         case "$targetdir" in
2876         '')  targetdir=/tmp
2877              echo "Guessing targetdir $targetdir." >&4
2878              ;;
2879         esac
2880         case "$targetuser" in
2881         '')  targetuser=root
2882              echo "Guessing targetuser $targetuser." >&4
2883              ;;
2884         esac
2885         case "$targetfrom" in
2886         scp)    q=-q ;;
2887         *)      q='' ;;
2888         esac
2889         case "$targetrun" in
2890         ssh|rsh)
2891             cat >$run <<EOF
2892 #!/bin/sh
2893 case "\$1" in
2894 -cwd)
2895   shift
2896   cwd=\$1
2897   shift
2898   ;;
2899 esac
2900 case "\$cwd" in
2901 '') cwd=$targetdir ;;
2902 esac
2903 exe=\$1
2904 shift
2905 if $test ! -f \$exe.xok; then
2906   $to \$exe
2907   $touch \$exe.xok
2908 fi
2909 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2910 EOF
2911             ;;
2912         *)  echo "Unknown targetrun '$targetrun'" >&4
2913             exit 1
2914             ;;
2915         esac
2916         case "$targetmkdir" in
2917         */Cross/mkdir)
2918             cat >$targetmkdir <<EOF
2919 #!/bin/sh
2920 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2921 EOF
2922             $chmod a+rx $targetmkdir
2923             ;;
2924         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2925             exit 1
2926             ;;
2927         esac
2928         case "$targetto" in
2929         scp|rcp)
2930             cat >$to <<EOF
2931 #!/bin/sh
2932 for f in \$@
2933 do
2934   case "\$f" in
2935   /*)
2936     $targetmkdir \`dirname \$f\`
2937     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2938     ;;
2939   *)
2940     $targetmkdir $targetdir/\`dirname \$f\`
2941     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2942     ;;
2943   esac
2944 done
2945 exit 0
2946 EOF
2947             ;;
2948         cp) cat >$to <<EOF
2949 #!/bin/sh
2950 for f in \$@
2951 do
2952   case "\$f" in
2953   /*)
2954     $mkdir -p $targetdir/\`dirname \$f\`
2955     $cp \$f $targetdir/\$f || exit 1
2956     ;;
2957   *)
2958     $targetmkdir $targetdir/\`dirname \$f\`
2959     $cp \$f $targetdir/\$f || exit 1
2960     ;;
2961   esac
2962 done
2963 exit 0
2964 EOF
2965             ;;
2966         *)  echo "Unknown targetto '$targetto'" >&4
2967             exit 1
2968             ;;
2969         esac
2970         case "$targetfrom" in
2971         scp|rcp)
2972           cat >$from <<EOF
2973 #!/bin/sh
2974 for f in \$@
2975 do
2976   $rm -f \$f
2977   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2978 done
2979 exit 0
2980 EOF
2981             ;;
2982         cp) cat >$from <<EOF
2983 #!/bin/sh
2984 for f in \$@
2985 do
2986   $rm -f \$f
2987   cp $targetdir/\$f . || exit 1
2988 done
2989 exit 0
2990 EOF
2991             ;;
2992         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2993             exit 1
2994             ;;
2995         esac
2996         if $test ! -f $run; then
2997             echo "Target 'run' script '$run' not found." >&4
2998         else
2999             $chmod a+rx $run
3000         fi
3001         if $test ! -f $to; then
3002             echo "Target 'to' script '$to' not found." >&4
3003         else
3004             $chmod a+rx $to
3005         fi
3006         if $test ! -f $from; then
3007             echo "Target 'from' script '$from' not found." >&4
3008         else
3009             $chmod a+rx $from
3010         fi
3011         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3012             exit 1
3013         fi
3014         cat >&4 <<EOF
3015 Using '$run' for remote execution,
3016 and '$from' and '$to'
3017 for remote file transfer.
3018 EOF
3019         ;;
3020 *)      run=''
3021         to=:
3022         from=:
3023         usecrosscompile='undef'
3024         targetarch=''
3025         ;;
3026 esac
3027
3028 : see whether [:lower:] and [:upper:] are supported character classes
3029 echo " "
3030 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3031 ABYZ)
3032         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3033         up='[:upper:]'
3034         low='[:lower:]'
3035         ;;
3036 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3037         # (0xd9 and 0xe2), therefore that is a nice testing point.
3038         if test "X$up" = X -o "X$low" = X; then
3039             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3040             rs) up='[A-Z]'
3041                 low='[a-z]'
3042                 ;;
3043             esac
3044         fi
3045         if test "X$up" = X -o "X$low" = X; then
3046             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3047             rs) up='A-Z'
3048                 low='a-z'
3049                 ;;
3050             esac
3051         fi
3052         if test "X$up" = X -o "X$low" = X; then
3053             case "`echo RS | od -x 2>/dev/null`" in
3054             *D9E2*|*d9e2*)
3055                 echo "Hey, this might be EBCDIC." >&4
3056                 if test "X$up" = X -o "X$low" = X; then
3057                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3058                     rs) up='[A-IJ-RS-Z]'
3059                         low='[a-ij-rs-z]'
3060                         ;;
3061                     esac
3062                 fi
3063                 if test "X$up" = X -o "X$low" = X; then
3064                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3065                     rs) up='A-IJ-RS-Z'
3066                         low='a-ij-rs-z'
3067                         ;;
3068                     esac
3069                 fi
3070                 ;;
3071             esac
3072         fi
3073 esac
3074 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3075 rs)
3076     echo "Using $up and $low to convert case." >&4
3077     ;;
3078 *)
3079     echo "I don't know how to translate letters from upper to lower case." >&4
3080     echo "Your tr is not acting any way I know of." >&4
3081     exit 1
3082     ;;
3083 esac
3084 : set up the translation script tr, must be called with ./tr of course
3085 cat >tr <<EOSC
3086 $startsh
3087 case "\$1\$2" in
3088 '[A-Z][a-z]') exec $tr '$up' '$low';;
3089 '[a-z][A-Z]') exec $tr '$low' '$up';;
3090 esac
3091 exec $tr "\$@"
3092 EOSC
3093 chmod +x tr
3094 $eunicefix tr
3095
3096 : Try to determine whether config.sh was made on this system
3097 case "$config_sh" in
3098 '')
3099 myuname=`$uname -a 2>/dev/null`
3100 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3101 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3102 # because the A-Z/a-z are not consecutive.
3103 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3104         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3105 newmyuname="$myuname"
3106 dflt=n
3107 case "$knowitall" in
3108 '')
3109         if test -f ../config.sh; then
3110                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3111                         eval "`grep myuname= ../config.sh`"
3112                 fi
3113                 if test "X$myuname" = "X$newmyuname"; then
3114                         dflt=y
3115                 fi
3116         fi
3117         ;;
3118 *) dflt=y;;
3119 esac
3120
3121 : Get old answers from old config file if Configure was run on the
3122 : same system, otherwise use the hints.
3123 hint=default
3124 cd ..
3125 if test -f config.sh; then
3126         echo " "
3127         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3128         . UU/myread
3129         case "$ans" in
3130         n*|N*) echo "OK, I'll ignore it."
3131                 mv config.sh config.sh.old
3132                 myuname="$newmyuname"
3133                 ;;
3134         *)  echo "Fetching default answers from your old config.sh file..." >&4
3135                 tmp_n="$n"
3136                 tmp_c="$c"
3137                 tmp_sh="$sh"
3138                 . ./config.sh
3139                 cp config.sh UU
3140                 n="$tmp_n"
3141                 c="$tmp_c"
3142                 : Older versions did not always set $sh.  Catch re-use of such
3143                 : an old config.sh.
3144                 case "$sh" in
3145                 '') sh="$tmp_sh" ;;
3146                 esac
3147                 hint=previous
3148                 ;;
3149         esac
3150 fi
3151 . ./UU/checkcc
3152 if test ! -f config.sh; then
3153         $cat <<EOM
3154
3155 First time through, eh?  I have some defaults handy for some systems
3156 that need some extra help getting the Configure answers right:
3157
3158 EOM
3159         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3160         dflt=''
3161         : Half the following guesses are probably wrong... If you have better
3162         : tests or hints, please send them to perlbug@perl.org
3163         : The metaconfig authors would also appreciate a copy...
3164         $test -f /irix && osname=irix
3165         $test -f /xenix && osname=sco_xenix
3166         $test -f /dynix && osname=dynix
3167         $test -f /dnix && osname=dnix
3168         $test -f /lynx.os && osname=lynxos
3169         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3170         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3171         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3172         $test -f /bin/mips && /bin/mips && osname=mips
3173         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3174                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3175         $test -d /usr/apollo/bin && osname=apollo
3176         $test -f /etc/saf/_sactab && osname=svr4
3177         $test -d /usr/include/minix && osname=minix
3178         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3179         if $test -d /MachTen -o -d /MachTen_Folder; then
3180                 osname=machten
3181                 if $test -x /sbin/version; then
3182                         osvers=`/sbin/version | $awk '{print $2}' |
3183                         $sed -e 's/[A-Za-z]$//'`
3184                 elif $test -x /usr/etc/version; then
3185                         osvers=`/usr/etc/version | $awk '{print $2}' |
3186                         $sed -e 's/[A-Za-z]$//'`
3187                 else
3188                         osvers="$2.$3"
3189                 fi
3190         fi
3191
3192         $test -f /sys/posix.dll &&
3193                 $test -f /usr/bin/what &&
3194                 set X `/usr/bin/what /sys/posix.dll` &&
3195                 $test "$3" = UWIN &&
3196                 osname=uwin &&
3197                 osvers="$5"
3198
3199         if $test -f $uname; then
3200                 set X $myuname
3201                 shift
3202
3203                 case "$5" in
3204                 fps*) osname=fps ;;
3205                 mips*)
3206                         case "$4" in
3207                         umips) osname=umips ;;
3208                         *) osname=mips ;;
3209                         esac;;
3210                 [23]100) osname=mips ;;
3211                 next*) osname=next ;;
3212                 i386*)
3213                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3214                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3215                                 osname='sco'
3216                                 osvers=$tmp
3217                         elif $test -f /etc/kconfig; then
3218                                 osname=isc
3219                                 if test "$lns" = "$ln -s"; then
3220                                         osvers=4
3221                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3222                                         osvers=3
3223                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3224                                         osvers=2
3225                                 fi
3226                         fi
3227                         tmp=''
3228                         ;;
3229                 pc*)
3230                         if test -n "$DJGPP"; then
3231                                 osname=dos
3232                                 osvers=djgpp
3233                         fi
3234                         ;;
3235                 esac
3236
3237                 case "$1" in
3238                 aix) osname=aix
3239                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3240                         case "$tmp" in
3241                         # oslevel can fail with:
3242                         # oslevel: Unable to acquire lock.
3243                         *not\ found) osvers="$4"."$3" ;;
3244                         '<3240'|'<>3240') osvers=3.2.0 ;;
3245                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3246                         '=3250'|'>3250') osvers=3.2.5 ;;
3247                         *) osvers=$tmp;;
3248                         esac
3249                         ;;
3250                 bsd386) osname=bsd386
3251                         osvers=`$uname -r`
3252                         ;;
3253                 cygwin*) osname=cygwin
3254                         osvers="$3"
3255                         ;;
3256                 *dc.osx) osname=dcosx
3257                         osvers="$3"
3258                         ;;
3259                 dnix) osname=dnix
3260                         osvers="$3"
3261                         ;;
3262                 domainos) osname=apollo
3263                         osvers="$3"
3264                         ;;
3265                 dgux)   osname=dgux
3266                         osvers="$3"
3267                         ;;
3268                 dragonfly) osname=dragonfly
3269                         osvers="$3"
3270                         ;;
3271                 dynixptx*) osname=dynixptx
3272                         osvers=`echo "$4"|sed 's/^v//'`
3273                         ;;
3274                 freebsd) osname=freebsd
3275                         osvers="$3" ;;
3276                 genix)  osname=genix ;;
3277                 gnu)    osname=gnu
3278                         osvers="$3" ;;
3279                 hp*)    osname=hpux
3280                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3281                         ;;
3282                 irix*)  osname=irix
3283                         case "$3" in
3284                         4*) osvers=4 ;;
3285                         5*) osvers=5 ;;
3286                         *)      osvers="$3" ;;
3287                         esac
3288                         ;;
3289                 linux)  osname=linux
3290                         case "$3" in
3291                         *)      osvers="$3" ;;
3292                         esac
3293                         ;;
3294                 MiNT)   osname=mint
3295                         ;;
3296                 netbsd*) osname=netbsd
3297                         osvers="$3"
3298                         ;;
3299                 news-os) osvers="$3"
3300                         case "$3" in
3301                         4*) osname=newsos4 ;;
3302                         *) osname=newsos ;;
3303                         esac
3304                         ;;
3305                 next*) osname=next ;;
3306                 nonstop-ux) osname=nonstopux ;;
3307                 openbsd) osname=openbsd
3308                         osvers="$3"
3309                         ;;
3310                 os2)    osname=os2
3311                         osvers="$4"
3312                         ;;
3313                 POSIX-BC | posix-bc ) osname=posix-bc
3314                         osvers="$3"
3315                         ;;
3316                 powerux | power_ux | powermax_os | powermaxos | \
3317                 powerunix | power_unix) osname=powerux
3318                         osvers="$3"
3319                         ;;
3320                 qnx) osname=qnx
3321                         osvers="$4"
3322                         ;;
3323                 solaris) osname=solaris
3324                         case "$3" in
3325                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3326                         *)      osvers="$3" ;;
3327                         esac
3328                         ;;
3329                 sunos) osname=sunos
3330                         case "$3" in
3331                         5*) osname=solaris
3332                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3333                         *)      osvers="$3" ;;
3334                         esac
3335                         ;;
3336                 titanos) osname=titanos
3337                         case "$3" in
3338                         1*) osvers=1 ;;
3339                         2*) osvers=2 ;;
3340                         3*) osvers=3 ;;
3341                         4*) osvers=4 ;;
3342                         *)      osvers="$3" ;;
3343                         esac
3344                         ;;
3345                 ultrix) osname=ultrix
3346                         osvers="$3"
3347                         ;;
3348                 osf1|mls+)      case "$5" in
3349                                 alpha)
3350                                         osname=dec_osf
3351                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3352                                         case "$osvers" in
3353                                         [1-9].[0-9]*) ;;
3354                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3355                                         esac
3356                                         ;;
3357                         hp*)    osname=hp_osf1  ;;
3358                         mips)   osname=mips_osf1 ;;
3359                         esac
3360                         ;;
3361                 # UnixWare 7.1.2 is known as Open UNIX 8
3362                 openunix|unixware) osname=svr5
3363                         osvers="$4"
3364                         ;;
3365                 uts)    osname=uts
3366                         osvers="$3"
3367                         ;;
3368                 vos) osvers="$3"
3369                         ;;
3370                 $2) case "$osname" in
3371                         *isc*) ;;
3372                         *freebsd*) ;;
3373                         svr*)
3374                                 : svr4.x or possibly later
3375                                 case "svr$3" in
3376                                 ${osname}*)
3377                                         osname=svr$3
3378                                         osvers=$4
3379                                         ;;
3380                                 esac
3381                                 case "$osname" in
3382                                 svr4.0)
3383                                         : Check for ESIX
3384                                         if test -f /stand/boot ; then
3385                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3386                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3387                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3388                                                         if test -n "$isesix"; then
3389                                                                 osname=esix4
3390                                                         fi
3391                                                 fi
3392                                         fi
3393                                         ;;
3394                                 esac
3395                                 ;;
3396                         *)      if test -f /etc/systemid; then
3397                                         osname=sco
3398                                         set `echo $3 | $sed 's/\./ /g'` $4
3399                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3400                                                 osvers=$1.$2.$3
3401                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3402                                                 osvers=$1.$2
3403                                         elif $test -f $src/hints/sco_$1.sh; then
3404                                                 osvers=$1
3405                                         fi
3406                                 else
3407                                         case "$osname" in
3408                                         '') : Still unknown.  Probably a generic Sys V.
3409                                                 osname="sysv"
3410                                                 osvers="$3"
3411                                                 ;;
3412                                         esac
3413                                 fi
3414                                 ;;
3415                         esac
3416                         ;;
3417                 *)      case "$osname" in
3418                         '') : Still unknown.  Probably a generic BSD.
3419                                 osname="$1"
3420                                 osvers="$3"
3421                                 ;;
3422                         esac
3423                         ;;
3424                 esac
3425         else
3426                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3427                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3428                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3429                                 osname=news_os
3430                         fi
3431                         $rm -f UU/kernel.what
3432                 elif test -d c:/. -o -n "$is_os2" ; then
3433                         set X $myuname
3434                         osname=os2
3435                         osvers="$5"
3436                 fi
3437         fi
3438
3439         case "$targetarch" in
3440         '') ;;
3441         *)  hostarch=$osname
3442             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3443             osvers=''
3444             ;;
3445         esac
3446
3447         : Now look for a hint file osname_osvers, unless one has been
3448         : specified already.
3449         case "$hintfile" in
3450         ''|' ')
3451                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3452                 : Also try without trailing minor version numbers.
3453                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3454                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3455                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3456                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3457                 case "$file" in
3458                 '') dflt=none ;;
3459                 *)  case "$osvers" in
3460                         '') dflt=$file
3461                                 ;;
3462                         *)  if $test -f $src/hints/$file.sh ; then
3463                                         dflt=$file
3464                                 elif $test -f $src/hints/$xfile.sh ; then
3465                                         dflt=$xfile
3466                                 elif $test -f $src/hints/$xxfile.sh ; then
3467                                         dflt=$xxfile
3468                                 elif $test -f $src/hints/$xxxfile.sh ; then
3469                                         dflt=$xxxfile
3470                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3471                                         dflt=$xxxxfile
3472                                 elif $test -f "$src/hints/${osname}.sh" ; then
3473                                         dflt="${osname}"
3474                                 else
3475                                         dflt=none
3476                                 fi
3477                                 ;;
3478                         esac
3479                         ;;
3480                 esac
3481                 if $test -f Policy.sh ; then
3482                         case "$dflt" in
3483                         *Policy*) ;;
3484                         none) dflt="Policy" ;;
3485                         *) dflt="Policy $dflt" ;;
3486                         esac
3487                 fi
3488                 ;;
3489         *)
3490                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3491                 ;;
3492         esac
3493
3494         if $test -f Policy.sh ; then
3495                 $cat <<EOM
3496
3497 There's also a Policy hint file available, which should make the
3498 site-specific (policy) questions easier to answer.
3499 EOM
3500
3501         fi
3502
3503         $cat <<EOM
3504
3505 You may give one or more space-separated answers, or "none" if appropriate.
3506 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3507 previous run of Configure, you may specify it as well as or instead of
3508 OS-specific hints.  If hints are provided for your OS, you should use them:
3509 although Perl can probably be built without hints on many platforms, using
3510 hints often improve performance and may enable features that Configure can't
3511 set up on its own. If there are no hints that match your OS, specify "none";
3512 DO NOT give a wrong version or a wrong OS.
3513
3514 EOM
3515
3516         rp="Which of these apply, if any?"
3517         . UU/myread
3518         tans=$ans
3519         for file in $tans; do
3520                 if $test X$file = XPolicy -a -f Policy.sh; then
3521                         . Policy.sh
3522                         $cat Policy.sh >> UU/config.sh
3523                 elif $test -f $src/hints/$file.sh; then
3524                         . $src/hints/$file.sh
3525                         $cat $src/hints/$file.sh >> UU/config.sh
3526                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3527                         : nothing
3528                 else
3529                         : Give one chance to correct a possible typo.
3530                         echo "$file.sh does not exist"
3531                         dflt=$file
3532                         rp="hint to use instead?"
3533                         . UU/myread
3534                         for file in $ans; do
3535                                 if $test -f "$src/hints/$file.sh"; then
3536                                         . $src/hints/$file.sh
3537                                         $cat $src/hints/$file.sh >> UU/config.sh
3538                                 elif $test X$ans = X -o X$ans = Xnone ; then
3539                                         : nothing
3540                                 else
3541                                         echo "$file.sh does not exist -- ignored."
3542                                 fi
3543                         done
3544                 fi
3545         done
3546
3547         hint=recommended
3548         : Remember our hint file for later.
3549         if $test -f "$src/hints/$file.sh" ; then
3550                 hintfile="$file"
3551         else
3552                 hintfile=''
3553         fi
3554 fi
3555 cd UU
3556 ;;
3557 *)
3558         echo " "
3559         echo "Fetching default answers from $config_sh..." >&4
3560         tmp_n="$n"
3561         tmp_c="$c"
3562         cd ..
3563         cp $config_sh config.sh 2>/dev/null
3564         chmod +w config.sh
3565         . ./config.sh
3566         cd UU
3567         cp ../config.sh .
3568         n="$tmp_n"
3569         c="$tmp_c"
3570         hint=previous
3571         ;;
3572 esac
3573 test "$override" && . ./optdef.sh
3574
3575 : Restore computed paths
3576 for file in $loclist $trylist; do
3577         eval $file="\$_$file"
3578 done
3579
3580 cat << EOM
3581
3582 Configure uses the operating system name and version to set some defaults.
3583 The default value is probably right if the name rings a bell. Otherwise,
3584 since spelling matters for me, either accept the default or answer "none"
3585 to leave it blank.
3586
3587 EOM
3588 case "$osname" in
3589         ''|' ')
3590                 case "$hintfile" in
3591                 ''|' '|none) dflt=none ;;
3592                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3593                 esac
3594                 ;;
3595         *) dflt="$osname" ;;
3596 esac
3597 rp="Operating system name?"
3598 . ./myread
3599 case "$ans" in
3600 none)  osname='' ;;
3601 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3602 esac
3603 echo " "
3604 case "$osvers" in
3605         ''|' ')
3606                 case "$hintfile" in
3607                 ''|' '|none) dflt=none ;;
3608                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3609                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3610                         case "$dflt" in
3611                         ''|' ') dflt=none ;;
3612                         esac
3613                         ;;
3614                 esac
3615                 ;;
3616         *) dflt="$osvers" ;;
3617 esac
3618 rp="Operating system version?"
3619 . ./myread
3620 case "$ans" in
3621 none)  osvers='' ;;
3622 *) osvers="$ans" ;;
3623 esac
3624
3625
3626 . ./posthint.sh
3627
3628 : who configured the system
3629 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3630 case "$cf_by" in
3631 "")
3632         cf_by=`(logname) 2>/dev/null`
3633         case "$cf_by" in
3634         "")
3635                 cf_by=`(whoami) 2>/dev/null`
3636                 case "$cf_by" in
3637                 "") cf_by=unknown ;;
3638                 esac ;;
3639         esac ;;
3640 esac
3641
3642 : decide how portable to be.  Allow command line overrides.
3643 case "$d_portable" in
3644 "$undef") ;;
3645 *)      d_portable="$define" ;;
3646 esac
3647
3648 : set up shell script to do ~ expansion
3649 cat >filexp <<EOSS
3650 $startsh
3651 : expand filename
3652 case "\$1" in
3653  \~/*|\~)
3654         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3655         ;;
3656  \~*)
3657         if $test -f /bin/csh; then
3658                 /bin/csh -f -c "glob \$1"
3659                 failed=\$?
3660                 echo ""
3661                 exit \$failed
3662         else
3663                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3664                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3665                 if $test ! -d "\$dir"; then
3666                         me=\`basename \$0\`
3667                         echo "\$me: can't locate home directory for: \$name" >&2
3668                         exit 1
3669                 fi
3670                 case "\$1" in
3671                 */*)
3672                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3673                         ;;
3674                 *)
3675                         echo \$dir
3676                         ;;
3677                 esac
3678         fi
3679         ;;
3680 *)
3681         echo \$1
3682         ;;
3683 esac
3684 EOSS
3685 chmod +x filexp
3686 $eunicefix filexp
3687
3688 : now set up to get a file name
3689 cat <<EOS >getfile
3690 $startsh
3691 EOS
3692 cat <<'EOSC' >>getfile
3693 tilde=''
3694 fullpath=''
3695 already=''
3696 skip=''
3697 none_ok=''
3698 exp_file=''
3699 nopath_ok=''
3700 orig_rp="$rp"
3701 orig_dflt="$dflt"
3702 case "$gfpth" in
3703 '') gfpth='.' ;;
3704 esac
3705
3706 case "$fn" in
3707 *\(*)
3708         : getfile will accept an answer from the comma-separated list
3709         : enclosed in parentheses even if it does not meet other criteria.
3710         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3711         fn=`echo $fn | sed 's/(.*)//'`
3712         ;;
3713 esac
3714
3715 case "$fn" in
3716 *:*)
3717         loc_file=`expr $fn : '.*:\(.*\)'`
3718         fn=`expr $fn : '\(.*\):.*'`
3719         ;;
3720 esac
3721
3722 case "$fn" in
3723 *~*) tilde=true;;
3724 esac
3725 case "$fn" in
3726 */*) fullpath=true;;
3727 esac
3728 case "$fn" in
3729 *+*) skip=true;;
3730 esac
3731 case "$fn" in
3732 *n*) none_ok=true;;
3733 esac
3734 case "$fn" in
3735 *e*) exp_file=true;;
3736 esac
3737 case "$fn" in
3738 *p*) nopath_ok=true;;
3739 esac
3740
3741 case "$fn" in
3742 *f*) type='File';;
3743 *d*) type='Directory';;
3744 *l*) type='Locate';;
3745 esac
3746
3747 what="$type"
3748 case "$what" in
3749 Locate) what='File';;
3750 esac
3751
3752 case "$exp_file" in
3753 '')
3754         case "$d_portable" in
3755         "$define") ;;
3756         *) exp_file=true;;
3757         esac
3758         ;;
3759 esac
3760
3761 cd ..
3762 while test "$type"; do
3763         redo=''
3764         rp="$orig_rp"
3765         dflt="$orig_dflt"
3766         case "$tilde" in
3767         true) rp="$rp (~name ok)";;
3768         esac
3769         . UU/myread
3770         if test -f UU/getfile.ok && \
3771                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3772         then
3773                 value="$ans"
3774                 ansexp="$ans"
3775                 break
3776         fi
3777         case "$ans" in
3778         none)
3779                 value=''
3780                 ansexp=''
3781                 case "$none_ok" in
3782                 true) type='';;
3783                 esac
3784                 ;;
3785         *)
3786                 case "$tilde" in
3787                 '') value="$ans"
3788                         ansexp="$ans";;
3789                 *)
3790                         value=`UU/filexp $ans`
3791                         case $? in
3792                         0)
3793                                 if test "$ans" != "$value"; then
3794                                         echo "(That expands to $value on this system.)"
3795                                 fi
3796                                 ;;
3797                         *) value="$ans";;
3798                         esac
3799                         ansexp="$value"
3800                         case "$exp_file" in
3801                         '') value="$ans";;
3802                         esac
3803                         ;;
3804                 esac
3805                 case "$fullpath" in
3806                 true)
3807                         case "$ansexp" in
3808                         /*) value="$ansexp" ;;
3809                         [a-zA-Z]:/*) value="$ansexp" ;;
3810                         *)
3811                                 redo=true
3812                                 case "$already" in
3813                                 true)
3814                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3815                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3816                                         ;;
3817                                 *)
3818                                 echo "Please give a full path name, starting with slash." >&4
3819                                         case "$tilde" in
3820                                         true)
3821                                 echo "Note that using ~name is ok provided it expands well." >&4
3822                                                 already=true
3823                                                 ;;
3824                                         esac
3825                                 esac
3826                                 ;;
3827                         esac
3828                         ;;
3829                 esac
3830                 case "$redo" in
3831                 '')
3832                         case "$type" in
3833                         File)
3834                                 for fp in $gfpth; do
3835                                         if test "X$fp" = X.; then
3836                                             pf="$ansexp"
3837                                         else    
3838                                             pf="$fp/$ansexp"
3839                                         fi
3840                                         if test -f "$pf"; then
3841                                                 type=''
3842                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3843                                         then
3844                                                 echo "($value is not a plain file, but that's ok.)"
3845                                                 type=''
3846                                         fi
3847                                         if test X"$type" = X; then
3848                                             value="$pf"
3849                                             break
3850                                         fi
3851                                 done
3852                                 ;;
3853                         Directory)
3854                                 for fp in $gfpth; do
3855                                         if test "X$fp" = X.; then
3856                                             dir="$ans"
3857                                             direxp="$ansexp"
3858                                         else    
3859                                             dir="$fp/$ansexp"
3860                                             direxp="$fp/$ansexp"
3861                                         fi
3862                                         if test -d "$direxp"; then
3863                                                 type=''
3864                                                 value="$dir"
3865                                                 break
3866                                         fi
3867                                 done
3868                                 ;;
3869                         Locate)
3870                                 if test -d "$ansexp"; then
3871                                         echo "(Looking for $loc_file in directory $value.)"
3872                                         value="$value/$loc_file"
3873                                         ansexp="$ansexp/$loc_file"
3874                                 fi
3875                                 if test -f "$ansexp"; then
3876                                         type=''
3877                                 fi
3878                                 case "$nopath_ok" in
3879                                 true)   case "$value" in
3880                                         */*) ;;
3881                                         *)      echo "Assuming $value will be in people's path."
3882                                                 type=''
3883                                                 ;;
3884                                         esac
3885                                         ;;
3886                                 esac
3887                                 ;;
3888                         esac
3889
3890                         case "$skip" in
3891                         true) type='';
3892                         esac
3893
3894                         case "$type" in
3895                         '') ;;
3896                         *)
3897                                 if test "$fastread" = yes; then
3898                                         dflt=y
3899                                 else
3900                                         dflt=n
3901                                 fi
3902                                 rp="$what $value doesn't exist.  Use that name anyway?"
3903                                 . UU/myread
3904                                 dflt=''
3905                                 case "$ans" in
3906                                 y*) type='';;
3907                                 *) echo " ";;
3908                                 esac
3909                                 ;;
3910                         esac
3911                         ;;
3912                 esac
3913                 ;;
3914         esac
3915 done
3916 cd UU
3917 ans="$value"
3918 rp="$orig_rp"
3919 dflt="$orig_dflt"
3920 rm -f getfile.ok
3921 test "X$gfpthkeep" != Xy && gfpth=""
3922 EOSC
3923
3924 : determine root of directory hierarchy where package will be installed.
3925 case "$prefix" in
3926 '')
3927         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3928         ;;
3929 *?/)
3930         dflt=`echo "$prefix" | sed 's/.$//'`
3931         ;;
3932 *)
3933         dflt="$prefix"
3934         ;;
3935 esac
3936 $cat <<EOM
3937
3938 By default, $package will be installed in $dflt/bin, manual pages
3939 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3940 installation directories. Typically this is something like /usr/local.
3941 If you wish to have binaries under /usr/bin but other parts of the
3942 installation under /usr/local, that's ok: you will be prompted
3943 separately for each of the installation directories, the prefix being
3944 only used to set the defaults.
3945
3946 EOM
3947 fn=d~
3948 rp='Installation prefix to use?'
3949 . ./getfile
3950 oldprefix=''
3951 case "$prefix" in
3952 '') ;;
3953 *)
3954         case "$ans" in
3955         "$prefix") ;;
3956         *) oldprefix="$prefix";;
3957         esac
3958         ;;
3959 esac
3960 prefix="$ans"
3961 prefixexp="$ansexp"
3962
3963 : allow them to override the AFS root
3964 case "$afsroot" in
3965 '')     afsroot=/afs ;;
3966 *)      afsroot=$afsroot ;;
3967 esac
3968
3969 : is AFS running?
3970 echo " "
3971 case "$afs" in
3972 $define|true)   afs=true ;;
3973 $undef|false)   afs=false ;;
3974 *)      if $test -d $afsroot; then
3975                 afs=true
3976         else
3977                 afs=false
3978         fi
3979         ;;
3980 esac
3981 if $afs; then
3982         echo "AFS may be running... I'll be extra cautious then..." >&4
3983 else
3984         echo "AFS does not seem to be running..." >&4
3985 fi
3986
3987 : determine installation prefix for where package is to be installed.
3988 if $afs; then 
3989 $cat <<EOM
3990
3991 Since you are running AFS, I need to distinguish the directory in which
3992 files will reside from the directory in which they are installed (and from
3993 which they are presumably copied to the former directory by occult means).
3994
3995 EOM
3996         case "$installprefix" in
3997         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3998         *) dflt="$installprefix";;
3999         esac
4000 else
4001 $cat <<EOM
4002
4003 In some special cases, particularly when building $package for distribution,
4004 it is convenient to distinguish the directory in which files should be
4005 installed from the directory ($prefix) in which they will
4006 eventually reside.  For most users, these two directories are the same.
4007
4008 EOM
4009         case "$installprefix" in
4010         '') dflt=$prefix ;;
4011         *) dflt=$installprefix;;
4012         esac
4013 fi
4014 fn=d~
4015 rp='What installation prefix should I use for installing files?'
4016 . ./getfile
4017 installprefix="$ans"
4018 installprefixexp="$ansexp"
4019
4020 : Perform the prefixexp/installprefixexp correction if necessary
4021 cat <<EOS >installprefix
4022 $startsh
4023 EOS
4024 cat <<'EOSC' >>installprefix
4025 : Change installation prefix, if necessary.
4026 if $test X"$prefix" != X"$installprefix"; then
4027     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4028 else
4029     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4030 fi
4031 EOSC
4032 chmod +x installprefix
4033 $eunicefix installprefix
4034
4035 : Set variables such as privlib and privlibexp from the output of ./getfile
4036 : performing the prefixexp/installprefixexp correction if necessary.
4037 cat <<EOS >setprefixvar
4038 $startsh
4039 EOS
4040 cat <<'EOSC' >>setprefixvar
4041 eval "${prefixvar}=\"\$ans\""
4042 eval "${prefixvar}exp=\"\$ansexp\""
4043 . ./installprefix
4044 EOSC
4045 chmod +x setprefixvar
4046 $eunicefix setprefixvar
4047
4048 : set up the script used to warn in case of inconsistency
4049 cat <<EOS >whoa
4050 $startsh
4051 EOS
4052 cat <<'EOSC' >>whoa
4053 dflt=y
4054 case "$hint" in
4055     recommended)
4056         case "$hintfile" in
4057         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4058                 ;;
4059         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4060                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4061                 ;;
4062         esac
4063         ;;
4064     *)  echo " "
4065         echo "*** WHOA THERE!!! ***" >&4
4066         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4067         ;;
4068 esac
4069 rp="    Keep the $hint value?"
4070 . ./myread
4071 case "$ans" in
4072 y) td=$was; tu=$was;;
4073 esac
4074 EOSC
4075
4076 : function used to set '$1' to '$val'
4077 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4078 case "$val$was" in
4079 $define$undef) . ./whoa; eval "$var=\$td";;
4080 $undef$define) . ./whoa; eval "$var=\$tu";;
4081 *) eval "$var=$val";;
4082 esac'
4083
4084 : get the patchlevel
4085 echo " "
4086 echo "Getting the current patchlevel..." >&4
4087 if $test -r $rsrc/patchlevel.h;then
4088         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4089         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4090         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4091         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4092         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4093         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4094         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4095 else
4096         revision=0
4097         patchlevel=0
4098         subversion=0
4099         api_revision=0
4100         api_version=0
4101         api_subversion=0
4102         perl_patchlevel=0
4103         $echo "(You do not have patchlevel.h.  Eek.)"
4104 fi
4105 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4106 version_patchlevel_string="version $patchlevel subversion $subversion"
4107 case "$perl_patchlevel" in
4108 0|'') ;;
4109 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4110     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4111     ;;
4112 esac
4113
4114 $echo "(You have $package $version_patchlevel_string.)"
4115
4116 case "$osname" in
4117 dos|vms)
4118         : XXX Should be a Configure test for double-dots in filenames.
4119         version=`echo $revision $patchlevel $subversion | \
4120                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4121         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4122                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4123         ;;
4124 *)
4125         version=`echo $revision $patchlevel $subversion | \
4126                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4127         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4128                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4129         ;;
4130 esac
4131 : Special case the 5.005_xx maintenance series, which used 5.005
4132 : without any subversion label as a subdirectory in $sitelib
4133 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4134         api_versionstring='5.005'
4135 fi
4136
4137 : Do we want threads support and if so, what type
4138 case "$usethreads" in
4139 $define|true|[yY]*)     dflt='y';;
4140 *)     # Catch case where user specified ithreads or 5005threads but
4141        # forgot -Dusethreads (A.D. 4/2002)
4142        case "$useithreads$use5005threads" in
4143        *$define*)       dflt='y';;
4144        *)               dflt='n';;
4145        esac
4146        ;;
4147 esac
4148 cat <<EOM
4149
4150 Perl can be built to take advantage of threads on some systems.
4151 To do so, Configure can be run with -Dusethreads.
4152
4153 Note that Perl built with threading support runs slightly slower
4154 and uses more memory than plain Perl. The current implementation
4155 is believed to be stable, but it is fairly new, and so should be
4156 treated with caution.
4157
4158 If this doesn't make any sense to you, just accept the default '$dflt'.
4159 EOM
4160 rp='Build a threading Perl?'
4161 . ./myread
4162 case "$ans" in
4163 y|Y)    val="$define" ;;
4164 *)      val="$undef" ;;
4165 esac
4166 set usethreads
4167 eval $setvar
4168
4169 if $test $patchlevel -lt 9; then
4170     case "$usethreads" in
4171     $define)
4172         $cat <<EOM
4173
4174 Since release 5.6, Perl has had two different threading implementations,
4175 the newer interpreter-based version (ithreads) with one interpreter per
4176 thread, and the older 5.005 version (5005threads).
4177 The 5005threads version is effectively unmaintained and will probably be
4178 removed in Perl 5.10, so there should be no need to build a Perl using it
4179 unless needed for backwards compatibility with some existing 5.005threads
4180 code.
4181
4182 EOM
4183         : Default to ithreads unless overridden on command line or with
4184         : old config.sh
4185         dflt='y'
4186         case "$use5005threads" in
4187                 $define|true|[yY]*) dflt='n';;
4188         esac
4189         case "$useithreads" in
4190                 $undef|false|[nN]*) dflt='n';;
4191         esac
4192         rp='Use the newer interpreter-based ithreads?'
4193         . ./myread
4194         case "$ans" in
4195         y|Y)    val="$define" ;;
4196         *)      val="$undef" ;;
4197         esac
4198         set useithreads
4199         eval $setvar
4200         : Now set use5005threads to the opposite value.
4201         case "$useithreads" in
4202         $define) val="$undef" ;;
4203         *) val="$define" ;;
4204         esac
4205         set use5005threads
4206         eval $setvar
4207         ;;
4208     *)
4209         useithreads="$undef"
4210         use5005threads="$undef"
4211         ;;
4212     esac
4213
4214     case "$useithreads$use5005threads" in
4215     "$define$define")
4216         $cat >&4 <<EOM
4217
4218 You cannot have both the ithreads and the 5.005 threads enabled
4219 at the same time.  Disabling the 5.005 threads since they are
4220 much less stable than the ithreads.
4221
4222 EOM
4223         use5005threads="$undef"
4224         ;;
4225     esac
4226
4227 else
4228 : perl-5.9.x and later
4229
4230     if test X"$usethreads" = "X$define"; then
4231         case "$use5005threads" in
4232             $define|true|[yY]*)
4233                 $cat >&4 <<EOM
4234
4235 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4236
4237 EOM
4238             ;;
4239         esac
4240     fi
4241
4242     use5005threads="$undef"
4243     useithreads="$usethreads"
4244 fi
4245
4246 case "$d_oldpthreads" in
4247 '')     : Configure tests would be welcome here.  For now, assume undef.
4248         val="$undef" ;;
4249 *)      val="$d_oldpthreads" ;;
4250 esac
4251 set d_oldpthreads
4252 eval $setvar
4253
4254
4255 : Look for a hint-file generated 'call-back-unit'.  If the
4256 : user has specified that a threading perl is to be built,
4257 : we may need to set or change some other defaults.
4258 if $test -f usethreads.cbu; then
4259     echo "Your platform has some specific hints regarding threaded builds, using them..."
4260     . ./usethreads.cbu
4261 else
4262     case "$usethreads" in
4263         "$define"|true|[yY]*)
4264                 $cat <<EOM
4265 (Your platform does not have any specific hints for threaded builds.
4266  Assuming POSIX threads, then.)
4267 EOM
4268         ;;
4269     esac
4270 fi
4271
4272 : Check if multiplicity is required
4273 cat <<EOM
4274
4275 Perl can be built so that multiple Perl interpreters can coexist
4276 within the same Perl executable.
4277 EOM
4278
4279 case "$useithreads" in
4280 $define)
4281         cat <<EOM
4282 This multiple interpreter support is required for interpreter-based threads.
4283 EOM
4284         val="$define"
4285         ;;
4286 *)      case "$usemultiplicity" in
4287         $define|true|[yY]*)     dflt='y';;
4288         *) dflt='n';;
4289         esac
4290         echo " "
4291         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4292         rp='Build Perl for multiplicity?'
4293         . ./myread
4294         case "$ans" in
4295         y|Y)    val="$define" ;;
4296         *)      val="$undef" ;;
4297         esac
4298         ;;
4299 esac
4300 set usemultiplicity
4301 eval $setvar
4302
4303 : Check if morebits is requested
4304 case "$usemorebits" in
4305 "$define"|true|[yY]*)
4306         use64bitint="$define"
4307         uselongdouble="$define"
4308         usemorebits="$define"
4309         ;;
4310 *)      usemorebits="$undef"
4311         ;;
4312 esac
4313
4314 : Determine the C compiler to be used
4315 echo " "
4316 case "$cc" in
4317 '') dflt=cc;;
4318 *) dflt="$cc";;
4319 esac
4320 rp="Use which C compiler?"
4321 . ./myread
4322 cc="$ans"
4323
4324 : See whether they have no cc but they do have gcc
4325 . ./trygcc
4326 if $test -f cc.cbu; then
4327     . ./cc.cbu
4328 fi
4329 . ./checkcc
4330
4331 : make some quick guesses about what we are up against
4332 echo " "
4333 $echo $n "Hmm...  $c"
4334 echo exit 1 >bsd
4335 echo exit 1 >usg
4336 echo exit 1 >v7
4337 echo exit 1 >osf1
4338 echo exit 1 >eunice
4339 echo exit 1 >xenix
4340 echo exit 1 >venix
4341 echo exit 1 >os2
4342 d_bsd="$undef"
4343 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4344 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4345 then
4346         echo "Looks kind of like an OSF/1 system, but we'll see..."
4347         echo exit 0 >osf1
4348 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4349         xxx=`./loc addbib blurfl $pth`
4350         if $test -f $xxx; then
4351         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4352                 echo exit 0 >bsd
4353                 echo exit 0 >usg
4354         else
4355                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4356                         echo "Looks kind of like an extended USG system, but we'll see..."
4357                 else
4358                         echo "Looks kind of like a USG system, but we'll see..."
4359                 fi
4360                 echo exit 0 >usg
4361         fi
4362 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4363         echo "Looks kind of like a BSD system, but we'll see..."
4364         d_bsd="$define"
4365         echo exit 0 >bsd
4366 else
4367         echo "Looks kind of like a Version 7 system, but we'll see..."
4368         echo exit 0 >v7
4369 fi
4370 case "$eunicefix" in
4371 *unixtovms*)
4372         $cat <<'EOI'
4373 There is, however, a strange, musty smell in the air that reminds me of
4374 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4375 EOI
4376         echo exit 0 >eunice
4377         d_eunice="$define"
4378 : it so happens the Eunice I know will not run shell scripts in Unix format
4379         ;;
4380 *)
4381         echo " "
4382         echo "Congratulations.  You aren't running Eunice."
4383         d_eunice="$undef"
4384         ;;
4385 esac
4386 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4387 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4388 : semicolon as a patch separator
4389 case "$p_" in
4390 :) ;;
4391 *)
4392         $cat <<'EOI'
4393 I have the feeling something is not exactly right, however...don't tell me...
4394 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4395 (Or you may be running DOS with DJGPP.)
4396 EOI
4397         echo exit 0 >os2
4398         ;;
4399 esac
4400 if test -f /xenix; then
4401         echo "Actually, this looks more like a XENIX system..."
4402         echo exit 0 >xenix
4403         d_xenix="$define"
4404 else
4405         echo " "
4406         echo "It's not Xenix..."
4407         d_xenix="$undef"
4408 fi
4409 chmod +x xenix
4410 $eunicefix xenix
4411 if test -f /venix; then
4412         echo "Actually, this looks more like a VENIX system..."
4413         echo exit 0 >venix
4414 else
4415         echo " "
4416         if ./xenix; then
4417                 : null
4418         else
4419                 echo "Nor is it Venix..."
4420         fi
4421 fi
4422 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4423 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4424 $rm -f foo
4425
4426 : Check if we are using GNU gcc and what its version is
4427 echo " "
4428 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4429 $cat >try.c <<EOM
4430 #include <stdio.h>
4431 int main() {
4432 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4433 #ifdef __VERSION__
4434         printf("%s\n", __VERSION__);
4435 #else
4436         printf("%s\n", "1");
4437 #endif
4438 #endif
4439         return(0);
4440 }
4441 EOM
4442 if $cc -o try $ccflags $ldflags try.c; then
4443         gccversion=`$run ./try`
4444         case "$gccversion" in
4445         '') echo "You are not using GNU cc." ;;
4446         *)  echo "You are using GNU cc $gccversion."
4447             ccname=gcc
4448             ;;
4449         esac
4450 else
4451         echo " "
4452         echo "*** WHOA THERE!!! ***" >&4
4453         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4454         case "$knowitall" in
4455         '')
4456         echo "    You'd better start hunting for one and let me know about it." >&4
4457                 exit 1
4458                 ;;
4459         esac
4460 fi
4461 $rm -f try try.*
4462 case "$gccversion" in
4463 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4464 esac
4465 case "$gccversion" in
4466 '') gccosandvers='' ;;
4467 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4468    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4469    gccshortvers=''
4470    case "$gccosandvers" in
4471    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4472    $osname$osvers) ;; # looking good
4473    $osname*) cat <<EOM >&4
4474
4475 *** WHOA THERE!!! ***
4476
4477     Your gcc has not been compiled for the exact release of
4478     your operating system ($gccosandvers versus $osname$osvers).
4479
4480     In general it is a good idea to keep gcc synchronized with
4481     the operating system because otherwise serious problems
4482     may ensue when trying to compile software, like Perl.
4483
4484     I'm trying to be optimistic here, though, and will continue.
4485     If later during the configuration and build icky compilation
4486     problems appear (headerfile conflicts being the most common
4487     manifestation), I suggest reinstalling the gcc to match
4488     your operating system release.
4489
4490 EOM
4491       ;;
4492    *) gccosandvers='' ;; # failed to parse, better be silent
4493    esac
4494    ;;
4495 esac
4496 case "$ccname" in
4497 '') ccname="$cc" ;;
4498 esac
4499
4500 # gcc 3.* complain about adding -Idirectories that they already know about,
4501 # so we will take those off from locincpth.
4502 case "$gccversion" in
4503 3*)
4504     echo "main(){}">try.c
4505     for incdir in $locincpth; do
4506        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4507              grep '^c[cp]p*[01]: warning: changing search order '`
4508        if test "X$warn" != X; then
4509            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4510        fi
4511     done
4512     $rm -f try try.*
4513 esac
4514
4515 : What should the include directory be ?
4516 echo " "
4517 $echo $n "Hmm...  $c"
4518 dflt='/usr/include'
4519 incpath=''
4520 mips_type=''
4521 if $test -f /bin/mips && /bin/mips; then
4522         echo "Looks like a MIPS system..."
4523         $cat >usr.c <<'EOCP'
4524 #ifdef SYSTYPE_BSD43
4525 /bsd43
4526 #endif
4527 EOCP
4528         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4529                 dflt='/bsd43/usr/include'
4530                 incpath='/bsd43'
4531                 mips_type='BSD 4.3'
4532         else
4533                 mips_type='System V'
4534         fi
4535         $rm -f usr.c usr.out
4536         echo "and you're compiling with the $mips_type compiler and libraries."
4537         xxx_prompt=y
4538         echo "exit 0" >mips
4539 else
4540         echo "Doesn't look like a MIPS system."
4541         xxx_prompt=n
4542         echo "exit 1" >mips
4543 fi
4544 chmod +x mips
4545 $eunicefix mips
4546 case "$usrinc" in
4547 '') ;;
4548 *) dflt="$usrinc";;
4549 esac
4550 case "$xxx_prompt" in
4551 y)      fn=d/
4552         echo " "
4553         rp='Where are the include files you want to use?'
4554         . ./getfile
4555         usrinc="$ans"
4556         ;;
4557 *)      usrinc="$dflt"
4558         ;;
4559 esac
4560
4561 : see how we invoke the C preprocessor
4562 echo " "
4563 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4564 cat <<'EOT' >testcpp.c
4565 #define ABC abc
4566 #define XYZ xyz
4567 ABC.XYZ
4568 EOT
4569 cd ..
4570 if test ! -f cppstdin; then
4571         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4572                 # AIX cc -E doesn't show the absolute headerfile
4573                 # locations but we'll cheat by using the -M flag.
4574                 echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; test -s .$$.u && awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' > cppstdin
4575         else
4576                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4577         fi
4578 else
4579         echo "Keeping your $hint cppstdin wrapper."
4580 fi
4581 chmod 755 cppstdin
4582 wrapper=`pwd`/cppstdin
4583 ok='false'
4584 cd UU
4585
4586 if $test "X$cppstdin" != "X" && \
4587         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4588         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4589 then
4590         echo "You used to use $cppstdin $cppminus so we'll use that again."
4591         case "$cpprun" in
4592         '') echo "But let's see if we can live without a wrapper..." ;;
4593         *)
4594                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4595                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4596                 then
4597                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4598                         ok='true'
4599                 else
4600                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4601                 fi
4602                 ;;
4603         esac
4604 else
4605         case "$cppstdin" in
4606         '') ;;
4607         *)
4608                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4609                 ;;
4610         esac
4611 fi
4612
4613 if $ok; then
4614         : nothing
4615 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4616         $cc -E <testcpp.c >testcpp.out 2>&1; \
4617         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4618         echo "Yup, it does."
4619         x_cpp="$cc -E"
4620         x_minus='';
4621 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4622         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4623         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4624         echo "Yup, it does."
4625         x_cpp="$cc -E"
4626         x_minus='-';
4627 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4628         $cc -P <testcpp.c >testcpp.out 2>&1; \
4629         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4630         echo "Yipee, that works!"
4631         x_cpp="$cc -P"
4632         x_minus='';
4633 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4634         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4635         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4636         echo "At long last!"
4637         x_cpp="$cc -P"
4638         x_minus='-';
4639 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4640         $cpp <testcpp.c >testcpp.out 2>&1; \
4641         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4642         echo "It works!"
4643         x_cpp="$cpp"
4644         x_minus='';
4645 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4646         $cpp - <testcpp.c >testcpp.out 2>&1; \
4647         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4648         echo "Hooray, it works!  I was beginning to wonder."
4649         x_cpp="$cpp"
4650         x_minus='-';
4651 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4652         $wrapper <testcpp.c >testcpp.out 2>&1; \
4653         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4654         x_cpp="$wrapper"
4655         x_minus=''
4656         echo "Eureka!"
4657 else
4658         dflt=''
4659         rp="No dice.  I can't find a C preprocessor.  Name one:"
4660         . ./myread
4661         x_cpp="$ans"
4662         x_minus=''
4663         $x_cpp <testcpp.c >testcpp.out 2>&1
4664         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4665                 echo "OK, that will do." >&4
4666         else
4667 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4668                 exit 1
4669         fi
4670 fi
4671
4672 case "$ok" in
4673 false)
4674         cppstdin="$x_cpp"
4675         cppminus="$x_minus"
4676         cpprun="$x_cpp"
4677         cpplast="$x_minus"
4678         set X $x_cpp
4679         shift
4680         case "$1" in
4681         "$cpp")
4682                 echo "Perhaps can we force $cc -E using a wrapper..."
4683                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4684                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4685                 then
4686                         echo "Yup, we can."
4687                         cppstdin="$wrapper"
4688                         cppminus='';
4689                 else
4690                         echo "Nope, we'll have to live without it..."
4691                 fi
4692                 ;;
4693         esac
4694         case "$cpprun" in
4695         "$wrapper")
4696                 cpprun=''
4697                 cpplast=''
4698                 ;;
4699         esac
4700         ;;
4701 esac
4702
4703 case "$cppstdin" in
4704 "$wrapper"|'cppstdin') ;;
4705 *) $rm -f $wrapper;;
4706 esac
4707 $rm -f testcpp.c testcpp.out
4708
4709 : Set private lib path
4710 case "$plibpth" in
4711 '') if ./mips; then
4712                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4713         fi;;
4714 esac
4715 case "$libpth" in
4716 ' ') dlist='';;
4717 '') dlist="$loclibpth $plibpth $glibpth";;
4718 *) dlist="$libpth";;
4719 esac
4720
4721 : Now check and see which directories actually exist, avoiding duplicates
4722 libpth=''
4723 for xxx in $dlist
4724 do
4725     if $test -d $xxx; then
4726                 case " $libpth " in
4727                 *" $xxx "*) ;;
4728                 *) libpth="$libpth $xxx";;
4729                 esac
4730     fi
4731 done
4732 $cat <<'EOM'
4733
4734 Some systems have incompatible or broken versions of libraries.  Among
4735 the directories listed in the question below, please remove any you
4736 know not to be holding relevant libraries, and add any that are needed.
4737 Say "none" for none.
4738
4739 EOM
4740 case "$libpth" in
4741 '') dflt='none';;
4742 *)
4743         set X $libpth
4744         shift
4745         dflt=${1+"$@"}
4746         ;;
4747 esac
4748 rp="Directories to use for library searches?"
4749 . ./myread
4750 case "$ans" in
4751 none) libpth=' ';;
4752 *) libpth="$ans";;
4753 esac
4754
4755 : compute shared library extension
4756 case "$so" in
4757 '')
4758         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4759                 dflt='sl'
4760         else
4761                 dflt='so'
4762         fi
4763         ;;
4764 *) dflt="$so";;
4765 esac
4766 $cat <<EOM
4767
4768 On some systems, shared libraries may be available.  Answer 'none' if
4769 you want to suppress searching of shared libraries for the remainder
4770 of this configuration.
4771
4772 EOM
4773 rp='What is the file extension used for shared libraries?'
4774 . ./myread
4775 so="$ans"
4776
4777 : Define several unixisms.
4778 : Hints files or command line option can be used to override them.
4779 : The convoluted testing is in case hints files set either the old
4780 : or the new name.
4781 case "$_exe" in
4782 '')     case "$exe_ext" in
4783         '')     ;;
4784         *)      _exe="$exe_ext" ;;
4785         esac
4786         ;;
4787 esac
4788 case "$_a" in
4789 '')     case "$lib_ext" in
4790     '') _a='.a';;
4791         *)      _a="$lib_ext" ;;
4792         esac
4793         ;;
4794 esac
4795 case "$_o" in
4796 '') case "$obj_ext" in
4797         '')     _o='.o';;
4798         *)      _o="$obj_ext";;
4799         esac
4800         ;;
4801 esac
4802 case "$p_" in
4803 '') case "$path_sep" in
4804         '')     p_=':';;
4805         *)      p_="$path_sep";;
4806         esac
4807         ;;
4808 esac
4809 exe_ext=$_exe
4810 lib_ext=$_a
4811 obj_ext=$_o
4812 path_sep=$p_
4813
4814 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4815
4816 : Which makefile gets called first.  This is used by make depend.
4817 case "$firstmakefile" in
4818 '') firstmakefile='makefile';;
4819 esac
4820
4821 : Check is we will use socks
4822 case "$usesocks" in
4823 $define|true|[yY]*)     dflt='y';;
4824 *) dflt='n';;
4825 esac
4826 cat <<EOM
4827
4828 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4829 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4830 to use the PerlIO abstraction layer, this will be implicitly selected.
4831
4832 If this doesn't make any sense to you, just accept the default '$dflt'.
4833 EOM
4834 rp='Build Perl for SOCKS?'
4835 . ./myread
4836 case "$ans" in
4837 y|Y)    val="$define" ;;
4838 *)      val="$undef" ;;
4839 esac
4840 set usesocks
4841 eval $setvar
4842
4843 : Check for uselongdouble support
4844 case "$ccflags" in
4845 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4846 esac
4847
4848 case "$uselongdouble" in
4849 $define|true|[yY]*)     dflt='y';;
4850 *) dflt='n';;
4851 esac
4852 cat <<EOM
4853
4854 Perl can be built to take advantage of long doubles which
4855 (if available) may give more accuracy and range for floating point numbers.
4856
4857 If this doesn't make any sense to you, just accept the default '$dflt'.
4858 EOM
4859 rp='Try to use long doubles if available?'
4860 . ./myread
4861 case "$ans" in
4862 y|Y)    val="$define"   ;;
4863 *)      val="$undef"    ;;
4864 esac
4865 set uselongdouble
4866 eval $setvar
4867
4868 case "$uselongdouble" in