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