78bfdf943308b30d18e5642bc397a2c289437b8a
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Tue Sep 12 16:47:06 EET DST 2000 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >/tmp/c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >/tmp/c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccname=''
164 ccversion=''
165 perllibs=''
166 d_bsd=''
167 d_eunice=''
168 d_xenix=''
169 eunicefix=''
170 Mcc=''
171 ar=''
172 awk=''
173 bash=''
174 bison=''
175 byacc=''
176 cat=''
177 chgrp=''
178 chmod=''
179 chown=''
180 comm=''
181 compress=''
182 cp=''
183 cpio=''
184 cpp=''
185 csh=''
186 date=''
187 echo=''
188 egrep=''
189 emacs=''
190 expr=''
191 find=''
192 flex=''
193 grep=''
194 gzip=''
195 inews=''
196 ksh=''
197 less=''
198 line=''
199 lint=''
200 ln=''
201 lp=''
202 lpr=''
203 ls=''
204 mail=''
205 mailx=''
206 make=''
207 mkdir=''
208 more=''
209 mv=''
210 nm=''
211 nroff=''
212 perl=''
213 pg=''
214 pmake=''
215 pr=''
216 rm=''
217 rmail=''
218 sed=''
219 sendmail=''
220 shar=''
221 sleep=''
222 smail=''
223 sort=''
224 submit=''
225 tail=''
226 tar=''
227 tbl=''
228 tee=''
229 test=''
230 touch=''
231 tr=''
232 troff=''
233 uname=''
234 uniq=''
235 uuname=''
236 vi=''
237 zcat=''
238 zip=''
239 libswanted=''
240 hint=''
241 myuname=''
242 osname=''
243 osvers=''
244 Author=''
245 Date=''
246 Header=''
247 Id=''
248 Locker=''
249 Log=''
250 RCSfile=''
251 Revision=''
252 Source=''
253 State=''
254 _a=''
255 _exe=''
256 _o=''
257 archobjs=''
258 exe_ext=''
259 firstmakefile=''
260 lib_ext=''
261 obj_ext=''
262 path_sep=''
263 cc=''
264 ccflags=''
265 cppflags=''
266 ldflags=''
267 lkflags=''
268 locincpth=''
269 optimize=''
270 cf_by=''
271 cf_time=''
272 contains=''
273 cpplast=''
274 cppminus=''
275 cpprun=''
276 cppstdin=''
277 d_dlopen=''
278 d_gnulibc=''
279 d_portable=''
280 cccdlflags=''
281 ccdlflags=''
282 dlsrc=''
283 ld=''
284 lddlflags=''
285 usedl=''
286 gccosandvers=''
287 gccversion=''
288 i_dld=''
289 libc=''
290 glibpth=''
291 libpth=''
292 loclibpth=''
293 plibpth=''
294 xlibpth=''
295 ignore_versioned_solibs=''
296 libs=''
297 libsdirs=''
298 libsfiles=''
299 libsfound=''
300 libspath=''
301 lns=''
302 make_set_make=''
303 c=''
304 n=''
305 package=''
306 spackage=''
307 sh=''
308 so=''
309 sharpbang=''
310 shsharp=''
311 spitshell=''
312 src=''
313 startsh=''
314 trnl=''
315 nm_opt=''
316 nm_so_opt=''
317 runnm=''
318 usenm=''
319 usesocks=''
320 incpath=''
321 mips_type=''
322 usrinc=''
323 CONFIG=''
324
325 define='define'
326 undef='undef'
327 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
328 rmlist=''
329
330 : We must find out about Eunice early
331 eunicefix=':'
332 if test -f /etc/unixtovms; then
333         eunicefix=/etc/unixtovms
334 fi
335 if test -f /etc/unixtovms.exe; then
336         eunicefix=/etc/unixtovms.exe
337 fi
338
339 ccname=''
340 ccversion=''
341 perllibs=''
342 : Trailing extension.  Override this in a hint file, if needed.
343 _exe=''
344 : Extra object files, if any, needed on this platform.
345 archobjs=''
346 cppflags=''
347 optimize=''
348 : Possible local include directories to search.
349 : Set locincpth to "" in a hint file to defeat local include searches.
350 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
351 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
352 :
353 : no include file wanted by default
354 inclwanted=''
355
356 : change the next line if compiling for Xenix/286 on Xenix/386
357 xlibpth='/usr/lib/386 /lib/386'
358 : Possible local library directories to search.
359 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
360 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
361
362 : general looking path for locating libraries
363 glibpth="/lib /usr/lib $xlibpth"
364 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
365 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
366 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
367
368 : Private path used by Configure to find libraries.  Its value
369 : is prepended to libpth. This variable takes care of special
370 : machines, like the mips.  Usually, it should be empty.
371 plibpth=''
372
373 : default library list
374 libswanted=''
375 : some systems want to use only the non-versioned libso:s
376 ignore_versioned_solibs=''
377 : set usesocks on the Configure command line to enable socks.
378 : List of libraries we want.
379 : If anyone needs -lnet, put it in a hint file.
380 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
381 libswanted="$libswanted dld ld sun m c cposix posix"
382 libswanted="$libswanted ndir dir crypt sec"
383 libswanted="$libswanted ucb bsd BSD PW x iconv util"
384 : We probably want to search /usr/shlib before most other libraries.
385 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
386 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
387 glibpth="/usr/shlib $glibpth"
388 : Do not use vfork unless overridden by a hint file.
389 usevfork=false
390
391 : Find the basic shell for Bourne shell scripts
392 case "$sh" in
393 '')
394         case "$SYSTYPE" in
395         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
396         *) xxx='/bin/sh';;
397         esac
398         if test -f "$xxx"; then
399                 sh="$xxx"
400         else
401                 : Build up a list and do a single loop so we can 'break' out.
402                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
403                 for xxx in sh bash ksh pdksh ash; do
404                         for p in $pth; do
405                                 try="$try ${p}/${xxx}"
406                         done
407                 done
408                 for xxx in $try; do
409                         if test -f "$xxx"; then
410                                 sh="$xxx";
411                                 break
412                         elif test -f "$xxx.exe"; then
413                                 sh="$xxx";
414                                 break
415                         fi
416                 done
417         fi
418         ;;
419 esac
420
421 case "$sh" in
422 '')     cat <<EOM >&2
423 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
424
425 Usually it's in /bin/sh.  How did you even get this far?
426 Please contact me (Perl Maintainers) at perlbug@perl.org and 
427 we'll try to straighten this all out.
428 EOM
429         exit 1
430         ;;
431 esac
432
433 : see if sh knows # comments
434 if `$sh -c '#' >/dev/null 2>&1`; then
435         shsharp=true
436         spitshell=cat
437         xcat=/bin/cat
438         test -f $xcat || xcat=/usr/bin/cat
439         echo "#!$xcat" >try
440         $eunicefix try
441         chmod +x try
442         ./try > today
443         if test -s today; then
444                 sharpbang='#!'
445         else
446                 echo "#! $xcat" > try
447                 $eunicefix try
448                 chmod +x try
449                 ./try > today
450                 if test -s today; then
451                         sharpbang='#! '
452                 else
453                         sharpbang=': use '
454                 fi
455         fi
456 else
457         echo " "
458         echo "Your $sh doesn't grok # comments--I will strip them later on."
459         shsharp=false
460         cd ..
461         echo "exec grep -v '^[  ]*#'" >spitshell
462         chmod +x spitshell
463         $eunicefix spitshell
464         spitshell=`pwd`/spitshell
465         cd UU
466         echo "I presume that if # doesn't work, #! won't work either!"
467         sharpbang=': use '
468 fi
469 rm -f try today
470
471 : figure out how to guarantee sh startup
472 case "$startsh" in
473 '') startsh=${sharpbang}${sh} ;;
474 *)
475 esac
476 cat >try <<EOSS
477 $startsh
478 set abc
479 test "$?abc" != 1
480 EOSS
481
482 chmod +x try
483 $eunicefix try
484 if ./try; then
485         : echo "Yup, it does."
486 else
487         echo "Hmm... '$startsh' does not guarantee sh startup..."
488         echo "You may have to fix up the shell scripts to make sure $sh runs them."
489 fi
490 rm -f try
491
492
493 : Save command line options in file UU/cmdline.opt for later use in
494 : generating config.sh.
495 cat > cmdline.opt <<EOSH
496 # Configure command line arguments.
497 config_arg0='$0'
498 config_args='$*'
499 config_argc=$#
500 EOSH
501 argn=1
502 for arg in "$@"; do
503         cat >>cmdline.opt <<EOSH
504 config_arg$argn='$arg'
505 EOSH
506         argn=`expr $argn + 1`
507 done
508
509 : produce awk script to parse command line options
510 cat >options.awk <<'EOF'
511 BEGIN {
512         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
513
514         len = length(optstr);
515         for (i = 1; i <= len; i++) {
516                 c = substr(optstr, i, 1);
517                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
518                 if (a == ":") {
519                         arg[c] = 1;
520                         i++;
521                 }
522                 opt[c] = 1;
523         }
524 }
525 {
526         expect = 0;
527         str = $0;
528         if (substr(str, 1, 1) != "-") {
529                 printf("'%s'\n", str);
530                 next;
531         }
532         len = length($0);
533         for (i = 2; i <= len; i++) {
534                 c = substr(str, i, 1);
535                 if (!opt[c]) {
536                         printf("-%s\n", substr(str, i));
537                         next;
538                 }
539                 printf("-%s\n", c);
540                 if (arg[c]) {
541                         if (i < len)
542                                 printf("'%s'\n", substr(str, i + 1));
543                         else
544                                 expect = 1;
545                         next;
546                 }
547         }
548 }
549 END {
550         if (expect)
551                 print "?";
552 }
553 EOF
554
555 : process the command line options
556 set X `for arg in "$@"; do echo "X$arg"; done |
557         sed -e s/X// | awk -f options.awk`
558 eval "set $*"
559 shift
560 rm -f options.awk
561
562 : set up default values
563 fastread=''
564 reuseval=false
565 config_sh=''
566 alldone=''
567 error=''
568 silent=''
569 extractsh=''
570 override=''
571 knowitall=''
572 rm -f optdef.sh posthint.sh
573 cat >optdef.sh <<EOS
574 $startsh
575 EOS
576
577
578 : option parsing
579 while test $# -gt 0; do
580         case "$1" in
581         -d) shift; fastread=yes;;
582         -e) shift; alldone=cont;;
583         -f)
584                 shift
585                 cd ..
586                 if test -r "$1"; then
587                         config_sh="$1"
588                 else
589                         echo "$me: cannot read config file $1." >&2
590                         error=true
591                 fi
592                 cd UU
593                 shift;;
594         -h) shift; error=true;;
595         -r) shift; reuseval=true;;
596         -s) shift; silent=true; realsilent=true;;
597         -E) shift; alldone=exit;;
598         -K) shift; knowitall=true;;
599         -O) shift; override=true;;
600         -S) shift; silent=true; extractsh=true;;
601         -D)
602                 shift
603                 case "$1" in
604                 *=)
605                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
606                         echo "$me: ignoring -D $1" >&2
607                         ;;
608                 *=*) echo "$1" | \
609                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
610                 *) echo "$1='define'" >> optdef.sh;;
611                 esac
612                 shift
613                 ;;
614         -U)
615                 shift
616                 case "$1" in
617                 *=) echo "$1" >> optdef.sh;;
618                 *=*)
619                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
620                         echo "$me: ignoring -U $1" >&2
621                         ;;
622                 *) echo "$1='undef'" >> optdef.sh;;
623                 esac
624                 shift
625                 ;;
626         -A)
627             shift
628             xxx=''
629             yyy="$1"
630             zzz=''
631             uuu=undef
632             case "$yyy" in
633             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
634                  case "$zzz" in
635                  *:*) zzz='' ;;
636                  *)   xxx=append
637                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
638                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
639                  esac
640                  ;;
641             esac
642             case "$xxx" in
643             '')  case "$yyy" in
644                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
645                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
646                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
647                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
648                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
649                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
650                  esac
651                  ;;       
652             esac
653             case "$xxx" in
654             append)
655                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
656             clear)
657                 echo "$yyy=''"                  >> posthint.sh ;;
658             define)
659                 case "$zzz" in
660                 '') zzz=define ;;
661                 esac
662                 echo "$yyy='$zzz'"              >> posthint.sh ;;
663             eval)
664                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
665             prepend)
666                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
667             undef)
668                 case "$zzz" in
669                 '') zzz="$uuu" ;;
670                 esac
671                 echo "$yyy=$zzz"                >> posthint.sh ;;
672             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
673             esac
674             shift
675             ;;
676         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
677             exit 0;;
678         --) break;;
679         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
680         *) break;;
681         esac
682 done
683
684 case "$error" in
685 true)
686         cat >&2 <<EOM
687 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
688                  [-U symbol] [-U symbol=] [-A command:symbol...]
689   -d : use defaults for all answers.
690   -e : go on without questioning past the production of config.sh.
691   -f : specify an alternate default configuration file.
692   -h : print this help message and exit (with an error status).
693   -r : reuse C symbols value if possible (skips costly nm extraction).
694   -s : silent mode, only echoes questions and essential information.
695   -D : define symbol to have some value:
696          -D symbol         symbol gets the value 'define'
697          -D symbol=value   symbol gets the value 'value'
698   -E : stop at the end of questions, after having produced config.sh.
699   -K : do not use unless you know what you are doing.
700   -O : let -D and -U override definitions from loaded configuration file.
701   -S : perform variable substitutions on all .SH files (can mix with -f)
702   -U : undefine symbol:
703          -U symbol    symbol gets the value 'undef'
704          -U symbol=   symbol gets completely empty
705   -A : manipulate symbol after the platform specific hints have been applied:
706          -A symbol=value                append " "value to symbol
707          -A append:symbol=value         append value to symbol
708          -A define:symbol=value         define symbol to have value
709          -A clear:symbol                define symbol to be ''
710          -A define:symbol               define symbol to be 'define'
711          -A eval:symbol=value           define symbol to be eval of value
712          -A prepend:symbol=value        prepend value to symbol
713          -A undef:symbol                define symbol to be 'undef'
714          -A undef:symbol=               define symbol to be ''
715   -V : print version number and exit (with a zero status).
716 EOM
717         exit 1
718         ;;
719 esac
720
721 : Sanity checks
722 case "$fastread$alldone" in
723 yescont|yesexit) ;;
724 *)
725         case "$extractsh" in
726         true) ;;
727         *)
728                 if test ! -t 0; then
729                         echo "Say 'sh Configure', not 'sh <Configure'"
730                         exit 1
731                 fi
732                 ;;
733         esac
734         ;;
735 esac
736
737 exec 4>&1
738 case "$silent" in
739 true) exec 1>/dev/null;;
740 esac
741
742 : run the defines and the undefines, if any, but leave the file out there...
743 touch optdef.sh
744 . ./optdef.sh
745 : create the posthint manipulation script and leave the file out there...
746 touch posthint.sh
747
748 : set package name
749 package=perl5
750
751 : Some greps do not return status, grrr.
752 echo "grimblepritz" >grimble
753 if grep blurfldyick grimble >/dev/null 2>&1 ; then
754         contains=contains
755 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
756         contains=grep
757 else
758         contains=contains
759 fi
760 rm -f grimble
761 : the following should work in any shell
762 case "$contains" in
763 contains*)
764         echo " "
765         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
766         cat >contains <<'EOSS'
767 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
768 EOSS
769 chmod +x contains
770 esac
771
772 : Find the path to the source tree
773 case "$src" in
774 '') case "$0" in
775     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
776          case "$src" in
777          /*)    ;;
778          *)     src=`cd ../$src && pwd` ;;
779          esac
780          ;;
781     *)   src='.';;
782     esac;;
783 esac
784 case "$src" in
785 '')     src=/
786         rsrc=/
787         ;;
788 /*) rsrc="$src";;
789 *) rsrc="../$src";;
790 esac
791 if test -f $rsrc/Configure && \
792         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
793 then
794    : found it, so we are ok.
795 else
796         rsrc=''
797         for src in . .. ../.. ../../.. ../../../..; do
798                 if test -f ../$src/Configure && \
799                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
800                 then
801                         rsrc=../$src
802                         break
803                 fi
804         done
805 fi
806 case "$rsrc" in
807 '')
808         cat <<EOM >&4
809
810 Sorry, I can't seem to locate the source dir for $package.  Please start
811 Configure with an explicit path -- i.e. /some/path/Configure.
812
813 EOM
814         exit 1
815         ;;
816 ../.)   rsrc='..';;
817 *)
818         echo " "
819         echo "Sources for $package found in \"$src\"." >&4
820         ;;
821 esac
822
823 : script used to extract .SH files with variable substitutions
824 cat >extract <<'EOS'
825 CONFIGDOTSH=true
826 echo "Doing variable substitutions on .SH files..."
827 if test -f $src/MANIFEST; then
828         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
829 else
830         echo "(Looking for .SH files under the source directory.)"
831         set x `(cd $src; find . -name "*.SH" -print)`
832 fi
833 shift
834 case $# in
835 0) set x `(cd $src; echo *.SH)`; shift;;
836 esac
837 if test ! -f $src/$1; then
838         shift
839 fi
840 mkdir_p='
841 name=$1;
842 create="";
843 while test $name; do
844         if test ! -d "$name"; then
845                 create="$name $create";
846                 name=`echo $name | sed -e "s|^[^/]*$||"`;
847                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
848         else
849                 name="";
850         fi;
851 done;
852 for file in $create; do
853         mkdir $file;
854 done
855 '
856 for file in $*; do
857         case "$src" in
858         ".")
859                 case "$file" in
860                 */*)
861                         dir=`expr X$file : 'X\(.*\)/'`
862                         file=`expr X$file : 'X.*/\(.*\)'`
863                         (cd $dir && . ./$file)
864                         ;;
865                 *)
866                         . ./$file
867                         ;;
868                 esac
869                 ;;
870         *)
871                 case "$file" in
872                 */*)
873                         dir=`expr X$file : 'X\(.*\)/'`
874                         file=`expr X$file : 'X.*/\(.*\)'`
875                         (set x $dir; shift; eval $mkdir_p)
876                         sh <$src/$dir/$file
877                         ;;
878                 *)
879                         sh <$src/$file
880                         ;;
881                 esac
882                 ;;
883         esac
884 done
885 if test -f $src/config_h.SH; then
886         if test ! -f config.h; then
887         : oops, they left it out of MANIFEST, probably, so do it anyway.
888         . $src/config_h.SH
889         fi
890 fi
891 EOS
892
893 : extract files and exit if asked to do so
894 case "$extractsh" in
895 true)
896         case "$realsilent" in
897         true) ;;
898         *) exec 1>&4;;
899         esac
900         case "$config_sh" in
901         '') config_sh='config.sh';;
902         esac
903         echo " "
904         echo "Fetching answers from $config_sh..."
905         cd ..
906         . $config_sh
907         test "$override" && . ./optdef.sh
908         echo " "
909         . UU/extract
910         rm -rf UU
911         echo "Done."
912         exit 0
913         ;;
914 esac
915
916 : Eunice requires " " instead of "", can you believe it
917 echo " "
918 : Here we go...
919 echo "Beginning of configuration questions for $package."
920
921 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
922
923 : first determine how to suppress newline on echo command
924 echo " "
925 echo "Checking echo to see how to suppress newlines..."
926 (echo "hi there\c" ; echo " ") >.echotmp
927 if $contains c .echotmp >/dev/null 2>&1 ; then
928         echo "...using -n."
929         n='-n'
930         c=''
931 else
932         cat <<'EOM'
933 ...using \c
934 EOM
935         n=''
936         c='\c'
937 fi
938 echo $n "The star should be here-->$c"
939 echo '*'
940 rm -f .echotmp
941
942 : Now test for existence of everything in MANIFEST
943 echo " "
944 if test -f $rsrc/MANIFEST; then
945         echo "First let's make sure your kit is complete.  Checking..." >&4
946         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
947         rm -f missing
948         tmppwd=`pwd`
949         for filelist in x??; do
950                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
951         done
952         if test -s missing; then
953                 cat missing >&4
954                 cat >&4 <<'EOM'
955
956 THIS PACKAGE SEEMS TO BE INCOMPLETE.
957
958 You have the option of continuing the configuration process, despite the
959 distinct possibility that your kit is damaged, by typing 'y'es.  If you
960 do, don't blame me if something goes wrong.  I advise you to type 'n'o
961 and contact the author (perlbug@perl.org).
962
963 EOM
964                 echo $n "Continue? [n] $c" >&4
965                 read ans
966                 case "$ans" in
967                 y*)
968                         echo "Continuing..." >&4
969                         rm -f missing
970                         ;;
971                 *)
972                         echo "ABORTING..." >&4
973                         kill $$
974                         ;;
975                 esac
976         else
977                 echo "Looks good..."
978         fi
979 else
980         echo "There is no MANIFEST file.  I hope your kit is complete !"
981 fi
982 rm -f missing x??
983
984 echo " "
985 : Find the appropriate value for a newline for tr
986 if test -n "$DJGPP"; then
987        trnl='\012'
988 fi
989 if test X"$trnl" = X; then
990         case "`echo foo|tr '\n' x 2>/dev/null`" in
991         foox) trnl='\n' ;;
992         esac
993 fi
994 if test X"$trnl" = X; then
995         case "`echo foo|tr '\012' x 2>/dev/null`" in
996         foox) trnl='\012' ;;
997         esac
998 fi
999 if test X"$trnl" = X; then
1000         cat <<EOM >&2
1001
1002 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1003
1004 EOM
1005         exit 1
1006 fi
1007
1008 : compute the number of columns on the terminal for proper question formatting
1009 case "$COLUMNS" in
1010 '') COLUMNS='80';;
1011 esac
1012
1013 : set up the echo used in my read
1014 myecho="case \"\$xxxm\" in
1015 '') echo $n \"\$rp $c\" >&4;;
1016 *) case \"\$rp\" in
1017         '') echo $n \"[\$xxxm] $c\";;
1018         *)
1019                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1020                         echo \"\$rp\" >&4
1021                         echo $n \"[\$xxxm] $c\" >&4
1022                 else
1023                         echo $n \"\$rp [\$xxxm] $c\" >&4
1024                 fi
1025                 ;;
1026         esac;;
1027 esac"
1028
1029 : now set up to do reads with possible shell escape and default assignment
1030 cat <<EOSC >myread
1031 $startsh
1032 xxxm=\$dflt
1033 $myecho
1034 ans='!'
1035 case "\$fastread" in
1036 yes) case "\$dflt" in
1037         '') ;;
1038         *) ans='';
1039                 case "\$silent-\$rp" in
1040                 true-) ;;
1041                 *) echo " " >&4;;
1042                 esac;;
1043         esac;;
1044 *) case "\$silent" in
1045         true) case "\$rp" in
1046                 '') ans='';;
1047                 esac;;
1048         esac;;
1049 esac
1050 while expr "X\$ans" : "X!" >/dev/null; do
1051         read answ
1052         set x \$xxxm
1053         shift
1054         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1055         case  "\$answ" in
1056         "!")
1057                 sh 1>&4
1058                 echo " "
1059                 $myecho
1060                 ;;
1061         !*)
1062                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1063                 shift
1064                 sh 1>&4 -c "\$*"
1065                 echo " "
1066                 $myecho
1067                 ;;
1068         "\$ans")
1069                 case "\$ans" in
1070                 \\&*)
1071                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1072                         shift
1073                         case "\$1" in
1074                         -d)
1075                                 fastread=yes
1076                                 echo "(OK, I'll run with -d after this question.)" >&4
1077                                 ;;
1078                         -*)
1079                                 echo "*** Sorry, \$1 not supported yet." >&4
1080                                 ;;
1081                         esac
1082                         $myecho
1083                         ans=!
1084                         ;;
1085                 esac;;
1086         *)
1087                 case "\$aok" in
1088                 y)
1089                         echo "*** Substitution done -- please confirm."
1090                         xxxm="\$ans"
1091                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1092                         xxxm="\$ans"
1093                         ans=!
1094                         ;;
1095                 *)
1096                         echo "*** Error -- try again."
1097                         ans=!
1098                         ;;
1099                 esac
1100                 $myecho
1101                 ;;
1102         esac
1103         case "\$ans\$xxxm\$nostick" in
1104         '')
1105                 ans=!
1106                 $myecho
1107                 ;;
1108         esac
1109 done
1110 case "\$ans" in
1111 '') ans="\$xxxm";;
1112 esac
1113 EOSC
1114
1115 : create .config dir to save info across Configure sessions
1116 test -d ../.config || mkdir ../.config
1117 cat >../.config/README <<EOF
1118 This directory created by Configure to save information that should
1119 persist across sessions for $package.
1120
1121 You may safely delete it if you wish.
1122 EOF
1123
1124 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
1125 case "$usedevel" in
1126 $define|true|[yY]*) ;;
1127 *) case "$xversion" in
1128    *[13579])
1129         cat >&4 <<EOH
1130 *** WHOA THERE!!! ***
1131
1132     This is an UNSTABLE DEVELOPMENT release.
1133     The version of this $package distribution is $xversion, that is, odd,
1134     (as opposed to even) and that signifies a development release.
1135     If you want a maintenance release, you want an even-numbered version.
1136
1137     Do ***NOT*** install this into production use.
1138     Data corruption and crashes are possible.
1139
1140     It is most seriously suggested that you do not continue any further
1141     unless you want to help in developing and debugging Perl.
1142
1143 EOH
1144         rp='Do you really want to continue?'
1145         dflt='n'
1146         . ./myread
1147         case "$ans" in
1148         [yY]) echo >&4 "Okay, continuing." ;;
1149         *) echo >&4 "Okay, bye."
1150            exit 1
1151            ;;
1152         esac
1153         ;;
1154     esac
1155     ;;
1156 esac
1157
1158 : general instructions
1159 needman=true
1160 firsttime=true
1161 user=`(logname) 2>/dev/null`
1162 case "$user" in
1163 '') user=`whoami 2>&1`;;
1164 esac
1165 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1166         firsttime=false
1167         echo " "
1168         rp='Would you like to see the instructions?'
1169         dflt=n
1170         . ./myread
1171         case "$ans" in
1172         [yY]*) ;;
1173         *) needman=false;;
1174         esac
1175 fi
1176 if $needman; then
1177         cat <<EOH
1178
1179 This installation shell script will examine your system and ask you questions
1180 to determine how the perl5 package should be installed. If you get
1181 stuck on a question, you may use a ! shell escape to start a subshell or
1182 execute a command.  Many of the questions will have default answers in square
1183 brackets; typing carriage return will give you the default.
1184
1185 On some of the questions which ask for file or directory names you are allowed
1186 to use the ~name construct to specify the login directory belonging to "name",
1187 even if you don't have a shell which knows about that.  Questions where this is
1188 allowed will be marked "(~name ok)".
1189
1190 EOH
1191         rp=''
1192         dflt='Type carriage return to continue'
1193         . ./myread
1194         cat <<'EOH'
1195
1196 The prompter used in this script allows you to use shell variables and
1197 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1198 in the default answer, as if the default line was a set of arguments given to a
1199 script shell.  This means you may also use $* to repeat the whole default line,
1200 so you do not have to re-type everything to add something to the default.
1201
1202 Everytime there is a substitution, you will have to confirm.  If there is an
1203 error (e.g. an unmatched backtick), the default answer will remain unchanged
1204 and you will be prompted again.
1205
1206 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1207 the questions and use the computed defaults (or the previous answers if there
1208 was already a config.sh file). Type 'Configure -h' for a list of options.
1209 You may also start interactively and then answer '& -d' at any prompt to turn
1210 on the non-interactive behaviour for the remainder of the execution.
1211
1212 EOH
1213         . ./myread
1214         cat <<EOH
1215
1216 Much effort has been expended to ensure that this shell script will run on any
1217 Unix system.  If despite that it blows up on yours, your best bet is to edit
1218 Configure and run it again.  If you can't run Configure for some reason,
1219 you'll have to generate a config.sh file by hand.  Whatever problems you
1220 have, let me (perlbug@perl.org) know how I blew it.
1221
1222 This installation script affects things in two ways:
1223
1224 1) it may do direct variable substitutions on some of the files included
1225    in this kit.
1226 2) it builds a config.h file for inclusion in C programs.  You may edit
1227    any of these files as the need arises after running this script.
1228
1229 If you make a mistake on a question, there is no easy way to back up to it
1230 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1231 files.  Configure will offer to let you do this before it runs the SH files.
1232
1233 EOH
1234         dflt='Type carriage return to continue'
1235         . ./myread
1236         case "$firsttime" in
1237         true) echo $user >>../.config/instruct;;
1238         esac
1239 fi
1240
1241 : find out where common programs are
1242 echo " "
1243 echo "Locating common programs..." >&4
1244 cat <<EOSC >loc
1245 $startsh
1246 case \$# in
1247 0) exit 1;;
1248 esac
1249 thing=\$1
1250 shift
1251 dflt=\$1
1252 shift
1253 for dir in \$*; do
1254         case "\$thing" in
1255         .)
1256         if test -d \$dir/\$thing; then
1257                 echo \$dir
1258                 exit 0
1259         fi
1260         ;;
1261         *)
1262         for thisthing in \$dir/\$thing; do
1263                 : just loop through to pick last item
1264         done
1265         if test -f \$thisthing; then
1266                 echo \$thisthing
1267                 exit 0
1268         elif test -f \$dir/\$thing.exe; then
1269                 if test -n "$DJGPP"; then
1270                         echo \$dir/\$thing.exe
1271                 else
1272                         : on Eunice apparently
1273                         echo \$dir/\$thing
1274                 fi
1275                 exit 0
1276         fi
1277         ;;
1278         esac
1279 done
1280 echo \$dflt
1281 exit 1
1282 EOSC
1283 chmod +x loc
1284 $eunicefix loc
1285 loclist="
1286 awk
1287 cat
1288 echo
1289 expr
1290 grep
1291 ls
1292 make
1293 rm
1294 sed
1295 touch
1296 tr
1297 "
1298 trylist="
1299 Mcc
1300 ar
1301 cpp
1302 date
1303 egrep
1304 gzip
1305 ln
1306 nm
1307 test
1308 uname
1309 zip
1310 "
1311 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1312 pth="$pth /lib /usr/lib"
1313 for file in $loclist; do
1314         eval xxx=\$$file
1315         case "$xxx" in
1316         /*|?:[\\/]*)
1317                 if test -f "$xxx"; then
1318                         : ok
1319                 else
1320                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1321                         xxx=`./loc $file $file $pth`
1322                 fi
1323                 ;;
1324         '') xxx=`./loc $file $file $pth`;;
1325         *) xxx=`./loc $xxx $xxx $pth`;;
1326         esac
1327         eval $file=$xxx
1328         eval _$file=$xxx
1329         case "$xxx" in
1330         /*)
1331                 echo $file is in $xxx.
1332                 ;;
1333         ?:[\\/]*)
1334                 echo $file is in $xxx.
1335                 ;;
1336         *)
1337                 echo "I don't know where '$file' is, and my life depends on it." >&4
1338                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1339                 exit 1
1340                 ;;
1341         esac
1342 done
1343 echo " "
1344 echo "Don't worry if any of the following aren't found..."
1345 say=offhand
1346 for file in $trylist; do
1347         eval xxx=\$$file
1348         case "$xxx" in
1349         /*|?:[\\/]*)
1350                 if test -f "$xxx"; then
1351                         : ok
1352                 else
1353                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1354                         xxx=`./loc $file $file $pth`
1355                 fi
1356                 ;;
1357         '') xxx=`./loc $file $file $pth`;;
1358         *) xxx=`./loc $xxx $xxx $pth`;;
1359         esac
1360         eval $file=$xxx
1361         eval _$file=$xxx
1362         case "$xxx" in
1363         /*)
1364                 echo $file is in $xxx.
1365                 ;;
1366         ?:[\\/]*)
1367                 echo $file is in $xxx.
1368                 ;;
1369         *)
1370                 echo "I don't see $file out there, $say."
1371                 say=either
1372                 ;;
1373         esac
1374 done
1375 case "$egrep" in
1376 egrep)
1377         echo "Substituting grep for egrep."
1378         egrep=$grep
1379         ;;
1380 esac
1381 case "$ln" in
1382 ln)
1383         echo "Substituting cp for ln."
1384         ln=$cp
1385         ;;
1386 esac
1387 case "$test" in
1388 test)
1389         echo "Hopefully test is built into your sh."
1390         ;;
1391 *)
1392         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1393                 echo "Using the test built into your sh."
1394                 test=test
1395                 _test=test
1396         fi
1397         ;;
1398 esac
1399 case "$echo" in
1400 echo)
1401         echo "Hopefully echo is built into your sh."
1402         ;;
1403 '') ;;
1404 *)
1405         echo " "
1406 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1407         $echo $n "hi there$c" >foo1
1408         echo $n "hi there$c" >foo2
1409         if cmp foo1 foo2 >/dev/null 2>&1; then
1410                 echo "They are compatible.  In fact, they may be identical."
1411         else
1412                 case "$n" in
1413                 '-n') n='' c='\c';;
1414                 *) n='-n' c='';;
1415                 esac
1416                 cat <<FOO
1417 They are not compatible!  You are probably running ksh on a non-USG system.
1418 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1419 have echo built in and we may have to run some Bourne shell scripts.  That
1420 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
1421
1422 FOO
1423                 $echo $n "The star should be here-->$c"
1424                 $echo "*"
1425         fi
1426         $rm -f foo1 foo2
1427         ;;
1428 esac
1429
1430 cat <<EOS >checkcc
1431 $startsh
1432 EOS
1433 cat <<'EOSC' >>checkcc
1434 case "$cc" in
1435 '') ;;
1436 *)  $rm -f try try.*
1437     $cat >try.c <<EOM
1438 int main(int argc, char *argv[]) {
1439   return 0;
1440 }
1441 EOM
1442     if $cc -o try try.c; then
1443        :
1444     else
1445         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
1446         despair=yes
1447         trygcc=yes
1448         case "$cc" in
1449         *gcc*) trygcc=no ;;
1450         esac
1451         case "`$cc -v -c try.c 2>&1`" in
1452         *gcc*) trygcc=no ;;
1453         esac
1454         if $test X"$trygcc" = Xyes; then
1455             if gcc -o try -c try.c; then
1456                 echo " "
1457                 echo "You seem to have a working gcc, though." >&4
1458                 rp="Would you like to use it?"
1459                 dflt=y
1460                 if $test -f myread; then
1461                     . ./myread
1462                 else
1463                     if $test -f UU/myread; then
1464                         . ./UU/myread
1465                     else
1466                         echo "Cannot find myread, sorry.  Aborting." >&2
1467                         exit 1
1468                     fi
1469                 fi  
1470                 case "$ans" in
1471                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no ;;
1472                 esac
1473             fi
1474         fi
1475         if $test X"$despair" = Xyes; then
1476             echo "You need to find a working C compiler." >&4
1477             echo "I cannot continue any further, aborting." >&4
1478             exit 1
1479         fi
1480     fi
1481     $rm -f try try.*
1482     ;;
1483 esac
1484 EOSC
1485
1486 : determine whether symbolic links are supported
1487 echo " "
1488 $touch blurfl
1489 if $ln -s blurfl sym > /dev/null 2>&1 ; then
1490         echo "Symbolic links are supported." >&4
1491         lns="$ln -s"
1492 else
1493         echo "Symbolic links are NOT supported." >&4
1494         lns="$ln"
1495 fi
1496 $rm -f blurfl sym
1497
1498 : see whether [:lower:] and [:upper:] are supported character classes
1499 echo " "
1500 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1501 ABYZ)
1502         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
1503         up='[:upper:]'
1504         low='[:lower:]'
1505         ;;
1506 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
1507         # (0xc9 and 0xd1), therefore that is a nice testing point.
1508         if test "X$up" = X -o "X$low" = X; then
1509             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
1510             ij) up='[A-Z]'
1511                 low='[a-z]'
1512                 ;;
1513             esac
1514         fi
1515         if test "X$up" = X -o "X$low" = X; then
1516             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
1517             ij) up='A-Z'
1518                 low='a-z'
1519                 ;;
1520             esac
1521         fi
1522         if test "X$up" = X -o "X$low" = X; then
1523             case "`echo IJ | od -x 2>/dev/null`" in
1524             *C9D1*|*c9d1*)
1525                 echo "Hey, this might be EBCDIC." >&4
1526                 if test "X$up" = X -o "X$low" = X; then
1527                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
1528                     ij) up='[A-IJ-RS-Z]'
1529                         low='[a-ij-rs-z]'
1530                         ;;
1531                     esac
1532                 fi
1533                 if test "X$up" = X -o "X$low" = X; then
1534                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
1535                     ij) up='A-IJ-RS-Z'
1536                         low='a-ij-rs-z'
1537                         ;;
1538                     esac
1539                 fi
1540                 ;;
1541             esac
1542         fi
1543 esac
1544 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
1545 ij)
1546     echo "Using $up and $low to convert case." >&4
1547     ;;
1548 *)
1549     echo "I don't know how to translate letters from upper to lower case." >&4
1550     echo "Your tr is not acting any way I know of." >&4
1551     exit 1
1552     ;;
1553 esac
1554 : set up the translation script tr, must be called with ./tr of course
1555 cat >tr <<EOSC
1556 $startsh
1557 case "\$1\$2" in
1558 '[A-Z][a-z]') exec $tr '$up' '$low';;
1559 '[a-z][A-Z]') exec $tr '$low' '$up';;
1560 esac
1561 exec $tr "\$@"
1562 EOSC
1563 chmod +x tr
1564 $eunicefix tr
1565
1566 : Try to determine whether config.sh was made on this system
1567 case "$config_sh" in
1568 '')
1569 myuname=`$uname -a 2>/dev/null`
1570 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
1571 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
1572 # because the A-Z/a-z are not consecutive.
1573 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
1574         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1575 newmyuname="$myuname"
1576 dflt=n
1577 case "$knowitall" in
1578 '')
1579         if test -f ../config.sh; then
1580                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
1581                         eval "`grep myuname= ../config.sh`"
1582                 fi
1583                 if test "X$myuname" = "X$newmyuname"; then
1584                         dflt=y
1585                 fi
1586         fi
1587         ;;
1588 *) dflt=y;;
1589 esac
1590
1591 : Get old answers from old config file if Configure was run on the
1592 : same system, otherwise use the hints.
1593 hint=default
1594 cd ..
1595 if test -f config.sh; then
1596         echo " "
1597         rp="I see a config.sh file.  Shall I use it to set the defaults?"
1598         . UU/myread
1599         case "$ans" in
1600         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
1601         *)  echo "Fetching default answers from your old config.sh file..." >&4
1602                 tmp_n="$n"
1603                 tmp_c="$c"
1604                 tmp_sh="$sh"
1605                 . ./config.sh
1606                 cp config.sh UU
1607                 n="$tmp_n"
1608                 c="$tmp_c"
1609                 : Older versions did not always set $sh.  Catch re-use of such
1610                 : an old config.sh.
1611                 case "$sh" in
1612                 '') sh="$tmp_sh" ;;
1613                 esac
1614                 hint=previous
1615                 ;;
1616         esac
1617 fi
1618 . ./UU/checkcc
1619 if test ! -f config.sh; then
1620         $cat <<EOM
1621
1622 First time through, eh?  I have some defaults handy for some systems
1623 that need some extra help getting the Configure answers right:
1624
1625 EOM
1626         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
1627         dflt=''
1628         : Half the following guesses are probably wrong... If you have better
1629         : tests or hints, please send them to perlbug@perl.org
1630         : The metaconfig authors would also appreciate a copy...
1631         $test -f /irix && osname=irix
1632         $test -f /xenix && osname=sco_xenix
1633         $test -f /dynix && osname=dynix
1634         $test -f /dnix && osname=dnix
1635         $test -f /lynx.os && osname=lynxos
1636         $test -f /unicos && osname=unicos && osvers=`$uname -r`
1637         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
1638         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
1639         $test -f /bin/mips && /bin/mips && osname=mips
1640         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
1641                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
1642         $test -d /usr/apollo/bin && osname=apollo
1643         $test -f /etc/saf/_sactab && osname=svr4
1644         $test -d /usr/include/minix && osname=minix
1645         if $test -d /MachTen -o -d /MachTen_Folder; then
1646                 osname=machten
1647                 if $test -x /sbin/version; then
1648                         osvers=`/sbin/version | $awk '{print $2}' |
1649                         $sed -e 's/[A-Za-z]$//'`
1650                 elif $test -x /usr/etc/version; then
1651                         osvers=`/usr/etc/version | $awk '{print $2}' |
1652                         $sed -e 's/[A-Za-z]$//'`
1653                 else
1654                         osvers="$2.$3"
1655                 fi
1656         fi
1657
1658         $test -f /sys/posix.dll &&
1659                 $test -f /usr/bin/what &&
1660                 set X `/usr/bin/what /sys/posix.dll` &&
1661                 $test "$3" = UWIN &&
1662                 osname=uwin &&
1663                 osvers="$5"
1664
1665         if $test -f $uname; then
1666                 set X $myuname
1667                 shift
1668
1669                 case "$5" in
1670                 fps*) osname=fps ;;
1671                 mips*)
1672                         case "$4" in
1673                         umips) osname=umips ;;
1674                         *) osname=mips ;;
1675                         esac;;
1676                 [23]100) osname=mips ;;
1677                 next*) osname=next ;;
1678                 i386*)
1679                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
1680                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
1681                                 osname='sco'
1682                                 osvers=$tmp
1683                         elif $test -f /etc/kconfig; then
1684                                 osname=isc
1685                                 if test "$lns" = "$ln -s"; then
1686                                         osvers=4
1687                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
1688                                         osvers=3
1689                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
1690                                         osvers=2
1691                                 fi
1692                         fi
1693                         tmp=''
1694                         ;;
1695                 pc*)
1696                         if test -n "$DJGPP"; then
1697                                 osname=dos
1698                                 osvers=djgpp
1699                         fi
1700                         ;;
1701                 esac
1702
1703                 case "$1" in
1704                 aix) osname=aix
1705                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
1706                         case "$tmp" in
1707                         'not found') osvers="$4"."$3" ;;
1708                         '<3240'|'<>3240') osvers=3.2.0 ;;
1709                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
1710                         '=3250'|'>3250') osvers=3.2.5 ;;
1711                         *) osvers=$tmp;;
1712                         esac
1713                         ;;
1714                 bsd386) osname=bsd386
1715                         osvers=`$uname -r`
1716                         ;;
1717                 cygwin*) osname=cygwin
1718                         osvers="$3"
1719                         ;;
1720                 *dc.osx) osname=dcosx
1721                         osvers="$3"
1722                         ;;
1723                 dnix) osname=dnix
1724                         osvers="$3"
1725                         ;;
1726                 domainos) osname=apollo
1727                         osvers="$3"
1728                         ;;
1729                 dgux) osname=dgux 
1730                         osvers="$3"
1731                         ;;
1732                 dynixptx*) osname=dynixptx
1733                         osvers=`echo "$4"|sed 's/^v//'`
1734                         ;;
1735                 freebsd) osname=freebsd 
1736                         osvers="$3" ;;
1737                 genix) osname=genix ;;
1738                 hp*) osname=hpux 
1739                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
1740                         ;;
1741                 irix*) osname=irix
1742                         case "$3" in
1743                         4*) osvers=4 ;;
1744                         5*) osvers=5 ;;
1745                         *)      osvers="$3" ;;
1746                         esac
1747                         ;;
1748                 linux) osname=linux
1749                         case "$3" in
1750                         *)      osvers="$3" ;;
1751                         esac
1752                         ;;
1753                 MiNT) osname=mint
1754                         ;;
1755                 netbsd*) osname=netbsd
1756                         osvers="$3"
1757                         ;;
1758                 news-os) osvers="$3"
1759                         case "$3" in
1760                         4*) osname=newsos4 ;;
1761                         *) osname=newsos ;;
1762                         esac
1763                         ;;
1764                 next*) osname=next ;;
1765                 POSIX-BC | posix-bc ) osname=posix-bc
1766                         osvers="$3"
1767                         ;;
1768                 powerux | power_ux | powermax_os | powermaxos | \
1769                 powerunix | power_unix) osname=powerux
1770                         osvers="$3"
1771                         ;;
1772                 qnx) osname=qnx
1773                         osvers="$4"
1774                         ;;
1775                 solaris) osname=solaris
1776                         case "$3" in
1777                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
1778                         *)      osvers="$3" ;;
1779                         esac
1780                         ;;
1781                 sunos) osname=sunos
1782                         case "$3" in
1783                         5*) osname=solaris
1784                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
1785                         *)      osvers="$3" ;;
1786                         esac
1787                         ;;
1788                 titanos) osname=titanos
1789                         case "$3" in
1790                         1*) osvers=1 ;;
1791                         2*) osvers=2 ;;
1792                         3*) osvers=3 ;;
1793                         4*) osvers=4 ;;
1794                         *)      osvers="$3" ;;
1795                         esac
1796                         ;;
1797                 ultrix) osname=ultrix
1798                         osvers="$3"
1799                         ;;
1800                 osf1|mls+)      case "$5" in
1801                                 alpha)
1802                                         osname=dec_osf
1803                                         osvers=`sizer -v | awk '{print $3}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
1804                                         case "$osvers" in
1805                                         [1-9].[0-9]*) ;;
1806                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
1807                                         esac
1808                                         ;;
1809                         hp*)    osname=hp_osf1  ;;
1810                         mips)   osname=mips_osf1 ;;
1811                         esac
1812                         ;;
1813                 unixware) osname=svr5
1814                         osvers="$4"
1815                         ;;
1816                 uts) osname=uts
1817                         osvers="$3"
1818                         ;;
1819                 $2) case "$osname" in
1820                         *isc*) ;;
1821                         *freebsd*) ;;
1822                         svr*)
1823                                 : svr4.x or possibly later
1824                                 case "svr$3" in 
1825                                 ${osname}*)
1826                                         osname=svr$3
1827                                         osvers=$4
1828                                         ;;
1829                                 esac
1830                                 case "$osname" in
1831                                 svr4.0)
1832                                         : Check for ESIX
1833                                         if test -f /stand/boot ; then
1834                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
1835                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
1836                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
1837                                                         if test -n "$isesix"; then
1838                                                                 osname=esix4
1839                                                         fi
1840                                                 fi
1841                                         fi
1842                                         ;;
1843                                 esac
1844                                 ;;
1845                         *)      if test -f /etc/systemid; then
1846                                         osname=sco
1847                                         set `echo $3 | $sed 's/\./ /g'` $4
1848                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
1849                                                 osvers=$1.$2.$3
1850                                         elif $test -f $src/hints/sco_$1_$2.sh; then
1851                                                 osvers=$1.$2
1852                                         elif $test -f $src/hints/sco_$1.sh; then
1853                                                 osvers=$1
1854                                         fi
1855                                 else
1856                                         case "$osname" in
1857                                         '') : Still unknown.  Probably a generic Sys V.
1858                                                 osname="sysv"
1859                                                 osvers="$3"
1860                                                 ;;
1861                                         esac
1862                                 fi
1863                                 ;;
1864                         esac
1865                         ;;
1866                 *)      case "$osname" in
1867                         '') : Still unknown.  Probably a generic BSD.
1868                                 osname="$1"
1869                                 osvers="$3"
1870                                 ;;
1871                         esac
1872                         ;;
1873                 esac
1874         else
1875                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
1876                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
1877                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
1878                                 osname=news_os
1879                         fi
1880                         $rm -f UU/kernel.what
1881                 elif test -d c:/.; then
1882                         set X $myuname
1883                         osname=os2
1884                         osvers="$5"
1885                 fi
1886         fi
1887         
1888         : Now look for a hint file osname_osvers, unless one has been
1889         : specified already.
1890         case "$hintfile" in
1891         ''|' ')
1892                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
1893                 : Also try without trailing minor version numbers.
1894                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
1895                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
1896                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
1897                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
1898                 case "$file" in
1899                 '') dflt=none ;;
1900                 *)  case "$osvers" in
1901                         '') dflt=$file
1902                                 ;;
1903                         *)  if $test -f $src/hints/$file.sh ; then
1904                                         dflt=$file
1905                                 elif $test -f $src/hints/$xfile.sh ; then
1906                                         dflt=$xfile
1907                                 elif $test -f $src/hints/$xxfile.sh ; then
1908                                         dflt=$xxfile
1909                                 elif $test -f $src/hints/$xxxfile.sh ; then
1910                                         dflt=$xxxfile
1911                                 elif $test -f $src/hints/$xxxxfile.sh ; then
1912                                         dflt=$xxxxfile
1913                                 elif $test -f "$src/hints/${osname}.sh" ; then
1914                                         dflt="${osname}"
1915                                 else
1916                                         dflt=none
1917                                 fi
1918                                 ;;
1919                         esac
1920                         ;;
1921                 esac
1922                 if $test -f Policy.sh ; then
1923                         case "$dflt" in
1924                         *Policy*) ;;
1925                         none) dflt="Policy" ;;
1926                         *) dflt="Policy $dflt" ;;
1927                         esac
1928                 fi
1929                 ;;
1930         *)
1931                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
1932                 ;;
1933         esac
1934
1935         if $test -f Policy.sh ; then
1936                 $cat <<EOM
1937
1938 There's also a Policy hint file available, which should make the
1939 site-specific (policy) questions easier to answer.
1940 EOM
1941
1942         fi
1943
1944         $cat <<EOM
1945
1946 You may give one or more space-separated answers, or "none" if appropriate.
1947 A well-behaved OS will have no hints, so answering "none" or just "Policy"
1948 is a good thing.  DO NOT give a wrong version or a wrong OS.
1949
1950 EOM
1951
1952         rp="Which of these apply, if any?"
1953         . UU/myread
1954         tans=$ans
1955         for file in $tans; do
1956                 if $test X$file = XPolicy -a -f Policy.sh; then
1957                         . Policy.sh
1958                         $cat Policy.sh >> UU/config.sh
1959                 elif $test -f $src/hints/$file.sh; then
1960                         . $src/hints/$file.sh
1961                         $cat $src/hints/$file.sh >> UU/config.sh
1962                 elif $test X$tans = X -o X$tans = Xnone ; then
1963                         : nothing
1964                 else
1965                         : Give one chance to correct a possible typo.
1966                         echo "$file.sh does not exist"
1967                         dflt=$file
1968                         rp="hint to use instead?"
1969                         . UU/myread
1970                         for file in $ans; do
1971                                 if $test -f "$src/hints/$file.sh"; then
1972                                         . $src/hints/$file.sh
1973                                         $cat $src/hints/$file.sh >> UU/config.sh
1974                                 elif $test X$ans = X -o X$ans = Xnone ; then
1975                                         : nothing
1976                                 else
1977                                         echo "$file.sh does not exist -- ignored."
1978                                 fi
1979                         done
1980                 fi
1981         done
1982
1983         hint=recommended
1984         : Remember our hint file for later.
1985         if $test -f "$src/hints/$file.sh" ; then
1986                 hintfile="$file"
1987         else
1988                 hintfile=''
1989         fi
1990 fi
1991 cd UU
1992 ;;
1993 *)
1994         echo " "
1995         echo "Fetching default answers from $config_sh..." >&4
1996         tmp_n="$n"
1997         tmp_c="$c"
1998         cd ..
1999         cp $config_sh config.sh 2>/dev/null
2000         chmod +w config.sh
2001         . ./config.sh
2002         cd UU
2003         cp ../config.sh .
2004         n="$tmp_n"
2005         c="$tmp_c"
2006         hint=previous
2007         ;;
2008 esac
2009 test "$override" && . ./optdef.sh
2010 myuname="$newmyuname"
2011
2012 : Restore computed paths
2013 for file in $loclist $trylist; do
2014         eval $file="\$_$file"
2015 done
2016
2017 cat << EOM
2018
2019 Configure uses the operating system name and version to set some defaults.
2020 The default value is probably right if the name rings a bell. Otherwise,
2021 since spelling matters for me, either accept the default or answer "none"
2022 to leave it blank.
2023
2024 EOM
2025 case "$osname" in
2026         ''|' ')
2027                 case "$hintfile" in
2028                 ''|' '|none) dflt=none ;;
2029                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2030                 esac
2031                 ;;
2032         *) dflt="$osname" ;;
2033 esac
2034 rp="Operating system name?"
2035 . ./myread
2036 case "$ans" in
2037 none)  osname='' ;;
2038 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2039 esac
2040 echo " "
2041 case "$osvers" in
2042         ''|' ')
2043                 case "$hintfile" in
2044                 ''|' '|none) dflt=none ;;
2045                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2046                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2047                         case "$dflt" in
2048                         ''|' ') dflt=none ;;
2049                         esac
2050                         ;;
2051                 esac
2052                 ;;
2053         *) dflt="$osvers" ;;
2054 esac
2055 rp="Operating system version?"
2056 . ./myread
2057 case "$ans" in
2058 none)  osvers='' ;;
2059 *) osvers="$ans" ;;
2060 esac
2061
2062
2063 . ./posthint.sh
2064
2065 : who configured the system
2066 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2067 cf_by=`(logname) 2>/dev/null`
2068 case "$cf_by" in
2069 "")
2070         cf_by=`(whoami) 2>/dev/null`
2071         case "$cf_by" in
2072         "") cf_by=unknown ;;
2073         esac ;;
2074 esac
2075
2076 : make some quick guesses about what we are up against
2077 echo " "
2078 $echo $n "Hmm...  $c"
2079 echo exit 1 >bsd
2080 echo exit 1 >usg
2081 echo exit 1 >v7
2082 echo exit 1 >osf1
2083 echo exit 1 >eunice
2084 echo exit 1 >xenix
2085 echo exit 1 >venix
2086 echo exit 1 >os2
2087 d_bsd="$undef"
2088 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2089 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2090 then
2091         echo "Looks kind of like an OSF/1 system, but we'll see..."
2092         echo exit 0 >osf1
2093 elif test `echo abc | tr a-z A-Z` = Abc ; then
2094         xxx=`./loc addbib blurfl $pth`
2095         if $test -f $xxx; then
2096         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2097                 echo exit 0 >bsd
2098                 echo exit 0 >usg
2099         else
2100                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2101                         echo "Looks kind of like an extended USG system, but we'll see..."
2102                 else
2103                         echo "Looks kind of like a USG system, but we'll see..."
2104                 fi
2105                 echo exit 0 >usg
2106         fi
2107 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2108         echo "Looks kind of like a BSD system, but we'll see..."
2109         d_bsd="$define"
2110         echo exit 0 >bsd
2111 else
2112         echo "Looks kind of like a Version 7 system, but we'll see..."
2113         echo exit 0 >v7
2114 fi
2115 case "$eunicefix" in
2116 *unixtovms*)
2117         $cat <<'EOI'
2118 There is, however, a strange, musty smell in the air that reminds me of
2119 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2120 EOI
2121         echo exit 0 >eunice
2122         d_eunice="$define"
2123 : it so happens the Eunice I know will not run shell scripts in Unix format
2124         ;;
2125 *)
2126         echo " "
2127         echo "Congratulations.  You aren't running Eunice."
2128         d_eunice="$undef"
2129         ;;
2130 esac
2131 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2132 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
2133 : semicolon as a patch separator
2134 case "$p_" in
2135 :) ;;
2136 *)
2137         $cat <<'EOI'
2138 I have the feeling something is not exactly right, however...don't tell me...
2139 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2140 (Or you may be running DOS with DJGPP.)
2141 EOI
2142         echo exit 0 >os2
2143         ;;
2144 esac
2145 if test -f /xenix; then
2146         echo "Actually, this looks more like a XENIX system..."
2147         echo exit 0 >xenix
2148         d_xenix="$define"
2149 else
2150         echo " "
2151         echo "It's not Xenix..."
2152         d_xenix="$undef"
2153 fi
2154 chmod +x xenix
2155 $eunicefix xenix
2156 if test -f /venix; then
2157         echo "Actually, this looks more like a VENIX system..."
2158         echo exit 0 >venix
2159 else
2160         echo " "
2161         if ./xenix; then
2162                 : null
2163         else
2164                 echo "Nor is it Venix..."
2165         fi
2166 fi
2167 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2168 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2169 $rm -f foo
2170
2171 case "$cc" in
2172 '') dflt=cc;;
2173 *) dflt="$cc";;
2174 esac
2175 rp="Use which C compiler?"
2176 . ./myread
2177 cc="$ans"
2178 : Look for a hint-file generated 'call-back-unit'.  Now that the
2179 : user has specified the compiler, we may need to set or change some
2180 : other defaults.
2181 if $test -f cc.cbu; then
2182     . ./cc.cbu
2183 fi
2184 . ./checkcc
2185
2186 echo " "
2187 echo "Checking for GNU cc in disguise and/or its version number..." >&4
2188 $cat >gccvers.c <<EOM
2189 #include <stdio.h>
2190 int main() {
2191 #ifdef __GNUC__
2192 #ifdef __VERSION__
2193         printf("%s\n", __VERSION__);
2194 #else
2195         printf("%s\n", "1");
2196 #endif
2197 #endif
2198         exit(0);
2199 }
2200 EOM
2201 if $cc $ldflags -o gccvers gccvers.c; then
2202         gccversion=`./gccvers`
2203         case "$gccversion" in
2204         '') echo "You are not using GNU cc." ;;
2205         *)  echo "You are using GNU cc $gccversion."
2206             ccname=gcc  
2207             ;;
2208         esac
2209 else
2210         echo " "
2211         echo "*** WHOA THERE!!! ***" >&4
2212         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
2213         case "$knowitall" in
2214         '')
2215         echo "    You'd better start hunting for one and let me know about it." >&4
2216                 exit 1
2217                 ;;
2218         esac
2219 fi
2220 $rm -f gccvers*
2221 case "$gccversion" in
2222 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
2223 esac
2224 case "$gccversion" in
2225 '') gccosandvers='' ;;
2226 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
2227    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
2228    gccshortvers=''
2229    case "$gccosandvers" in
2230    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
2231    $osname$osvers) ;; # looking good
2232    $osname*) cat <<EOM >&4
2233
2234 *** WHOA THERE!!! ***
2235
2236     Your gcc has not been compiled for the exact release of
2237     your operating system ($gccosandvers versus $osname$osvers).
2238
2239     In general it is a good idea to keep gcc synchronized with
2240     the operating system because otherwise serious problems
2241     may ensue when trying to compile software, like Perl.
2242
2243     I'm trying to be optimistic here, though, and will continue.
2244     If later during the configuration and build icky compilation
2245     problems appear (headerfile conflicts being the most common
2246     manifestation), I suggest reinstalling the gcc to match
2247     your operating system release.
2248
2249 EOM
2250       ;;
2251    *) gccosandvers='' ;; # failed to parse, better be silent
2252    esac
2253    ;;
2254 esac
2255 case "$ccname" in
2256 '') ccname="$cc" ;;
2257 esac
2258
2259 : see how we invoke the C preprocessor
2260 echo " "
2261 echo "Now, how can we feed standard input to your C preprocessor..." >&4
2262 cat <<'EOT' >testcpp.c
2263 #define ABC abc
2264 #define XYZ xyz
2265 ABC.XYZ
2266 EOT
2267 cd ..
2268 if test ! -f cppstdin; then
2269         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
2270                 # AIX cc -E doesn't show the absolute headerfile
2271                 # locations but we'll cheat by using the -M flag.
2272                 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
2273         else
2274                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
2275         fi
2276 else
2277         echo "Keeping your $hint cppstdin wrapper."
2278 fi
2279 chmod 755 cppstdin
2280 wrapper=`pwd`/cppstdin
2281 ok='false'
2282 cd UU
2283
2284 if $test "X$cppstdin" != "X" && \
2285         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
2286         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
2287 then
2288         echo "You used to use $cppstdin $cppminus so we'll use that again."
2289         case "$cpprun" in
2290         '') echo "But let's see if we can live without a wrapper..." ;;
2291         *)
2292                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
2293                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
2294                 then
2295                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
2296                         ok='true'
2297                 else
2298                         echo "(However, $cpprun $cpplast does not work, let's see...)"
2299                 fi
2300                 ;;
2301         esac
2302 else
2303         case "$cppstdin" in
2304         '') ;;
2305         *)
2306                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
2307                 ;;
2308         esac
2309 fi
2310
2311 if $ok; then
2312         : nothing
2313 elif echo 'Maybe "'"$cc"' -E" will work...'; \
2314         $cc -E <testcpp.c >testcpp.out 2>&1; \
2315         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2316         echo "Yup, it does."
2317         x_cpp="$cc -E"
2318         x_minus='';
2319 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
2320         $cc -E - <testcpp.c >testcpp.out 2>&1; \
2321         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2322         echo "Yup, it does."
2323         x_cpp="$cc -E"
2324         x_minus='-';
2325 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
2326         $cc -P <testcpp.c >testcpp.out 2>&1; \
2327         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2328         echo "Yipee, that works!"
2329         x_cpp="$cc -P"
2330         x_minus='';
2331 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
2332         $cc -P - <testcpp.c >testcpp.out 2>&1; \
2333         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2334         echo "At long last!"
2335         x_cpp="$cc -P"
2336         x_minus='-';
2337 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
2338         $cpp <testcpp.c >testcpp.out 2>&1; \
2339         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2340         echo "It works!"
2341         x_cpp="$cpp"
2342         x_minus='';
2343 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
2344         $cpp - <testcpp.c >testcpp.out 2>&1; \
2345         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2346         echo "Hooray, it works!  I was beginning to wonder."
2347         x_cpp="$cpp"
2348         x_minus='-';
2349 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
2350         $wrapper <testcpp.c >testcpp.out 2>&1; \
2351         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2352         x_cpp="$wrapper"
2353         x_minus=''
2354         echo "Eureka!"
2355 else
2356         dflt=''
2357         rp="No dice.  I can't find a C preprocessor.  Name one:"
2358         . ./myread
2359         x_cpp="$ans"
2360         x_minus=''
2361         $x_cpp <testcpp.c >testcpp.out 2>&1
2362         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2363                 echo "OK, that will do." >&4
2364         else
2365 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
2366                 exit 1
2367         fi
2368 fi
2369
2370 case "$ok" in
2371 false)
2372         cppstdin="$x_cpp"
2373         cppminus="$x_minus"
2374         cpprun="$x_cpp"
2375         cpplast="$x_minus"
2376         set X $x_cpp
2377         shift
2378         case "$1" in
2379         "$cpp")
2380                 echo "Perhaps can we force $cc -E using a wrapper..."
2381                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
2382                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
2383                 then
2384                         echo "Yup, we can."
2385                         cppstdin="$wrapper"
2386                         cppminus='';
2387                 else
2388                         echo "Nope, we'll have to live without it..."
2389                 fi
2390                 ;;
2391         esac
2392         case "$cpprun" in
2393         "$wrapper")
2394                 cpprun=''
2395                 cpplast=''
2396                 ;;
2397         esac
2398         ;;
2399 esac
2400
2401 case "$cppstdin" in
2402 "$wrapper"|'cppstdin') ;;
2403 *) $rm -f $wrapper;;
2404 esac
2405 $rm -f testcpp.c testcpp.out
2406
2407 : decide how portable to be.  Allow command line overrides.
2408 case "$d_portable" in
2409 "$undef") ;;
2410 *)      d_portable="$define" ;;
2411 esac
2412
2413 : set up shell script to do ~ expansion
2414 cat >filexp <<EOSS
2415 $startsh
2416 : expand filename
2417 case "\$1" in
2418  ~/*|~)
2419         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
2420         ;;
2421  ~*)
2422         if $test -f /bin/csh; then
2423                 /bin/csh -f -c "glob \$1"
2424                 failed=\$?
2425                 echo ""
2426                 exit \$failed
2427         else
2428                 name=\`$expr x\$1 : '..\([^/]*\)'\`
2429                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
2430                 if $test ! -d "\$dir"; then
2431                         me=\`basename \$0\`
2432                         echo "\$me: can't locate home directory for: \$name" >&2
2433                         exit 1
2434                 fi
2435                 case "\$1" in
2436                 */*)
2437                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
2438                         ;;
2439                 *)
2440                         echo \$dir
2441                         ;;
2442                 esac
2443         fi
2444         ;;
2445 *)
2446         echo \$1
2447         ;;
2448 esac
2449 EOSS
2450 chmod +x filexp
2451 $eunicefix filexp
2452
2453 : now set up to get a file name
2454 cat <<EOS >getfile
2455 $startsh
2456 EOS
2457 cat <<'EOSC' >>getfile
2458 tilde=''
2459 fullpath=''
2460 already=''
2461 skip=''
2462 none_ok=''
2463 exp_file=''
2464 nopath_ok=''
2465 orig_rp="$rp"
2466 orig_dflt="$dflt"
2467 case "$gfpth" in
2468 '') gfpth='.' ;;
2469 esac
2470
2471 case "$fn" in
2472 *\(*)
2473         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
2474         fn=`echo $fn | sed 's/(.*)//'`
2475         ;;
2476 esac
2477
2478 case "$fn" in
2479 *:*)
2480         loc_file=`expr $fn : '.*:\(.*\)'`
2481         fn=`expr $fn : '\(.*\):.*'`
2482         ;;
2483 esac
2484
2485 case "$fn" in
2486 *~*) tilde=true;;
2487 esac
2488 case "$fn" in
2489 */*) fullpath=true;;
2490 esac
2491 case "$fn" in
2492 *+*) skip=true;;
2493 esac
2494 case "$fn" in
2495 *n*) none_ok=true;;
2496 esac
2497 case "$fn" in
2498 *e*) exp_file=true;;
2499 esac
2500 case "$fn" in
2501 *p*) nopath_ok=true;;
2502 esac
2503
2504 case "$fn" in
2505 *f*) type='File';;
2506 *d*) type='Directory';;
2507 *l*) type='Locate';;
2508 esac
2509
2510 what="$type"
2511 case "$what" in
2512 Locate) what='File';;
2513 esac
2514
2515 case "$exp_file" in
2516 '')
2517         case "$d_portable" in
2518         "$define") ;;
2519         *) exp_file=true;;
2520         esac
2521         ;;
2522 esac
2523
2524 cd ..
2525 while test "$type"; do
2526         redo=''
2527         rp="$orig_rp"
2528         dflt="$orig_dflt"
2529         case "$tilde" in
2530         true) rp="$rp (~name ok)";;
2531         esac
2532         . UU/myread
2533         if test -f UU/getfile.ok && \
2534                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
2535         then
2536                 value="$ans"
2537                 ansexp="$ans"
2538                 break
2539         fi
2540         case "$ans" in
2541         none)
2542                 value=''
2543                 ansexp=''
2544                 case "$none_ok" in
2545                 true) type='';;
2546                 esac
2547                 ;;
2548         *)
2549                 case "$tilde" in
2550                 '') value="$ans"
2551                         ansexp="$ans";;
2552                 *)
2553                         value=`UU/filexp $ans`
2554                         case $? in
2555                         0)
2556                                 if test "$ans" != "$value"; then
2557                                         echo "(That expands to $value on this system.)"
2558                                 fi
2559                                 ;;
2560                         *) value="$ans";;
2561                         esac
2562                         ansexp="$value"
2563                         case "$exp_file" in
2564                         '') value="$ans";;
2565                         esac
2566                         ;;
2567                 esac
2568                 case "$fullpath" in
2569                 true)
2570                         case "$ansexp" in
2571                         /*) value="$ansexp" ;;
2572                         [a-zA-Z]:/*) value="$ansexp" ;;
2573                         *)
2574                                 redo=true
2575                                 case "$already" in
2576                                 true)
2577                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
2578                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
2579                                         ;;
2580                                 *)
2581                                 echo "Please give a full path name, starting with slash." >&4
2582                                         case "$tilde" in
2583                                         true)
2584                                 echo "Note that using ~name is ok provided it expands well." >&4
2585                                                 already=true
2586                                                 ;;
2587                                         esac
2588                                 esac
2589                                 ;;
2590                         esac
2591                         ;;
2592                 esac
2593                 case "$redo" in
2594                 '')
2595                         case "$type" in
2596                         File)
2597                                 for fp in $gfpth; do
2598                                         if test "X$fp" = X.; then
2599                                             pf="$ansexp"
2600                                         else    
2601                                             pf="$fp/$ansexp"
2602                                         fi
2603                                         if test -f "$pf"; then
2604                                                 type=''
2605                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
2606                                         then
2607                                                 echo "($value is not a plain file, but that's ok.)"
2608                                                 type=''
2609                                         fi
2610                                         if test X"$type" = X; then
2611                                             value="$pf"
2612                                             break
2613                                         fi
2614                                 done
2615                                 ;;
2616                         Directory)
2617                                 for fp in $gfpth; do
2618                                         if test "X$fp" = X.; then
2619                                             dir="$ans"
2620                                             direxp="$ansexp"
2621                                         else    
2622                                             dir="$fp/$ansexp"
2623                                             direxp="$fp/$ansexp"
2624                                         fi
2625                                         if test -d "$direxp"; then
2626                                                 type=''
2627                                                 value="$dir"
2628                                                 break
2629                                         fi
2630                                 done
2631                                 ;;
2632                         Locate)
2633                                 if test -d "$ansexp"; then
2634                                         echo "(Looking for $loc_file in directory $value.)"
2635                                         value="$value/$loc_file"
2636                                         ansexp="$ansexp/$loc_file"
2637                                 fi
2638                                 if test -f "$ansexp"; then
2639                                         type=''
2640                                 fi
2641                                 case "$nopath_ok" in
2642                                 true)   case "$value" in
2643                                         */*) ;;
2644                                         *)      echo "Assuming $value will be in people's path."
2645                                                 type=''
2646                                                 ;;
2647                                         esac
2648                                         ;;
2649                                 esac
2650                                 ;;
2651                         esac
2652
2653                         case "$skip" in
2654                         true) type='';
2655                         esac
2656
2657                         case "$type" in
2658                         '') ;;
2659                         *)
2660                                 if test "$fastread" = yes; then
2661                                         dflt=y
2662                                 else
2663                                         dflt=n
2664                                 fi
2665                                 rp="$what $value doesn't exist.  Use that name anyway?"
2666                                 . UU/myread
2667                                 dflt=''
2668                                 case "$ans" in
2669                                 y*) type='';;
2670                                 *) echo " ";;
2671                                 esac
2672                                 ;;
2673                         esac
2674                         ;;
2675                 esac
2676                 ;;
2677         esac
2678 done
2679 cd UU
2680 ans="$value"
2681 rp="$orig_rp"
2682 dflt="$orig_dflt"
2683 rm -f getfile.ok
2684 test "X$gfpthkeep" != Xy && gfpth=""
2685 EOSC
2686
2687 : What should the include directory be ?
2688 echo " "
2689 $echo $n "Hmm...  $c"
2690 dflt='/usr/include'
2691 incpath=''
2692 mips_type=''
2693 if $test -f /bin/mips && /bin/mips; then
2694         echo "Looks like a MIPS system..."
2695         $cat >usr.c <<'EOCP'
2696 #ifdef SYSTYPE_BSD43
2697 /bsd43
2698 #endif
2699 EOCP
2700         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
2701                 dflt='/bsd43/usr/include'
2702                 incpath='/bsd43'
2703                 mips_type='BSD 4.3'
2704         else
2705                 mips_type='System V'
2706         fi
2707         $rm -f usr.c usr.out
2708         echo "and you're compiling with the $mips_type compiler and libraries."
2709         xxx_prompt=y
2710         echo "exit 0" >mips
2711 else
2712         echo "Doesn't look like a MIPS system."
2713         xxx_prompt=n
2714         echo "exit 1" >mips
2715 fi
2716 chmod +x mips
2717 $eunicefix mips
2718 case "$usrinc" in
2719 '') ;;
2720 *) dflt="$usrinc";;
2721 esac
2722 case "$xxx_prompt" in
2723 y)      fn=d/
2724         echo " "
2725         rp='Where are the include files you want to use?'
2726         . ./getfile
2727         usrinc="$ans"
2728         ;;
2729 *)      usrinc="$dflt"
2730         ;;
2731 esac
2732
2733 : Set private lib path
2734 case "$plibpth" in
2735 '') if ./mips; then
2736                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
2737         fi;;
2738 esac
2739 case "$libpth" in
2740 ' ') dlist='';;
2741 '') dlist="$loclibpth $plibpth $glibpth";;
2742 *) dlist="$libpth";;
2743 esac
2744
2745 : Now check and see which directories actually exist, avoiding duplicates
2746 libpth=''
2747 for xxx in $dlist
2748 do
2749     if $test -d $xxx; then
2750                 case " $libpth " in
2751                 *" $xxx "*) ;;
2752                 *) libpth="$libpth $xxx";;
2753                 esac
2754     fi
2755 done
2756 $cat <<'EOM'
2757
2758 Some systems have incompatible or broken versions of libraries.  Among
2759 the directories listed in the question below, please remove any you
2760 know not to be holding relevant libraries, and add any that are needed.
2761 Say "none" for none.
2762
2763 EOM
2764 case "$libpth" in
2765 '') dflt='none';;
2766 *)
2767         set X $libpth
2768         shift
2769         dflt=${1+"$@"}
2770         ;;
2771 esac
2772 rp="Directories to use for library searches?"
2773 . ./myread
2774 case "$ans" in
2775 none) libpth=' ';;
2776 *) libpth="$ans";;
2777 esac
2778
2779 : compute shared library extension
2780 case "$so" in
2781 '')
2782         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
2783                 dflt='sl'
2784         else
2785                 dflt='so'
2786         fi
2787         ;;
2788 *) dflt="$so";;
2789 esac
2790 $cat <<EOM
2791
2792 On some systems, shared libraries may be available.  Answer 'none' if
2793 you want to suppress searching of shared libraries for the remainder
2794 of this configuration.
2795
2796 EOM
2797 rp='What is the file extension used for shared libraries?'
2798 . ./myread
2799 so="$ans"
2800
2801 : Define several unixisms.
2802 : Hints files or command line option can be used to override them.
2803 : The convoluted testing is in case hints files set either the old
2804 : or the new name.
2805 case "$_exe" in
2806 '')     case "$exe_ext" in
2807     '') ;;
2808         *)      _exe="$exe_ext" ;;
2809         esac
2810         ;;
2811 esac
2812 case "$_a" in
2813 '')     case "$lib_ext" in
2814     '') _a='.a';;
2815         *)      _a="$lib_ext" ;;
2816         esac
2817         ;;
2818 esac
2819 case "$_o" in
2820 '') case "$obj_ext" in
2821         '')     _o='.o';;
2822         *)      _o="$obj_ext";;
2823         esac
2824         ;;
2825 esac
2826 case "$p_" in
2827 '') case "$path_sep" in
2828         '')     p_=':';;
2829         *)      p_="$path_sep";;
2830         esac
2831         ;;
2832 esac
2833 exe_ext=$_exe
2834 lib_ext=$_a
2835 obj_ext=$_o
2836 path_sep=$p_
2837
2838 : set up the script used to warn in case of inconsistency
2839 cat <<EOS >whoa
2840 $startsh
2841 EOS
2842 cat <<'EOSC' >>whoa
2843 dflt=y
2844 echo " "
2845 echo "*** WHOA THERE!!! ***" >&4
2846 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2847 rp="    Keep the $hint value?"
2848 . ./myread
2849 case "$ans" in
2850 y) td=$was; tu=$was;;
2851 esac
2852 EOSC
2853
2854 : function used to set $1 to $val
2855 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2856 case "$val$was" in
2857 $define$undef) . ./whoa; eval "$var=\$td";;
2858 $undef$define) . ./whoa; eval "$var=\$tu";;
2859 *) eval "$var=$val";;
2860 esac'
2861
2862 case "$usesocks" in
2863 $define|true|[yY]*)     dflt='y';;
2864 *) dflt='n';;
2865 esac
2866 cat <<EOM
2867
2868 Perl can be built to use the SOCKS proxy protocol library.  To do so,
2869 Configure must be run with -Dusesocks.
2870
2871 If this doesn't make any sense to you, just accept the default '$dflt'.
2872 EOM
2873 rp='Build Perl for SOCKS?'
2874 . ./myread
2875 case "$ans" in
2876 y|Y)    val="$define" ;;     
2877 *)      val="$undef" ;;
2878 esac
2879 set usesocks
2880 eval $setvar
2881
2882 : Looking for optional libraries
2883 echo " "
2884 echo "Checking for optional libraries..." >&4
2885 case "$libs" in
2886 ' '|'') dflt='';;
2887 *) dflt="$libs";;
2888 esac
2889 case "$libswanted" in
2890 '') libswanted='c_s';;
2891 esac
2892 case "$usesocks" in
2893 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
2894 esac
2895 libsfound=''
2896 libsfiles=''
2897 libsdirs=''
2898 libspath=''
2899 for thisdir in $libpth $xlibpth; do
2900   test -d $thisdir && libspath="$libspath $thisdir"
2901 done
2902 for thislib in $libswanted; do
2903         for thisdir in $libspath; do
2904             xxx=''
2905             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
2906                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
2907                 $test -f "$xxx" && eval $libscheck
2908                 $test -f "$xxx" && libstyle=shared
2909             fi
2910             if test ! -f "$xxx"; then
2911                 xxx=$thisdir/lib$thislib.$so
2912                 $test -f "$xxx" && eval $libscheck
2913                 $test -f "$xxx" && libstyle=shared
2914             fi  
2915             if test ! -f "$xxx"; then
2916                 xxx=$thisdir/lib$thislib$_a
2917                 $test -f "$xxx" && eval $libscheck
2918                 $test -f "$xxx" && libstyle=static
2919             fi
2920             if test ! -f "$xxx"; then
2921                 xxx=$thisdir/$thislib$_a
2922                 $test -f "$xxx" && eval $libscheck
2923                 $test -f "$xxx" && libstyle=static
2924             fi
2925             if test ! -f "$xxx"; then
2926                 xxx=$thisdir/lib${thislib}_s$_a
2927                 $test -f "$xxx" && eval $libscheck
2928                 $test -f "$xxx" && libstyle=static
2929                 $test -f "$xxx" && thislib=${thislib}_s
2930             fi
2931             if test ! -f "$xxx"; then
2932                 xxx=$thisdir/Slib$thislib$_a
2933                 $test -f "$xxx" && eval $libscheck
2934                 $test -f "$xxx" && libstyle=static
2935             fi
2936             if $test -f "$xxx"; then
2937                 case "$libstyle" in
2938                 shared) echo "Found -l$thislib (shared)." ;;
2939                 static) echo "Found -l$thislib." ;;
2940                 *)      echo "Found -l$thislib ($libstyle)." ;;
2941                 esac
2942                 case " $dflt " in
2943                 *"-l$thislib "*);;
2944                 *) dflt="$dflt -l$thislib"
2945                    libsfound="$libsfound $xxx"
2946                    yyy=`basename $xxx`
2947                    libsfiles="$libsfiles $yyy"
2948                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
2949                    case " $libsdirs " in
2950                    *" $yyy "*) ;;
2951                    *) libsdirs="$libsdirs $yyy" ;;
2952                    esac
2953                    ;;
2954                 esac
2955                 break
2956             fi  
2957         done
2958         if $test ! -f "$xxx"; then
2959             echo "No -l$thislib."
2960         fi
2961 done
2962 set X $dflt
2963 shift
2964 dflt="$*"
2965 case "$libs" in
2966 '') dflt="$dflt";;
2967 *) dflt="$libs";;
2968 esac
2969 case "$dflt" in
2970 ' '|'') dflt='none';;
2971 esac
2972
2973 $cat <<EOM
2974
2975 In order to compile $package on your machine, a number of libraries
2976 are usually needed.  Include any other special libraries here as well.
2977 Say "none" for none.  The default list is almost always right.
2978 EOM
2979
2980 echo " "
2981 rp="What libraries to use?"
2982 . ./myread
2983 case "$ans" in
2984 none) libs=' ';;
2985 *) libs="$ans";;
2986 esac
2987
2988 : determine filename position in cpp output
2989 echo " "
2990 echo "Computing filename position in cpp output for #include directives..." >&4
2991 echo '#include <stdio.h>' > foo.c
2992 $cat >fieldn <<EOF
2993 $startsh
2994 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
2995 $grep '^[       ]*#.*stdio\.h' | \
2996 while read cline; do
2997         pos=1
2998         set \$cline
2999         while $test \$# -gt 0; do
3000                 if $test -r \`echo \$1 | $tr -d '"'\`; then
3001                         echo "\$pos"
3002                         exit 0
3003                 fi
3004                 shift
3005                 pos=\`expr \$pos + 1\`
3006         done
3007 done
3008 EOF
3009 chmod +x fieldn
3010 fieldn=`./fieldn`
3011 $rm -f foo.c fieldn
3012 case $fieldn in
3013 '') pos='???';;
3014 1) pos=first;;
3015 2) pos=second;;
3016 3) pos=third;;
3017 *) pos="${fieldn}th";;
3018 esac
3019 echo "Your cpp writes the filename in the $pos field of the line."
3020
3021 : locate header file
3022 $cat >findhdr <<EOF
3023 $startsh
3024 wanted=\$1
3025 name=''
3026 for usrincdir in $usrinc
3027 do
3028         if test -f \$usrincdir/\$wanted; then
3029                 echo "\$usrincdir/\$wanted"
3030                 exit 0
3031         fi
3032 done
3033 awkprg='{ print \$$fieldn }'
3034 echo "#include <\$wanted>" > foo\$\$.c
3035 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3036 $grep "^[       ]*#.*\$wanted" | \
3037 while read cline; do
3038         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
3039         case "\$name" in
3040         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
3041         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
3042         *) exit 2;;
3043         esac;
3044 done;
3045 #
3046 # status = 0: grep returned 0 lines, case statement not executed
3047 # status = 1: headerfile found
3048 # status = 2: while loop executed, no headerfile found
3049 #
3050 status=\$?
3051 $rm -f foo\$\$.c;
3052 if test \$status -eq 1; then
3053         exit 0;
3054 fi
3055 exit 1
3056 EOF
3057 chmod +x findhdr
3058
3059 : define an alternate in-header-list? function
3060 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
3061 cont=true; xxf="echo \"<\$1> found.\" >&4";
3062 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
3063 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
3064 esac;
3065 case $# in 4) instead=instead;; *) instead="at last";; esac;
3066 while $test "$cont"; do
3067         xxx=`./findhdr $1`
3068         var=$2; eval "was=\$$2";
3069         if $test "$xxx" && $test -r "$xxx";
3070         then eval $xxf;
3071         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
3072                 cont="";
3073         else eval $xxnf;
3074         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
3075         set $yyy; shift; shift; yyy=$@;
3076         case $# in 0) cont="";;
3077         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
3078                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
3079         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
3080                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
3081         esac;
3082 done;
3083 while $test "$yyy";
3084 do set $yyy; var=$2; eval "was=\$$2";
3085         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
3086         set $yyy; shift; shift; yyy=$@;
3087 done'
3088
3089 : see if dld is available
3090 set dld.h i_dld
3091 eval $inhdr
3092
3093 : determine optimization, if desired, or use for debug flag also
3094 case "$optimize" in
3095 ' '|$undef) dflt='none';;
3096 '') dflt='-O';;
3097 *) dflt="$optimize";;
3098 esac
3099 $cat <<EOH
3100
3101 By default, $package compiles with the -O flag to use the optimizer.
3102 Alternately, you might want to use the symbolic debugger, which uses
3103 the -g flag (on traditional Unix systems).  Either flag can be
3104 specified here.  To use neither flag, specify the word "none".
3105
3106 EOH
3107 rp="What optimizer/debugger flag should be used?"
3108 . ./myread
3109 optimize="$ans"
3110 case "$optimize" in
3111 'none') optimize=" ";;
3112 esac
3113
3114 dflt=''
3115 : We will not override a previous value, but we might want to
3116 : augment a hint file
3117 case "$hint" in
3118 default|recommended)
3119         case "$gccversion" in
3120         1*) dflt='-fpcc-struct-return' ;;
3121         esac
3122         case "$optimize" in
3123         *-g*) dflt="$dflt -DDEBUGGING";;
3124         esac
3125         case "$gccversion" in
3126         2*) if test -d /etc/conf/kconfig.d &&
3127                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3128                 then
3129                         dflt="$dflt -posix"
3130                 fi
3131                 ;;
3132         esac
3133         case "$gccversion" in
3134         1*) ;;
3135         2.[0-8]*) ;;
3136         ?*)     echo " "
3137                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
3138                 echo 'int main(void) { return 0; }' > gcctest.c
3139                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
3140                         echo "Yes, it does." 2>&1
3141                         case "$ccflags" in
3142                         *strict-aliasing*) 
3143                                 echo "Leaving current flags $ccflags alone." 2>&1
3144                                 ;;
3145                         *) dflt="$dflt -fno-strict-aliasing" ;;
3146                         esac
3147                 else
3148                         echo "Nope, it doesn't, but that's ok." 2>&1
3149                 fi
3150                 ;;
3151         esac
3152         ;;
3153 esac
3154
3155 case "$mips_type" in
3156 *BSD*|'') inclwanted="$locincpth $usrinc";;
3157 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3158 esac
3159 for thisincl in $inclwanted; do
3160         if $test -d $thisincl; then
3161                 if $test x$thisincl != x$usrinc; then
3162                         case "$dflt" in
3163                         *" -I$thisincl "*);;
3164                         *) dflt="$dflt -I$thisincl ";;
3165                         esac
3166                 fi
3167         fi
3168 done
3169
3170 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3171         xxx=true;
3172 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3173         xxx=true;
3174 else
3175         xxx=false;
3176 fi;
3177 if $xxx; then
3178         case "$dflt" in
3179         *$2*);;
3180         *) dflt="$dflt -D$2";;
3181         esac;
3182 fi'
3183
3184 set signal.h LANGUAGE_C; eval $inctest
3185
3186 case "$usesocks" in
3187 $define)
3188         ccflags="$ccflags -DSOCKS"
3189         ;;
3190 esac
3191
3192 case "$hint" in
3193 default|recommended) dflt="$ccflags $dflt" ;;
3194 *) dflt="$ccflags";;
3195 esac
3196
3197 case "$dflt" in
3198 ''|' ') dflt=none;;
3199 esac
3200
3201 $cat <<EOH
3202
3203 Your C compiler may want other flags.  For this question you should include
3204 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3205 but you should NOT include libraries or ld flags like -lwhatever.  If you
3206 want $package to honor its debug switch, you should include -DDEBUGGING here.
3207 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3208
3209 To use no flags, specify the word "none".
3210
3211 EOH
3212 set X $dflt
3213 shift
3214 dflt=${1+"$@"}
3215 rp="Any additional cc flags?"
3216 . ./myread
3217 case "$ans" in
3218 none) ccflags='';;
3219 *) ccflags="$ans";;
3220 esac
3221
3222 : the following weeds options from ccflags that are of no interest to cpp
3223 cppflags="$ccflags"
3224 case "$gccversion" in
3225 1*) cppflags="$cppflags -D__GNUC__"
3226 esac
3227 case "$mips_type" in
3228 '');;
3229 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3230 esac
3231 case "$cppflags" in
3232 '');;
3233 *)
3234         echo " "
3235         echo "Let me guess what the preprocessor flags are..." >&4
3236         set X $cppflags
3237         shift
3238         cppflags=''
3239         $cat >cpp.c <<'EOM'
3240 #define BLURFL foo
3241
3242 BLURFL xx LFRULB
3243 EOM
3244         previous=''
3245         for flag in $*
3246         do
3247                 case "$flag" in
3248                 -*) ftry="$flag";;
3249                 *) ftry="$previous $flag";;
3250                 esac
3251                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3252                         >cpp1.out 2>/dev/null && \
3253                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3254                         >cpp2.out 2>/dev/null && \
3255                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3256                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3257                 then
3258                         cppflags="$cppflags $ftry"
3259                         previous=''
3260                 else
3261                         previous="$flag"
3262                 fi
3263         done
3264         set X $cppflags
3265         shift
3266         cppflags=${1+"$@"}
3267         case "$cppflags" in
3268         *-*)  echo "They appear to be: $cppflags";;
3269         esac
3270         $rm -f cpp.c cpp?.out
3271         ;;
3272 esac
3273
3274 : flags used in final linking phase
3275 case "$ldflags" in
3276 '') if ./venix; then
3277                 dflt='-i -z'
3278         else
3279                 dflt=''
3280         fi
3281         case "$ccflags" in
3282         *-posix*) dflt="$dflt -posix" ;;
3283         esac
3284         ;;
3285 *) dflt="$ldflags";;
3286 esac
3287
3288 : Try to guess additional flags to pick up local libraries.
3289 for thislibdir in $libpth; do
3290         case " $loclibpth " in
3291         *" $thislibdir "*)
3292                 case "$dflt " in 
3293                 *"-L$thislibdir "*) ;;
3294                 *)  dflt="$dflt -L$thislibdir" ;;
3295                 esac
3296                 ;;
3297         esac
3298 done
3299
3300 case "$dflt" in
3301 '') dflt='none' ;;
3302 esac
3303
3304 $cat <<EOH
3305
3306 Your C linker may need flags.  For this question you should
3307 include -L/whatever and any other flags used by the C linker, but you
3308 should NOT include libraries like -lwhatever.
3309
3310 Make sure you include the appropriate -L/path flags if your C linker
3311 does not normally search all of the directories you specified above,
3312 namely
3313         $libpth
3314 To use no flags, specify the word "none".
3315
3316 EOH
3317
3318 rp="Any additional ld flags (NOT including libraries)?"
3319 . ./myread
3320 case "$ans" in
3321 none) ldflags='';;
3322 *) ldflags="$ans";;
3323 esac
3324 rmlist="$rmlist pdp11"
3325
3326 : coherency check
3327 echo " "
3328 echo "Checking your choice of C compiler and flags for coherency..." >&4
3329 $cat > try.c <<'EOF'
3330 #include <stdio.h>
3331 int main() { printf("Ok\n"); exit(0); }
3332 EOF
3333 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
3334 shift
3335 $cat >try.msg <<'EOM'
3336 I've tried to compile and run the following simple program:
3337
3338 EOM
3339 $cat try.c >> try.msg
3340
3341 $cat >> try.msg <<EOM
3342
3343 I used the command:
3344
3345         $*
3346         ./try
3347
3348 and I got the following output:
3349
3350 EOM
3351 dflt=y
3352 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
3353         if sh -c './try' >>try.msg 2>&1; then
3354                 xxx=`./try`
3355                 case "$xxx" in
3356                 "Ok") dflt=n ;;
3357                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
3358                         case " $libs " in
3359                         *" -lsfio "*)
3360                                 cat >> try.msg <<'EOQS'
3361 If $libs contains -lsfio, and sfio is mis-configured, then it
3362 sometimes (apparently) runs and exits with a 0 status, but with no
3363 output!  It may have to do with sfio's use of _exit vs. exit.
3364
3365 EOQS
3366                                 rp="You have a big problem.  Shall I abort Configure"
3367                                 dflt=y
3368                                 ;;
3369                         esac
3370                         ;;
3371                 esac
3372         else
3373                 echo "The program compiled OK, but exited with status $?." >>try.msg
3374                 rp="You have a problem.  Shall I abort Configure"
3375                 dflt=y
3376         fi
3377 else
3378         echo "I can't compile the test program." >>try.msg
3379         rp="You have a BIG problem.  Shall I abort Configure"
3380         dflt=y
3381 fi
3382 case "$dflt" in
3383 y)
3384         $cat try.msg >&4
3385         case "$knowitall" in
3386         '')
3387                 echo "(The supplied flags or libraries might be incorrect.)"
3388                 ;;
3389         *) dflt=n;;
3390         esac
3391         echo " "
3392         . ./myread
3393         case "$ans" in
3394         n*|N*) ;;
3395         *)      echo "Ok.  Stopping Configure." >&4
3396                 exit 1
3397                 ;;
3398         esac
3399         ;;
3400 n) echo "OK, that should do.";;
3401 esac
3402 $rm -f try try.* core
3403
3404 : define a shorthand compile call
3405 compile='
3406 mc_file=$1;
3407 shift;
3408 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
3409 : define a shorthand compile call for compilations that should be ok.
3410 compile_ok='
3411 mc_file=$1;
3412 shift;
3413 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
3414
3415 echo " "
3416 echo "Checking for GNU C Library..." >&4
3417 cat >gnulibc.c <<EOM
3418 #include <stdio.h>
3419 int main()
3420 {
3421 #ifdef __GLIBC__
3422     exit(0);
3423 #else
3424     exit(1);
3425 #endif
3426 }
3427 EOM
3428 set gnulibc
3429 if eval $compile_ok && ./gnulibc; then
3430         val="$define"
3431         echo "You are using the GNU C Library"
3432 else
3433         val="$undef"
3434         echo "You are not using the GNU C Library"
3435 fi
3436 $rm -f gnulibc*
3437 set d_gnulibc
3438 eval $setvar
3439
3440 : see if nm is to be used to determine whether a symbol is defined or not
3441 case "$usenm" in
3442 '')
3443         dflt=''
3444         case "$d_gnulibc" in
3445         "$define")
3446                 echo " "
3447                 echo "nm probably won't work on the GNU C Library." >&4
3448                 dflt=n
3449                 ;;
3450         esac
3451         case "$dflt" in
3452         '') 
3453                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
3454                         echo " "
3455                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
3456                         echo "'nm' won't be sufficient on this sytem." >&4
3457                         dflt=n
3458                 fi
3459                 ;;
3460         esac
3461         case "$dflt" in
3462         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
3463                 if $test $dflt -gt 20; then
3464                         dflt=y
3465                 else
3466                         dflt=n
3467                 fi
3468                 ;;
3469         esac
3470         ;;
3471 *)
3472         case "$usenm" in
3473         true|$define) dflt=y;;
3474         *) dflt=n;;
3475         esac
3476         ;;
3477 esac
3478 $cat <<EOM
3479
3480 I can use $nm to extract the symbols from your C libraries. This
3481 is a time consuming task which may generate huge output on the disk (up
3482 to 3 megabytes) but that should make the symbols extraction faster. The
3483 alternative is to skip the 'nm' extraction part and to compile a small
3484 test program instead to determine whether each symbol is present. If
3485 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
3486 this may be the best solution.
3487
3488 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
3489
3490 EOM
3491 rp="Shall I use $nm to extract C symbols from the libraries?"
3492 . ./myread
3493 case "$ans" in
3494 [Nn]*) usenm=false;;
3495 *) usenm=true;;
3496 esac
3497
3498 runnm=$usenm
3499 case "$reuseval" in
3500 true) runnm=false;;
3501 esac
3502
3503 : nm options which may be necessary
3504 case "$nm_opt" in
3505 '') if $test -f /mach_boot; then
3506                 nm_opt=''       # Mach
3507         elif $test -d /usr/ccs/lib; then
3508                 nm_opt='-p'     # Solaris (and SunOS?)
3509         elif $test -f /dgux; then
3510                 nm_opt='-p'     # DG-UX
3511         elif $test -f /lib64/rld; then
3512                 nm_opt='-p'     # 64-bit Irix
3513         else
3514                 nm_opt=''
3515         fi;;
3516 esac
3517
3518 : nm options which may be necessary for shared libraries but illegal
3519 : for archive libraries.  Thank you, Linux.
3520 case "$nm_so_opt" in
3521 '')     case "$myuname" in
3522         *linux*)
3523                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
3524                         nm_so_opt='--dynamic'
3525                 fi
3526                 ;;
3527         esac
3528         ;;
3529 esac
3530
3531 case "$runnm" in
3532 true)
3533 : get list of predefined functions in a handy place
3534 echo " "
3535 case "$libc" in
3536 '') libc=unknown
3537         case "$libs" in
3538         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
3539         esac
3540         ;;
3541 esac
3542 libnames='';
3543 case "$libs" in
3544 '') ;;
3545 *)  for thislib in $libs; do
3546         case "$thislib" in
3547         -lc|-lc_s)
3548                 : Handle C library specially below.
3549                 ;;
3550         -l*)
3551                 thislib=`echo $thislib | $sed -e 's/^-l//'`
3552                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
3553                         :
3554                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
3555                         :
3556                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
3557                         :
3558                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
3559                         :
3560                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
3561                         :
3562                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
3563                         :
3564                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
3565                         :
3566                 else
3567                         try=''
3568                 fi
3569                 libnames="$libnames $try"
3570                 ;;
3571         *) libnames="$libnames $thislib" ;;
3572         esac
3573         done
3574         ;;
3575 esac
3576 xxx=normal
3577 case "$libc" in
3578 unknown)
3579         set /lib/libc.$so
3580         for xxx in $libpth; do
3581                 $test -r $1 || set $xxx/libc.$so
3582                 : The messy sed command sorts on library version numbers.
3583                 $test -r $1 || \
3584                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
3585                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
3586                                 h
3587                                 s/[0-9][0-9]*/0000&/g
3588                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
3589                                 G
3590                                 s/\n/ /' | \
3591                          sort | $sed -e 's/^.* //'`
3592                 eval set \$$#
3593         done
3594         $test -r $1 || set /usr/ccs/lib/libc.$so
3595         $test -r $1 || set /lib/libsys_s$_a
3596         ;;
3597 *)
3598         set blurfl
3599         ;;
3600 esac
3601 if $test -r "$1"; then
3602         echo "Your (shared) C library seems to be in $1."
3603         libc="$1"
3604 elif $test -r /lib/libc && $test -r /lib/clib; then
3605         echo "Your C library seems to be in both /lib/clib and /lib/libc."
3606         xxx=apollo
3607         libc='/lib/clib /lib/libc'
3608         if $test -r /lib/syslib; then
3609                 echo "(Your math library is in /lib/syslib.)"
3610                 libc="$libc /lib/syslib"
3611         fi
3612 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
3613         echo "Your C library seems to be in $libc, as you said before."
3614 elif $test -r $incpath/usr/lib/libc$_a; then
3615         libc=$incpath/usr/lib/libc$_a;
3616         echo "Your C library seems to be in $libc.  That's fine."
3617 elif $test -r /lib/libc$_a; then
3618         libc=/lib/libc$_a;
3619         echo "Your C library seems to be in $libc.  You're normal."
3620 else
3621         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
3622                 :
3623         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
3624                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
3625         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
3626                 :
3627         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
3628                 :
3629         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
3630                 :
3631         else
3632                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
3633         fi
3634         if $test -r "$tans"; then
3635                 echo "Your C library seems to be in $tans, of all places."
3636                 libc=$tans
3637         else
3638                 libc='blurfl'
3639         fi
3640 fi
3641 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
3642         dflt="$libc"
3643         cat <<EOM
3644
3645 If the guess above is wrong (which it might be if you're using a strange
3646 compiler, or your machine supports multiple models), you can override it here.
3647
3648 EOM
3649 else
3650         dflt=''
3651         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
3652         cat >&4 <<EOM
3653 I can't seem to find your C library.  I've looked in the following places:
3654
3655 EOM
3656         $sed 's/^/      /' libpath
3657         cat <<EOM
3658
3659 None of these seems to contain your C library. I need to get its name...
3660
3661 EOM
3662 fi
3663 fn=f
3664 rp='Where is your C library?'
3665 . ./getfile
3666 libc="$ans"
3667
3668 echo " "
3669 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
3670 set X `cat libnames`
3671 shift
3672 xxx=files
3673 case $# in 1) xxx=file; esac
3674 echo "Extracting names from the following $xxx for later perusal:" >&4
3675 echo " "
3676 $sed 's/^/      /' libnames >&4
3677 echo " "
3678 $echo $n "This may take a while...$c" >&4
3679
3680 for file in $*; do
3681         case $file in
3682         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
3683         *) $nm $nm_opt $file 2>/dev/null;;
3684         esac
3685 done >libc.tmp
3686
3687 $echo $n ".$c"
3688 $grep fprintf libc.tmp > libc.ptf
3689 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
3690 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
3691 xxx='[ADTSIW]'
3692 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
3693         eval $xscan;\
3694         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3695                 eval $xrun
3696 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
3697         eval $xscan;\
3698         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3699                 eval $xrun
3700 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
3701         eval $xscan;\
3702         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3703                 eval $xrun
3704 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
3705         eval $xscan;\
3706         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3707                 eval $xrun
3708 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
3709         eval $xscan;\
3710         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3711                 eval $xrun
3712 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
3713         eval $xscan;\
3714         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3715                 eval $xrun
3716 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
3717                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
3718         eval $xscan;\
3719         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3720                 eval $xrun
3721 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
3722         eval $xscan;\
3723         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3724                 eval $xrun
3725 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
3726         eval $xscan;\
3727         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3728                 eval $xrun
3729 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
3730         eval $xscan;\
3731         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3732                 eval $xrun
3733 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
3734         eval $xscan;\
3735         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3736                 eval $xrun
3737 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
3738         eval $xscan;\
3739         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3740                 eval $xrun
3741 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
3742         eval $xscan;\
3743         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3744                 eval $xrun
3745 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
3746         eval $xscan;\
3747         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3748                 eval $xrun
3749 else
3750         $nm -p $* 2>/dev/null >libc.tmp
3751         $grep fprintf libc.tmp > libc.ptf
3752         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
3753                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
3754         then
3755                 nm_opt='-p'
3756                 eval $xrun
3757         else
3758                 echo " "
3759                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
3760                 com=''
3761                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
3762                         for thisname in $libnames $libc; do
3763                                 $ar t $thisname >>libc.tmp
3764                         done
3765                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
3766                         echo "Ok." >&4
3767                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
3768                         # Repeat libc to extract forwarders to DLL entries too
3769                         for thisname in $libnames $libc; do
3770                                 $ar tv $thisname >>libc.tmp
3771                                 # Revision 50 of EMX has bug in $ar.
3772                                 # it will not extract forwarders to DLL entries
3773                                 # Use emximp which will extract exactly them.
3774                                 emximp -o tmp.imp $thisname \
3775                                     2>/dev/null && \
3776                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
3777                                     < tmp.imp >>libc.tmp
3778                                 $rm tmp.imp
3779                         done
3780                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
3781                         echo "Ok." >&4
3782                 else
3783                         echo "$ar didn't seem to work right." >&4
3784                         echo "Maybe this is a Cray...trying bld instead..." >&4
3785                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
3786                         then
3787                                 for thisname in $libnames; do
3788                                         bld t $libnames | \
3789                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
3790                                         $ar t $thisname >>libc.tmp
3791                                 done
3792                                 echo "Ok." >&4
3793                         else
3794                                 echo "That didn't work either.  Giving up." >&4
3795                                 exit 1
3796                         fi
3797                 fi
3798         fi
3799 fi
3800 nm_extract="$com"
3801 if $test -f /lib/syscalls.exp; then
3802         echo " "
3803         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
3804         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
3805 fi
3806 ;;
3807 esac
3808 $rm -f libnames libpath
3809
3810 : is a C symbol defined?
3811 csym='tlook=$1;
3812 case "$3" in
3813 -v) tf=libc.tmp; tc=""; tdc="";;
3814 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
3815 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
3816 esac;
3817 tx=yes;
3818 case "$reuseval-$4" in
3819 true-) ;;
3820 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
3821 esac;
3822 case "$tx" in
3823 yes)
3824         case "$runnm" in
3825         true)
3826                 if $contains $tlook $tf >/dev/null 2>&1;
3827                 then tval=true;
3828                 else tval=false;
3829                 fi;;
3830         *)
3831                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
3832                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
3833                 then tval=true;
3834                 else tval=false;
3835                 fi;
3836                 $rm -f t t.c;;
3837         esac;;
3838 *)
3839         case "$tval" in
3840         $define) tval=true;;
3841         *) tval=false;;
3842         esac;;
3843 esac;
3844 eval "$2=$tval"'
3845
3846 : define an is-in-libc? function
3847 inlibc='echo " "; td=$define; tu=$undef;
3848 sym=$1; var=$2; eval "was=\$$2";
3849 tx=yes;
3850 case "$reuseval$was" in
3851 true) ;;
3852 true*) tx=no;;
3853 esac;
3854 case "$tx" in
3855 yes)
3856         set $sym tres -f;
3857         eval $csym;
3858         case "$tres" in
3859         true)
3860                 echo "$sym() found." >&4;
3861                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
3862         *)
3863                 echo "$sym() NOT found." >&4;
3864                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
3865         esac;;
3866 *)
3867         case "$was" in
3868         $define) echo "$sym() found." >&4;;
3869         *) echo "$sym() NOT found." >&4;;
3870         esac;;
3871 esac'
3872
3873 : see if dlopen exists
3874 xxx_runnm="$runnm"
3875 runnm=false
3876 set dlopen d_dlopen
3877 eval $inlibc
3878 runnm="$xxx_runnm"
3879
3880 : determine which dynamic loading, if any, to compile in
3881 echo " "
3882 dldir="ext/DynaLoader"
3883 case "$usedl" in
3884 $define|y|true)
3885         dflt='y'
3886         usedl="$define"
3887         ;;
3888 $undef|n|false)
3889         dflt='n'
3890         usedl="$undef"
3891         ;;
3892 *) 
3893         dflt='n'
3894         case "$d_dlopen" in
3895             $define) dflt='y' ;;
3896         esac
3897         case "$i_dld" in
3898             $define) dflt='y' ;;
3899         esac
3900         : Does a dl_xxx.xs file exist for this operating system
3901         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
3902         ;;
3903 esac
3904 rp="Do you wish to use dynamic loading?"
3905 . ./myread
3906 usedl="$ans"
3907 case "$ans" in
3908 y*) usedl="$define"
3909         case "$dlsrc" in
3910         '')
3911                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
3912                         dflt="$dldir/dl_${osname}.xs"
3913                 elif $test "$d_dlopen" = "$define" ; then
3914                         dflt="$dldir/dl_dlopen.xs"
3915                 elif $test "$i_dld" = "$define" ; then
3916                         dflt="$dldir/dl_dld.xs"
3917                 else
3918                         dflt=''
3919                 fi
3920                 ;;
3921         *)      dflt="$dldir/$dlsrc"
3922                 ;;
3923         esac
3924     echo "The following dynamic loading files are available:"
3925         : Can not go over to $dldir because getfile has path hard-coded in.
3926         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
3927         rp="Source file to use for dynamic loading"
3928         fn="fne"
3929         gfpth="$src"
3930         . ./getfile
3931         usedl="$define"
3932         : emulate basename
3933         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
3934
3935         $cat << EOM
3936
3937 Some systems may require passing special flags to $cc -c to
3938 compile modules that will be used to create a shared library.
3939 To use no flags, say "none".
3940
3941 EOM
3942     case "$cccdlflags" in
3943     '') case "$gccversion" in
3944                 '') case "$osname" in
3945                         hpux)   dflt='+z' ;;
3946                         next)   dflt='none' ;;
3947                         irix*)  dflt='-KPIC' ;;
3948                         svr4*|esix*|solaris) dflt='-KPIC' ;;
3949                         sunos)  dflt='-pic' ;;
3950                         *)      dflt='none' ;;
3951                     esac
3952                         ;;
3953                 *)  case "$osname" in
3954                         svr4*|esix*|solaris) dflt='-fPIC' ;;
3955                         *)      dflt='-fpic' ;;
3956                     esac ;;
3957             esac ;;
3958         ' ') dflt='none' ;;
3959     *)  dflt="$cccdlflags" ;;
3960     esac
3961     rp="Any special flags to pass to $cc -c to compile shared library modules?"
3962     . ./myread
3963     case "$ans" in
3964     none) cccdlflags=' ' ;;
3965     *) cccdlflags="$ans" ;;
3966     esac
3967
3968     cat << EOM
3969
3970 Some systems use ld to create libraries that can be dynamically loaded,
3971 while other systems (such as those using ELF) use $cc.
3972
3973 EOM
3974         case "$ld" in
3975         '')     $cat >try.c <<'EOM'
3976 /* Test for whether ELF binaries are produced */
3977 #include <fcntl.h>
3978 #include <stdlib.h>
3979 int main() {
3980         char b[4];
3981         int i = open("a.out",O_RDONLY);
3982         if(i == -1) 
3983                 exit(1); /* fail */
3984         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
3985                 exit(0); /* succeed (yes, it's ELF) */
3986         else
3987                 exit(1); /* fail */
3988 }
3989 EOM
3990                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
3991                         cat <<EOM
3992 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
3993 EOM
3994                         dflt="$cc"
3995                 else
3996                         echo "I'll use ld to build dynamic libraries."
3997                         dflt='ld'
3998                 fi
3999                 rm -f try.c a.out
4000                 ;;
4001         *)      dflt="$ld"
4002                 ;;
4003         esac
4004
4005     rp="What command should be used to create dynamic libraries?"
4006     . ./myread
4007         ld="$ans"
4008
4009     cat << EOM
4010
4011 Some systems may require passing special flags to $ld to create a
4012 library that can be dynamically loaded.  If your ld flags include
4013 -L/other/path options to locate libraries outside your loader's normal
4014 search path, you may need to specify those -L options here as well.  To
4015 use no flags, say "none".
4016
4017 EOM
4018     case "$lddlflags" in
4019     '') case "$osname" in
4020                         beos) dflt='-nostart' ;;
4021                         hpux) dflt='-b';
4022                               case "$gccversion" in
4023                               '') dflt="$dflt +vnocompatwarnings" ;;
4024                               esac
4025                               ;;        
4026                         linux|irix*)    dflt='-shared' ;;
4027                         next)  dflt='none' ;;
4028                         solaris) dflt='-G' ;;
4029                         sunos) dflt='-assert nodefinitions' ;;
4030                         svr4*|esix*) dflt="-G $ldflags" ;;
4031                 *)     dflt='none' ;;
4032                         esac
4033                         ;;
4034     *) dflt="$lddlflags" ;;
4035     esac
4036
4037         : Try to guess additional flags to pick up local libraries.
4038         : Be careful not to append to a plain 'none'
4039         case "$dflt" in
4040         none) dflt='' ;;
4041         esac
4042         for thisflag in $ldflags; do
4043                 case "$thisflag" in
4044                 -L*|-R*)
4045                         case " $dflt " in
4046                         *" $thisflag "*) ;;
4047                         *) dflt="$dflt $thisflag" ;;
4048                         esac
4049                         ;;
4050                 esac
4051         done
4052
4053         case "$dflt" in
4054         ''|' ') dflt='none' ;;
4055         esac
4056
4057     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
4058     . ./myread
4059     case "$ans" in
4060     none) lddlflags=' ' ;;
4061     *) lddlflags="$ans" ;;
4062     esac
4063
4064         cat <<EOM
4065
4066 Some systems may require passing special flags to $cc to indicate that
4067 the resulting executable will use dynamic linking.  To use no flags,
4068 say "none".
4069
4070 EOM
4071     case "$ccdlflags" in
4072     '') case "$osname" in
4073                 hpux)   dflt='-Wl,-E' ;;
4074                 linux)  dflt='-rdynamic' ;;
4075                 next)   dflt='none' ;;
4076                 sunos)  dflt='none' ;;
4077                 *)      dflt='none' ;;
4078             esac ;;
4079     ' ')  dflt='none' ;;
4080     *)  dflt="$ccdlflags" ;;
4081     esac
4082     rp="Any special flags to pass to $cc to use dynamic linking?"
4083     . ./myread
4084     case "$ans" in
4085     none) ccdlflags=' ' ;;
4086     *) ccdlflags="$ans" ;;
4087     esac
4088     ;;
4089 *)  usedl="$undef"
4090         ld='ld'
4091     dlsrc='dl_none.xs'
4092     lddlflags=''
4093     ccdlflags=''
4094     ;;
4095 esac
4096
4097 : Remove libraries needed only for extensions
4098 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
4099 case "$usedl" in
4100 $define|true|[yY]*)
4101         set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
4102         shift
4103         perllibs="$*"
4104         ;;
4105 *)      perllibs="$libs"
4106         ;;
4107 esac
4108
4109 : Remove build directory name from cppstdin so it can be used from
4110 : either the present location or the final installed location.
4111 echo " "
4112 : Get out of the UU directory to get correct path name.
4113 cd ..
4114 case "$cppstdin" in
4115 `pwd`/cppstdin)
4116         echo "Stripping down cppstdin path name"
4117         cppstdin=cppstdin
4118         ;;
4119 esac
4120 cd UU
4121
4122 : end of configuration questions
4123 echo " "
4124 echo "End of configuration questions."
4125 echo " "
4126
4127 : back to where it started
4128 if test -d ../UU; then
4129         cd ..
4130 fi
4131
4132 : configuration may be patched via a 'config.over' file
4133 if $test -f config.over; then
4134         echo " "
4135         dflt=y
4136         rp='I see a config.over file.  Do you wish to load it?'
4137         . UU/myread
4138         case "$ans" in
4139         n*) echo "OK, I'll ignore it.";;
4140         *)      . ./config.over
4141                 echo "Configuration override changes have been loaded."
4142                 ;;
4143         esac
4144 fi
4145
4146 : in case they want portability, strip down executable paths
4147 case "$d_portable" in
4148 "$define")
4149         echo " "
4150         echo "Stripping down executable paths..." >&4
4151         for file in $loclist $trylist; do
4152                 eval temp=\$$file
4153                 eval $file=`basename $temp`
4154         done
4155         ;;
4156 esac
4157
4158 : create config.sh file
4159 echo " "
4160 echo "Creating config.sh..." >&4
4161 $spitshell <<EOT >config.sh
4162 $startsh
4163 #
4164 # This file was produced by running the Configure script. It holds all the
4165 # definitions figured out by Configure. Should you modify one of these values,
4166 # do not forget to propagate your changes by running "Configure -der". You may
4167 # instead choose to run each of the .SH files by yourself, or "Configure -S".
4168 #
4169
4170 # Package name      : $package
4171 # Source directory  : $src
4172 # Configuration time: $cf_time
4173 # Configured by     : $cf_by
4174 # Target system     : $myuname
4175
4176 Author='$Author'
4177 Date='$Date'
4178 Header='$Header'
4179 Id='$Id'
4180 Locker='$Locker'
4181 Log='$Log'
4182 Mcc='$Mcc'
4183 RCSfile='$RCSfile'
4184 Revision='$Revision'
4185 Source='$Source'
4186 State='$State'
4187 _a='$_a'
4188 _exe='$_exe'
4189 _o='$_o'
4190 ar='$ar'
4191 archobjs='$archobjs'
4192 awk='$awk'
4193 bash='$bash'
4194 bison='$bison'
4195 byacc='$byacc'
4196 c='$c'
4197 cat='$cat'
4198 cc='$cc'
4199 cccdlflags='$cccdlflags'
4200 ccdlflags='$ccdlflags'
4201 ccflags='$ccflags'
4202 ccname='$ccname'
4203 ccversion='$ccversion'
4204 cf_by='$cf_by'
4205 cf_time='$cf_time'
4206 chgrp='$chgrp'
4207 chmod='$chmod'
4208 chown='$chown'
4209 comm='$comm'
4210 compress='$compress'
4211 contains='$contains'
4212 cp='$cp'
4213 cpio='$cpio'
4214 cpp='$cpp'
4215 cppflags='$cppflags'
4216 cpplast='$cpplast'
4217 cppminus='$cppminus'
4218 cpprun='$cpprun'
4219 cppstdin='$cppstdin'
4220 csh='$csh'
4221 d_bsd='$d_bsd'
4222 d_dlopen='$d_dlopen'
4223 d_eunice='$d_eunice'
4224 d_gnulibc='$d_gnulibc'
4225 d_portable='$d_portable'
4226 d_xenix='$d_xenix'
4227 date='$date'
4228 dlsrc='$dlsrc'
4229 echo='$echo'
4230 egrep='$egrep'
4231 emacs='$emacs'
4232 eunicefix='$eunicefix'
4233 exe_ext='$exe_ext'
4234 expr='$expr'
4235 find='$find'
4236 firstmakefile='$firstmakefile'
4237 flex='$flex'
4238 gccosandvers='$gccosandvers'
4239 gccversion='$gccversion'
4240 glibpth='$glibpth'
4241 grep='$grep'
4242 gzip='$gzip'
4243 hint='$hint'
4244 i_dld='$i_dld'
4245 ignore_versioned_solibs='$ignore_versioned_solibs'
4246 incpath='$incpath'
4247 inews='$inews'
4248 ksh='$ksh'
4249 ld='$ld'
4250 lddlflags='$lddlflags'
4251 ldflags='$ldflags'
4252 less='$less'
4253 lib_ext='$lib_ext'
4254 libc='$libc'
4255 libpth='$libpth'
4256 libs='$libs'
4257 libsdirs='$libsdirs'
4258 libsfiles='$libsfiles'
4259 libsfound='$libsfound'
4260 libspath='$libspath'
4261 libswanted='$libswanted'
4262 line='$line'
4263 lint='$lint'
4264 lkflags='$lkflags'
4265 ln='$ln'
4266 lns='$lns'
4267 locincpth='$locincpth'
4268 loclibpth='$loclibpth'
4269 lp='$lp'
4270 lpr='$lpr'
4271 ls='$ls'
4272 mail='$mail'
4273 mailx='$mailx'
4274 make='$make'
4275 make_set_make='$make_set_make'
4276 mips_type='$mips_type'
4277 mkdir='$mkdir'
4278 more='$more'
4279 mv='$mv'
4280 myuname='$myuname'
4281 n='$n'
4282 nm='$nm'
4283 nm_opt='$nm_opt'
4284 nm_so_opt='$nm_so_opt'
4285 nroff='$nroff'
4286 obj_ext='$obj_ext'
4287 optimize='$optimize'
4288 osname='$osname'
4289 osvers='$osvers'
4290 package='$package'
4291 path_sep='$path_sep'
4292 perl='$perl'
4293 perllibs='$perllibs'
4294 pg='$pg'
4295 plibpth='$plibpth'
4296 pmake='$pmake'
4297 pr='$pr'
4298 rm='$rm'
4299 rmail='$rmail'
4300 runnm='$runnm'
4301 sed='$sed'
4302 sendmail='$sendmail'
4303 sh='$sh'
4304 shar='$shar'
4305 sharpbang='$sharpbang'
4306 shsharp='$shsharp'
4307 sleep='$sleep'
4308 smail='$smail'
4309 so='$so'
4310 sort='$sort'
4311 spackage='$spackage'
4312 spitshell='$spitshell'
4313 src='$src'
4314 startsh='$startsh'
4315 submit='$submit'
4316 tail='$tail'
4317 tar='$tar'
4318 tbl='$tbl'
4319 tee='$tee'
4320 test='$test'
4321 touch='$touch'
4322 tr='$tr'
4323 trnl='$trnl'
4324 troff='$troff'
4325 uname='$uname'
4326 uniq='$uniq'
4327 usedl='$usedl'
4328 usenm='$usenm'
4329 usesocks='$usesocks'
4330 usrinc='$usrinc'
4331 uuname='$uuname'
4332 vi='$vi'
4333 xlibpth='$xlibpth'
4334 zcat='$zcat'
4335 zip='$zip'
4336 EOT
4337
4338 : Add in command line options if available
4339 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
4340
4341 : add special variables
4342 $test -f $src/patchlevel.h && \
4343 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
4344 echo "CONFIGDOTSH=true" >>config.sh
4345
4346 : propagate old symbols
4347 if $test -f UU/config.sh; then
4348         <UU/config.sh sort | uniq >UU/oldconfig.sh
4349         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
4350         sort | uniq -u >UU/oldsyms
4351         set X `cat UU/oldsyms`
4352         shift
4353         case $# in
4354         0) ;;
4355         *)
4356                 cat <<EOM
4357 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
4358 EOM
4359                 echo "# Variables propagated from previous config.sh file." >>config.sh
4360                 for sym in `cat UU/oldsyms`; do
4361                         echo "    Propagating $hint variable "'$'"$sym..."
4362                         eval 'tmp="$'"${sym}"'"'
4363                         echo "$tmp" | \
4364                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
4365                 done
4366                 ;;
4367         esac
4368 fi
4369
4370 : preserve RCS keywords in files with variable substitution, grrr
4371 Id='$Id'
4372
4373 : Finish up by extracting the .SH files
4374 case "$alldone" in
4375 exit)
4376         $rm -rf UU
4377         echo "Done."
4378         exit 0
4379         ;;
4380 cont)
4381         ;;
4382 '')
4383         dflt=''
4384         nostick=true
4385         $cat <<EOM
4386
4387 If you'd like to make any changes to the config.sh file before I begin
4388 to configure things, do it as a shell escape now (e.g. !vi config.sh).
4389
4390 EOM
4391         rp="Press return or use a shell escape to edit config.sh:"
4392         . UU/myread
4393         nostick=''
4394         case "$ans" in
4395         '') ;;
4396         *) : in case they cannot read
4397                 sh 1>&4 -c "$ans";;
4398         esac
4399         ;;
4400 esac
4401
4402 : if this fails, just run all the .SH files by hand
4403 . ./config.sh
4404
4405 echo " "
4406 exec 1>&4
4407 . ./UU/extract
4408
4409 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
4410         dflt=y
4411         case "$silent" in
4412         true) ;;
4413         *)
4414                 $cat <<EOM
4415
4416 Now you need to generate make dependencies by running "$make depend".
4417 You might prefer to run it in background: "$make depend > makedepend.out &"
4418 It can take a while, so you might not want to run it right now.
4419
4420 EOM
4421                 ;;
4422         esac
4423         rp="Run $make depend now?"
4424         . UU/myread
4425         case "$ans" in
4426         y*)
4427                 $make depend && echo "Now you must run '$make'."
4428                 ;;
4429         *)
4430                 echo "You must run '$make depend' then '$make'."
4431                 ;;
4432         esac
4433 elif test -f [Mm]akefile; then
4434         echo " "
4435         echo "Now you must run a $make."
4436 else
4437         echo "Done."
4438 fi
4439
4440 if $test -f Policy.sh; then
4441     $cat <<EOM
4442
4443 If you compile $package on a different machine or from a different object
4444 directory, copy the Policy.sh file from this object directory to the
4445 new one before you run Configure -- this will help you with most of
4446 the policy defaults.
4447
4448 EOM
4449 fi
4450 if $test -f config.msg; then
4451     echo "Hmm.  I also noted the following information while running:"
4452     echo " "
4453     $cat config.msg >&4
4454     $rm -f config.msg
4455 fi
4456 $rm -f kit*isdone ark*isdone
4457 $rm -rf UU
4458
4459 : End of Configure
4460