summaryrefslogtreecommitdiffstats
path: root/contrib/top/Configure
diff options
context:
space:
mode:
authordwmalone <dwmalone@FreeBSD.org>2002-01-24 17:24:16 +0000
committerdwmalone <dwmalone@FreeBSD.org>2002-01-24 17:24:16 +0000
commit6d85e91806136ccf94d20612be2f8cc4d2590a8a (patch)
tree01dc9dd59148ee3d2624019bf4a06905463468a9 /contrib/top/Configure
parent1b9d0472b72177a604d3c5dd26d25eec00049bd2 (diff)
downloadFreeBSD-src-6d85e91806136ccf94d20612be2f8cc4d2590a8a.zip
FreeBSD-src-6d85e91806136ccf94d20612be2f8cc4d2590a8a.tar.gz
import top_3_5beta12
Diffstat (limited to 'contrib/top/Configure')
-rwxr-xr-xcontrib/top/Configure120
1 files changed, 91 insertions, 29 deletions
diff --git a/contrib/top/Configure b/contrib/top/Configure
index b02806c..e760044 100755
--- a/contrib/top/Configure
+++ b/contrib/top/Configure
@@ -25,7 +25,7 @@ if ($#argv > 0) then
set fastrack = 1
else
cat <<'EOF'
-Configuration for top, version 3.4
+Configuration for top, version 3.5
One moment....
'EOF'
@@ -37,11 +37,17 @@ ls machine/m_*.man >$$.m
sed -e 's@^machine/m_@@' -e 's/.c$//' $$.f >$$.n
# build Make.desc
-set descs = `sed -e 's@\.c$@.desc@' $$.f`
-sed -e "s@%descs%@$descs@" Make.desc.X >Make.desc
+sed -e 's@\.c@.desc\\@' $$.f | sed -e '$s/\\//' >$$.a
+sed -e "/^DESCS/r $$.a" Make.desc.X >Make.desc
# build desc files and SYNOPSIS as needed
make -f Make.desc >/dev/null
+if ($status != 0) then
+ echo "Unable to build the synopsis."
+ echo 'Make sure the command "make" is on your path and try'
+ echo 'running Configure again.'
+ exit 1
+endif
if (-e .defaults) then
echo ""
@@ -82,7 +88,7 @@ if ($fastrack == 1) then
if ($status != 0) then
echo "$module is not recognized. To see a list of available modules"
echo 'run "Configure" with no arguments.'
- rm -f $$.[fmn]
+ rm -f $$.[fmna]
exit 1
endif
set random1 = `expr $random + 1`
@@ -128,7 +134,7 @@ cat <<'EOF'
The following machine-dependent modules are available:
'EOF'
-awk -F: ' { printf "%-8s %s\n", $1, $2 }' SYNOPSIS
+awk -F: ' { printf "%-10s %s\n", $1, $2 }' SYNOPSIS
echo ''
./getans "What module is appropriate for this machine? " string "$module" .$$
set module = `cat .$$`
@@ -256,9 +262,16 @@ set delay = `cat .$$`
echo ""
set rand = 0
-ypwhich >&/dev/null
-if ($status == 0 || -e /etc/passwd.dir || -e /etc/pwd.db) then
- set rand = 1
+if (-e /etc/nsswitch.conf) then
+ set rand = `grep '^passwd:.*nis' /etc/nsswitch.conf | wc -l`
+ if ($rand > 1) then
+ set rand = 1
+ endif
+else
+ ypwhich >&/dev/null
+ if ($status == 0 || -e /etc/passwd.dir || -e /etc/pwd.db) then
+ set rand = 1
+ endif
endif
if ($rand == 1) then
@@ -293,8 +306,15 @@ if ($status == 0) then
set cnt = `wc -l </tmp/$$.a`
set mapfile = "NIS map"
else
- set cnt = `wc -l </etc/passwd`
- set mapfile = "file"
+ rm /tmp/$$.a
+ niscat passwd.org_dir >&/tmp/$$.a
+ if ($status == 0) then
+ set cnt = `wc -l </tmp/$$.a`
+ set mapfile = "NISPLUS map"
+ else
+ set cnt = `wc -l </etc/passwd`
+ set mapfile = "file"
+ endif
endif
rm /tmp/$$.a
set double = `expr $cnt \* 2`
@@ -335,18 +355,37 @@ set t_owner = root
set t_group = `$ls -d /usr/bin | awk ' { print $4 }'`
if (-e /proc) then
cat <<EOF
-Uh oh! I see /proc out there. Some new Unix variants provide the /proc
-file system as a mechanism to get to a process's address space. This
-directory is typically only accessible by root. However, there are a few
-systems (such as DG/UX) on which this directory exists, but isn't used.
-I'm going to assume that top needs to run setuid to root, but you should
-double check and use mode 2755 (set group id) if top doesn't really need
-root access. If you are running SunOS 5.x then you will need to install
-top setuid root (owner root and mode 4711).
+I see /proc out there. Many Unix variants provide the /proc file
+system as a mechanism to get to a process's address space. This
+directory is typically only accessible by root. However, there are a
+few systems (such as DG/UX) on which this directory exists, but isn't
+used.
EOF
- set t_mode = 4711
- set mode = 4711
+ if (-r /proc/0/psinfo) then
+ set t_mode = 2711
+ set mode = 2711
+ set t_group = sys
+ set group = sys
+ cat <<EOF
+It looks like this system is running Solaris 2.6 or greater. If this
+is the case, then top can function just fine installed set group id to
+sys. It does not need to be installed set-uid to root.
+
+EOF
+ else
+ set t_mode = 4711
+ set mode = 4711
+ cat <<EOF
+I'm going to assume that top needs to run setuid to root, but you
+should double check and use mode 2755 (set group id) if top doesn't
+really need root access. If you are running SunOS 5.0 through SunOS
+5.5.1 (that's Solaris 2.0 through Solaris 2.5.1) then you will need to
+install top setuid root (owner root and mode 4711). In SunOS 5.6
+and higher top only requires set group id sys permissions.
+
+EOF
+ endif
else if (-e /dev/kmem) then
$ls /dev/kmem >/tmp/$$.b
grep '^....r..r..' /tmp/$$.b >&/dev/null
@@ -404,13 +443,14 @@ echo "We are done with the questions."
# Some Unix environments are so poor that their csh doesn't even support
# the "eval" builtin. Check for this before relying on its use to save
# the current configuration.
-/bin/csh -c "eval echo foo" >&/dev/null
+/bin/csh -fc "eval echo foo" >&/dev/null
if ($status == 1) then
echo "Can't save configuration (nonfatal)"
else
echo "Saving configuration..."
# save settings to use as defaults the next time
rm -f .defaults
+ touch .defaults
foreach v ($vars)
set tmp = `eval echo \$$v`
echo set $v = "'$tmp'" >>.defaults
@@ -419,12 +459,8 @@ endif
fast:
-# set variables which contain module lists
-set modules = `cat $$.f`
-set manmodules = `cat $$.m`
-
# clean up
-rm -f $$.f $$.m $$.n
+rm -f $$.[fmna]
# set the link for machine.c
rm -f machine.c machine.o
@@ -434,10 +470,36 @@ ln -s machine/m_${module}.c machine.c
set libs = `grep LIBS: machine/m_${module}.desc | sed -e 's/^.[^:]*: *//'`
set cflgs = `grep CFLAGS: machine/m_${module}.desc | sed -e 's/^.[^:]*: *//'`
set tcap = `grep TERMCAP: machine/m_${module}.desc | sed -e 's/^.[^:]*: *//'`
+set math = `grep MATH: machine/m_${module}.desc | sed -e 's/^.[^:]*: *//'`
+
+# get osrev defition, if we can
+set uname=""
+if (-e /usr/bin/uname) then
+ set uname=/usr/bin/uname
+else if (-e /bin/uname) then
+ set uname=/bin/uname
+endif
+
+if ("$uname" != "") then
+# different versions of tr can't agree on the way to specify ranges, so
+# we will have to give the range explicitly.....sigh.
+ set osrev="-DOSREV=`$uname -r | tr -cd ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`"
+else
+ set osrev=""
+endif
# default for tcap (termcap)
if ("$tcap" == "") then
set tcap="-ltermcap"
+else if ("$tcap" == "none") then
+ set tcap=""
+endif
+
+# allow for the module to override or remove -lm
+if ("$math" == "") then
+ set math="-lm"
+else if ("$math" == "none") then
+ set math=""
endif
if ( { grep -s SIGKILL /usr/include/signal.h } ) then
@@ -461,14 +523,14 @@ sed -e "s|%topn%|$topn|" \
-e "s|%libs%|$libs|" \
-e "s|%cflgs%|$cflgs|" \
-e "s|%termcap%|$tcap|" \
+ -e "s|%math%|$math|" \
-e "s|%cdefs%|$cdefs|" \
- -e "s|%modules%|$modules|" \
- -e "s|%manmodules%|$manmodules|" \
-e "s|%signal%|$signal|" \
-e "s|%cc%|$Cmdcc|" \
-e "s|%awk%|$Cmdawk|" \
-e "s|%install%|$Cmdinstall|" \
-e "s|%shell%|$Cmdshell|" \
+ -e "s|%osrev%|$osrev|" \
Makefile.X >Makefile
echo "Building top.local.h..."
@@ -499,5 +561,5 @@ echo 'To install the executable, type "make install".'
exit 0
byebye:
-rm -f .$$ $$.[fmn] /tmp/$$.[ab]
+rm -f .$$ $$.[fmna] /tmp/$$.[ab]
exit 1
OpenPOWER on IntegriCloud