summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure122
-rw-r--r--configure.ac2
-rw-r--r--include/asterisk/autoconfig.h.in3
-rw-r--r--res/res_corosync.c6
4 files changed, 132 insertions, 1 deletions
diff --git a/configure b/configure
index 459f6eac7..9a468950d 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.ac Revision: 360490 .
+# From configure.ac Revision: 361968 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.68 for asterisk trunk.
#
@@ -1005,6 +1005,10 @@ PBX_CURSES
CURSES_DIR
CURSES_INCLUDE
CURSES_LIB
+PBX_COROSYNC_CFG_STATE_TRACK
+COROSYNC_CFG_STATE_TRACK_DIR
+COROSYNC_CFG_STATE_TRACK_INCLUDE
+COROSYNC_CFG_STATE_TRACK_LIB
PBX_COROSYNC
COROSYNC_DIR
COROSYNC_INCLUDE
@@ -8101,6 +8105,18 @@ fi
+COROSYNC_CFG_STATE_TRACK_DESCRIP="A callback only in corosync 1.x"
+COROSYNC_CFG_STATE_TRACK_OPTION=cfg
+COROSYNC_CFG_STATE_TRACK_DIR=${COROSYNC_DIR}
+
+PBX_COROSYNC_CFG_STATE_TRACK=0
+
+
+
+
+
+
+
CURSES_DESCRIP="curses"
CURSES_OPTION="curses"
PBX_CURSES=0
@@ -26002,6 +26018,110 @@ fi
+if test "x${PBX_COROSYNC_CFG_STATE_TRACK}" != "x1" -a "${USE_COROSYNC_CFG_STATE_TRACK}" != "no"; then
+ pbxlibdir=""
+ # if --with-COROSYNC_CFG_STATE_TRACK=DIR has been specified, use it.
+ if test "x${COROSYNC_CFG_STATE_TRACK_DIR}" != "x"; then
+ if test -d ${COROSYNC_CFG_STATE_TRACK_DIR}/lib; then
+ pbxlibdir="-L${COROSYNC_CFG_STATE_TRACK_DIR}/lib"
+ else
+ pbxlibdir="-L${COROSYNC_CFG_STATE_TRACK_DIR}"
+ fi
+ fi
+ pbxfuncname="corosync_cfg_state_track"
+ if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers
+ AST_COROSYNC_CFG_STATE_TRACK_FOUND=yes
+ else
+ ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+ CFLAGS="${CFLAGS} "
+ as_ac_Lib=`$as_echo "ac_cv_lib_cfg_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lcfg" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lcfg... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lcfg ${pbxlibdir} -lcfg $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char ${pbxfuncname} ();
+int
+main ()
+{
+return ${pbxfuncname} ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ eval "$as_ac_Lib=yes"
+else
+ eval "$as_ac_Lib=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+ AST_COROSYNC_CFG_STATE_TRACK_FOUND=yes
+else
+ AST_COROSYNC_CFG_STATE_TRACK_FOUND=no
+fi
+
+ CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+ fi
+
+ # now check for the header.
+ if test "${AST_COROSYNC_CFG_STATE_TRACK_FOUND}" = "yes"; then
+ COROSYNC_CFG_STATE_TRACK_LIB="${pbxlibdir} -lcfg -lcfg"
+ # if --with-COROSYNC_CFG_STATE_TRACK=DIR has been specified, use it.
+ if test "x${COROSYNC_CFG_STATE_TRACK_DIR}" != "x"; then
+ COROSYNC_CFG_STATE_TRACK_INCLUDE="-I${COROSYNC_CFG_STATE_TRACK_DIR}/include"
+ fi
+ COROSYNC_CFG_STATE_TRACK_INCLUDE="${COROSYNC_CFG_STATE_TRACK_INCLUDE} "
+ if test "xcorosync/cfg.h" = "x" ; then # no header, assume found
+ COROSYNC_CFG_STATE_TRACK_HEADER_FOUND="1"
+ else # check for the header
+ ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+ CPPFLAGS="${CPPFLAGS} ${COROSYNC_CFG_STATE_TRACK_INCLUDE}"
+ ac_fn_c_check_header_mongrel "$LINENO" "corosync/cfg.h" "ac_cv_header_corosync_cfg_h" "$ac_includes_default"
+if test "x$ac_cv_header_corosync_cfg_h" = xyes; then :
+ COROSYNC_CFG_STATE_TRACK_HEADER_FOUND=1
+else
+ COROSYNC_CFG_STATE_TRACK_HEADER_FOUND=0
+fi
+
+
+ CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+ fi
+ if test "x${COROSYNC_CFG_STATE_TRACK_HEADER_FOUND}" = "x0" ; then
+ COROSYNC_CFG_STATE_TRACK_LIB=""
+ COROSYNC_CFG_STATE_TRACK_INCLUDE=""
+ else
+ if test "x${pbxfuncname}" = "x" ; then # only checking headers -> no library
+ COROSYNC_CFG_STATE_TRACK_LIB=""
+ fi
+ PBX_COROSYNC_CFG_STATE_TRACK=1
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_COROSYNC_CFG_STATE_TRACK 1
+_ACEOF
+
+ fi
+ fi
+fi
+
+
+
if test "x${PBX_SPEEX}" != "x1" -a "${USE_SPEEX}" != "no"; then
pbxlibdir=""
diff --git a/configure.ac b/configure.ac
index 8e22214dd..5d1064499 100644
--- a/configure.ac
+++ b/configure.ac
@@ -383,6 +383,7 @@ AST_EXT_LIB_SETUP([BKTR], [Stack Backtrace], [execinfo])
AST_EXT_LIB_SETUP([BLUETOOTH], [Bluetooth], [bluetooth])
AST_EXT_LIB_SETUP([CAP], [POSIX 1.e capabilities], [cap])
AST_EXT_LIB_SETUP([COROSYNC], [Corosync], [cpg])
+AST_EXT_LIB_SETUP_OPTIONAL([COROSYNC_CFG_STATE_TRACK], [A callback only in corosync 1.x], [COROSYNC], [cfg])
AST_EXT_LIB_SETUP([CURSES], [curses], [curses])
AST_EXT_LIB_SETUP([CRYPTO], [OpenSSL Cryptography], [crypto])
AST_EXT_LIB_SETUP([DAHDI], [DAHDI], [dahdi])
@@ -2000,6 +2001,7 @@ AST_EXT_LIB_CHECK([LUA], [lua], [luaL_register], [lua.h], [-lm])
AST_EXT_LIB_CHECK([RADIUS], [radiusclient-ng], [rc_read_config], [radiusclient-ng.h])
AST_EXT_LIB_CHECK([COROSYNC], [cpg], [cpg_join], [corosync/cpg.h], [-lcfg])
+AST_EXT_LIB_CHECK([COROSYNC_CFG_STATE_TRACK], [cfg], [corosync_cfg_state_track], [corosync/cfg.h], [-lcfg])
AST_EXT_LIB_CHECK([SPEEX], [speex], [speex_encode], [speex/speex.h], [-lm])
diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in
index 6ba9d6527..f7ef9be89 100644
--- a/include/asterisk/autoconfig.h.in
+++ b/include/asterisk/autoconfig.h.in
@@ -140,6 +140,9 @@
/* Define to 1 if you have the Corosync library. */
#undef HAVE_COROSYNC
+/* Define to 1 if COROSYNC has the A callback only in corosync 1.x feature. */
+#undef HAVE_COROSYNC_CFG_STATE_TRACK
+
/* Define to 1 if you have the `cos' function. */
#undef HAVE_COS
diff --git a/res/res_corosync.c b/res/res_corosync.c
index 95a0e83dd..72c3b6511 100644
--- a/res/res_corosync.c
+++ b/res/res_corosync.c
@@ -68,15 +68,19 @@ static struct {
static cpg_handle_t cpg_handle;
static corosync_cfg_handle_t cfg_handle;
+#ifdef HAVE_COROSYNC_CFG_STATE_TRACK
static void cfg_state_track_cb(
corosync_cfg_state_notification_buffer_t *notification_buffer,
cs_error_t error);
+#endif /* HAVE_COROSYNC_CFG_STATE_TRACK */
static void cfg_shutdown_cb(corosync_cfg_handle_t cfg_handle,
corosync_cfg_shutdown_flags_t flags);
static corosync_cfg_callbacks_t cfg_callbacks = {
+#ifdef HAVE_COROSYNC_CFG_STATE_TRACK
.corosync_cfg_state_track_callback = cfg_state_track_cb,
+#endif /* HAVE_COROSYNC_CFG_STATE_TRACK */
.corosync_cfg_shutdown_callback = cfg_shutdown_cb,
};
@@ -95,11 +99,13 @@ static cpg_callbacks_t cpg_callbacks = {
static void ast_event_cb(const struct ast_event *event, void *data);
+#ifdef HAVE_COROSYNC_CFG_STATE_TRACK
static void cfg_state_track_cb(
corosync_cfg_state_notification_buffer_t *notification_buffer,
cs_error_t error)
{
}
+#endif /* HAVE_COROSYNC_CFG_STATE_TRACK */
static void cfg_shutdown_cb(corosync_cfg_handle_t cfg_handle,
corosync_cfg_shutdown_flags_t flags)