mirror of https://github.com/Icinga/icinga2.git
Fixed Solaris compatibility.
This commit is contained in:
parent
071853034d
commit
132a62f4eb
|
@ -52,14 +52,17 @@ libbase_la_CPPFLAGS = \
|
|||
-DI2_BASE_BUILD \
|
||||
$(LTDLINCL) \
|
||||
$(BOOST_CPPFLAGS) \
|
||||
$(OPENSSL_INCLUDES) \
|
||||
-I${top_srcdir}/third-party/mmatch
|
||||
|
||||
libbase_la_LDFLAGS = \
|
||||
$(BOOST_LDFLAGS) \
|
||||
$(OPENSSL_LDFLAGS) \
|
||||
-no-undefined \
|
||||
@RELEASE_INFO@ \
|
||||
@VERSION_INFO@
|
||||
|
||||
libbase_la_LIBADD = \
|
||||
$(LIBLTDL) \
|
||||
$(BOOST_LDFLAGS) \
|
||||
$(OPENSSL_LIBS) \
|
||||
${top_builddir}/third-party/mmatch/libmmatch.la
|
||||
|
|
|
@ -37,7 +37,13 @@ int delegate_fwd(int (TObject::*function)(TArgs), weak_ptr<TObject> wref, TArgs
|
|||
template<class TObject, class TArgs>
|
||||
function<int (TArgs)> bind_weak(int (TObject::*function)(TArgs), const weak_ptr<TObject>& wref)
|
||||
{
|
||||
return bind(&delegate_fwd<TObject, TArgs>, function, wref, placeholders::_1);
|
||||
return bind(&delegate_fwd<TObject, TArgs>, function, wref,
|
||||
#ifdef HAVE_BOOST
|
||||
_1
|
||||
#else /* HAVE_BOOST */
|
||||
placeholders::_1
|
||||
#endif /* HAVE_BOOST */
|
||||
);
|
||||
}
|
||||
|
||||
template<class TObject, class TArgs>
|
||||
|
|
|
@ -169,7 +169,7 @@ int Socket::GetLastSocketError(void)
|
|||
*
|
||||
* @param ex An exception.
|
||||
*/
|
||||
void Socket::HandleSocketError(const exception& ex)
|
||||
void Socket::HandleSocketError(const std::exception& ex)
|
||||
{
|
||||
if (OnError.HasObservers()) {
|
||||
SocketErrorEventArgs sea(ex);
|
||||
|
@ -290,4 +290,4 @@ SocketException::SocketException(const string& message, int errorCode)
|
|||
|
||||
string msg = message + ": " + details;
|
||||
SetMessage(msg.c_str());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,9 +29,9 @@ namespace icinga {
|
|||
*/
|
||||
struct I2_BASE_API SocketErrorEventArgs : public EventArgs
|
||||
{
|
||||
const exception& Exception;
|
||||
const std::exception& Exception;
|
||||
|
||||
SocketErrorEventArgs(const exception& ex)
|
||||
SocketErrorEventArgs(const std::exception& ex)
|
||||
: Exception(ex) { }
|
||||
};
|
||||
|
||||
|
@ -78,7 +78,7 @@ protected:
|
|||
|
||||
int GetError(void) const;
|
||||
static int GetLastSocketError(void);
|
||||
void HandleSocketError(const exception& ex);
|
||||
void HandleSocketError(const std::exception& ex);
|
||||
|
||||
virtual void CloseInternal(bool from_dtor);
|
||||
|
||||
|
|
|
@ -5,6 +5,3 @@ include:
|
|||
bcp --boost=$(BOOST_PATH)/include tr1 smart_ptr bind function make_shared boost && \
|
||||
rm -Rf include && mkdir include && \
|
||||
mv boost/boost include/
|
||||
|
||||
clean:
|
||||
rm -Rf include
|
||||
|
|
|
@ -16,13 +16,13 @@ configfile_la_CPPFLAGS = \
|
|||
-I${top_srcdir}/third-party/cJSON
|
||||
|
||||
configfile_la_LDFLAGS = \
|
||||
$(BOOST_LDFLAGS) \
|
||||
-module \
|
||||
-no-undefined \
|
||||
@RELEASE_INFO@ \
|
||||
@VERSION_INFO@
|
||||
|
||||
configfile_la_LIBADD = \
|
||||
$(BOOST_LDFLAGS) \
|
||||
$(top_builddir)/base/libbase.la \
|
||||
$(top_builddir)/icinga/libicinga.la \
|
||||
$(top_builddir)/third-party/cJSON/libcJSON.la
|
||||
|
|
|
@ -15,13 +15,13 @@ configrpc_la_CPPFLAGS = \
|
|||
-I${top_srcdir}/icinga
|
||||
|
||||
configrpc_la_LDFLAGS = \
|
||||
$(BOOST_LDFLAGS) \
|
||||
-module \
|
||||
-no-undefined \
|
||||
@RELEASE_INFO@ \
|
||||
@VERSION_INFO@
|
||||
|
||||
configrpc_la_LIBADD = \
|
||||
$(BOOST_LDFLAGS) \
|
||||
${top_builddir}/base/libbase.la \
|
||||
${top_builddir}/jsonrpc/libjsonrpc.la \
|
||||
${top_builddir}/icinga/libicinga.la
|
||||
|
|
|
@ -15,13 +15,13 @@ demo_la_CPPFLAGS = \
|
|||
-I${top_srcdir}/icinga
|
||||
|
||||
demo_la_LDFLAGS = \
|
||||
$(BOOST_LDFLAGS) \
|
||||
-module \
|
||||
-no-undefined \
|
||||
@RELEASE_INFO@ \
|
||||
@VERSION_INFO@
|
||||
|
||||
demo_la_LIBADD = \
|
||||
$(BOOST_LDFLAGS) \
|
||||
${top_builddir}/base/libbase.la \
|
||||
${top_builddir}/jsonrpc/libjsonrpc.la \
|
||||
${top_builddir}/icinga/libicinga.la
|
||||
|
|
|
@ -17,13 +17,13 @@ discovery_la_CPPFLAGS = \
|
|||
-I${top_srcdir}/icinga
|
||||
|
||||
discovery_la_LDFLAGS = \
|
||||
$(BOOST_LDFLAGS) \
|
||||
-module \
|
||||
-no-undefined \
|
||||
@RELEASE_INFO@ \
|
||||
@VERSION_INFO@
|
||||
|
||||
discovery_la_LIBADD = \
|
||||
$(BOOST_LDFLAGS) \
|
||||
${top_builddir}/base/libbase.la \
|
||||
${top_builddir}/jsonrpc/libjsonrpc.la \
|
||||
${top_builddir}/icinga/libicinga.la
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Check whether the given FLAG works with the current language's compiler
|
||||
# or gives an error. (Warnings, however, are ignored)
|
||||
#
|
||||
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
|
||||
# success/failure.
|
||||
#
|
||||
# If EXTRA-FLAGS is defined, it is added to the current language's default
|
||||
# flags (e.g. CFLAGS) when the check is done. The check is thus made with
|
||||
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
|
||||
# force the compiler to issue an error when a bad flag is given.
|
||||
#
|
||||
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
|
||||
# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
|
||||
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by the
|
||||
# Free Software Foundation, either version 3 of the License, or (at your
|
||||
# option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
# Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||
# gives unlimited permission to copy, distribute and modify the configure
|
||||
# scripts that are the output of Autoconf when processing the Macro. You
|
||||
# need not follow the terms of the GNU General Public License when using
|
||||
# or distributing such scripts, even though portions of the text of the
|
||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||
# all other use of the material that constitutes the Autoconf Macro.
|
||||
#
|
||||
# This special exception to the GPL applies to versions of the Autoconf
|
||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 2
|
||||
|
||||
AC_DEFUN([AX_CHECK_COMPILE_FLAG],
|
||||
[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX
|
||||
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
|
||||
AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
|
||||
ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
|
||||
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
|
||||
[AS_VAR_SET(CACHEVAR,[yes])],
|
||||
[AS_VAR_SET(CACHEVAR,[no])])
|
||||
_AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
|
||||
AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes],
|
||||
[m4_default([$2], :)],
|
||||
[m4_default([$3], :)])
|
||||
AS_VAR_POPDEF([CACHEVAR])dnl
|
||||
])dnl AX_CHECK_COMPILE_FLAGS
|
|
@ -0,0 +1,124 @@
|
|||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_check_openssl.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CHECK_OPENSSL([action-if-found[, action-if-not-found]])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Look for OpenSSL in a number of default spots, or in a user-selected
|
||||
# spot (via --with-openssl). Sets
|
||||
#
|
||||
# OPENSSL_INCLUDES to the include directives required
|
||||
# OPENSSL_LIBS to the -l directives required
|
||||
# OPENSSL_LDFLAGS to the -L or -R flags required
|
||||
#
|
||||
# and calls ACTION-IF-FOUND or ACTION-IF-NOT-FOUND appropriately
|
||||
#
|
||||
# This macro sets OPENSSL_INCLUDES such that source files should use the
|
||||
# openssl/ directory in include directives:
|
||||
#
|
||||
# #include <openssl/hmac.h>
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2009,2010 Zmanda Inc. <http://www.zmanda.com/>
|
||||
# Copyright (c) 2009,2010 Dustin J. Mitchell <dustin@zmanda.com>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 8
|
||||
|
||||
AU_ALIAS([CHECK_SSL], [AX_CHECK_OPENSSL])
|
||||
AC_DEFUN([AX_CHECK_OPENSSL], [
|
||||
found=false
|
||||
AC_ARG_WITH([openssl],
|
||||
[AS_HELP_STRING([--with-openssl=DIR],
|
||||
[root of the OpenSSL directory])],
|
||||
[
|
||||
case "$withval" in
|
||||
"" | y | ye | yes | n | no)
|
||||
AC_MSG_ERROR([Invalid --with-openssl value])
|
||||
;;
|
||||
*) ssldirs="$withval"
|
||||
;;
|
||||
esac
|
||||
], [
|
||||
# if pkg-config is installed and openssl has installed a .pc file,
|
||||
# then use that information and don't search ssldirs
|
||||
AC_PATH_PROG([PKG_CONFIG], [pkg-config])
|
||||
if test x"$PKG_CONFIG" != x""; then
|
||||
OPENSSL_LDFLAGS=`$PKG_CONFIG openssl --libs-only-L 2>/dev/null`
|
||||
if test $? = 0; then
|
||||
OPENSSL_LIBS=`$PKG_CONFIG openssl --libs-only-l 2>/dev/null`
|
||||
OPENSSL_INCLUDES=`$PKG_CONFIG openssl --cflags-only-I 2>/dev/null`
|
||||
found=true
|
||||
fi
|
||||
fi
|
||||
|
||||
# no such luck; use some default ssldirs
|
||||
if ! $found; then
|
||||
ssldirs="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr"
|
||||
fi
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
# note that we #include <openssl/foo.h>, so the OpenSSL headers have to be in
|
||||
# an 'openssl' subdirectory
|
||||
|
||||
if ! $found; then
|
||||
OPENSSL_INCLUDES=
|
||||
for ssldir in $ssldirs; do
|
||||
AC_MSG_CHECKING([for openssl/ssl.h in $ssldir])
|
||||
if test -f "$ssldir/include/openssl/ssl.h"; then
|
||||
OPENSSL_INCLUDES="-I$ssldir/include"
|
||||
OPENSSL_LDFLAGS="-L$ssldir/lib"
|
||||
OPENSSL_LIBS="-lssl -lcrypto"
|
||||
found=true
|
||||
AC_MSG_RESULT([yes])
|
||||
break
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
done
|
||||
|
||||
# if the file wasn't found, well, go ahead and try the link anyway -- maybe
|
||||
# it will just work!
|
||||
fi
|
||||
|
||||
# try the preprocessor and linker with our new flags,
|
||||
# being careful not to pollute the global LIBS, LDFLAGS, and CPPFLAGS
|
||||
|
||||
AC_MSG_CHECKING([whether compiling and linking against OpenSSL works])
|
||||
echo "Trying link with OPENSSL_LDFLAGS=$OPENSSL_LDFLAGS;" \
|
||||
"OPENSSL_LIBS=$OPENSSL_LIBS; OPENSSL_INCLUDES=$OPENSSL_INCLUDES" >&AS_MESSAGE_LOG_FD
|
||||
|
||||
save_LIBS="$LIBS"
|
||||
save_LDFLAGS="$LDFLAGS"
|
||||
save_CPPFLAGS="$CPPFLAGS"
|
||||
LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
|
||||
LIBS="$OPENSSL_LIBS $LIBS"
|
||||
CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS"
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM([#include <openssl/ssl.h>], [SSL_new(NULL)])],
|
||||
[
|
||||
AC_MSG_RESULT([yes])
|
||||
$1
|
||||
], [
|
||||
AC_MSG_RESULT([no])
|
||||
$2
|
||||
])
|
||||
CPPFLAGS="$save_CPPFLAGS"
|
||||
LDFLAGS="$save_LDFLAGS"
|
||||
LIBS="$save_LIBS"
|
||||
|
||||
AC_SUBST([OPENSSL_INCLUDES])
|
||||
AC_SUBST([OPENSSL_LIBS])
|
||||
AC_SUBST([OPENSSL_LDFLAGS])
|
||||
])
|
18
configure.ac
18
configure.ac
|
@ -33,7 +33,7 @@ AC_LANG_CPLUSPLUS
|
|||
AC_PROG_CC
|
||||
AC_LANG_C
|
||||
|
||||
LT_INIT([dlopen])
|
||||
LT_INIT([dlopen disable-static win32-dll])
|
||||
LT_CONFIG_LTDL_DIR([third-party/ltdl])
|
||||
LTDL_INIT
|
||||
|
||||
|
@ -54,7 +54,7 @@ AX_CXX_GCC_ABI_DEMANGLE
|
|||
AX_PTHREAD
|
||||
AX_BOOST_BASE
|
||||
AX_BOOST_UNIT_TEST_FRAMEWORK
|
||||
|
||||
AX_CHECK_OPENSSL([], [AC_MSG_ERROR([You need the OpenSSL headers and libraries in order to build this application])])
|
||||
AC_CHECK_LIB(ssl, SSL_new)
|
||||
AC_CHECK_LIB(crypto, X509_NAME_oneline)
|
||||
AC_CHECK_LIB(eay32, X509_NAME_oneline)
|
||||
|
@ -64,20 +64,6 @@ AC_CHECK_LIB(socket, getsockname)
|
|||
AC_CHECK_LIB(ws2_32, getsockname)
|
||||
AC_CHECK_LIB(shlwapi, PathRemoveFileSpecA)
|
||||
|
||||
AC_MSG_CHECKING([for OpenSSL])
|
||||
AC_LANG_PUSH(C)
|
||||
AC_COMPILE_IFELSE(
|
||||
AC_LANG_PROGRAM([[#include <openssl/ssl.h>]], []),
|
||||
[
|
||||
AC_MSG_RESULT([yes])
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([You need the OpenSSL headers and libraries in order to build this application])
|
||||
]
|
||||
)
|
||||
AC_LANG_POP(C)
|
||||
|
||||
AC_CHECK_LIB(sqlite3, sqlite3_open)
|
||||
|
||||
AC_MSG_CHECKING([for SQLite3])
|
||||
|
|
|
@ -15,8 +15,10 @@ icinga_CPPFLAGS = \
|
|||
-I${top_srcdir}/icinga \
|
||||
-I${top_srcdir}
|
||||
|
||||
icinga_LDFLAGS = \
|
||||
$(BOOST_LDFLAGS)
|
||||
|
||||
icinga_LDADD = \
|
||||
$(BOOST_LDFLAGS) \
|
||||
${top_builddir}/base/libbase.la \
|
||||
${top_builddir}/icinga/libicinga.la \
|
||||
-dlopen ${top_builddir}/components/configfile/configfile.la \
|
||||
|
|
|
@ -34,7 +34,9 @@ using namespace icinga;
|
|||
*/
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
LTDL_SET_PRELOADED_SYMBOLS();
|
||||
#endif /* _WIN32 */
|
||||
|
||||
IcingaApplication::Ptr instance = make_shared<IcingaApplication>();
|
||||
return instance->Run(argc, argv);
|
||||
|
|
|
@ -28,11 +28,11 @@ libicinga_la_CPPFLAGS = \
|
|||
-I${top_srcdir}
|
||||
|
||||
libicinga_la_LDFLAGS = \
|
||||
$(BOOST_LDFLAGS) \
|
||||
-no-undefined \
|
||||
@RELEASE_INFO@ \
|
||||
@VERSION_INFO@
|
||||
|
||||
libicinga_la_LIBADD = \
|
||||
$(BOOST_LDFLAGS) \
|
||||
${top_builddir}/jsonrpc/libjsonrpc.la \
|
||||
${top_builddir}/base/libbase.la
|
||||
|
|
|
@ -26,11 +26,11 @@ libjsonrpc_la_CPPFLAGS = \
|
|||
-I${top_srcdir}/third-party/cJSON
|
||||
|
||||
libjsonrpc_la_LDFLAGS = \
|
||||
$(BOOST_LDFLAGS) \
|
||||
-no-undefined \
|
||||
@RELEASE_INFO@ \
|
||||
@VERSION_INFO@
|
||||
|
||||
libjsonrpc_la_LIBADD = \
|
||||
$(BOOST_LDFLAGS) \
|
||||
${top_builddir}/base/libbase.la \
|
||||
${top_builddir}/third-party/cJSON/libcJSON.la
|
||||
|
|
Loading…
Reference in New Issue