From 88e75bf9d7ab44ceb679c8cac639a7235fbfd7bc Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Tue, 8 Jan 2013 14:30:59 +0100 Subject: [PATCH] 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 --- libs/freetdm/configure.ac | 13 +++++++++++++ libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c | 7 +++++++ 2 files changed, 20 insertions(+) diff --git a/libs/freetdm/configure.ac b/libs/freetdm/configure.ac index 93e30f6d40..ce5450abc8 100644 --- a/libs/freetdm/configure.ac +++ b/libs/freetdm/configure.ac @@ -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]) diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index 0e22b0f350..d1c74cd42e 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -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 \n" "libpri reset \n" "libpri restart \n" +#ifdef HAVE_LIBPRI_MAINT_SERVICE "libpri maintenance \n" +#endif "libpri debug [all|none|flag,...flagN]\n" "libpri msn \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);