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