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