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