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