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