[Asterisk-code-review] This commit adds a new beanstalkd functionality to the CDR b... (asterisk[master])

Nir Simionovich (GreenfieldTech - Israel) asteriskteam at digium.com
Mon Oct 16 10:25:28 CDT 2017


Nir Simionovich (GreenfieldTech - Israel) has uploaded this change for review. ( https://gerrit.asterisk.org/6815


Change subject: This commit adds a new beanstalkd functionality to the CDR backend.
......................................................................

This commit adds a new beanstalkd functionality to the CDR backend.

Change-Id: Icf8c7b376e1992d2916fc0b3e7886703edf6ec82
---
M build_tools/menuselect-deps.in
M configure
M configure.ac
M include/asterisk/autoconfig.h.in
M makeopts.in
5 files changed, 154 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/15/6815/1

diff --git a/build_tools/menuselect-deps.in b/build_tools/menuselect-deps.in
index ec70be0..9629ea5 100644
--- a/build_tools/menuselect-deps.in
+++ b/build_tools/menuselect-deps.in
@@ -1,5 +1,6 @@
 ALSA=@PBX_ALSA@
 BLUETOOTH=@PBX_BLUETOOTH@
+BEANSTALK=@PBX_BEANSTALK@
 COROSYNC=@PBX_COROSYNC@
 CRYPTO=@PBX_CRYPTO@
 BFD=@PBX_BFD@
diff --git a/configure b/configure
index 893f107..bc4b03c 100755
--- a/configure
+++ b/configure
@@ -991,6 +991,10 @@
 PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_DIR
 PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_INCLUDE
 PJSIP_DLG_CREATE_UAS_AND_INC_LOCK_LIB
+PBX_BEANSTALK
+BEANSTALK_DIR
+BEANSTALK_INCLUDE
+BEANSTALK_LIB
 PBX_PGSQL
 PGSQL_DIR
 PGSQL_INCLUDE
@@ -1430,6 +1434,7 @@
 with_osptk
 with_oss
 with_postgres
+with_beanstalk
 with_pjproject
 with_popt
 with_portaudio
@@ -2182,6 +2187,7 @@
   --with-osptk=PATH       use OSP Toolkit files in PATH
   --with-oss=PATH         use Open Sound System files in PATH
   --with-postgres=PATH    use PostgreSQL files in PATH
+  --with-beanstalk=PATH   use Beanstalk Job Queue files in PATH
   --with-pjproject=PATH   use PJPROJECT files in PATH
   --with-popt=PATH        use popt files in PATH
   --with-portaudio=PATH   use PortAudio files in PATH
@@ -11409,6 +11415,38 @@
 	*)
 	PGSQL_DIR="${withval}"
 	ac_mandatory_list="${ac_mandatory_list} PGSQL"
+	;;
+	esac
+
+fi
+
+
+
+
+
+
+
+
+    BEANSTALK_DESCRIP="Beanstalk Job Queue"
+    BEANSTALK_OPTION="beanstalk"
+    PBX_BEANSTALK=0
+
+# Check whether --with-beanstalk was given.
+if test "${with_beanstalk+set}" = set; then :
+  withval=$with_beanstalk;
+	case ${withval} in
+	n|no)
+	USE_BEANSTALK=no
+	# -1 is a magic value used by menuselect to know that the package
+	# was disabled, other than 'not found'
+	PBX_BEANSTALK=-1
+	;;
+	y|ye|yes)
+	ac_mandatory_list="${ac_mandatory_list} BEANSTALK"
+	;;
+	*)
+	BEANSTALK_DIR="${withval}"
+	ac_mandatory_list="${ac_mandatory_list} BEANSTALK"
 	;;
 	esac
 
@@ -25043,6 +25081,111 @@
 
 
 
+
+if test "x${PBX_BEANSTALK}" != "x1" -a "${USE_BEANSTALK}" != "no"; then
+   pbxlibdir=""
+   # if --with-BEANSTALK=DIR has been specified, use it.
+   if test "x${BEANSTALK_DIR}" != "x"; then
+      if test -d ${BEANSTALK_DIR}/lib; then
+         pbxlibdir="-L${BEANSTALK_DIR}/lib"
+      else
+         pbxlibdir="-L${BEANSTALK_DIR}"
+      fi
+   fi
+   pbxfuncname="bs_version"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_BEANSTALK_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_beanstalk_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lbeanstalk" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lbeanstalk... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lbeanstalk ${pbxlibdir}  $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_BEANSTALK_FOUND=yes
+else
+  AST_BEANSTALK_FOUND=no
+fi
+
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   if test "${AST_BEANSTALK_FOUND}" = "yes"; then
+      BEANSTALK_LIB="${pbxlibdir} -lbeanstalk "
+      # if --with-BEANSTALK=DIR has been specified, use it.
+      if test "x${BEANSTALK_DIR}" != "x"; then
+         BEANSTALK_INCLUDE="-I${BEANSTALK_DIR}/include"
+      fi
+      BEANSTALK_INCLUDE="${BEANSTALK_INCLUDE} "
+      if test "xbeanstalk.h" = "x" ; then	# no header, assume found
+         BEANSTALK_HEADER_FOUND="1"
+      else				# check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${BEANSTALK_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "beanstalk.h" "ac_cv_header_beanstalk_h" "$ac_includes_default"
+if test "x$ac_cv_header_beanstalk_h" = xyes; then :
+  BEANSTALK_HEADER_FOUND=1
+else
+  BEANSTALK_HEADER_FOUND=0
+fi
+
+
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${BEANSTALK_HEADER_FOUND}" = "x0" ; then
+         BEANSTALK_LIB=""
+         BEANSTALK_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then		# only checking headers -> no library
+            BEANSTALK_LIB=""
+         fi
+         PBX_BEANSTALK=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_BEANSTALK 1
+_ACEOF
+
+      fi
+   fi
+fi
+
+
+
 # possible places for oss definitions
 
 if test "x${PBX_OSS}" != "x1" -a "${USE_OSS}" != "no"; then
diff --git a/configure.ac b/configure.ac
index e714c54..618ff8d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -526,6 +526,7 @@
 AST_EXT_LIB_SETUP([OSPTK], [OSP Toolkit], [osptk])
 AST_EXT_LIB_SETUP([OSS], [Open Sound System], [oss])
 AST_EXT_LIB_SETUP([PGSQL], [PostgreSQL], [postgres])
+AST_EXT_LIB_SETUP([BEANSTALK], [Beanstalk Job Queue], [beanstalk])
 
 if test "x${PBX_PJPROJECT}" != "x1" ; then
 AST_EXT_LIB_SETUP([PJPROJECT], [PJPROJECT], [pjproject])
@@ -2170,6 +2171,9 @@
 
 AST_EXT_LIB_CHECK([BLUETOOTH], [bluetooth], [ba2str], [bluetooth/bluetooth.h])
 
+AST_EXT_LIB_CHECK([BEA
+NSTALK], [beanstalk], [bs_version], [beanstalk.h])
+
 # possible places for oss definitions
 AST_EXT_LIB_CHECK([OSS], [ossaudio], [], [linux/soundcard.h])
 AST_EXT_LIB_CHECK([OSS], [ossaudio], [], [sys/soundcard.h])
diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in
index b9b4e1f..c7a1908 100644
--- a/include/asterisk/autoconfig.h.in
+++ b/include/asterisk/autoconfig.h.in
@@ -115,6 +115,9 @@
    attribute. */
 #undef HAVE_ATTRIBUTE_warn_unused_result
 
+/* Define to 1 if you have the Beanstalk Job Queue library. */
+#undef HAVE_BEANSTALK
+
 /* Define to 1 if you have the Debug symbol decoding library. */
 #undef HAVE_BFD
 
diff --git a/makeopts.in b/makeopts.in
index 6a1164c..d45740d 100644
--- a/makeopts.in
+++ b/makeopts.in
@@ -383,3 +383,6 @@
 
 SNDFILE_INCLUDE=@SNDFILE_INCLUDE@
 SNDFILE_LIB=@SNDFILE_LIB@
+
+BEANSTALK_INCLUDE=@BEANSTALK_INCLUDE@
+BEANSTALK_LIB=@BEANSTALK_LIB@
\ No newline at end of file

-- 
To view, visit https://gerrit.asterisk.org/6815
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icf8c7b376e1992d2916fc0b3e7886703edf6ec82
Gerrit-Change-Number: 6815
Gerrit-PatchSet: 1
Gerrit-Owner: Nir Simionovich (GreenfieldTech - Israel) <nirs at greenfieldtech.net>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171016/c6222c8b/attachment.html>


More information about the asterisk-code-review mailing list