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