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