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