summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRadek Novacek <rnovacek@redhat.com>2012-07-25 15:12:42 +0200
committerRadek Novacek <rnovacek@redhat.com>2012-07-25 15:12:42 +0200
commitfef70e4d67b3db1bd1d70ca419f253fb0786e20d (patch)
treec5027e1f5f959a483f9a5e9016f2b12098b6d71d
parentd9d3ba6e636c9d0253d863f7121c94177b5b1265 (diff)
downloadopenlmi-providers-fef70e4d67b3db1bd1d70ca419f253fb0786e20d.tar.gz
openlmi-providers-fef70e4d67b3db1bd1d70ca419f253fb0786e20d.tar.xz
openlmi-providers-fef70e4d67b3db1bd1d70ca419f253fb0786e20d.zip
service: Finish converting service provider to CMake
-rw-r--r--src/service/CMakeLists.txt18
-rw-r--r--src/service/Makefile.am38
-rw-r--r--src/service/acinclude.m4407
-rwxr-xr-xsrc/service/autoconfiscate.sh39
-rw-r--r--src/service/configure.ac74
5 files changed, 16 insertions, 560 deletions
diff --git a/src/service/CMakeLists.txt b/src/service/CMakeLists.txt
index 9d5ef6f..e2a41ca 100644
--- a/src/service/CMakeLists.txt
+++ b/src/service/CMakeLists.txt
@@ -1,16 +1,30 @@
set(PROVIDER_NAME Service)
set(LIBRARY_NAME cmpi${PROVIDER_NAME})
+set(MOF Linux_Service.mof)
set(provider_SRCS
- Service.c
+ util/serviceutil.c
ServiceUtils.c
)
+konkretcmpi_generate(${MOF}
+ CIM_PROVIDERS
+ CIM_HEADERS
+)
+
add_library(${LIBRARY_NAME} SHARED
${provider_SRCS}
+ ${CIM_PROVIDERS}
+ ${CIM_HEADERS}
)
-include_directories(${CMPI_INCLUDE_DIR})
+include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMPI_INCLUDE_DIR})
+target_link_libraries(${LIBRARY_NAME} ${KONKRETCMPI_LIBRARIES})
+
+# Create registration file
+cim_registration(${PROVIDER_NAME} ${LIBRARY_NAME} ${MOF})
+
+install(FILES util/servicedisc.sh util/serviceutil.sh DESTINATION bin)
install(TARGETS ${LIBRARY_NAME} DESTINATION lib${LIB_SUFFIX}/cmpi)
diff --git a/src/service/Makefile.am b/src/service/Makefile.am
deleted file mode 100644
index 5cf4745..0000000
--- a/src/service/Makefile.am
+++ /dev/null
@@ -1,38 +0,0 @@
-# Start from an empty extra distribution file list
-EXTRA_DIST=
-
-# providerdir defines where provider libraries will be installed (@PROVIDERDIR@ is set by the configure script)
-providerdir = @PROVIDERDIR@
-
-provider_LTLIBRARIES = libService.la
-
-libService_la_SOURCES = Service.c
-libService_la_LIBADD = -lServiceUtils -lserviceutil
-libService_la_LDFLAGS = -avoid-version
-
-lib_LTLIBRARIES = libServiceUtils.la libserviceutil.la
-libServiceUtils_la_SOURCES= ServiceUtils.c
-libServiceUtils_la_LDFLAGS = -Wc,-nostartfiles
-libserviceutil_la_SOURCES = util/serviceutil.c
-libserviceutil_la_LDFLAGS = -Wc,-nostartfiles
-
-noinst_HEADERS = ServiceUtils.h util/serviceutil.h
-
-# Mof file
-SCHEMAS=mof/Linux_Service.mof
-REGISTRATIONS=mof/Linux_Service.registration
-
-pkgdata_DATA=$(SCHEMAS) $(REGISTRATIONS)
-pkgdata_SCRIPTS=provider-register.sh
-
-EXTRA_DIST+=mof $(pkgdata_SCRIPTS)
-# Register the provider(s) and class definition(s) to the current CIM server/CIMOM
-postinstall:
- sh provider-register.sh -t @CIMSERVER@ -r $(REGISTRATIONS) -m $(SCHEMAS)
-preuninstall:
- sh provider-register.sh -d -t @CIMSERVER@ -r $(REGISTRATIONS) -m $(SCHEMAS)
-
-
-# Install util/syslog-service.sh
-bin_SCRIPTS = util/serviceutil.sh util/servicedisc.sh
-EXTRA_DIST+=$(bin_SCRIPTS)
diff --git a/src/service/acinclude.m4 b/src/service/acinclude.m4
deleted file mode 100644
index 52538d0..0000000
--- a/src/service/acinclude.m4
+++ /dev/null
@@ -1,407 +0,0 @@
-dnl
-dnl $Id: acinclude.m4,v 1.2 2009/05/22 03:50:48 tyreld Exp $
-dnl
-dnl
-dnl (C) Copyright IBM Corp. 2004, 2005, 2009
-dnl
-dnl THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE
-dnl ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE
-dnl CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT.
-dnl
-dnl You can obtain a current copy of the Eclipse Public License from
-dnl http://www.eclipse.org/legal/epl-v10.html
-dnl
-dnl Author: Konrad Rzeszutek <konradr@us.ibm.com>
-dnl Contributors: Viktor Mihajlovski <mihajlov@de.ibm.com>
-dnl Date : 09/20/2004
-dnl
-dnl
-dnl CHECK_CMPI: Check for CMPI headers and set the CPPFLAGS
-dnl with the -I<directory>
-dnl
-dnl CHECK_PEGASUS_2_3_2: Check for Pegasus 2.3.2 and set
-dnl the HAVE_PEGASUS_2_3_2
-dnl flag
-dnl
-
-AC_DEFUN([CHECK_PEGASUS_2_3_2],
- [
- AC_MSG_CHECKING(for Pegasus 2.3.2)
- if which cimserver > /dev/null 2>&1
- then
- test_CIMSERVER=`cimserver -v`
- fi
- if test "$test_CIMSERVER" == "2.3.2"; then
- AC_MSG_RESULT(yes)
- AC_DEFINE_UNQUOTED(HAVE_PEGASUS_2_3_2,1,[Defined to 1 if Pegasus 2.3.2 is used])
- else
- AC_MSG_RESULT(no)
-
- fi
- ]
-)
-
-dnl
-dnl CHECK_PEGASUS_2_4: Check for Pegasus 2.4 and set the
-dnl the -DPEGASUS_USE_EXPERIMENTAL_INTERFACES flag
-dnl
-AC_DEFUN([CHECK_PEGASUS_2_4],
- [
- AC_MSG_CHECKING(for Pegasus 2.4)
- if which cimserver > /dev/null 2>&1
- then
- test_CIMSERVER=`cimserver -v`
- fi
- if test "$test_CIMSERVER" == "2.4"; then
- AC_MSG_RESULT(yes)
- CPPFLAGS="$CPPFLAGS -DPEGASUS_USE_EXPERIMENTAL_INTERFACES"
- AC_DEFINE_UNQUOTED(HAVE_PEGASUS_2_4,1,[Defined to 1 if Pegasus 2.4 is used])
- else
- AC_MSG_RESULT(no)
-
- fi
- ]
-)
-
-
-dnl
-dnl Helper functions
-dnl
-AC_DEFUN([_CHECK_CMPI],
- [
- AC_MSG_CHECKING($1)
- AC_TRY_LINK(
- [
- #include <stdio.h>
- #include <cmpimacs.h>
- #include <cmpidt.h>
- #include <cmpift.h>
- ],
- [
- CMPIBroker broker;
- CMPIStatus status = {CMPI_RC_OK, NULL};
- CMPIString *s = CMNewString(&broker, "TEST", &status);
- ],
- [
- have_CMPI=yes
- dnl AC_MSG_RESULT(yes)
- ],
- [
- have_CMPI=no
- dnl AC_MSG_RESULT(no)
- ])
-
-])
-
-AC_DEFUN([_CHECK_INDHELP_HEADER],
- [
- AC_MSG_CHECKING($1)
- AC_TRY_COMPILE(
- [
- #include <stdio.h>
- #include <ind_helper.h>
- ],
- [
- CMPISelectExp *filter = NULL;
- ind_set_select("/root/cimv2",NULL,filter);
- ],
- [
- have_INDHELP=yes
- dnl AC_MSG_RESULT(yes)
- ],
- [
- have_INDHELP=no
- dnl AC_MSG_RESULT(no)
- ])
-
-])
-
-dnl
-dnl The main function to check for CMPI headers
-dnl Modifies the CPPFLAGS with the right include directory and sets
-dnl the 'have_CMPI' to either 'no' or 'yes'
-dnl
-
-AC_DEFUN([CHECK_CMPI],
- [
- AC_MSG_CHECKING(for CMPI headers)
- dnl Check just with the standard include paths
- CMPI_CPP_FLAGS="$CPPFLAGS"
- _CHECK_CMPI(standard)
- if test "$have_CMPI" == "yes"; then
- dnl The standard include paths worked.
- AC_MSG_RESULT(yes)
- else
- _DIRS_="/usr/include/cmpi \
- /usr/local/include/cmpi \
- $PEGASUS_ROOT/src/Pegasus/Provider/CMPI \
- /opt/tog-pegasus/include/Pegasus/Provider/CMPI \
- /usr/include/Pegasus/Provider/CMPI \
- /usr/include/openwbem \
- /usr/sniacimom/include"
- for _DIR_ in $_DIRS_
- do
- _cppflags=$CPPFLAGS
- _include_CMPI="$_DIR_"
- CPPFLAGS="$CPPFLAGS -I$_include_CMPI"
- _CHECK_CMPI($_DIR_)
- if test "$have_CMPI" == "yes"; then
- dnl Found it
- AC_MSG_RESULT(yes)
- dnl Save the new -I parameter
- CMPI_CPP_FLAGS="$CPPFLAGS"
- break
- fi
- CPPFLAGS=$_cppflags
- done
- fi
- CPPFLAGS="$CMPI_CPP_FLAGS"
- if test "$have_CMPI" == "no"; then
- AC_MSG_ERROR(no. Sorry cannot find CMPI headers files.)
- fi
- ]
-)
-
-dnl
-dnl The main function to check for the indication_helper header.
-dnl Modifies the CPPFLAGS with the right include directory and sets
-dnl the 'have_INDHELP' to either 'no' or 'yes'
-dnl
-
-AC_DEFUN([CHECK_INDHELP_HEADER],
- [
- INDHELP_CPP_FLAGS="$CPPFLAGS"
- AC_MSG_CHECKING(for indication helper header)
- dnl Check just with the standard include paths
- _CHECK_INDHELP_HEADER(standard)
- if test "$have_INDHELP" == "yes"; then
- dnl The standard include paths worked.
- AC_MSG_RESULT(yes)
- else
- _DIRS_="/usr/include/sblim \
- /usr/local/include/sblim"
- for _DIR_ in $_DIRS_
- do
- _cppflags=$CPPFLAGS
- _include_INDHELP="$_DIR_"
- CPPFLAGS="$CPPFLAGS -I$_include_INDHELP"
- _CHECK_INDHELP_HEADER($_DIR_)
- if test "$have_INDHELP" == "yes"; then
- dnl Found it
- AC_MSG_RESULT(yes)
- dnl Save the new -I parameter
- INDHELP_CPP_FLAGS="$CPPFLAGS"
- break
- fi
- CPPFLAGS=$_cppflags
- done
- fi
- CPPFLAGS="$INDHELP_CPP_FLAGS"
- if test "$have_INDHELP" == "no"; then
- AC_MSG_RESULT(no)
- fi
- ]
-)
-
-dnl
-dnl The check for the CMPI provider directory
-dnl Sets the PROVIDERDIR variable.
-dnl
-
-AC_DEFUN([CHECK_PROVIDERDIR],
- [
- AC_MSG_CHECKING(for CMPI provider directory)
- _DIRS="$libdir/cmpi"
- save_exec_prefix=${exec_prefix}
- save_prefix=${prefix}
- if test xNONE == x${prefix}; then
- prefix=/usr/local
- fi
- if test xNONE == x${exec_prefix}; then
- exec_prefix=$prefix
- fi
- for _dir in $_DIRS
- do
- _xdir=`eval echo $_dir`
- AC_MSG_CHECKING( $_dir )
- if test -d $_xdir ; then
- dnl Found it
- AC_MSG_RESULT(yes)
- if test x"$PROVIDERDIR" == x ; then
- PROVIDERDIR=$_dir
- fi
- break
- fi
- done
- if test x"$PROVIDERDIR" == x ; then
- PROVIDERDIR="$libdir"/cmpi
- AC_MSG_RESULT(implied: $PROVIDERDIR)
- fi
- exec_prefix=$save_exec_prefix
- prefix=$save_prefix
- ]
-)
-
-dnl
-dnl The "check" for the CIM server type in PATH and
-dnl the sbin directories.
-dnl Sets the CIMSERVER variable.
-dnl
-
-AC_DEFUN([CHECK_CIMSERVER],
- [
- AC_MSG_CHECKING(for CIM servers)
- if test x"$CIMSERVER" = x
- then
- _SERVERS="sfcbd cimserver owcimomd"
- _SAVE_PATH=$PATH
- PATH=/usr/sbin:/usr/local/sbin:$PATH
- for _name in $_SERVERS
- do
- AC_MSG_CHECKING( $_name )
- for _path in `echo $PATH | sed "s/:/ /g"`
- do
- if test -f $_path/$_name ; then
- dnl Found it
- AC_MSG_RESULT(yes)
- if test x"$CIMSERVER" == x ; then
- case $_name in
- sfcbd) CIMSERVER=sfcb;;
- cimserver) CIMSERVER=pegasus;;
- owcimomd) CIMSERVER=openwbem;;
- esac
- fi
- break;
- fi
- done
- done
- PATH=$_SAVE_PATH
- if test x"$CIMSERVER" == x ; then
- CIMSERVER=sfcb
- AC_MSG_RESULT(implied: $CIMSERVER)
- fi
- fi
- # Cross platform only needed for sfcb currently
- if test $CIMSERVER = sfcb
- then
- AC_REQUIRE([AC_CANONICAL_HOST])
- AC_CHECK_SIZEOF(int)
- case "$build_cpu" in
- i*86) case "$host_cpu" in
- powerpc*) if test $ac_cv_sizeof_int == 4
- then
- REGISTER_FLAGS="-X P32"
- fi ;;
- esac ;;
- esac
- AC_SUBST(REGISTER_FLAGS)
- fi
- ]
-)
-
-dnl
-dnl The check for the SBLIM test suite
-dnl Sets the TESTSUITEDIR variable and the TESTSUITE conditional
-dnl
-
-AC_DEFUN([CHECK_TESTSUITE],
- [
- AC_MSG_CHECKING(for SBLIM testsuite)
- _DIRS="$datadir/sblim-testsuite"
- save_exec_prefix=${exec_prefix}
- save_prefix=${prefix}
- if test xNONE == x${prefix}; then
- prefix=/usr/local
- fi
- if test xNONE == x${exec_prefix}; then
- exec_prefix=$prefix
- fi
- for _name in $_DIRS
- do
- AC_MSG_CHECKING( $_name )
- _xname=`eval echo $_name`
- if test -x $_xname/run.sh ; then
- dnl Found it
- AC_MSG_RESULT(yes)
- if test x"$TESTSUITEDIR" == x; then
- TESTSUITEDIR=$_name
- fi
- AC_SUBST(TESTSUITEDIR)
- break;
- fi
- done
- if test x"$TESTSUITEDIR" == x ; then
- AC_MSG_RESULT(no)
- fi
- AM_CONDITIONAL(TESTSUITE,[test x"$TESTSUITEDIR" != x])
- exec_prefix=$save_exec_prefix
- prefix=$save_prefix
- ]
-)
-
-dnl
-dnl The main function to check for the cmpi-base common header
-dnl Modifies the CPPFLAGS with the right include directory and sets
-dnl the 'have_SBLIMBASE' to either 'no' or 'yes'
-dnl
-AC_DEFUN([_CHECK_SBLIM_BASE],
- [
- AC_MSG_CHECKING($1)
- _ldflags=$LDFLAGS
- LDFLAGS="$LDFLAGS -lcmpiOSBase_Common"
- AC_TRY_LINK(
- [
- #include <OSBase_Common.h>
- ],
- [
- get_system_name();
- ],
- [
- have_SBLIMBASE=yes
- LDFLAGS=$_ldflags
- dnl AC_MSG_RESULT(yes)
- ],
- [
- have_SBLIMBASE=no
- LDFLAGS=$_ldflags
- dnl AC_MSG_RESULT(no)
- ])
-
-])
-
-AC_DEFUN([CHECK_SBLIM_BASE],
- [
- AC_MSG_CHECKING(for SBLIM Base)
- SBLIMBASE_CPP_FLAGS="$CPPFLAGS"
- dnl Check just with the standard include paths
- _CHECK_SBLIM_BASE(standard)
- if test "$have_SBLIMBASE" == "yes"; then
- dnl The standard include paths worked.
- AC_MSG_RESULT(yes)
- else
- _DIRS_="/usr/include/sblim \
- /usr/local/include/sblim"
- for _DIR_ in $_DIRS_
- do
- _cppflags=$CPPFLAGS
- _include_SBLIMBASE="$_DIR_"
- CPPFLAGS="$CPPFLAGS -I$_include_SBLIMBASE"
- _CHECK_SBLIM_BASE($_DIR_)
- if test "$have_SBLIMBASE" == "yes"; then
- dnl Found it
- AC_MSG_RESULT(yes)
- dnl Save the new -I parameter
- SBLIMBASE_CPP_FLAGS="$CPPFLAGS"
- LIBSBLIMBASE=-lcmpiOSBase_Common
- break
- fi
- CPPFLAGS=$_cppflags
- done
- fi
- CPPFLAGS=$SBLIMBASE_CPP_FLAGS
- AC_SUBST(LIBSBLIMBASE)
- if test "$have_SBLIMBASE" == "no"; then
- AC_MSG_ERROR(no. The required SBLIM Base package is missing.)
- fi
- ]
-)
diff --git a/src/service/autoconfiscate.sh b/src/service/autoconfiscate.sh
deleted file mode 100755
index 70a21a7..0000000
--- a/src/service/autoconfiscate.sh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh
-# $Id: autoconfiscate.sh,v 1.2 2009/05/22 03:50:48 tyreld Exp $
-# ============================================================================
-# (C) Copyright IBM Corp. 2005, 2009
-#
-# THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE
-# ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE
-# CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT.
-#
-# You can obtain a current copy of the Eclipse Public License from
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Author: Viktor Mihajlovski, <mihajlov@de.ibm.com>
-# Contributors: Dr. Gareth S. Bestor, <bestorga@us.ibm.com>
-# Last Updated: April 15, 2005
-# Description:
-# Setup autoconf/automake build environment for package.
-# Run this script as the first step of building this package.
-# ============================================================================
-# NO CHANGES SHOULD BE NECESSARY TO THIS FILE
-# ============================================================================
-
-echo "Running aclocal ..." &&
-aclocal --force &&
-
-echo "Running autoheader ..." &&
-autoheader --force &&
-
-echo "Running libtool ..." &&
-libtoolize --force &&
-
-echo "Running automake ..." &&
-automake --add-missing --force-missing &&
-
-echo "Running autoconf ..." &&
-autoconf --force &&
-
-echo "You may now run ./configure"
-
diff --git a/src/service/configure.ac b/src/service/configure.ac
deleted file mode 100644
index fc0c9c6..0000000
--- a/src/service/configure.ac
+++ /dev/null
@@ -1,74 +0,0 @@
-# -*- Autoconf -*-
-# Process this file with autoconf to produce a configure script.
-
-AC_PREREQ(2.59)
-AC_INIT(SBLIM Service Provider, 0.0.1, vcrhonek@redhat.com, cmpi-service)
-AC_CONFIG_HEADER([config.h])
-AM_INIT_AUTOMAKE
-
-AC_CANONICAL_HOST
-case $host_cpu in
- i*86) HW=INTEL;;
- s390*) HW=S390;;
- ppc*) HW=PPC;;
- x86_64) HW=X86_64;;
- ia64) HW=IA64;;
- **) HW=GENERIC;;
-esac
-
-# Configuration Arguments
-AC_ARG_VAR([PROVIDERDIR],[the directory where the CMPI providers will be installed.])
-AC_ARG_VAR([CIMSERVER],[the target CIM server (pegasus|sfcb|openwbem|sniacimom).])
-
-# Checks for programs.
-AC_PROG_CC
-AC_PROG_INSTALL
-AC_PROG_LIBTOOL
-
-# Check for required CMPI header files (defined in acinclude.m4)
-CHECK_CMPI
-
-# Check for required libraries (defined in acinclude.m4)
-CHECK_PROVIDERDIR
-
-# Check for CIM Server (defined in acinclude.m4)
-CHECK_CIMSERVER
-
-# Checks for header files.
-AC_HEADER_DIRENT
-AC_HEADER_STDC
-AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS([fcntl.h langinfo.h limits.h malloc.h stdlib.h string.h sys/time.h unistd.h])
-
-# Checks for typedefs, structures, and compiler characteristics.
-AC_C_CONST
-AC_C_INLINE
-AC_TYPE_MODE_T
-AC_TYPE_OFF_T
-AC_TYPE_SIZE_T
-AC_HEADER_TIME
-AC_STRUCT_TM
-
-AC_FUNC_MALLOC
-AC_FUNC_STAT
-AC_CHECK_FUNCS([gethostname strcasecmp strchr strdup strstr])
-
-AC_CONFIG_FILES([Makefile])
-
-# Extend CPPFLAGS
-CPPFLAGS="$CPPFLAGS -D$HW"
-
-# Display configuration options
-echo "-------------------------------------------------------"
-echo "Configuration for $PACKAGE complete."
-echo ""
-echo "The following configuration options have been selected:"
-echo "CIMSERVER: " $CIMSERVER
-echo "PROVIDERDIR: " $PROVIDERDIR
-echo "SYSLOG:" $SYSLOG
-echo "CPPFLAGS:" $CPPFLAGS
-echo "-------------------------------------------------------"
-
-AC_OUTPUT
-
-echo "You may now run make"