[perl #97020] Carp (actually caller) leaking memory
[perl.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist 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 Wed Jun 23 16:03:55 CEST 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 "$less" in
2449 '')     ;;
2450 *)      if $less -R </dev/null >/dev/null; then
2451                echo "Substituting less -R for less."
2452                less="$less -R"
2453                _less=$less
2454         fi
2455         ;;
2456 esac
2457 case "$ln" in
2458 ln)
2459         echo "Substituting cp for ln."
2460         ln=$cp
2461         _ln=$cp
2462         ;;
2463 esac
2464 case "$make" in
2465 make)
2466         case "$gmake" in
2467         gmake)
2468         echo "I can't find make or gmake, and my life depends on it." >&4
2469         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2470         exit 1
2471         ;;
2472         esac
2473         ;;
2474 esac
2475 case "$gmake" in
2476 gmake)  ;;
2477 *)      # We can't have osname yet.
2478         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2479                 # Assume that gmake, if found, is definitely GNU make
2480                 # and prefer it over the system make.
2481                 echo "Substituting gmake for make."
2482                 make=$gmake
2483                 _make=$gmake
2484         fi
2485         ;;
2486 esac
2487 case "$test" in
2488 test)
2489         echo "Hopefully test is built into your sh."
2490         ;;
2491 *)
2492         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2493                 echo "Using the test built into your sh."
2494                 test=test
2495                 _test=test
2496         fi
2497         ;;
2498 esac
2499 case "$echo" in
2500 echo)
2501         echo "Hopefully echo is built into your sh."
2502         ;;
2503 '') ;;
2504 *)
2505         echo " "
2506 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2507         $echo $n "hi there$c" >foo1
2508         echo $n "hi there$c" >foo2
2509         if cmp foo1 foo2 >/dev/null 2>&1; then
2510                 echo "They are compatible.  In fact, they may be identical."
2511         else
2512                 case "$n" in
2513                 '-n') n='' c='\c';;
2514                 *) n='-n' c='';;
2515                 esac
2516                 cat <<FOO
2517 They are not compatible!  You are probably running ksh on a non-USG system.
2518 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2519 have echo built in and we may have to run some Bourne shell scripts.  That
2520 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2521
2522 FOO
2523                 $echo $n "The star should be here-->$c"
2524                 $echo "*"
2525         fi
2526         $rm -f foo1 foo2
2527         ;;
2528 esac
2529
2530 # This question was auctioned at YAPC::Europe-2007 in Vienna
2531 # I never promised you could answer it. I only auctioned the question.
2532 cat <<FOO
2533 The following message is sponsored by
2534
2535   Dresden.pm<--The stars should be here.
2536
2537 Dear Perl user, system administrator or package
2538 maintainer, the Perl community sends greetings to
2539 you. Do you (emblematical) greet back [Y/n]? n
2540
2541 FOO
2542
2543 : Check what type of C compiler we use
2544 cat <<EOS >trygcc
2545 $startsh
2546 EOS
2547 cat <<'EOSC' >>trygcc
2548 case "$cc" in
2549 '') ;;
2550 *)  $rm -f try try.*
2551     $cat >try.c <<EOM
2552 int main(int argc, char *argv[]) {
2553   return 0;
2554 }
2555 EOM
2556     if $cc -o try $ccflags $ldflags try.c; then
2557        :
2558     else
2559         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2560         despair=yes
2561         trygcc=yes
2562         case "$cc" in
2563         *gcc*) trygcc=no ;;
2564         esac
2565         # Skip this test because it gives a false match on output like:
2566         #    ./trygcc: line 23: cc: command not found
2567         # case "`$cc -v -c try.c 2>&1`" in
2568         # *gcc*) trygcc=no ;;
2569         # esac
2570         if $test X"$trygcc" = Xyes; then
2571             if gcc -o try -c try.c; then
2572                 echo " "
2573                 echo "You seem to have a working gcc, though." >&4
2574                 # Switching compilers may undo the work of hints files.
2575                 # The most common problem is -D_REENTRANT for threads.
2576                 # This heuristic catches that case, but gets false positives
2577                 # if -Dusethreads was not actually specified.  Better to
2578                 # bail out here with a useful message than fail 
2579                 # mysteriously later. Should we perhaps just try to
2580                 # re-invoke Configure -Dcc=gcc config_args ?
2581                 if $test -f usethreads.cbu; then
2582                         $cat >&4 <<EOM 
2583
2584 *** However, any setting of the C compiler flags (e.g. for thread support)
2585 *** will be lost.  It may be necessary for you to restart Configure and
2586 *** add -Dcc=gcc to your Configure command line.
2587
2588 EOM
2589                         rp="Would you like to go ahead and try gcc anyway?"
2590                         dflt=n
2591                 else
2592                         rp="Would you like to use it?"
2593                         dflt=y
2594                 fi
2595                 if $test -f myread; then
2596                     . ./myread
2597                 else
2598                     if $test -f UU/myread; then
2599                         . ./UU/myread
2600                     else
2601                         echo "Cannot find myread, sorry.  Aborting." >&2
2602                         exit 1
2603                     fi
2604                 fi  
2605                 case "$ans" in
2606                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2607                 esac
2608             fi
2609         fi
2610     fi
2611     $rm -f try try.*
2612     ;;
2613 esac
2614 EOSC
2615
2616 cat <<EOS >checkcc
2617 $startsh
2618 EOS
2619 cat <<'EOSC' >>checkcc
2620 case "$cc" in        
2621 '') ;;
2622 *)  $rm -f try try.*              
2623     $cat >try.c <<EOM
2624 int main(int argc, char *argv[]) {
2625   return 0;
2626 }
2627 EOM
2628     if $cc -o try $ccflags $ldflags try.c; then
2629        :
2630     else
2631         if $test X"$despair" = Xyes; then
2632            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2633         fi
2634         $cat >&4 <<EOM         
2635 You need to find a working C compiler.
2636 Either (purchase and) install the C compiler supplied by your OS vendor,
2637 or for a free C compiler try http://gcc.gnu.org/
2638 I cannot continue any further, aborting.
2639 EOM
2640         exit 1
2641     fi
2642     $rm -f try try.*
2643     ;;
2644 esac
2645 EOSC
2646
2647 : determine whether symbolic links are supported
2648 echo " "
2649 $touch blurfl
2650 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2651         echo "Symbolic links are supported." >&4
2652         lns="$ln -s"
2653 else
2654         echo "Symbolic links are NOT supported." >&4
2655         lns="$ln"
2656 fi
2657 $rm -f blurfl sym
2658
2659 : determine whether symbolic links are supported
2660 echo " "
2661 case "$lns" in
2662 *"ln"*" -s")
2663         echo "Checking how to test for symbolic links..." >&4
2664         $lns blurfl sym
2665         if $test "X$issymlink" = X; then
2666                 case "$newsh" in
2667                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2668                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2669                 esac
2670                 if test $? = 0; then
2671                         issymlink="test -h"
2672                 else
2673                         echo "Your builtin 'test -h' may be broken." >&4
2674                         case "$test" in
2675                         /*)     ;;
2676                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2677                                 for p in $pth
2678                                 do
2679                                         if test -f "$p/$test"; then
2680                                                 test="$p/$test"
2681                                                 break
2682                                         fi
2683                                 done
2684                                 ;;
2685                         esac
2686                         case "$test" in
2687                         /*)
2688                                 echo "Trying external '$test -h'." >&4
2689                                 issymlink="$test -h"
2690                                 if $test ! -h sym >/dev/null 2>&1; then
2691                                         echo "External '$test -h' is broken, too." >&4
2692                                         issymlink=''
2693                                 fi
2694                                 ;;
2695                         *)      issymlink='' ;;
2696                         esac
2697                 fi              
2698         fi
2699         if $test "X$issymlink" = X; then
2700                 if $test -L sym 2>/dev/null; then
2701                         issymlink="$test -L"
2702                         echo "The builtin '$test -L' worked." >&4
2703                 fi
2704         fi
2705         if $test "X$issymlink" != X; then
2706                 echo "You can test for symbolic links with '$issymlink'." >&4
2707         else
2708                 echo "I do not know how you can test for symbolic links." >&4
2709         fi
2710         $rm -f blurfl sym
2711         ;;
2712 *)      echo "No symbolic links, so not testing for their testing..." >&4
2713         ;;
2714 esac
2715 echo " "
2716
2717 : Make symlinks util
2718 case "$mksymlinks" in
2719 $define|true|[yY]*)
2720         case "$src" in
2721         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2722                 exit 1
2723                 ;;
2724         *)      case "$lns:$issymlink" in
2725                 *"ln"*" -s:"*"test -"?)
2726                         echo "Creating the symbolic links..." >&4
2727                         echo "(First creating the subdirectories...)" >&4
2728                         cd ..
2729                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2730                                 read directory
2731                                 test -z "$directory" && break
2732                                 mkdir -p $directory
2733                         done
2734                         # Sanity check 1.
2735                         if test ! -d t/base; then
2736                                 echo "Failed to create the subdirectories.  Aborting." >&4
2737                                 exit 1
2738                         fi
2739                         echo "(Then creating the symlinks...)" >&4
2740                         awk '{print $1}' $src/MANIFEST | while true; do
2741                                 read filename
2742                                 test -z "$filename" && break
2743                                 if test -f $filename; then
2744                                         if $issymlink $filename; then
2745                                                 rm -f $filename
2746                                         fi
2747                                 fi
2748                                 if test -f $filename; then
2749                                         echo "$filename already exists, not symlinking."
2750                                 else
2751                                         ln -s $src/$filename $filename
2752                                 fi
2753                         done
2754                         # Sanity check 2.
2755                         if test ! -f t/base/lex.t; then
2756                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2757                                 exit 1
2758                         fi
2759                         cd UU
2760                         ;;
2761                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2762                         ;;
2763                 esac
2764                 ;;
2765         esac
2766         ;;
2767 esac
2768
2769 : Check for Cross-Compilation
2770 case "$usecrosscompile" in
2771 $define|true|[yY]*)
2772         $echo "Cross-compiling..."
2773         croak=''
2774         case "$cc" in
2775         *-*-gcc) # A cross-compiling gcc, probably.
2776             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2777             ar=$targetarch-ar
2778             # leave out ld, choosing it is more complex
2779             nm=$targetarch-nm
2780             ranlib=$targetarch-ranlib
2781             $echo 'extern int foo;' > try.c
2782             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2783             shift
2784             if $test $# -gt 0; then
2785                 incpth="$incpth $*"
2786                 incpth="`$echo $incpth|$sed 's/^ //'`"
2787                 echo "Guessing incpth '$incpth'." >&4
2788                 for i in $*; do
2789                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2790                     if $test -d $j; then
2791                         libpth="$libpth $j"
2792                     fi
2793                 done   
2794                 libpth="`$echo $libpth|$sed 's/^ //'`"
2795                 echo "Guessing libpth '$libpth'." >&4
2796             fi
2797             $rm -f try.c
2798             ;;
2799         esac
2800         case "$targetarch" in
2801         '') echo "Targetarch not defined." >&4; croak=y ;;
2802         *)  echo "Using targetarch $targetarch." >&4 ;;
2803         esac
2804         case "$incpth" in
2805         '') echo "Incpth not defined." >&4; croak=y ;;
2806         *)  echo "Using incpth '$incpth'." >&4 ;;
2807         esac
2808         case "$libpth" in
2809         '') echo "Libpth not defined." >&4; croak=y ;;
2810         *)  echo "Using libpth '$libpth'." >&4 ;;
2811         esac
2812         case "$usrinc" in
2813         '') for i in $incpth; do
2814                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2815                     usrinc=$i
2816                     echo "Guessing usrinc $usrinc." >&4
2817                     break
2818                 fi
2819             done
2820             case "$usrinc" in
2821             '') echo "Usrinc not defined." >&4; croak=y ;;
2822             esac
2823             ;;
2824         *)  echo "Using usrinc $usrinc." >&4 ;;
2825         esac
2826         case "$targethost" in
2827         '') echo "Targethost not defined." >&4; croak=y ;;
2828         *)  echo "Using targethost $targethost." >&4
2829         esac
2830         locincpth=' '
2831         loclibpth=' '
2832         case "$croak" in
2833         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2834         esac
2835         case "$src" in
2836         /*) run=$src/Cross/run
2837             targetmkdir=$src/Cross/mkdir
2838             to=$src/Cross/to
2839             from=$src/Cross/from
2840             ;;
2841         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2842             run=$pwd/Cross/run
2843             targetmkdir=$pwd/Cross/mkdir
2844             to=$pwd/Cross/to
2845             from=$pwd/Cross/from
2846             ;;
2847         esac
2848         case "$targetrun" in
2849         '') targetrun=ssh ;;
2850         esac
2851         case "$targetto" in
2852         '') targetto=scp ;;
2853         esac
2854         case "$targetfrom" in
2855         '') targetfrom=scp ;;
2856         esac
2857         run=$run-$targetrun
2858         to=$to-$targetto
2859         from=$from-$targetfrom
2860         case "$targetdir" in
2861         '')  targetdir=/tmp
2862              echo "Guessing targetdir $targetdir." >&4
2863              ;;
2864         esac
2865         case "$targetuser" in
2866         '')  targetuser=root
2867              echo "Guessing targetuser $targetuser." >&4
2868              ;;
2869         esac
2870         case "$targetfrom" in
2871         scp)    q=-q ;;
2872         *)      q='' ;;
2873         esac
2874         case "$targetrun" in
2875         ssh|rsh)
2876             cat >$run <<EOF
2877 #!/bin/sh
2878 case "\$1" in
2879 -cwd)
2880   shift
2881   cwd=\$1
2882   shift
2883   ;;
2884 esac
2885 case "\$cwd" in
2886 '') cwd=$targetdir ;;
2887 esac
2888 exe=\$1
2889 shift
2890 if $test ! -f \$exe.xok; then
2891   $to \$exe
2892   $touch \$exe.xok
2893 fi
2894 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2895 EOF
2896             ;;
2897         *)  echo "Unknown targetrun '$targetrun'" >&4
2898             exit 1
2899             ;;
2900         esac
2901         case "$targetmkdir" in
2902         */Cross/mkdir)
2903             cat >$targetmkdir <<EOF
2904 #!/bin/sh
2905 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2906 EOF
2907             $chmod a+rx $targetmkdir
2908             ;;
2909         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2910             exit 1
2911             ;;
2912         esac
2913         case "$targetto" in
2914         scp|rcp)
2915             cat >$to <<EOF
2916 #!/bin/sh
2917 for f in \$@
2918 do
2919   case "\$f" in
2920   /*)
2921     $targetmkdir \`dirname \$f\`
2922     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2923     ;;
2924   *)
2925     $targetmkdir $targetdir/\`dirname \$f\`
2926     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2927     ;;
2928   esac
2929 done
2930 exit 0
2931 EOF
2932             ;;
2933         cp) cat >$to <<EOF
2934 #!/bin/sh
2935 for f in \$@
2936 do
2937   case "\$f" in
2938   /*)
2939     $mkdir -p $targetdir/\`dirname \$f\`
2940     $cp \$f $targetdir/\$f || exit 1
2941     ;;
2942   *)
2943     $targetmkdir $targetdir/\`dirname \$f\`
2944     $cp \$f $targetdir/\$f || exit 1
2945     ;;
2946   esac
2947 done
2948 exit 0
2949 EOF
2950             ;;
2951         *)  echo "Unknown targetto '$targetto'" >&4
2952             exit 1
2953             ;;
2954         esac
2955         case "$targetfrom" in
2956         scp|rcp)
2957           cat >$from <<EOF
2958 #!/bin/sh
2959 for f in \$@
2960 do
2961   $rm -f \$f
2962   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2963 done
2964 exit 0
2965 EOF
2966             ;;
2967         cp) cat >$from <<EOF
2968 #!/bin/sh
2969 for f in \$@
2970 do
2971   $rm -f \$f
2972   cp $targetdir/\$f . || exit 1
2973 done
2974 exit 0
2975 EOF
2976             ;;
2977         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2978             exit 1
2979             ;;
2980         esac
2981         if $test ! -f $run; then
2982             echo "Target 'run' script '$run' not found." >&4
2983         else
2984             $chmod a+rx $run
2985         fi
2986         if $test ! -f $to; then
2987             echo "Target 'to' script '$to' not found." >&4
2988         else
2989             $chmod a+rx $to
2990         fi
2991         if $test ! -f $from; then
2992             echo "Target 'from' script '$from' not found." >&4
2993         else
2994             $chmod a+rx $from
2995         fi
2996         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2997             exit 1
2998         fi
2999         cat >&4 <<EOF
3000 Using '$run' for remote execution,
3001 and '$from' and '$to'
3002 for remote file transfer.
3003 EOF
3004         ;;
3005 *)      run=''
3006         to=:
3007         from=:
3008         usecrosscompile='undef'
3009         targetarch=''
3010         ;;
3011 esac
3012
3013 : see whether [:lower:] and [:upper:] are supported character classes
3014 echo " "
3015 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3016 ABYZ)
3017         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3018         up='[:upper:]'
3019         low='[:lower:]'
3020         ;;
3021 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3022         # (0xd9 and 0xe2), therefore that is a nice testing point.
3023         if test "X$up" = X -o "X$low" = X; then
3024             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3025             rs) up='[A-Z]'
3026                 low='[a-z]'
3027                 ;;
3028             esac
3029         fi
3030         if test "X$up" = X -o "X$low" = X; then
3031             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3032             rs) up='A-Z'
3033                 low='a-z'
3034                 ;;
3035             esac
3036         fi
3037         if test "X$up" = X -o "X$low" = X; then
3038             case "`echo RS | od -x 2>/dev/null`" in
3039             *D9E2*|*d9e2*)
3040                 echo "Hey, this might be EBCDIC." >&4
3041                 if test "X$up" = X -o "X$low" = X; then
3042                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3043                     rs) up='[A-IJ-RS-Z]'
3044                         low='[a-ij-rs-z]'
3045                         ;;
3046                     esac
3047                 fi
3048                 if test "X$up" = X -o "X$low" = X; then
3049                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3050                     rs) up='A-IJ-RS-Z'
3051                         low='a-ij-rs-z'
3052                         ;;
3053                     esac
3054                 fi
3055                 ;;
3056             esac
3057         fi
3058 esac
3059 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3060 rs)
3061     echo "Using $up and $low to convert case." >&4
3062     ;;
3063 *)
3064     echo "I don't know how to translate letters from upper to lower case." >&4
3065     echo "Your tr is not acting any way I know of." >&4
3066     exit 1
3067     ;;
3068 esac
3069 : set up the translation script tr, must be called with ./tr of course
3070 cat >tr <<EOSC
3071 $startsh
3072 case "\$1\$2" in
3073 '[A-Z][a-z]') exec $tr '$up' '$low';;
3074 '[a-z][A-Z]') exec $tr '$low' '$up';;
3075 esac
3076 exec $tr "\$@"
3077 EOSC
3078 chmod +x tr
3079 $eunicefix tr
3080
3081 : Try to determine whether config.sh was made on this system
3082 case "$config_sh" in
3083 '')
3084 myuname=`$uname -a 2>/dev/null`
3085 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3086 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3087 # because the A-Z/a-z are not consecutive.
3088 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3089         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3090 newmyuname="$myuname"
3091 dflt=n
3092 case "$knowitall" in
3093 '')
3094         if test -f ../config.sh; then
3095                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3096                         eval "`grep myuname= ../config.sh`"
3097                 fi
3098                 if test "X$myuname" = "X$newmyuname"; then
3099                         dflt=y
3100                 fi
3101         fi
3102         ;;
3103 *) dflt=y;;
3104 esac
3105
3106 : Get old answers from old config file if Configure was run on the
3107 : same system, otherwise use the hints.
3108 hint=default
3109 cd ..
3110 if test -f config.sh; then
3111         echo " "
3112         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3113         . UU/myread
3114         case "$ans" in
3115         n*|N*) echo "OK, I'll ignore it."
3116                 mv config.sh config.sh.old
3117                 myuname="$newmyuname"
3118                 ;;
3119         *)  echo "Fetching default answers from your old config.sh file..." >&4
3120                 tmp_n="$n"
3121                 tmp_c="$c"
3122                 tmp_sh="$sh"
3123                 . ./config.sh
3124                 cp config.sh UU
3125                 n="$tmp_n"
3126                 c="$tmp_c"
3127                 : Older versions did not always set $sh.  Catch re-use of such
3128                 : an old config.sh.
3129                 case "$sh" in
3130                 '') sh="$tmp_sh" ;;
3131                 esac
3132                 hint=previous
3133                 ;;
3134         esac
3135 fi
3136 . ./UU/checkcc
3137 if test ! -f config.sh; then
3138         $cat <<EOM
3139
3140 First time through, eh?  I have some defaults handy for some systems
3141 that need some extra help getting the Configure answers right:
3142
3143 EOM
3144         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3145         dflt=''
3146         : Half the following guesses are probably wrong... If you have better
3147         : tests or hints, please send them to perlbug@perl.org
3148         : The metaconfig authors would also appreciate a copy...
3149         $test -f /irix && osname=irix
3150         $test -f /xenix && osname=sco_xenix
3151         $test -f /dynix && osname=dynix
3152         $test -f /dnix && osname=dnix
3153         $test -f /lynx.os && osname=lynxos
3154         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3155         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3156         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3157         $test -f /bin/mips && /bin/mips && osname=mips
3158         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3159                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3160         $test -d /usr/apollo/bin && osname=apollo
3161         $test -f /etc/saf/_sactab && osname=svr4
3162         $test -d /usr/include/minix && osname=minix
3163         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3164         if $test -d /MachTen -o -d /MachTen_Folder; then
3165                 osname=machten
3166                 if $test -x /sbin/version; then
3167                         osvers=`/sbin/version | $awk '{print $2}' |
3168                         $sed -e 's/[A-Za-z]$//'`
3169                 elif $test -x /usr/etc/version; then
3170                         osvers=`/usr/etc/version | $awk '{print $2}' |
3171                         $sed -e 's/[A-Za-z]$//'`
3172                 else
3173                         osvers="$2.$3"
3174                 fi
3175         fi
3176
3177         $test -f /sys/posix.dll &&
3178                 $test -f /usr/bin/what &&
3179                 set X `/usr/bin/what /sys/posix.dll` &&
3180                 $test "$3" = UWIN &&
3181                 osname=uwin &&
3182                 osvers="$5"
3183
3184         if $test -f $uname; then
3185                 set X $myuname
3186                 shift
3187
3188                 case "$5" in
3189                 fps*) osname=fps ;;
3190                 mips*)
3191                         case "$4" in
3192                         umips) osname=umips ;;
3193                         *) osname=mips ;;
3194                         esac;;
3195                 [23]100) osname=mips ;;
3196                 next*) osname=next ;;
3197                 i386*)
3198                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3199                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3200                                 osname='sco'
3201                                 osvers=$tmp
3202                         elif $test -f /etc/kconfig; then
3203                                 osname=isc
3204                                 if test "$lns" = "$ln -s"; then
3205                                         osvers=4
3206                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3207                                         osvers=3
3208                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3209                                         osvers=2
3210                                 fi
3211                         fi
3212                         tmp=''
3213                         ;;
3214                 pc*)
3215                         if test -n "$DJGPP"; then
3216                                 osname=dos
3217                                 osvers=djgpp
3218                         fi
3219                         ;;
3220                 esac
3221
3222                 case "$1" in
3223                 aix) osname=aix
3224                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3225                         case "$tmp" in
3226                         # oslevel can fail with:
3227                         # oslevel: Unable to acquire lock.
3228                         *not\ found) osvers="$4"."$3" ;;
3229                         '<3240'|'<>3240') osvers=3.2.0 ;;
3230                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3231                         '=3250'|'>3250') osvers=3.2.5 ;;
3232                         *) osvers=$tmp;;
3233                         esac
3234                         ;;
3235                 bsd386) osname=bsd386
3236                         osvers=`$uname -r`
3237                         ;;
3238                 cygwin*) osname=cygwin
3239                         osvers="$3"
3240                         ;;
3241                 *dc.osx) osname=dcosx
3242                         osvers="$3"
3243                         ;;
3244                 dnix) osname=dnix
3245                         osvers="$3"
3246                         ;;
3247                 domainos) osname=apollo
3248                         osvers="$3"
3249                         ;;
3250                 dgux)   osname=dgux
3251                         osvers="$3"
3252                         ;;
3253                 dragonfly) osname=dragonfly
3254                         osvers="$3"
3255                         ;;
3256                 dynixptx*) osname=dynixptx
3257                         osvers=`echo "$4"|sed 's/^v//'`
3258                         ;;
3259                 freebsd) osname=freebsd
3260                         osvers="$3" ;;
3261                 genix)  osname=genix ;;
3262                 gnu)    osname=gnu
3263                         osvers="$3" ;;
3264                 hp*)    osname=hpux
3265                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3266                         ;;
3267                 irix*)  osname=irix
3268                         case "$3" in
3269                         4*) osvers=4 ;;
3270                         5*) osvers=5 ;;
3271                         *)      osvers="$3" ;;
3272                         esac
3273                         ;;
3274                 linux)  osname=linux
3275                         case "$3" in
3276                         *)      osvers="$3" ;;
3277                         esac
3278                         ;;
3279                 MiNT)   osname=mint
3280                         ;;
3281                 netbsd*) osname=netbsd
3282                         osvers="$3"
3283                         ;;
3284                 news-os) osvers="$3"
3285                         case "$3" in
3286                         4*) osname=newsos4 ;;
3287                         *) osname=newsos ;;
3288                         esac
3289                         ;;
3290                 next*) osname=next ;;
3291                 nonstop-ux) osname=nonstopux ;;
3292                 openbsd) osname=openbsd
3293                         osvers="$3"
3294                         ;;
3295                 os2)    osname=os2
3296                         osvers="$4"
3297                         ;;
3298                 POSIX-BC | posix-bc ) osname=posix-bc
3299                         osvers="$3"
3300                         ;;
3301                 powerux | power_ux | powermax_os | powermaxos | \
3302                 powerunix | power_unix) osname=powerux
3303                         osvers="$3"
3304                         ;;
3305                 qnx) osname=qnx
3306                         osvers="$4"
3307                         ;;
3308                 solaris) osname=solaris
3309                         case "$3" in
3310                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3311                         *)      osvers="$3" ;;
3312                         esac
3313                         ;;
3314                 sunos) osname=sunos
3315                         case "$3" in
3316                         5*) osname=solaris
3317                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3318                         *)      osvers="$3" ;;
3319                         esac
3320                         ;;
3321                 titanos) osname=titanos
3322                         case "$3" in
3323                         1*) osvers=1 ;;
3324                         2*) osvers=2 ;;
3325                         3*) osvers=3 ;;
3326                         4*) osvers=4 ;;
3327                         *)      osvers="$3" ;;
3328                         esac
3329                         ;;
3330                 ultrix) osname=ultrix
3331                         osvers="$3"
3332                         ;;
3333                 osf1|mls+)      case "$5" in
3334                                 alpha)
3335                                         osname=dec_osf
3336                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3337                                         case "$osvers" in
3338                                         [1-9].[0-9]*) ;;
3339                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3340                                         esac
3341                                         ;;
3342                         hp*)    osname=hp_osf1  ;;
3343                         mips)   osname=mips_osf1 ;;
3344                         esac
3345                         ;;
3346                 # UnixWare 7.1.2 is known as Open UNIX 8
3347                 openunix|unixware) osname=svr5
3348                         osvers="$4"
3349                         ;;
3350                 uts)    osname=uts
3351                         osvers="$3"
3352                         ;;
3353                 vos) osvers="$3"
3354                         ;;
3355                 $2) case "$osname" in
3356                         *isc*) ;;
3357                         *freebsd*) ;;
3358                         svr*)
3359                                 : svr4.x or possibly later
3360                                 case "svr$3" in
3361                                 ${osname}*)
3362                                         osname=svr$3
3363                                         osvers=$4
3364                                         ;;
3365                                 esac
3366                                 case "$osname" in
3367                                 svr4.0)
3368                                         : Check for ESIX
3369                                         if test -f /stand/boot ; then
3370                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3371                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3372                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3373                                                         if test -n "$isesix"; then
3374                                                                 osname=esix4
3375                                                         fi
3376                                                 fi
3377                                         fi
3378                                         ;;
3379                                 esac
3380                                 ;;
3381                         *)      if test -f /etc/systemid; then
3382                                         osname=sco
3383                                         set `echo $3 | $sed 's/\./ /g'` $4
3384                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3385                                                 osvers=$1.$2.$3
3386                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3387                                                 osvers=$1.$2
3388                                         elif $test -f $src/hints/sco_$1.sh; then
3389                                                 osvers=$1
3390                                         fi
3391                                 else
3392                                         case "$osname" in
3393                                         '') : Still unknown.  Probably a generic Sys V.
3394                                                 osname="sysv"
3395                                                 osvers="$3"
3396                                                 ;;
3397                                         esac
3398                                 fi
3399                                 ;;
3400                         esac
3401                         ;;
3402                 *)      case "$osname" in
3403                         '') : Still unknown.  Probably a generic BSD.
3404                                 osname="$1"
3405                                 osvers="$3"
3406                                 ;;
3407                         esac
3408                         ;;
3409                 esac
3410         else
3411                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3412                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3413                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3414                                 osname=news_os
3415                         fi
3416                         $rm -f UU/kernel.what
3417                 elif test -d c:/. -o -n "$is_os2" ; then
3418                         set X $myuname
3419                         osname=os2
3420                         osvers="$5"
3421                 fi
3422         fi
3423
3424         case "$targetarch" in
3425         '') ;;
3426         *)  hostarch=$osname
3427             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3428             osvers=''
3429             ;;
3430         esac
3431
3432         : Now look for a hint file osname_osvers, unless one has been
3433         : specified already.
3434         case "$hintfile" in
3435         ''|' ')
3436                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3437                 : Also try without trailing minor version numbers.
3438                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3439                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3440                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3441                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3442                 case "$file" in
3443                 '') dflt=none ;;
3444                 *)  case "$osvers" in
3445                         '') dflt=$file
3446                                 ;;
3447                         *)  if $test -f $src/hints/$file.sh ; then
3448                                         dflt=$file
3449                                 elif $test -f $src/hints/$xfile.sh ; then
3450                                         dflt=$xfile
3451                                 elif $test -f $src/hints/$xxfile.sh ; then
3452                                         dflt=$xxfile
3453                                 elif $test -f $src/hints/$xxxfile.sh ; then
3454                                         dflt=$xxxfile
3455                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3456                                         dflt=$xxxxfile
3457                                 elif $test -f "$src/hints/${osname}.sh" ; then
3458                                         dflt="${osname}"
3459                                 else
3460                                         dflt=none
3461                                 fi
3462                                 ;;
3463                         esac
3464                         ;;
3465                 esac
3466                 if $test -f Policy.sh ; then
3467                         case "$dflt" in
3468                         *Policy*) ;;
3469                         none) dflt="Policy" ;;
3470                         *) dflt="Policy $dflt" ;;
3471                         esac
3472                 fi
3473                 ;;
3474         *)
3475                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3476                 ;;
3477         esac
3478
3479         if $test -f Policy.sh ; then
3480                 $cat <<EOM
3481
3482 There's also a Policy hint file available, which should make the
3483 site-specific (policy) questions easier to answer.
3484 EOM
3485
3486         fi
3487
3488         $cat <<EOM
3489
3490 You may give one or more space-separated answers, or "none" if appropriate.
3491 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3492 previous run of Configure, you may specify it as well as or instead of
3493 OS-specific hints.  If hints are provided for your OS, you should use them:
3494 although Perl can probably be built without hints on many platforms, using
3495 hints often improve performance and may enable features that Configure can't
3496 set up on its own. If there are no hints that match your OS, specify "none";
3497 DO NOT give a wrong version or a wrong OS.
3498
3499 EOM
3500
3501         rp="Which of these apply, if any?"
3502         . UU/myread
3503         tans=$ans
3504         for file in $tans; do
3505                 if $test X$file = XPolicy -a -f Policy.sh; then
3506                         . Policy.sh
3507                         $cat Policy.sh >> UU/config.sh
3508                 elif $test -f $src/hints/$file.sh; then
3509                         . $src/hints/$file.sh
3510                         $cat $src/hints/$file.sh >> UU/config.sh
3511                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3512                         : nothing
3513                 else
3514                         : Give one chance to correct a possible typo.
3515                         echo "$file.sh does not exist"
3516                         dflt=$file
3517                         rp="hint to use instead?"
3518                         . UU/myread
3519                         for file in $ans; do
3520                                 if $test -f "$src/hints/$file.sh"; then
3521                                         . $src/hints/$file.sh
3522                                         $cat $src/hints/$file.sh >> UU/config.sh
3523                                 elif $test X$ans = X -o X$ans = Xnone ; then
3524                                         : nothing
3525                                 else
3526                                         echo "$file.sh does not exist -- ignored."
3527                                 fi
3528                         done
3529                 fi
3530         done
3531
3532         hint=recommended
3533         : Remember our hint file for later.
3534         if $test -f "$src/hints/$file.sh" ; then
3535                 hintfile="$file"
3536         else
3537                 hintfile=''
3538         fi
3539 fi
3540 cd UU
3541 ;;
3542 *)
3543         echo " "
3544         echo "Fetching default answers from $config_sh..." >&4
3545         tmp_n="$n"
3546         tmp_c="$c"
3547         cd ..
3548         cp $config_sh config.sh 2>/dev/null
3549         chmod +w config.sh
3550         . ./config.sh
3551         cd UU
3552         cp ../config.sh .
3553         n="$tmp_n"
3554         c="$tmp_c"
3555         hint=previous
3556         ;;
3557 esac
3558 test "$override" && . ./optdef.sh
3559
3560 : Restore computed paths
3561 for file in $loclist $trylist; do
3562         eval $file="\$_$file"
3563 done
3564
3565 cat << EOM
3566
3567 Configure uses the operating system name and version to set some defaults.
3568 The default value is probably right if the name rings a bell. Otherwise,
3569 since spelling matters for me, either accept the default or answer "none"
3570 to leave it blank.
3571
3572 EOM
3573 case "$osname" in
3574         ''|' ')
3575                 case "$hintfile" in
3576                 ''|' '|none) dflt=none ;;
3577                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3578                 esac
3579                 ;;
3580         *) dflt="$osname" ;;
3581 esac
3582 rp="Operating system name?"
3583 . ./myread
3584 case "$ans" in
3585 none)  osname='' ;;
3586 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3587 esac
3588 echo " "
3589 case "$osvers" in
3590         ''|' ')
3591                 case "$hintfile" in
3592                 ''|' '|none) dflt=none ;;
3593                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3594                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3595                         case "$dflt" in
3596                         ''|' ') dflt=none ;;
3597                         esac
3598                         ;;
3599                 esac
3600                 ;;
3601         *) dflt="$osvers" ;;
3602 esac
3603 rp="Operating system version?"
3604 . ./myread
3605 case "$ans" in
3606 none)  osvers='' ;;
3607 *) osvers="$ans" ;;
3608 esac
3609
3610
3611 . ./posthint.sh
3612
3613 : who configured the system
3614 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3615 case "$cf_by" in
3616 "")
3617         cf_by=`(logname) 2>/dev/null`
3618         case "$cf_by" in
3619         "")
3620                 cf_by=`(whoami) 2>/dev/null`
3621                 case "$cf_by" in
3622                 "") cf_by=unknown ;;
3623                 esac ;;
3624         esac ;;
3625 esac
3626
3627 : decide how portable to be.  Allow command line overrides.
3628 case "$d_portable" in
3629 "$undef") ;;
3630 *)      d_portable="$define" ;;
3631 esac
3632
3633 : set up shell script to do ~ expansion
3634 cat >filexp <<EOSS
3635 $startsh
3636 : expand filename
3637 case "\$1" in
3638  \~/*|\~)
3639         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3640         ;;
3641  \~*)
3642         if $test -f /bin/csh; then
3643                 /bin/csh -f -c "glob \$1"
3644                 failed=\$?
3645                 echo ""
3646                 exit \$failed
3647         else
3648                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3649                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3650                 if $test ! -d "\$dir"; then
3651                         me=\`basename \$0\`
3652                         echo "\$me: can't locate home directory for: \$name" >&2
3653                         exit 1
3654                 fi
3655                 case "\$1" in
3656                 */*)
3657                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3658                         ;;
3659                 *)
3660                         echo \$dir
3661                         ;;
3662                 esac
3663         fi
3664         ;;
3665 *)
3666         echo \$1
3667         ;;
3668 esac
3669 EOSS
3670 chmod +x filexp
3671 $eunicefix filexp
3672
3673 : now set up to get a file name
3674 cat <<EOS >getfile
3675 $startsh
3676 EOS
3677 cat <<'EOSC' >>getfile
3678 tilde=''
3679 fullpath=''
3680 already=''
3681 skip=''
3682 none_ok=''
3683 exp_file=''
3684 nopath_ok=''
3685 orig_rp="$rp"
3686 orig_dflt="$dflt"
3687 case "$gfpth" in
3688 '') gfpth='.' ;;
3689 esac
3690
3691 case "$fn" in
3692 *\(*)
3693         : getfile will accept an answer from the comma-separated list
3694         : enclosed in parentheses even if it does not meet other criteria.
3695         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3696         fn=`echo $fn | sed 's/(.*)//'`
3697         ;;
3698 esac
3699
3700 case "$fn" in
3701 *:*)
3702         loc_file=`expr $fn : '.*:\(.*\)'`
3703         fn=`expr $fn : '\(.*\):.*'`
3704         ;;
3705 esac
3706
3707 case "$fn" in
3708 *~*) tilde=true;;
3709 esac
3710 case "$fn" in
3711 */*) fullpath=true;;
3712 esac
3713 case "$fn" in
3714 *+*) skip=true;;
3715 esac
3716 case "$fn" in
3717 *n*) none_ok=true;;
3718 esac
3719 case "$fn" in
3720 *e*) exp_file=true;;
3721 esac
3722 case "$fn" in
3723 *p*) nopath_ok=true;;
3724 esac
3725
3726 case "$fn" in
3727 *f*) type='File';;
3728 *d*) type='Directory';;
3729 *l*) type='Locate';;
3730 esac
3731
3732 what="$type"
3733 case "$what" in
3734 Locate) what='File';;
3735 esac
3736
3737 case "$exp_file" in
3738 '')
3739         case "$d_portable" in
3740         "$define") ;;
3741         *) exp_file=true;;
3742         esac
3743         ;;
3744 esac
3745
3746 cd ..
3747 while test "$type"; do
3748         redo=''
3749         rp="$orig_rp"
3750         dflt="$orig_dflt"
3751         case "$tilde" in
3752         true) rp="$rp (~name ok)";;
3753         esac
3754         . UU/myread
3755         if test -f UU/getfile.ok && \
3756                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3757         then
3758                 value="$ans"
3759                 ansexp="$ans"
3760                 break
3761         fi
3762         case "$ans" in
3763         none)
3764                 value=''
3765                 ansexp=''
3766                 case "$none_ok" in
3767                 true) type='';;
3768                 esac
3769                 ;;
3770         *)
3771                 case "$tilde" in
3772                 '') value="$ans"
3773                         ansexp="$ans";;
3774                 *)
3775                         value=`UU/filexp $ans`
3776                         case $? in
3777                         0)
3778                                 if test "$ans" != "$value"; then
3779                                         echo "(That expands to $value on this system.)"
3780                                 fi
3781                                 ;;
3782                         *) value="$ans";;
3783                         esac
3784                         ansexp="$value"
3785                         case "$exp_file" in
3786                         '') value="$ans";;
3787                         esac
3788                         ;;
3789                 esac
3790                 case "$fullpath" in
3791                 true)
3792                         case "$ansexp" in
3793                         /*) value="$ansexp" ;;
3794                         [a-zA-Z]:/*) value="$ansexp" ;;
3795                         *)
3796                                 redo=true
3797                                 case "$already" in
3798                                 true)
3799                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3800                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3801                                         ;;
3802                                 *)
3803                                 echo "Please give a full path name, starting with slash." >&4
3804                                         case "$tilde" in
3805                                         true)
3806                                 echo "Note that using ~name is ok provided it expands well." >&4
3807                                                 already=true
3808                                                 ;;
3809                                         esac
3810                                 esac
3811                                 ;;
3812                         esac
3813                         ;;
3814                 esac
3815                 case "$redo" in
3816                 '')
3817                         case "$type" in
3818                         File)
3819                                 for fp in $gfpth; do
3820                                         if test "X$fp" = X.; then
3821                                             pf="$ansexp"
3822                                         else    
3823                                             pf="$fp/$ansexp"
3824                                         fi
3825                                         if test -f "$pf"; then
3826                                                 type=''
3827                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3828                                         then
3829                                                 echo "($value is not a plain file, but that's ok.)"
3830                                                 type=''
3831                                         fi
3832                                         if test X"$type" = X; then
3833                                             value="$pf"
3834                                             break
3835                                         fi
3836                                 done
3837                                 ;;
3838                         Directory)
3839                                 for fp in $gfpth; do
3840                                         if test "X$fp" = X.; then
3841                                             dir="$ans"
3842                                             direxp="$ansexp"
3843                                         else    
3844                                             dir="$fp/$ansexp"
3845                                             direxp="$fp/$ansexp"
3846                                         fi
3847                                         if test -d "$direxp"; then
3848                                                 type=''
3849                                                 value="$dir"
3850                                                 break
3851                                         fi
3852                                 done
3853                                 ;;
3854                         Locate)
3855                                 if test -d "$ansexp"; then
3856                                         echo "(Looking for $loc_file in directory $value.)"
3857                                         value="$value/$loc_file"
3858                                         ansexp="$ansexp/$loc_file"
3859                                 fi
3860                                 if test -f "$ansexp"; then
3861                                         type=''
3862                                 fi
3863                                 case "$nopath_ok" in
3864                                 true)   case "$value" in
3865                                         */*) ;;
3866                                         *)      echo "Assuming $value will be in people's path."
3867                                                 type=''
3868                                                 ;;
3869                                         esac
3870                                         ;;
3871                                 esac
3872                                 ;;
3873                         esac
3874
3875                         case "$skip" in
3876                         true) type='';
3877                         esac
3878
3879                         case "$type" in
3880                         '') ;;
3881                         *)
3882                                 if test "$fastread" = yes; then
3883                                         dflt=y
3884                                 else
3885                                         dflt=n
3886                                 fi
3887                                 rp="$what $value doesn't exist.  Use that name anyway?"
3888                                 . UU/myread
3889                                 dflt=''
3890                                 case "$ans" in
3891                                 y*) type='';;
3892                                 *) echo " ";;
3893                                 esac
3894                                 ;;
3895                         esac
3896                         ;;
3897                 esac
3898                 ;;
3899         esac
3900 done
3901 cd UU
3902 ans="$value"
3903 rp="$orig_rp"
3904 dflt="$orig_dflt"
3905 rm -f getfile.ok
3906 test "X$gfpthkeep" != Xy && gfpth=""
3907 EOSC
3908
3909 : determine root of directory hierarchy where package will be installed.
3910 case "$prefix" in
3911 '')
3912         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3913         ;;
3914 *?/)
3915         dflt=`echo "$prefix" | sed 's/.$//'`
3916         ;;
3917 *)
3918         dflt="$prefix"
3919         ;;
3920 esac
3921 $cat <<EOM
3922
3923 By default, $package will be installed in $dflt/bin, manual pages
3924 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3925 installation directories. Typically this is something like /usr/local.
3926 If you wish to have binaries under /usr/bin but other parts of the
3927 installation under /usr/local, that's ok: you will be prompted
3928 separately for each of the installation directories, the prefix being
3929 only used to set the defaults.
3930
3931 EOM
3932 fn=d~
3933 rp='Installation prefix to use?'
3934 . ./getfile
3935 oldprefix=''
3936 case "$prefix" in
3937 '') ;;
3938 *)
3939         case "$ans" in
3940         "$prefix") ;;
3941         *) oldprefix="$prefix";;
3942         esac
3943         ;;
3944 esac
3945 prefix="$ans"
3946 prefixexp="$ansexp"
3947
3948 : allow them to override the AFS root
3949 case "$afsroot" in
3950 '')     afsroot=/afs ;;
3951 *)      afsroot=$afsroot ;;
3952 esac
3953
3954 : is AFS running?
3955 echo " "
3956 case "$afs" in
3957 $define|true)   afs=true ;;
3958 $undef|false)   afs=false ;;
3959 *)      if $test -d $afsroot; then
3960                 afs=true
3961         else
3962                 afs=false
3963         fi
3964         ;;
3965 esac
3966 if $afs; then
3967         echo "AFS may be running... I'll be extra cautious then..." >&4
3968 else
3969         echo "AFS does not seem to be running..." >&4
3970 fi
3971
3972 : determine installation prefix for where package is to be installed.
3973 if $afs; then 
3974 $cat <<EOM
3975
3976 Since you are running AFS, I need to distinguish the directory in which
3977 files will reside from the directory in which they are installed (and from
3978 which they are presumably copied to the former directory by occult means).
3979
3980 EOM
3981         case "$installprefix" in
3982         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3983         *) dflt="$installprefix";;
3984         esac
3985 else
3986 $cat <<EOM
3987
3988 In some special cases, particularly when building $package for distribution,
3989 it is convenient to distinguish the directory in which files should be
3990 installed from the directory ($prefix) in which they will
3991 eventually reside.  For most users, these two directories are the same.
3992
3993 EOM
3994         case "$installprefix" in
3995         '') dflt=$prefix ;;
3996         *) dflt=$installprefix;;
3997         esac
3998 fi
3999 fn=d~
4000 rp='What installation prefix should I use for installing files?'
4001 . ./getfile
4002 installprefix="$ans"
4003 installprefixexp="$ansexp"
4004
4005 : Perform the prefixexp/installprefixexp correction if necessary
4006 cat <<EOS >installprefix
4007 $startsh
4008 EOS
4009 cat <<'EOSC' >>installprefix
4010 : Change installation prefix, if necessary.
4011 if $test X"$prefix" != X"$installprefix"; then
4012     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4013 else
4014     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4015 fi
4016 EOSC
4017 chmod +x installprefix
4018 $eunicefix installprefix
4019
4020 : Set variables such as privlib and privlibexp from the output of ./getfile
4021 : performing the prefixexp/installprefixexp correction if necessary.
4022 cat <<EOS >setprefixvar
4023 $startsh
4024 EOS
4025 cat <<'EOSC' >>setprefixvar
4026 eval "${prefixvar}=\"\$ans\""
4027 eval "${prefixvar}exp=\"\$ansexp\""
4028 . ./installprefix
4029 EOSC
4030 chmod +x setprefixvar
4031 $eunicefix setprefixvar
4032
4033 : set up the script used to warn in case of inconsistency
4034 cat <<EOS >whoa
4035 $startsh
4036 EOS
4037 cat <<'EOSC' >>whoa
4038 dflt=y
4039 case "$hint" in
4040     recommended)
4041         case "$hintfile" in
4042         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4043                 ;;
4044         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4045                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4046                 ;;
4047         esac
4048         ;;
4049     *)  echo " "
4050         echo "*** WHOA THERE!!! ***" >&4
4051         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4052         ;;
4053 esac
4054 rp="    Keep the $hint value?"
4055 . ./myread
4056 case "$ans" in
4057 y) td=$was; tu=$was;;
4058 esac
4059 EOSC
4060
4061 : function used to set '$1' to '$val'
4062 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4063 case "$val$was" in
4064 $define$undef) . ./whoa; eval "$var=\$td";;
4065 $undef$define) . ./whoa; eval "$var=\$tu";;
4066 *) eval "$var=$val";;
4067 esac'
4068
4069 : Check is we will use socks
4070 case "$usesocks" in
4071 $define|true|[yY]*)     dflt='y';;
4072 *) dflt='n';;
4073 esac
4074 cat <<EOM
4075
4076 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4077 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4078 to use the PerlIO abstraction layer, this will be implicitly selected.
4079
4080 If this doesn't make any sense to you, just accept the default '$dflt'.
4081 EOM
4082 rp='Build Perl for SOCKS?'
4083 . ./myread
4084 case "$ans" in
4085 y|Y)    val="$define" ;;
4086 *)      val="$undef" ;;
4087 esac
4088 set usesocks
4089 eval $setvar
4090
4091 case "$usesocks" in
4092 $define|true|[yY]*) useperlio="$define";;
4093 esac
4094
4095 : Check if we want perlio
4096 case "$useperlio" in
4097 $define|true|[yY]*|'')  dflt='y';;
4098 *) dflt='n';;
4099 esac
4100 cat <<EOM
4101
4102 Previous version of $package used the standard IO mechanisms as
4103 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4104 alternate IO mechanisms via the PerlIO abstraction layer, but the
4105 stdio mechanism is still available if needed.  The abstraction layer
4106 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4107 Using PerlIO with sfio may cause problems with some extension modules.
4108
4109 If this doesn't make any sense to you, just accept the default '$dflt'.
4110 EOM
4111 rp='Use the PerlIO abstraction layer?'
4112 . ./myread
4113 case "$ans" in
4114 y|Y)
4115         val="$define"
4116         ;;
4117 *)
4118         echo "Ok, doing things the stdio way."
4119         val="$undef"
4120         ;;
4121 esac
4122 set useperlio
4123 eval $setvar
4124
4125 case "$usesocks" in
4126 $define|true|[yY]*)
4127         case "$useperlio" in
4128         $define|true|[yY]*) ;;
4129         *)      cat >&4 <<EOM
4130
4131 You are using the SOCKS proxy protocol library which means that you
4132 should also use the PerlIO layer.  You may be headed for trouble.
4133
4134 EOM
4135                 ;;
4136         esac
4137         ;;
4138 esac
4139
4140 : get the patchlevel
4141 echo " "
4142 echo "Getting the current patchlevel..." >&4
4143 if $test -r $rsrc/patchlevel.h;then
4144         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4145         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4146         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4147         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4148         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4149         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4150         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4151 else
4152         revision=0
4153         patchlevel=0
4154         subversion=0
4155         api_revision=0
4156         api_version=0
4157         api_subversion=0
4158         perl_patchlevel=0
4159         $echo "(You do not have patchlevel.h.  Eek.)"
4160 fi
4161 if $test -r $rsrc/.patch ; then
4162         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4163                 perl_patchlevel=`cat $rsrc/.patch`
4164         fi
4165 fi
4166 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4167 version_patchlevel_string="version $patchlevel subversion $subversion"
4168 case "$perl_patchlevel" in
4169 0|'') ;;
4170 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4171     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4172     ;;
4173 esac
4174
4175 $echo "(You have $package $version_patchlevel_string.)"
4176
4177 case "$osname" in
4178 dos|vms)
4179         : XXX Should be a Configure test for double-dots in filenames.
4180         version=`echo $revision $patchlevel $subversion | \
4181                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4182         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4183                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4184         ;;
4185 *)
4186         version=`echo $revision $patchlevel $subversion | \
4187                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4188         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4189                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4190         ;;
4191 esac
4192 : Special case the 5.005_xx maintenance series, which used 5.005
4193 : without any subversion label as a subdirectory in $sitelib
4194 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4195         api_versionstring='5.005'
4196 fi
4197
4198 : Do we want threads support and if so, what type
4199 case "$usethreads" in
4200 $define|true|[yY]*)     dflt='y';;
4201 *)     # Catch case where user specified ithreads or 5005threads but
4202        # forgot -Dusethreads (A.D. 4/2002)
4203        case "$useithreads$use5005threads" in
4204        *$define*)
4205                 case "$useperlio" in
4206                 "$define")      dflt='y' ;;
4207                 *)              dflt='n' ;;
4208                 esac
4209                 ;;
4210        *)       dflt='n';;
4211        esac
4212        ;;
4213 esac
4214 cat <<EOM
4215
4216 Perl can be built to take advantage of threads on some systems.
4217 To do so, Configure can be run with -Dusethreads.
4218
4219 Note that Perl built with threading support runs slightly slower
4220 and uses more memory than plain Perl. The current implementation
4221 is believed to be stable, but it is fairly new, and so should be
4222 treated with caution.
4223
4224 If this doesn't make any sense to you, just accept the default '$dflt'.
4225 EOM
4226 rp='Build a threading Perl?'
4227 . ./myread
4228 case "$ans" in
4229 y|Y)    val="$define" ;;
4230 *)      val="$undef" ;;
4231 esac
4232 set usethreads
4233 eval $setvar
4234
4235 if $test $patchlevel -lt 9; then
4236     case "$usethreads" in
4237     $define)
4238         $cat <<EOM
4239
4240 Since release 5.6, Perl has had two different threading implementations,
4241 the newer interpreter-based version (ithreads) with one interpreter per
4242 thread, and the older 5.005 version (5005threads).
4243 The 5005threads version is effectively unmaintained and will probably be
4244 removed in Perl 5.10, so there should be no need to build a Perl using it
4245 unless needed for backwards compatibility with some existing 5.005threads
4246 code.
4247
4248 EOM
4249         : Default to ithreads unless overridden on command line or with
4250         : old config.sh
4251         dflt='y'
4252         case "$use5005threads" in
4253                 $define|true|[yY]*) dflt='n';;
4254         esac
4255         case "$useithreads" in
4256                 $undef|false|[nN]*) dflt='n';;
4257         esac
4258         rp='Use the newer interpreter-based ithreads?'
4259         . ./myread
4260         case "$ans" in
4261         y|Y)    val="$define" ;;
4262         *)      val="$undef" ;;
4263         esac
4264         set useithreads
4265         eval $setvar
4266         : Now set use5005threads to the opposite value.
4267         case "$useithreads" in
4268         $define) val="$undef" ;;
4269         *) val="$define" ;;
4270         esac
4271         set use5005threads
4272         eval $setvar
4273         ;;
4274     *)
4275         useithreads="$undef"
4276         use5005threads="$undef"
4277         ;;
4278     esac
4279
4280     case "$useithreads$use5005threads" in
4281     "$define$define")
4282         $cat >&4 <<EOM
4283
4284 You cannot have both the ithreads and the 5.005 threads enabled
4285 at the same time.  Disabling the 5.005 threads since they are
4286 much less stable than the ithreads.
4287
4288 EOM
4289         use5005threads="$undef"
4290         ;;
4291     esac
4292
4293 else
4294 : perl-5.9.x and later
4295
4296     if test X"$usethreads" = "X$define"; then
4297         case "$use5005threads" in
4298             $define|true|[yY]*)
4299                 $cat >&4 <<EOM
4300
4301 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4302
4303 EOM
4304             ;;
4305         esac
4306     fi
4307
4308     use5005threads="$undef"
4309     useithreads="$usethreads"
4310 fi
4311
4312 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4313         cat >&4 <<EOF
4314 ***
4315 *** To build with ithreads you must also use the PerlIO layer.
4316 *** Cannot continue, aborting.
4317 ***
4318 EOF
4319         exit 1
4320 fi
4321
4322 case "$d_oldpthreads" in
4323 '')     : Configure tests would be welcome here.  For now, assume undef.
4324         val="$undef" ;;
4325 *)      val="$d_oldpthreads" ;;
4326 esac
4327 set d_oldpthreads
4328 eval $setvar
4329
4330
4331 : Look for a hint-file generated 'call-back-unit'.  If the
4332 : user has specified that a threading perl is to be built,
4333 : we may need to set or change some other defaults.
4334 if $test -f usethreads.cbu; then
4335     echo "Your platform has some specific hints regarding threaded builds, using them..."
4336     . ./usethreads.cbu
4337 else
4338     case "$usethreads" in
4339         "$define"|true|[yY]*)
4340                 $cat <<EOM
4341 (Your platform does not have any specific hints for threaded builds.
4342  Assuming POSIX threads, then.)
4343 EOM
4344         ;;
4345     esac
4346 fi
4347
4348 : Check if multiplicity is required
4349 cat <<EOM
4350
4351 Perl can be built so that multiple Perl interpreters can coexist
4352 within the same Perl executable.
4353 EOM
4354
4355 case "$useithreads" in
4356 $define)
4357         cat <<EOM
4358 This multiple interpreter support is required for interpreter-based threads.
4359 EOM
4360         val="$define"
4361         ;;
4362 *)      case "$usemultiplicity" in
4363         $define|true|[yY]*)     dflt='y';;
4364         *) dflt='n';;
4365         esac
4366         echo " "
4367         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4368         rp='Build Perl for multiplicity?'
4369         . ./myread
4370         case "$ans" in
4371         y|Y)    val="$define" ;;
4372         *)      val="$undef" ;;
4373         esac
4374         ;;
4375 esac
4376 set usemultiplicity
4377 eval $setvar
4378
4379 : Check if morebits is requested
4380 case "$usemorebits" in
4381 "$define"|true|[yY]*)
4382         use64bitint="$define"
4383         uselongdouble="$define"
4384         usemorebits="$define"
4385         ;;
4386 *)      usemorebits="$undef"
4387         ;;
4388 esac
4389
4390 : Determine the C compiler to be used
4391 echo " "
4392 case "$cc" in
4393 '') dflt=cc;;
4394 *) dflt="$cc";;
4395 esac
4396 rp="Use which C compiler?"
4397 . ./myread
4398 cc="$ans"
4399
4400 : See whether they have no cc but they do have gcc
4401 . ./trygcc
4402 if $test -f cc.cbu; then
4403     . ./cc.cbu
4404 fi
4405 . ./checkcc
4406
4407 : make some quick guesses about what we are up against
4408 echo " "
4409 $echo $n "Hmm...  $c"
4410 echo exit 1 >bsd
4411 echo exit 1 >usg
4412 echo exit 1 >v7
4413 echo exit 1 >osf1
4414 echo exit 1 >eunice
4415 echo exit 1 >xenix
4416 echo exit 1 >venix
4417 echo exit 1 >os2
4418 d_bsd="$undef"
4419 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4420 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4421 then
4422         echo "Looks kind of like an OSF/1 system, but we'll see..."
4423         echo exit 0 >osf1
4424 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4425         xxx=`./loc addbib blurfl $pth`
4426         if $test -f $xxx; then
4427         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4428                 echo exit 0 >bsd
4429                 echo exit 0 >usg
4430         else
4431                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4432                         echo "Looks kind of like an extended USG system, but we'll see..."
4433                 else
4434                         echo "Looks kind of like a USG system, but we'll see..."
4435                 fi
4436                 echo exit 0 >usg
4437         fi
4438 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4439         echo "Looks kind of like a BSD system, but we'll see..."
4440         d_bsd="$define"
4441         echo exit 0 >bsd
4442 else
4443         echo "Looks kind of like a Version 7 system, but we'll see..."
4444         echo exit 0 >v7
4445 fi
4446 case "$eunicefix" in
4447 *unixtovms*)
4448         $cat <<'EOI'
4449 There is, however, a strange, musty smell in the air that reminds me of
4450 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4451 EOI
4452         echo exit 0 >eunice
4453         d_eunice="$define"
4454 : it so happens the Eunice I know will not run shell scripts in Unix format
4455         ;;
4456 *)
4457         echo " "
4458         echo "Congratulations.  You aren't running Eunice."
4459         d_eunice="$undef"
4460         ;;
4461 esac
4462 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4463 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4464 : semicolon as a patch separator
4465 case "$p_" in
4466 :) ;;
4467 *)
4468         $cat <<'EOI'
4469 I have the feeling something is not exactly right, however...don't tell me...
4470 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4471 (Or you may be running DOS with DJGPP.)
4472 EOI
4473         echo exit 0 >os2
4474         ;;
4475 esac
4476 if test -f /xenix; then
4477         echo "Actually, this looks more like a XENIX system..."
4478         echo exit 0 >xenix
4479         d_xenix="$define"
4480 else
4481         echo " "
4482         echo "It's not Xenix..."
4483         d_xenix="$undef"
4484 fi
4485 chmod +x xenix
4486 $eunicefix xenix
4487 if test -f /venix; then
4488         echo "Actually, this looks more like a VENIX system..."
4489         echo exit 0 >venix
4490 else
4491         echo " "
4492         if ./xenix; then
4493                 : null
4494         else
4495                 echo "Nor is it Venix..."
4496         fi
4497 fi
4498 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4499 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4500 $rm -f foo
4501
4502 : Check if we are using GNU gcc and what its version is
4503 echo " "
4504 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4505 $cat >try.c <<EOM
4506 #include <stdio.h>
4507 int main() {
4508 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4509 #ifdef __VERSION__
4510         printf("%s\n", __VERSION__);
4511 #else
4512         printf("%s\n", "1");
4513 #endif
4514 #endif
4515         return(0);
4516 }
4517 EOM
4518 if $cc -o try $ccflags $ldflags try.c; then
4519         gccversion=`$run ./try`
4520         case "$gccversion" in
4521         '') echo "You are not using GNU cc." ;;
4522         *)  echo "You are using GNU cc $gccversion."
4523             ccname=gcc
4524             ;;
4525         esac
4526 else
4527         echo " "
4528         echo "*** WHOA THERE!!! ***" >&4
4529         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4530         case "$knowitall" in
4531         '')
4532         echo "    You'd better start hunting for one and let me know about it." >&4
4533                 exit 1
4534                 ;;
4535         esac
4536 fi
4537 $rm -f try try.*
4538 case "$gccversion" in
4539 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4540 esac
4541 case "$gccversion" in
4542 '') gccosandvers='' ;;
4543 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4544    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4545    gccshortvers=''
4546    case "$gccosandvers" in
4547    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4548    $osname$osvers) ;; # looking good
4549    $osname*) cat <<EOM >&4
4550
4551 *** WHOA THERE!!! ***
4552
4553     Your gcc has not been compiled for the exact release of
4554     your operating system ($gccosandvers versus $osname$osvers).
4555
4556     In general it is a good idea to keep gcc synchronized with
4557     the operating system because otherwise serious problems
4558     may ensue when trying to compile software, like Perl.
4559
4560     I'm trying to be optimistic here, though, and will continue.
4561     If later during the configuration and build icky compilation
4562     problems appear (headerfile conflicts being the most common
4563     manifestation), I suggest reinstalling the gcc to match
4564     your operating system release.
4565
4566 EOM
4567       ;;
4568    *) gccosandvers='' ;; # failed to parse, better be silent
4569    esac
4570    ;;
4571 esac
4572 case "$ccname" in
4573 '') ccname="$cc" ;;
4574 esac
4575
4576 # gcc 3.* complain about adding -Idirectories that they already know about,
4577 # so we will take those off from locincpth.
4578 case "$gccversion" in
4579 3*)
4580     echo "main(){}">try.c
4581     for incdir in $locincpth; do
4582        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4583              grep '^c[cp]p*[01]: warning: changing search order '`
4584        if test "X$warn" != X; then
4585            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4586        fi
4587     done
4588     $rm -f try try.*
4589 esac
4590
4591 : What should the include directory be ?
4592 echo " "
4593 $echo $n "Hmm...  $c"
4594 dflt='/usr/include'
4595 incpath=''
4596 mips_type=''
4597 if $test -f /bin/mips && /bin/mips; then
4598         echo "Looks like a MIPS system..."
4599         $cat >usr.c <<'EOCP'
4600 #ifdef SYSTYPE_BSD43
4601 /bsd43
4602 #endif
4603 EOCP
4604         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4605                 dflt='/bsd43/usr/include'
4606                 incpath='/bsd43'
4607                 mips_type='BSD 4.3'
4608         else
4609                 mips_type='System V'
4610         fi
4611         $rm -f usr.c usr.out
4612         echo "and you're compiling with the $mips_type compiler and libraries."
4613         xxx_prompt=y
4614         echo "exit 0" >mips
4615 else
4616         echo "Doesn't look like a MIPS system."
4617         xxx_prompt=n
4618         echo "exit 1" >mips
4619 fi
4620 chmod +x mips
4621 $eunicefix mips
4622 case "$usrinc" in
4623 '') ;;
4624 *) dflt="$usrinc";;
4625 esac
4626 case "$xxx_prompt" in
4627 y)      fn=d/
4628         echo " "
4629         rp='Where are the include files you want to use?'
4630         . ./getfile
4631         usrinc="$ans"
4632         ;;
4633 *)      usrinc="$dflt"
4634         ;;
4635 esac
4636
4637 : see how we invoke the C preprocessor
4638 echo " "
4639 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4640 cat <<'EOT' >testcpp.c
4641 #define ABC abc
4642 #define XYZ xyz
4643 ABC.XYZ
4644 EOT
4645 cd ..
4646 if test ! -f cppstdin; then
4647         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4648                 # AIX cc -E doesn't show the absolute headerfile
4649                 # locations but we'll cheat by using the -M flag.
4650                 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
4651         else
4652                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4653         fi
4654 else
4655         echo "Keeping your $hint cppstdin wrapper."
4656 fi
4657 chmod 755 cppstdin
4658 wrapper=`pwd`/cppstdin
4659 ok='false'
4660 cd UU
4661
4662 if $test "X$cppstdin" != "X" && \
4663         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4664         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4665 then
4666         echo "You used to use $cppstdin $cppminus so we'll use that again."
4667         case "$cpprun" in
4668         '') echo "But let's see if we can live without a wrapper..." ;;
4669         *)
4670                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4671                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4672                 then
4673                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4674                         ok='true'
4675                 else
4676                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4677                 fi
4678                 ;;
4679         esac
4680 else
4681         case "$cppstdin" in
4682         '') ;;
4683         *)
4684                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4685                 ;;
4686         esac
4687 fi
4688
4689 if $ok; then
4690         : nothing
4691 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4692         $cc -E <testcpp.c >testcpp.out 2>&1; \
4693         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4694         echo "Yup, it does."
4695         x_cpp="$cc -E"
4696         x_minus='';
4697 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4698         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4699         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4700         echo "Yup, it does."
4701         x_cpp="$cc -E"
4702         x_minus='-';
4703 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4704         $cc -P <testcpp.c >testcpp.out 2>&1; \
4705         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4706         echo "Yipee, that works!"
4707         x_cpp="$cc -P"
4708         x_minus='';
4709 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4710         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4711         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4712         echo "At long last!"
4713         x_cpp="$cc -P"
4714         x_minus='-';
4715 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4716         $cpp <testcpp.c >testcpp.out 2>&1; \
4717         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4718         echo "It works!"
4719         x_cpp="$cpp"
4720         x_minus='';
4721 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4722         $cpp - <testcpp.c >testcpp.out 2>&1; \
4723         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4724         echo "Hooray, it works!  I was beginning to wonder."
4725         x_cpp="$cpp"
4726         x_minus='-';
4727 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4728         $wrapper <testcpp.c >testcpp.out 2>&1; \
4729         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4730         x_cpp="$wrapper"
4731         x_minus=''
4732         echo "Eureka!"
4733 else
4734         dflt=''
4735         rp="No dice.  I can't find a C preprocessor.  Name one:"
4736         . ./myread
4737         x_cpp="$ans"
4738         x_minus=''
4739         $x_cpp <testcpp.c >testcpp.out 2>&1
4740         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4741                 echo "OK, that will do." >&4
4742         else
4743 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4744                 exit 1
4745         fi
4746 fi
4747
4748 case "$ok" in
4749 false)
4750         cppstdin="$x_cpp"
4751         cppminus="$x_minus"
4752         cpprun="$x_cpp"
4753         cpplast="$x_minus"
4754         set X $x_cpp
4755         shift
4756         case "$1" in
4757         "$cpp")
4758                 echo "Perhaps can we force $cc -E using a wrapper..."
4759                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4760                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4761                 then
4762                         echo "Yup, we can."
4763                         cppstdin="$wrapper"
4764                         cppminus='';
4765                 else
4766                         echo "Nope, we'll have to live without it..."
4767                 fi
4768                 ;;
4769         esac
4770         case "$cpprun" in
4771         "$wrapper")
4772                 cpprun=''
4773                 cpplast=''
4774                 ;;
4775         esac
4776         ;;
4777 esac
4778
4779 case "$cppstdin" in
4780 "$wrapper"|'cppstdin') ;;
4781 *) $rm -f $wrapper;;
4782 esac
4783 $rm -f testcpp.c testcpp.out
4784
4785 : Set private lib path
4786 case "$plibpth" in
4787 '') if ./mips; then
4788                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4789         fi;;
4790 esac
4791 case "$libpth" in
4792 ' ') dlist='';;
4793 '') dlist="$loclibpth $plibpth $glibpth";;
4794 *) dlist="$libpth";;
4795 esac
4796
4797 : Now check and see which directories actually exist, avoiding duplicates
4798 libpth=''
4799 for xxx in $dlist
4800 do
4801     if $test -d $xxx; then
4802                 case " $libpth " in
4803                 *" $xxx "*) ;;
4804                 *) libpth="$libpth $xxx";;
4805                 esac
4806     fi
4807 done
4808 $cat <<'EOM'
4809
4810 Some systems have incompatible or broken versions of libraries.  Among
4811 the directories listed in the question below, please remove any you
4812 know not to be holding relevant libraries, and add any that are needed.
4813 Say "none" for none.
4814
4815 EOM
4816 case "$libpth" in
4817 '') dflt='none';;
4818 *)
4819         set X $libpth
4820         shift
4821         dflt=${1+"$@"}
4822         ;;
4823 esac
4824 rp="Directories to use for library searches?"
4825 . ./myread
4826 case "$ans" in
4827 none) libpth=' ';;
4828 *) libpth="$ans";;
4829 esac
4830
4831 : compute shared library extension