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