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