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

File: [Pegasus] / pegasus_unsupported / config / configure (download)
Revision: 1.23, Wed Jan 25 16:47:08 2012 UTC (12 years, 3 months ago) by karl
Branch: MAIN
CVS Tags: HEAD
Changes since 1.22: +25 -27 lines
BUG#: 9999
TITLE:Checkin to unsupported module.  Fix license on config script

DESCRIPTION: No approval required.  This is unsupportec CVS module.
This checkin just updates license statement to current Pegasus stds.

#!/bin/sh

#//%LICENSE////////////////////////////////////////////////////////////////
#//
#// Licensed to The Open Group (TOG) under one or more contributor license
#// agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
#// this work for additional information regarding copyright ownership.
#// Each contributor licenses this file to you under the OpenPegasus Open
#// Source License; you may not use this file except in compliance with the
#// License.
#//
#// Permission is hereby granted, free of charge, to any person obtaining a
#// copy of this software and associated documentation files (the "Software"),
#// to deal in the Software without restriction, including without limitation
#// the rights to use, copy, modify, merge, publish, distribute, sublicense,
#// and/or sell copies of the Software, and to permit persons to whom the
#// Software is furnished to do so, subject to the following conditions:
#//
#// The above copyright notice and this permission notice shall be included
#// in all copies or substantial portions of the Software.
#//
#// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
#// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
#// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
#// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
#// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
#// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
#// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#//
#//////////////////////////////////////////////////////////////////////////

##==============================================================================
##
## Check for existence of pegasus config.mak. If this does not exist, it means
## that the distribution is incomplete or that the configure file has been run
## from the wrong directory.
##
##==============================================================================

config=mak/config.mak

if [ ! -f "$config" ]; then
    echo "$0: Error: ./configure must be run from root of Pegasus distribution."
    echo
    exit 1
fi

##==============================================================================
##
## Collection command line options.
##
##==============================================================================

help=

for opt
do

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

  case $opt in

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

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

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

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

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

    -libdir=*)
      libdir=$optarg
      ;;

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

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

    --enable-debug)
      enable_debug=1
      ;;

    --enable-mrr-generation)
      enable_mrr_generation=1
      ;;

    --enable-mrr)
      enable_mrr=1
      ;;

    --disable-oop)
      disable_oop=1
      ;;

    --disable-trace)
      disable_trace=1
      ;;

    --disable-ipv6)
      disable_ipv6=1
      ;;

    --disable-trace)
      disable_trace=1
      ;;

    --disable-tests)
      disable_tests=1
      ;;

    --enable-pam)
      enable_pam=1
      ;;

    --enable-pam-standalone)
      enable_pam_standalone=1
      ;;

    --with-pam=*)
      with_pam=$optarg
      ;;

    --with-pam-mod=*)
      with_pam_mod=$optarg
      ;;

    --enable-ssl)
      enable_ssl=1
      ;;

    --enable-slp)
      enable_slp=1
      ;;

    --enable-openslp)
      enable_openslp=1
      ;;

    --with-openslp=*)
      with_openslp=$optarg
      ;;
    
    --with-external-slp=*)
      with_external_slp=$optarg
      ;;
    
    --with-external-slp-dir=*)
      with_external_slp_dir=$optarg
      ;;

    --disable-cmpi)
      disable_cmpi=1
      ;;

    --with-ssl=*)
      with_ssl=$optarg
      ;;

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

    --enable-compressed-repository)
      enable_compressed_repository=1
      ;;

    --with-solaris-defaults)
      with_solaris_defaults=1
      ;;

    --with-solaris-nevada-defaults)
      with_solaris_nevada_defaults=1
      ;;
    --solaris)
      with_solaris_defaults=1
      ;;

    --with-vxworks-xscale-defaults)
      with_vxworks_xscale_defaults=1
      ;;

    --vxworks-xscale)
      with_vxworks_xscale_defaults=1
      ;;

    --with-test-user=*)
      with_test_user=$optarg
      ;;

    --with-test-user-pass=*)
      with_test_user_pass=$optarg
      ;;

    --with-temp-build-dir=*)
      with_temp_build_dir=$optarg
      ;;

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

  esac
done

##==============================================================================
##
## Print help message if --help given on command line.
##
##==============================================================================

if [ "$help" = "1" ]; then
cat<<END

Usage: ./configure [OPTION]...

Configures OpenPegasus build options.

Configure examples.
    $ ./configure
    $ make

Options:
    --help
        Print this help message.
    --platform=PLATFORM
        Build package for this PLATFORM, which must be one of the following:
            LINUX_IX86_GNU
            LINUX_X86_64_GNU
            SOLARIS_SPARC_64_CC
            SOLARIS_X86_64_CC
            VXWORKS_XSCALE_GNU
    --prefix=DIR
        Install under DIR
    --bindir=DIR
        Install programs here.
    --sbindir=DIR
        Install super-user programs here.
    --libdir=DIR
        Install libraries here.
    --includedir=DIR
        Install include files here.
    --datadir=DIR
        Install data files here.
    --enable-debug
        Build for debug.
    --enable-mrr-generation
        Enable memory-resident repository generation (in cimmofl).
    --enable-mrr
        Enable the memory-resident repository.
    --disable-oop
        Disable out-of-process providers.
    --disable-trace
        Disable tracing facility.
    --disable-ipv6
        Disable IPV6 support.
    --disable-trace
        Disable tracing facility
    --disable-tests
        Disable build of most of the tests.
    --enable-pam
        Enable PAM authentication.
    --enable-pam-standalone
        Use PAM standalone cimservera program (implies --enable-pam).
    --with-pam=DIR
        Specify an alternative PAM directory location (defaults to /etc/pam.d).
    --with-test-user=USER
        The USER for user-related tests (must refer to actual OS user).
        This feature is used only with the pegasus test suite
    --with-test-user-pass=PASSWORD
        The PASSWORD for user-related tests (must refer to actual OS user).
        This feature is used only with the pegasus test suite.
    --enable-ssl
        Enable SSL feature
    --with-ssl=DIR
        Find SSL under DIR (e.g., --with-ssl=/usr).
    --enable-slp
        Enable SLP feature
    --enable-openslp
        Enable OpenSLP feature (implies --enable-slp).
        Deprecated. Use --with-external-slp
    --with-openslp=DIR
        Find OpenSLP installation under DIR (e.g., --with-openslp=/usr).
        Deprecated. Use --with-external-slp-dir
    --with-external-slp=TYPE
        Use external slp defined by keyword (e.g., --with-external-slp=openslp).
        Superceedes --enable-openslp.
    --with-external-slp-dir=DIR
        Find external SLP include and lib directories under DIR
        (e.g., --with-external-slp=/usr).  Default is /usr
    --disable-cmpi
        Disable CMPI provider support
    --enable-binary-repository
        Enable the binary repository feature, resulting in a smaller CIM 
        repository disk footprint.
    --with-temp-build-dir=directory
        Uses defined temporary directory for all work files during build and
        test process.
    --with-solaris-defaults
        Enables reasonable defaults for the Solaris platform. These
        includes:
            --enable-ssl
            --enable-openslp
            --enable-pam-standalone
    --with-solaris-nevada-defaults
        Enables reasonable defaults for the Solaris Nevada platform. These
        includes:
            --enable-ssl
            --with-external-slp=solarisslp
            --enable-pam-standalone
    --with-vxworks-xscale-defaults
        Enables reasonable defaults for the VXWorks/XScale platform.
        includes:
            --platform=VXWORKS_XSCALE_GNU
            --disable-oop
            --disable-trace
            --enable-ssl
END
exit
fi

##==============================================================================
##
## Resolve platform specific default options.
##
##==============================================================================

if [ "$with_solaris_defaults" = 1 ]; then
    enable_ssl=1
    with_external_slp=openslp
    enable_pam_standalone=1
fi
if [ "$with_solaris_nevada_defaults" = 1 ]; then
    enable_ssl=1
    with_external_slp=solarisslp
    enable_pam_standalone=1
fi
if [ "$with_vxworks_xscale_defaults" = 1 ]; then
    platform=VXWORKS_XSCALE_GNU
    disable_oop=1
    disable_trace=1
    enable_ssl=1
    enable_slp=1
    disable_cmpi=1
    enable_mrr=1
fi

##==============================================================================
##
## Check the --platform option.
##
##==============================================================================

if [ ! -z "$platform" ]; then
    case "$platform" in
        LINUX_IX86_GNU)
            ;;
        LINUX_X86_64_GNU)
            ;;
        SOLARIS_SPARC_64_CC)
            ;;
        SOLARIS_SPARC_CC)
            ;;
        SOLARIS_X86_64_CC)
            ;;
        SOLARIS_IX86_CC)
            ;;
        VXWORKS_XSCALE_GNU)
            ;;
        *)
            echo "$0: Unknown platform: --platform=$platform"
            echo ""
            exit 1
            ;;
    esac
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
  token="$machine:$system:$release:$version"

  case "$token" in

    i686:Linux:*:*)
      platform=LINUX_IX86_GNU
      libbase=lib
      ;;

    x86_64:Linux:*:*)
      platform=LINUX_X86_64_GNU
      libbase=lib64
      ;;

    sun*:SunOS:*:*)
      platform=SOLARIS_SPARC_64_CC
      libbase=lib/64
      ;;

    i86pc:SunOS:*:*)
      platform=SOLARIS_X86_64_CC
      libbase=lib/64
      ;;

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

  esac
fi

##==============================================================================
##
## Resolve default directory names.
##
##==============================================================================

# --prefix:

if [ -z "$prefix" ]; then
  prefix=/usr/local
fi

# --bindir:

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

# --sbindir:

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

# --libdir:

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

# --includedir:

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

if [ -z "$with_pam" ]; then
  with_pam=/etc/pam.d
fi

##==============================================================================
##
## Verify --with-ssl directory.
##
##==============================================================================

if [ ! -z "$with_ssl" ]; then

  if [ ! -d "$with_ssl" ]; then
    echo "$0: Error: No such directory: --with-ssl=$with_ssl"
    exit 1;
  fi

  if [ ! -f "$with_ssl/include/openssl/ssl.h" ]; then
    echo "$0: missing dependency: \$with_ssl/include/openssl/ssl.h"
    missing=1
  fi

  if [ ! -f "$with_ssl/bin/openssl" ]; then
    echo "$0: missing dependency: \$with_ssl/bin/openssl"
    missing=1
  fi

  if [ ! -f "$with_ssl/$libbase/libssl.so" ]; then
    echo "$0: missing dependency: \$with_ssl/$libbase/libss.so"
    missing=1
  fi

  if [ "$missing" = "1" ]; then
    echo "$0: where --with-ssl=$with_ssl"
    exit 1;
  fi

fi

##==============================================================================
##
## Verify --with-openslp directory.
## Note that this option is deprecated in favor of the --with-external-slp
## option that allows multiple slp types defined as external
##
##==============================================================================

if [ ! -z "$with_openslp" ]; then

  if [ ! -d "$with_openslp" ]; then
    echo "$0: Error: No such directory: --with-openslp=$with_openslp"
    exit 1;
  fi

  if [ ! -f "$with_openslp/include/slp.h" ]; then
    echo "$0: missing dependency: \$with_openslp/include/slp.h"
    missing=1
  fi

  if [ ! -f "$with_openslp/$libbase/libslp.so" ]; then
    echo "$0: missing dependency: \$with_openslp/$libbase/libslp.so"
    missing=1
  fi

  if [ "$missing" = "1" ]; then
    echo "$0: where --with-openslp=$with_openslp"
    exit 1;
  fi

fi

##==============================================================================
##
## Verify --with-external-slp - Test for valid keyword and no openslp option
##
##==============================================================================
if [ ! -z "$with_external_slp" ]; then

  if [  "enable_openslp" = 1 ]; then
     echo "$0: Error: trying to use both --enable-openslp and --with-external-slp"
     exit 1
  fi
  ## determine if with_external_slp type is a valid keyword
  ## list of valid keywords each surrounded by a space to prevent
  ## subset of keywords passing the test.
  external_slp_types=" openslp solarisslp none "
  posx=`expr match ${external_slp_types} ".*\ ${with_external_slp} "`

  if [ "$posx" = "0" ]; then
    echo "$0: Error: --with-external-slp value. $with_external_slp is not valid type"
    echo "Valid types are $external_slp_types"
    exit 1;
  fi
fi
  
##==============================================================================
##
## Verify --with-external-slp-dir directory.
##
##==============================================================================

if [ ! -z "$with_external_slp_dir" ]; then

  if [ ! -d "$with_external_slp_dir" ]; then
    echo "$0: Error: No such directory: --with-external-slp-dir=$with_external_slp_dir"
    exit 1;
  fi

  if [ ! -f "$with_external_slp_dir/include/slp.h" ]; then
    echo "$0: missing dependency: \$with_external_slp_dir/include/slp.h"
    missing=1
  fi

  if [ ! -f "$with_external_slp_dir/$libbase/libslp.so" ]; then
    echo "$0: missing dependency: \$with_external_slp_dir/$libbase/libslp.so"
    missing=1
  fi

  if [ "$missing" = "1" ]; then
    echo "$0: where --with-external-slp-dir=$with_external_slp_dir"
    exit 1;
  fi

fi

##==============================================================================
##
## These options (if non-empty) must denote absolute directory names.
##
##==============================================================================

for i in \
  prefix \
  bindir \
  sbindir \
  libdir \
  includedir \
  datadir \
  with_ssl \
  with_pam
do

  eval v=$`echo $i`

  case $v in
    /* | "")
      ;;

    *)
      echo "$0: Error: Must be an absolute directory name: --$i=$v"
      exit 1;
      ;;
  esac

done

##==============================================================================
##
## Check whether the test user will be able to access pegasus home.
##
##==============================================================================

uid=`id -u`
cwd=`/bin/pwd`

if [ "$uid" = "0" -a "$disable_tests" != "1" ]; then

  if [ "$enable_pam" = "1" -o "$enable_pam_standalone" = "1" ]; then

    su $with_test_user -c "/bin/true"

    if [ "$?" != "0" ]; then
      echo "$0: The test user account ($with_test_user) does not exist on this system. Please create a test user with this name or designate an existing one with the --with-test-user option."
      exit 1
    fi

    su $with_test_user -c "cd $cwd 2> /dev/null"

    if [ "$?" != "0" ]; then
      echo "$0: The test user account ($with_test_user) has insufficient privileges to access the pegasus root directory ($cwd), which will cause the user-context tests to fail. Please configure from a different directory."
      exit 1
    fi
  else
     echo "Warning: Using --with-test-user without --enable_pam or --enable-pam-standalone"
  fi


fi

##==============================================================================
##
## Verify if --enable_pam that pam headers exist
##
##==============================================================================

if [ ! -z "$enable_pam" ]
then

  if [ ! -f "/usr/include/security/pam_appl.h" -a \
       ! -f "/usr/local/include/security/pam_appl.h" ]
  then
      echo "$0: <security/pam_appl.h> is missing (required by --enable_pam)"
      exit 1
  fi

fi

##==============================================================================
##
## Create options.mak
##
##==============================================================================

options=options.mak
rm -f $options
echo "# This file was generated by configure." >> $options
echo "# ./configure $*" >> $options

cwd=`/bin/pwd`
root=$cwd
echo "export ROOT=$root" >> $options
#echo "export PATH=$PATH:$cwd/$platform/bin" >> $options
#echo "export LD_LIBRARY_PATH=$cwd/$platform/lib:$libdir" >> $options
echo "export PEGASUS_PLATFORM=$platform" >> $options
echo "export PEGASUS_ROOT=$root" >> $options
echo "export PEGASUS_HOME=$cwd/$platform" >> $options

if [ "$disable_oop" = "1" ]
then
  echo "export PEGASUS_DEFAULT_ENABLE_OOP=false" >> $options
  echo "export PEGASUS_DISABLE_PROV_USERCTXT=1" >> $options
  echo "export PEGASUS_DISABLE_PRIVILEGED_TESTS=true" >> $options
fi

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

if [ "$disable_ipv6" = "1" ]
then
  echo "export PEGASUS_ENABLE_IPV6=false" >> $options
else
  echo "export PEGASUS_ENABLE_IPV6=true" >> $options
fi

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

if [ "$disable_tests" = "1" ]
then
  echo "export PEGASUS_SKIP_MOST_TEST_DIRS=true" >> $options
fi

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

if [ "$enable_mrr_generation" = 1 ]
then
  echo "export PEGASUS_ENABLE_MRR_GENERATION=1" >> $options
fi

if [ "$enable_mrr" = 1 ]
then
  echo "export PEGASUS_ENABLE_MRR=1" >> $options
fi

if [ "$enable_pam" = "1" ]; then
  echo "export PEGASUS_PAM_AUTHENTICATION=true" >> $options
fi

if [ "$enable_pam_standalone" = "1" ]; then
  echo "export PEGASUS_PAM_AUTHENTICATION=true" >> $options
  echo "export PEGASUS_USE_PAM_STANDALONE_PROC=true" >> $options
fi

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

if [ "$enable_compressed_repository" = "1" ]; then
  echo "export PEGASUS_ENABLE_COMPRESSED_REPOSITORY=1" >> $options
fi

if [ "$enable_ssl" = "1" ]; then
  echo "export PEGASUS_HAS_SSL=true" >> $options
fi

if [ ! -z "$with_ssl" ]; then
  echo "export OPENSSL_HOME=$with_ssl" >> $options
fi

if [ "$enable_slp" = "1" ]; then
    echo "export PEGASUS_ENABLE_SLP=true" >> $options
fi

if [ "$enable_openslp" = "1" ]; then
    echo "export PEGASUS_ENABLE_SLP=true" >> $options
    echo "export PEGASUS_USE_OPENSLP=true" >> $options
fi

if [ ! -z "$with_external_slp" ]; then
    echo "export PEGASUS_ENABLE_SLP=true" >> $options
    echo "export PEGASUS_USE_EXTERNAL_SLP=$with_external_slp" >> $options
fi

if [ ! -z "$with_external_slp_dir" ]; then
  echo "export PEGASUS_EXTERNAL_SLP_HOME=$with_external_slp_dir" >> $options
fi

if [ ! -z "$with_openslp" ]; then
  echo "export PEGASUS_OPENSLP_HOME=$with_openslp" >> $options
fi

if [ "$disable_cmpi" != "1" ]; then
  echo "export PEGASUS_ENABLE_CMPI_PROVIDER_MANAGER=true" >> $options
fi

if [ ! -z "$with_test_user" ]; then
  echo "export PEGASUS_TEST_USER_ID=$with_test_user" >> $options
fi

if [ ! -z "$with_test_user_pass" ]; then
  echo "export PEGASUS_TEST_USER_PASS=$with_test_user_pass" >> $options
fi

echo "created $options"

##==============================================================================
##
## Create GNUmakefile
##
##==============================================================================

cat > GNUmakefile << END
include options.mak

export PATH := \$(PATH):\$(PEGASUS_HOME)/bin
export LD_LIBRARY_PATH := \$(LD_LIBRARY_PATH):\$(PEGASUS_HOME)/bin

include Makefile

distclean:
	rm -rf \$(PEGASUS_PLATFORM)
	rm -f GNUmakefile
	rm -f options.mak
END

echo "created GNUmakefile"

##==============================================================================
##
## Print final message:
##
##==============================================================================

echo "configured for $platform"
echo

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2