<p>Alexander Traud has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/8636">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">BuildSystem: Add support for building RADIUS with radcli.<br><br>Radcli is yet another RADIUS client library, generally compatible with<br>freeradius and radiusclient-ng.<br><br>This commit adds autoconf option for detecting it as well and changes<br>cdr_radius and cel_radius to use its header file in that case.<br><br>ASTERISK-26540<br>Reported by: Tzafrir Cohen<br><br>Change-Id: Icc056d476b7acf481309219e9abdca416866c6ec<br>---<br>M CHANGES<br>M cdr/cdr_radius.c<br>M cel/cel_radius.c<br>M configure<br>M configure.ac<br>M include/asterisk/autoconfig.h.in<br>6 files changed, 128 insertions(+), 15 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/36/8636/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/CHANGES b/CHANGES<br>index 753f6ae..6c6eb33 100644<br>--- a/CHANGES<br>+++ b/CHANGES<br>@@ -12,6 +12,12 @@<br> --- Functionality changes from Asterisk 13.20.0 to Asterisk 13.21.0 ----------<br> ------------------------------------------------------------------------------<br> <br>+Build System<br>+------------------<br>+ * RADIUS backends for CEL and CDR can now also be built using the radcli<br>+   client library, in addition to the existing support for building them<br>+   using either freeradius or radiusclient-ng.<br>+<br> Core<br> ------------------<br>  * A new configuration option "genericplc_on_equal_codecs" was added to the<br>diff --git a/cdr/cdr_radius.c b/cdr/cdr_radius.c<br>index 50d0dd0..f2f07f9 100644<br>--- a/cdr/cdr_radius.c<br>+++ b/cdr/cdr_radius.c<br>@@ -41,11 +41,7 @@<br> <br> ASTERISK_FILE_VERSION(__FILE__, "$Revision$")<br> <br>-#ifdef FREERADIUS_CLIENT<br>-#include <freeradius-client.h><br>-#else<br>-#include <radiusclient-ng.h><br>-#endif<br>+#include RADIUS_HEADER_STR<br> <br> #include "asterisk/channel.h"<br> #include "asterisk/cdr.h"<br>diff --git a/cel/cel_radius.c b/cel/cel_radius.c<br>index 7b41887..716e1c3 100644<br>--- a/cel/cel_radius.c<br>+++ b/cel/cel_radius.c<br>@@ -35,11 +35,7 @@<br> <br> ASTERISK_FILE_VERSION(__FILE__, "$Rev$")<br> <br>-#ifdef FREERADIUS_CLIENT<br>-#include <freeradius-client.h><br>-#else<br>-#include <radiusclient-ng.h><br>-#endif<br>+#include RADIUS_HEADER_STR<br> <br> #include "asterisk/channel.h"<br> #include "asterisk/cel.h"<br>diff --git a/configure b/configure<br>index c4f730b..7b1247c 100755<br>--- a/configure<br>+++ b/configure<br>@@ -29360,7 +29360,7 @@<br> <br> if test "x${PBX_RADIUS}" = "x1"; then<br> <br>-$as_echo "#define FREERADIUS_CLIENT /**/" >>confdefs.h<br>+$as_echo "#define RADIUS_HEADER_STR <freeradius-client.h>" >>confdefs.h<br> <br> else<br> <br>@@ -29459,6 +29459,113 @@<br> fi<br> <br> <br>+       if test "x${PBX_RADIUS}" = "x1"; then<br>+<br>+$as_echo "#define RADIUS_HEADER_STR <radiusclient-ng.h>" >>confdefs.h<br>+<br>+        else<br>+<br>+if test "x${PBX_RADIUS}" != "x1" -a "${USE_RADIUS}" != "no"; then<br>+   pbxlibdir=""<br>+   # if --with-RADIUS=DIR has been specified, use it.<br>+   if test "x${RADIUS_DIR}" != "x"; then<br>+      if test -d ${RADIUS_DIR}/lib; then<br>+         pbxlibdir="-L${RADIUS_DIR}/lib"<br>+      else<br>+         pbxlibdir="-L${RADIUS_DIR}"<br>+      fi<br>+   fi<br>+<br>+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"<br>+      CFLAGS="${CFLAGS} "<br>+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rc_read_config in -lradcli" >&5<br>+$as_echo_n "checking for rc_read_config in -lradcli... " >&6; }<br>+if ${ac_cv_lib_radcli_rc_read_config+:} false; then :<br>+  $as_echo_n "(cached) " >&6<br>+else<br>+  ac_check_lib_save_LIBS=$LIBS<br>+LIBS="-lradcli ${pbxlibdir}  $LIBS"<br>+cat confdefs.h - <<_ACEOF >conftest.$ac_ext<br>+/* end confdefs.h.  */<br>+<br>+/* Override any GCC internal prototype to avoid an error.<br>+   Use char because int might match the return type of a GCC<br>+   builtin and then its argument prototype would still apply.  */<br>+#ifdef __cplusplus<br>+extern "C"<br>+#endif<br>+char rc_read_config ();<br>+int<br>+main ()<br>+{<br>+return rc_read_config ();<br>+  ;<br>+  return 0;<br>+}<br>+_ACEOF<br>+if ac_fn_c_try_link "$LINENO"; then :<br>+  ac_cv_lib_radcli_rc_read_config=yes<br>+else<br>+  ac_cv_lib_radcli_rc_read_config=no<br>+fi<br>+rm -f core conftest.err conftest.$ac_objext \<br>+    conftest$ac_exeext conftest.$ac_ext<br>+LIBS=$ac_check_lib_save_LIBS<br>+fi<br>+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_radcli_rc_read_config" >&5<br>+$as_echo "$ac_cv_lib_radcli_rc_read_config" >&6; }<br>+if test "x$ac_cv_lib_radcli_rc_read_config" = xyes; then :<br>+  AST_RADIUS_FOUND=yes<br>+else<br>+  AST_RADIUS_FOUND=no<br>+fi<br>+<br>+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"<br>+<br>+<br>+   # now check for the header.<br>+   if test "${AST_RADIUS_FOUND}" = "yes"; then<br>+      RADIUS_LIB="${pbxlibdir} -lradcli "<br>+      # if --with-RADIUS=DIR has been specified, use it.<br>+      if test "x${RADIUS_DIR}" != "x"; then<br>+         RADIUS_INCLUDE="-I${RADIUS_DIR}/include"<br>+      fi<br>+      RADIUS_INCLUDE="${RADIUS_INCLUDE} "<br>+<br>+         # check for the header<br>+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"<br>+         CPPFLAGS="${CPPFLAGS} ${RADIUS_INCLUDE}"<br>+         ac_fn_c_check_header_mongrel "$LINENO" "radcli/radcli.h" "ac_cv_header_radcli_radcli_h" "$ac_includes_default"<br>+if test "x$ac_cv_header_radcli_radcli_h" = xyes; then :<br>+  RADIUS_HEADER_FOUND=1<br>+else<br>+  RADIUS_HEADER_FOUND=0<br>+fi<br>+<br>+<br>+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"<br>+<br>+      if test "x${RADIUS_HEADER_FOUND}" = "x0" ; then<br>+         RADIUS_LIB=""<br>+         RADIUS_INCLUDE=""<br>+      else<br>+<br>+         PBX_RADIUS=1<br>+         cat >>confdefs.h <<_ACEOF<br>+#define HAVE_RADIUS 1<br>+_ACEOF<br>+<br>+      fi<br>+   fi<br>+fi<br>+<br>+<br>+              if test "x${PBX_RADIUS}" = "x1"; then<br>+<br>+$as_echo "#define RADIUS_HEADER_STR <radcli/radcli.h>" >>confdefs.h<br>+<br>+          fi<br>+   fi<br> fi<br> <br> <br>diff --git a/configure.ac b/configure.ac<br>index 62f8239..dad0b8d 100644<br>--- a/configure.ac<br>+++ b/configure.ac<br>@@ -2373,9 +2373,17 @@<br> # just different header filenames and different SONAMEs<br> AST_EXT_LIB_CHECK([RADIUS], [freeradius-client], [rc_read_config], [freeradius-client.h])<br> if test "x${PBX_RADIUS}" = "x1"; then<br>-     AC_DEFINE(FREERADIUS_CLIENT, [], [Use the FreeRADIUS-client library])<br>+        AC_DEFINE(RADIUS_HEADER_STR, [<freeradius-client.h>], [Name of RADIUS library include header])<br> else<br>   AST_EXT_LIB_CHECK([RADIUS], [radiusclient-ng], [rc_read_config], [radiusclient-ng.h])<br>+        if test "x${PBX_RADIUS}" = "x1"; then<br>+            AC_DEFINE(RADIUS_HEADER_STR, [<radiusclient-ng.h>], [Name of RADIUS library include header])<br>+   else<br>+         AST_EXT_LIB_CHECK([RADIUS], [radcli], [rc_read_config], [radcli/radcli.h])<br>+           if test "x${PBX_RADIUS}" = "x1"; then<br>+                    AC_DEFINE(RADIUS_HEADER_STR, [<radcli/radcli.h>], [Name of RADIUS library include header])<br>+             fi<br>+   fi<br> fi<br> <br> AST_EXT_LIB_CHECK([COROSYNC], [cpg], [cpg_join], [corosync/cpg.h], [-lcpg -lcfg])<br>diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in<br>index e5cf7f9..0fa2859 100644<br>--- a/include/asterisk/autoconfig.h.in<br>+++ b/include/asterisk/autoconfig.h.in<br>@@ -32,9 +32,6 @@<br> /* Define to 1 if using `alloca.c'. */<br> #undef C_ALLOCA<br> <br>-/* Use the FreeRADIUS-client library */<br>-#undef FREERADIUS_CLIENT<br>-<br> /* Define to 1 if anonymous semaphores work. */<br> #undef HAS_WORKING_SEMAPHORE<br> <br>@@ -1298,6 +1295,9 @@<br> /* Define if your system needs braces around PTHREAD_ONCE_INIT */<br> #undef PTHREAD_ONCE_INIT_NEEDS_BRACES<br> <br>+/* Name of RADIUS library include header */<br>+#undef RADIUS_HEADER_STR<br>+<br> /* Define to the type of arg 1 for `select'. */<br> #undef SELECT_TYPE_ARG1<br> <br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/8636">change 8636</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/8636"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Icc056d476b7acf481309219e9abdca416866c6ec </div>
<div style="display:none"> Gerrit-Change-Number: 8636 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Alexander Traud <pabstraud@compuserve.com> </div>