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