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