www.pudn.com > bpmdetect.rar > configure


#! /bin/sh

# Checks for Python interpreter. Honours $PYTHON if set. Stores path to
# interpreter in $PYTHON.
#
checkPython()
{
  if [ -z $PYTHON ]; then
    PYTHON=`which python 2>/dev/null`
  fi
  echo -n "Checking for Python               :  "
  if [ ! -x "$PYTHON" ]; then
    echo -e "not found!"
    echo "Please make sure that the Python interpreter is available in your PATH"
    echo "or invoke configure using the PYTHON flag, e.g."
    echo "$ PYTHON=/usr/local/bin/python configure"
    exit 1
  fi
  echo -e "$PYTHON"
}

# Checks for SCons. Honours $SCONS if set. Stores path to 'scons' in $SCONS.
# Requires that $PYTHON is set.
#
checkSCons()
{
  echo -n "Checking for SCons                :  "
  if [ -z $SCONS ]; then
    SCONS=`which scons 2>/dev/null`
  fi
  if [ ! -x "$SCONS" ]; then
    echo -e "not found"$NORMAL
    exit 1
  else
    echo -e "$SCONS"
  fi
  SCONS="$SCONS -Q"
}

# Generates a Makefile. Requires that $SCONS is set.
#
generateMakefile()
{
  cat > Makefile << EOF
SCONS=$SCONS

all:
	@\$(SCONS)

install:
	@\$(SCONS) install

clean:
	@\$(SCONS) -c

uninstall:
	@\$(SCONS) -c install

dist:
	@\$(SCONS) dist

distclean:
	@\$(SCONS) -c
	rm -rf cache/
EOF
}

checkPython
checkSCons

if [[ "$1" == "--help" ]]; then
   $SCONS --help
   exit
fi

SCONS="$SCONS $@"

generateMakefile
$SCONS configure