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