(file) Return to configure CVS log (file) (dir) Up to [Pegasus] / pegasus_unsupported / config

File: [Pegasus] / pegasus_unsupported / config / configure (download)
Revision: 1.1, Wed Jul 2 14:07:56 2008 UTC (15 years, 11 months ago) by mike
Branch: MAIN
BUG#: 9999
TITLE: Configuration Utility

DESCRIPTION: Configuration Utility

#!/bin/bash

##==============================================================================
##
## Current directory should be the Pegasus root directory.
##
##==============================================================================

if [ ! -d "src/Pegasus" ]; then
    echo "$0: must be invoked from the root of the Pegasus distribution"
    exit 1
fi

##==============================================================================
##
## Options defaults.
##
##==============================================================================

platform=
prefix=/usr/local
bindir=
sbindir=
libdir=
includedir=
datadir=
enable_debug=
enable_binary_repository=
disable_oop=
disable_prov_userctxt=
disable_privileged_tests=
disable_trace=

if [ -f "config.local" ]; then
    source config.local
fi

##==============================================================================
##
## Collect options.
##
##==============================================================================

for opt
do

  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`

  case $opt in

    --help | --h | -h | -help)
      help=1
      ;;

    --platform=*)
      platform=$optarg 
      ;;

    --prefix=*)
      prefix=$optarg 
      ;;

    --bindir=*)
      bindir=$optarg
      ;;

    --sbindir=*)
      sbindir=$optarg
      ;;

    --libdir=*)
      libdir=$optarg
      ;;

    --includedir=*)
      includedir=$optarg
      ;;

    --datadir=*)
      datadir=$optarg
      ;;

    --enable-debug)
      enable_debug=1
      ;;

    --enable-binary-repository)
      enable_binary_repository=1
      ;;

    --disable-oop)
      disable_oop=1
      ;;

    --disable-prov-userctxt)
      disable_prov_userctxt=1
      ;;

    --disable-privileged-tests)
      disable_privileged_tests=1
      ;;

    --disable-trace)
      disable_trace=1
      ;;

    *)
      echo "$0: unknown option:  $opt"
      exit 1
      ;;

  esac

done

##==============================================================================
##
## Help
##
##==============================================================================

if [ "$help" = "1" ]; then
    cat config.help
    exit
fi

##==============================================================================
##
## Guess the platform
##
##==============================================================================

if [ -z "$platform" ]; then

    machine=`(uname -m) 2>/dev/null` || machine=unknown
    system=`(uname -s) 2>/dev/null`  || system=unknown
    release=`(uname -r) 2>/dev/null` || release=unknown 
    version=`(uname -v) 2>/dev/null` || version=unknown

    case "$machine:$system:$release:$version" in

        i*86:Linux:*:*)
            export platform=LINUX_IX86_GNU
            ;;

        x86_64:Linux:*:*)
            export platform=LINUX_X86_64_GNU
            ;;

        *)
            echo "$0: Failed to guess platform: "
            echo "    machine=$machine "
            echo "    system=$system "
            echo "    release=$release "
            echo "    version=$version "
            echo
            exit 1
            ;;

    esac
else
    platform=$platform
fi

##==============================================================================
##
## Check platform:
##
##==============================================================================

case "$platform" in

    LINUX_IX86_GNU)
        ;;

    LINUX_X86_64_GNU)
        ;;

    *)
        echo "$0: Unrecognized platform: $platform"
        exit 1
        ;;

esac

##==============================================================================
##
## Deduce locations.
##
##==============================================================================

if [ -z "$bindir" ]; then
  bindir=$prefix/bin
fi

if [ -z "$sbindir" ]; then
  sbindir=$prefix/sbin
fi

if [ -z "$libdir" ]; then
  libdir=$prefix/lib
fi

if [ -z "$includedir" ]; then
  includedir=$prefix/include
fi

if [ -z "$datadir" ]; then
  datadir=$prefix/share
fi

##==============================================================================
##
## Create config.options
##
##==============================================================================

rm -f config.options

echo "platform=$platform" >> config.options
echo "prefix=$prefix" >> config.options
echo "bindir=$bindir" >> config.options
echo "sbindir=$sbindir" >> config.options
echo "libdir=$libdir" >> config.options
echo "includedir=$includedir" >> config.options
echo "datadir=$datadir" >> config.options
echo "enable_debug=$enable_debug" >> config.options
echo "enable_binary_repository=$enable_binary_repository" >> config.options
echo "disable_oop=$disable_oop" >> config.options
echo "disable_prov_userctxt=$disable_prov_userctxt" >> config.options
echo "disable_privileged_tests=$disable_privileged_tests" >> config.options
echo "disable_trace=$disable_trace" >> config.options

echo "export PEGASUS_PLATFORM=$platform" >> config.options
echo "export PEGASUS_ROOT=`pwd`" >> config.options
echo "export PEGASUS_HOME=`pwd`/build/$platform" >> config.options

if [ "$enable_debug" = "1" ]; then
echo "export PEGASUS_DEBUG=1" >> config.options
fi

if [ "$enable_binary_repository" = "1" ]; then
  echo "export PEGASUS_REPOSITORY_MODE=BIN" >> config.options
fi

if [ "$disable_oop" = "1" ]; then
  echo "export PEGASUS_DEFAULT_ENABLE_OOP=false" >> config.options
fi

if [ "$disable_prov_userctxt" = "1" ]; then
  echo "export PEGASUS_DISABLE_PROV_USERCTXT=1" >> config.options
fi

if [ "$disable_privileged_tests" = "1" ]; then
  echo "export PEGASUS_DISABLE_PRIVILEGED_TESTS=1" >> config.options
fi

if [ "$disable_trace" = "1" ]; then
  echo "export PEGASUS_REMOVE_TRACE=1" >> config.options
fi

echo "Created config.options"
echo "Configured for $platform"
echo

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2