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