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