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