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