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