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