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