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