ftmod_libpri: Add configure check for pri_maintenance_service()
Said function has been added in libpri-1.4.11 and breaks building with older libpri versions (i.e. the passive one for ftmod_pritap). Check for pri_maintenance_service() in configure and disable the "maintenance" subcommand if it is not available. Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
This commit is contained in:
parent
1e5beafe97
commit
88e75bf9d7
|
@ -283,6 +283,19 @@ then
|
|||
AC_MSG_NOTICE([You will need libpri-1.4.12_beta1 or newer for AOC event support])]
|
||||
)
|
||||
|
||||
|
||||
AC_MSG_CHECKING([whether libpri has pri_maintenance_service()])
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[extern int pri_maintenance_service(void);],
|
||||
[pri_maintenance_service();]
|
||||
)],
|
||||
[AC_DEFINE([HAVE_LIBPRI_MAINT_SERVICE], [1], [libpri has pri_maintenance_service()])
|
||||
AC_MSG_RESULT([yes])],
|
||||
[AC_MSG_RESULT([no])
|
||||
AC_MSG_NOTICE([You will need libpri-1.4.11 or newer for the ftdm libpri maintenance set of commands])]
|
||||
)
|
||||
|
||||
# libpri is available, set variables for Makefile(.am)
|
||||
AC_SUBST([LIBPRI_LIBS], [-lpri])
|
||||
AC_SUBST([LIBPRI_LDFLAGS])
|
||||
|
|
|
@ -207,6 +207,7 @@ static int parse_debug(const char *in, uint32_t *flags)
|
|||
return res;
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBPRI_MAINT_SERVICE
|
||||
/**
|
||||
* \brief Parses a change status string to flags
|
||||
* \param in change status string to parse for
|
||||
|
@ -232,6 +233,8 @@ static int parse_change_status(const char *in)
|
|||
|
||||
return flags;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static int print_debug(uint32_t flags, char *tmp, const int size)
|
||||
{
|
||||
|
@ -441,7 +444,9 @@ static const char *ftdm_libpri_usage =
|
|||
"libpri kill <span>\n"
|
||||
"libpri reset <span>\n"
|
||||
"libpri restart <span> <channel/all>\n"
|
||||
#ifdef HAVE_LIBPRI_MAINT_SERVICE
|
||||
"libpri maintenance <span> <channel/all> <in/maint/out>\n"
|
||||
#endif
|
||||
"libpri debug <span> [all|none|flag,...flagN]\n"
|
||||
"libpri msn <span>\n"
|
||||
"\n"
|
||||
|
@ -650,6 +655,7 @@ static FIO_API_FUNCTION(ftdm_libpri_api)
|
|||
goto done;
|
||||
}
|
||||
}
|
||||
#ifdef HAVE_LIBPRI_MAINT_SERVICE
|
||||
if (!strcasecmp(argv[0], "maintenance") && argc > 3) {
|
||||
ftdm_span_t *span = NULL;
|
||||
if (ftdm_span_find_by_name(argv[1], &span) == FTDM_SUCCESS) {
|
||||
|
@ -681,6 +687,7 @@ static FIO_API_FUNCTION(ftdm_libpri_api)
|
|||
goto done;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
/* zero args print usage */
|
||||
stream->write_function(stream, ftdm_libpri_usage);
|
||||
|
|
Loading…
Reference in New Issue