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