[Asterisk-code-review] Binaural synthesis (confbridge): Adds libfftw3 as dependency. (asterisk[master])

Anonymous Coward asteriskteam at digium.com
Thu Oct 13 11:00:58 CDT 2016


Anonymous Coward #1000019 has submitted this change and it was merged.

Change subject: Binaural synthesis (confbridge): Adds libfftw3 as dependency.
......................................................................


Binaural synthesis (confbridge): Adds libfftw3 as dependency.

Adds libfftw3 to the build chain that is is going to be used for binaural
synthesis by bridge_softmix.

ASTERISK-26292

Change-Id: Iedc2f174e4ccb39ae5d9e698e339c6a17155867b
---
M build_tools/menuselect-deps.in
M configure
M configure.ac
M include/asterisk/autoconfig.h.in
M makeopts.in
5 files changed, 175 insertions(+), 1 deletion(-)

Approvals:
  Anonymous Coward #1000019: Verified
  Matthew Fredrickson: Looks good to me, approved



diff --git a/build_tools/menuselect-deps.in b/build_tools/menuselect-deps.in
index 9b07768..9f1aa70 100644
--- a/build_tools/menuselect-deps.in
+++ b/build_tools/menuselect-deps.in
@@ -54,6 +54,7 @@
 PRI=@PBX_PRI@
 OPENR2=@PBX_OPENR2@
 RESAMPLE=@PBX_RESAMPLE@
+FFTW3=@PBX_FFTW3@
 RADIUS=@PBX_RADIUS@
 LAUNCHD=@PBX_LAUNCHD@
 SPANDSP=@PBX_SPANDSP@
diff --git a/configure b/configure
index 37a8751..2294f53 100755
--- a/configure
+++ b/configure
@@ -841,6 +841,10 @@
 RESAMPLE_DIR
 RESAMPLE_INCLUDE
 RESAMPLE_LIB
+PBX_FFTW3
+FFTW3_DIR
+FFTW3_INCLUDE
+FFTW3_LIB
 PBX_RADIUS
 RADIUS_DIR
 RADIUS_INCLUDE
@@ -1330,6 +1334,7 @@
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -1412,6 +1417,7 @@
 with_pri
 with_pwlib
 with_radius
+with_fftw3
 with_resample
 with_sdl
 with_SDL_image
@@ -1511,6 +1517,7 @@
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1763,6 +1770,15 @@
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1900,7 +1916,7 @@
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+		libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -2053,6 +2069,7 @@
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -2160,6 +2177,7 @@
   --with-pri=PATH         use ISDN PRI files in PATH
   --with-pwlib=PATH       use PWlib files in PATH
   --with-radius=PATH      use Radius Client files in PATH
+  --with-fftw3=PATH       use LIBFFTW3 files in PATH
   --with-resample=PATH    use LIBRESAMPLE files in PATH
   --with-sdl=PATH         use Sdl files in PATH
   --with-SDL_image=PATH   use Sdl Image files in PATH
@@ -11790,6 +11808,38 @@
 	*)
 	RADIUS_DIR="${withval}"
 	ac_mandatory_list="${ac_mandatory_list} RADIUS"
+	;;
+	esac
+
+fi
+
+
+
+
+
+
+
+
+    FFTW3_DESCRIP="LIBFFTW3"
+    FFTW3_OPTION="fftw3"
+    PBX_FFTW3=0
+
+# Check whether --with-fftw3 was given.
+if test "${with_fftw3+set}" = set; then :
+  withval=$with_fftw3;
+	case ${withval} in
+	n|no)
+	USE_FFTW3=no
+	# -1 is a magic value used by menuselect to know that the package
+	# was disabled, other than 'not found'
+	PBX_FFTW3=-1
+	;;
+	y|ye|yes)
+	ac_mandatory_list="${ac_mandatory_list} FFTW3"
+	;;
+	*)
+	FFTW3_DIR="${withval}"
+	ac_mandatory_list="${ac_mandatory_list} FFTW3"
 	;;
 	esac
 
@@ -28971,6 +29021,115 @@
 
 
 
+if test "x${PBX_FFTW3}" != "x1" -a "${USE_FFTW3}" != "no"; then
+   pbxlibdir=""
+   # if --with-FFTW3=DIR has been specified, use it.
+   if test "x${FFTW3_DIR}" != "x"; then
+      if test -d ${FFTW3_DIR}/lib; then
+         pbxlibdir="-L${FFTW3_DIR}/lib"
+      else
+         pbxlibdir="-L${FFTW3_DIR}"
+      fi
+   fi
+   pbxfuncname="fftw_alloc_real"
+   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
+      AST_FFTW3_FOUND=yes
+   else
+      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
+      CFLAGS="${CFLAGS} "
+      as_ac_Lib=`$as_echo "ac_cv_lib_fftw3_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lfftw3" >&5
+$as_echo_n "checking for ${pbxfuncname} in -lfftw3... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lfftw3 ${pbxlibdir} -lfftw3 $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_FFTW3_FOUND=yes
+else
+  AST_FFTW3_FOUND=no
+fi
+
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   if test "${AST_FFTW3_FOUND}" = "yes"; then
+      FFTW3_LIB="${pbxlibdir} -lfftw3 -lfftw3"
+      # if --with-FFTW3=DIR has been specified, use it.
+      if test "x${FFTW3_DIR}" != "x"; then
+         FFTW3_INCLUDE="-I${FFTW3_DIR}/include"
+      fi
+      FFTW3_INCLUDE="${FFTW3_INCLUDE} "
+      if test "xfftw3.h" = "x" ; then	# no header, assume found
+         FFTW3_HEADER_FOUND="1"
+      else				# check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${FFTW3_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "fftw3.h" "ac_cv_header_fftw3_h" "$ac_includes_default"
+if test "x$ac_cv_header_fftw3_h" = xyes; then :
+  FFTW3_HEADER_FOUND=1
+else
+  FFTW3_HEADER_FOUND=0
+fi
+
+
+         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
+      fi
+      if test "x${FFTW3_HEADER_FOUND}" = "x0" ; then
+         FFTW3_LIB=""
+         FFTW3_INCLUDE=""
+      else
+         if test "x${pbxfuncname}" = "x" ; then		# only checking headers -> no library
+            FFTW3_LIB=""
+         fi
+         PBX_FFTW3=1
+         cat >>confdefs.h <<_ACEOF
+#define HAVE_FFTW3 1
+_ACEOF
+
+      fi
+   fi
+fi
+
+
+if test "$PBX_FFTW3" = "1"; then
+
+$as_echo "#define HAVE_FFTW 1" >>confdefs.h
+
+fi
+
 
     if test "x${PBX_SPANDSP}" != "x1" -a "${USE_SPANDSP}" != "no"; then
         if test "xminimum version of SpanDSP" != "x"; then
diff --git a/configure.ac b/configure.ac
index cdc6487..6f56b94 100644
--- a/configure.ac
+++ b/configure.ac
@@ -538,6 +538,7 @@
 # ------------------------------------^
 AST_EXT_LIB_SETUP([PWLIB], [PWlib], [pwlib])
 AST_EXT_LIB_SETUP([RADIUS], [Radius Client], [radius])
+AST_EXT_LIB_SETUP([FFTW3], [LIBFFTW3], [fftw3])
 AST_EXT_LIB_SETUP([RESAMPLE], [LIBRESAMPLE], [resample])
 AST_EXT_LIB_SETUP([SDL], [Sdl], [sdl])
 AST_EXT_LIB_SETUP([SDL_IMAGE], [Sdl Image], [SDL_image])
@@ -2270,6 +2271,10 @@
 # ------------------------------------^
 
 AST_EXT_LIB_CHECK([RESAMPLE], [resample], [resample_open], [libresample.h], [-lm])
+AST_EXT_LIB_CHECK([FFTW3], [fftw3], [fftw_alloc_real], [fftw3.h], [-lfftw3])
+if test "$PBX_FFTW3" = "1"; then
+	AC_DEFINE([HAVE_FFTW], 1, [Define 1 if your system has fftw.])
+fi
 
 AST_C_COMPILE_CHECK([SPANDSP], [
 		#if SPANDSP_RELEASE_DATE < 20080516
diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in
index 7a11ba3..706798c 100644
--- a/include/asterisk/autoconfig.h.in
+++ b/include/asterisk/autoconfig.h.in
@@ -239,6 +239,12 @@
 /* Define to 1 if you have the `ffsll' function. */
 #undef HAVE_FFSLL
 
+/* Define 1 if your system has fftw. */
+#undef HAVE_FFTW
+
+/* Define to 1 if you have the LIBFFTW3 library. */
+#undef HAVE_FFTW3
+
 /* Define to 1 if you have the `floor' function. */
 #undef HAVE_FLOOR
 
diff --git a/makeopts.in b/makeopts.in
index a826d88..a145b02 100644
--- a/makeopts.in
+++ b/makeopts.in
@@ -259,6 +259,9 @@
 RESAMPLE_INCLUDE=@RESAMPLE_INCLUDE@
 RESAMPLE_LIB=@RESAMPLE_LIB@
 
+FFTW3_INCLUDE=@FFTW3_INCLUDE@
+FFTW3_LIB=@FFTW3_LIB@
+
 RT_LIB=@RT_LIB@
 
 SS7_INCLUDE=@SS7_INCLUDE@

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iedc2f174e4ccb39ae5d9e698e339c6a17155867b
Gerrit-PatchSet: 4
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Frank Haase <fra.haase at googlemail.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Dennis Guse <dennis.guse at alumni.tu-berlin.de>
Gerrit-Reviewer: Frank Haase <fra.haase at googlemail.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matthew Fredrickson <creslin at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-code-review mailing list