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