#!/bin/sh

# This returns the number of processors we are going to use in the
# compilation process.  I general, the number of processors avaialble
# minus one, except if we have just one processor, of course.  If we
# do not knwow how to work out the number of processors, we'll use
# just one.

case $1 in
SYMM)        echo `/etc/online -N` 1 - p | dc ;;
IRIX*)       echo `/usr/sbin/mpadmin -n | tail -1` 1 - p | dc ;;
SunOS4*)     echo 1 ;;
Solaris*)    echo `/usr/bin/mpstat | /usr/bin/wc -l` 1 - p | dc ;;
Win32*)      echo 1 ;;
LINUXi86*)    if (test -e /proc/cpuinfo) && (test -e /bin/grep) ;
	     then echo `/bin/grep processor /proc/cpuinfo | wc --lines` ;
	     else if (test -e /proc/cpuinfo) && (test -e /usr/bin/grep) ;
	     then echo `/usr/bin/grep processor /proc/cpuinfo | wc --lines` ;
	     else echo 1; fi ; fi ;;
LINUXalpha)  echo 1;;
*)           echo 1 ;;
esac
