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