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