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