version 1.4, 2015/04/20 18:10:09
|
version 1.5, 2015/04/20 18:19:49
|
|
|
| |
##============================================================================== | ##============================================================================== |
## | ## |
|
## 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, Version, and Bilddate information: |
## | ## |
##============================================================================== | ##============================================================================== |
| |
product="OMI" | product="OMI" |
fullproduct="Open Management Infrastructure" | fullproduct="Open Management Infrastructure" |
major=1 |
major=`cut -d. -f1 $root/VERSION` |
minor=0 |
minor=`cut -d. -f2 $root/VERSION` |
revision=2 |
revision=`cut -d. -f3 $root/VERSION` |
date=`date` |
|
version="$major.$minor.$revision" | version="$major.$minor.$revision" |
|
version_with_release="$major.$minor.$revision-1" |
|
date=`date` |
| |
##============================================================================== | ##============================================================================== |
## | ## |
|
|
enable_debug=1 | enable_debug=1 |
;; | ;; |
| |
|
--enable-httpheaders) |
|
enable_httpheaders=1 |
|
;; |
|
|
--disable-rtti) | --disable-rtti) |
disable_rtti=1 | disable_rtti=1 |
;; | ;; |
|
|
target=$arg | target=$arg |
;; | ;; |
| |
--toolchain=*) |
|
toolchain=$arg |
|
;; |
|
|
|
--prefix=*) | --prefix=*) |
prefix=$arg | prefix=$arg |
;; | ;; |
|
|
authdir=$arg | authdir=$arg |
;; | ;; |
| |
--builddir=*) |
--outputdirname=*) |
builddir=$arg |
outputdirname=$arg |
;; | ;; |
| |
--enable-werror) | --enable-werror) |
|
|
favorsize=1 | 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" | echo "$0: unknown option: $opt" |
exit 1 | exit 1 |
|
|
--enable-werror Treat warnings as errors. | --enable-werror Treat warnings as errors. |
--enable-wchar Use 'wchar_t' character type [char]. | --enable-wchar Use 'wchar_t' character type [char]. |
--target=TARGET Cross-compiler for the given platform. | --target=TARGET Cross-compiler for the given platform. |
--toolchain=PATH Cross-compiler toolchain path (contains 'lib' dir). |
|
--prefix=PATH The installation prefix [/opt/omi-$version] | --prefix=PATH The installation prefix [/opt/omi-$version] |
--libdir=PATH Install library components here [*/lib]. | --libdir=PATH Install library components here [*/lib]. |
--bindir=PATH Install programs here [*/bin]. | --bindir=PATH Install programs here [*/bin]. |
|
|
--certsdir=PATH Install SSL certificates here [*/etc/ssl/certs]. | --certsdir=PATH Install SSL certificates here [*/etc/ssl/certs]. |
--authdir=PATH Temporary authentication files here [*/var/omiauth]. | --authdir=PATH Temporary authentication files here [*/var/omiauth]. |
--namespace NAME Name of the default namespace [root/cimv2]. | --namespace NAME Name of the default namespace [root/cimv2]. |
--buildir=PATH Alternative location to place build output files. |
|
--httpport=PORT Server listens on this port for HTTP protocols. | --httpport=PORT Server listens on this port for HTTP protocols. |
--httpsport=PORT Server listens on this port for HTTPS protocols. | --httpsport=PORT Server listens on this port for HTTPS protocols. |
--disable-libpath Disable embedding of library search paths in | --disable-libpath Disable embedding of library search paths in |
|
|
--favorsize Enable the CONFIG_FAVORSIZE source code macro | --favorsize Enable the CONFIG_FAVORSIZE source code macro |
to compile alternative source code that yields | to compile alternative source code that yields |
smaller object code size. | smaller object code size. |
|
--singleimage Create single omiimage file; omiserver and omiagent |
|
are soft links to this file. This saves space on |
|
the disk or flash device of an embedded system. |
|
--dev Perform a development build in which the binaries |
|
are configured to work from the build directory |
|
rather than from the install directories. This |
|
also enable unit tests. |
|
--outputdirname The name of the output directory where the binary |
|
files are placed. This name must not contain |
|
slashes. |
|
--openssl=PATH Full path to the 'openssl' command. |
|
--opensslcflags=FLAGS Extra C flags needed for OpenSSL. |
|
(e.g., "-I/usr/local/include"). |
|
--openssllibs=FLAGS Extra library options needed for OpenSSL. |
|
(e.g., "-L/usr/local/lib -lssl -lcrypto"). |
|
--openssllibdir=PATH The path of the directory containing the desired |
|
OpenSSL libraries (ssl and crypto). |
|
--with-cc=PATH Use C compiler given by PATH. |
|
--with-cxx=PATH Use C++ compiler given by PATH. |
|
--with-ar=PATH Use archive command (ar) given by PATH. |
|
--enable-httpheaders Enable passing of HTTP headers to providers. |
|
--enable-32bit Perform a 32 bit on 64 bit system (GNU only). |
|
--disable-localsession Disable MI_Context_GetLocalSession function. |
|
--disable-indication Disable indication feature from omiserver. |
|
--enable-preexec Enable execution of 'pre-exec' programs. These |
|
programs are executed by the server (as root) |
|
before invoking the associated provider for the |
|
first time. |
|
--enable-sections Place functions and data in sections, allowing |
|
the linker to remove unused objects at link time. |
| |
EOF | EOF |
exit 0 | exit 0 |
|
|
| |
##============================================================================== | ##============================================================================== |
## | ## |
## The the platform, os, arch, and compiler. |
## buildtool |
## | ## |
##============================================================================== | ##============================================================================== |
| |
if [ "$CONFIG_TARGET" != "" ]; then |
buildtool="$root/buildtool" |
export CONFIG_TARGET=$target |
|
|
##============================================================================== |
|
## |
|
## --dev - perform a development build. |
|
## |
|
##============================================================================== |
|
|
|
hostname=`$buildtool hostname` |
|
|
|
if [ -z "$outputdirname" ]; then |
|
outputdirname=output |
fi | fi |
| |
if [ "$CONFIG_TOOLCHAIN" != "" ]; then |
outputdir=$configuredir/$outputdirname |
export CONFIG_TOOLCHAIN=$toolchain |
|
|
if [ "$dev" = "1" ]; then |
|
enable_werror=1 |
|
enable_debug=1 |
|
prefix=$configuredir |
|
libdir=$outputdir/lib |
|
bindir=$outputdir/bin |
|
localstatedir=$outputdir/var |
|
includedir=$outputdir/include |
|
sysconfdir=$root/etc |
fi | fi |
| |
platform=`./buildtool platform` |
##============================================================================== |
|
## |
|
## The platform, os, arch, and compiler. |
|
## |
|
##============================================================================== |
|
|
|
if [ "$target" != "" ]; then |
|
buildtoolopts="--target=$target" |
|
fi |
|
|
|
platform=`$buildtool platform $buildtoolopts` |
| |
if [ "$?" != "0" ]; then | if [ "$?" != "0" ]; then |
echo "$0: unknown platform: $platform" | echo "$0: unknown platform: $platform" |
exit 1 | exit 1 |
fi | fi |
| |
os=`./buildtool os` |
os=`$buildtool os $buildtoolopts` |
arch=`./buildtool arch` |
arch=`$buildtool arch $buildtoolopts` |
compiler=`./buildtool compiler` |
compiler=`$buildtool compiler $buildtoolopts` |
| |
##============================================================================== | ##============================================================================== |
## | ## |
|
|
## | ## |
##============================================================================== | ##============================================================================== |
| |
root=`pwd` |
|
|
|
if [ -z "$prefix" ]; then | if [ -z "$prefix" ]; then |
prefix=/opt/omi-$version | prefix=/opt/omi-$version |
fi | fi |
|
|
namespace=root/cimv2 | namespace=root/cimv2 |
fi | fi |
| |
hostname=`./buildtool hostname` |
if [ "$openssl" != "" ]; then |
|
|
|
if [ ! -x "$openssl" ]; then |
|
echo "$0: invalid option: --openssl=$openssl: no such program" |
|
exit 1 |
|
fi |
|
fi |
|
|
|
if [ -x "/bin/uuidgen" -o -x "/usr/bin/uuidgen" ]; then |
|
configuuid="`uuidgen`" |
|
else |
|
configuuid="`echo $USER`" |
|
fi |
|
|
|
if [ -z "$with_cc" ]; then |
|
with_cc=`$buildtool cc $buildtoolopts` |
|
else |
|
if [ ! -x "$with_cc" ]; then |
|
echo "$0: invalid option: --with-cc=$with_cc: no such program" |
|
exit 1 |
|
fi |
|
fi |
| |
outputdirbase=./output/$hostname |
if [ -z "$with_cxx" ]; then |
|
with_cxx=`$buildtool cxx $buildtoolopts` |
|
else |
|
if [ ! -x "$with_cxx" ]; then |
|
echo "$0: invalid option: --with-cxx=$with_cxx: no such program" |
|
exit 1 |
|
fi |
|
fi |
| |
outputdir=$root/output/$hostname |
if [ -z "$with_ar" ]; then |
|
with_ar=`$buildtool ar $buildtoolopts` |
|
else |
|
if [ ! -x "$with_ar" ]; then |
|
echo "$0: invalid option: --with-ar=$with_ar: no such program" |
|
exit 1 |
|
fi |
|
fi |
| |
tmpdir=$outputdir/tmp | tmpdir=$outputdir/tmp |
| |
|
|
##============================================================================== | ##============================================================================== |
| |
if [ -z "$httpport" ]; then | if [ -z "$httpport" ]; then |
httpport=7778 |
httpport=5985 |
else | else |
rc=`expr "(" "$httpport" ">=" 1 ")" "&" "(" "$httpport" "<=" 65535 ")"` | rc=`expr "(" "$httpport" ">=" 1 ")" "&" "(" "$httpport" "<=" 65535 ")"` |
| |
|
|
fi | fi |
| |
if [ -z "$httpsport" ]; then | if [ -z "$httpsport" ]; then |
httpsport=7779 |
httpsport=5986 |
else | else |
rc=`expr "(" "$httpsport" ">=" 1 ")" "&" "(" "$httpsport" "<=" 65535 ")"` | rc=`expr "(" "$httpsport" ">=" 1 ")" "&" "(" "$httpsport" "<=" 65535 ")"` |
| |
|
|
## | ## |
##============================================================================== | ##============================================================================== |
| |
if [ -z "$builddir" ]; then |
|
mkdir -p $outputdir | mkdir -p $outputdir |
else |
echo "created $outputdir" |
mkdir -p $builddir |
|
ln -s $builddir $outputdir |
|
fi |
|
| |
mkdir -p $outputdir/bin | mkdir -p $outputdir/bin |
mkdir -p $outputdir/lib | mkdir -p $outputdir/lib |
|
|
| |
##============================================================================== | ##============================================================================== |
## | ## |
## Attempt to find C compiler. |
## 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 <<EOF |
|
int main() |
|
{ |
|
return 123; |
|
} |
|
EOF |
|
|
|
( cd $tmpdir ; $cc $cprogflags $cflags -o cprogram 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 <<EOF |
|
#include <stdio.h> |
|
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 <<EOF |
|
#include <stdio.h> |
|
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 <<EOF |
|
int x = 2; |
|
# define PAL_PREFETCH(p) (__builtin_prefetch((const void*)p),*(p)) |
|
int main() |
|
{ |
|
PAL_PREFETCH(&x); |
|
return 0; |
|
} |
|
EOF |
|
|
|
( cd $tmpdir ; $cc $cprogflags $cflags -o builtin_prefetch_test 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 <<EOF |
|
#include<stdio.h> |
|
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 <<EOF |
|
#include <stdio.h> |
|
#include <wchar.h> |
|
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 <<EOF |
|
#include <stdio.h> |
|
#include <wchar.h> |
|
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 <<EOF |
|
#include <stdio.h> |
|
#include <wchar.h> |
|
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 <<EOF |
|
#include <stdio.h> |
|
#include <stdarg.h> |
|
#include <wchar.h> |
|
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 <<EOF |
|
#include <stdio.h> |
|
#include <stdarg.h> |
|
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 <<EOF |
|
#include <execinfo.h> |
|
#include <stdio.h> |
|
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 whether C compiler is on the path... $echoc" |
echo $echon "checking for __sync_synchronize... $echoc" |
| |
cc=`./buildtool cc` |
rm -f $tmpdir/sync_synchronize_test |
| |
if [ "$cc" = "" ]; then |
cat > $tmpdir/sync_synchronize_test.c <<EOF |
echo "$0: failed" |
int main() |
exit 1 |
{ |
fi |
__sync_synchronize(); |
|
return 0; |
|
} |
|
EOF |
| |
tmp1=`echo $cc | awk '{ print $1; }'` |
( cd $tmpdir ; $cc $cprogflags $cflags -o sync_synchronize_test sync_synchronize_test.c > /dev/null 2> /dev/null ) |
tmp2=`which $tmp1` |
|
| |
if [ -x "$tmp2" ]; then |
if [ "$?" = "0" ]; then |
|
have_sync_synchronize=1 |
echo "yes" | echo "yes" |
else | else |
|
have_sync_synchronize=0 |
echo "no" | echo "no" |
exit 1 |
|
fi | fi |
| |
|
rm -f $tmpdir/sync_synchronize_test.c |
|
rm -f $tmpdir/sync_synchronize_test |
|
|
##============================================================================== | ##============================================================================== |
## | ## |
## Attempt to compile and execute a simple C program |
## Check whether Atomic Intrinsic Functions are supported. |
## | ## |
##============================================================================== | ##============================================================================== |
| |
echo $echon "checking whether C compiler compiles... $echoc" |
echo $echon "checking for Atomic Intrinsic Functions... $echoc" |
rm -f $tmpdir/cprogram |
|
|
rm -f $tmpdir/atomic_intrinsic |
|
|
|
cat > $tmpdir/atomic_intrinsic.c <<EOF |
|
#include <stdio.h> |
| |
cat > $tmpdir/cprogram.c <<EOF |
|
int main() | int main() |
{ | { |
return 123; |
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 | EOF |
| |
( cd $tmpdir ; $cc -o cprogram cprogram.c > /dev/null 2> /dev/null ) |
( cd $tmpdir ; $cc $cprogflags $cflags -o atomic_intrinsic atomic_intrinsic.c > /dev/null 2> /dev/null ) |
| |
if [ "$?" = "0" ]; then | if [ "$?" = "0" ]; then |
|
have_atomic_intrinsics=1 |
echo "yes" | echo "yes" |
else | else |
|
have_atomic_intrinsics=0 |
echo "no" | echo "no" |
exit 1 |
|
fi | fi |
| |
if [ -z "$CONFIG_TARGET" ]; then |
rm -f $tmpdir/atomic_intrinsic.c |
|
rm -f $tmpdir/atomic_intrinsic |
| |
echo $echon "checking whether C program executes... $echoc" |
if [ "$disable_atomics" = "1" ]; then |
|
have_atomic_intrinsics=0 |
|
fi |
| |
$tmpdir/cprogram |
##============================================================================== |
|
## |
|
## Check whether sem_timedwait is supported. |
|
## |
|
##============================================================================== |
| |
if [ "$?" = "123" ]; then |
echo $echon "checking for sem_timedwait... $echoc" |
|
|
|
rm -f $tmpdir/sem_timedwait_func |
|
|
|
cat > $tmpdir/sem_timedwait_func.c <<EOF |
|
# include <semaphore.h> |
|
# include <time.h> |
|
|
|
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" | echo "yes" |
else | else |
|
have_sem_timedwait_func=0 |
echo "no" | echo "no" |
exit 1 |
|
fi | 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 <<EOF |
|
#include <errno.h> |
|
#include <string.h> |
|
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 | fi |
| |
rm $tmpdir/cprogram.c |
rm -f $tmpdir/strerror_r.c |
rm $tmpdir/cprogram |
rm -f $tmpdir/strerror_r |
| |
##============================================================================== | ##============================================================================== |
## | ## |
## Check whether __FUNCTION__ macro is supported. |
## Check whether pthread_rwlock_t is supported. |
## | ## |
##============================================================================== | ##============================================================================== |
| |
echo $echon "checking for __FUNCTION__ macro... $echoc" |
echo $echon "checking for pthread_rwlock_t... $echoc" |
|
|
rm -f $tmpdir/function |
|
| |
cat > $tmpdir/function.c <<EOF |
rm -f $tmpdir/pthread_rwlock_t_func |
#include <stdio.h> |
|
| |
|
cat > $tmpdir/pthread_rwlock_t_func.c <<EOF |
|
#include <pthread.h> |
int main() | int main() |
{ | { |
printf("%s\n", __FUNCTION__); |
pthread_rwlock_t lock = PTHREAD_RWLOCK_INITIALIZER; |
|
(void)lock; |
return 0; | return 0; |
} | } |
EOF | EOF |
| |
( cd $tmpdir ; $cc -o function function.c > /dev/null 2> /dev/null ) |
( cd $tmpdir ; $cc $cprogflags $cflags -o pthread_rwlock_t_func pthread_rwlock_t_func.c > /dev/null 2> /dev/null ) |
| |
if [ "$?" = "0" ]; then | if [ "$?" = "0" ]; then |
have_function_macro=1 |
|
echo "yes" | echo "yes" |
else | else |
have_function_macro=0 |
|
echo "no" | echo "no" |
|
exit 1 |
fi | fi |
| |
rm -f $tmpdir/function.c |
rm -f $tmpdir/pthread_rwlock_t_func.c |
rm -f $tmpdir/function |
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 |
| |
##============================================================================== | ##============================================================================== |
## | ## |
## Check for 'openssl' command. |
## Resolve OpenSSL options: |
## | ## |
##============================================================================== | ##============================================================================== |
| |
|
if [ -z "$openssl" ]; then |
|
|
echo $echon "checking whether openssl command is on the path... $echoc" | echo $echon "checking whether openssl command is on the path... $echoc" |
| |
openssl=`which openssl` | openssl=`which openssl` |
|
|
exit 1 | exit 1 |
fi | 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. | ## Check for 'pkg-config' command. |
## | ## |
##============================================================================== | ##============================================================================== |
| |
echo $echon "checking whether pkg-config command is on the path... $echoc" |
echo $echon "checking whether fault injection is supported... $echoc" |
| |
pkgconfig=`which pkg-config` |
faultinjection=`$buildtool faultinjection` |
| |
if [ -x "$pkgconfig" ]; then |
if [ "$faultinjection" = "1" ]; then |
echo "yes" | 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 | else |
echo "no" | echo "no" |
exit 1 |
|
fi | fi |
| |
##============================================================================== | ##============================================================================== |
## | ## |
|
## Grap the timestamp: |
|
## |
|
##============================================================================== |
|
|
|
timestamp=`cat $root/TIMESTAMP` |
|
|
|
##============================================================================== |
|
## |
## Create config.mak file | ## Create config.mak file |
## | ## |
##============================================================================== | ##============================================================================== |
|
|
cat > $fn <<EOF | cat > $fn <<EOF |
# CAUTION: This file was generated by 'configure' script. | # CAUTION: This file was generated by 'configure' script. |
| |
|
BUILDTOOL=$buildtool |
|
BUILDTOOLOPTS=$buildtoolopts |
|
|
CONFIG_PRODUCT=$product | CONFIG_PRODUCT=$product |
CONFIG_FULLPRODUCT=$fullproduct | CONFIG_FULLPRODUCT=$fullproduct |
CONFIG_VERSION=$version | CONFIG_VERSION=$version |
|
|
OS=$os | OS=$os |
ARCH=$arch | ARCH=$arch |
COMPILER=$compiler | COMPILER=$compiler |
ROOT=$root |
|
| |
|
ROOT=$root |
|
SRCDIR=$root |
OUTPUTDIR=$outputdir | OUTPUTDIR=$outputdir |
SRCDIR=$root/source |
OUTPUTDIRNAME=$outputdirname |
LIBDIR=$outputdir/lib | LIBDIR=$outputdir/lib |
BINDIR=$outputdir/bin | BINDIR=$outputdir/bin |
OBJDIR=$outputdir/obj | OBJDIR=$outputdir/obj |
INCDIR=$outputdir/include | INCDIR=$outputdir/include |
TMPDIR=$tmpdir | TMPDIR=$tmpdir |
OPENSSL=$openssl |
|
PKGCONFIG=$pkgconfig | PKGCONFIG=$pkgconfig |
|
CONFIGUREDIR=$configuredir |
| |
|
CONFIG_SRCDIR=$root |
CONFIG_TARGET=$target | CONFIG_TARGET=$target |
CONFIG_TOOLCHAIN=$toolchain |
|
|
OPENSSL=$openssl |
|
OPENSSLCFLAGS=$opensslcflags |
|
OPENSSLLIBS=$openssllibs |
|
OPENSSLLIBDIR=$openssllibdir |
|
|
|
WITH_CC=$with_cc |
|
WITH_CXX=$with_cxx |
|
WITH_AR=$with_ar |
|
|
CONFIG_PREFIX=$prefix | CONFIG_PREFIX=$prefix |
CONFIG_BINDIR=$bindir | CONFIG_BINDIR=$bindir |
CONFIG_LIBDIR=$libdir | CONFIG_LIBDIR=$libdir |
|
|
ENABLE_GCOV=$enable_gcov | ENABLE_GCOV=$enable_gcov |
ENABLE_WERROR=$enable_werror | ENABLE_WERROR=$enable_werror |
ENABLE_WCHAR=$enable_wchar | ENABLE_WCHAR=$enable_wchar |
|
ENABLE_32BIT=$enable_32bit |
DISABLE_RTTI=$disable_rtti | DISABLE_RTTI=$disable_rtti |
DISABLE_LIBPATH=$disable_libpath | DISABLE_LIBPATH=$disable_libpath |
DISABLE_TEMPLATES=$disable_templates | DISABLE_TEMPLATES=$disable_templates |
|
DISABLE_LOCALSESSION=$disable_localsession |
|
DISABLE_INDICATION=$disable_indication |
CONFIG_CIMSCHEMA=$cimschema | CONFIG_CIMSCHEMA=$cimschema |
CONFIG_FAVORSIZE=$favorsize | CONFIG_FAVORSIZE=$favorsize |
|
CONFIG_SINGLEIMAGE=$singleimage |
|
CONFIG_TIMESTAMP=$timestamp |
|
ENABLE_HTTPHEADERS=$enable_httpheaders |
|
ENABLE_PREEXEC=$enable_preexec |
|
ENABLE_SECTIONS=$enable_sections |
|
ENABLE_FAULTINJECTION=$enable_faultinjection |
EOF | EOF |
| |
echo "created $fn" | echo "created $fn" |
| |
|
|
|
##============================================================================== |
|
## |
|
## Create nitsargs.txt file for unit test |
|
## |
|
##============================================================================== |
|
|
|
shlibext=`$buildtool shlibext $buildtoolopts` |
|
fnnitsargs=$tmpdir/nitsargs.txt |
|
|
|
rm -f $fnnitsargs |
|
|
|
if [ "$enable_faultinjection" = "1" ]; then |
|
echo "-install" >> $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 | ## Create config.h file |
|
|
| |
#define CONFIG_PRODUCT "$product" | #define CONFIG_PRODUCT "$product" |
#define CONFIG_FULLPRODUCT "$fullproduct" | #define CONFIG_FULLPRODUCT "$fullproduct" |
#define CONFIG_VERSION "$version" |
#define CONFIG_VERSION "$version_with_release" |
#define CONFIG_MAJOR $major | #define CONFIG_MAJOR $major |
#define CONFIG_MINOR $minor | #define CONFIG_MINOR $minor |
#define CONFIG_REVISION $revision | #define CONFIG_REVISION $revision |
|
|
#define CONFIG_COMPILER_$compiler | #define CONFIG_COMPILER_$compiler |
#define CONFIG_POSIX | #define CONFIG_POSIX |
#define CONFIG_TARGET "$target" | #define CONFIG_TARGET "$target" |
#define CONFIG_TOOLCHAIN "$toolchain" |
#define CONFIG_SRCDIR "$root" |
#define CONFIG_PREFIX "$prefix" | #define CONFIG_PREFIX "$prefix" |
#define CONFIG_LIBDIR "$libdir" | #define CONFIG_LIBDIR "$libdir" |
#define CONFIG_INCLUDEDIR "$includedir" | #define CONFIG_INCLUDEDIR "$includedir" |
|
|
#define CONFIG_HTTPSPORT $httpsport | #define CONFIG_HTTPSPORT $httpsport |
#define CONFIG_TMPDIR "$tmpdir" | #define CONFIG_TMPDIR "$tmpdir" |
#define CONFIG_CIMSCHEMA "$cimschema" | #define CONFIG_CIMSCHEMA "$cimschema" |
|
#define CONFIG_UUID "$configuuid" |
EOF | EOF |
| |
if [ "$enable_debug" = "1" ]; then | if [ "$enable_debug" = "1" ]; then |
|
|
echo "/* #define CONFIG_FAVORSIZE */" >> $fn | echo "/* #define CONFIG_FAVORSIZE */" >> $fn |
fi | 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 | if [ "$have_function_macro" = "1" ]; then |
echo "#define CONFIG_HAVE_FUNCTION_MACRO" >> $fn | echo "#define CONFIG_HAVE_FUNCTION_MACRO" >> $fn |
else | else |
echo "/* #define CONFIG_HAVE_FUNCTION_MACRO */" >> $fn | echo "/* #define CONFIG_HAVE_FUNCTION_MACRO */" >> $fn |
fi | fi |
| |
echo "#define CONFIG_SHLIBEXT \"`./buildtool shlibext`\"" >> $fn |
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 "" >> $fn |
echo "#endif /* _config_h */" >> $fn | echo "#endif /* _config_h */" >> $fn |
|
|
## | ## |
##============================================================================== | ##============================================================================== |
| |
rm -rf $outputdir/include/MI.h |
fn=$outputdir/include/MI.h |
ln -f -s $root/common/MI.h $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 | rm -rf $outputdir/include/micxx |
ln -f -s $root/micxx $outputdir/include/micxx | ln -f -s $root/micxx $outputdir/include/micxx |
|
|
OBJECTS = \$(__OBJECTS:.cpp=.o) | OBJECTS = \$(__OBJECTS:.cpp=.o) |
INCLUDES += -I\$(INCLUDEDIR) | INCLUDES += -I\$(INCLUDEDIR) |
| |
CC=`./buildtool cc` |
CC=$with_cc |
CXX=`./buildtool cxx` |
CXX=$with_cxx |
| |
ifndef DEBUG | ifndef DEBUG |
CFLAGS=`./buildtool cflags --debug --pic` |
CFLAGS=`$buildtool cflags --debug --pic $buildtoolopts` |
CXXFLAGS=`./buildtool cxxflags --debug --pic` |
CXXFLAGS=`$buildtool cxxflags --debug --pic $buildtoolopts` |
else | else |
CFLAGS=`./buildtool cflags --optim --pic` |
CFLAGS=`$buildtool cflags --optim --pic $buildtoolopts` |
CXXFLAGS=`./buildtool cxxflags --optim --pic` |
CXXFLAGS=`$buildtool cxxflags --optim --pic $buildtoolopts` |
endif | endif |
| |
CSHLIBFLAGS=`./buildtool cshlibflags --libpath=$libdir` |
CSHLIBFLAGS=`$buildtool cshlibflags --libpath=$libdir $buildtoolopts` |
CXXSHLIBFLAGS=`./buildtool cxxshlibflags --libpath=$libdir` |
CXXSHLIBFLAGS=`$buildtool cxxshlibflags --libpath=$libdir $buildtoolopts` |
LIBRARY = lib\$(PROVIDER).`./buildtool shlibext` |
LIBRARY = lib\$(PROVIDER).`$buildtool shlibext $buildtoolopts` |
| |
EOF | EOF |
| |
|
|
##============================================================================== | ##============================================================================== |
| |
fn=$outputdir/ssl.cnf | fn=$outputdir/ssl.cnf |
longhostname=`./buildtool longhostname` |
longhostname=`$buildtool longhostname $buildtoolopts` |
| |
cat > $fn <<EOF | cat > $fn <<EOF |
[ req ] | [ req ] |
|
|
## | ## |
##============================================================================== | ##============================================================================== |
| |
shlibext=`./buildtool shlibext` |
shlibext=`$buildtool shlibext $buildtoolopts` |
ldlibrarypath=`./buildtool ldlibrarypath` |
ldlibrarypath=`$buildtool ldlibrarypath $buildtoolopts` |
fn=$outputdir/install | fn=$outputdir/install |
|
outputdirrelative=./$outputdirname |
| |
cat > $fn <<EOF | cat > $fn <<EOF |
#!/bin/sh | #!/bin/sh |
|
|
## Attempt to resolve OpenSSL libdir. | ## Attempt to resolve OpenSSL libdir. |
## | ## |
| |
openssllibdir=\`./buildtool openssllibdir\` |
openssllibdir=\`$buildtool openssllibdir $buildtoolopts\` |
| |
if [ -n "\$openssllibdir" ]; then | if [ -n "\$openssllibdir" ]; then |
$ldlibrarypath=\$openssllibdir | $ldlibrarypath=\$openssllibdir |
|
|
mkdir -p \$destdir/$datadir/omischema | mkdir -p \$destdir/$datadir/omischema |
mkdir -p \$destdir/$sysconfdir/omiregister | mkdir -p \$destdir/$sysconfdir/omiregister |
mkdir -p \$destdir/$sysconfdir/omiregister/interop | mkdir -p \$destdir/$sysconfdir/omiregister/interop |
mkdir -p "\$destdir/$sysconfdir/omiregister/root#cimv2" |
mkdir -p "\$destdir/$sysconfdir/omiregister/root-cimv2" |
mkdir -p "\$destdir/$sysconfdir/omiregister/root#omi" |
mkdir -p "\$destdir/$sysconfdir/omiregister/root-omi" |
mkdir -p "\$destdir/$sysconfdir/omiregister/root#check" |
mkdir -p "\$destdir/$sysconfdir/omiregister/root-check" |
mkdir -p \$destdir/$sysconfdir/omiregister/$namespacedir | mkdir -p \$destdir/$sysconfdir/omiregister/$namespacedir |
| |
## | ## |
## Install executables. | ## Install executables. |
## | ## |
| |
cp -f $outputdirbase/bin/omiserver \$destdir/$bindir/omiserver.bin |
if test -f "$outputdirrelative/bin/omiimage"; then |
cp -f $outputdirbase/bin/omicli \$destdir/$bindir/omicli.bin |
cp -f $outputdirrelative/bin/omiimage \$destdir/$bindir/omiimage |
cp -f $outputdirbase/bin/omigen \$destdir/$bindir/omigen.bin |
rm -r \$destdir/bin/omiserver |
cp -f $outputdirbase/bin/omireg \$destdir/$bindir/omireg.bin |
ln -s \$destdir/$bindir/omiimage \$destdir/$bindir/omiserver |
cp -f $outputdirbase/bin/omicheck \$destdir/$bindir/omicheck.bin |
rm -r \$destdir/bin/omiagent |
cp -f $outputdirbase/bin/omiagent \$destdir/$bindir/omiagent |
ln -s \$destdir/$bindir/omiimage \$destdir/$bindir/omiagent |
|
else |
rm -f \$destdir/$bindir/omicli |
cp -f $outputdirrelative/bin/omiserver \$destdir/$bindir/omiserver |
rm -f \$destdir/$bindir/omigen |
cp -f $outputdirrelative/bin/omiagent \$destdir/$bindir/omiagent |
rm -f \$destdir/$bindir/omireg |
fi |
rm -f \$destdir/$bindir/omiserver |
|
rm -f \$destdir/$bindir/omicheck |
|
|
|
cat > \$destdir/$bindir/omiserver <<OMISERVEREND |
|
#!/bin/sh |
|
prog=\\\`basename \\\$0\\\` |
|
$ldlibrarypath=$libdir:\$openssllibdir |
|
export $ldlibrarypath |
|
$bindir/\\\$prog.bin \\\$@ |
|
OMISERVEREND |
|
|
|
chmod 755 \$destdir/$bindir/omiserver |
|
| |
cp \$destdir/$bindir/omiserver \$destdir/$bindir/omicli |
cp -f $outputdirrelative/bin/omicli \$destdir/$bindir/omicli |
cp \$destdir/$bindir/omiserver \$destdir/$bindir/omigen |
cp -f $outputdirrelative/bin/omigen \$destdir/$bindir/omigen |
cp \$destdir/$bindir/omiserver \$destdir/$bindir/omireg |
cp -f $outputdirrelative/bin/omireg \$destdir/$bindir/omireg |
cp \$destdir/$bindir/omiserver \$destdir/$bindir/omicheck |
cp -f $outputdirrelative/bin/omicheck \$destdir/$bindir/omicheck |
| |
## | ## |
## Install libraries. | ## Install libraries. |
## | ## |
| |
cp -f $outputdirbase/lib/libmicxx.$shlibext \$destdir/$libdir/ |
cp -f $outputdirrelative/lib/libmicxx.$shlibext \$destdir/$libdir/ |
cp -f $outputdirbase/lib/libomiclient.$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 "$outputdirbase/lib/libbase.$shlibext" |
if test -f "$outputdirrelative/lib/libpal.$shlibext" |
then | then |
cp -f $outputdirbase/lib/libbase.$shlibext \$destdir/$libdir/ |
cp -f $outputdirrelative/lib/libpal.$shlibext \$destdir/$libdir/ |
fi | fi |
| |
|
|
## | ## |
## Install configuration files. | ## Install configuration files. |
## | ## |
| |
if test ! -f "\$destdir/$sysconfdir/omiserver.conf" | if test ! -f "\$destdir/$sysconfdir/omiserver.conf" |
then | then |
cp ./etc/omiserver.conf \$destdir/$sysconfdir/omiserver.conf |
cp $rootrelative/etc/omiserver.conf \$destdir/$sysconfdir/omiserver.conf |
fi | fi |
| |
if test ! -f "\$destdir/$sysconfdir/omicli.conf" | if test ! -f "\$destdir/$sysconfdir/omicli.conf" |
then | then |
cp ./etc/omicli.conf \$destdir/$sysconfdir/omicli.conf |
cp $rootrelative/etc/omicli.conf \$destdir/$sysconfdir/omicli.conf |
fi | fi |
| |
if test ! -f "\$destdir/$sysconfdir/omigen.conf" | if test ! -f "\$destdir/$sysconfdir/omigen.conf" |
then | then |
cp ./etc/omigen.conf \$destdir/$sysconfdir/omigen.conf |
cp $rootrelative/etc/omigen.conf \$destdir/$sysconfdir/omigen.conf |
fi | fi |
| |
## | ## |
## Install header files. | ## Install header files. |
## | ## |
| |
cp -f ./common/MI.h \$destdir/$includedir/ |
cp -f $outputdirrelative/include/MI.h \$destdir/$includedir/ |
cp -f ./micxx/array.h \$destdir/$includedir/micxx/ |
cp -f $rootrelative/micxx/array.h \$destdir/$includedir/micxx/ |
cp -f ./micxx/context.h \$destdir/$includedir/micxx/ |
cp -f $rootrelative/micxx/context.h \$destdir/$includedir/micxx/ |
cp -f ./micxx/field.h \$destdir/$includedir/micxx/ |
cp -f $rootrelative/micxx/field.h \$destdir/$includedir/micxx/ |
cp -f ./micxx/micxx.h \$destdir/$includedir/micxx/ |
cp -f $rootrelative/micxx/micxx.h \$destdir/$includedir/micxx/ |
cp -f ./micxx/types.h \$destdir/$includedir/micxx/ |
cp -f $rootrelative/micxx/types.h \$destdir/$includedir/micxx/ |
cp -f ./micxx/arraytraits.h \$destdir/$includedir/micxx/ |
cp -f $rootrelative/micxx/arraytraits.h \$destdir/$includedir/micxx/ |
cp -f ./micxx/datetime.h \$destdir/$includedir/micxx/ |
cp -f $rootrelative/micxx/datetime.h \$destdir/$includedir/micxx/ |
cp -f ./micxx/instance.h \$destdir/$includedir/micxx/ |
cp -f $rootrelative/micxx/instance.h \$destdir/$includedir/micxx/ |
cp -f ./micxx/propertyset.h \$destdir/$includedir/micxx/ |
cp -f $rootrelative/micxx/propertyset.h \$destdir/$includedir/micxx/ |
cp -f ./micxx/atomic.h \$destdir/$includedir/micxx/ |
cp -f $rootrelative/micxx/atomic.h \$destdir/$includedir/micxx/ |
cp -f ./micxx/dinstance.h \$destdir/$includedir/micxx/ |
cp -f $rootrelative/micxx/dinstance.h \$destdir/$includedir/micxx/ |
cp -f ./micxx/linkage.h \$destdir/$includedir/micxx/ |
cp -f $rootrelative/micxx/linkage.h \$destdir/$includedir/micxx/ |
cp -f ./micxx/string.h \$destdir/$includedir/micxx/ |
cp -f $rootrelative/micxx/micxx_string.h \$destdir/$includedir/micxx/ |
cp -f ./omiclient/linkage.h \$destdir/$includedir/omiclient/ |
cp -f $rootrelative/micxx/atomic.h \$destdir/$includedir/micxx/ |
cp -f ./omiclient/client.h \$destdir/$includedir/omiclient/ |
cp -f $rootrelative/omiclient/linkage.h \$destdir/$includedir/omiclient/ |
cp -f ./omiclient/handler.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). | ## Install schema files (MOF files). |
## | ## |
| |
cp -f ./share/omischema/CIM_Schema.mof \$destdir/$datadir/omischema/ |
cp -f $rootrelative/share/omischema/CIM_Schema.mof \$destdir/$datadir/omischema/ |
rm -rf \$destdir/$datadir/omischema/$cimschema | rm -rf \$destdir/$datadir/omischema/$cimschema |
cp -r ./share/omischema/$cimschema \$destdir/$datadir/omischema/ |
cp -r $rootrelative/share/omischema/$cimschema \$destdir/$datadir/omischema/ |
| |
## | ## |
## Install providers. | ## Install providers. |
## | ## |
| |
cp -f "./etc/omiregister/root#omi/omiidentify.reg" "\$destdir/$sysconfdir/omiregister/root#omi" |
cp -f "$rootrelative/etc/omiregister/root-omi/omiidentify.reg" "\$destdir/$sysconfdir/omiregister/root-omi" |
cp -f "./etc/omiregister/root#check/omiidentify.reg" "\$destdir/$sysconfdir/omiregister/root#check" |
cp -f "$rootrelative/etc/omiregister/root-check/omiidentify.reg" "\$destdir/$sysconfdir/omiregister/root-check" |
cp -f $outputdirbase/lib/libomiidentify.$shlibext \$destdir/$providerdir/ |
cp -f $outputdirrelative/lib/libomiidentify.$shlibext \$destdir/$providerdir/ |
| |
## | ## |
## Install omi.mak. | ## Install omi.mak. |
## | ## |
| |
echo "OMI_ROOT=/" > \$destdir/$datadir/omi.mak | echo "OMI_ROOT=/" > \$destdir/$datadir/omi.mak |
cat $outputdirbase/omi.mak >> \$destdir/$datadir/omi.mak |
cat $outputdirrelative/omi.mak >> \$destdir/$datadir/omi.mak |
| |
## | ## |
## Install certificates. | ## Install certificates. |
## | ## |
| |
hostname=`./buildtool hostname` |
hostname=`$buildtool hostname $buildtoolopts` |
cnffile=./output/$hostname/ssl.cnf |
cnffile=$outputdirrelative/ssl.cnf |
keyfile=\$destdir/$certsdir/omikey.pem | keyfile=\$destdir/$certsdir/omikey.pem |
certfile=\$destdir/$certsdir/omi.pem | certfile=\$destdir/$certsdir/omi.pem |
| |
|
|
## Configure PAM. | ## Configure PAM. |
## | ## |
| |
$outputdirbase/installpam |
$outputdirrelative/installpam |
| |
## | ## |
## Install 'uninstall' script. | ## Install 'uninstall' script. |
## | ## |
| |
cp $outputdirbase/uninstall \$destdir/$bindir/omiuninstall |
cp $outputdirrelative/uninstall \$destdir/$bindir/omiuninstall |
chmod 755 \$destdir/$bindir/omiuninstall | chmod 755 \$destdir/$bindir/omiuninstall |
| |
## | ## |
|
|
## | ## |
##============================================================================== | ##============================================================================== |
| |
shlibext=`./buildtool shlibext` |
shlibext=`$buildtool shlibext $buildtoolopts` |
fn=$outputdir/uninstall | fn=$outputdir/uninstall |
| |
cat > $fn <<EOF | cat > $fn <<EOF |
|
|
## | ## |
##============================================================================== | ##============================================================================== |
| |
rm -rf $prefix/bin/omiserver |
rm -rf $bindir/omiimage |
rm -rf $prefix/bin/omiserver.bin |
rm -rf $bindir/omiserver |
rm -rf $prefix/bin/omiagent |
rm -rf $bindir/omiagent |
rm -rf $prefix/bin/omicli |
rm -rf $bindir/omiagent |
rm -rf $prefix/bin/omicli.bin |
rm -rf $bindir/omicli |
rm -rf $prefix/bin/omigen |
rm -rf $bindir/omigen |
rm -rf $prefix/bin/omigen.bin |
rm -rf $bindir/omireg |
rm -rf $prefix/bin/omireg |
rm -rf $bindir/omicheck |
rm -rf $prefix/bin/omireg.bin |
rm -rf $libdir/libmicxx.$shlibext |
rm -rf $prefix/bin/omicheck |
rm -rf $libdir/libomiclient.$shlibext |
rm -rf $prefix/bin/omicheck.bin |
rm -rf $libdir/libomiidentify.$shlibext |
rm -rf $prefix/lib/libmicxx.$shlibext |
rm -rf $localstatedir/log/omiserver.log |
rm -rf $prefix/lib/libomiclient.$shlibext |
rm -rf $localstatedir/log/omiserver-send.trc |
rm -rf $prefix/lib/libomiidentify.$shlibext |
rm -rf $localstatedir/log/omiserver-recv.trc |
rm -rf $prefix/var/log/omiserver.log |
rm -rf $localstatedir/log/omiagent.*.*.log |
rm -rf $prefix/var/log/omiagent.*.*.log |
rm -rf $localstatedir/run/omiserver.pid |
rm -rf $prefix/var/run/omiserver.pid |
rm -rf $localstatedir/run/omiserver.sock |
rm -rf $prefix/var/run/omiserver.sock |
rm -rf $localstatedir/omiauth |
rm -rf $prefix/var/omiauth |
rm -rf $sysconfdir/omiregister |
rm -rf $prefix/etc/omiregister |
rm -rf $includedir/micxx |
rm -rf $prefix/include/micxx |
rm -rf $includedir/omiclient |
rm -rf $prefix/include/omiclient |
rm -rf $includedir/MI.h |
rm -rf $prefix/include/MI.h |
rm -rf $datadir/omischema |
rm -rf $prefix/share/omischema |
rm -rf $datadir/omi.mak |
rm -rf $prefix/share/omi.mak |
rm -rf $bindir/omiuninstall |
|
|
|
EOF |
|
|
|
chmod +x $fn |
|
echo "created $fn" |
|
|
|
##============================================================================== |
|
## |
|
## Create GNUmakefile |
|
## |
|
##============================================================================== |
|
|
|
fn=$configuredir/GNUmakefile |
| |
|
cat > $fn <<EOF |
|
.PHONY: check |
|
.PHONY: tests |
|
|
|
__ROOT=$root |
|
export OUTPUTDIR=$outputdir |
|
export SYSCONFDIR=$sysconfdir |
|
export DATADIR=$datadir |
|
export ROOT=$root |
|
|
|
all: |
|
@echo '========================= Performing Building OMI' |
|
( cd \$(__ROOT); \$(MAKE) -f build.mak ) |
|
|
|
tests: |
|
@echo '========================= Performing OMI unit tests' |
|
( cd \$(__ROOT); \$(MAKE) -f build.mak tests ) |
|
|
|
check: |
|
@echo '========================= Performing OMI check' |
|
( cd \$(__ROOT); \$(MAKE) -f build.mak check ) |
|
|
|
%: |
|
( cd \$(__ROOT); \$(MAKE) -f build.mak \$(MAKECMDGOALS) ) |
EOF | EOF |
| |
chmod +x $fn | chmod +x $fn |
|
|
| |
os=`uname -s` | os=`uname -s` |
fn=$outputdir/installpam | fn=$outputdir/installpam |
|
rm -f $fn.tmp |
rm -f $fn | rm -f $fn |
| |
case $os in | case $os in |
Linux) | Linux) |
if [ -f /etc/S[uU]SE-release ]; then | if [ -f /etc/S[uU]SE-release ]; then |
cp ./scripts/installpam-sles $fn |
cp $root/scripts/installpam-sles $fn.tmp |
else | else |
cp ./scripts/installpam-rhel $fn |
cp $root/scripts/installpam-rhel $fn.tmp |
fi | fi |
;; | ;; |
HP-UX) |
HP-UX | HPUX) |
cp ./scripts/installpam-hp $fn |
cp $root/scripts/installpam-hp $fn.tmp |
;; | ;; |
AIX) | AIX) |
cp ./scripts/installpam-aix $fn |
cp $root/scripts/installpam-aix $fn.tmp |
;; | ;; |
SunOS) | SunOS) |
VERSION=`uname -r | sed 's/[0-9]\.//'` | VERSION=`uname -r | sed 's/[0-9]\.//'` |
if [ "$VERSION" = "10" ]; then | if [ "$VERSION" = "10" ]; then |
cp ./scripts/installpam-sun10 $fn |
cp $root/scripts/installpam-sun10 $fn.tmp |
else | else |
cp ./scripts/installpam-sun9 $fn |
cp $root/scripts/installpam-sun9 $fn.tmp |
fi | fi |
;; | ;; |
Darwin) | Darwin) |
echo "pam script is not supported on Mac-OS yet" | echo "pam script is not supported on Mac-OS yet" |
touch $fn |
touch $fn.tmp |
;; | ;; |
*) | *) |
echo "Unknown" | echo "Unknown" |
|
|
;; | ;; |
esac | esac |
| |
test -f $fn && chmod +x $fn && echo "pam-script configured" |
sed "s~__BUILDTOOL__~$rootrelative/buildtool~g" $fn.tmp > $fn |
|
rm -f $fn.tmp |
|
|
|
test -f $fn && chmod +x $fn && echo "created $fn" |
| |
##============================================================================== | ##============================================================================== |
## | ## |