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