<commit_before>#
# CMakeLists.txt for openwsman/
#

PROJECT(openwsman)

cmake_minimum_required(VERSION 2.4)

include(CTest)
enable_testing()
#
# cmake2.6: backward compatibility to cmake 2.4
#
if(COMMAND cmake_policy)
  cmake_policy(SET CMP0003 OLD)
endif(COMMAND cmake_policy)

if(COMMAND cmake_policy)
  cmake_policy(SET CMP0005 OLD)
endif(COMMAND cmake_policy)
	      
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})

INCLUDE( ${CMAKE_SOURCE_DIR}/VERSION.cmake )
SET(VERSION "${OPENWSMAN_MAJOR}.${OPENWSMAN_MINOR}.${OPENWSMAN_PATCH}")
   MESSAGE(STATUS "Version ${VERSION}")
SET(PACKAGE_VERSION \"${OPENWSMAN_MAJOR}.${OPENWSMAN_MINOR}\")
   MESSAGE(STATUS "Package Version ${PACKAGE_VERSION}")
SET(OPENWSMAN_PLUGIN_API_VERSION \"${OPENWSMAN_PLUGIN_API_MAJOR}.${OPENWSMAN_PLUGIN_API_MINOR}\")
   MESSAGE(STATUS "Plugin API Version ${OPENWSMAN_PLUGIN_API_VERSION}")
# build timestamp
EXECUTE_PROCESS(COMMAND "/bin/date" "+%Y%m%d%H%M" OUTPUT_VARIABLE BUILD_DATE)
STRING(REPLACE "\n" "" PACKAGE_BUILDTS "${BUILD_DATE}")
   MESSAGE(STATUS "Package build timestamp ${PACKAGE_BUILDTS}")

# Package architecture
IF ( NOT DEFINED PACKAGE_ARCHITECTURE )
 EXECUTE_PROCESS(COMMAND "/bin/uname" "-m" OUTPUT_VARIABLE UNAME_M)
 # strip trailing newline
 STRING(REPLACE "\n" "" PACKAGE_ARCHITECTURE ${UNAME_M})
ENDIF ( NOT DEFINED PACKAGE_ARCHITECTURE )
MESSAGE(STATUS "Building for ${PACKAGE_ARCHITECTURE}" )


# Library path (lib / lib64 )

IF ( DEFINED LIB )
  SET ( LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${LIB}" )
ELSE ( DEFINED  LIB )
  IF (CMAKE_SIZEOF_VOID_P MATCHES "8")
    SET( LIB_SUFFIX "64" )
  ENDIF(CMAKE_SIZEOF_VOID_P MATCHES "8")
  SET ( LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" )
ENDIF ( DEFINED  LIB )
MESSAGE(STATUS "Libraries will be installed in ${LIB_INSTALL_DIR}" )
SET( BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin" )
SET( INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include" )
IF( "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr")
  SET( SYSCONFDIR "/etc" )
ELSE( "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr")
  SET( SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/etc" )
ENDIF( "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr")
SET( WSMANCONF_DIR "${SYSCONFDIR}/openwsman" )
MESSAGE(STATUS "Configuration will be installed in ${WSMANCONF_DIR}" )
SET( DEFAULT_CONFIG_FILE "\"${WSMANCONF_DIR}/openwsman.conf\"")
SET( DEFAULT_CLIENT_CONFIG_FILE "\"${WSMANCONF_DIR}/openwsman_client.conf\"")
SET( PACKAGE_SUBSCRIPTION_DIR "/var/lib/openwsman/subscriptions" )
SET( PACKAGE_PLUGIN_DIR "${LIB_INSTALL_DIR}/openwsman/plugins" )
SET( PACKAGE_AUTH_DIR "${LIB_INSTALL_DIR}/openwsman/authenticators" )


# Macro for error message when header files not present, but build option
# explicitly declared
MACRO(NO_HEADERS_WARNING_EXPL optionName pkgName)
   MESSAGE(STATUS "************  WARNING  *************")
   MESSAGE(STATUS "Didn't Find ${pkgName} Headers... ")
   MESSAGE(STATUS "${optionName} explicitly requested.")
   MESSAGE(STATUS "Make sure ${pkgName} header files are available and run cmake again.")
   MESSAGE(STATUS "************************************")
   SET(HAVE_WARNINGS YES)
ENDMACRO(NO_HEADERS_WARNING_EXPL)
    
# Macro for error message when header files not present, but build option
# not explicitly declared
MACRO(NO_HEADERS_WARNING optionName pkgName)
   SET(${optionName} NO)
   SET(HAVE_WARNINGS YES)
   MESSAGE(STATUS "************  WARNING  *************")
   MESSAGE(STATUS "Didn't Find ${pkgName} Headers... Not Building ${pkgName} Bindings")
   MESSAGE(STATUS "************************************")
ENDMACRO(NO_HEADERS_WARNING)

# For binding options, see if it is explicitly set on the command line,
# before defining the option with a default.  Then if we don't find
# the headers: if it was explicitly set then fail, otherwise
# just give a warning message
SET( BUILD_PYTHON_EXPLICIT ${BUILD_PYTHON})
SET( BUILD_RUBY_EXPLICIT ${BUILD_RUBY})
SET( BUILD_PERL_EXPLICIT ${BUILD_PERL})
SET( BUILD_JAVA_EXPLICIT ${BUILD_JAVA})

# options

OPTION( BUILD_LIBCIM "Build CIM plugin" YES )
OPTION( BUILD_EXAMPLES "Build examples" YES )
OPTION( BUILD_PYTHON "Build Python bindings" YES )
OPTION( BUILD_RUBY "Build Ruby bindings" YES )
IF( BUILD_RUBY )
OPTION( BUILD_RUBY_GEM "Build Ruby GEM" YES )
ENDIF( BUILD_RUBY )
OPTION( BUILD_PERL "Build Perl bindings" YES )
OPTION( BUILD_JAVA "Build Java bindings" YES )
OPTION( BUILD_CSHARP "Build C# bindings" YES)
OPTION( BUILD_CUNIT_TESTS "Build serialization tests" NO )
OPTION( DISABLE_PLUGINS "Do not build plugins" NO )
OPTION( BUILD_SWIG_PLUGIN "Build SWIG plugin" YES )
OPTION( DISABLE_SERVER "Do not build server component" NO )
OPTION( ENABLE_EVENTING_SUPPORT "WS-Eventing wanted" YES )
OPTION( WSMAN_DEBUG_VERBOSE "Verbose debug logging" NO )
OPTION( ENABLE_IPV6 "Enable IPv6 support" YES )
OPTION( BUILD_TESTS "Build tests" YES )


IF (ENABLE_EVENTING_SUPPORT)
  SET(ENABLE_EVENTING_SUPPORT 1)
ELSE (ENABLE_EVENTING_SUPPORT)
  SET(ENABLE_EVENTING_SUPPORT 0)
ENDIF (ENABLE_EVENTING_SUPPORT)

IF(WSMAN_DEBUG_VERBOSE)
  SET(WSMAN_DEBUG_VERBOSE 1)
ELSE(WSMAN_DEBUG_VERBOSE)
  SET(WSMAN_DEBUG_VERBOSE 0)
ENDIF(WSMAN_DEBUG_VERBOSE)

OPTION( USE_PAM "Use PAM authentication" YES )
IF( USE_PAM )
  FIND_LIBRARY( HAVE_LIBPAM "pam" )
  IF(HAVE_LIBPAM)
    SET( HAVE_PAM 1 )
    MESSAGE(STATUS "building PAM authentication" )
  ELSE(HAVE_LIBPAM)
    MESSAGE(WARNING " libpam not found, disabling PAM authentication" )
    SET( HAVE_PAM 1 )
  ENDIF(HAVE_LIBPAM)
ELSE( USE_PAM )
 SET( HAVE_PAM 0 )
 MESSAGE(STATUS "Disabling PAM authentication" )
ENDIF( USE_PAM )

INCLUDE(FindOpenSSL)
IF(OPENSSL_FOUND)
  SET(HAVE_SSL 1)
  SET(USE_OPENSSL 1)
ENDIF(OPENSSL_FOUND)

IF( BUILD_RUBY )
INCLUDE(FindRuby)
IF( RUBY_VERSION_MAJOR EQUAL 2)
  MESSAGE(ERROR "Ruby 2.x not supported yet")
ENDIF( RUBY_VERSION_MAJOR EQUAL 2 )
  IF( RUBY_VERSION VERSION_LESS "1.9.0" )
    EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['sitearchdir']"
      OUTPUT_VARIABLE RUBY_SITEARCH_DIR)
  ELSE( RUBY_VERSION VERSION_LESS "1.9.0" )
    EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['sitearchdir']"
      OUTPUT_VARIABLE RUBY_SITEARCH_DIR)
  ENDIF( RUBY_VERSION VERSION_LESS "1.9.0" )

MESSAGE(STATUS "Building Ruby bindings" )
 IF(NOT RUBY_INCLUDE_PATH)
  IF(BUILD_RUBY_EXPLICIT)
   NO_HEADERS_WARNING_EXPL(BUILD_RUBY Ruby)
  ELSE(BUILD_RUBY_EXPLICIT)
   NO_HEADERS_WARNING(BUILD_RUBY Ruby)
  ENDIF(BUILD_RUBY_EXPLICIT)
 ENDIF(NOT RUBY_INCLUDE_PATH )
ENDIF( BUILD_RUBY )

IF( BUILD_PYTHON )
  MESSAGE(STATUS "Building Python bindings" )
  FIND_PACKAGE(PythonLibs)
  IF (PYTHON_LIBRARY)
    FIND_PACKAGE(PythonInterp REQUIRED)
    MESSAGE(STATUS "Found PythonLibs...")
    FIND_PACKAGE(PythonLinkLibs)
    IF (PYTHON_LINK_LIBS)
      MESSAGE(STATUS "Building Python...")
    ENDIF (PYTHON_LINK_LIBS)
  ENDIF (PYTHON_LIBRARY)
  IF(NOT PYTHON_INCLUDE_PATH )
    IF(BUILD_PYTHON_EXPLICIT)
      NO_HEADERS_WARNING_EXPL(BUILD_PYTHON Python)
    ELSE(BUILD_PYTHON_EXPLICIT)
      NO_HEADERS_WARNING(BUILD_PYTHON Python)
    ENDIF(BUILD_PYTHON_EXPLICIT)
  ENDIF(NOT PYTHON_INCLUDE_PATH )
ENDIF( BUILD_PYTHON )

IF( BUILD_PERL )
  INCLUDE(FindPerl)
  IF(PERL_EXECUTABLE)
    MESSAGE(STATUS "Building Perl bindings" )
  ELSE(PERL_EXECUTABLE)
    MESSAGE(WARNING "Perl not found" )
  ENDIF(PERL_EXECUTABLE)
ENDIF( BUILD_PERL )

IF( BUILD_JAVA )
  INCLUDE(FindJava)
  IF(JAVA_COMPILE)
    INCLUDE(FindJNI)
    IF(JNI_INCLUDE_DIRS)
      MESSAGE(STATUS "Building Java bindings" )
    ELSE(JNI_INCLUDE_DIRS)
      MESSAGE(WARNING " Java jni.h not found" )
      SET( BUILD_JAVA "NO" )
    ENDIF(JNI_INCLUDE_DIRS)
  ELSE(JAVA_COMPILE)
    MESSAGE(WARNING " Java compiler not found" )
    SET( BUILD_JAVA "NO" )
  ENDIF(JAVA_COMPILE)
ENDIF( BUILD_JAVA )

# swig

IF( BUILD_SWIG_PLUGIN )
FIND_PACKAGE(SWIG)
IF( NOT SWIG_EXECUTABLE)
  FIND_PROGRAM(SWIG_EXECUTABLE
    NAMES swig-1.3 swig
    PATHS ${SWIG_DIR} ${SWIG_DIR}/.. ${SWIG_DIR}/../../bin /usr/bin /usr/local/bin ${CMAKE_INSTALL_PREFIX}/bin
  )
ENDIF( NOT SWIG_EXECUTABLE)
ENDIF( BUILD_SWIG_PLUGIN )

IF ( NOT SWIG_EXECUTABLE )
  MESSAGE( STATUS "SWIG not found, skipping bindings." )
ELSE ( NOT SWIG_EXECUTABLE )
  MESSAGE( STATUS "SWIG found at ${SWIG_EXECUTABLE}" )
  ADD_SUBDIRECTORY(bindings)
ENDIF ( NOT SWIG_EXECUTABLE )

# curl

INCLUDE(FindCURL)
IF ( NOT CURL_FOUND)
  MESSAGE( FATAL_ERROR " curl not found" )
ELSE ( NOT CURL_FOUND)
  INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIR})
ENDIF( NOT CURL_FOUND)

# xml2

INCLUDE(FindLibXml2)
IF ( NOT LIBXML2_FOUND)
  MESSAGE( FATAL_ERROR " libxml2 not found" )
ELSE ( NOT LIBXML2_FOUND)
  INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
ENDIF( NOT LIBXML2_FOUND)

# pthreads

INCLUDE(FindThreads)
IF( NOT CMAKE_USE_PTHREADS_INIT )
 MESSAGE( FATAL_ERROR " openwsman needs pthread" )
ELSE( NOT CMAKE_USE_PTHREADS_INIT )
 SET(USE_PTHREAD TRUE)<commit_msg>New option BUILD_BINDINGS<commit_after>#
# CMakeLists.txt for openwsman/
#

PROJECT(openwsman)

cmake_minimum_required(VERSION 2.4)

include(CTest)
enable_testing()
#
# cmake2.6: backward compatibility to cmake 2.4
#
if(COMMAND cmake_policy)
  cmake_policy(SET CMP0003 OLD)
endif(COMMAND cmake_policy)

if(COMMAND cmake_policy)
  cmake_policy(SET CMP0005 OLD)
endif(COMMAND cmake_policy)
	      
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})

INCLUDE( ${CMAKE_SOURCE_DIR}/VERSION.cmake )
SET(VERSION "${OPENWSMAN_MAJOR}.${OPENWSMAN_MINOR}.${OPENWSMAN_PATCH}")
   MESSAGE(STATUS "Version ${VERSION}")
SET(PACKAGE_VERSION \"${OPENWSMAN_MAJOR}.${OPENWSMAN_MINOR}\")
   MESSAGE(STATUS "Package Version ${PACKAGE_VERSION}")
SET(OPENWSMAN_PLUGIN_API_VERSION \"${OPENWSMAN_PLUGIN_API_MAJOR}.${OPENWSMAN_PLUGIN_API_MINOR}\")
   MESSAGE(STATUS "Plugin API Version ${OPENWSMAN_PLUGIN_API_VERSION}")
# build timestamp
EXECUTE_PROCESS(COMMAND "/bin/date" "+%Y%m%d%H%M" OUTPUT_VARIABLE BUILD_DATE)
STRING(REPLACE "\n" "" PACKAGE_BUILDTS "${BUILD_DATE}")
   MESSAGE(STATUS "Package build timestamp ${PACKAGE_BUILDTS}")

# Package architecture
IF ( NOT DEFINED PACKAGE_ARCHITECTURE )
 EXECUTE_PROCESS(COMMAND "/bin/uname" "-m" OUTPUT_VARIABLE UNAME_M)
 # strip trailing newline
 STRING(REPLACE "\n" "" PACKAGE_ARCHITECTURE ${UNAME_M})
ENDIF ( NOT DEFINED PACKAGE_ARCHITECTURE )
MESSAGE(STATUS "Building for ${PACKAGE_ARCHITECTURE}" )


# Library path (lib / lib64 )

IF ( DEFINED LIB )
  SET ( LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${LIB}" )
ELSE ( DEFINED  LIB )
  IF (CMAKE_SIZEOF_VOID_P MATCHES "8")
    SET( LIB_SUFFIX "64" )
  ENDIF(CMAKE_SIZEOF_VOID_P MATCHES "8")
  SET ( LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" )
ENDIF ( DEFINED  LIB )
MESSAGE(STATUS "Libraries will be installed in ${LIB_INSTALL_DIR}" )
SET( BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin" )
SET( INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include" )
IF( "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr")
  SET( SYSCONFDIR "/etc" )
ELSE( "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr")
  SET( SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/etc" )
ENDIF( "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr")
SET( WSMANCONF_DIR "${SYSCONFDIR}/openwsman" )
MESSAGE(STATUS "Configuration will be installed in ${WSMANCONF_DIR}" )
SET( DEFAULT_CONFIG_FILE "\"${WSMANCONF_DIR}/openwsman.conf\"")
SET( DEFAULT_CLIENT_CONFIG_FILE "\"${WSMANCONF_DIR}/openwsman_client.conf\"")
SET( PACKAGE_SUBSCRIPTION_DIR "/var/lib/openwsman/subscriptions" )
SET( PACKAGE_PLUGIN_DIR "${LIB_INSTALL_DIR}/openwsman/plugins" )
SET( PACKAGE_AUTH_DIR "${LIB_INSTALL_DIR}/openwsman/authenticators" )


# Macro for error message when header files not present, but build option
# explicitly declared
MACRO(NO_HEADERS_WARNING_EXPL optionName pkgName)
   MESSAGE(STATUS "************  WARNING  *************")
   MESSAGE(STATUS "Didn't Find ${pkgName} Headers... ")
   MESSAGE(STATUS "${optionName} explicitly requested.")
   MESSAGE(STATUS "Make sure ${pkgName} header files are available and run cmake again.")
   MESSAGE(STATUS "************************************")
   SET(HAVE_WARNINGS YES)
ENDMACRO(NO_HEADERS_WARNING_EXPL)
    
# Macro for error message when header files not present, but build option
# not explicitly declared
MACRO(NO_HEADERS_WARNING optionName pkgName)
   SET(${optionName} NO)
   SET(HAVE_WARNINGS YES)
   MESSAGE(STATUS "************  WARNING  *************")
   MESSAGE(STATUS "Didn't Find ${pkgName} Headers... Not Building ${pkgName} Bindings")
   MESSAGE(STATUS "************************************")
ENDMACRO(NO_HEADERS_WARNING)

# For binding options, see if it is explicitly set on the command line,
# before defining the option with a default.  Then if we don't find
# the headers: if it was explicitly set then fail, otherwise
# just give a warning message
SET( BUILD_PYTHON_EXPLICIT ${BUILD_PYTHON})
SET( BUILD_RUBY_EXPLICIT ${BUILD_RUBY})
SET( BUILD_PERL_EXPLICIT ${BUILD_PERL})
SET( BUILD_JAVA_EXPLICIT ${BUILD_JAVA})
SET( BUILD_SWIG_PLUGIN_EXPLICIT ${BUILD_SWIG_PLUGIN})

# options

OPTION( BUILD_LIBCIM "Build CIM plugin" YES )
OPTION( BUILD_EXAMPLES "Build examples" YES )
OPTION( BUILD_BINDINGS "Build client bindings and swig server plugin" YES )
OPTION( BUILD_PYTHON "Build Python bindings" YES )
OPTION( BUILD_RUBY "Build Ruby bindings" YES )
IF( BUILD_RUBY )
OPTION( BUILD_RUBY_GEM "Build Ruby GEM" YES )
ENDIF( BUILD_RUBY )
OPTION( BUILD_PERL "Build Perl bindings" YES )
OPTION( BUILD_JAVA "Build Java bindings" YES )
OPTION( BUILD_CSHARP "Build C# bindings" YES)
OPTION( BUILD_CUNIT_TESTS "Build serialization tests" NO )
OPTION( DISABLE_PLUGINS "Do not build plugins" NO )
OPTION( BUILD_SWIG_PLUGIN "Build SWIG plugin" YES )
OPTION( DISABLE_SERVER "Do not build server component" NO )
OPTION( ENABLE_EVENTING_SUPPORT "WS-Eventing wanted" YES )
OPTION( WSMAN_DEBUG_VERBOSE "Verbose debug logging" NO )
OPTION( ENABLE_IPV6 "Enable IPv6 support" YES )
OPTION( BUILD_TESTS "Build tests" YES )


IF (ENABLE_EVENTING_SUPPORT)
  SET(ENABLE_EVENTING_SUPPORT 1)
ELSE (ENABLE_EVENTING_SUPPORT)
  SET(ENABLE_EVENTING_SUPPORT 0)
ENDIF (ENABLE_EVENTING_SUPPORT)

IF(WSMAN_DEBUG_VERBOSE)
  SET(WSMAN_DEBUG_VERBOSE 1)
ELSE(WSMAN_DEBUG_VERBOSE)
  SET(WSMAN_DEBUG_VERBOSE 0)
ENDIF(WSMAN_DEBUG_VERBOSE)

OPTION( USE_PAM "Use PAM authentication" YES )
IF( USE_PAM )
  FIND_LIBRARY( HAVE_LIBPAM "pam" )
  IF(HAVE_LIBPAM)
    SET( HAVE_PAM 1 )
    MESSAGE(STATUS "building PAM authentication" )
  ELSE(HAVE_LIBPAM)
    MESSAGE(WARNING " libpam not found, disabling PAM authentication" )
    SET( HAVE_PAM 1 )
  ENDIF(HAVE_LIBPAM)
ELSE( USE_PAM )
 SET( HAVE_PAM 0 )
 MESSAGE(STATUS "Disabling PAM authentication" )
ENDIF( USE_PAM )

INCLUDE(FindOpenSSL)
IF(OPENSSL_FOUND)
  SET(HAVE_SSL 1)
  SET(USE_OPENSSL 1)
ENDIF(OPENSSL_FOUND)

IF( BUILD_RUBY )
INCLUDE(FindRuby)
IF( RUBY_VERSION_MAJOR EQUAL 2)
  MESSAGE(ERROR "Ruby 2.x not supported yet")
ENDIF( RUBY_VERSION_MAJOR EQUAL 2 )
  IF( RUBY_VERSION VERSION_LESS "1.9.0" )
    EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['sitearchdir']"
      OUTPUT_VARIABLE RUBY_SITEARCH_DIR)
  ELSE( RUBY_VERSION VERSION_LESS "1.9.0" )
    EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['sitearchdir']"
      OUTPUT_VARIABLE RUBY_SITEARCH_DIR)
  ENDIF( RUBY_VERSION VERSION_LESS "1.9.0" )

MESSAGE(STATUS "Building Ruby bindings" )
 IF(NOT RUBY_INCLUDE_PATH)
  IF(BUILD_RUBY_EXPLICIT)
   NO_HEADERS_WARNING_EXPL(BUILD_RUBY Ruby)
  ELSE(BUILD_RUBY_EXPLICIT)
   NO_HEADERS_WARNING(BUILD_RUBY Ruby)
  ENDIF(BUILD_RUBY_EXPLICIT)
 ENDIF(NOT RUBY_INCLUDE_PATH )
ENDIF( BUILD_RUBY )

IF( BUILD_PYTHON )
  MESSAGE(STATUS "Building Python bindings" )
  FIND_PACKAGE(PythonLibs)
  IF (PYTHON_LIBRARY)
    FIND_PACKAGE(PythonInterp REQUIRED)
    MESSAGE(STATUS "Found PythonLibs...")
    FIND_PACKAGE(PythonLinkLibs)
    IF (PYTHON_LINK_LIBS)
      MESSAGE(STATUS "Building Python...")
    ENDIF (PYTHON_LINK_LIBS)
  ENDIF (PYTHON_LIBRARY)
  IF(NOT PYTHON_INCLUDE_PATH )
    IF(BUILD_PYTHON_EXPLICIT)
      NO_HEADERS_WARNING_EXPL(BUILD_PYTHON Python)
    ELSE(BUILD_PYTHON_EXPLICIT)
      NO_HEADERS_WARNING(BUILD_PYTHON Python)
    ENDIF(BUILD_PYTHON_EXPLICIT)
  ENDIF(NOT PYTHON_INCLUDE_PATH )
ENDIF( BUILD_PYTHON )

IF( BUILD_PERL )
  INCLUDE(FindPerl)
  IF(PERL_EXECUTABLE)
    MESSAGE(STATUS "Building Perl bindings" )
  ELSE(PERL_EXECUTABLE)
    MESSAGE(WARNING "Perl not found" )
  ENDIF(PERL_EXECUTABLE)
ENDIF( BUILD_PERL )

IF( BUILD_JAVA )
  INCLUDE(FindJava)
  IF(JAVA_COMPILE)
    INCLUDE(FindJNI)
    IF(JNI_INCLUDE_DIRS)
      MESSAGE(STATUS "Building Java bindings" )
    ELSE(JNI_INCLUDE_DIRS)
      MESSAGE(WARNING " Java jni.h not found" )
      SET( BUILD_JAVA "NO" )
    ENDIF(JNI_INCLUDE_DIRS)
  ELSE(JAVA_COMPILE)
    MESSAGE(WARNING " Java compiler not found" )
    SET( BUILD_JAVA "NO" )
  ENDIF(JAVA_COMPILE)
ENDIF( BUILD_JAVA )

# swig
IF( BUILD_BINDINGS )
  FIND_PACKAGE(SWIG)
  IF( NOT SWIG_EXECUTABLE)
    FIND_PROGRAM(SWIG_EXECUTABLE
      NAMES swig-1.3 swig
      PATHS ${SWIG_DIR} ${SWIG_DIR}/.. ${SWIG_DIR}/../../bin /usr/bin /usr/local/bin ${CMAKE_INSTALL_PREFIX}/bin
    )
  ENDIF( NOT SWIG_EXECUTABLE)
ENDIF( BUILD_BINDINGS )

IF ( NOT SWIG_EXECUTABLE )
  MESSAGE( STATUS "SWIG not found, skipping bindings and swig server plugin." )
  IF (BUILD_SWIG_PLUGIN_EXPLICIT)
    MESSAGE( FATAL "Cannot build SWIG server plugin" )
  ELSE (BUILD_SWIG_PLUGIN_EXPLICIT)
    SET( BUILD_SWIG_PLUGIN NO )
  ENDIF (BUILD_SWIG_PLUGIN_EXPLICIT)
  IF( BUILD_PYTHON_EXPLICIT OR BUILD_RUBY_EXPLICIT OR BUILD_PERL_EXPLICIT OR BUILD_JAVA_EXPLICIT)
    MESSAGE( ERROR "Cannot build client bindings" )
  ENDIF( BUILD_PYTHON_EXPLICIT OR BUILD_RUBY_EXPLICIT OR BUILD_PERL_EXPLICIT OR BUILD_JAVA_EXPLICIT)
ELSE ( NOT SWIG_EXECUTABLE )
  MESSAGE( STATUS "SWIG found at ${SWIG_EXECUTABLE}" )
  ADD_SUBDIRECTORY(bindings)
ENDIF ( NOT SWIG_EXECUTABLE )

# curl

INCLUDE(FindCURL)
IF ( NOT CURL_FOUND)
  MESSAGE( FATAL_ERROR " curl not found" )
ELSE ( NOT CURL_FOUND)
  INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIR})
ENDIF( NOT CURL_FOUND)

# xml2

INCLUDE(FindLibXml2)
IF ( NOT LIBXML2_FOUND)
  MESSAGE( FATAL_ERROR " libxml2 not found" )
ELSE ( NOT LIBXML2_FOUND)
  INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
ENDIF( NOT LIBXML2_FOUND)

# pthreads

INCLUDE(FindThreads)
IF( NOT CMAKE_USE_PTHREADS_INIT )
 MESSAGE( FATAL_ERROR " openwsman needs pthread" )
ELSE( NOT CMAKE_USE_PTHREADS_INIT )
 SET(USE_PTHREAD TRUE)
{'fraction_non_alphanumeric': 0.11400334827455852, 'fraction_numerical': 0.005616460549765081, 'mean_word_length': 5.731370410759724, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3895249', 'n_tokens_mistral': 7556, 'n_tokens_neox': 7037, 'n_words': 1522}