#!/bin/sh ##============================================================================== ## ## configuredir ## rootrelative ## root ## Determine the root directory of the distribution (not necessarily the ## same as the current directory, since configure can be run anywhere). ## ##============================================================================== configuredir=`pwd` rootrelative=`dirname $0` cd $rootrelative root=`pwd` cd $configuredir ##============================================================================== ## ## Product, Version, and Bilddate information: ## ##============================================================================== product="OMI" fullproduct="Open Management Infrastructure" major=`cut -d. -f1 $root/VERSION` minor=`cut -d. -f2 $root/VERSION` revision=`cut -d. -f3 $root/VERSION` version="$major.$minor.$revision" version_with_release="$major.$minor.$revision-1" date=`date` ##============================================================================== ## ## CIM Schema version ## ##============================================================================== cimschema="CIM-2.32.0" ##============================================================================== ## ## Get command line options that start with slash. ## ##============================================================================== for opt do arg=`expr "x$opt" : 'x[^=]*=\(.*\)'` case $opt in -h | --help) help=1 ;; --enable-debug) enable_debug=1 ;; --enable-httpheaders) enable_httpheaders=1 ;; --disable-rtti) disable_rtti=1 ;; --disable-templates) disable_templates=1 ;; --target=*) target=$arg ;; --prefix=*) prefix=$arg ;; --bindir=*) bindir=$arg ;; --libdir=*) libdir=$arg ;; --includedir=*) includedir=$arg ;; --datadir=*) datadir=$arg ;; --localstatedir=*) localstatedir=$arg ;; --sysconfdir=*) sysconfdir=$arg ;; --providerdir=*) providerdir=$arg ;; --providerdir=*) providerdir=$arg ;; --certsdir=*) certsdir=$arg ;; --authdir=*) authdir=$arg ;; --outputdirname=*) outputdirname=$arg ;; --enable-werror) enable_werror=1 ;; --enable-wchar) enable_wchar=1 ;; --enable-gcov) enable_gcov=1 ;; --namespace=*) namespace=$arg ;; --httpport=*) httpport=$arg ;; --httpsport=*) httpsport=$arg ;; --disable-libpath) disable_libpath=1 ;; --favorsize) favorsize=1 ;; --singleimage) singleimage=1 ;; --dev) dev=1 ;; --openssl=*) openssl=$arg ;; --opensslcflags=*) opensslcflags=$arg opensslcflags_found=1 ;; --openssllibs=*) openssllibs=$arg openssllibs_found=1 ;; --openssllibdir=*) openssllibdir=$arg openssllibdir_found=1 ;; --with-cc=*) with_cc=$arg ;; --with-cxx=*) with_cxx=$arg ;; --with-ar=*) with_ar=$arg ;; --enable-32bit) enable_32bit=1 ;; --disable-localsession) disable_localsession=1 ;; --disable-indication) disable_indication=1 ;; --disable-atomics) disable_atomics=1 ;; --enable-preexec) enable_preexec=1 ;; --enable-sections) enable_sections=1 ;; *) echo "$0: unknown option: $opt" exit 1 ;; esac done ##============================================================================== ## ## Print the help message ## ##============================================================================== if [ "$help" = "1" ]; then cat<=" 1 ")" "&" "(" "$httpport" "<=" 65535 ")"` if [ "$rc" = "0" ]; then echo "$0: invalid --httpport option: $httpport" exit 1 fi fi if [ -z "$httpsport" ]; then httpsport=5986 else rc=`expr "(" "$httpsport" ">=" 1 ")" "&" "(" "$httpsport" "<=" 65535 ")"` if [ "$rc" = "0" ]; then echo "$0: invalid --httpsport option: $httpsport" exit 1 fi fi ##============================================================================== ## ## Create output directories. ## ##============================================================================== mkdir -p $outputdir echo "created $outputdir" mkdir -p $outputdir/bin mkdir -p $outputdir/lib mkdir -p $outputdir/obj mkdir -p $outputdir/tmp mkdir -p $outputdir/var mkdir -p $outputdir/var/log mkdir -p $outputdir/var/run mkdir -p $outputdir/var/omiauth mkdir -p $outputdir/include mkdir -p $tmpdir ##============================================================================== ## ## Set macros for suppressing the linefeed produced by 'echo' command. ## ##============================================================================== case `echo -n xyz` in -n*) echon= case `echo 'xyz\c'` in *c*) echoc= ;; *) echoc='\c' ;; esac ;; *) echon='-n' echoc= ;; esac ##============================================================================== ## ## Attempt to find C compiler. ## ##============================================================================== echo $echon "checking whether C compiler is on the path... $echoc" cc=$with_cc if [ "$cc" = "" ]; then echo "$0: failed" exit 1 fi tmp1=`echo $cc | awk '{ print $1; }'` tmp2=`which $tmp1` if [ -x "$tmp2" ]; then echo "yes" else echo "no" exit 1 fi ##============================================================================== ## ## Attempt to compile and execute a simple C program ## ##============================================================================== echo $echon "checking whether C compiler compiles... $echoc" rm -f $tmpdir/cprogram cflags=`$buildtool cflags $buildtoolopts` cprogflags=`$buildtool cprogflags $buildtoolopts` cat > $tmpdir/cprogram.c < /dev/null 2> /dev/null ) if [ "$?" = "0" ]; then echo "yes" else echo "no" exit 1 fi if [ -z "$CONFIG_TARGET" ]; then echo $echon "checking whether C program executes... $echoc" $tmpdir/cprogram if [ "$?" = "123" ]; then echo "yes" else echo "no" exit 1 fi fi rm $tmpdir/cprogram.c rm $tmpdir/cprogram ##============================================================================== ## ## Check whether __FUNCTION__ macro or reserved word is supported. ## ##============================================================================== echo $echon "checking for __FUNCTION__ macro or reserved word... $echoc" rm -f $tmpdir/function cat > $tmpdir/function.c < int main() { printf("%s\n", __FUNCTION__); return 0; } EOF ( cd $tmpdir ; $cc $cprogflags $clfags -o function function.c > /dev/null 2> /dev/null ) if [ "$?" = "0" ]; then have_function_macro=1 echo "yes" else have_function_macro=0 echo "no" fi rm -f $tmpdir/function.c rm -f $tmpdir/function ##============================================================================== ## ## Check whether __builtin_ctz is supported. ## ##============================================================================== echo $echon "checking for __builtin_ctz... $echoc" rm -f $tmpdir/builtin_ctz_test cat > $tmpdir/builtin_ctz_test.c < int main() { printf("Trailing 0s in 0x8 are %d and in 0x7 are %d\n", __builtin_ctz(0x8), __builtin_ctz(0x7)); } EOF ( cd $tmpdir ; $cc $cprogflags $cflags -o builtin_ctz_test builtin_ctz_test.c > /dev/null 2> /dev/null ) if [ "$?" = "0" ]; then have_builtin_ctz=1 echo "yes" else have_builtin_ctz=0 echo "no" fi rm -f $tmpdir/builtin_ctz_test.c rm -f $tmpdir/builtin_ctz_test ##============================================================================== ## ## Check whether __builtin_prefetch is supported. ## ##============================================================================== echo $echon "checking for __builtin_prefetch... $echoc" rm -f $tmpdir/builtin_prefetch_test cat > $tmpdir/builtin_prefetch_test.c < /dev/null 2> /dev/null ) if [ "$?" = "0" ]; then have_builtin_prefetch=1 echo "yes" else have_builtin_prefetch=0 echo "no" fi rm -f $tmpdir/builtin_prefetch_test.c rm -f $tmpdir/builtin_prefetch_test ##============================================================================== ## ## Check whether sched_getcpu is supported. ## ##============================================================================== echo $echon "checking for sched_getcpu... $echoc" rm -f $tmpdir/sched_getcpu_test cat > $tmpdir/sched_getcpu_test.c < int main() { printf("%d\n", sched_getcpu()); } EOF ( cd $tmpdir ; $cc $cprogflags $clfags -o sched_getcpu_test sched_getcpu_test.c > /dev/null 2> /dev/null ) if [ "$?" = "0" ]; then have_sched_getcpu=1 echo "yes" else have_sched_getcpu=0 echo "no" fi rm -f $tmpdir/sched_getcpu_test.c rm -f $tmpdir/sched_getcpu_test ##============================================================================== ## ## Check whether wcstoll is supported. ## ##============================================================================== echo $echon "checking for wcstoll... $echoc" rm -f $tmpdir/wcstoll_test cat > $tmpdir/wcstoll_test.c < #include extern long long wcstoll(const wchar_t* s, wchar_t** e, int b); int main() { printf("converted value %lld\n", wcstoll(L"123", NULL, 0)); } EOF ( cd $tmpdir ; $cc $cprogflags $cflags -o wcstoll_test wcstoll_test.c > /dev/null 2> /dev/null ) if [ "$?" = "0" ]; then have_wcstoll=1 echo "yes" else have_wcstoll=0 echo "no" fi rm -f $tmpdir/wcstoll_test.c rm -f $tmpdir/wcstoll_test ##============================================================================== ## ## Check whether wcsdup is supported. ## ##============================================================================== echo $echon "checking for wcsdup... $echoc" rm -f $tmpdir/wcsdup_test cat > $tmpdir/wcsdup_test.c < #include extern wchar_t* wcsdup(const wchar_t*); int main() { const wchar_t *str = L"My string"; printf("%S \n", wcsdup(str)); } EOF ( cd $tmpdir ; $cc $cprogflags $cflags -o wcsdup_test wcsdup_test.c > /dev/null 2> /dev/null ) if [ "$?" = "0" ]; then have_wcsdup=1 echo "yes" else have_wcsdup=0 echo "no" fi rm -f $tmpdir/wcsdup_test.c rm -f $tmpdir/wcsdup_test ##============================================================================== ## ## Check whether wcscasecmp, wcsncasecmp is supported. ## ##============================================================================== echo $echon "checking for wcscasecmp, wcsncasecmp... $echoc" rm -f $tmpdir/wcscasecmp_test cat > $tmpdir/wcscasecmp_test.c < #include extern int wcscasecmp(const wchar_t*, const wchar_t*); extern int wcsncasecmp(const wchar_t*, const wchar_t*, size_t n); int main() { const wchar_t *str1 = L"ABC"; const wchar_t *str2 = L"aB"; printf("casecmp = %d case2cmp = %d\n", wcscasecmp(str1, str2), wcsncasecmp(str1, str2, 2)); } EOF ( cd $tmpdir ; $cc $cprogflags $cflags -o wcscasecmp_test wcscasecmp_test.c > /dev/null 2> /dev/null ) if [ "$?" = "0" ]; then have_wcscasecmp=1 echo "yes" else have_wcscasecmp=0 echo "no" fi rm -f $tmpdir/wcscasecmp_test.c rm -f $tmpdir/wcscasecmp_test ##============================================================================== ## ## Check whether vswscanf is supported. ## ##============================================================================== echo $echon "checking for vswscanf... $echoc" rm -f $tmpdir/vswscanf_test cat > $tmpdir/vswscanf_test.c < #include #include extern int vswscanf(const wchar_t*, const wchar_t*, va_list); static void scan(const wchar_t* str, const wchar_t* fmt, ...) { va_list args; va_start(args, fmt); vswscanf(str, fmt, args); va_end(args); } int main() { const wchar_t *str = L"37"; const wchar_t *fmt = L"%d"; int n; scan(str, fmt, &n); return 0; } EOF ( cd $tmpdir ; $cc $cprogflags $cflags -o vswscanf_test vswscanf_test.c > /dev/null 2> /dev/null ) if [ "$?" = "0" ]; then have_vswscanf=1 echo "yes" else have_vswscanf=0 echo "no" fi rm -f $tmpdir/vswscanf.c rm -f $tmpdir/vswscanf_test ##============================================================================== ## ## Check whether va_copy from the C99 standard is supported. ## ##============================================================================== echo $echon "checking for va_copy... $echoc" rm -f $tmpdir/va_copy_test cat > $tmpdir/va_copy_test.c < #include static void cpy(const char* str, const char* fmt, ...) { va_list args; va_list dest; va_start(args, fmt); va_copy(dest, args); va_end(dest); } int main() { const char *str = "-61"; const char *fmt = L"%d"; int n; cpy(str, fmt, &n); return 0; } EOF ( cd $tmpdir ; $cc $cprogflags $cflags -o va_copy_test va_copy_test.c > /dev/null 2> /dev/null ) if [ "$?" = "0" ]; then have_va_copy=1 echo "yes" else have_va_copy=0 echo "no" fi rm -f $tmpdir/va_copy_test.c rm -f $tmpdir/va_copy_test ##============================================================================== ## ## Check whether backtrace is supported. ## ##============================================================================== echo $echon "checking for backtrace... $echoc" rm -f $tmpdir/backtrace_test cat > $tmpdir/backtrace_test.c < #include int main() { void *StackFrames[3]; int count = backtrace(StackFrames, 3); printf("%d\n", count); } EOF ( cd $tmpdir ; $cc $cprogflags $cflags -o backtrace_test backtrace_test.c > /dev/null 2> /dev/null ) if [ "$?" = "0" ]; then have_backtrace=1 echo "yes" else have_backtrace=0 echo "no" fi rm -f $tmpdir/backtrace_test.c rm -f $tmpdir/backtrace_test ##============================================================================== ## ## Check whether __sync_synchronize is supported. ## ##============================================================================== echo $echon "checking for __sync_synchronize... $echoc" rm -f $tmpdir/sync_synchronize_test cat > $tmpdir/sync_synchronize_test.c < /dev/null 2> /dev/null ) if [ "$?" = "0" ]; then have_sync_synchronize=1 echo "yes" else have_sync_synchronize=0 echo "no" fi rm -f $tmpdir/sync_synchronize_test.c rm -f $tmpdir/sync_synchronize_test ##============================================================================== ## ## Check whether Atomic Intrinsic Functions are supported. ## ##============================================================================== echo $echon "checking for Atomic Intrinsic Functions... $echoc" rm -f $tmpdir/atomic_intrinsic cat > $tmpdir/atomic_intrinsic.c < int main() { volatile long x = 1; printf("Result value = %d\n", x, __sync_add_and_fetch(&x, 1)); printf("Result value = %d\n", x, __sync_val_compare_and_swap(&x, 2, 3)); printf("Result value = %d\n", x, __sync_lock_test_and_set(&x, 4)); printf("Result value = %d\n", x, __sync_and_and_fetch(&x, 15)); printf("Result value = %d\n", x, __sync_sub_and_fetch(&x, 1)); return 0; } EOF ( cd $tmpdir ; $cc $cprogflags $cflags -o atomic_intrinsic atomic_intrinsic.c > /dev/null 2> /dev/null ) if [ "$?" = "0" ]; then have_atomic_intrinsics=1 echo "yes" else have_atomic_intrinsics=0 echo "no" fi rm -f $tmpdir/atomic_intrinsic.c rm -f $tmpdir/atomic_intrinsic if [ "$disable_atomics" = "1" ]; then have_atomic_intrinsics=0 fi ##============================================================================== ## ## Check whether sem_timedwait is supported. ## ##============================================================================== echo $echon "checking for sem_timedwait... $echoc" rm -f $tmpdir/sem_timedwait_func cat > $tmpdir/sem_timedwait_func.c < # include int main() { sem_t sem; if(sem_init(&sem, 0, 1) == 0) { struct timespec temp = {0}; sem_timedwait(&sem, &temp); } return 0; } EOF ( cd $tmpdir ; $cc $cprogflags $cflags -o sem_timedwait_func sem_timedwait_func.c > /dev/null 2> /dev/null ) if [ "$?" = "0" ]; then have_sem_timedwait_func=1 echo "yes" else have_sem_timedwait_func=0 echo "no" fi rm -f $tmpdir/sem_timedwait_func.c rm -f $tmpdir/sem_timedwait_func ##============================================================================== ## ## Check whether strerror_r is supported. ## ##============================================================================== echo $echon "checking for strerror_r... $echoc" rm -f $tmpdir/strerror_r cat > $tmpdir/strerror_r.c < #include int main() { char buf[128]; strerror_r(EAGAIN, buf, sizeof(buf)); return 0; } EOF ( cd $tmpdir ; $cc -c -o strerror_r -Werror -Wall strerror_r.c > /dev/null 2> /dev/null ) if [ "$?" = "0" ]; then have_strerror_r=1 echo "yes" else have_strerror_r=0 echo "no" fi rm -f $tmpdir/strerror_r.c rm -f $tmpdir/strerror_r ##============================================================================== ## ## Check whether pthread_rwlock_t is supported. ## ##============================================================================== echo $echon "checking for pthread_rwlock_t... $echoc" rm -f $tmpdir/pthread_rwlock_t_func cat > $tmpdir/pthread_rwlock_t_func.c < int main() { pthread_rwlock_t lock = PTHREAD_RWLOCK_INITIALIZER; (void)lock; return 0; } EOF ( cd $tmpdir ; $cc $cprogflags $cflags -o pthread_rwlock_t_func pthread_rwlock_t_func.c > /dev/null 2> /dev/null ) if [ "$?" = "0" ]; then echo "yes" else echo "no" exit 1 fi rm -f $tmpdir/pthread_rwlock_t_func.c rm -f $tmpdir/pthread_rwlock_t_func ##============================================================================== ## ## Check for 'pkg-config' command. ## ##============================================================================== echo $echon "checking whether pkg-config command is on the path... $echoc" pkgconfig=`which pkg-config` if [ -x "$pkgconfig" ]; then echo "yes" else echo "no" exit 1 fi ##============================================================================== ## ## Resolve OpenSSL options: ## ##============================================================================== if [ -z "$openssl" ]; then echo $echon "checking whether openssl command is on the path... $echoc" openssl=`which openssl` if [ -x "$openssl" ]; then echo "yes" else echo "no" exit 1 fi fi if [ "$opensslcflags_found" != "1" ]; then opensslcflags=`$pkgconfig --cflags openssl` fi if [ -z "$openssllibs_found" ]; then openssllibs=`$pkgconfig --libs openssl` fi if [ -z "$openssllibdir_found" ]; then openssllibdir=`$pkgconfig --variable=libdir openssl` fi ##============================================================================== ## ## Check for 'pkg-config' command. ## ##============================================================================== echo $echon "checking whether fault injection is supported... $echoc" faultinjection=`$buildtool faultinjection` if [ "$faultinjection" = "1" ]; then echo "yes" enable_faultinjection=1 else echo "no" fi ##============================================================================== ## ## Check for 'vsnprintf' behavior on NULL buffer ## ##============================================================================== echo $echon "checking whether vsnprintf return -1 on NULL buffer... $echoc" vsnprintfreturnminusone=`$buildtool vsnprintf` if [ "$vsnprintfreturnminusone" = "1" ]; then echo "yes" vsnprintf_returnminusoneonnullbuffer=1 else echo "no" fi ##============================================================================== ## ## Grap the timestamp: ## ##============================================================================== timestamp=`cat $root/TIMESTAMP` ##============================================================================== ## ## Create config.mak file ## ##============================================================================== fn=$outputdir/config.mak cat > $fn <> $fnnitsargs fi if [ $shlibext = "so" ]; then cat $root/ut/nonWin/nitsargs.txt >> $fnnitsargs else sed -e "s/\.so/\.$shlibext/" < $root/ut/nonWin/nitsargs.txt >> $fnnitsargs fi chmod +w $fnnitsargs echo "created $fnnitsargs" ##============================================================================== ## ## Create config.h file ## ##============================================================================== fn=$outputdir/include/config.h cat > $fn <> $fn else echo "/* #define CONFIG_ENABLE_DEBUG */" >> $fn fi if [ "$enable_gcov" = "1" ]; then echo "#define CONFIG_ENABLE_GCOV" >> $fn else echo "/* #define CONFIG_ENABLE_GCOV */" >> $fn fi if [ "$enable_werror" = "1" ]; then echo "#define CONFIG_ENABLE_WERROR" >> $fn else echo "/* #define CONFIG_ENABLE_WERROR */" >> $fn fi if [ "$enable_wchar" = "1" ]; then echo "#define CONFIG_ENABLE_WCHAR" >> $fn else echo "/* #define CONFIG_ENABLE_WCHAR */" >> $fn fi if [ "$disable_rtti" = "1" ]; then echo "#define CONFIG_DISABLE_RTTI" >> $fn else echo "/* #define CONFIG_DISABLE_RTTI */" >> $fn fi if [ "$disable_libpath" = "1" ]; then echo "#define CONFIG_DISABLE_LIBPATH" >> $fn else echo "/* #define CONFIG_DISABLE_LIBPATH */" >> $fn fi if [ "$disable_templates" = "1" ]; then echo "#define CONFIG_DISABLE_TEMPLATES" >> $fn else echo "/* #define CONFIG_DISABLE_TEMPLATES */" >> $fn fi if [ "$favorsize" = "1" ]; then echo "#define CONFIG_FAVORSIZE" >> $fn else echo "/* #define CONFIG_FAVORSIZE */" >> $fn fi if [ "$disable_localsession" = "1" ]; then echo "#define DISABLE_LOCALSESSION" >> $fn else echo "/* #define DISABLE_LOCALSESSION */" >> $fn fi if [ "$disable_indication" = "1" ]; then echo "#define DISABLE_INDICATION" >> $fn else echo "/* #define DISABLE_INDICATION */" >> $fn echo $echon "libtest_indication."$shlibext >> $fnnitsargs fi if [ "$singleimage" = "1" ]; then echo "#define CONFIG_SINGLEIMAGE" >> $fn else echo "/* #define CONFIG_SINGLEIMAGE */" >> $fn fi if [ "$have_function_macro" = "1" ]; then echo "#define CONFIG_HAVE_FUNCTION_MACRO" >> $fn else echo "/* #define CONFIG_HAVE_FUNCTION_MACRO */" >> $fn fi if [ "$have_builtin_ctz" = "1" ]; then echo "#define CONFIG_HAVE_BUILTIN_CTZ" >> $fn else echo "/* #define CONFIG_HAVE_BUILTIN_CTZ */" >> $fn fi if [ "$have_builtin_prefetch" = "1" ]; then echo "#define CONFIG_HAVE_BUILTIN_PREFETCH" >> $fn else echo "/* #define CONFIG_HAVE_BUILTIN_PREFETCH */" >> $fn fi if [ "$have_sched_getcpu" = "1" ]; then echo "#define CONFIG_HAVE_SCHED_GETCPU" >> $fn else echo "/* #define CONFIG_HAVE_SCHED_GETCPU */" >> $fn fi if [ "$have_wcstoll" = "1" ]; then echo "#define CONFIG_HAVE_WCSTOLL" >> $fn else echo "/* #define CONFIG_HAVE_WCSTOLL */" >> $fn fi if [ "$have_wcsdup" = "1" ]; then echo "#define CONFIG_HAVE_WCSDUP" >> $fn else echo "/* #define CONFIG_HAVE_WCSDUP */" >> $fn fi if [ "$have_wcscasecmp" = "1" ]; then echo "#define CONFIG_HAVE_WCSCASECMP" >> $fn else echo "/* #define CONFIG_HAVE_WCSCASECMP */" >> $fn fi if [ "$have_vswscanf" = "1" ]; then echo "#define CONFIG_HAVE_VSWSCANF" >> $fn else echo "/* #define CONFIG_HAVE_VSWSCANF */" >> $fn fi if [ "$have_va_copy" = "1" ]; then echo "#define CONFIG_HAVE_VA_COPY" >> $fn else echo "/* #define CONFIG_HAVE_VA_COPY */" >> $fn fi if [ "$have_backtrace" = "1" ]; then echo "#define CONFIG_HAVE_BACKTRACE" >> $fn else echo "/* #define CONFIG_HAVE_BACKTRACE */" >> $fn fi if [ "$have_sync_synchronize" = "1" ]; then echo "#define CONFIG_HAVE_SYNC_SYNCHRONIZE" >> $fn else echo "/* #define CONFIG_HAVE_SYNC_SYNCHRONIZE */" >> $fn fi if [ "$have_atomic_intrinsics" = "1" ]; then echo "#define CONFIG_HAVE_ATOMIC_INTRINSICS" >> $fn else echo "/* #define CONFIG_HAVE_ATOMIC_INTRINSICS */" >> $fn fi if [ "$have_sem_timedwait_func" = "1" ]; then echo "#define CONFIG_HAVE_SEM_TIMEDWAIT" >> $fn else echo "/* #define CONFIG_HAVE_SEM_TIMEDWAIT */" >> $fn fi if [ "$have_strerror_r" = "1" ]; then echo "#define CONFIG_HAVE_STRERROR_R" >> $fn else echo "/* #define CONFIG_HAVE_STRERROR_R */" >> $fn fi echo "#define CONFIG_SHLIBEXT \"$shlibext\" " >> $fn echo "#define CONFIG_TIMESTAMP \"$timestamp\" " >> $fn if [ "$enable_httpheaders" = "1" ]; then echo "#define CONFIG_ENABLE_HTTPHEADERS" >> $fn else echo "/* #define CONFIG_ENABLE_HTTPHEADERS */" >> $fn fi echo "#define CONFIG_SEMNAMELOCALPREFIX \"`$buildtool semnamelocalprefix`\"" CONFIG_UUID >> $fn echo "#define CONFIG_SEMNAMEGLOBALPREFIX \"`$buildtool semnamelocalprefix`\"" CONFIG_UUID>> $fn echo "#define CONFIG_SHMNAMELOCALPREFIX \"`$buildtool shmnamelocalprefix`\"" CONFIG_UUID >> $fn echo "#define CONFIG_SHMNAMEGLOBALPREFIX \"`$buildtool shmnamelocalprefix`\"" CONFIG_UUID >> $fn if [ "$enable_preexec" = "1" ]; then echo "#define CONFIG_ENABLE_PREEXEC" >> $fn else echo "/* #define CONFIG_ENABLE_PREEXEC */" >> $fn fi if [ "$enable_sections" = "1" ]; then echo "#define CONFIG_ENABLE_SECTIONS" >> $fn else echo "/* #define CONFIG_ENABLE_SECTIONS */" >> $fn fi if [ "$enable_faultinjection" = "1" ]; then echo "#define CONFIG_ENABLE_FAULTINJECTION" >> $fn else echo "/* #define CONFIG_ENABLE_FAULTINJECTION */" >> $fn fi if [ "$vsnprintf_returnminusoneonnullbuffer" = "1" ]; then echo "#define CONFIG_VSNPRINTF_RETURN_MINUSONE_WITH_NULLBUFFER" >> $fn else echo "/* #define CONFIG_VSNPRINTF_RETURN_MINUSONE_WITH_NULLBUFFER */" >> $fn fi echo "" >> $fn echo "#endif /* _config_h */" >> $fn echo "created $fn" fn="" ##============================================================================== ## ## Setup symbolic links for 'include' directory. ## ##============================================================================== fn=$outputdir/include/MI.h rm -rf $fn echo "#define MI_MAJOR $major" >> $fn echo "#define MI_MINOR $minor" >> $fn echo "#define MI_REVISION $revision" >> $fn if [ "$enable_wchar" = "1" ]; then cat $root/common/MI_wchar.h.in >> $fn fi cat $root/common/MI.h >> $fn echo "Created $fn" fn="" rm -rf $outputdir/include/micxx ln -f -s $root/micxx $outputdir/include/micxx rm -rf $outputdir/include/omiclient ln -f -s $root/omiclient $outputdir/include/omiclient ##============================================================================== ## ## Generate omi.mak (end-user makefile). ## ##============================================================================== fn=$outputdir/omi.mak cat > $fn < $fn < $fn < /dev/null 2> /dev/null if [ "\$?" != "0" ]; then echo "\$0: openssl program is not executable." exit 1 fi ## ## Create directories. ## mkdir -p \$destdir/$prefix mkdir -p \$destdir/$bindir mkdir -p \$destdir/$libdir mkdir -p \$destdir/$localstatedir mkdir -p \$destdir/$localstatedir/log mkdir -p \$destdir/$localstatedir/run mkdir -p \$destdir/$sysconfdir mkdir -p \$destdir/$providerdir mkdir -p \$destdir/$certsdir mkdir -p \$destdir/$authdir mkdir -p \$destdir/$includedir mkdir -p \$destdir/$includedir/micxx mkdir -p \$destdir/$includedir/omiclient mkdir -p \$destdir/$datadir mkdir -p \$destdir/$datadir/omischema mkdir -p \$destdir/$sysconfdir/omiregister mkdir -p \$destdir/$sysconfdir/omiregister/interop mkdir -p "\$destdir/$sysconfdir/omiregister/root-cimv2" mkdir -p "\$destdir/$sysconfdir/omiregister/root-omi" mkdir -p "\$destdir/$sysconfdir/omiregister/root-check" mkdir -p \$destdir/$sysconfdir/omiregister/$namespacedir ## ## Install executables. ## if test -f "$outputdirrelative/bin/omiimage"; then cp -f $outputdirrelative/bin/omiimage \$destdir/$bindir/omiimage rm -r \$destdir/bin/omiserver ln -s \$destdir/$bindir/omiimage \$destdir/$bindir/omiserver rm -r \$destdir/bin/omiagent ln -s \$destdir/$bindir/omiimage \$destdir/$bindir/omiagent else cp -f $outputdirrelative/bin/omiserver \$destdir/$bindir/omiserver cp -f $outputdirrelative/bin/omiagent \$destdir/$bindir/omiagent fi cp -f $outputdirrelative/bin/omicli \$destdir/$bindir/omicli cp -f $outputdirrelative/bin/omigen \$destdir/$bindir/omigen cp -f $outputdirrelative/bin/omireg \$destdir/$bindir/omireg cp -f $outputdirrelative/bin/omicheck \$destdir/$bindir/omicheck ## ## Install libraries. ## cp -f $outputdirrelative/lib/libmicxx.$shlibext \$destdir/$libdir/ cp -f $outputdirrelative/lib/libomiclient.$shlibext \$destdir/$libdir/ cp -f $outputdirrelative/lib/libmi.$shlibext \$destdir/$libdir/ if test -f "$outputdirrelative/lib/libbase.$shlibext" then cp -f $outputdirrelative/lib/libbase.$shlibext \$destdir/$libdir/ fi if test -f "$outputdirrelative/lib/libpal.$shlibext" then cp -f $outputdirrelative/lib/libpal.$shlibext \$destdir/$libdir/ fi ## ## Install configuration files. ## if test ! -f "\$destdir/$sysconfdir/omiserver.conf" then cp $rootrelative/etc/omiserver.conf \$destdir/$sysconfdir/omiserver.conf fi if test ! -f "\$destdir/$sysconfdir/omicli.conf" then cp $rootrelative/etc/omicli.conf \$destdir/$sysconfdir/omicli.conf fi if test ! -f "\$destdir/$sysconfdir/omigen.conf" then cp $rootrelative/etc/omigen.conf \$destdir/$sysconfdir/omigen.conf fi ## ## Install header files. ## cp -f $outputdirrelative/include/MI.h \$destdir/$includedir/ cp -f $rootrelative/micxx/array.h \$destdir/$includedir/micxx/ cp -f $rootrelative/micxx/context.h \$destdir/$includedir/micxx/ cp -f $rootrelative/micxx/field.h \$destdir/$includedir/micxx/ cp -f $rootrelative/micxx/micxx.h \$destdir/$includedir/micxx/ cp -f $rootrelative/micxx/types.h \$destdir/$includedir/micxx/ cp -f $rootrelative/micxx/arraytraits.h \$destdir/$includedir/micxx/ cp -f $rootrelative/micxx/datetime.h \$destdir/$includedir/micxx/ cp -f $rootrelative/micxx/instance.h \$destdir/$includedir/micxx/ cp -f $rootrelative/micxx/propertyset.h \$destdir/$includedir/micxx/ cp -f $rootrelative/micxx/atomic.h \$destdir/$includedir/micxx/ cp -f $rootrelative/micxx/dinstance.h \$destdir/$includedir/micxx/ cp -f $rootrelative/micxx/linkage.h \$destdir/$includedir/micxx/ cp -f $rootrelative/micxx/micxx_string.h \$destdir/$includedir/micxx/ cp -f $rootrelative/micxx/atomic.h \$destdir/$includedir/micxx/ cp -f $rootrelative/omiclient/linkage.h \$destdir/$includedir/omiclient/ cp -f $rootrelative/omiclient/client.h \$destdir/$includedir/omiclient/ cp -f $rootrelative/omiclient/handler.h \$destdir/$includedir/omiclient/ ## ## Install schema files (MOF files). ## cp -f $rootrelative/share/omischema/CIM_Schema.mof \$destdir/$datadir/omischema/ rm -rf \$destdir/$datadir/omischema/$cimschema cp -r $rootrelative/share/omischema/$cimschema \$destdir/$datadir/omischema/ ## ## Install providers. ## cp -f "$rootrelative/etc/omiregister/root-omi/omiidentify.reg" "\$destdir/$sysconfdir/omiregister/root-omi" cp -f "$rootrelative/etc/omiregister/root-check/omiidentify.reg" "\$destdir/$sysconfdir/omiregister/root-check" cp -f $outputdirrelative/lib/libomiidentify.$shlibext \$destdir/$providerdir/ ## ## Install omi.mak. ## echo "OMI_ROOT=/" > \$destdir/$datadir/omi.mak cat $outputdirrelative/omi.mak >> \$destdir/$datadir/omi.mak ## ## Install certificates. ## hostname=`$buildtool hostname $buildtoolopts` cnffile=$outputdirrelative/ssl.cnf keyfile=\$destdir/$certsdir/omikey.pem certfile=\$destdir/$certsdir/omi.pem if [ -f "\$keyfile" -a -f "\$certfile" ]; then echo echo "************************************************************" echo "* Warning: The certificate and keyfile were not generated *" echo "* since they already exist. *" echo "************************************************************" else openssl req -x509 -sha1 -newkey rsa:2048 -days 3650 -nodes -config \$cnffile -keyout \$keyfile -out \$certfile chmod 600 \$keyfile chmod 644 \$certfile fi ## ## Configure PAM. ## $outputdirrelative/installpam ## ## Install 'uninstall' script. ## cp $outputdirrelative/uninstall \$destdir/$bindir/omiuninstall chmod 755 \$destdir/$bindir/omiuninstall ## ## Print success message! ## echo "Successfully installed under under: \$destdir/$prefix" EOF chmod +x $fn echo "created $fn" ##============================================================================== ## ## Create 'uninstall' script. ## ##============================================================================== shlibext=`$buildtool shlibext $buildtoolopts` fn=$outputdir/uninstall cat > $fn < $fn < $fn rm -f $fn.tmp test -f $fn && chmod +x $fn && echo "created $fn" ##============================================================================== ## ## Put platform configuration message. ## ##============================================================================== echo "Configured for $platform"