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