ftmod_libpri: Check for required features in configure and remove old-style log callbacks

Non-PRI_NEW_SET_API logging callbacks were only available in libpri-1.0 and older,
which also lacks PRI_IO_FUNCS (required) and wouldn't work anyway.

Explicitly check for both PRI_* feature defines at configure time and reject libpri
versions that lack them.

Remove the non-PRI_NEW_SET_API logging callbacks in ftmod_libpri.c.

Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
This commit is contained in:
Stefan Knoblich 2012-04-14 01:39:25 +02:00
parent 020724e103
commit 997550c511
2 changed files with 15 additions and 20 deletions

View File

@ -236,6 +236,21 @@ then
AC_MSG_ERROR([libpri not found or unusable (see config.log for details)])] AC_MSG_ERROR([libpri not found or unusable (see config.log for details)])]
) )
AC_MSG_CHECKING([whether libpri is too old])
AC_PREPROC_IFELSE(
[AC_LANG_PROGRAM(
[#include <libpri.h>],
[#if !defined(PRI_IO_FUNCS)
#error "libpri is lacking PRI_IO_FUNCS"
#elif !defined(PRI_NEW_SET_API)
#error "libpri is lacking PRI_NEW_SET_API"
#endif]
)],
[AC_MSG_RESULT([no])],
[AC_MSG_RESULT([yes])
AC_MSG_ERROR([Your version of libpri is too old (pre 1.2), please update!])]
)
AC_MSG_CHECKING([whether libpri has BRI support]) AC_MSG_CHECKING([whether libpri has BRI support])
AC_LINK_IFELSE( AC_LINK_IFELSE(
[AC_LANG_PROGRAM( [AC_LANG_PROGRAM(

View File

@ -115,7 +115,6 @@ static FIO_CHANNEL_REQUEST_FUNCTION(isdn_channel_request)
} }
#ifdef PRI_NEW_SET_API
/** /**
* \brief Logs a libpri message * \brief Logs a libpri message
* \param pri libpri structure * \param pri libpri structure
@ -147,25 +146,6 @@ static void s_pri_error(struct pri *pri, char *s)
ftdm_log(FTDM_LOG_ERROR, "%s", s); ftdm_log(FTDM_LOG_ERROR, "%s", s);
} }
} }
#else /* !PRI_NEW_SET_API */
/**
* \brief Logs a libpri message
* \param s Message string
*/
static void s_pri_message(char *s)
{
ftdm_log(FTDM_LOG_DEBUG, "%s", s);
}
/**
* \brief Logs a libpri error
* \param s Error string
*/
static void s_pri_error(char *s)
{
ftdm_log(FTDM_LOG_ERROR, "%s", s);
}
#endif
#define PRI_DEBUG_Q921_ALL (PRI_DEBUG_Q921_RAW | PRI_DEBUG_Q921_DUMP | PRI_DEBUG_Q921_STATE) #define PRI_DEBUG_Q921_ALL (PRI_DEBUG_Q921_RAW | PRI_DEBUG_Q921_DUMP | PRI_DEBUG_Q921_STATE)