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