]> git.pld-linux.org Git - packages/di.git/blob - di-distr.003
- changed all BuildRoot definitons
[packages/di.git] / di-distr.003
1 #! /bin/sh
2 # This is a shell archive.  Remove anything before this line, then unpack
3 # it by saving it into a file and typing "sh file".  To overwrite existing
4 # files, type "sh file -c".  You can also feed this as standard input via
5 # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
6 # will see the following message at the end:
7 #               "End of archive 3 (of 3)."
8 # Contents:  Configure
9 # Wrapped by root@seer on Thu Feb 24 10:15:51 2000
10 PATH=/bin:/usr/bin:/usr/ucb ; export PATH
11 if test -f 'Configure' -a "${1}" != "-c" ; then
12   echo shar: Will not clobber existing file \"'Configure'\"
13 else
14 echo shar: Extracting \"'Configure'\" \(106597 characters\)
15 sed "s/^X//" >'Configure' <<'END_OF_FILE'
16 X#! /bin/sh
17 X#
18 X# If these # comments don't work, trim them. Don't worry about any other
19 X# shell scripts, Configure will trim # comments from them for you.
20 X#
21 X# (If you are trying to port this package to a machine without sh,
22 X# I would suggest you have a look at the prototypical config_h.SH file
23 X# and edit it to reflect your system. Some packages may include samples
24 X# of config.h for certain machines, so you might look for one of those.)
25 X#
26 X# Yes, you may rip this off to use in other distribution packages. This
27 X# script belongs to the public domain and cannot be copyrighted.
28 X#
29 X# (Note: this Configure script was generated automatically. Rather than
30 X# working with this copy of Configure, you may wish to get metaconfig.
31 X# The dist-3.0 package (which contains metaconfig) was posted in
32 X# comp.sources.misc and is available on CPAN under authors/id/RAM so
33 X# you may fetch it yourself from your nearest archive site.)
34 X#
35 X
36 X# $Id$
37 X#
38 X# Generated on Sat Feb 12 13:14:26 PST 2000 [metaconfig 3.0 PL70b-1]
39 X# (with additional metaconfig patches by bll@gentoo.com)
40 X
41 Xcat >/tmp/c1$$ <<EOF
42 XARGGGHHHH!!!!!
43 X
44 XSCO csh still thinks true is false.  Write to SCO today and tell them that next
45 Xyear Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
46 X
47 X(Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
48 Xwe'd have to do is go in and swap the && and || tokens, wherever they are.)
49 X
50 X[End of diatribe. We now return you to your regularly scheduled programming...]
51 XEOF
52 Xcat >/tmp/c2$$ <<EOF
53 X
54 XOOPS!  You naughty creature!  You didn't run Configure with sh!
55 XI will attempt to remedy the situation by running sh for you...
56 XEOF
57 X
58 Xtrue || cat /tmp/c1$$ /tmp/c2$$
59 Xtrue || exec sh $0 $argv:q
60 X
61 X(exit $?0) || cat /tmp/c2$$
62 X(exit $?0) || exec sh $0 $argv:q
63 Xrm -f /tmp/c1$$ /tmp/c2$$
64 X
65 X: compute my invocation name
66 Xme=$0
67 Xcase "$0" in
68 X*/*)
69 X       me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
70 X       test "$me" || me=$0
71 X       ;;
72 Xesac
73 X
74 X: Proper separator for the PATH environment variable
75 Xp_=:
76 X: On OS/2 this directory should exist if this is not floppy only system :-]
77 Xif test -d c:/. ; then
78 X    if test -n "$OS2_SHELL"; then
79 X               p_=\;
80 X               PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
81 X               OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
82 X       elif test -n "$DJGPP"; then
83 X               p_=\;
84 X       fi
85 Xfi
86 X
87 X: Proper PATH setting
88 Xpaths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
89 Xpaths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
90 Xpaths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
91 Xpaths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
92 Xpaths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
93 Xpaths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
94 Xpaths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
95 Xpaths="$paths /sbin /usr/sbin /usr/libexec"
96 X
97 Xfor p in $paths
98 Xdo
99 X       case "$p_$PATH$p_" in
100 X       *$p_$p$p_*) ;;
101 X       *) test -d $p && PATH=$PATH$p_$p ;;
102 X       esac
103 Xdone
104 X
105 XPATH=.$p_$PATH
106 Xexport PATH
107 X
108 X: shall we be using ksh?
109 Xinksh=''
110 Xneedksh=''
111 Xavoidksh=''
112 Xnewsh=/bin/ksh
113 Xchangesh=''
114 Xif (PATH=.; alias -x) >/dev/null 2>&1; then
115 X               inksh=true
116 Xfi
117 Xif test -f /hp-ux -a -f /bin/ksh; then
118 X       needksh='to avoid sh bug in "here document" expansion'
119 Xfi
120 Xif test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
121 X       if test X`/usr/bin/uname -v` = X4; then
122 X               avoidksh="to avoid AIX 4's /bin/sh"
123 X               newsh=/usr/bin/bsh
124 X       fi
125 Xfi
126 Xcase "$inksh/$needksh" in
127 X/[a-z]*)
128 X               ENV=''
129 X               changesh=true
130 X               reason="$needksh"
131 X       ;;
132 Xesac
133 Xcase "$inksh/$avoidksh" in
134 Xtrue/[a-z]*)
135 X       changesh=true
136 X       reason="$avoidksh"
137 X       ;;
138 Xesac
139 Xcase "$inksh/$needksh-$avoidksh-" in
140 Xtrue/--)
141 X               cat <<EOM
142 X(I see you are using the Korn shell.  Some ksh's blow up on $me,
143 Xmainly on older exotic systems.  If yours does, try the Bourne shell instead.)
144 XEOM
145 X       ;;
146 Xesac
147 Xcase "$changesh" in
148 Xtrue)
149 X       echo "(Feeding myself to $newsh $reason.)"
150 X       case "$0" in
151 X       Configure|*/Configure) exec $newsh $0 "$@";;
152 X       *) exec $newsh Configure "$@";;
153 X       esac
154 X       ;;
155 Xesac
156 X
157 X: if needed set CDPATH to a harmless value that is not chatty
158 X: avoid bash 2.02 problems with empty CDPATH.
159 Xcase "$CDPATH" in
160 X'')    ;;
161 X*)     case "$SHELL" in
162 X       *bash*) CDPATH='.' ;;
163 X       *)              CDPATH='' ;;
164 X       esac
165 X       ;;
166 Xesac
167 X: Configure runs within the UU subdirectory
168 Xtest -d UU || mkdir UU
169 Xcd UU && rm -f ./*
170 X
171 Xdi_otherobj=''
172 Xdi_prog=''
173 Xd_bsd=''
174 Xd_eunice=''
175 Xd_xenix=''
176 Xeunicefix=''
177 XMcc=''
178 Xar=''
179 Xawk=''
180 Xbash=''
181 Xbison=''
182 Xbyacc=''
183 Xcat=''
184 Xchgrp=''
185 Xchmod=''
186 Xchown=''
187 Xcomm=''
188 Xcompress=''
189 Xcp=''
190 Xcpio=''
191 Xcpp=''
192 Xcsh=''
193 Xdate=''
194 Xecho=''
195 Xegrep=''
196 Xemacs=''
197 Xexpr=''
198 Xfind=''
199 Xflex=''
200 Xgrep=''
201 Xgzip=''
202 Xinews=''
203 Xksh=''
204 Xless=''
205 Xline=''
206 Xlint=''
207 Xln=''
208 Xlp=''
209 Xlpr=''
210 Xls=''
211 Xmail=''
212 Xmailx=''
213 Xmake=''
214 Xmkdir=''
215 Xmore=''
216 Xmv=''
217 Xnm=''
218 Xnroff=''
219 Xperl=''
220 Xpg=''
221 Xpmake=''
222 Xpr=''
223 Xrm=''
224 Xrmail=''
225 Xsed=''
226 Xsendmail=''
227 Xshar=''
228 Xsleep=''
229 Xsmail=''
230 Xsort=''
231 Xsubmit=''
232 Xtail=''
233 Xtar=''
234 Xtbl=''
235 Xtee=''
236 Xtest=''
237 Xtouch=''
238 Xtr=''
239 Xtroff=''
240 Xuname=''
241 Xuniq=''
242 Xuuname=''
243 Xvi=''
244 Xzcat=''
245 Xzip=''
246 Xlibswanted=''
247 Xhint=''
248 Xmyuname=''
249 Xosname=''
250 Xosvers=''
251 XAuthor=''
252 XDate=''
253 XHeader=''
254 XId=''
255 XLocker=''
256 XLog=''
257 XRCSfile=''
258 XRevision=''
259 XSource=''
260 XState=''
261 X_a=''
262 X_exe=''
263 X_o=''
264 Xarchobjs=''
265 Xexe_ext=''
266 Xfirstmakefile=''
267 Xlib_ext=''
268 Xobj_ext=''
269 Xpath_sep=''
270 Xafs=''
271 Xcc=''
272 Xgccversion=''
273 Xccflags=''
274 Xcppflags=''
275 Xldflags=''
276 Xlkflags=''
277 Xlocincpth=''
278 Xoptimize=''
279 Xcf_by=''
280 Xcf_time=''
281 Xcontains=''
282 Xcpplast=''
283 Xcppminus=''
284 Xcpprun=''
285 Xcppstdin=''
286 Xd_64bit_statfs_flds=''
287 Xd_bcopy=''
288 Xd_bzero=''
289 Xd_endmntent=''
290 Xd_fs_info=''
291 Xd_getmnt=''
292 Xd_getmntent=''
293 Xd_getmntinfo=''
294 Xd_getopt=''
295 Xd_optind=''
296 Xd_gnulibc=''
297 Xd_memcpy=''
298 Xd_memset=''
299 Xd_mntctl=''
300 Xd_mnttime=''
301 Xd_portable=''
302 Xd_setmntent=''
303 Xd_setmntent_one_arg=''
304 Xd_statfs=''
305 Xd_statfsbsd=''
306 Xd_statfssysv3=''
307 Xubsize=''
308 Xd_statvfs=''
309 Xd_index=''
310 Xd_strchr=''
311 Xd_sysfs=''
312 Xi_fshelp=''
313 Xi_kernfsinfo=''
314 Xi_limits=''
315 Xi_malloc=''
316 Xi_memory=''
317 Xi_mntent=''
318 Xi_mnttab=''
319 Xi_stdlib=''
320 Xi_stor_directory=''
321 Xi_stor_entry=''
322 Xi_stor_path=''
323 Xi_string=''
324 Xstrings=''
325 Xi_sysfstyp=''
326 Xi_sysfs_types=''
327 Xi_sysfstypes=''
328 Xi_sysmntctl=''
329 Xi_sysmntent=''
330 Xi_sysmnttab=''
331 Xd_getmntinfobsize=''
332 Xd_getmntinfofsize=''
333 Xd_getmntinfofstype=''
334 Xi_sysmount=''
335 Xi_sysparam=''
336 Xi_sysstat=''
337 Xd_statfs_frsize=''
338 Xi_sysstatfs=''
339 Xd_statvfsbasetype=''
340 Xi_sysstatvfs=''
341 Xi_systypes=''
342 Xi_sysvfs=''
343 Xi_sysvfstab=''
344 Xi_sysvmount=''
345 Xi_systime=''
346 Xi_systimek=''
347 Xi_time=''
348 Xtimeincl=''
349 Xi_unistd=''
350 Xlibc=''
351 Xglibpth=''
352 Xlibpth=''
353 Xloclibpth=''
354 Xplibpth=''
355 Xxlibpth=''
356 Xlibs=''
357 Xlns=''
358 Xmake_set_make=''
359 Xinstallmansrc=''
360 Xmanext=''
361 Xmansrc=''
362 Xmansrcexp=''
363 Xc=''
364 Xn=''
365 Xpackage=''
366 Xspackage=''
367 Xprefix=''
368 Xprefixexp=''
369 Xprototype=''
370 Xsh=''
371 Xso=''
372 Xsharpbang=''
373 Xshsharp=''
374 Xspitshell=''
375 Xsrc=''
376 Xstartsh=''
377 Xsysman=''
378 Xnm_opt=''
379 Xnm_so_opt=''
380 Xrunnm=''
381 Xusenm=''
382 Xincpath=''
383 Xmips=''
384 Xmips_type=''
385 Xusrinc=''
386 Xdefvoidused=''
387 Xvoidflags=''
388 XCONFIG=''
389 X
390 Xdefine='define'
391 Xundef='undef'
392 Xsmallmach='pdp11 i8086 z8000 i80286 iAPX286'
393 Xrmlist=''
394 X
395 X: We must find out about Eunice early
396 Xeunicefix=':'
397 Xif test -f /etc/unixtovms; then
398 X       eunicefix=/etc/unixtovms
399 Xfi
400 Xif test -f /etc/unixtovms.exe; then
401 X       eunicefix=/etc/unixtovms.exe
402 Xfi
403 X
404 X: Trailing extension.  Override this in a hint file, if needed.
405 X_exe=''
406 X: Extra object files, if any, needed on this platform.
407 Xarchobjs=''
408 Xgccversion=''
409 X: Possible local include directories to search.
410 X: Set locincpth to "" in a hint file to defeat local include searches.
411 Xlocincpth="/usr/local/include /opt/local/include /usr/gnu/include"
412 Xlocincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
413 X:
414 X: no include file wanted by default
415 Xinclwanted=''
416 X
417 Xi_sysselct=''
418 X: change the next line if compiling for Xenix/286 on Xenix/386
419 Xxlibpth='/usr/lib/386 /lib/386'
420 X
421 X: Possible local library directories to search.
422 Xloclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
423 Xloclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
424 X
425 X: general looking path for locating libraries
426 Xglibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
427 Xglibpth="$glibpth /lib /usr/lib $xlibpth"
428 Xglibpth="$glibpth /lib/large /usr/lib/small /lib/small"
429 Xglibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
430 X
431 X: Private path used by Configure to find libraries.  Its value
432 X: is prepended to libpth. This variable takes care of special
433 X: machines, like the mips.  Usually, it should be empty.
434 Xplibpth=''
435 X
436 X: default library list
437 Xlibswanted=''
438 Xlarge=''
439 X: full support for void wanted by default
440 Xdefvoidused=15
441 X
442 X: List of libraries we want.
443 X: If anyone needs -lnet, put it in a hint file.
444 Xlibswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
445 Xlibswanted="$libswanted dld ld sun m c cposix posix ndir dir crypt"
446 Xlibswanted="$libswanted ucb bsd BSD PW x"
447 X: We probably want to search /usr/shlib before most other libraries.
448 X: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
449 Xglibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
450 Xglibpth="/usr/shlib $glibpth"
451 X: Do not use vfork unless overridden by a hint file.
452 Xusevfork=false
453 X
454 X: Find the basic shell for Bourne shell scripts
455 Xcase "$sh" in
456 X'')
457 X       case "$SYSTYPE" in
458 X       *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
459 X       *) xxx='/bin/sh';;
460 X       esac
461 X       if test -f "$xxx"; then
462 X               sh="$xxx"
463 X       else
464 X               : Build up a list and do a single loop so we can 'break' out.
465 X               pth=`echo $PATH | sed -e "s/$p_/ /g"`
466 X               for xxx in sh bash ksh pdksh ash; do
467 X                       for p in $pth; do
468 X                               try="$try ${p}/${xxx}"
469 X                       done
470 X               done
471 X               for xxx in $try; do
472 X                       if test -f "$xxx"; then
473 X                               sh="$xxx";
474 X                               break
475 X                       elif test -f "$xxx.exe"; then
476 X                               sh="$xxx";
477 X                               break
478 X                       fi
479 X               done
480 X       fi
481 X       ;;
482 Xesac
483 X
484 Xcase "$sh" in
485 X'')    cat <<EOM >&2
486 X$me:  Fatal Error:  I can't find a Bourne Shell anywhere.
487 X
488 XUsually it's in /bin/sh.  How did you even get this far?
489 XPlease contact me (Brad Lanam) at bll@gentoo.com and
490 Xwe'll try to straighten this all out.
491 XEOM
492 X       exit 1
493 X       ;;
494 Xesac
495 X
496 X: see if sh knows # comments
497 Xif `$sh -c '#' >/dev/null 2>&1`; then
498 X       shsharp=true
499 X       spitshell=cat
500 X       xcat=/bin/cat
501 X       test -f $xcat || xcat=/usr/bin/cat
502 X       echo "#!$xcat" >try
503 X       $eunicefix try
504 X       chmod +x try
505 X       ./try > today
506 X       if test -s today; then
507 X               sharpbang='#!'
508 X       else
509 X               echo "#! $xcat" > try
510 X               $eunicefix try
511 X               chmod +x try
512 X               ./try > today
513 X               if test -s today; then
514 X                       sharpbang='#! '
515 X               else
516 X                       sharpbang=': use '
517 X               fi
518 X       fi
519 Xelse
520 X       echo " "
521 X       echo "Your $sh doesn't grok # comments--I will strip them later on."
522 X       shsharp=false
523 X       cd ..
524 X       echo "exec grep -v '^[  ]*#'" >spitshell
525 X       chmod +x spitshell
526 X       $eunicefix spitshell
527 X       spitshell=`pwd`/spitshell
528 X       cd UU
529 X       echo "I presume that if # doesn't work, #! won't work either!"
530 X       sharpbang=': use '
531 Xfi
532 Xrm -f try today
533 X
534 X: figure out how to guarantee sh startup
535 Xcase "$startsh" in
536 X'') startsh=${sharpbang}${sh} ;;
537 X*)
538 Xesac
539 Xcat >try <<EOSS
540 X$startsh
541 Xset abc
542 Xtest "$?abc" != 1
543 XEOSS
544 X
545 Xchmod +x try
546 X$eunicefix try
547 Xif ./try; then
548 X       : echo "Yup, it does."
549 Xelse
550 X       echo "Hmm... '$startsh' does not guarantee sh startup..."
551 X       echo "You may have to fix up the shell scripts to make sure $sh runs them."
552 Xfi
553 Xrm -f try
554 X
555 X
556 X: Save command line options in file UU/cmdline.opt for later use in
557 X: generating config.sh.
558 Xcat > cmdline.opt <<EOSH
559 X# Configure command line arguments.
560 Xconfig_arg0='$0'
561 Xconfig_args='$*'
562 Xconfig_argc=$#
563 XEOSH
564 Xargn=1
565 Xfor arg in "$@"; do
566 X       cat >>cmdline.opt <<EOSH
567 Xconfig_arg$argn='$arg'
568 XEOSH
569 X       argn=`expr $argn + 1`
570 Xdone
571 X
572 X: produce awk script to parse command line options
573 Xcat >options.awk <<'EOF'
574 XBEGIN {
575 X       optstr = "dD:eEf:hKOrsSU:V";    # getopt-style specification
576 X
577 X       len = length(optstr);
578 X       for (i = 1; i <= len; i++) {
579 X               c = substr(optstr, i, 1);
580 X               if (i < len) a = substr(optstr, i + 1, 1); else a = "";
581 X               if (a == ":") {
582 X                       arg[c] = 1;
583 X                       i++;
584 X               }
585 X               opt[c] = 1;
586 X       }
587 X}
588 X{
589 X       expect = 0;
590 X       str = $0;
591 X       if (substr(str, 1, 1) != "-") {
592 X               printf("'%s'\n", str);
593 X               next;
594 X       }
595 X       len = length($0);
596 X       for (i = 2; i <= len; i++) {
597 X               c = substr(str, i, 1);
598 X               if (!opt[c]) {
599 X                       printf("-%s\n", substr(str, i));
600 X                       next;
601 X               }
602 X               printf("-%s\n", c);
603 X               if (arg[c]) {
604 X                       if (i < len)
605 X                               printf("'%s'\n", substr(str, i + 1));
606 X                       else
607 X                               expect = 1;
608 X                       next;
609 X               }
610 X       }
611 X}
612 XEND {
613 X       if (expect)
614 X               print "?";
615 X}
616 XEOF
617 X
618 X: process the command line options
619 Xset X `for arg in "$@"; do echo "X$arg"; done |
620 X       sed -e s/X// | awk -f options.awk`
621 Xeval "set $*"
622 Xshift
623 Xrm -f options.awk
624 X
625 X: set up default values
626 Xfastread=''
627 Xreuseval=false
628 Xconfig_sh=''
629 Xalldone=''
630 Xerror=''
631 Xsilent=''
632 Xextractsh=''
633 Xoverride=''
634 Xknowitall=''
635 Xrm -f optdef.sh
636 Xcat >optdef.sh <<EOS
637 X$startsh
638 XEOS
639 X
640 X
641 X: option parsing
642 Xwhile test $# -gt 0; do
643 X       case "$1" in
644 X       -d) shift; fastread=yes;;
645 X       -e) shift; alldone=cont;;
646 X       -f)
647 X               shift
648 X               cd ..
649 X               if test -r "$1"; then
650 X                       config_sh="$1"
651 X               else
652 X                       echo "$me: cannot read config file $1." >&2
653 X                       error=true
654 X               fi
655 X               cd UU
656 X               shift;;
657 X       -h) shift; error=true;;
658 X       -r) shift; reuseval=true;;
659 X       -s) shift; silent=true; realsilent=true;;
660 X       -E) shift; alldone=exit;;
661 X       -K) shift; knowitall=true;;
662 X       -O) shift; override=true;;
663 X       -S) shift; silent=true; extractsh=true;;
664 X       -D)
665 X               shift
666 X               case "$1" in
667 X               *=)
668 X                       echo "$me: use '-U symbol=', not '-D symbol='." >&2
669 X                       echo "$me: ignoring -D $1" >&2
670 X                       ;;
671 X               *=*) echo "$1" | \
672 X                               sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
673 X               *) echo "$1='define'" >> optdef.sh;;
674 X               esac
675 X               shift
676 X               ;;
677 X       -U)
678 X               shift
679 X               case "$1" in
680 X               *=) echo "$1" >> optdef.sh;;
681 X               *=*)
682 X                       echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
683 X                       echo "$me: ignoring -U $1" >&2
684 X                       ;;
685 X               *) echo "$1='undef'" >> optdef.sh;;
686 X               esac
687 X               shift
688 X               ;;
689 X       -V) echo "$me generated by metaconfig 3.0 PL70b-1." >&2
690 X               exit 0;;
691 X       --) break;;
692 X       -*) echo "$me: unknown option $1" >&2; shift; error=true;;
693 X       *) break;;
694 X       esac
695 Xdone
696 X
697 Xcase "$error" in
698 Xtrue)
699 X       cat >&2 <<EOM
700 XUsage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
701 X                 [-U symbol] [-U symbol=]
702 X  -d : use defaults for all answers.
703 X  -e : go on without questioning past the production of config.sh.
704 X  -f : specify an alternate default configuration file.
705 X  -h : print this help message and exit (with an error status).
706 X  -r : reuse C symbols value if possible (skips costly nm extraction).
707 X  -s : silent mode, only echoes questions and essential information.
708 X  -D : define symbol to have some value:
709 X         -D symbol         symbol gets the value 'define'
710 X         -D symbol=value   symbol gets the value 'value'
711 X  -E : stop at the end of questions, after having produced config.sh.
712 X  -K : do not use unless you know what you are doing.
713 X  -O : let -D and -U override definitions from loaded configuration file.
714 X  -S : perform variable substitutions on all .SH files (can mix with -f)
715 X  -U : undefine symbol:
716 X         -U symbol    symbol gets the value 'undef'
717 X         -U symbol=   symbol gets completely empty
718 X  -V : print version number and exit (with a zero status).
719 XEOM
720 X       exit 1
721 X       ;;
722 Xesac
723 X
724 X: Sanity checks
725 Xcase "$fastread$alldone" in
726 Xyescont|yesexit) ;;
727 X*)
728 X       if test ! -t 0; then
729 X               echo "Say 'sh Configure', not 'sh <Configure'"
730 X               exit 1
731 X       fi
732 X       ;;
733 Xesac
734 X
735 Xexec 4>&1
736 Xcase "$silent" in
737 Xtrue) exec 1>/dev/null;;
738 Xesac
739 X
740 X: run the defines and the undefines, if any, but leave the file out there...
741 Xtouch optdef.sh
742 X. ./optdef.sh
743 X
744 X: set package name
745 Xpackage=di
746 Xfirst=`echo $package | sed -e 's/^\(.\).*/\1/'`
747 Xlast=`echo $package | sed -e 's/^.\(.*\)/\1/'`
748 Xcase "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
749 XABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
750 X*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
751 Xesac
752 X
753 X: Some greps do not return status, grrr.
754 Xecho "grimblepritz" >grimble
755 Xif grep blurfldyick grimble >/dev/null 2>&1 ; then
756 X       contains=contains
757 Xelif grep grimblepritz grimble >/dev/null 2>&1 ; then
758 X       contains=grep
759 Xelse
760 X       contains=contains
761 Xfi
762 Xrm -f grimble
763 X: the following should work in any shell
764 Xcase "$contains" in
765 Xcontains*)
766 X       echo " "
767 X       echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
768 X       cat >contains <<'EOSS'
769 Xgrep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
770 XEOSS
771 Xchmod +x contains
772 Xesac
773 X
774 X: Find the path to the source tree
775 Xcase "$src" in
776 X'') case "$0" in
777 X    */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`;;
778 X    *)   src='.';;
779 X    esac;;
780 Xesac
781 Xcase "$src" in
782 X'')    src=/
783 X       rsrc=/
784 X       ;;
785 X/*) rsrc="$src";;
786 X*) rsrc="../$src";;
787 Xesac
788 Xif test -f $rsrc/Configure && \
789 X       $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
790 Xthen
791 X   : found it, so we are ok.
792 Xelse
793 X       rsrc=''
794 X       for src in . .. ../.. ../../.. ../../../..; do
795 X               if test -f ../$src/Configure && \
796 X                       $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
797 X               then
798 X                       rsrc=../$src
799 X                       break
800 X               fi
801 X       done
802 Xfi
803 Xcase "$rsrc" in
804 X'')
805 X       cat <<EOM >&4
806 X
807 XSorry, I can't seem to locate the source dir for $package.  Please start
808 XConfigure with an explicit path -- i.e. /some/path/Configure.
809 X
810 XEOM
811 X       exit 1
812 X       ;;
813 X../.)  rsrc='..';;
814 X*)
815 X       echo " "
816 X       echo "Sources for $package found in \"$src\"." >&4
817 X       ;;
818 Xesac
819 X
820 X: script used to extract .SH files with variable substitutions
821 Xcat >extract <<'EOS'
822 XCONFIG=true
823 Xecho "Doing variable substitutions on .SH files..."
824 Xif test -f $src/MANIFEST; then
825 X       set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH'`
826 Xelse
827 X       echo "(Looking for .SH files under the source directory.)"
828 X       set x `(cd $src; find . -name "*.SH" -print)`
829 Xfi
830 Xshift
831 Xcase $# in
832 X0) set x `(cd $src; echo *.SH)`; shift;;
833 Xesac
834 Xif test ! -f $src/$1; then
835 X       shift
836 Xfi
837 Xmkdir_p='
838 Xname=$1;
839 Xcreate="";
840 Xwhile test $name; do
841 X       if test ! -d "$name"; then
842 X               create="$name $create";
843 X               name=`echo $name | sed -e "s|^[^/]*$||"`;
844 X               name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
845 X       else
846 X               name="";
847 X       fi;
848 Xdone;
849 Xfor file in $create; do
850 X       mkdir $file;
851 Xdone
852 X'
853 Xfor file in $*; do
854 X       case "$src" in
855 X       ".")
856 X               case "$file" in
857 X               */*)
858 X                       dir=`expr X$file : 'X\(.*\)/'`
859 X                       file=`expr X$file : 'X.*/\(.*\)'`
860 X                       (cd $dir && . ./$file)
861 X                       ;;
862 X               *)
863 X                       . ./$file
864 X                       ;;
865 X               esac
866 X               ;;
867 X       *)
868 X               case "$file" in
869 X               */*)
870 X                       dir=`expr X$file : 'X\(.*\)/'`
871 X                       file=`expr X$file : 'X.*/\(.*\)'`
872 X                       (set x $dir; shift; eval $mkdir_p)
873 X                       sh <$src/$dir/$file
874 X                       ;;
875 X               *)
876 X                       sh <$src/$file
877 X                       ;;
878 X               esac
879 X               ;;
880 X       esac
881 Xdone
882 Xif test -f $src/config_h.SH; then
883 X       if test ! -f config.h; then
884 X       : oops, they left it out of MANIFEST, probably, so do it anyway.
885 X       . $src/config_h.SH
886 X       fi
887 Xfi
888 XEOS
889 X
890 X: extract files and exit if asked to do so
891 Xcase "$extractsh" in
892 Xtrue)
893 X       case "$realsilent" in
894 X       true) ;;
895 X       *) exec 1>&4;;
896 X       esac
897 X       case "$config_sh" in
898 X       '') config_sh='config.sh';;
899 X       esac
900 X       echo " "
901 X       echo "Fetching answers from $config_sh..."
902 X       cd ..
903 X       . $config_sh
904 X       test "$override" && . ./optdef.sh
905 X       echo " "
906 X       . UU/extract
907 X       rm -rf UU
908 X       echo "Done."
909 X       exit 0
910 X       ;;
911 Xesac
912 X
913 X: Eunice requires " " instead of "", can you believe it
914 Xecho " "
915 X: Here we go...
916 Xecho "Beginning of configuration questions for $package."
917 X
918 Xtrap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
919 X
920 X: first determine how to suppress newline on echo command
921 Xecho " "
922 Xecho "Checking echo to see how to suppress newlines..."
923 X(echo "hi there\c" ; echo " ") >.echotmp
924 Xif $contains c .echotmp >/dev/null 2>&1 ; then
925 X       echo "...using -n."
926 X       n='-n'
927 X       c=''
928 Xelse
929 X       cat <<'EOM'
930 X...using \c
931 XEOM
932 X       n=''
933 X       c='\c'
934 Xfi
935 Xecho $n "The star should be here-->$c"
936 Xecho '*'
937 Xrm -f .echotmp
938 X
939 X: Now test for existence of everything in MANIFEST
940 Xecho " "
941 Xif test -f $rsrc/MANIFEST; then
942 X       echo "First let's make sure your kit is complete.  Checking..." >&4
943 X       awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
944 X       rm -f missing
945 X       tmppwd=`pwd`
946 X       for filelist in x??; do
947 X               (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
948 X       done
949 X       if test -s missing; then
950 X               cat missing >&4
951 X               cat >&4 <<'EOM'
952 X
953 XTHIS PACKAGE SEEMS TO BE INCOMPLETE.
954 X
955 XYou have the option of continuing the configuration process, despite the
956 Xdistinct possibility that your kit is damaged, by typing 'y'es.  If you
957 Xdo, don't blame me if something goes wrong.  I advise you to type 'n'o
958 Xand contact the author (bll@gentoo.com).
959 X
960 XEOM
961 X               echo $n "Continue? [n] $c" >&4
962 X               read ans
963 X               case "$ans" in
964 X               y*)
965 X                       echo "Continuing..." >&4
966 X                       rm -f missing
967 X                       ;;
968 X               *)
969 X                       echo "ABORTING..." >&4
970 X                       kill $$
971 X                       ;;
972 X               esac
973 X       else
974 X               echo "Looks good..."
975 X       fi
976 Xelse
977 X       echo "There is no MANIFEST file.  I hope your kit is complete !"
978 Xfi
979 Xrm -f missing x??
980 X
981 X: compute the number of columns on the terminal for proper question formatting
982 Xcase "$COLUMNS" in
983 X'') COLUMNS='80';;
984 Xesac
985 X
986 X: set up the echo used in my read
987 Xmyecho="case \"\$xxxm\" in
988 X'') echo $n \"\$rp $c\" >&4;;
989 X*) case \"\$rp\" in
990 X       '') echo $n \"[\$xxxm] $c\";;
991 X       *)
992 X               if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
993 X                       echo \"\$rp\" >&4
994 X                       echo $n \"[\$xxxm] $c\" >&4
995 X               else
996 X                       echo $n \"\$rp [\$xxxm] $c\" >&4
997 X               fi
998 X               ;;
999 X       esac;;
1000 Xesac"
1001 X
1002 X: now set up to do reads with possible shell escape and default assignment
1003 Xcat <<EOSC >myread
1004 X$startsh
1005 Xxxxm=\$dflt
1006 X$myecho
1007 Xans='!'
1008 Xcase "\$fastread" in
1009 Xyes) case "\$dflt" in
1010 X       '') ;;
1011 X       *) ans='';
1012 X               case "\$silent-\$rp" in
1013 X               true-) ;;
1014 X               *) echo " " >&4;;
1015 X               esac;;
1016 X       esac;;
1017 X*) case "\$silent" in
1018 X       true) case "\$rp" in
1019 X               '') ans='';;
1020 X               esac;;
1021 X       esac;;
1022 Xesac
1023 Xwhile expr "X\$ans" : "X!" >/dev/null; do
1024 X       read answ
1025 X       set x \$xxxm
1026 X       shift
1027 X       aok=''; eval "ans=\\"\$answ\\"" && aok=y
1028 X       case  "\$answ" in
1029 X       "!")
1030 X               sh 1>&4
1031 X               echo " "
1032 X               $myecho
1033 X               ;;
1034 X       !*)
1035 X               set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1036 X               shift
1037 X               sh 1>&4 -c "\$*"
1038 X               echo " "
1039 X               $myecho
1040 X               ;;
1041 X       "\$ans")
1042 X               case "\$ans" in
1043 X               \\&*)
1044 X                       set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1045 X                       shift
1046 X                       case "\$1" in
1047 X                       -d)
1048 X                               fastread=yes
1049 X                               echo "(OK, I'll run with -d after this question.)" >&4
1050 X                               ;;
1051 X                       -*)
1052 X                               echo "*** Sorry, \$1 not supported yet." >&4
1053 X                               ;;
1054 X                       esac
1055 X                       $myecho
1056 X                       ans=!
1057 X                       ;;
1058 X               esac;;
1059 X       *)
1060 X               case "\$aok" in
1061 X               y)
1062 X                       echo "*** Substitution done -- please confirm."
1063 X                       xxxm="\$ans"
1064 X                       ans=\`echo $n "\$ans$c" | tr '\012' ' '\`
1065 X                       xxxm="\$ans"
1066 X                       ans=!
1067 X                       ;;
1068 X               *)
1069 X                       echo "*** Error -- try again."
1070 X                       ans=!
1071 X                       ;;
1072 X               esac
1073 X               $myecho
1074 X               ;;
1075 X       esac
1076 X       case "\$ans\$xxxm\$nostick" in
1077 X       '')
1078 X               ans=!
1079 X               $myecho
1080 X               ;;
1081 X       esac
1082 Xdone
1083 Xcase "\$ans" in
1084 X'') ans="\$xxxm";;
1085 Xesac
1086 XEOSC
1087 X
1088 X: create .config dir to save info across Configure sessions
1089 Xtest -d ../.config || mkdir ../.config
1090 Xcat >../.config/README <<EOF
1091 XThis directory created by Configure to save information that should
1092 Xpersist across sessions for $package.
1093 X
1094 XYou may safely delete it if you wish.
1095 XEOF
1096 X
1097 X: general instructions
1098 Xneedman=true
1099 Xfirsttime=true
1100 Xuser=`(logname) 2>/dev/null`
1101 Xcase "$user" in
1102 X'') user=`whoami 2>&1`;;
1103 Xesac
1104 Xif $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1105 X       firsttime=false
1106 X       echo " "
1107 X       rp='Would you like to see the instructions?'
1108 X       dflt=n
1109 X       . ./myread
1110 X       case "$ans" in
1111 X       [yY]*) ;;
1112 X       *) needman=false;;
1113 X       esac
1114 Xfi
1115 Xif $needman; then
1116 X       cat <<EOH
1117 X
1118 XThis installation shell script will examine your system and ask you questions
1119 Xto determine how the di package should be installed. If you get
1120 Xstuck on a question, you may use a ! shell escape to start a subshell or
1121 Xexecute a command.  Many of the questions will have default answers in square
1122 Xbrackets; typing carriage return will give you the default.
1123 X
1124 XOn some of the questions which ask for file or directory names you are allowed
1125 Xto use the ~name construct to specify the login directory belonging to "name",
1126 Xeven if you don't have a shell which knows about that.  Questions where this is
1127 Xallowed will be marked "(~name ok)".
1128 X
1129 XEOH
1130 X       rp=''
1131 X       dflt='Type carriage return to continue'
1132 X       . ./myread
1133 X       cat <<'EOH'
1134 X
1135 XThe prompter used in this script allows you to use shell variables and
1136 Xbackticks in your answers.  You may use $1, $2, etc...  to refer to the words
1137 Xin the default answer, as if the default line was a set of arguments given to a
1138 Xscript shell.  This means you may also use $* to repeat the whole default line,
1139 Xso you do not have to re-type everything to add something to the default.
1140 X
1141 XEverytime there is a substitution, you will have to confirm.  If there is an
1142 Xerror (e.g. an unmatched backtick), the default answer will remain unchanged
1143 Xand you will be prompted again.
1144 X
1145 XIf you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1146 Xthe questions and use the computed defaults (or the previous answers if there
1147 Xwas already a config.sh file). Type 'Configure -h' for a list of options.
1148 XYou may also start interactively and then answer '& -d' at any prompt to turn
1149 Xon the non-interactive behaviour for the remainder of the execution.
1150 X
1151 XEOH
1152 X       . ./myread
1153 X       cat <<EOH
1154 X
1155 XMuch effort has been expended to ensure that this shell script will run on any
1156 XUnix system.  If despite that it blows up on yours, your best bet is to edit
1157 XConfigure and run it again.  If you can't run Configure for some reason,
1158 Xyou'll have to generate a config.sh file by hand.  Whatever problems you
1159 Xhave, let me (bll@gentoo.com) know how I blew it.
1160 X
1161 XThis installation script affects things in two ways:
1162 X
1163 X1) it may do direct variable substitutions on some of the files included
1164 X   in this kit.
1165 X2) it builds a config.h file for inclusion in C programs.  You may edit
1166 X   any of these files as the need arises after running this script.
1167 X
1168 XIf you make a mistake on a question, there is no easy way to back up to it
1169 Xcurrently.  The easiest thing to do is to edit config.sh and rerun all the SH
1170 Xfiles.  Configure will offer to let you do this before it runs the SH files.
1171 X
1172 XEOH
1173 X       dflt='Type carriage return to continue'
1174 X       . ./myread
1175 X       case "$firsttime" in
1176 X       true) echo $user >>../.config/instruct;;
1177 X       esac
1178 Xfi
1179 X
1180 X: find out where common programs are
1181 Xecho " "
1182 Xecho "Locating common programs..." >&4
1183 Xcat <<EOSC >loc
1184 X$startsh
1185 Xcase \$# in
1186 X0) exit 1;;
1187 Xesac
1188 Xthing=\$1
1189 Xshift
1190 Xdflt=\$1
1191 Xshift
1192 Xfor dir in \$*; do
1193 X       case "\$thing" in
1194 X       .)
1195 X       if test -d \$dir/\$thing; then
1196 X               echo \$dir
1197 X               exit 0
1198 X       fi
1199 X       ;;
1200 X       *)
1201 X       for thisthing in \$dir/\$thing; do
1202 X               : just loop through to pick last item
1203 X       done
1204 X       if test -f \$thisthing; then
1205 X               echo \$thisthing
1206 X               exit 0
1207 X       elif test -f \$dir/\$thing.exe; then
1208 X               if test -n "$DJGPP"; then
1209 X                       echo \$dir/\$thing.exe
1210 X               else
1211 X                       : on Eunice apparently
1212 X                       echo \$dir/\$thing
1213 X               fi
1214 X               exit 0
1215 X       fi
1216 X       ;;
1217 X       esac
1218 Xdone
1219 Xecho \$dflt
1220 Xexit 1
1221 XEOSC
1222 Xchmod +x loc
1223 X$eunicefix loc
1224 Xloclist="
1225 Xawk
1226 Xcat
1227 Xchgrp
1228 Xchmod
1229 Xchown
1230 Xcp
1231 Xecho
1232 Xexpr
1233 Xgrep
1234 Xmake
1235 Xmv
1236 Xrm
1237 Xsed
1238 Xtouch
1239 Xtr
1240 X"
1241 Xtrylist="
1242 XMcc
1243 Xar
1244 Xcpp
1245 Xdate
1246 Xegrep
1247 Xln
1248 Xnm
1249 Xnroff
1250 Xtest
1251 Xuname
1252 X"
1253 Xpth=`echo $PATH | sed -e "s/$p_/ /g"`
1254 Xpth="$pth /lib /usr/lib"
1255 Xfor file in $loclist; do
1256 X       eval xxx=\$$file
1257 X       case "$xxx" in
1258 X       /*|?:[\\/]*)
1259 X               if test -f "$xxx"; then
1260 X                       : ok
1261 X               else
1262 X                       echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1263 X                       xxx=`./loc $file $file $pth`
1264 X               fi
1265 X               ;;
1266 X       '') xxx=`./loc $file $file $pth`;;
1267 X       *) xxx=`./loc $xxx $xxx $pth`;;
1268 X       esac
1269 X       eval $file=$xxx
1270 X       eval _$file=$xxx
1271 X       case "$xxx" in
1272 X       /*)
1273 X               echo $file is in $xxx.
1274 X               ;;
1275 X       ?:[\\/]*)
1276 X               echo $file is in $xxx.
1277 X               ;;
1278 X       *)
1279 X               echo "I don't know where '$file' is, and my life depends on it." >&4
1280 X               echo "Go find a public domain implementation or fix your PATH setting!" >&4
1281 X               exit 1
1282 X               ;;
1283 X       esac
1284 Xdone
1285 Xecho " "
1286 Xecho "Don't worry if any of the following aren't found..."
1287 Xsay=offhand
1288 Xfor file in $trylist; do
1289 X       eval xxx=\$$file
1290 X       case "$xxx" in
1291 X       /*|?:[\\/]*)
1292 X               if test -f "$xxx"; then
1293 X                       : ok
1294 X               else
1295 X                       echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1296 X                       xxx=`./loc $file $file $pth`
1297 X               fi
1298 X               ;;
1299 X       '') xxx=`./loc $file $file $pth`;;
1300 X       *) xxx=`./loc $xxx $xxx $pth`;;
1301 X       esac
1302 X       eval $file=$xxx
1303 X       eval _$file=$xxx
1304 X       case "$xxx" in
1305 X       /*)
1306 X               echo $file is in $xxx.
1307 X               ;;
1308 X       ?:[\\/]*)
1309 X               echo $file is in $xxx.
1310 X               ;;
1311 X       *)
1312 X               echo "I don't see $file out there, $say."
1313 X               say=either
1314 X               ;;
1315 X       esac
1316 Xdone
1317 Xcase "$egrep" in
1318 Xegrep)
1319 X       echo "Substituting grep for egrep."
1320 X       egrep=$grep
1321 X       ;;
1322 Xesac
1323 Xcase "$ln" in
1324 Xln)
1325 X       echo "Substituting cp for ln."
1326 X       ln=$cp
1327 X       ;;
1328 Xesac
1329 Xcase "$test" in
1330 Xtest)
1331 X       echo "Hopefully test is built into your sh."
1332 X       ;;
1333 X*)
1334 X       if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1335 X               echo "Using the test built into your sh."
1336 X               test=test
1337 X               _test=test
1338 X       fi
1339 X       ;;
1340 Xesac
1341 Xcase "$echo" in
1342 Xecho)
1343 X       echo "Hopefully echo is built into your sh."
1344 X       ;;
1345 X'') ;;
1346 X*)
1347 X       echo " "
1348 Xecho "Checking compatibility between $echo and builtin echo (if any)..." >&4
1349 X       $echo $n "hi there$c" >foo1
1350 X       echo $n "hi there$c" >foo2
1351 X       if cmp foo1 foo2 >/dev/null 2>&1; then
1352 X               echo "They are compatible.  In fact, they may be identical."
1353 X       else
1354 X               case "$n" in
1355 X               '-n') n='' c='\c';;
1356 X               *) n='-n' c='';;
1357 X               esac
1358 X               cat <<FOO
1359 XThey are not compatible!  You are probably running ksh on a non-USG system.
1360 XI'll have to use $echo instead of the builtin, since Bourne shell doesn't
1361 Xhave echo built in and we may have to run some Bourne shell scripts.  That
1362 Xmeans I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
1363 X
1364 XFOO
1365 X               $echo $n "The star should be here-->$c"
1366 X               $echo "*"
1367 X       fi
1368 X       $rm -f foo1 foo2
1369 X       ;;
1370 Xesac
1371 X
1372 X: determine whether symbolic links are supported
1373 Xecho " "
1374 X$touch blurfl
1375 Xif $ln -s blurfl sym > /dev/null 2>&1 ; then
1376 X       echo "Symbolic links are supported." >&4
1377 X       lns="$ln -s"
1378 Xelse
1379 X       echo "Symbolic links are NOT supported." >&4
1380 X       lns="$ln"
1381 Xfi
1382 X$rm -f blurfl sym
1383 X
1384 X: see whether [:lower:] and [:upper:] are supported character classes
1385 Xecho " "
1386 Xup='[A-Z]'
1387 Xlow='[a-z]'
1388 Xcase "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1389 XABYZ)
1390 X       echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
1391 X       up='[:upper:]'
1392 X       low='[:lower:]'
1393 X       ;;
1394 X*)
1395 X       echo "Your tr only supports [a-z] and [A-Z] to convert case." >&4
1396 X       ;;
1397 Xesac
1398 X: set up the translation script tr, must be called with ./tr of course
1399 Xcat >tr <<EOSC
1400 X$startsh
1401 Xcase "\$1\$2" in
1402 X'[A-Z][a-z]') exec $tr '$up' '$low';;
1403 X'[a-z][A-Z]') exec $tr '$low' '$up';;
1404 Xesac
1405 Xexec $tr "\$@"
1406 XEOSC
1407 Xchmod +x tr
1408 X$eunicefix tr
1409 X
1410 X: Try to determine whether config.sh was made on this system
1411 Xcase "$config_sh" in
1412 X'')
1413 Xmyuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
1414 Xmyuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
1415 X       ./tr '[A-Z]' '[a-z]' | tr '\012' ' '`
1416 Xnewmyuname="$myuname"
1417 Xdflt=n
1418 Xcase "$knowitall" in
1419 X'')
1420 X       if test -f ../config.sh; then
1421 X               if $contains myuname= ../config.sh >/dev/null 2>&1; then
1422 X                       eval "`grep myuname= ../config.sh`"
1423 X               fi
1424 X               if test "X$myuname" = "X$newmyuname"; then
1425 X                       dflt=y
1426 X               fi
1427 X       fi
1428 X       ;;
1429 X*) dflt=y;;
1430 Xesac
1431 X
1432 X: Get old answers from old config file if Configure was run on the
1433 X: same system, otherwise use the hints.
1434 Xhint=default
1435 Xcd ..
1436 Xif test -f config.sh; then
1437 X       echo " "
1438 X       rp="I see a config.sh file.  Shall I use it to set the defaults?"
1439 X       . UU/myread
1440 X       case "$ans" in
1441 X       n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
1442 X       *)  echo "Fetching default answers from your old config.sh file..." >&4
1443 X               tmp_n="$n"
1444 X               tmp_c="$c"
1445 X               tmp_sh="$sh"
1446 X               . ./config.sh
1447 X               cp config.sh UU
1448 X               n="$tmp_n"
1449 X               c="$tmp_c"
1450 X               : Older versions did not always set $sh.  Catch re-use of such
1451 X               : an old config.sh.
1452 X               case "$sh" in
1453 X               '') sh="$tmp_sh" ;;
1454 X               esac
1455 X               hint=previous
1456 X               ;;
1457 X       esac
1458 Xfi
1459 Xif test ! -f config.sh; then
1460 X       $cat <<EOM
1461 X
1462 XFirst time through, eh?  I have some defaults handy for some systems
1463 Xthat need some extra help getting the Configure answers right:
1464 X
1465 XEOM
1466 X       (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
1467 X       dflt=''
1468 X       : Half the following guesses are probably wrong... If you have better
1469 X       : tests or hints, please send them to bll@gentoo.com
1470 X       : The metaconfig authors would also appreciate a copy...
1471 X       $test -f /irix && osname=irix
1472 X       $test -f /xenix && osname=sco_xenix
1473 X       $test -f /dynix && osname=dynix
1474 X       $test -f /dnix && osname=dnix
1475 X       $test -f /lynx.os && osname=lynxos
1476 X       $test -f /unicos && osname=unicos && osvers=`$uname -r`
1477 X       $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
1478 X       $test -f /bin/mips && /bin/mips && osname=mips
1479 X       $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
1480 X               $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
1481 X       $test -d /usr/apollo/bin && osname=apollo
1482 X       $test -f /etc/saf/_sactab && osname=svr4
1483 X       $test -d /usr/include/minix && osname=minix
1484 X       if $test -d /MachTen; then
1485 X               osname=machten
1486 X               if $test -x /sbin/version; then
1487 X                       osvers=`/sbin/version | $awk '{print $2}' |
1488 X                       $sed -e 's/[A-Za-z]$//'`
1489 X               elif $test -x /usr/etc/version; then
1490 X                       osvers=`/usr/etc/version | $awk '{print $2}' |
1491 X                       $sed -e 's/[A-Za-z]$//'`
1492 X               else
1493 X                       osvers="$2.$3"
1494 X               fi
1495 X       fi
1496 X       if $test -f $uname; then
1497 X               set X $myuname
1498 X               shift
1499 X
1500 X               case "$5" in
1501 X               fps*) osname=fps ;;
1502 X               mips*)
1503 X                       case "$4" in
1504 X                       umips) osname=umips ;;
1505 X                       *) osname=mips ;;
1506 X                       esac;;
1507 X               [23]100) osname=mips ;;
1508 X               next*) osname=next ;;
1509 X               i386*)
1510 X                       if $test -f /etc/kconfig; then
1511 X                               osname=isc
1512 X                               if test "$lns" = "ln -s"; then
1513 X                                       osvers=4
1514 X                               elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
1515 X                                       osvers=3
1516 X                               elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
1517 X                                       osvers=2
1518 X                               fi
1519 X                       fi
1520 X                       ;;
1521 X               pc*)
1522 X                       if test -n "$DJGPP"; then
1523 X                               osname=dos
1524 X                               osvers=djgpp
1525 X                       fi
1526 X                       ;;
1527 X               esac
1528 X
1529 X               case "$1" in
1530 X               aix) osname=aix
1531 X                       tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
1532 X                       case "$tmp" in
1533 X                       'not found') osvers="$4"."$3" ;;
1534 X                       '<3240'|'<>3240') osvers=3.2.0 ;;
1535 X                       '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
1536 X                       '=3250'|'>3250') osvers=3.2.5 ;;
1537 X                       *) osvers=$tmp;;
1538 X                       esac
1539 X                       ;;
1540 X               *dc.osx) osname=dcosx
1541 X                       osvers="$3"
1542 X                       ;;
1543 X               dnix) osname=dnix
1544 X                       osvers="$3"
1545 X                       ;;
1546 X               domainos) osname=apollo
1547 X                       osvers="$3"
1548 X                       ;;
1549 X               dgux) osname=dgux
1550 X                       osvers="$3"
1551 X                       ;;
1552 X               dynixptx*) osname=dynixptx
1553 X                       osvers="$3"
1554 X                       ;;
1555 X               freebsd) osname=freebsd
1556 X                       osvers="$3" ;;
1557 X               genix) osname=genix ;;
1558 X               hp*) osname=hpux
1559 X                       osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
1560 X                       ;;
1561 X               irix*) osname=irix
1562 X                       case "$3" in
1563 X                       4*) osvers=4 ;;
1564 X                       5*) osvers=5 ;;
1565 X                       *)      osvers="$3" ;;
1566 X                       esac
1567 X                       ;;
1568 X               linux) osname=linux
1569 X                       case "$3" in
1570 X                       *)      osvers="$3" ;;
1571 X                       esac
1572 X                       ;;
1573 X               netbsd*) osname=netbsd
1574 X                       osvers="$3"
1575 X                       ;;
1576 X               news-os) osvers="$3"
1577 X                       case "$3" in
1578 X                       4*) osname=newsos4 ;;
1579 X                       *) osname=newsos ;;
1580 X                       esac
1581 X                       ;;
1582 X               bsd386) osname=bsd386
1583 X                       osvers=`$uname -r`
1584 X                       ;;
1585 X               powerux | power_ux | powermax_os | powermaxos | \
1586 X               powerunix | power_unix) osname=powerux
1587 X                       osvers="$3"
1588 X                       ;;
1589 X               next*) osname=next ;;
1590 X               solaris) osname=solaris
1591 X                       case "$3" in
1592 X                       5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
1593 X                       *)      osvers="$3" ;;
1594 X                       esac
1595 X                       ;;
1596 X               sunos) osname=sunos
1597 X                       case "$3" in
1598 X                       5*) osname=solaris
1599 X                               osvers=`echo $3 | $sed 's/^5/2/g'` ;;
1600 X                       *)      osvers="$3" ;;
1601 X                       esac
1602 X                       ;;
1603 X               titanos) osname=titanos
1604 X                       case "$3" in
1605 X                       1*) osvers=1 ;;
1606 X                       2*) osvers=2 ;;
1607 X                       3*) osvers=3 ;;
1608 X                       4*) osvers=4 ;;
1609 X                       *)      osvers="$3" ;;
1610 X                       esac
1611 X                       ;;
1612 X               ultrix) osname=ultrix
1613 X                       osvers="$3"
1614 X                       ;;
1615 X               osf1|mls+)      case "$5" in
1616 X                               alpha)
1617 X                                       osname=dec_osf
1618 X                                       osvers=`echo "$3" | sed 's/^[xvt]//'`
1619 X                                       ;;
1620 X                       hp*)    osname=hp_osf1  ;;
1621 X                       mips)   osname=mips_osf1 ;;
1622 X                       esac
1623 X                       ;;
1624 X               uts) osname=uts
1625 X                       osvers="$3"
1626 X                       ;;
1627 X               qnx) osname=qnx
1628 X                       osvers="$4"
1629 X                       ;;
1630 X               beos) osname=beos
1631 X                       osvers="$3"
1632 X                       ;;
1633 X               $2) case "$osname" in
1634 X                       *isc*) ;;
1635 X                       *freebsd*) ;;
1636 X                       svr*)
1637 X                               : svr4.x or possibly later
1638 X                               case "svr$3" in
1639 X                               ${osname}*)
1640 X                                       osname=svr$3
1641 X                                       osvers=$4
1642 X                                       ;;
1643 X                               esac
1644 X                               case "$osname" in
1645 X                               svr4.0)
1646 X                                       : Check for ESIX
1647 X                                       if test -f /stand/boot ; then
1648 X                                               eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
1649 X                                               if test -n "$INITPROG" -a -f "$INITPROG"; then
1650 X                       isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
1651 X                                                       if test -n "$isesix"; then
1652 X                                                               osname=esix4
1653 X                                                       fi
1654 X                                               fi
1655 X                                       fi
1656 X                                       ;;
1657 X                               esac
1658 X                               ;;
1659 X                       *)      if test -f /etc/systemid; then
1660 X                                       osname=sco
1661 X                                       set `echo $3 | $sed 's/\./ /g'` $4
1662 X                                       if $test -f $src/hints/sco_$1_$2_$3.sh; then
1663 X                                               osvers=$1.$2.$3
1664 X                                       elif $test -f $src/hints/sco_$1_$2.sh; then
1665 X                                               osvers=$1.$2
1666 X                                       elif $test -f $src/hints/sco_$1.sh; then
1667 X                                               osvers=$1
1668 X                                       fi
1669 X                               else
1670 X                                       case "$osname" in
1671 X                                       '') : Still unknown.  Probably a generic Sys V.
1672 X                                               osname="sysv"
1673 X                                               osvers="$3"
1674 X                                               ;;
1675 X                                       esac
1676 X                               fi
1677 X                               ;;
1678 X                       esac
1679 X                       ;;
1680 X               *)      case "$osname" in
1681 X                       '') : Still unknown.  Probably a generic BSD.
1682 X                               osname="$1"
1683 X                               osvers="$3"
1684 X                               ;;
1685 X                       esac
1686 X                       ;;
1687 X               esac
1688 X       else
1689 X               if test -f /vmunix -a -f $src/hints/news_os.sh; then
1690 X                       (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
1691 X                       if $contains news-os UU/kernel.what >/dev/null 2>&1; then
1692 X                               osname=news_os
1693 X                       fi
1694 X                       $rm -f UU/kernel.what
1695 X               elif test -d c:/.; then
1696 X                       set X $myuname
1697 X                       osname=os2
1698 X                       osvers="$5"
1699 X               fi
1700 X       fi
1701 X
1702 X       : Now look for a hint file osname_osvers, unless one has been
1703 X       : specified already.
1704 X       case "$hintfile" in
1705 X       ''|' ')
1706 X               file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
1707 X               : Also try without trailing minor version numbers.
1708 X               xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
1709 X               xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
1710 X               xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
1711 X               xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
1712 X               case "$file" in
1713 X               '') dflt=none ;;
1714 X               *)  case "$osvers" in
1715 X                       '') dflt=$file
1716 X                               ;;
1717 X                       *)  if $test -f $src/hints/$file.sh ; then
1718 X                                       dflt=$file
1719 X                               elif $test -f $src/hints/$xfile.sh ; then
1720 X                                       dflt=$xfile
1721 X                               elif $test -f $src/hints/$xxfile.sh ; then
1722 X                                       dflt=$xxfile
1723 X                               elif $test -f $src/hints/$xxxfile.sh ; then
1724 X                                       dflt=$xxxfile
1725 X                               elif $test -f $src/hints/$xxxxfile.sh ; then
1726 X                                       dflt=$xxxxfile
1727 X                               elif $test -f "$src/hints/${osname}.sh" ; then
1728 X                                       dflt="${osname}"
1729 X                               else
1730 X                                       dflt=none
1731 X                               fi
1732 X                               ;;
1733 X                       esac
1734 X                       ;;
1735 X               esac
1736 X               if $test -f Policy.sh ; then
1737 X                       case "$dflt" in
1738 X                       *Policy*) ;;
1739 X                       none) dflt="Policy" ;;
1740 X                       *) dflt="Policy $dflt" ;;
1741 X                       esac
1742 X               fi
1743 X               ;;
1744 X       *)
1745 X               dflt=`echo $hintfile | $sed 's/\.sh$//'`
1746 X               ;;
1747 X       esac
1748 X
1749 X       if $test -f Policy.sh ; then
1750 X               $cat <<EOM
1751 X
1752 XThere's also a Policy hint file available, which should make the
1753 Xsite-specific (policy) questions easier to answer.
1754 XEOM
1755 X
1756 X       fi
1757 X
1758 X       $cat <<EOM
1759 X
1760 XYou may give one or more space-separated answers, or "none" if appropriate.
1761 XA well-behaved OS will have no hints, so answering "none" or just "Policy"
1762 Xis a good thing.  DO NOT give a wrong version.
1763 X
1764 XEOM
1765 X
1766 X       rp="Which of these apply, if any?"
1767 X       . UU/myread
1768 X       tans=$ans
1769 X       for file in $tans; do
1770 X               if $test X$file = XPolicy -a -f Policy.sh; then
1771 X                       . Policy.sh
1772 X                       $cat Policy.sh >> UU/config.sh
1773 X               elif $test -f $src/hints/$file.sh; then
1774 X                       . $src/hints/$file.sh
1775 X                       $cat $src/hints/$file.sh >> UU/config.sh
1776 X               elif $test X$tans = X -o X$tans = Xnone ; then
1777 X                       : nothing
1778 X               else
1779 X                       : Give one chance to correct a possible typo.
1780 X                       echo "$file.sh does not exist"
1781 X                       dflt=$file
1782 X                       rp="hint to use instead?"
1783 X                       . UU/myread
1784 X                       for file in $ans; do
1785 X                               if $test -f "$src/hints/$file.sh"; then
1786 X                                       . $src/hints/$file.sh
1787 X                                       $cat $src/hints/$file.sh >> UU/config.sh
1788 X                               elif $test X$ans = X -o X$ans = Xnone ; then
1789 X                                       : nothing
1790 X                               else
1791 X                                       echo "$file.sh does not exist -- ignored."
1792 X                               fi
1793 X                       done
1794 X               fi
1795 X       done
1796 X
1797 X       hint=recommended
1798 X       : Remember our hint file for later.
1799 X       if $test -f "$src/hints/$file.sh" ; then
1800 X               hintfile="$file"
1801 X       else
1802 X               hintfile=''
1803 X       fi
1804 Xfi
1805 Xcd UU
1806 X;;
1807 X*)
1808 X       echo " "
1809 X       echo "Fetching default answers from $config_sh..." >&4
1810 X       tmp_n="$n"
1811 X       tmp_c="$c"
1812 X       cd ..
1813 X       cp $config_sh config.sh 2>/dev/null
1814 X       chmod +w config.sh
1815 X       . ./config.sh
1816 X       cd UU
1817 X       cp ../config.sh .
1818 X       n="$tmp_n"
1819 X       c="$tmp_c"
1820 X       hint=previous
1821 X       ;;
1822 Xesac
1823 Xtest "$override" && . ./optdef.sh
1824 Xmyuname="$newmyuname"
1825 X
1826 X: Restore computed paths
1827 Xfor file in $loclist $trylist; do
1828 X       eval $file="\$_$file"
1829 Xdone
1830 X
1831 Xcat << EOM
1832 X
1833 XConfigure uses the operating system name and version to set some defaults.
1834 XThe default value is probably right if the name rings a bell. Otherwise,
1835 Xsince spelling matters for me, either accept the default or answer "none"
1836 Xto leave it blank.
1837 X
1838 XEOM
1839 Xcase "$osname" in
1840 X       ''|' ')
1841 X               case "$hintfile" in
1842 X               ''|' '|none) dflt=none ;;
1843 X               *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
1844 X               esac
1845 X               ;;
1846 X       *) dflt="$osname" ;;
1847 Xesac
1848 Xrp="Operating system name?"
1849 X. ./myread
1850 Xcase "$ans" in
1851 Xnone)  osname='' ;;
1852 X*) osname=`echo "$ans" | $sed -e 's/[  ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
1853 Xesac
1854 X: who configured the system
1855 Xcf_time=`LC_ALL=C; export LC_ALL; $date 2>&1`
1856 Xcf_by=`(logname) 2>/dev/null`
1857 Xcase "$cf_by" in
1858 X"")
1859 X       cf_by=`(whoami) 2>/dev/null`
1860 X       case "$cf_by" in
1861 X       "") cf_by=unknown ;;
1862 X       esac ;;
1863 Xesac
1864 X
1865 X: is AFS running?
1866 Xecho " "
1867 Xcase "$afs" in
1868 X$define|true)  afs=true ;;
1869 X$undef|false)  afs=false ;;
1870 X*)     if test -d /afs; then
1871 X               afs=true
1872 X       else
1873 X               afs=false
1874 X       fi
1875 X       ;;
1876 Xesac
1877 Xif $afs; then
1878 X       echo "AFS may be running... I'll be extra cautious then..." >&4
1879 Xelse
1880 X       echo "AFS does not seem to be running..." >&4
1881 Xfi
1882 X
1883 X: determine where manual pages are on this system
1884 Xecho " "
1885 Xcase "$sysman" in
1886 X'')
1887 X       syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
1888 X       syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
1889 X       syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
1890 X       syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
1891 X       syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
1892 X       sysman=`./loc . /usr/man/man1 $syspath`
1893 X       ;;
1894 Xesac
1895 Xif $test -d "$sysman"; then
1896 X       echo "System manual is in $sysman." >&4
1897 Xelse
1898 X       echo "Could not find manual pages in source form." >&4
1899 Xfi
1900 X
1901 X: decide how portable to be
1902 Xcase "$d_portable" in
1903 X"$define") dflt=y;;
1904 X*)     dflt=n;;
1905 Xesac
1906 X$cat <<'EOH'
1907 X
1908 XI can set things up so that your shell scripts and binaries are more portable,
1909 Xat what may be a noticable cost in performance.  In particular, if you
1910 Xask to be portable, the following happens:
1911 X
1912 X     1) Shell scripts will rely on the PATH variable rather than using
1913 X       the paths derived above.
1914 X     2) ~username interpretations will be done at run time rather than
1915 X       by Configure.
1916 X
1917 XEOH
1918 Xrp="Do you expect to run these scripts and binaries on multiple machines?"
1919 X. ./myread
1920 Xcase "$ans" in
1921 X       y*) d_portable="$define"
1922 X       ;;
1923 X       *)  d_portable="$undef" ;;
1924 Xesac
1925 X
1926 X: set up shell script to do ~ expansion
1927 Xcat >filexp <<EOSS
1928 X$startsh
1929 X: expand filename
1930 Xcase "\$1" in
1931 X ~/*|~)
1932 X       echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
1933 X       ;;
1934 X ~*)
1935 X       if $test -f /bin/csh; then
1936 X               /bin/csh -f -c "glob \$1"
1937 X               failed=\$?
1938 X               echo ""
1939 X               exit \$failed
1940 X       else
1941 X               name=\`$expr x\$1 : '..\([^/]*\)'\`
1942 X               dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
1943 X               if $test ! -d "\$dir"; then
1944 X                       me=\`basename \$0\`
1945 X                       echo "\$me: can't locate home directory for: \$name" >&2
1946 X                       exit 1
1947 X               fi
1948 X               case "\$1" in
1949 X               */*)
1950 X                       echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
1951 X                       ;;
1952 X               *)
1953 X                       echo \$dir
1954 X                       ;;
1955 X               esac
1956 X       fi
1957 X       ;;
1958 X*)
1959 X       echo \$1
1960 X       ;;
1961 Xesac
1962 XEOSS
1963 Xchmod +x filexp
1964 X$eunicefix filexp
1965 X
1966 X: now set up to get a file name
1967 Xcat <<EOS >getfile
1968 X$startsh
1969 XEOS
1970 Xcat <<'EOSC' >>getfile
1971 Xtilde=''
1972 Xfullpath=''
1973 Xalready=''
1974 Xskip=''
1975 Xnone_ok=''
1976 Xexp_file=''
1977 Xnopath_ok=''
1978 Xorig_rp="$rp"
1979 Xorig_dflt="$dflt"
1980 X
1981 Xcase "$fn" in
1982 X*\(*)
1983 X       expr $fn : '.*(\(.*\)).*' | tr ',' '\012' >getfile.ok
1984 X       fn=`echo $fn | sed 's/(.*)//'`
1985 X       ;;
1986 Xesac
1987 X
1988 Xcase "$fn" in
1989 X*:*)
1990 X       loc_file=`expr $fn : '.*:\(.*\)'`
1991 X       fn=`expr $fn : '\(.*\):.*'`
1992 X       ;;
1993 Xesac
1994 X
1995 Xcase "$fn" in
1996 X*~*) tilde=true;;
1997 Xesac
1998 Xcase "$fn" in
1999 X*/*) fullpath=true;;
2000 Xesac
2001 Xcase "$fn" in
2002 X*+*) skip=true;;
2003 Xesac
2004 Xcase "$fn" in
2005 X*n*) none_ok=true;;
2006 Xesac
2007 Xcase "$fn" in
2008 X*e*) exp_file=true;;
2009 Xesac
2010 Xcase "$fn" in
2011 X*p*) nopath_ok=true;;
2012 Xesac
2013 X
2014 Xcase "$fn" in
2015 X*f*) type='File';;
2016 X*d*) type='Directory';;
2017 X*l*) type='Locate';;
2018 Xesac
2019 X
2020 Xwhat="$type"
2021 Xcase "$what" in
2022 XLocate) what='File';;
2023 Xesac
2024 X
2025 Xcase "$exp_file" in
2026 X'')
2027 X       case "$d_portable" in
2028 X       "$define") ;;
2029 X       *) exp_file=true;;
2030 X       esac
2031 X       ;;
2032 Xesac
2033 X
2034 Xcd ..
2035 Xwhile test "$type"; do
2036 X       redo=''
2037 X       rp="$orig_rp"
2038 X       dflt="$orig_dflt"
2039 X       case "$tilde" in
2040 X       true) rp="$rp (~name ok)";;
2041 X       esac
2042 X       . UU/myread
2043 X       if test -f UU/getfile.ok && \
2044 X               $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
2045 X       then
2046 X               value="$ans"
2047 X               ansexp="$ans"
2048 X               break
2049 X       fi
2050 X       case "$ans" in
2051 X       none)
2052 X               value=''
2053 X               ansexp=''
2054 X               case "$none_ok" in
2055 X               true) type='';;
2056 X               esac
2057 X               ;;
2058 X       *)
2059 X               case "$tilde" in
2060 X               '') value="$ans"
2061 X                       ansexp="$ans";;
2062 X               *)
2063 X                       value=`UU/filexp $ans`
2064 X                       case $? in
2065 X                       0)
2066 X                               if test "$ans" != "$value"; then
2067 X                                       echo "(That expands to $value on this system.)"
2068 X                               fi
2069 X                               ;;
2070 X                       *) value="$ans";;
2071 X                       esac
2072 X                       ansexp="$value"
2073 X                       case "$exp_file" in
2074 X                       '') value="$ans";;
2075 X                       esac
2076 X                       ;;
2077 X               esac
2078 X               case "$fullpath" in
2079 X               true)
2080 X                       case "$ansexp" in
2081 X                       /*) value="$ansexp" ;;
2082 X                       *)
2083 X                               redo=true
2084 X                               case "$already" in
2085 X                               true)
2086 X                               echo "I shall only accept a full path name, as in /bin/ls." >&4
2087 X                               echo "Use a ! shell escape if you wish to check pathnames." >&4
2088 X                                       ;;
2089 X                               *)
2090 X                               echo "Please give a full path name, starting with slash." >&4
2091 X                                       case "$tilde" in
2092 X                                       true)
2093 X                               echo "Note that using ~name is ok provided it expands well." >&4
2094 X                                               already=true
2095 X                                               ;;
2096 X                                       esac
2097 X                               esac
2098 X                               ;;
2099 X                       esac
2100 X                       ;;
2101 X               esac
2102 X               case "$redo" in
2103 X               '')
2104 X                       case "$type" in
2105 X                       File)
2106 X                               if test -f "$ansexp"; then
2107 X                                       type=''
2108 X                               elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1
2109 X                               then
2110 X                                       echo "($value is not a plain file, but that's ok.)"
2111 X                                       type=''
2112 X                               fi
2113 X                               ;;
2114 X                       Directory)
2115 X                               if test -d "$ansexp"; then
2116 X                                       type=''
2117 X                               fi
2118 X                               ;;
2119 X                       Locate)
2120 X                               if test -d "$ansexp"; then
2121 X                                       echo "(Looking for $loc_file in directory $value.)"
2122 X                                       value="$value/$loc_file"
2123 X                                       ansexp="$ansexp/$loc_file"
2124 X                               fi
2125 X                               if test -f "$ansexp"; then
2126 X                                       type=''
2127 X                               fi
2128 X                               case "$nopath_ok" in
2129 X                               true)   case "$value" in
2130 X                                       */*) ;;
2131 X                                       *)      echo "Assuming $value will be in people's path."
2132 X                                               type=''
2133 X                                               ;;
2134 X                                       esac
2135 X                                       ;;
2136 X                               esac
2137 X                               ;;
2138 X                       esac
2139 X
2140 X                       case "$skip" in
2141 X                       true) type='';
2142 X                       esac
2143 X
2144 X                       case "$type" in
2145 X                       '') ;;
2146 X                       *)
2147 X                               if test "$fastread" = yes; then
2148 X                                       dflt=y
2149 X                               else
2150 X                                       dflt=n
2151 X                               fi
2152 X                               rp="$what $value doesn't exist.  Use that name anyway?"
2153 X                               . UU/myread
2154 X                               dflt=''
2155 X                               case "$ans" in
2156 X                               y*) type='';;
2157 X                               *) echo " ";;
2158 X                               esac
2159 X                               ;;
2160 X                       esac
2161 X                       ;;
2162 X               esac
2163 X               ;;
2164 X       esac
2165 Xdone
2166 Xcd UU
2167 Xans="$value"
2168 Xrp="$orig_rp"
2169 Xdflt="$orig_dflt"
2170 Xrm -f getfile.ok
2171 XEOSC
2172 X
2173 X: determine root of directory hierarchy where package will be installed.
2174 Xcase "$prefix" in
2175 X'')
2176 X       dflt=`./loc . /usr/local /usr/local /local /opt /usr`
2177 X       ;;
2178 X*)
2179 X       dflt="$prefix"
2180 X       ;;
2181 Xesac
2182 X$cat <<EOM
2183 X
2184 XBy default, $package will be installed in $dflt/bin, manual
2185 Xpages under $dflt/man, etc..., i.e. with $dflt as prefix for
2186 Xall installation directories. Typically set to /usr/local, but you
2187 Xmay choose /usr if you wish to install $package among your system
2188 Xbinaries. If you wish to have binaries under /bin but manual pages
2189 Xunder /usr/local/man, that's ok: you will be prompted separately
2190 Xfor each of the installation directories, the prefix being only used
2191 Xto set the defaults.
2192 X
2193 XEOM
2194 Xfn=d~
2195 Xrp='Installation prefix to use?'
2196 X. ./getfile
2197 Xoldprefix=''
2198 Xcase "$prefix" in
2199 X'') ;;
2200 X*)
2201 X       case "$ans" in
2202 X       "$prefix") ;;
2203 X       *) oldprefix="$prefix";;
2204 X       esac
2205 X       ;;
2206 Xesac
2207 Xprefix="$ans"
2208 Xprefixexp="$ansexp"
2209 X
2210 X: set the prefixit variable, to compute a suitable default value
2211 Xprefixit='case "$3" in
2212 X""|none)
2213 X       case "$oldprefix" in
2214 X       "") eval "$1=\"\$$2\"";;
2215 X       *)
2216 X               case "$3" in
2217 X               "") eval "$1=";;
2218 X               none)
2219 X                       eval "tp=\"\$$2\"";
2220 X                       case "$tp" in
2221 X                       ""|" ") eval "$1=\"\$$2\"";;
2222 X                       *) eval "$1=";;
2223 X                       esac;;
2224 X               esac;;
2225 X       esac;;
2226 X*)
2227 X       eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
2228 X       case "$tp" in
2229 X       --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
2230 X       /*-$oldprefix/*|\~*-$oldprefix/*)
2231 X               eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
2232 X       *) eval "$1=\"\$$2\"";;
2233 X       esac;;
2234 Xesac'
2235 X
2236 X: set the prefixup variable, to restore leading tilda escape
2237 Xprefixup='case "$prefixexp" in
2238 X"$prefix") ;;
2239 X*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
2240 Xesac'
2241 X
2242 X: determine where manual pages go
2243 Xset mansrc mansrc none
2244 Xeval $prefixit
2245 X$cat <<EOM
2246 X
2247 X$spackage has manual pages available in source form.
2248 XEOM
2249 Xcase "$nroff" in
2250 Xnroff)
2251 X       echo "However, you don't have nroff, so they're probably useless to you."
2252 X       case "$mansrc" in
2253 X       '') mansrc="none";;
2254 X       esac;;
2255 Xesac
2256 Xecho "If you don't want the manual sources installed, answer 'none'."
2257 Xcase "$mansrc" in
2258 X'')
2259 X       lookpath="$prefixexp/man/man1 $prefixexp/man/u_man/man1"
2260 X       lookpath="$lookpath $prefixexp/man/l_man/man1"
2261 X       lookpath="$lookpath /usr/local/man/man1 /opt/man/man1 /usr/man/manl"
2262 X       lookpath="$lookpath /usr/man/local/man1 /usr/man/l_man/man1"
2263 X       lookpath="$lookpath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2264 X       lookpath="$lookpath /usr/man/man.L"
2265 X       mansrc=`./loc . $prefixexp/man/man1 $lookpath`
2266 X       if $test -d "$mansrc"; then
2267 X               dflt="$mansrc"
2268 X       else
2269 X               dflt="$sysman"
2270 X       fi
2271 X       set dflt
2272 X       eval $prefixup
2273 X       ;;
2274 X' ') dflt=none;;
2275 X*)  dflt="$mansrc"
2276 X       ;;
2277 Xesac
2278 Xecho " "
2279 Xfn=dn~
2280 Xrp='Where do the manual pages (source) go?'
2281 X. ./getfile
2282 Xif test "X$mansrcexp" != "X$ansexp"; then
2283 X       installmansrc=''
2284 Xfi
2285 Xmansrc="$ans"
2286 Xmansrcexp="$ansexp"
2287 Xcase "$mansrc" in
2288 X'') mansrc=' '
2289 X       installmansrc='';;
2290 Xesac
2291 Xif $afs && $test "$mansrc"; then
2292 X       $cat <<EOM
2293 X
2294 XSince you are running AFS, I need to distinguish the directory in which
2295 Xmanual pages reside from the directory in which they are installed (and from
2296 Xwhich they are presumably copied to the former directory by occult means).
2297 X
2298 XEOM
2299 X       case "$installmansrc" in
2300 X       '') dflt=`echo $mansrcexp | sed 's#^/afs/#/afs/.#'`;;
2301 X       *) dflt="$installmansrc";;
2302 X       esac
2303 X       fn=de~
2304 X       rp='Where will man pages be installed?'
2305 X       . ./getfile
2306 X       installmansrc="$ans"
2307 Xelse
2308 X       installmansrc="$mansrcexp"
2309 Xfi
2310 X
2311 Xcase "$mansrc" in
2312 X' ') manext='0';;
2313 X*l) manext=l;;
2314 X*n) manext=n;;
2315 X*o) manext=l;;
2316 X*p) manext=n;;
2317 X*C) manext=C;;
2318 X*L) manext=L;;
2319 X*L1) manext=L1;;
2320 X*) manext=1;;
2321 Xesac
2322 X
2323 X: set up the script used to warn in case of inconsistency
2324 Xcat <<EOS >whoa
2325 X$startsh
2326 XEOS
2327 Xcat <<'EOSC' >>whoa
2328 Xdflt=y
2329 Xecho " "
2330 Xecho "*** WHOA THERE!!! ***" >&4
2331 Xecho "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2332 Xrp="    Keep the $hint value?"
2333 X. ./myread
2334 Xcase "$ans" in
2335 Xy) td=$was; tu=$was;;
2336 Xesac
2337 XEOSC
2338 X
2339 X: function used to set $1 to $val
2340 Xsetvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2341 Xcase "$val$was" in
2342 X$define$undef) . ./whoa; eval "$var=\$td";;
2343 X$undef$define) . ./whoa; eval "$var=\$tu";;
2344 X*) eval "$var=$val";;
2345 Xesac'
2346 X
2347 X
2348 Xset valtemp
2349 Xvaltemp="$d_64bit_statfs_flds"
2350 Xcase $valtemp in
2351 X    '') valtemp="$undef" ;;
2352 Xesac
2353 X
2354 Xval=$valtemp
2355 Xset d_64bit_statfs_flds
2356 Xeval $setvar
2357 X: make some quick guesses about what we are up against
2358 Xecho " "
2359 X$echo $n "Hmm...  $c"
2360 Xecho exit 1 >bsd
2361 Xecho exit 1 >usg
2362 Xecho exit 1 >v7
2363 Xecho exit 1 >osf1
2364 Xecho exit 1 >eunice
2365 Xecho exit 1 >xenix
2366 Xecho exit 1 >venix
2367 Xecho exit 1 >os2
2368 Xd_bsd="$undef"
2369 X$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2370 Xif test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2371 Xthen
2372 X       echo "Looks kind of like an OSF/1 system, but we'll see..."
2373 X       echo exit 0 >osf1
2374 Xelif test `echo abc | tr a-z A-Z` = Abc ; then
2375 X       xxx=`./loc addbib blurfl $pth`
2376 X       if $test -f $xxx; then
2377 X       echo "Looks kind of like a USG system with BSD features, but we'll see..."
2378 X               echo exit 0 >bsd
2379 X               echo exit 0 >usg
2380 X       else
2381 X               if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2382 X                       echo "Looks kind of like an extended USG system, but we'll see..."
2383 X               else
2384 X                       echo "Looks kind of like a USG system, but we'll see..."
2385 X               fi
2386 X               echo exit 0 >usg
2387 X       fi
2388 Xelif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2389 X       echo "Looks kind of like a BSD system, but we'll see..."
2390 X       d_bsd="$define"
2391 X       echo exit 0 >bsd
2392 Xelse
2393 X       echo "Looks kind of like a Version 7 system, but we'll see..."
2394 X       echo exit 0 >v7
2395 Xfi
2396 Xcase "$eunicefix" in
2397 X*unixtovms*)
2398 X       $cat <<'EOI'
2399 XThere is, however, a strange, musty smell in the air that reminds me of
2400 Xsomething...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2401 XEOI
2402 X       echo exit 0 >eunice
2403 X       d_eunice="$define"
2404 X: it so happens the Eunice I know will not run shell scripts in Unix format
2405 X       ;;
2406 X*)
2407 X       echo " "
2408 X       echo "Congratulations.  You aren't running Eunice."
2409 X       d_eunice="$undef"
2410 X       ;;
2411 Xesac
2412 X: Detect OS2.  The p_ variable is set above in the Head.U unit.
2413 Xcase "$p_" in
2414 X:) ;;
2415 X*)
2416 X       $cat <<'EOI'
2417 XI have the feeling something is not exactly right, however...don't tell me...
2418 Xlemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2419 XEOI
2420 X       echo exit 0 >os2
2421 X       ;;
2422 Xesac
2423 Xif test -f /xenix; then
2424 X       echo "Actually, this looks more like a XENIX system..."
2425 X       echo exit 0 >xenix
2426 X       d_xenix="$define"
2427 Xelse
2428 X       echo " "
2429 X       echo "It's not Xenix..."
2430 X       d_xenix="$undef"
2431 Xfi
2432 Xchmod +x xenix
2433 X$eunicefix xenix
2434 Xif test -f /venix; then
2435 X       echo "Actually, this looks more like a VENIX system..."
2436 X       echo exit 0 >venix
2437 Xelse
2438 X       echo " "
2439 X       if ./xenix; then
2440 X               : null
2441 X       else
2442 X               echo "Nor is it Venix..."
2443 X       fi
2444 Xfi
2445 Xchmod +x bsd usg v7 osf1 eunice xenix venix os2
2446 X$eunicefix bsd usg v7 osf1 eunice xenix venix os2
2447 X$rm -f foo
2448 X
2449 X: see if we need a special compiler
2450 Xecho " "
2451 Xif ./usg; then
2452 X       case "$cc" in
2453 X       '') case "$Mcc" in
2454 X               /*) dflt='Mcc';;
2455 X               *) case "$large" in
2456 X                       -M*) dflt='cc';;
2457 X                       *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
2458 X                                       if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
2459 X                                               dflt='cc'
2460 X                                       else
2461 X                                               dflt='cc -M'
2462 X                                       fi
2463 X                               else
2464 X                                       dflt='cc'
2465 X                               fi;;
2466 X                       esac;;
2467 X               esac;;
2468 X       *)  dflt="$cc";;
2469 X       esac
2470 X       case "$dflt" in
2471 X       *M*)    $cat <<'EOM'
2472 XOn some older systems the default C compiler will not resolve multiple global
2473 Xreferences that happen to have the same name.  On some such systems the "Mcc"
2474 Xcommand may be used to force these to be resolved.  On other systems a "cc -M"
2475 Xcommand is required.  (Note that the -M flag on other systems indicates a
2476 Xmemory model to use!) If you have the Gnu C compiler, you might wish to use
2477 Xthat instead.
2478 X
2479 XEOM
2480 X       ;;
2481 X       esac
2482 X       rp="Use which C compiler?"
2483 X       . ./myread
2484 X       cc="$ans"
2485 Xelse
2486 X       case "$cc" in
2487 X       '') dflt=cc;;
2488 X       *) dflt="$cc";;
2489 X       esac
2490 X       rp="Use which C compiler?"
2491 X       . ./myread
2492 X       cc="$ans"
2493 Xfi
2494 X: Look for a hint-file generated 'call-back-unit'.  Now that the
2495 X: user has specified the compiler, we may need to set or change some
2496 X: other defaults.
2497 Xif $test -f cc.cbu; then
2498 X    . ./cc.cbu
2499 Xfi
2500 Xecho " "
2501 Xecho "Checking for GNU cc in disguise and/or its version number..." >&4
2502 X$cat >gccvers.c <<EOM
2503 X#include <stdio.h>
2504 Xint main() {
2505 X#ifdef __GNUC__
2506 X#ifdef __VERSION__
2507 X       printf("%s\n", __VERSION__);
2508 X#else
2509 X       printf("%s\n", "1");
2510 X#endif
2511 X#endif
2512 X       exit(0);
2513 X}
2514 XEOM
2515 Xif $cc -o gccvers gccvers.c >/dev/null 2>&1; then
2516 X       gccversion=`./gccvers`
2517 X       case "$gccversion" in
2518 X       '') echo "You are not using GNU cc." ;;
2519 X       *)  echo "You are using GNU cc $gccversion." ;;
2520 X       esac
2521 Xelse
2522 X       echo " "
2523 X       echo "*** WHOA THERE!!! ***" >&4
2524 X       echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
2525 X       case "$knowitall" in
2526 X       '')
2527 X       echo "    You'd better start hunting for one and let me know about it." >&4
2528 X               exit 1
2529 X               ;;
2530 X       esac
2531 Xfi
2532 X$rm -f gccvers*
2533 Xcase "$gccversion" in
2534 X1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
2535 Xesac
2536 X
2537 X: What should the include directory be ?
2538 Xecho " "
2539 X$echo $n "Hmm...  $c"
2540 Xdflt='/usr/include'
2541 Xincpath=''
2542 Xmips_type=''
2543 Xif $test -f /bin/mips && /bin/mips; then
2544 X       echo "Looks like a MIPS system..."
2545 X       $cat >usr.c <<'EOCP'
2546 X#ifdef SYSTYPE_BSD43
2547 X/bsd43
2548 X#endif
2549 XEOCP
2550 X       if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
2551 X               dflt='/bsd43/usr/include'
2552 X               incpath='/bsd43'
2553 X               mips_type='BSD 4.3'
2554 X       else
2555 X               mips_type='System V'
2556 X       fi
2557 X       $rm -f usr.c usr.out
2558 X       echo "and you're compiling with the $mips_type compiler and libraries."
2559 X       xxx_prompt=y
2560 X       echo "exit 0" >mips
2561 Xelse
2562 X       echo "Doesn't look like a MIPS system."
2563 X       xxx_prompt=n
2564 X       echo "exit 1" >mips
2565 Xfi
2566 Xchmod +x mips
2567 X$eunicefix mips
2568 Xcase "$usrinc" in
2569 X'') ;;
2570 X*) dflt="$usrinc";;
2571 Xesac
2572 Xcase "$xxx_prompt" in
2573 Xy)     fn=d/
2574 X       echo " "
2575 X       rp='Where are the include files you want to use?'
2576 X       . ./getfile
2577 X       usrinc="$ans"
2578 X       ;;
2579 X*)     usrinc="$dflt"
2580 X       ;;
2581 Xesac
2582 X
2583 X: Set private lib path
2584 Xcase "$plibpth" in
2585 X'') if ./mips; then
2586 X               plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
2587 X       fi;;
2588 Xesac
2589 Xcase "$libpth" in
2590 X' ') dlist='';;
2591 X'') dlist="$loclibpth $plibpth $glibpth";;
2592 X*) dlist="$libpth";;
2593 Xesac
2594 X
2595 X: Now check and see which directories actually exist, avoiding duplicates
2596 Xlibpth=''
2597 Xfor xxx in $dlist
2598 Xdo
2599 X    if $test -d $xxx; then
2600 X               case " $libpth " in
2601 X               *" $xxx "*) ;;
2602 X               *) libpth="$libpth $xxx";;
2603 X               esac
2604 X    fi
2605 Xdone
2606 X$cat <<'EOM'
2607 X
2608 XSome systems have incompatible or broken versions of libraries.  Among
2609 Xthe directories listed in the question below, please remove any you
2610 Xknow not to be holding relevant libraries, and add any that are needed.
2611 XSay "none" for none.
2612 X
2613 XEOM
2614 Xcase "$libpth" in
2615 X'') dflt='none';;
2616 X*)
2617 X       set X $libpth
2618 X       shift
2619 X       dflt=${1+"$@"}
2620 X       ;;
2621 Xesac
2622 Xrp="Directories to use for library searches?"
2623 X. ./myread
2624 Xcase "$ans" in
2625 Xnone) libpth=' ';;
2626 X*) libpth="$ans";;
2627 Xesac
2628 X
2629 X: compute shared library extension
2630 Xcase "$so" in
2631 X'')
2632 X       if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
2633 X               dflt='sl'
2634 X       else
2635 X               dflt='so'
2636 X       fi
2637 X       ;;
2638 X*) dflt="$so";;
2639 Xesac
2640 X$cat <<EOM
2641 X
2642 XOn some systems, shared libraries may be available.  Answer 'none' if
2643 Xyou want to suppress searching of shared libraries for the remaining
2644 Xof this configuration.
2645 X
2646 XEOM
2647 Xrp='What is the file extension used for shared libraries?'
2648 X. ./myread
2649 Xso="$ans"
2650 X
2651 X: Define several unixisms.
2652 X: Hints files or command line option can be used to override them.
2653 X: The convoluted testing is in case hints files set either the old
2654 X: or the new name.
2655 Xcase "$_exe" in
2656 X'')    case "$exe_ext" in
2657 X    '')        ;;
2658 X       *)      _exe="$exe_ext" ;;
2659 X       esac
2660 X       ;;
2661 Xesac
2662 Xcase "$_a" in
2663 X'')    case "$lib_ext" in
2664 X    '')        _a='.a';;
2665 X       *)      _a="$lib_ext" ;;
2666 X       esac
2667 X       ;;
2668 Xesac
2669 Xcase "$_o" in
2670 X'') case "$obj_ext" in
2671 X       '')     _o='.o';;
2672 X       *)      _o="$obj_ext";;
2673 X       esac
2674 X       ;;
2675 Xesac
2676 Xcase "$p_" in
2677 X'') case "$path_sep" in
2678 X       '')     p_=':';;
2679 X       *)      p_="$path_sep";;
2680 X       esac
2681 X       ;;
2682 Xesac
2683 Xexe_ext=$_exe
2684 Xlib_ext=$_a
2685 Xobj_ext=$_o
2686 Xpath_sep=$p_
2687 X
2688 X: Looking for optional libraries
2689 Xecho " "
2690 Xecho "Checking for optional libraries..." >&4
2691 Xcase "$libs" in
2692 X' '|'') dflt='';;
2693 X*) dflt="$libs";;
2694 Xesac
2695 Xcase "$libswanted" in
2696 X'') libswanted='c_s';;
2697 Xesac
2698 Xfor thislib in $libswanted; do
2699 X
2700 X       if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`; $test -f "$xxx"; then
2701 X               echo "Found -l$thislib (shared)."
2702 X               case " $dflt " in
2703 X               *"-l$thislib "*);;
2704 X               *) dflt="$dflt -l$thislib";;
2705 X               esac
2706 X       elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
2707 X               echo "Found -l$thislib (shared)."
2708 X               case " $dflt " in
2709 X               *"-l$thislib "*);;
2710 X               *) dflt="$dflt -l$thislib";;
2711 X               esac
2712 X       elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
2713 X               echo "Found -l$thislib."
2714 X               case " $dflt " in
2715 X               *"-l$thislib "*);;
2716 X               *) dflt="$dflt -l$thislib";;
2717 X               esac
2718 X       elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
2719 X               echo "Found -l$thislib."
2720 X               case " $dflt " in
2721 X               *"-l$thislib "*);;
2722 X               *) dflt="$dflt -l$thislib";;
2723 X               esac
2724 X       elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
2725 X               echo "Found -l${thislib}_s."
2726 X               case " $dflt " in
2727 X               *"-l$thislib "*);;
2728 X               *) dflt="$dflt -l${thislib}_s";;
2729 X               esac
2730 X       elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
2731 X               echo "Found -l$thislib."
2732 X               case " $dflt " in
2733 X               *"-l$thislib "*);;
2734 X               *) dflt="$dflt -l$thislib";;
2735 X               esac
2736 X       else
2737 X               echo "No -l$thislib."
2738 X       fi
2739 Xdone
2740 Xset X $dflt
2741 Xshift
2742 Xdflt="$*"
2743 Xcase "$libs" in
2744 X'') dflt="$dflt";;
2745 X*) dflt="$libs";;
2746 Xesac
2747 Xcase "$dflt" in
2748 X' '|'') dflt='none';;
2749 Xesac
2750 X
2751 X$cat <<EOM
2752 X
2753 XSome versions of Unix support shared libraries, which make executables smaller
2754 Xbut make load time slightly longer.
2755 X
2756 XOn some systems, mostly System V Release 3's, the shared library is included
2757 Xby putting the option "-lc_s" as the last thing on the cc command line when
2758 Xlinking.  Other systems use shared libraries by default.  There may be other
2759 Xlibraries needed to compile $package on your machine as well.  If your system
2760 Xneeds the "-lc_s" option, include it here.  Include any other special libraries
2761 Xhere as well.  Say "none" for none.
2762 XEOM
2763 X
2764 Xecho " "
2765 Xrp="Any additional libraries?"
2766 X. ./myread
2767 Xcase "$ans" in
2768 Xnone) libs=' ';;
2769 X*) libs="$ans";;
2770 Xesac
2771 X
2772 X: see how we invoke the C preprocessor
2773 Xecho " "
2774 Xecho "Now, how can we feed standard input to your C preprocessor..." >&4
2775 Xcat <<'EOT' >testcpp.c
2776 X#define ABC abc
2777 X#define XYZ xyz
2778 XABC.XYZ
2779 XEOT
2780 Xcd ..
2781 Xecho 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
2782 Xchmod 755 cppstdin
2783 Xwrapper=`pwd`/cppstdin
2784 Xok='false'
2785 Xcd UU
2786 X
2787 Xif $test "X$cppstdin" != "X" && \
2788 X       $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
2789 X       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
2790 Xthen
2791 X       echo "You used to use $cppstdin $cppminus so we'll use that again."
2792 X       case "$cpprun" in
2793 X       '') echo "But let's see if we can live without a wrapper..." ;;
2794 X       *)
2795 X               if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
2796 X                       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
2797 X               then
2798 X                       echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
2799 X                       ok='true'
2800 X               else
2801 X                       echo "(However, $cpprun $cpplast does not work, let's see...)"
2802 X               fi
2803 X               ;;
2804 X       esac
2805 Xelse
2806 X       case "$cppstdin" in
2807 X       '') ;;
2808 X       *)
2809 X               echo "Good old $cppstdin $cppminus does not seem to be of any help..."
2810 X               ;;
2811 X       esac
2812 Xfi
2813 X
2814 Xif $ok; then
2815 X       : nothing
2816 Xelif echo 'Maybe "'"$cc"' -E" will work...'; \
2817 X       $cc -E <testcpp.c >testcpp.out 2>&1; \
2818 X       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2819 X       echo "Yup, it does."
2820 X       x_cpp="$cc -E"
2821 X       x_minus='';
2822 Xelif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
2823 X       $cc -E - <testcpp.c >testcpp.out 2>&1; \
2824 X       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2825 X       echo "Yup, it does."
2826 X       x_cpp="$cc -E"
2827 X       x_minus='-';
2828 Xelif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
2829 X       $cc -P <testcpp.c >testcpp.out 2>&1; \
2830 X       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2831 X       echo "Yipee, that works!"
2832 X       x_cpp="$cc -P"
2833 X       x_minus='';
2834 Xelif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
2835 X       $cc -P - <testcpp.c >testcpp.out 2>&1; \
2836 X       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2837 X       echo "At long last!"
2838 X       x_cpp="$cc -P"
2839 X       x_minus='-';
2840 Xelif echo 'No such luck, maybe "'$cpp'" will work...'; \
2841 X       $cpp <testcpp.c >testcpp.out 2>&1; \
2842 X       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2843 X       echo "It works!"
2844 X       x_cpp="$cpp"
2845 X       x_minus='';
2846 Xelif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
2847 X       $cpp - <testcpp.c >testcpp.out 2>&1; \
2848 X       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2849 X       echo "Hooray, it works!  I was beginning to wonder."
2850 X       x_cpp="$cpp"
2851 X       x_minus='-';
2852 Xelif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
2853 X       $wrapper <testcpp.c >testcpp.out 2>&1; \
2854 X       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2855 X       x_cpp="$wrapper"
2856 X       x_minus=''
2857 X       echo "Eureka!"
2858 Xelse
2859 X       dflt=''
2860 X       rp="No dice.  I can't find a C preprocessor.  Name one:"
2861 X       . ./myread
2862 X       x_cpp="$ans"
2863 X       x_minus=''
2864 X       $x_cpp <testcpp.c >testcpp.out 2>&1
2865 X       if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2866 X               echo "OK, that will do." >&4
2867 X       else
2868 Xecho "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
2869 X               exit 1
2870 X       fi
2871 Xfi
2872 X
2873 Xcase "$ok" in
2874 Xfalse)
2875 X       cppstdin="$x_cpp"
2876 X       cppminus="$x_minus"
2877 X       cpprun="$x_cpp"
2878 X       cpplast="$x_minus"
2879 X       set X $x_cpp
2880 X       shift
2881 X       case "$1" in
2882 X       "$cpp")
2883 X               echo "Perhaps can we force $cc -E using a wrapper..."
2884 X               if $wrapper <testcpp.c >testcpp.out 2>&1; \
2885 X                       $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
2886 X               then
2887 X                       echo "Yup, we can."
2888 X                       cppstdin="$wrapper"
2889 X                       cppminus='';
2890 X               else
2891 X                       echo "Nope, we'll have to live without it..."
2892 X               fi
2893 X               ;;
2894 X       esac
2895 X       case "$cpprun" in
2896 X       "$wrapper")
2897 X               cpprun=''
2898 X               cpplast=''
2899 X               ;;
2900 X       esac
2901 X       ;;
2902 Xesac
2903 X
2904 Xcase "$cppstdin" in
2905 X"$wrapper") ;;
2906 X*) $rm -f $wrapper;;
2907 Xesac
2908 X$rm -f testcpp.c testcpp.out
2909 X
2910 X: determine optimize, if desired, or use for debug flag also
2911 Xcase "$optimize" in
2912 X' '|$undef) dflt='none';;
2913 X'') dflt='-O';;
2914 X*) dflt="$optimize";;
2915 Xesac
2916 X$cat <<EOH
2917 X
2918 XSome C compilers have problems with their optimizers.  By default, $package
2919 Xcompiles with the -O flag to use the optimizer.  Alternately, you might want
2920 Xto use the symbolic debugger, which uses the -g flag (on traditional Unix
2921 Xsystems).  Either flag can be specified here.  To use neither flag, specify
2922 Xthe word "none".
2923 X
2924 XEOH
2925 Xrp="What optimizer/debugger flag should be used?"
2926 X. ./myread
2927 Xoptimize="$ans"
2928 Xcase "$optimize" in
2929 X'none') optimize=" ";;
2930 Xesac
2931 X
2932 Xdflt=''
2933 X: We will not override a previous value, but we might want to
2934 X: augment a hint file
2935 Xcase "$hint" in
2936 Xnone|recommended)
2937 X       case "$gccversion" in
2938 X       1*) dflt='-fpcc-struct-return' ;;
2939 X       esac
2940 X       case "$optimize" in
2941 X       *-g*) dflt="$dflt";;
2942 X       esac
2943 X       case "$gccversion" in
2944 X       2*) if test -d /etc/conf/kconfig.d &&
2945 X                       $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
2946 X               then
2947 X                       dflt="$dflt -posix"
2948 X               fi
2949 X               ;;
2950 X       esac
2951 X       ;;
2952 Xesac
2953 X
2954 Xcase "$mips_type" in
2955 X*BSD*|'') inclwanted="$locincpth $usrinc";;
2956 X*) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
2957 Xesac
2958 Xfor thisincl in $inclwanted; do
2959 X       if $test -d $thisincl; then
2960 X               if $test x$thisincl != x$usrinc; then
2961 X                       case "$dflt" in
2962 X                       *$thisincl*);;
2963 X                       *) dflt="$dflt -I$thisincl";;
2964 X                       esac
2965 X               fi
2966 X       fi
2967 Xdone
2968 X
2969 Xinctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
2970 X       xxx=true;
2971 Xelif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
2972 X       xxx=true;
2973 Xelse
2974 X       xxx=false;
2975 Xfi;
2976 Xif $xxx; then
2977 X       case "$dflt" in
2978 X       *$2*);;
2979 X       *) dflt="$dflt -D$2";;
2980 X       esac;
2981 Xfi'
2982 X
2983 Xif ./osf1; then
2984 X       set signal.h __LANGUAGE_C__; eval $inctest
2985 Xelse
2986 X       set signal.h LANGUAGE_C; eval $inctest
2987 Xfi
2988 X
2989 Xcase "$hint" in
2990 Xnone|recommended) dflt="$ccflags $dflt" ;;
2991 X*) dflt="$ccflags";;
2992 Xesac
2993 X
2994 Xcase "$dflt" in
2995 X''|' ') dflt=none;;
2996 Xesac
2997 X$cat <<EOH
2998 X
2999 XYour C compiler may want other flags.  For this question you should include
3000 X-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3001 Xbut you should NOT include libraries or ld flags like -lwhatever.  If you
3002 Xwant $package to honor its debug switch, you should include -DDEBUGGING here.
3003 XYour C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3004 X
3005 XTo use no flags, specify the word "none".
3006 X
3007 XEOH
3008 Xset X $dflt
3009 Xshift
3010 Xdflt=${1+"$@"}
3011 Xrp="Any additional cc flags?"
3012 X. ./myread
3013 Xcase "$ans" in
3014 Xnone) ccflags='';;
3015 X*) ccflags="$ans";;
3016 Xesac
3017 X
3018 X: the following weeds options from ccflags that are of no interest to cpp
3019 Xcppflags="$ccflags"
3020 Xcase "$gccversion" in
3021 X1*) cppflags="$cppflags -D__GNUC__"
3022 Xesac
3023 Xcase "$mips_type" in
3024 X'');;
3025 X*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3026 Xesac
3027 Xcase "$cppflags" in
3028 X'');;
3029 X*)
3030 X       echo " "
3031 X       echo "Let me guess what the preprocessor flags are..." >&4
3032 X       set X $cppflags
3033 X       shift
3034 X       cppflags=''
3035 X       $cat >cpp.c <<'EOM'
3036 X#define BLURFL foo
3037 X
3038 XBLURFL xx LFRULB
3039 XEOM
3040 X       previous=''
3041 X       for flag in $*
3042 X       do
3043 X               case "$flag" in
3044 X               -*) ftry="$flag";;
3045 X               *) ftry="$previous $flag";;
3046 X               esac
3047 X               if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3048 X                       >cpp1.out 2>/dev/null && \
3049 X                       $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3050 X                       >cpp2.out 2>/dev/null && \
3051 X                       $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3052 X                       $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3053 X               then
3054 X                       cppflags="$cppflags $ftry"
3055 X                       previous=''
3056 X               else
3057 X                       previous="$flag"
3058 X               fi
3059 X       done
3060 X       set X $cppflags
3061 X       shift
3062 X       cppflags=${1+"$@"}
3063 X       case "$cppflags" in
3064 X       *-*)  echo "They appear to be: $cppflags";;
3065 X       esac
3066 X       $rm -f cpp.c cpp?.out
3067 X       ;;
3068 Xesac
3069 X
3070 X: flags used in final linking phase
3071 Xcase "$ldflags" in
3072 X'') if ./venix; then
3073 X               dflt='-i -z'
3074 X       else
3075 X               dflt=''
3076 X       fi
3077 X       case "$ccflags" in
3078 X       *-posix*) dflt="$dflt -posix" ;;
3079 X       esac
3080 X       ;;
3081 X*) dflt="$ldflags";;
3082 Xesac
3083 X
3084 X: Try to guess additional flags to pick up local libraries.
3085 Xfor thislibdir in $libpth; do
3086 X       case " $loclibpth " in
3087 X       *" $thislibdir "*)
3088 X               case "$dflt " in
3089 X               *"-L$thislibdir "*) ;;
3090 X               *)  dflt="$dflt -L$thislibdir" ;;
3091 X               esac
3092 X               ;;
3093 X       esac
3094 Xdone
3095 X
3096 Xcase "$dflt" in
3097 X'') dflt='none' ;;
3098 Xesac
3099 X
3100 X$cat <<EOH
3101 X
3102 XYour C linker may need flags.  For this question you should
3103 Xinclude -L/whatever and any other flags used by the C linker, but you
3104 Xshould NOT include libraries like -lwhatever.
3105 X
3106 XMake sure you include the appropriate -L/path flags if your C linker
3107 Xdoes not normally search all of the directories you specified above,
3108 Xnamely
3109 X       $libpth
3110 XTo use no flags, specify the word "none".
3111 X
3112 XEOH
3113 X
3114 Xrp="Any additional ld flags (NOT including libraries)?"
3115 X. ./myread
3116 Xcase "$ans" in
3117 Xnone) ldflags='';;
3118 X*) ldflags="$ans";;
3119 Xesac
3120 Xrmlist="$rmlist pdp11"
3121 X
3122 X: coherency check
3123 Xecho " "
3124 Xecho "Checking your choice of C compiler and flags for coherency..." >&4
3125 Xset X $cc $optimize $ccflags $ldflags -o try try.c $libs
3126 Xshift
3127 X$cat >try.msg <<EOM
3128 XI've tried to compile and run a simple program with:
3129 X
3130 X       $*
3131 X       ./try
3132 X
3133 Xand I got the following output:
3134 X
3135 XEOM
3136 X$cat > try.c <<'EOF'
3137 X#include <stdio.h>
3138 Xmain() { printf("Ok\n"); exit(0); }
3139 XEOF
3140 Xdflt=y
3141 Xif sh -c "$cc $optimize $ccflags $ldflags -o try try.c $libs" >>try.msg 2>&1; then
3142 X       if sh -c './try' >>try.msg 2>&1; then
3143 X               xxx=`./try`
3144 X               case "$xxx" in
3145 X               "Ok") dflt=n ;;
3146 X               *)      echo 'The program compiled OK, but produced no output.' >> try.msg
3147 X                       case " $libs " in
3148 X                       *" -lsfio "*)
3149 X                               cat >> try.msg <<'EOQS'
3150 XIf $libs contains -lsfio, and sfio is mis-configured, then it
3151 Xsometimes (apparently) runs and exits with a 0 status, but with no
3152 Xoutput!  It may have to do with sfio's use of _exit vs. exit.
3153 X
3154 XEOQS
3155 X                               rp="You have a big problem.  Shall I abort Configure"
3156 X                               dflt=y
3157 X                               ;;
3158 X                       esac
3159 X                       ;;
3160 X               esac
3161 X       else
3162 X               echo "The program compiled OK, but exited with status $?." >>try.msg
3163 X               rp="You have a problem.  Shall I abort Configure"
3164 X               dflt=y
3165 X       fi
3166 Xelse
3167 X       echo "I can't compile the test program." >>try.msg
3168 X       rp="You have a BIG problem.  Shall I abort Configure"
3169 X       dflt=y
3170 Xfi
3171 Xcase "$dflt" in
3172 Xy)
3173 X       $cat try.msg >&4
3174 X       case "$knowitall" in
3175 X       '')
3176 X               echo "(The supplied flags might be incorrect with this C compiler.)"
3177 X               ;;
3178 X       *) dflt=n;;
3179 X       esac
3180 X       echo " "
3181 X       . ./myread
3182 X       case "$ans" in
3183 X       n*|N*) ;;
3184 X       *)      echo "Ok.  Stopping Configure." >&4
3185 X               exit 1
3186 X               ;;
3187 X       esac
3188 X       ;;
3189 Xn) echo "OK, that should do.";;
3190 Xesac
3191 X$rm -f try try.* core
3192 X
3193 X: define a shorthand compile call
3194 Xcompile='
3195 Xmc_file=$1;
3196 Xshift;
3197 X$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
3198 X: define a shorthand compile call for compilations that should be ok.
3199 Xcompile_ok='
3200 Xmc_file=$1;
3201 Xshift;
3202 X$cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
3203 X
3204 Xecho " "
3205 Xecho "Checking for GNU C Library..." >&4
3206 Xcat >gnulibc.c <<EOM
3207 X#include <stdio.h>
3208 Xint
3209 Xmain()
3210 X{
3211 X#ifdef __GLIBC__
3212 X    exit(0);
3213 X#else
3214 X    exit(1);
3215 X#endif
3216 X}
3217 XEOM
3218 Xset gnulibc
3219 Xif eval $compile_ok && ./gnulibc; then
3220 X       val="$define"
3221 X       echo "You are using the GNU C Library"
3222 Xelse
3223 X       val="$undef"
3224 X       echo "You are not using the GNU C Library"
3225 Xfi
3226 X$rm -f gnulibc*
3227 Xset d_gnulibc
3228 Xeval $setvar
3229 X
3230 X: see if nm is to be used to determine whether a symbol is defined or not
3231 Xcase "$usenm" in
3232 X'')
3233 X       dflt=''
3234 X       case "$d_gnulibc" in
3235 X       "$define")
3236 X               echo " "
3237 X               echo "nm probably won't work on the GNU C Library." >&4
3238 X               dflt=n
3239 X               ;;
3240 X       esac
3241 X       case "$dflt" in
3242 X       '')
3243 X               if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
3244 X                       echo " "
3245 X                       echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
3246 X                       echo "'nm' won't be sufficient on this sytem." >&4
3247 X                       dflt=n
3248 X               fi
3249 X               ;;
3250 X       esac
3251 X       case "$dflt" in
3252 X       '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
3253 X               if $test $dflt -gt 20; then
3254 X                       dflt=y
3255 X               else
3256 X                       dflt=n
3257 X               fi
3258 X               ;;
3259 X       esac
3260 X       ;;
3261 X*)
3262 X       case "$usenm" in
3263 X       true|$define) dflt=y;;
3264 X       *) dflt=n;;
3265 X       esac
3266 X       ;;
3267 Xesac
3268 X$cat <<EOM
3269 X
3270 XI can use $nm to extract the symbols from your C libraries. This
3271 Xis a time consuming task which may generate huge output on the disk (up
3272 Xto 3 megabytes) but that should make the symbols extraction faster. The
3273 Xalternative is to skip the 'nm' extraction part and to compile a small
3274 Xtest program instead to determine whether each symbol is present. If
3275 Xyou have a fast C compiler and/or if your 'nm' output cannot be parsed,
3276 Xthis may be the best solution.
3277 X
3278 XYou probably shouldn't let me use 'nm' if you are using the GNU C Library.
3279 X
3280 XEOM
3281 Xrp="Shall I use $nm to extract C symbols from the libraries?"
3282 X. ./myread
3283 Xcase "$ans" in
3284 X[Nn]*) usenm=false;;
3285 X*) usenm=true;;
3286 Xesac
3287 X
3288 Xrunnm=$usenm
3289 Xcase "$reuseval" in
3290 Xtrue) runnm=false;;
3291 Xesac
3292 X
3293 X: nm options which may be necessary
3294 Xcase "$nm_opt" in
3295 X'') if $test -f /mach_boot; then
3296 X               nm_opt=''       # Mach
3297 X       elif $test -d /usr/ccs/lib; then
3298 X               nm_opt='-p'     # Solaris (and SunOS?)
3299 X       elif $test -f /dgux; then
3300 X               nm_opt='-p'     # DG-UX
3301 X       elif $test -f /lib64/rld; then
3302 X               nm_opt='-p'     # 64-bit Irix
3303 X       else
3304 X               nm_opt=''
3305 X       fi;;
3306 Xesac
3307 X
3308 X: nm options which may be necessary for shared libraries but illegal
3309 X: for archive libraries.  Thank you, Linux.
3310 Xcase "$nm_so_opt" in
3311 X'')    case "$myuname" in
3312 X       *linux*)
3313 X               if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
3314 X                       nm_so_opt='--dynamic'
3315 X               fi
3316 X               ;;
3317 X       esac
3318 X       ;;
3319 Xesac
3320 X
3321 Xcase "$runnm" in
3322 Xtrue)
3323 X: get list of predefined functions in a handy place
3324 Xecho " "
3325 Xcase "$libc" in
3326 X'') libc=unknown
3327 X       case "$libs" in
3328 X       *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
3329 X       esac
3330 X       ;;
3331 Xesac
3332 Xlibnames='';
3333 Xcase "$libs" in
3334 X'') ;;
3335 X*)  for thislib in $libs; do
3336 X       case "$thislib" in
3337 X       -lc|-lc_s)
3338 X               : Handle C library specially below.
3339 X               ;;
3340 X       -l*)
3341 X               thislib=`echo $thislib | $sed -e 's/^-l//'`
3342 X               if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
3343 X                       :
3344 X               elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
3345 X                       :
3346 X               elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
3347 X                       :
3348 X               elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
3349 X                       :
3350 X               elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
3351 X                       :
3352 X               elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
3353 X                       :
3354 X               elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
3355 X                       :
3356 X               else
3357 X                       try=''
3358 X               fi
3359 X               libnames="$libnames $try"
3360 X               ;;
3361 X       *) libnames="$libnames $thislib" ;;
3362 X       esac
3363 X       done
3364 X       ;;
3365 Xesac
3366 Xxxx=normal
3367 Xcase "$libc" in
3368 Xunknown)
3369 X       set /lib/libc.$so
3370 X       for xxx in $libpth; do
3371 X               $test -r $1 || set $xxx/libc.$so
3372 X               : The messy sed command sorts on library version numbers.
3373 X               $test -r $1 || \
3374 X                       set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
3375 X                       tr ' ' '\012' | egrep -v '\.[A-Za-z]*$' | $sed -e '
3376 X                               h
3377 X                               s/[0-9][0-9]*/0000&/g
3378 X                               s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
3379 X                               G
3380 X                               s/\n/ /' | \
3381 X                        sort | $sed -e 's/^.* //'`
3382 X               eval set \$$#
3383 X       done
3384 X       $test -r $1 || set /usr/ccs/lib/libc.$so
3385 X       $test -r $1 || set /lib/libsys_s$_a
3386 X       ;;
3387 X*)
3388 X       set blurfl
3389 X       ;;
3390 Xesac
3391 Xif $test -r "$1"; then
3392 X       echo "Your (shared) C library seems to be in $1."
3393 X       libc="$1"
3394 Xelif $test -r /lib/libc && $test -r /lib/clib; then
3395 X       echo "Your C library seems to be in both /lib/clib and /lib/libc."
3396 X       xxx=apollo
3397 X       libc='/lib/clib /lib/libc'
3398 X       if $test -r /lib/syslib; then
3399 X               echo "(Your math library is in /lib/syslib.)"
3400 X               libc="$libc /lib/syslib"
3401 X       fi
3402 Xelif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
3403 X       echo "Your C library seems to be in $libc, as you said before."
3404 Xelif $test -r $incpath/usr/lib/libc$_a; then
3405 X       libc=$incpath/usr/lib/libc$_a;
3406 X       echo "Your C library seems to be in $libc.  That's fine."
3407 Xelif $test -r /lib/libc$_a; then
3408 X       libc=/lib/libc$_a;
3409 X       echo "Your C library seems to be in $libc.  You're normal."
3410 Xelse
3411 X       if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
3412 X               :
3413 X       elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
3414 X               libnames="$libnames "`./loc clib blurfl/dyick $libpth`
3415 X       elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
3416 X               :
3417 X       elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
3418 X               :
3419 X       elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
3420 X               :
3421 X       else
3422 X               tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
3423 X       fi
3424 X       if $test -r "$tans"; then
3425 X               echo "Your C library seems to be in $tans, of all places."
3426 X               libc=$tans
3427 X       else
3428 X               libc='blurfl'
3429 X       fi
3430 Xfi
3431 Xif $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
3432 X       dflt="$libc"
3433 X       cat <<EOM
3434 X
3435 XIf the guess above is wrong (which it might be if you're using a strange
3436 Xcompiler, or your machine supports multiple models), you can override it here.
3437 X
3438 XEOM
3439 Xelse
3440 X       dflt=''
3441 X       echo $libpth | tr ' ' '\012' | sort | uniq > libpath
3442 X       cat >&4 <<EOM
3443 XI can't seem to find your C library.  I've looked in the following places:
3444 X
3445 XEOM
3446 X       $sed 's/^/      /' libpath
3447 X       cat <<EOM
3448 X
3449 XNone of these seems to contain your C library. I need to get its name...
3450 X
3451 XEOM
3452 Xfi
3453 Xfn=f
3454 Xrp='Where is your C library?'
3455 X. ./getfile
3456 Xlibc="$ans"
3457 X
3458 Xecho " "
3459 Xecho $libc $libnames | tr ' ' '\012' | sort | uniq > libnames
3460 Xset X `cat libnames`
3461 Xshift
3462 Xxxx=files
3463 Xcase $# in 1) xxx=file; esac
3464 Xecho "Extracting names from the following $xxx for later perusal:" >&4
3465 Xecho " "
3466 X$sed 's/^/     /' libnames >&4
3467 Xecho " "
3468 X$echo $n "This may take a while...$c" >&4
3469 X
3470 Xfor file in $*; do
3471 X       case $file in
3472 X       *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
3473 X       *) $nm $nm_opt $file 2>/dev/null;;
3474 X       esac
3475 Xdone >libc.tmp
3476 X
3477 X$echo $n ".$c"
3478 X$grep fprintf libc.tmp > libc.ptf
3479 Xxscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
3480 Xxrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
3481 Xxxx='[ADTSIW]'
3482 Xif com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
3483 X       eval $xscan;\
3484 X       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3485 X               eval $xrun
3486 Xelif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
3487 X       eval $xscan;\
3488 X       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3489 X               eval $xrun
3490 Xelif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
3491 X       eval $xscan;\
3492 X       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3493 X               eval $xrun
3494 Xelif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
3495 X       eval $xscan;\
3496 X       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3497 X               eval $xrun
3498 Xelif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
3499 X       eval $xscan;\
3500 X       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3501 X               eval $xrun
3502 Xelif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
3503 X       eval $xscan;\
3504 X       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3505 X               eval $xrun
3506 Xelif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
3507 X                               -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
3508 X       eval $xscan;\
3509 X       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3510 X               eval $xrun
3511 Xelif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
3512 X       eval $xscan;\
3513 X       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3514 X               eval $xrun
3515 Xelif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
3516 X       eval $xscan;\
3517 X       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3518 X               eval $xrun
3519 Xelif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
3520 X       eval $xscan;\
3521 X       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3522 X               eval $xrun
3523 Xelif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
3524 X       eval $xscan;\
3525 X       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3526 X               eval $xrun
3527 Xelif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
3528 X       eval $xscan;\
3529 X       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3530 X               eval $xrun
3531 Xelif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
3532 X       eval $xscan;\
3533 X       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3534 X               eval $xrun
3535 Xelse
3536 X       $nm -p $* 2>/dev/null >libc.tmp
3537 X       $grep fprintf libc.tmp > libc.ptf
3538 X       if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
3539 X               eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
3540 X       then
3541 X               nm_opt='-p'
3542 X               eval $xrun
3543 X       else
3544 X               echo " "
3545 X               echo "$nm didn't seem to work right. Trying $ar instead..." >&4
3546 X               com=''
3547 X               if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
3548 X                       for thisname in $libnames $libc; do
3549 X                               $ar t $thisname >>libc.tmp
3550 X                       done
3551 X                       $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
3552 X                       echo "Ok." >&4
3553 X               elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
3554 X                       # Repeat libc to extract forwarders to DLL entries too
3555 X                       for thisname in $libnames $libc; do
3556 X                               $ar tv $thisname >>libc.tmp
3557 X                               # Revision 50 of EMX has bug in $ar.
3558 X                               # it will not extract forwarders to DLL entries
3559 X                               # Use emximp which will extract exactly them.
3560 X                               emximp -o tmp.imp $thisname \
3561 X                                   2>/dev/null && \
3562 X                                   $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
3563 X                                   < tmp.imp >>libc.tmp
3564 X                               $rm tmp.imp
3565 X                       done
3566 X                       $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
3567 X                       echo "Ok." >&4
3568 X               else
3569 X                       echo "$ar didn't seem to work right." >&4
3570 X                       echo "Maybe this is a Cray...trying bld instead..." >&4
3571 X                       if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
3572 X                       then
3573 X                               for thisname in $libnames; do
3574 X                                       bld t $libnames | \
3575 X                                       $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
3576 X                                       $ar t $thisname >>libc.tmp
3577 X                               done
3578 X                               echo "Ok." >&4
3579 X                       else
3580 X                               echo "That didn't work either.  Giving up." >&4
3581 X                               exit 1
3582 X                       fi
3583 X               fi
3584 X       fi
3585 Xfi
3586 Xnm_extract="$com"
3587 Xif $test -f /lib/syscalls.exp; then
3588 X       echo " "
3589 X       echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
3590 X       $sed -n 's/^\([^        ]*\)[   ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list
3591 Xfi
3592 X;;
3593 Xesac
3594 X$rm -f libnames libpath
3595 X
3596 X: is a C symbol defined?
3597 Xcsym='tlook=$1;
3598 Xcase "$3" in
3599 X-v) tf=libc.tmp; tc=""; tdc="";;
3600 X-a) tf=libc.tmp; tc="[0]"; tdc="[]";;
3601 X*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
3602 Xesac;
3603 Xtx=yes;
3604 Xcase "$reuseval-$4" in
3605 Xtrue-) ;;
3606 Xtrue-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
3607 Xesac;
3608 Xcase "$tx" in
3609 Xyes)
3610 X       case "$runnm" in
3611 X       true)
3612 X               if $contains $tlook $tf >/dev/null 2>&1;
3613 X               then tval=true;
3614 X               else tval=false;
3615 X               fi;;
3616 X       *)
3617 X               echo "main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
3618 X               if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
3619 X               then tval=true;
3620 X               else tval=false;
3621 X               fi;
3622 X               $rm -f t t.c;;
3623 X       esac;;
3624 X*)
3625 X       case "$tval" in
3626 X       $define) tval=true;;
3627 X       *) tval=false;;
3628 X       esac;;
3629 Xesac;
3630 Xeval "$2=$tval"'
3631 X
3632 X: define an is-in-libc? function
3633 Xinlibc='echo " "; td=$define; tu=$undef;
3634 Xsym=$1; var=$2; eval "was=\$$2";
3635 Xtx=yes;
3636 Xcase "$reuseval$was" in
3637 Xtrue) ;;
3638 Xtrue*) tx=no;;
3639 Xesac;
3640 Xcase "$tx" in
3641 Xyes)
3642 X       set $sym tres -f;
3643 X       eval $csym;
3644 X       case "$tres" in
3645 X       true)
3646 X               echo "$sym() found." >&4;
3647 X               case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
3648 X       *)
3649 X               echo "$sym() NOT found." >&4;
3650 X               case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
3651 X       esac;;
3652 X*)
3653 X       case "$was" in
3654 X       $define) echo "$sym() found." >&4;;
3655 X       *) echo "$sym() NOT found." >&4;;
3656 X       esac;;
3657 Xesac'
3658 X
3659 X: see if bcopy exists
3660 Xset bcopy d_bcopy
3661 Xeval $inlibc
3662 X
3663 X: see if bzero exists
3664 Xset bzero d_bzero
3665 Xeval $inlibc
3666 X
3667 X: see if endmntent exists
3668 Xset endmntent d_endmntent
3669 Xeval $inlibc
3670 X
3671 X: see if fs_info exists
3672 Xset fs_info d_fs_info
3673 Xeval $inlibc
3674 X
3675 X: see if getmnt exists
3676 Xset getmnt d_getmnt
3677 Xeval $inlibc
3678 X
3679 X: see if getmntent exists
3680 Xset getmntent d_getmntent
3681 Xeval $inlibc
3682 X
3683 X: see if getmntinfo exists
3684 Xset getmntinfo d_getmntinfo
3685 Xeval $inlibc
3686 X: determine filename position in cpp output
3687 Xecho " "
3688 Xecho "Computing filename position in cpp output for #include directives..." >&4
3689 Xecho '#include <stdio.h>' > foo.c
3690 X$cat >fieldn <<EOF
3691 X$startsh
3692 X$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
3693 X$grep '^[      ]*#.*stdio\.h' | \
3694 Xwhile read cline; do
3695 X       pos=1
3696 X       set \$cline
3697 X       while $test \$# -gt 0; do
3698 X               if $test -r \`echo \$1 | $tr -d '"'\`; then
3699 X                       echo "\$pos"
3700 X                       exit 0
3701 X               fi
3702 X               shift
3703 X               pos=\`expr \$pos + 1\`
3704 X       done
3705 Xdone
3706 XEOF
3707 Xchmod +x fieldn
3708 Xfieldn=`./fieldn`
3709 X$rm -f foo.c fieldn
3710 Xcase $fieldn in
3711 X'') pos='???';;
3712 X1) pos=first;;
3713 X2) pos=second;;
3714 X3) pos=third;;
3715 X*) pos="${fieldn}th";;
3716 Xesac
3717 Xecho "Your cpp writes the filename in the $pos field of the line."
3718 X
3719 X: locate header file
3720 X$cat >findhdr <<EOF
3721 X$startsh
3722 Xwanted=\$1
3723 Xname=''
3724 Xif test -f $usrinc/\$wanted; then
3725 X       echo "$usrinc/\$wanted"
3726 X       exit 0
3727 Xfi
3728 Xawkprg='{ print \$$fieldn }'
3729 Xecho "#include <\$wanted>" > foo\$\$.c
3730 X$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3731 X$grep "^[      ]*#.*\$wanted" | \
3732 Xwhile read cline; do
3733 X       name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
3734 X       case "\$name" in
3735 X       */\$wanted) echo "\$name"; exit 0;;
3736 X       *) name='';;
3737 X       esac;
3738 Xdone;
3739 X$rm -f foo\$\$.c;
3740 Xcase "\$name" in
3741 X'') exit 1;;
3742 Xesac
3743 XEOF
3744 Xchmod +x findhdr
3745 X
3746 X: define an alternate in-header-list? function
3747 Xinhdr='echo " "; td=$define; tu=$undef; yyy=$@;
3748 Xcont=true; xxf="echo \"<\$1> found.\" >&4";
3749 Xcase $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
3750 X*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
3751 Xesac;
3752 Xcase $# in 4) instead=instead;; *) instead="at last";; esac;
3753 Xwhile $test "$cont"; do
3754 X       xxx=`./findhdr $1`
3755 X       var=$2; eval "was=\$$2";
3756 X       if $test "$xxx" && $test -r "$xxx";
3757 X       then eval $xxf;
3758 X       eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
3759 X               cont="";
3760 X       else eval $xxnf;
3761 X       eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
3762 X       set $yyy; shift; shift; yyy=$@;
3763 X       case $# in 0) cont="";;
3764 X       2) xxf="echo \"but I found <\$1> $instead.\" >&4";
3765 X               xxnf="echo \"and I did not find <\$1> either.\" >&4";;
3766 X       *) xxf="echo \"but I found <\$1\> instead.\" >&4";
3767 X               xxnf="echo \"there is no <\$1>, ...\" >&4";;
3768 X       esac;
3769 Xdone;
3770 Xwhile $test "$yyy";
3771 Xdo set $yyy; var=$2; eval "was=\$$2";
3772 X       eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
3773 X       set $yyy; shift; shift; yyy=$@;
3774 Xdone'
3775 X
3776 X: see if this is a sys/mount.h system
3777 Xset sys/mount.h i_sysmount
3778 Xeval $inhdr
3779 X
3780 Xset xxx valfstype valbsize valfsize
3781 Xvalfstype="$d_getmntinfofstype"
3782 Xvalbsize="$d_getmntinfobsize"
3783 Xvalfsize="$d_getmntinfofsize"
3784 X
3785 Xcase $valfstype in
3786 X    '') valfstype="$undef" ;;
3787 Xesac
3788 Xcase $valbsize in
3789 X    '') valbsize="$undef" ;;
3790 Xesac
3791 Xcase $valfsize in
3792 X    '') valfsize="$undef" ;;
3793 Xesac
3794 X
3795 Xxxx=`./findhdr sys/mount.h`
3796 Xif $test -f "$xxx";then
3797 X    $cppstdin $cppflags $cppminus < $xxx >$$.h
3798 X    : f_fsize is always more preferable. changed from bsize 17 dec 99
3799 X    if $contains "[^a-zA-Z_]f_fsize[^a-zA-Z_]*;" $$.h  > /dev/null 2>&1
3800 X    then
3801 X            valfsize="$define"
3802 X    else
3803 X        if $contains "[^a-zA-Z_]f_bsize[^a-zA-Z_]*;" $$.h  > /dev/null 2>&1
3804 X        then
3805 X            valbsize="$define"
3806 X        fi
3807 X    fi
3808 X    if $contains "[^a-zA-Z_]f_fstypename[^a-zA-Z_]*;" $$.h  > /dev/null 2>&1
3809 X    then
3810 X        valfstype="$define"
3811 X    fi
3812 Xfi
3813 X
3814 Xval=$valfstype
3815 Xset d_getmntinfofstype
3816 Xeval $setvar
3817 Xval=$valbsize
3818 Xset d_getmntinfobsize
3819 Xeval $setvar
3820 Xval=$valfsize
3821 Xset d_getmntinfofsize
3822 Xeval $setvar
3823 X
3824 X$rm -f $$.h > /dev/null 2>&1
3825 Xunset xxx valfstype valbsize valfsize
3826 X: see if memcpy exists
3827 Xset memcpy d_memcpy
3828 Xeval $inlibc
3829 X
3830 X: see if memset exists
3831 Xset memset d_memset
3832 Xeval $inlibc
3833 X
3834 X: see if mntctl exists
3835 Xset mntctl d_mntctl
3836 Xeval $inlibc
3837 X
3838 X
3839 Xset x xxx valmtime
3840 Xvalmtime="$d_mnttime"
3841 X
3842 Xcase $valmtime in
3843 X    '') valmtime="$undef" ;;
3844 Xesac
3845 X
3846 Xxxx=`./findhdr sys/mnttab.h`
3847 Xxxx="$xxx `./findhdr sys/mntctl.h`"
3848 Xfor x in $xxx
3849 Xdo
3850 X    if $test -f "$x";then
3851 X        $cppstdin $cppflags $cppminus < $x >$$.h
3852 X        if $contains "[^a-zA-Z_]mnt_time[^a-zA-Z_]*;" $$.h  > /dev/null 2>&1
3853 X        then
3854 X            valmtime="$define"
3855 X        fi
3856 X        if $contains "[^a-zA-Z_]vmt_time[^a-zA-Z_]*;" $$.h  > /dev/null 2>&1
3857 X        then
3858 X            valmtime="$define"
3859 X        fi
3860 X    fi
3861 Xdone
3862 X
3863 Xval=$valmtime
3864 Xset d_mnttime
3865 Xeval $setvar
3866 X
3867 X$rm -f $$.h > /dev/null 2>&1
3868 Xunset x xxx valmtime
3869 X
3870 X: see if stdlib is available
3871 Xset stdlib.h i_stdlib
3872 Xeval $inhdr
3873 X
3874 X: see if this is a unistd.h system
3875 Xset unistd.h i_unistd
3876 Xeval $inhdr
3877 X
3878 X: see if getopt exists
3879 Xset getopt d_getopt
3880 Xeval $inlibc
3881 X
3882 Xif $test $i_stdlib = "$define" ; then
3883 X    x1="#include <stdlib.h>"
3884 Xfi
3885 Xif $test $i_unistd = "$define" ; then
3886 X    x2="#include <unistd.h>"
3887 Xfi
3888 X
3889 X$echo "#include <stdio.h>" > gotest.c
3890 X$echo "$x1" >> gotest.c
3891 X$echo "$x2" >> gotest.c
3892 X$cat >>gotest.c <<'EOF'
3893 X
3894 Xmain() { optind; optarg; }
3895 X
3896 XEOF
3897 X
3898 Xif $cc $ccflags $ldflags gotest.c -o gotest $libs >/dev/null 2>&1; then
3899 X    val="$define"
3900 X    $echo "optind is defined in stdio.h, stdlib.h or unistd.h."
3901 Xelse
3902 X    val="$undef"
3903 X    $echo "optind is not defined in stdio.h, stdlib.h or unistd.h."
3904 Xfi
3905 X
3906 Xset d_optind
3907 Xeval $setvar
3908 X
3909 X$rm -f gotest gotest.c > /dev/null 2>&1
3910 X: see if setmntent exists
3911 Xset setmntent d_setmntent
3912 Xeval $inlibc
3913 X
3914 Xset x xxx valtemp
3915 Xvaltemp="$d_setmntent_one_arg"
3916 Xcase $valtemp in
3917 X    '') valtemp="$undef" ;;
3918 Xesac
3919 X
3920 Xcase "$d_setmntent" in
3921 X    "$define")
3922 X        :  We will try the easy way first...
3923 X        :  This only works if there are prototypes.
3924 X        :  And hope the dual universe machines dont define both!
3925 X        xxx="`./findhdr mntent.h`"
3926 X        xxx="$xxx `./findhdr sys/mount.h`"
3927 X        for x in $xxx
3928 X        do
3929 X            if $test -f "$x"; then
3930 X                $cppstdin $cppflags $cppminus < $x >smtest.h
3931 X                if $contains '[^a-zA-Z_]setmntent.*([^),]+)' smtest.h  > /dev/null 2>&1
3932 X                then
3933 X                    valtemp="$define"
3934 X                    $echo 'You appear to have a single argument setmntent().'
3935 X                fi
3936 X            fi
3937 X        done
3938 X
3939 X        $rm -f smtest.h > /dev/null 2>&1
3940 X        ;;
3941 Xesac
3942 X
3943 Xval=$valtemp
3944 Xset d_setmntent_one_arg
3945 Xeval $setvar
3946 Xunset x xxx valtemp
3947 X
3948 X: see if this is a sys/statfs.h system
3949 Xset sys/statfs.h i_sysstatfs
3950 Xeval $inhdr
3951 X
3952 Xset xxx valfrsize
3953 Xvalfrsize="$d_statfs_frsize"
3954 Xcase $valfrsize in
3955 X    '') valfrsize="$undef" ;;
3956 Xesac
3957 X
3958 Xxxx=`./findhdr sys/statfs.h`
3959 Xif $test -f "$xxx";then
3960 X    $cppstdin $cppflags $cppminus < $xxx >sftemp.h
3961 X    if $contains "[^a-zA-Z_]f_frsize[^a-zA-Z_]*;" sftemp.h  > /dev/null 2>&1
3962 X    then
3963 X        valfrsize="$define"
3964 X    fi
3965 Xfi
3966 X
3967 Xval=$valfrsize
3968 Xset d_statfs_frsize
3969 Xeval $setvar
3970 X
3971 X$rm -f sftemp.h > /dev/null 2>&1
3972 Xunset xxx valfrsize
3973 X: see if statvfs exists
3974 Xset statvfs d_statvfs
3975 Xeval $inlibc
3976 X
3977 X
3978 Xif $test "$d_getmnt" = "$define" || \
3979 X       $test "$d_getmntinfo" = "$define" || \
3980 X       $test "$d_statvfs" = "$define"
3981 Xthen
3982 X    d_statfs="$undef"    # we don't care if it's there or not.
3983 X    d_statfsbsd="$undef"
3984 X    d_statfssysv3="$undef"
3985 X    ubsize=""
3986 Xelse
3987 X    : see if statfs exists
3988 X    set statfs d_statfs
3989 X    eval $inlibc
3990 X
3991 X    set valbsd xxx valsysv3
3992 X    valbsd="$d_statfsbsd"
3993 X    valsysv3="$d_statfssysv3"
3994 X
3995 X    case $valbsd in
3996 X        '') valbsd="$undef" ;;
3997 X    esac
3998 X    case $valsysv3 in
3999 X        '') valsysv3="$undef" ;;
4000 X    esac
4001 X
4002 X    case "$d_statfs" in
4003 X        "$define")
4004 X            :  We will try the easy way first...
4005 X            :  This only works if there are prototypes.
4006 X            :  And hope the dual universe machines dont define both!
4007 X            xxx="`./findhdr sys/statfs.h`"
4008 X            xxx="$xxx `./findhdr sys/mount.h`"
4009 X            xxx="$xxx `./findhdr sys/vfs.h`"
4010 X       for x in $xxx
4011 X            do
4012 X                if $test -f "$x"; then
4013 X                    $cppstdin $cppflags $cppminus < $x >sftest.h
4014 X                    if $contains '[^a-zA-Z_]statfs.*([^,]*,[^,]*,[^,]*,[^,]*)' sftest.h  > /dev/null 2>&1
4015 X                    then
4016 X                        valsysv3="$define"
4017 X                        valbsd="$undef"
4018 X                        $echo 'You appear to have the System V.3 style statfs()'
4019 X                    fi
4020 X                    if $contains '[^a-zA-Z_]statfs.*([^,]*,[^,]*)' sftest.h  > /dev/null 2>&1
4021 X                    then
4022 X                        valsysv3="$undef"
4023 X                        valbsd="$define"
4024 X                        $echo 'You appear to have the BSD style statfs()'
4025 X                    fi
4026 X
4027 X                    if $contains '[^a-zA-Z_]statfs.*([^,]*,[^,]*,[^,]*)' sftest.h  > /dev/null 2>&1
4028 X                    then
4029 X                        valsysv3="$undef"
4030 X                        valbsd="$define"
4031 X                        $echo 'You appear to have the BSD style of statfs()'
4032 X                    fi
4033 X                fi
4034 X            done
4035 X
4036 X            case "$valbsd" in
4037 X                "$undef")
4038 X                    case "$valsysv3" in
4039 X                        "$undef")
4040 X
4041 X                            unset dflt
4042 X                            rp='How many arguments does your statfs system call accept (2/3/4)?'
4043 X                            . ./myread
4044 X                            case "$ans" in
4045 X                                2)  valbsd="$define"
4046 X                                    valsysv3="$undef"
4047 X                                    ;;
4048 X                                3)  valbsd="$define"
4049 X                                    valsysv3="$undef"
4050 X                                    ;;
4051 X                                4)  valbsd="$undef"
4052 X                                    valsysv3="$define"
4053 X                                    ;;
4054 X                            esac
4055 X                        ;;
4056 X                    esac
4057 X                ;;
4058 X            esac
4059 X
4060 X            $rm -f sftest.h > /dev/null 2>&1
4061 X            ;;
4062 X    esac
4063 X
4064 X    val=$valbsd
4065 X    set d_statfsbsd
4066 X    eval $setvar
4067 X    val=$valsysv3
4068 X    set d_statfssysv3
4069 X    eval $setvar
4070 X    unset x xxx valbsd valsysv3
4071 X
4072 X    case ${d_statfssysv3} in
4073 X        "$define") ;;
4074 X        *) ubsize="" ;;
4075 X    esac
4076 Xfi
4077 X: see if this is a sys/statvfs.h system
4078 Xset sys/statvfs.h i_sysstatvfs
4079 Xeval $inhdr
4080 X
4081 Xset xxx valbasetype
4082 Xvalbasetype="$d_statvfsbasetype"
4083 Xcase $valbasetype in
4084 X    '') valbasetype="$undef" ;;
4085 Xesac
4086 Xxxx=`./findhdr sys/statvfs.h`
4087 Xif $test -f "$xxx";then
4088 X    $cppstdin $cppflags $cppminus < $xxx >$$.h
4089 X    if $contains "[^a-zA-Z_]f_basetype[^a-zA-Z_]*;" $$.h  > /dev/null 2>&1
4090 X    then
4091 X            valbasetype="$define"
4092 X    fi
4093 Xfi
4094 X
4095 Xval=$valbasetype
4096 Xset d_statvfsbasetype
4097 Xeval $setvar
4098 X
4099 X$rm -f $$.h > /dev/null 2>&1
4100 Xunset xxx valbasetype
4101 X: see which of string.h or strings.h is needed
4102 Xecho " "
4103 Xstrings=`./findhdr string.h`
4104 Xif $test "$strings" && $test -r "$strings"; then
4105 X       echo "Using <string.h> instead of <strings.h>." >&4
4106 X       val="$define"
4107 Xelse
4108 X       val="$undef"
4109 X       strings=`./findhdr strings.h`
4110 X       if $test "$strings" && $test -r "$strings"; then
4111 X               echo "Using <strings.h> instead of <string.h>." >&4
4112 X       else
4113 X               echo "No string header found -- You'll surely have problems." >&4
4114 X       fi
4115 Xfi
4116 Xset i_string
4117 Xeval $setvar
4118 Xcase "$i_string" in
4119 X"$undef") strings=`./findhdr strings.h`;;
4120 X*)       strings=`./findhdr string.h`;;
4121 Xesac
4122 X
4123 X: index or strchr
4124 Xecho " "
4125 Xif set index val -f; eval $csym; $val; then
4126 X       if set strchr val -f d_strchr; eval $csym; $val; then
4127 X               if $contains strchr "$strings" >/dev/null 2>&1 ; then
4128 X                       val="$define"
4129 X                       vali="$undef"
4130 X                       echo "strchr() found." >&4
4131 X               else
4132 X                       val="$undef"
4133 X                       vali="$define"
4134 X                       echo "index() found." >&4
4135 X               fi
4136 X       else
4137 X               val="$undef"
4138 X               vali="$define"
4139 X               echo "index() found." >&4
4140 X       fi
4141 Xelse
4142 X       if set strchr val -f d_strchr; eval $csym; $val; then
4143 X               val="$define"
4144 X               vali="$undef"
4145 X               echo "strchr() found." >&4
4146 X       else
4147 X               echo "No index() or strchr() found!" >&4
4148 X               val="$undef"
4149 X               vali="$undef"
4150 X       fi
4151 Xfi
4152 Xset d_strchr; eval $setvar
4153 Xval="$vali"
4154 Xset d_index; eval $setvar
4155 X
4156 X: see if sysfs exists
4157 Xset sysfs d_sysfs
4158 Xeval $inlibc
4159 X
4160 X: preserve RCS keywords in files with variable substitution, grrr
4161 XId='$Id'
4162 XSource='$Source'
4163 X
4164 X
4165 Xif $test "$di_prog" = ""; then
4166 X    set di_prog
4167 X    val="di"
4168 X    eval $setvar
4169 Xfi
4170 Xif $test "$d_getopt" = "$define";then
4171 X    val=""
4172 Xelse
4173 X    val="getopt$_o"
4174 Xfi
4175 Xset di_otherobj
4176 Xeval $setvar
4177 Xecho " "
4178 Xecho "Checking if your $make program sets \$(MAKE)..." >&4
4179 Xcase "$make_set_make" in
4180 X'')
4181 X       $sed 's/^X //' > testmake.mak << 'EOF'
4182 XXall:
4183 XX      @echo 'maketemp="$(MAKE)"'
4184 XEOF
4185 X       case "`$make -f testmake.mak 2>/dev/null`" in
4186 X       *maketemp=*) make_set_make='#' ;;
4187 X       *)      make_set_make="MAKE=$make" ;;
4188 X       esac
4189 X       $rm -f testmake.mak
4190 X       ;;
4191 Xesac
4192 Xcase "$make_set_make" in
4193 X'#') echo "Yup, it does.";;
4194 X*) echo "Nope, it doesn't.";;
4195 Xesac
4196 X
4197 X: Cruising for prototypes
4198 Xecho " "
4199 Xecho "Checking out function prototypes..." >&4
4200 X$cat >prototype.c <<'EOCP'
4201 Xmain(int argc, char *argv[]) {
4202 X       exit(0);}
4203 XEOCP
4204 Xif $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4205 X       echo "Your C compiler appears to support function prototypes."
4206 X       val="$define"
4207 Xelse
4208 X       echo "Your C compiler doesn't seem to understand function prototypes."
4209 X       val="$undef"
4210 Xfi
4211 Xset prototype
4212 Xeval $setvar
4213 X$rm -f prototype*
4214 X
4215 X: check for void type
4216 Xecho " "
4217 Xecho "Checking to see how well your C compiler groks the void type..." >&4
4218 Xcase "$voidflags" in
4219 X'')
4220 X       $cat >try.c <<'EOCP'
4221 X#if TRY & 1
4222 Xvoid sub() {
4223 X#else
4224 Xsub() {
4225 X#endif
4226 X       extern void moo();      /* function returning void */
4227 X       void (*goo)();          /* ptr to func returning void */
4228 X#if TRY & 8
4229 X       void *hue;              /* generic ptr */
4230 X#endif
4231 X#if TRY & 2
4232 X       void (*foo[10])();
4233 X#endif
4234 X
4235 X#if TRY & 4
4236 X       if(goo == moo) {
4237 X               exit(0);
4238 X       }
4239 X#endif
4240 X       exit(0);
4241 X}
4242 Xmain() { sub(); }
4243 XEOCP
4244 X       if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
4245 X               voidflags=$defvoidused
4246 X       echo "Good.  It appears to support void to the level $package wants.">&4
4247 X               if $contains warning .out >/dev/null 2>&1; then
4248 X                       echo "However, you might get some warnings that look like this:"
4249 X                       $cat .out
4250 X               fi
4251 X       else
4252 Xecho "Hmm, your compiler has some difficulty with void. Checking further..." >&4
4253 X               if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
4254 X                       echo "It supports 1..."
4255 X                       if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
4256 X                               echo "It also supports 2..."
4257 X                               if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
4258 X                                       voidflags=7
4259 X                                       echo "And it supports 4 but not 8 definitely."
4260 X                               else
4261 X                                       echo "It doesn't support 4..."
4262 X                                       if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
4263 X                                               voidflags=11
4264 X                                               echo "But it supports 8."
4265 X                                       else
4266 X                                               voidflags=3
4267 X                                               echo "Neither does it support 8."
4268 X                                       fi
4269 X                               fi
4270 X                       else
4271 X                               echo "It does not support 2..."
4272 X                               if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
4273 X                                       voidflags=13
4274 X                                       echo "But it supports 4 and 8."
4275 X                               else
4276 X                                       if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
4277 X                                               voidflags=5
4278 X                                               echo "And it supports 4 but has not heard about 8."
4279 X                                       else
4280 X                                               echo "However it supports 8 but not 4."
4281 X                                       fi
4282 X                               fi
4283 X                       fi
4284 X               else
4285 X                       echo "There is no support at all for void."
4286 X                       voidflags=0
4287 X               fi
4288 X       fi
4289 Xesac
4290 Xcase "$voidflags" in
4291 X"$defvoidused") ;;
4292 X*)     $cat >&4 <<'EOM'
4293 X  Support flag bits are:
4294 X    1: basic void declarations.
4295 X    2: arrays of pointers to functions returning void.
4296 X    4: operations between pointers to and addresses of void functions.
4297 X    8: generic void pointers.
4298 XEOM
4299 X       dflt="$voidflags";
4300 X       rp="Your void support flags add up to what?"
4301 X       . ./myread
4302 X       voidflags="$ans"
4303 X       ;;
4304 Xesac
4305 X$rm -f try.* .out
4306 X
4307 X: see if this is an fshelp.h system
4308 Xset fshelp.h i_fshelp
4309 Xeval $inhdr
4310 X
4311 X: see if this is an kernel/fs_info.h system
4312 Xset kernel/fs_info.h i_kernfsinfo
4313 Xeval $inhdr
4314 X
4315 X: see if this is a limits.h system
4316 Xset limits.h i_limits
4317 Xeval $inhdr
4318 X
4319 X: see if this is a malloc.h system
4320 Xset malloc.h i_malloc
4321 Xeval $inhdr
4322 X
4323 X: see if memory.h is available.
4324 Xval=''
4325 Xset memory.h val
4326 Xeval $inhdr
4327 X
4328 X: See if it conflicts with string.h
4329 Xcase "$val" in
4330 X$define)
4331 X       case "$strings" in
4332 X       '') ;;
4333 X       *)
4334 X               $cppstdin $cppflags $cppminus < $strings > mem.h
4335 X               if $contains 'memcpy' mem.h >/dev/null 2>&1; then
4336 X                       echo " "
4337 X                       echo "We won't be including <memory.h>."
4338 X                       val="$undef"
4339 X               fi
4340 X               $rm -f mem.h
4341 X               ;;
4342 X       esac
4343 Xesac
4344 Xset i_memory
4345 Xeval $setvar
4346 X
4347 X: see if this is an mntent.h system
4348 Xset mntent.h i_mntent
4349 Xeval $inhdr
4350 X
4351 X: see if this is an mnttab.h system
4352 Xset mnttab.h i_mnttab
4353 Xeval $inhdr
4354 X: see if this is an storage/Directory.h system
4355 Xset storage/Directory.h i_stor_directory
4356 Xeval $inhdr
4357 X
4358 X: see if this is an storage/Entry.h system
4359 Xset storage/Entry.h i_stor_entry
4360 Xeval $inhdr
4361 X
4362 X: see if this is an storage/Path.h system
4363 Xset storage/Path.h i_stor_path
4364 Xeval $inhdr
4365 X
4366 X: see if this is a sys/fstypes.h system
4367 Xset sys/fstypes.h i_sysfstypes
4368 Xeval $inhdr
4369 Xset sys/fs_types.h i_sysfs_types
4370 Xeval $inhdr
4371 X
4372 X: see if this is a sys/fstyp.h system
4373 Xset sys/fstyp.h i_sysfstyp
4374 Xeval $inhdr
4375 X
4376 X: see if this is a sys/mntctl.h system
4377 Xset sys/mntctl.h i_sysmntctl
4378 Xeval $inhdr
4379 X
4380 X: see if this is a sys/mntent.h system
4381 Xset sys/mntent.h i_sysmntent
4382 Xeval $inhdr
4383 X
4384 X: see if this is a sys/mnttab.h system
4385 Xset sys/mnttab.h i_sysmnttab
4386 Xeval $inhdr
4387 X
4388 X: see if this is a sys/param system
4389 Xset sys/param.h i_sysparam
4390 Xeval $inhdr
4391 X
4392 X: see if sys/stat.h is available
4393 Xset sys/stat.h i_sysstat
4394 Xeval $inhdr
4395 X
4396 X: see if we should include time.h, sys/time.h, or both
4397 Xecho " "
4398 Xecho "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
4399 X$echo $n "I'm now running the test program...$c"
4400 X$cat >try.c <<'EOCP'
4401 X#include <sys/types.h>
4402 X#ifdef I_TIME
4403 X#include <time.h>
4404 X#endif
4405 X#ifdef I_SYSTIME
4406 X#ifdef SYSTIMEKERNEL
4407 X#define KERNEL
4408 X#endif
4409 X#include <sys/time.h>
4410 X#endif
4411 X#ifdef I_SYSSELECT
4412 X#include <sys/select.h>
4413 X#endif
4414 Xmain()
4415 X{
4416 X       struct tm foo;
4417 X#ifdef S_TIMEVAL
4418 X       struct timeval bar;
4419 X#endif
4420 X#ifdef S_TIMEZONE
4421 X       struct timezone tzp;
4422 X#endif
4423 X       if (foo.tm_sec == foo.tm_sec)
4424 X               exit(0);
4425 X#ifdef S_TIMEVAL
4426 X       if (bar.tv_sec == bar.tv_sec)
4427 X               exit(0);
4428 X#endif
4429 X       exit(1);
4430 X}
4431 XEOCP
4432 Xflags=''
4433 Xs_timezone=''
4434 Xsysselect=''
4435 Xfor s_timeval in '-DS_TIMEVAL' ''; do
4436 Xfor i_systimek in '' '-DSYSTIMEKERNEL'; do
4437 Xfor i_time in '' '-DI_TIME'; do
4438 Xfor i_systime in '-DI_SYSTIME' ''; do
4439 X       case "$flags" in
4440 X       '') $echo $n ".$c"
4441 X               set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
4442 X               if eval $compile; then
4443 X                               set X $i_time $i_systime $i_systimek $sysselect $s_timeval
4444 X                       shift
4445 X                       flags="$*"
4446 X                       echo " "
4447 X                       $echo $n "Succeeded with $flags$c"
4448 X               fi
4449 X               ;;
4450 X       esac
4451 Xdone
4452 Xdone
4453 Xdone
4454 Xdone
4455 Xtimeincl=''
4456 Xecho " "
4457 Xcase "$flags" in
4458 X*SYSTIMEKERNEL*) i_systimek="$define"
4459 X       timeincl=`./findhdr sys/time.h`
4460 X       echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
4461 X*) i_systimek="$undef";;
4462 Xesac
4463 Xcase "$flags" in
4464 X*I_TIME*) i_time="$define"
4465 X       timeincl=`./findhdr time.h`" $timeincl"
4466 X       echo "We'll include <time.h>." >&4;;
4467 X*) i_time="$undef";;
4468 Xesac
4469 Xcase "$flags" in
4470 X*I_SYSTIME*) i_systime="$define"
4471 X       timeincl=`./findhdr sys/time.h`" $timeincl"
4472 X       echo "We'll include <sys/time.h>." >&4;;
4473 X*) i_systime="$undef";;
4474 Xesac
4475 X$rm -f try.c try
4476 X
4477 X: see if sys/types.h has to be included
4478 Xset sys/types.h i_systypes
4479 Xeval $inhdr
4480 X
4481 X: see if this is a sys/vfs.h system
4482 Xset sys/vfs.h i_sysvfs
4483 Xeval $inhdr
4484 X
4485 X: see if this is a sys/vfstab.h system
4486 Xset sys/vfstab.h i_sysvfstab
4487 Xeval $inhdr
4488 X
4489 X: see if this is a sys/vmount.h system
4490 Xset sys/vmount.h i_sysvmount
4491 Xeval $inhdr
4492 X
4493 X: end of configuration questions
4494 Xecho " "
4495 Xecho "End of configuration questions."
4496 Xecho " "
4497 X
4498 X: back to where it started
4499 Xif test -d ../UU; then
4500 X       cd ..
4501 Xfi
4502 X
4503 X: configuration may be patched via a 'config.over' file
4504 Xif $test -f config.over; then
4505 X       echo " "
4506 X       dflt=y
4507 X       rp='I see a config.over file.  Do you wish to load it?'
4508 X       . UU/myread
4509 X       case "$ans" in
4510 X       n*) echo "OK, I'll ignore it.";;
4511 X       *)      . ./config.over
4512 X               echo "Configuration override changes have been loaded."
4513 X               ;;
4514 X       esac
4515 Xfi
4516 X
4517 X: in case they want portability, strip down executable paths
4518 Xcase "$d_portable" in
4519 X"$define")
4520 X       echo " "
4521 X       echo "Stripping down executable paths..." >&4
4522 X       for file in $loclist $trylist; do
4523 X               if test X$file != Xln -a X$file != Xar -o X$osname != Xos2; then
4524 X                       eval $file="\$file"
4525 X               fi
4526 X       done
4527 X       ;;
4528 Xesac
4529 X
4530 X: create config.sh file
4531 Xecho " "
4532 Xecho "Creating config.sh..." >&4
4533 X$spitshell <<EOT >config.sh
4534 X$startsh
4535 X#
4536 X# This file was produced by running the Configure script. It holds all the
4537 X# definitions figured out by Configure. Should you modify one of these values,
4538 X# do not forget to propagate your changes by running "Configure -der". You may
4539 X# instead choose to run each of the .SH files by yourself, or "Configure -S".
4540 X#
4541 X
4542 X# Package name      : $package
4543 X# Source directory  : $src
4544 X# Configuration time: $cf_time
4545 X# Configured by     : $cf_by
4546 X# Target system     : $myuname
4547 X
4548 XAuthor='$Author'
4549 XDate='$Date'
4550 XHeader='$Header'
4551 XId='$Id'
4552 XLocker='$Locker'
4553 XLog='$Log'
4554 XMcc='$Mcc'
4555 XRCSfile='$RCSfile'
4556 XRevision='$Revision'
4557 XSource='$Source'
4558 XState='$State'
4559 X_a='$_a'
4560 X_exe='$_exe'
4561 X_o='$_o'
4562 Xafs='$afs'
4563 Xar='$ar'
4564 Xarchobjs='$archobjs'
4565 Xawk='$awk'
4566 Xbash='$bash'
4567 Xbison='$bison'
4568 Xbyacc='$byacc'
4569 Xc='$c'
4570 Xcat='$cat'
4571 Xcc='$cc'
4572 Xccflags='$ccflags'
4573 Xcf_by='$cf_by'
4574 Xcf_time='$cf_time'
4575 Xchgrp='$chgrp'
4576 Xchmod='$chmod'
4577 Xchown='$chown'
4578 Xcomm='$comm'
4579 Xcompress='$compress'
4580 Xcontains='$contains'
4581 Xcp='$cp'
4582 Xcpio='$cpio'
4583 Xcpp='$cpp'
4584 Xcppflags='$cppflags'
4585 Xcpplast='$cpplast'
4586 Xcppminus='$cppminus'
4587 Xcpprun='$cpprun'
4588 Xcppstdin='$cppstdin'
4589 Xcsh='$csh'
4590 Xd_64bit_statfs_flds='$d_64bit_statfs_flds'
4591 Xd_bcopy='$d_bcopy'
4592 Xd_bsd='$d_bsd'
4593 Xd_bzero='$d_bzero'
4594 Xd_endmntent='$d_endmntent'
4595 Xd_eunice='$d_eunice'
4596 Xd_fs_info='$d_fs_info'
4597 Xd_getmnt='$d_getmnt'
4598 Xd_getmntent='$d_getmntent'
4599 Xd_getmntinfo='$d_getmntinfo'
4600 Xd_getmntinfobsize='$d_getmntinfobsize'
4601 Xd_getmntinfofsize='$d_getmntinfofsize'
4602 Xd_getmntinfofstype='$d_getmntinfofstype'
4603 Xd_getopt='$d_getopt'
4604 Xd_gnulibc='$d_gnulibc'
4605 Xd_index='$d_index'
4606 Xd_memcpy='$d_memcpy'
4607 Xd_memset='$d_memset'
4608 Xd_mntctl='$d_mntctl'
4609 Xd_mnttime='$d_mnttime'
4610 Xd_optind='$d_optind'
4611 Xd_portable='$d_portable'
4612 Xd_setmntent='$d_setmntent'
4613 Xd_setmntent_one_arg='$d_setmntent_one_arg'
4614 Xd_statfs='$d_statfs'
4615 Xd_statfs_frsize='$d_statfs_frsize'
4616 Xd_statfsbsd='$d_statfsbsd'
4617 Xd_statfssysv3='$d_statfssysv3'
4618 Xd_statvfs='$d_statvfs'
4619 Xd_statvfsbasetype='$d_statvfsbasetype'
4620 Xd_strchr='$d_strchr'
4621 Xd_sysfs='$d_sysfs'
4622 Xd_xenix='$d_xenix'
4623 Xdate='$date'
4624 Xdefvoidused='$defvoidused'
4625 Xdi_otherobj='$di_otherobj'
4626 Xdi_prog='$di_prog'
4627 Xecho='$echo'
4628 Xegrep='$egrep'
4629 Xemacs='$emacs'
4630 Xeunicefix='$eunicefix'
4631 Xexe_ext='$exe_ext'
4632 Xexpr='$expr'
4633 Xfind='$find'
4634 Xfirstmakefile='$firstmakefile'
4635 Xflex='$flex'
4636 Xgccversion='$gccversion'
4637 Xglibpth='$glibpth'
4638 Xgrep='$grep'
4639 Xgzip='$gzip'
4640 Xhint='$hint'
4641 Xi_fshelp='$i_fshelp'
4642 Xi_kernfsinfo='$i_kernfsinfo'
4643 Xi_limits='$i_limits'
4644 Xi_malloc='$i_malloc'
4645 Xi_memory='$i_memory'
4646 Xi_mntent='$i_mntent'
4647 Xi_mnttab='$i_mnttab'
4648 Xi_stdlib='$i_stdlib'
4649 Xi_stor_directory='$i_stor_directory'
4650 Xi_stor_entry='$i_stor_entry'
4651 Xi_stor_path='$i_stor_path'
4652 Xi_string='$i_string'
4653 Xi_sysfs_types='$i_sysfs_types'
4654 Xi_sysfstyp='$i_sysfstyp'
4655 Xi_sysfstypes='$i_sysfstypes'
4656 Xi_sysmntctl='$i_sysmntctl'
4657 Xi_sysmntent='$i_sysmntent'
4658 Xi_sysmnttab='$i_sysmnttab'
4659 Xi_sysmount='$i_sysmount'
4660 Xi_sysparam='$i_sysparam'
4661 Xi_sysstat='$i_sysstat'
4662 Xi_sysstatfs='$i_sysstatfs'
4663 Xi_sysstatvfs='$i_sysstatvfs'
4664 Xi_systime='$i_systime'
4665 Xi_systimek='$i_systimek'
4666 Xi_systypes='$i_systypes'
4667 Xi_sysvfs='$i_sysvfs'
4668 Xi_sysvfstab='$i_sysvfstab'
4669 Xi_sysvmount='$i_sysvmount'
4670 Xi_time='$i_time'
4671 Xi_unistd='$i_unistd'
4672 Xincpath='$incpath'
4673 Xinews='$inews'
4674 Xinstallmansrc='$installmansrc'
4675 Xksh='$ksh'
4676 Xldflags='$ldflags'
4677 Xless='$less'
4678 Xlib_ext='$lib_ext'
4679 Xlibc='$libc'
4680 Xlibpth='$libpth'
4681 Xlibs='$libs'
4682 Xlibswanted='$libswanted'
4683 Xline='$line'
4684 Xlint='$lint'
4685 Xlkflags='$lkflags'
4686 Xln='$ln'
4687 Xlns='$lns'
4688 Xlocincpth='$locincpth'
4689 Xloclibpth='$loclibpth'
4690 Xlp='$lp'
4691 Xlpr='$lpr'
4692 Xls='$ls'
4693 Xmail='$mail'
4694 Xmailx='$mailx'
4695 Xmake='$make'
4696 Xmake_set_make='$make_set_make'
4697 Xmanext='$manext'
4698 Xmansrc='$mansrc'
4699 Xmansrcexp='$mansrcexp'
4700 Xmips='$mips'
4701 Xmips_type='$mips_type'
4702 Xmkdir='$mkdir'
4703 Xmore='$more'
4704 Xmv='$mv'
4705 Xmyuname='$myuname'
4706 Xn='$n'
4707 Xnm='$nm'
4708 Xnm_opt='$nm_opt'
4709 Xnm_so_opt='$nm_so_opt'
4710 Xnroff='$nroff'
4711 Xobj_ext='$obj_ext'
4712 Xoptimize='$optimize'
4713 Xosname='$osname'
4714 Xosvers='$osvers'
4715 Xpackage='$package'
4716 Xpath_sep='$path_sep'
4717 Xperl='$perl'
4718 Xpg='$pg'
4719 Xplibpth='$plibpth'
4720 Xpmake='$pmake'
4721 Xpr='$pr'
4722 Xprefix='$prefix'
4723 Xprefixexp='$prefixexp'
4724 Xprototype='$prototype'
4725 Xrm='$rm'
4726 Xrmail='$rmail'
4727 Xrunnm='$runnm'
4728 Xsed='$sed'
4729 Xsendmail='$sendmail'
4730 Xsh='$sh'
4731 Xshar='$shar'
4732 Xsharpbang='$sharpbang'
4733 Xshsharp='$shsharp'
4734 Xsleep='$sleep'
4735 Xsmail='$smail'
4736 Xso='$so'
4737 Xsort='$sort'
4738 Xspackage='$spackage'
4739 Xspitshell='$spitshell'
4740 Xsrc='$src'
4741 Xstartsh='$startsh'
4742 Xstrings='$strings'
4743 Xsubmit='$submit'
4744 Xsysman='$sysman'
4745 Xtail='$tail'
4746 Xtar='$tar'
4747 Xtbl='$tbl'
4748 Xtee='$tee'
4749 Xtest='$test'
4750 Xtimeincl='$timeincl'
4751 Xtouch='$touch'
4752 Xtr='$tr'
4753 Xtroff='$troff'
4754 Xubsize='$ubsize'
4755 Xuname='$uname'
4756 Xuniq='$uniq'
4757 Xusenm='$usenm'
4758 Xusrinc='$usrinc'
4759 Xuuname='$uuname'
4760 Xvi='$vi'
4761 Xvoidflags='$voidflags'
4762 Xxlibpth='$xlibpth'
4763 Xzcat='$zcat'
4764 Xzip='$zip'
4765 XEOT
4766 X
4767 X: Add in command line options if available
4768 X$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
4769 X
4770 X: add special variables
4771 X$test -f $src/patchlevel.h && \
4772 Xawk '/^#define/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
4773 Xecho "CONFIG=true" >>config.sh
4774 X
4775 X: propagate old symbols
4776 Xif $test -f UU/config.sh; then
4777 X       <UU/config.sh sort | uniq >UU/oldconfig.sh
4778 X       sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
4779 X       sort | uniq -u >UU/oldsyms
4780 X       set X `cat UU/oldsyms`
4781 X       shift
4782 X       case $# in
4783 X       0) ;;
4784 X       *)
4785 X               cat <<EOM
4786 XHmm...You had some extra variables I don't know about...I'll try to keep 'em...
4787 XEOM
4788 X               echo "# Variables propagated from previous config.sh file." >>config.sh
4789 X               for sym in `cat UU/oldsyms`; do
4790 X                       echo "    Propagating $hint variable "'$'"$sym..."
4791 X                       eval 'tmp="$'"${sym}"'"'
4792 X                       echo "$tmp" | \
4793 X                               sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
4794 X               done
4795 X               ;;
4796 X       esac
4797 Xfi
4798 X
4799 X: Finish up by extracting the .SH files
4800 Xcase "$alldone" in
4801 Xexit)
4802 X       $rm -rf UU
4803 X       echo "Done."
4804 X       exit 0
4805 X       ;;
4806 Xcont)
4807 X       ;;
4808 X'')
4809 X       dflt=''
4810 X       nostick=true
4811 X       $cat <<EOM
4812 X
4813 XIf you'd like to make any changes to the config.sh file before I begin
4814 Xto configure things, do it as a shell escape now (e.g. !vi config.sh).
4815 X
4816 XEOM
4817 X       rp="Press return or use a shell escape to edit config.sh:"
4818 X       . UU/myread
4819 X       nostick=''
4820 X       case "$ans" in
4821 X       '') ;;
4822 X       *) : in case they cannot read
4823 X               sh 1>&4 -c "$ans";;
4824 X       esac
4825 X       ;;
4826 Xesac
4827 X
4828 X: if this fails, just run all the .SH files by hand
4829 X. ./config.sh
4830 X
4831 Xecho " "
4832 Xexec 1>&4
4833 X. ./UU/extract
4834 X
4835 Xif $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
4836 X       dflt=y
4837 X       case "$silent" in
4838 X       true) ;;
4839 X       *)
4840 X               $cat <<EOM
4841 X
4842 XNow you need to generate make dependencies by running "make depend".
4843 XYou might prefer to run it in background: "make depend > makedepend.out &"
4844 XIt can take a while, so you might not want to run it right now.
4845 X
4846 XEOM
4847 X               ;;
4848 X       esac
4849 X       rp="Run make depend now?"
4850 X       . UU/myread
4851 X       case "$ans" in
4852 X       y*)
4853 X               make depend && echo "Now you must run a make."
4854 X               ;;
4855 X       *)
4856 X               echo "You must run 'make depend' then 'make'."
4857 X               ;;
4858 X       esac
4859 Xelif test -f [Mm]akefile; then
4860 X       echo " "
4861 X       echo "Now you must run a make."
4862 Xelse
4863 X       echo "Done."
4864 Xfi
4865 X
4866 Xif $test -f Policy.sh; then
4867 X    $cat <<EOM
4868 X
4869 XIf you compile $package on a different machine or from a different object
4870 Xdirectory, copy the Policy.sh file from this object directory to the
4871 Xnew one before you run Configure -- this will help you with most of
4872 Xthe policy defaults.
4873 X
4874 XEOM
4875 Xfi
4876 Xif $test -f config.msg; then
4877 X    echo "Hmm.  I also noted the following information while running:"
4878 X    echo " "
4879 X    $cat config.msg >&4
4880 X    $rm -f config.msg
4881 Xfi
4882 X$rm -f kit*isdone ark*isdone
4883 X$rm -rf UU
4884 X
4885 X: End of Configure
4886 X
4887 END_OF_FILE
4888 if test 106597 -ne `wc -c <'Configure'`; then
4889     echo shar: \"'Configure'\" unpacked with wrong size!
4890 fi
4891 chmod +x 'Configure'
4892 # end of 'Configure'
4893 fi
4894 echo shar: End of archive 3 \(of 3\).
4895 cp /dev/null ark3isdone
4896 MISSING=""
4897 for I in 1 2 3 ; do
4898     if test ! -f ark${I}isdone ; then
4899         MISSING="${MISSING} ${I}"
4900     fi
4901 done
4902 if test "${MISSING}" = "" ; then
4903     echo You have unpacked all 3 archives.
4904     rm -f ark[1-9]isdone
4905 else
4906     echo You still need to unpack the following archives:
4907     echo "        " ${MISSING}
4908 fi
4909 ##  End of shell archive.
4910 exit 0
4911
4912
This page took 0.752995 seconds and 3 git commands to generate.