(file) Return to configure CVS log (file) (dir) Up to [OMI] / omi

   1 mike  1.1 #!/bin/sh
   2           
   3           ##==============================================================================
   4           ##
   5           ## Product, Version, and Bilddate information:
   6           ##
   7           ##==============================================================================
   8           
   9           product="OMI"
  10           fullproduct="Open Management Infrastructure"
  11           major=1
  12           minor=0
  13           revision=0
  14           date=`date`
  15           version="$major.$minor.$revision"
  16           
  17           ##==============================================================================
  18           ##
  19           ## CIM Schema version
  20           ##
  21           ##==============================================================================
  22 mike  1.1 
  23           cimschema="CIM-2.32.0"
  24           
  25           ##==============================================================================
  26           ##
  27           ## Get command line options that start with slash.
  28           ##
  29           ##==============================================================================
  30           
  31           for opt
  32           do
  33           
  34             arg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
  35           
  36             case $opt in
  37           
  38               -h | --help)
  39                 help=1
  40                 ;;
  41           
  42               --enable-debug)
  43 mike  1.1       enable_debug=1
  44                 ;;
  45           
  46               --disable-rtti)
  47                 disable_rtti=1
  48                 ;;
  49           
  50               --disable-templates)
  51                 disable_templates=1
  52                 ;;
  53           
  54               --target=*)
  55                 target=$arg
  56                 ;;
  57           
  58               --toolchain=*)
  59                 toolchain=$arg
  60                 ;;
  61           
  62               --prefix=*)
  63                 prefix=$arg 
  64 mike  1.1       ;;
  65           
  66               --bindir=*)
  67                 bindir=$arg 
  68                 ;;
  69           
  70               --libdir=*)
  71                 libdir=$arg 
  72                 ;;
  73           
  74               --includedir=*)
  75                 includedir=$arg 
  76                 ;;
  77           
  78               --datadir=*)
  79                 datadir=$arg 
  80                 ;;
  81           
  82               --localstatedir=*)
  83                 localstatedir=$arg 
  84                 ;;
  85 mike  1.1 
  86               --sysconfdir=*)
  87                 sysconfdir=$arg 
  88                 ;;
  89           
  90               --providerdir=*)
  91                 providerdir=$arg 
  92                 ;;
  93           
  94               --providerdir=*)
  95                 providerdir=$arg 
  96                 ;;
  97           
  98               --certsdir=*)
  99                 certsdir=$arg 
 100                 ;;
 101           
 102               --authdir=*)
 103                 authdir=$arg 
 104                 ;;
 105           
 106 mike  1.1     --builddir=*)
 107                 builddir=$arg 
 108                 ;;
 109           
 110               --enable-werror)
 111                 enable_werror=1
 112                 ;;
 113           
 114               --enable-wchar)
 115                 enable_wchar=1
 116                 ;;
 117           
 118               --enable-gcov)
 119                 enable_gcov=1
 120                 ;;
 121           
 122               --namespace=*)
 123                 namespace=$arg
 124                 ;;
 125           
 126               --httpport=*)
 127 mike  1.1       httpport=$arg
 128                 ;;
 129           
 130               --httpsport=*)
 131                 httpsport=$arg
 132                 ;;
 133           
 134               --disable-libpath)
 135                 disable_libpath=1
 136                 ;;
 137           
 138               *)
 139                 echo "$0: unknown option:  $opt"
 140                 exit 1
 141                 ;;
 142           
 143             esac
 144           done
 145           
 146           ##==============================================================================
 147           ##
 148 mike  1.1 ## Print the help message
 149           ##
 150           ##==============================================================================
 151           
 152           if [ "$help" = "1" ]; then
 153           
 154               cat<<EOF
 155           
 156           Usage: ./configure [OPTIONS]
 157           
 158           OVERVIEW:
 159           
 160           This script configures OMI for building. Type the following commands.
 161           
 162               $ ./configure
 163               $ make
 164           
 165           OPTIONS:
 166               -h, --help              Print this help message.
 167               --enable-debug          Perform a debug build.
 168               --enable-gcov           Build for use with gcov code coverage tool.
 169 mike  1.1     --disable-rtti          Disable C++ RTTI support.
 170               --disable-templates     Disable C++ templates support.
 171               --enable-werror         Treat warnings as errors.
 172               --enable-wchar          Use 'wchar_t' character type [char].
 173               --target=TARGET         Cross-compiler for the given platform.
 174               --toolchain=PATH        Cross-compiler toolchain path (contains 'lib' dir).
 175               --prefix=PATH           The installation prefix [/opt/omi-1.0.0]
 176               --libdir=PATH           Install library components here [*/lib].
 177               --bindir=PATH           Install programs here [*/bin].
 178               --includedir=PATH       Install C/C++ include files here [*/include].
 179               --datadir=PATH          Install data files here [*/share].
 180               --localstatedir=PATH    Install 'log' and 'run' directories here [*/var].
 181               --sysconfdir=PATH       Install configuration files here [*/etc].
 182               --providerdir=PATH      Install provider libraries here [*/lib].
 183               --certsdir=PATH         Install SSL certificates here [*/etc/ssl/certs].
 184               --authdir=PATH          Temporary authentication files here [*/var/omiauth].
 185               --namespace NAME        Name of the default namespace [root/cimv2].
 186               --buildir=PATH          Alternative location to place build output files.
 187               --httpport=PORT         Server listens on this port for HTTP protocols.
 188               --httpsport=PORT        Server listens on this port for HTTPS protocols.
 189               --disable-libpath         Disable embedding of library search paths in
 190 mike  1.1                             binaries (shared libraries and executables).
 191           
 192           EOF
 193               exit 0
 194           fi
 195           
 196           ##==============================================================================
 197           ##
 198           ## The the platform, os, arch, and compiler.
 199           ##
 200           ##==============================================================================
 201           
 202           if [ "$CONFIG_TARGET" != "" ]; then
 203               export CONFIG_TARGET=$target
 204           fi
 205           
 206           if [ "$CONFIG_TOOLCHAIN" != "" ]; then
 207               export CONFIG_TOOLCHAIN=$toolchain
 208           fi
 209           
 210           platform=`./buildtool platform`
 211 mike  1.1 
 212           if [ "$?" != "0" ]; then
 213               echo "$0: unknown platform: $platform"
 214               exit 1
 215           fi
 216           
 217           os=`./buildtool os`
 218           arch=`./buildtool arch`
 219           compiler=`./buildtool compiler`
 220           
 221           ##==============================================================================
 222           ##
 223           ## Resolve locations
 224           ##
 225           ##==============================================================================
 226           
 227           root=`pwd`
 228           
 229           if [ -z "$prefix" ]; then
 230               prefix=/opt/omi-1.0.0
 231           fi
 232 mike  1.1 
 233           if [ -z "$bindir" ]; then
 234               bindir=$prefix/bin
 235           fi
 236           
 237           if [ -z "$libdir" ]; then
 238               libdir=$prefix/lib
 239           fi
 240           
 241           if [ -z "$includedir" ]; then
 242               includedir=$prefix/include
 243           fi
 244           
 245           if [ -z "$datadir" ]; then
 246               datadir=$prefix/share
 247           fi
 248           
 249           if [ -z "$localstatedir" ]; then
 250               localstatedir=$prefix/var
 251           fi
 252           
 253 mike  1.1 if [ -z "$sysconfdir" ]; then
 254               sysconfdir=$prefix/etc
 255           fi
 256           
 257           if [ -z "$providerdir" ]; then
 258               providerdir=$libdir
 259           fi
 260           
 261           if [ -z "$certsdir" ]; then
 262               certsdir=$sysconfdir/ssl/certs
 263           fi
 264           
 265           if [ -z "$authdir" ]; then
 266               authdir=$localstatedir/omiauth
 267           fi
 268           
 269           if [ -z "$namespace" ]; then
 270               namespace=root/cimv2
 271           fi
 272           
 273           hostname=`./buildtool hostname`
 274 mike  1.1 
 275           outputdirbase=./output/$hostname
 276           
 277           outputdir=$root/output/$hostname
 278           
 279           tmpdir=$outputdir/tmp
 280           
 281           ##==============================================================================
 282           ##
 283           ## Resolve ports
 284           ##
 285           ##==============================================================================
 286           
 287           if [ -z "$httpport" ]; then
 288               httpport=7778
 289           else
 290               rc=`expr "(" "$httpport" ">=" 1 ")" "&" "(" "$httpport" "<=" 65535 ")"`
 291           
 292               if [ "$rc" = "0" ]; then
 293                   echo "$0: invalid --httpport option: $httpport"
 294                   exit 1
 295 mike  1.1     fi
 296           fi
 297           
 298           if [ -z "$httpsport" ]; then
 299               httpsport=7779
 300           else
 301               rc=`expr "(" "$httpsport" ">=" 1 ")" "&" "(" "$httpsport" "<=" 65535 ")"`
 302           
 303               if [ "$rc" = "0" ]; then
 304                   echo "$0: invalid --httpsport option: $httpsport"
 305                   exit 1
 306               fi
 307           fi
 308           
 309           ##==============================================================================
 310           ##
 311           ## Create output directories.
 312           ##
 313           ##==============================================================================
 314           
 315           if [ -z "$builddir" ]; then
 316 mike  1.1     mkdir -p $outputdir
 317           else
 318               mkdir -p $builddir
 319               ln -s $builddir $outputdir
 320           fi
 321           
 322           mkdir -p $outputdir/bin
 323           mkdir -p $outputdir/lib
 324           mkdir -p $outputdir/obj
 325           mkdir -p $outputdir/tmp
 326           mkdir -p $outputdir/var
 327           mkdir -p $outputdir/var/log
 328           mkdir -p $outputdir/var/run
 329           mkdir -p $outputdir/var/omiauth
 330           mkdir -p $outputdir/include
 331           mkdir -p $tmpdir
 332           
 333           ##==============================================================================
 334           ##
 335           ## Set macros for suppressing the linefeed produced by 'echo' command.
 336           ##
 337 mike  1.1 ##==============================================================================
 338           
 339           case `echo -n xyz` in
 340               -n*)
 341                   echon=
 342                   case `echo 'xyz\c'` in
 343                       *c*)
 344                           echoc=
 345                           ;;
 346                       *)
 347                           echoc='\c'
 348                           ;;
 349                   esac
 350                   ;;
 351               *)
 352                   echon='-n'
 353                   echoc=
 354                   ;;
 355           esac
 356           
 357           ##==============================================================================
 358 mike  1.1 ##
 359           ## Attempt to find C compiler.
 360           ##
 361           ##==============================================================================
 362           
 363           echo $echon "checking whether C compiler is on the path... $echoc"
 364           
 365           cc=`./buildtool cc`
 366           
 367           if [ "$cc" = "" ]; then
 368               echo "$0: failed"
 369               exit 1
 370           fi
 371           
 372           tmp1=`echo $cc | awk '{ print $1; }'`
 373           tmp2=`which $tmp1`
 374           
 375           if [ -x "$tmp2" ]; then
 376               echo "yes"
 377           else
 378               echo "no"
 379 mike  1.1     exit 1
 380           fi
 381           
 382           ##==============================================================================
 383           ##
 384           ## Attempt to compile and execute a simple C program
 385           ##
 386           ##==============================================================================
 387           
 388           echo $echon "checking whether C compiler compiles... $echoc"
 389           rm -f $tmpdir/cprogram
 390           
 391           cat > $tmpdir/cprogram.c <<EOF
 392           int main()
 393           {
 394               return 123;
 395           }
 396           EOF
 397           
 398           ( cd $tmpdir ; $cc -o cprogram cprogram.c > /dev/null 2> /dev/null )
 399           
 400 mike  1.1 if [ "$?" = "0" ]; then
 401               echo "yes"
 402           else
 403               echo "no"
 404               exit 1
 405           fi
 406           
 407           if [ -z "$CONFIG_TARGET" ]; then
 408           
 409               echo $echon "checking whether C program executes... $echoc"
 410           
 411               $tmpdir/cprogram
 412           
 413               if [ "$?" = "123" ]; then
 414                   echo "yes"
 415               else
 416                   echo "no"
 417                   exit 1
 418               fi
 419           
 420           
 421 mike  1.1 fi
 422           
 423           rm $tmpdir/cprogram.c
 424           rm $tmpdir/cprogram
 425           
 426           ##==============================================================================
 427           ##
 428           ## Check whether __FUNCTION__ macro is supported.
 429           ##
 430           ##==============================================================================
 431           
 432           echo $echon "checking for __FUNCTION__ macro... $echoc"
 433           
 434           rm -f $tmpdir/function
 435           
 436           cat > $tmpdir/function.c <<EOF
 437           #include <stdio.h>
 438           
 439           int main()
 440           {
 441               printf("%s\n", __FUNCTION__);
 442 mike  1.1     return 0;
 443           }
 444           EOF
 445           
 446           ( cd $tmpdir ; $cc -o function function.c > /dev/null 2> /dev/null )
 447           
 448           if [ "$?" = "0" ]; then
 449               have_function_macro=1
 450               echo "yes"
 451           else
 452               have_function_macro=0
 453               echo "no"
 454           fi
 455           
 456           rm -f $tmpdir/function.c
 457           rm -f $tmpdir/function
 458           
 459           ##==============================================================================
 460           ##
 461           ## Check for 'openssl' command.
 462           ##
 463 mike  1.1 ##==============================================================================
 464           
 465           echo $echon "checking whether openssl command is on the path... $echoc"
 466           
 467           openssl=`which openssl`
 468           
 469           if [ -x "$openssl" ]; then
 470               echo "yes"
 471           else
 472               echo "no"
 473               exit 1
 474           fi
 475           
 476           ##==============================================================================
 477           ##
 478           ## Check for 'pkg-config' command.
 479           ##
 480           ##==============================================================================
 481           
 482           echo $echon "checking whether pkg-config command is on the path... $echoc"
 483           
 484 mike  1.1 pkgconfig=`which pkg-config`
 485           
 486           if [ -x "$pkgconfig" ]; then
 487               echo "yes"
 488           else
 489               echo "no"
 490               exit 1
 491           fi
 492           
 493           ##==============================================================================
 494           ##
 495           ## Create config.mak file
 496           ##
 497           ##==============================================================================
 498           
 499           fn=$outputdir/config.mak
 500           
 501           cat > $fn <<EOF
 502           # CAUTION: This file was generated by 'configure' script.
 503           
 504           CONFIG_PRODUCT=$product
 505 mike  1.1 CONFIG_FULLPRODUCT=$fullproduct
 506           CONFIG_VERSION=$version
 507           CONFIG_MINOR=$minor
 508           CONFIG_MAJOR=$major
 509           CONFIG_REVISION=$revision
 510           CONFIG_DATE=$date
 511           
 512           CONFIG_MAK=1
 513           $platform=1
 514           PLATFORM=$platform
 515           OS=$os
 516           ARCH=$arch
 517           COMPILER=$compiler
 518           ROOT=$root
 519           
 520           OUTPUTDIR=$outputdir
 521           SRCDIR=$root/source
 522           LIBDIR=$outputdir/lib
 523           BINDIR=$outputdir/bin
 524           OBJDIR=$outputdir/obj
 525           INCDIR=$outputdir/include
 526 mike  1.1 TMPDIR=$tmpdir
 527           OPENSSL=$openssl
 528           PKGCONFIG=$pkgconfig
 529           
 530           CONFIG_TARGET=$target
 531           CONFIG_TOOLCHAIN=$toolchain
 532           CONFIG_PREFIX=$prefix
 533           CONFIG_BINDIR=$bindir
 534           CONFIG_LIBDIR=$libdir
 535           CONFIG_INCLUDEDIR=$includedir
 536           CONFIG_DATADIR=$datadir
 537           CONFIG_LOCALSTATEDIR=$localstatedir
 538           CONFIG_SYSCONFDIR=$sysconfdir
 539           CONFIG_PROVIDERDIR=$providerdir
 540           CONFIG_CERTSDIR=$certsdir
 541           CONFIG_AUTHDIR=$authdir
 542           CONFIG_NAMESPACE=$namespace
 543           CONFIG_HTTPPORT=$httpport
 544           CONFIG_HTTPSPORT=$httpsport
 545           
 546           ENABLE_DEBUG=$enable_debug
 547 mike  1.1 ENABLE_GCOV=$enable_gcov
 548           ENABLE_WERROR=$enable_werror
 549           ENABLE_WCHAR=$enable_wchar
 550           DISABLE_RTTI=$disable_rtti
 551           DISABLE_LIBPATH=$disable_libpath
 552           DISABLE_TEMPLATES=$disable_templates
 553           CONFIG_CIMSCHEMA=$cimschema
 554           EOF
 555           
 556           echo "created $fn"
 557           
 558           ##==============================================================================
 559           ##
 560           ## Create config.h file
 561           ##
 562           ##==============================================================================
 563           
 564           
 565           fn=$outputdir/include/config.h
 566           
 567           cat > $fn <<EOF
 568 mike  1.1 /* CAUTION: This file was generated by 'configure' script. */
 569           #ifndef _config_h
 570           #define _config_h
 571           
 572           #define CONFIG_PRODUCT "$product"
 573           #define CONFIG_FULLPRODUCT "$fullproduct"
 574           #define CONFIG_VERSION "$version"
 575           #define CONFIG_MINOR $minor
 576           #define CONFIG_MAJOR $major
 577           #define CONFIG_REVISION $revision
 578           #define CONFIG_DATE "$date"
 579           #define CONFIG_PLATFORM "$platform"
 580           #define CONFIG_OS "$os"
 581           #define CONFIG_ARCH "$arch"
 582           #define CONFIG_COMPILER "$compiler"
 583           #define CONFIG_PLATFORM_$platform
 584           #define CONFIG_OS_$os
 585           #define CONFIG_ARCH_$arch
 586           #define CONFIG_COMPILER_$compiler
 587           #define CONFIG_POSIX
 588           #define CONFIG_TARGET "$target"
 589 mike  1.1 #define CONFIG_TOOLCHAIN "$toolchain"
 590           #define CONFIG_PREFIX "$prefix"
 591           #define CONFIG_LIBDIR "$libdir"
 592           #define CONFIG_INCLUDEDIR "$includedir"
 593           #define CONFIG_DATADIR "$datadir"
 594           #define CONFIG_BINDIR "$bindir"
 595           #define CONFIG_LOCALSTATEDIR "$localstatedir"
 596           #define CONFIG_SYSCONFDIR "$sysconfdir"
 597           #define CONFIG_PROVIDERDIR "$providerdir"
 598           #define CONFIG_CERTSDIR "$certsdir"
 599           #define CONFIG_AUTHDIR "$authdir"
 600           #define CONFIG_NAMESPACE "$namespace"
 601           #define CONFIG_HTTPPORT $httpport
 602           #define CONFIG_HTTPSPORT $httpsport
 603           #define CONFIG_TMPDIR "$tmpdir"
 604           #define CONFIG_CIMSCHEMA "$cimschema"
 605           EOF
 606           
 607           if [ "$enable_debug" = "1" ]; then
 608               echo "#define CONFIG_ENABLE_DEBUG" >> $fn
 609           else
 610 mike  1.1     echo "/* #define CONFIG_ENABLE_DEBUG */" >> $fn
 611           fi
 612           
 613           if [ "$enable_gcov" = "1" ]; then
 614               echo "#define CONFIG_ENABLE_GCOV" >> $fn
 615           else
 616               echo "/* #define CONFIG_ENABLE_GCOV */" >> $fn
 617           fi
 618           
 619           if [ "$enable_werror" = "1" ]; then
 620               echo "#define CONFIG_ENABLE_WERROR" >> $fn
 621           else
 622               echo "/* #define CONFIG_ENABLE_WERROR */" >> $fn
 623           fi
 624           
 625           if [ "$enable_wchar" = "1" ]; then
 626               echo "#define CONFIG_ENABLE_WCHAR" >> $fn
 627           else
 628               echo "/* #define CONFIG_ENABLE_WCHAR */" >> $fn
 629           fi
 630           
 631 mike  1.1 if [ "$disable_rtti" = "1" ]; then
 632               echo "#define CONFIG_DISABLE_RTTI" >> $fn
 633           else
 634               echo "/* #define CONFIG_DISABLE_RTTI */" >> $fn
 635           fi
 636           
 637           if [ "$disable_libpath" = "1" ]; then
 638               echo "#define CONFIG_DISABLE_LIBPATH" >> $fn
 639           else
 640               echo "/* #define CONFIG_DISABLE_LIBPATH */" >> $fn
 641           fi
 642           
 643           if [ "$disable_templates" = "1" ]; then
 644               echo "#define CONFIG_DISABLE_TEMPLATES" >> $fn
 645           else
 646               echo "/* #define CONFIG_DISABLE_TEMPLATES */" >> $fn
 647           fi
 648           
 649           if [ "$have_function_macro" = "1" ]; then
 650               echo "#define CONFIG_HAVE_FUNCTION_MACRO" >> $fn
 651           else
 652 mike  1.1     echo "/* #define CONFIG_HAVE_FUNCTION_MACRO */" >> $fn
 653           fi
 654           
 655           echo "#define CONFIG_SHLIBEXT \"`./buildtool shlibext`\"" >> $fn
 656           
 657           echo "" >> $fn
 658           echo "#endif /* _config_h */" >> $fn
 659           
 660           echo "created $fn"
 661           fn=""
 662           
 663           ##==============================================================================
 664           ##
 665           ## Setup symbolic links for 'include' directory.
 666           ##
 667           ##==============================================================================
 668           
 669           rm -rf $outputdir/include/MI.h
 670           ln -f -s $root/common/MI.h $outputdir/include/MI.h
 671           
 672           rm -rf $outputdir/include/micxx
 673 mike  1.1 ln -f -s $root/micxx $outputdir/include/micxx
 674           
 675           rm -rf $outputdir/include/omiclient
 676           ln -f -s $root/omiclient $outputdir/include/omiclient
 677           
 678           ##==============================================================================
 679           ##
 680           ## Generate omi.mak (end-user makefile).
 681           ##
 682           ##==============================================================================
 683           
 684           fn=$outputdir/omi.mak
 685           
 686           cat > $fn <<EOF
 687           CONFIG_PREFIX=$prefix
 688           LIBDIR=\$(OMI_ROOT)/$libdir
 689           BINDIR=\$(OMI_ROOT)/$bindir
 690           INCLUDEDIR=\$(OMI_ROOT)/$includedir
 691           SYSCONFDIR=\$(OMI_ROOT)/$sysconfdir
 692           CXXLIBS = -L\$(LIBDIR) -lmicxx
 693           
 694 mike  1.1 __OBJECTS = \$(SOURCES:.c=.o)
 695           OBJECTS = \$(__OBJECTS:.cpp=.o)
 696           INCLUDES += -I\$(INCLUDEDIR)
 697           
 698           CC=`./buildtool cc`
 699           CXX=`./buildtool cxx`
 700           
 701           ifndef DEBUG
 702             CFLAGS=`./buildtool cflags --debug --pic`
 703             CXXFLAGS=`./buildtool cxxflags --debug --pic`
 704           else
 705             CFLAGS=`./buildtool cflags --optim --pic`
 706             CXXFLAGS=`./buildtool cxxflags --optim --pic`
 707           endif
 708           
 709           CSHLIBFLAGS=`./buildtool cshlibflags --libpath=$libdir`
 710           CXXSHLIBFLAGS=`./buildtool cxxshlibflags --libpath=$libdir`
 711           LIBRARY = lib\$(PROVIDER).`./buildtool shlibext`
 712           
 713           EOF
 714           
 715 mike  1.1 echo "created $fn"
 716           
 717           ##==============================================================================
 718           ##
 719           ## Generate ssl.cnf (certification configuration file).
 720           ##
 721           ##==============================================================================
 722           
 723           fn=$outputdir/ssl.cnf
 724           longhostname=`./buildtool longhostname`
 725           
 726           cat > $fn <<EOF
 727           [ req ]
 728           distinguished_name     = req_distinguished_name
 729           prompt                 = no
 730           [ req_distinguished_name ]
 731           CN                     = $hostname
 732           CN                     = $longhostname
 733           EOF
 734           
 735           echo "created $fn"
 736 mike  1.1 
 737           ##==============================================================================
 738           ##
 739           ## Create 'install' script.
 740           ##
 741           ##==============================================================================
 742           
 743           shlibext=`./buildtool shlibext`
 744           ldlibrarypath=`./buildtool ldlibrarypath`
 745           fn=$outputdir/install
 746           
 747           cat > $fn <<EOF
 748           #!/bin/sh
 749           ##==============================================================================
 750           ##
 751           ## This file was generated by ./configure
 752           ##
 753           ##==============================================================================
 754           
 755           ##
 756           ## Check options
 757 mike  1.1 ##
 758           
 759           for opt
 760           do
 761           
 762             arg=\`expr "x\$opt" : 'x[^=]*=\(.*\)'\`
 763           
 764             case \$opt in
 765           
 766               -h | --help)
 767                 help=1
 768                 ;;
 769           
 770               --destdir=*)
 771                 destdir=\$arg
 772                 ;;
 773           
 774               --openssllibdir=*)
 775                 openssllibdir=\$arg
 776                 if [ ! -d "$openssllibdir" ]; then
 777                   echo "\$0: directory given by --openssllibdir option does not exist: $option"
 778 mike  1.1         exit 1
 779                 fi
 780                 ;;
 781           
 782               *)
 783                 echo "\$0: unknown option:  \$opt"
 784                 exit 1
 785                 ;;
 786           
 787             esac
 788           done
 789           
 790           if [ -z "\$destdir" ]; then
 791             destdir=/
 792           fi
 793           
 794           ##
 795           ## Print help message
 796           ##
 797           
 798           if [ "\$help" = "1" ]; then
 799 mike  1.1 cat<<ENDHELP
 800           
 801           Usage: ./install [OPTIONS]
 802           
 803           OVERVIEW:
 804           
 805           This script installs OMI.
 806           
 807               \$ ./install --destdir /opt
 808           
 809           OPTIONS:
 810               -h, --help              Print this help message.
 811               --destdir=PATH          Install under PATH (default=/)
 812           
 813           ENDHELP
 814               exit 0
 815           fi
 816           
 817           ##
 818           ## Find openssl program.
 819           ##
 820 mike  1.1 
 821           if [ ! -x "\`which openssl\`" ]; then
 822               echo "\$0: 'openssl' program not found on path. Please add to path an try again".
 823               exit 1
 824           fi
 825           
 826           ##
 827           ## Attempt to resolve OpenSSL libdir.
 828           ##
 829           
 830           openssllibdir=\`./buildtool openssllibdir\`
 831           
 832           if [ -n "\$openssllibdir" ]; then
 833               $ldlibrarypath=\$openssllibdir
 834               export $ldlibrarypath
 835           fi
 836           
 837           openssl -h > /dev/null 2> /dev/null
 838           
 839           if [ "\$?" != "0" ]; then
 840               echo "\$0: openssl program is not executable."
 841 mike  1.1     exit 1
 842           fi
 843           
 844           ##
 845           ## Create directories.
 846           ##
 847           
 848           mkdir -p \$destdir/$prefix
 849           mkdir -p \$destdir/$bindir
 850           mkdir -p \$destdir/$libdir
 851           mkdir -p \$destdir/$localstatedir
 852           mkdir -p \$destdir/$localstatedir/log
 853           mkdir -p \$destdir/$localstatedir/run
 854           mkdir -p \$destdir/$sysconfdir
 855           mkdir -p \$destdir/$providerdir
 856           mkdir -p \$destdir/$certsdir
 857           mkdir -p \$destdir/$authdir
 858           mkdir -p \$destdir/$includedir
 859           mkdir -p \$destdir/$includedir/micxx
 860           mkdir -p \$destdir/$includedir/omiclient
 861           mkdir -p \$destdir/$datadir
 862 mike  1.1 mkdir -p \$destdir/$datadir/omischema
 863           mkdir -p \$destdir/$sysconfdir/omiregister
 864           mkdir -p \$destdir/$sysconfdir/omiregister/interop
 865           mkdir -p "\$destdir/$sysconfdir/omiregister/root#cimv2"
 866           mkdir -p "\$destdir/$sysconfdir/omiregister/root#omi"
 867           mkdir -p "\$destdir/$sysconfdir/omiregister/root#check"
 868           mkdir -p \$destdir/$sysconfdir/omiregister/$namespacedir
 869           
 870           ##
 871           ## Install executables.
 872           ##
 873           
 874           cp -f $outputdirbase/bin/omiserver \$destdir/$bindir/omiserver.bin
 875           cp -f $outputdirbase/bin/omicli \$destdir/$bindir/omicli.bin
 876           cp -f $outputdirbase/bin/omigen \$destdir/$bindir/omigen.bin
 877           cp -f $outputdirbase/bin/omireg \$destdir/$bindir/omireg.bin
 878           cp -f $outputdirbase/bin/omicheck \$destdir/$bindir/omicheck.bin
 879           cp -f $outputdirbase/bin/omiagent \$destdir/$bindir/omiagent
 880           
 881           rm -f \$destdir/$bindir/omicli
 882           rm -f \$destdir/$bindir/omigen
 883 mike  1.1 rm -f \$destdir/$bindir/omireg
 884           rm -f \$destdir/$bindir/omiserver
 885           rm -f \$destdir/$bindir/omicheck
 886           
 887           cat > \$destdir/$bindir/omiserver <<OMISERVEREND
 888           #!/bin/sh
 889           prog=\\\`basename \\\$0\\\`
 890           $ldlibrarypath=$libdir:\$openssllibdir
 891           export $ldlibrarypath
 892           $bindir/\\\$prog.bin \\\$@
 893           OMISERVEREND
 894           
 895           chmod 755 \$destdir/$bindir/omiserver
 896           
 897           cp \$destdir/$bindir/omiserver \$destdir/$bindir/omicli
 898           cp \$destdir/$bindir/omiserver \$destdir/$bindir/omigen
 899           cp \$destdir/$bindir/omiserver \$destdir/$bindir/omireg
 900           cp \$destdir/$bindir/omiserver \$destdir/$bindir/omicheck
 901           
 902           ##
 903           ## Install libraries.
 904 mike  1.1 ##
 905           
 906           cp -f $outputdirbase/lib/libmicxx.$shlibext \$destdir/$libdir/
 907           cp -f $outputdirbase/lib/libomiclient.$shlibext \$destdir/$libdir/
 908           
 909           if test -f "$outputdirbase/lib/libbase.$shlibext"
 910           then
 911               cp -f $outputdirbase/lib/libbase.$shlibext \$destdir/$libdir/
 912           fi
 913           
 914           ##
 915           ## Install configuration files.
 916           ##
 917           
 918           if test ! -f "\$destdir/$sysconfdir/omiserver.conf" 
 919           then 
 920               cp ./etc/omiserver.conf \$destdir/$sysconfdir/omiserver.conf
 921           fi
 922           
 923           if test ! -f "\$destdir/$sysconfdir/omicli.conf"
 924           then 
 925 mike  1.1     cp ./etc/omicli.conf \$destdir/$sysconfdir/omicli.conf
 926           fi
 927           
 928           if test ! -f "\$destdir/$sysconfdir/omigen.conf"
 929           then 
 930               cp ./etc/omigen.conf \$destdir/$sysconfdir/omigen.conf
 931           fi
 932           
 933           ##
 934           ## Install header files.
 935           ##
 936           
 937           cp -f ./common/MI.h \$destdir/$includedir/
 938           cp -f ./micxx/array.h \$destdir/$includedir/micxx/
 939           cp -f ./micxx/context.h \$destdir/$includedir/micxx/
 940           cp -f ./micxx/field.h \$destdir/$includedir/micxx/
 941           cp -f ./micxx/micxx.h \$destdir/$includedir/micxx/
 942           cp -f ./micxx/types.h \$destdir/$includedir/micxx/
 943           cp -f ./micxx/arraytraits.h \$destdir/$includedir/micxx/
 944           cp -f ./micxx/datetime.h \$destdir/$includedir/micxx/
 945           cp -f ./micxx/instance.h \$destdir/$includedir/micxx/
 946 mike  1.1 cp -f ./micxx/propertyset.h \$destdir/$includedir/micxx/
 947           cp -f ./micxx/atomic.h \$destdir/$includedir/micxx/
 948           cp -f ./micxx/dinstance.h \$destdir/$includedir/micxx/
 949           cp -f ./micxx/linkage.h \$destdir/$includedir/micxx/
 950           cp -f ./micxx/string.h \$destdir/$includedir/micxx/
 951           cp -f ./omiclient/linkage.h \$destdir/$includedir/omiclient/
 952           cp -f ./omiclient/client.h \$destdir/$includedir/omiclient/
 953           cp -f ./omiclient/handler.h \$destdir/$includedir/omiclient/
 954           
 955           ##
 956           ## Install schema files (MOF files).
 957           ##
 958           
 959           cp -f ./share/omischema/CIM_Schema.mof \$destdir/$datadir/omischema/
 960           rm -rf \$destdir/$datadir/omischema/$cimschema
 961           cp -r ./share/omischema/$cimschema \$destdir/$datadir/omischema/
 962           
 963           ##
 964           ## Install providers.
 965           ##
 966           
 967 mike  1.1 cp -f "./etc/omiregister/root#omi/omiidentify.reg" "\$destdir/$sysconfdir/omiregister/root#omi"
 968           cp -f "./etc/omiregister/root#check/omiidentify.reg" "\$destdir/$sysconfdir/omiregister/root#check"
 969           cp -f $outputdirbase/lib/libomiidentify.$shlibext \$destdir/$providerdir/
 970           
 971           ##
 972           ## Install omi.mak.
 973           ##
 974           
 975           echo "OMI_ROOT=/" > \$destdir/$datadir/omi.mak
 976           cat $outputdirbase/omi.mak >> \$destdir/$datadir/omi.mak
 977           
 978           ##
 979           ## Install certificates.
 980           ##
 981           
 982           hostname=`./buildtool hostname`
 983           cnffile=./output/$hostname/ssl.cnf
 984           keyfile=\$destdir/$certsdir/omikey.pem
 985           certfile=\$destdir/$certsdir/omi.pem
 986           
 987           if [ -f "\$keyfile" -a -f "\$certfile" ]; then
 988 mike  1.1   echo
 989             echo "************************************************************"
 990             echo "* Warning: The certificate and keyfile were not generated  *"
 991             echo "* since they already exist.                                *"
 992             echo "************************************************************"
 993           else
 994             openssl req -x509 -sha1 -newkey rsa:2048 -days 3650 -nodes -config \$cnffile -keyout \$keyfile -out \$certfile
 995             chmod 600 \$keyfile
 996             chmod 644 \$certfile
 997           fi
 998           
 999           ##
1000           ## Configure PAM.
1001           ##
1002           
1003           $outputdirbase/installpam
1004           
1005           ##
1006           ## Install 'uninstall' script.
1007           ##
1008           
1009 mike  1.1 cp $outputdirbase/uninstall \$destdir/$bindir/omiuninstall
1010           chmod 755 \$destdir/$bindir/omiuninstall
1011           
1012           ##
1013           ## Print success message!
1014           ##
1015           
1016           echo "Successfully installed under under: \$destdir/$prefix"
1017           
1018           EOF
1019           
1020           chmod +x $fn
1021           echo "created $fn"
1022           
1023           ##==============================================================================
1024           ##
1025           ## Create 'uninstall' script.
1026           ##
1027           ##==============================================================================
1028           
1029           shlibext=`./buildtool shlibext`
1030 mike  1.1 fn=$outputdir/uninstall
1031           
1032           cat > $fn <<EOF
1033           #!/bin/sh
1034           ##==============================================================================
1035           ##
1036           ## This file was generated by ./configure
1037           ##
1038           ##==============================================================================
1039           
1040           rm -rf $prefix/bin/omiserver
1041           rm -rf $prefix/bin/omiserver.bin
1042           rm -rf $prefix/bin/omiagent
1043           rm -rf $prefix/bin/omicli
1044           rm -rf $prefix/bin/omicli.bin
1045           rm -rf $prefix/bin/omigen
1046           rm -rf $prefix/bin/omigen.bin
1047           rm -rf $prefix/bin/omireg
1048           rm -rf $prefix/bin/omireg.bin
1049           rm -rf $prefix/bin/omicheck
1050           rm -rf $prefix/bin/omicheck.bin
1051 mike  1.1 rm -rf $prefix/lib/libmicxx.$shlibext
1052           rm -rf $prefix/lib/libomiclient.$shlibext
1053           rm -rf $prefix/lib/libomiidentify.$shlibext
1054           rm -rf $prefix/var/log/omiserver.log
1055           rm -rf $prefix/var/log/omiagent.*.*.log
1056           rm -rf $prefix/var/run/omiserver.pid
1057           rm -rf $prefix/var/run/omiserver.sock
1058           rm -rf $prefix/var/omiauth
1059           rm -rf $prefix/etc/omiregister
1060           rm -rf $prefix/include/micxx
1061           rm -rf $prefix/include/omiclient
1062           rm -rf $prefix/include/MI.h
1063           rm -rf $prefix/share/omischema
1064           rm -rf $prefix/share/omi.mak
1065           
1066           EOF
1067           
1068           chmod +x $fn
1069           echo "created $fn"
1070           
1071           ##==============================================================================
1072 mike  1.1 ##
1073           ## Take suitable 'installpam' script.
1074           ##
1075           ##==============================================================================
1076           
1077           os=`uname -s`
1078           fn=$outputdir/installpam
1079           rm -f $fn
1080           
1081           case $os in
1082                   Linux)
1083                       if [ -f /etc/S[uU]SE-release ]; then 
1084                           cp ./scripts/installpam-sles $fn
1085                       else
1086                           cp ./scripts/installpam-rhel $fn
1087                       fi
1088                       ;;
1089                   HP-UX)
1090                       cp ./scripts/installpam-hp $fn
1091                       ;;
1092                   AIX)
1093 mike  1.1             cp ./scripts/installpam-aix $fn
1094                       ;;
1095                   SunOS)
1096                       VERSION=`uname -r | sed 's/[0-9]\.//'`
1097                       if [ "$VERSION" = "10" ]; then
1098                           cp ./scripts/installpam-sun10 $fn
1099                       else
1100                           cp ./scripts/installpam-sun9 $fn
1101                       fi
1102                       ;;
1103                   Darwin)
1104                       echo "pam script is not supported on Mac-OS yet"
1105                       touch $fn
1106                       ;;
1107                   *)
1108                       echo "Unknown"
1109                       exit 1
1110                   ;;
1111           esac
1112           
1113           test -f $fn && chmod +x $fn && echo "pam-script configured"
1114 mike  1.1 
1115           ##==============================================================================
1116           ##
1117           ## Put platform configuration message.
1118           ##
1119           ##==============================================================================
1120           
1121           echo "Configured for $platform"

ViewCVS 0.9.2