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