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