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