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