mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 02:37:10 +00:00 
			
		
		
		
	configure: Add autoconf check for libopus.
Because opus transcoding support cannot be included in the standard Asterisk distribution, a few codec_opus implementations have popped up. To make it easier for people to drop in opus support in their own installations, this patch adds configure checks for libopus. Review: https://reviewboard.asterisk.org/r/4106/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@426234 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
		| @@ -41,6 +41,7 @@ NEON=@PBX_NEON@ | ||||
| NEON29=@PBX_NEON29@ | ||||
| OGG=@PBX_OGG@ | ||||
| OPENH323=@PBX_OPENH323@ | ||||
| OPUS=@PBX_OPUS@ | ||||
| OSPTK=@PBX_OSPTK@ | ||||
| OSS=@PBX_OSS@ | ||||
| PGSQL=@PBX_PGSQL@ | ||||
|   | ||||
							
								
								
									
										155
									
								
								configure
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										155
									
								
								configure
									
									
									
									
										vendored
									
									
								
							| @@ -1,5 +1,5 @@ | ||||
| #! /bin/sh | ||||
| # From configure.ac Revision: 421230 . | ||||
| # From configure.ac Revision: 425965 . | ||||
| # Guess values for system-dependent variables and create Makefiles. | ||||
| # Generated by GNU Autoconf 2.69 for asterisk trunk. | ||||
| # | ||||
| @@ -930,6 +930,10 @@ PBX_OSPTK | ||||
| OSPTK_DIR | ||||
| OSPTK_INCLUDE | ||||
| OSPTK_LIB | ||||
| PBX_OPUS | ||||
| OPUS_DIR | ||||
| OPUS_INCLUDE | ||||
| OPUS_LIB | ||||
| PBX_OPENR2 | ||||
| OPENR2_DIR | ||||
| OPENR2_INCLUDE | ||||
| @@ -1315,6 +1319,7 @@ with_netsnmp | ||||
| with_newt | ||||
| with_ogg | ||||
| with_openr2 | ||||
| with_opus | ||||
| with_osptk | ||||
| with_oss | ||||
| with_postgres | ||||
| @@ -2052,6 +2057,7 @@ Optional Packages: | ||||
|   --with-newt=PATH        use newt files in PATH | ||||
|   --with-ogg=PATH         use OGG files in PATH | ||||
|   --with-openr2=PATH      use MFR2 files in PATH | ||||
|   --with-opus=PATH        use Opus files in PATH | ||||
|   --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 | ||||
| @@ -10048,6 +10054,38 @@ fi | ||||
|  | ||||
|  | ||||
|  | ||||
|     OPUS_DESCRIP="Opus" | ||||
|     OPUS_OPTION="opus" | ||||
|     PBX_OPUS=0 | ||||
|  | ||||
| # Check whether --with-opus was given. | ||||
| if test "${with_opus+set}" = set; then : | ||||
|   withval=$with_opus; | ||||
| 	case ${withval} in | ||||
| 	n|no) | ||||
| 	USE_OPUS=no | ||||
| 	# -1 is a magic value used by menuselect to know that the package | ||||
| 	# was disabled, other than 'not found' | ||||
| 	PBX_OPUS=-1 | ||||
| 	;; | ||||
| 	y|ye|yes) | ||||
| 	ac_mandatory_list="${ac_mandatory_list} OPUS" | ||||
| 	;; | ||||
| 	*) | ||||
| 	OPUS_DIR="${withval}" | ||||
| 	ac_mandatory_list="${ac_mandatory_list} OPUS" | ||||
| 	;; | ||||
| 	esac | ||||
|  | ||||
| fi | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|     OSPTK_DESCRIP="OSP Toolkit" | ||||
|     OSPTK_OPTION="osptk" | ||||
|     PBX_OSPTK=0 | ||||
| @@ -13248,7 +13286,7 @@ else | ||||
|     We can't simply define LARGE_OFF_T to be 9223372036854775807, | ||||
|     since some C++ compilers masquerading as C compilers | ||||
|     incorrectly reject 9223372036854775807.  */ | ||||
| #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) | ||||
| #define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) | ||||
|   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 | ||||
| 		       && LARGE_OFF_T % 2147483647 == 1) | ||||
| 		      ? 1 : -1]; | ||||
| @@ -13294,7 +13332,7 @@ else | ||||
|     We can't simply define LARGE_OFF_T to be 9223372036854775807, | ||||
|     since some C++ compilers masquerading as C compilers | ||||
|     incorrectly reject 9223372036854775807.  */ | ||||
| #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) | ||||
| #define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) | ||||
|   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 | ||||
| 		       && LARGE_OFF_T % 2147483647 == 1) | ||||
| 		      ? 1 : -1]; | ||||
| @@ -13318,7 +13356,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | ||||
|     We can't simply define LARGE_OFF_T to be 9223372036854775807, | ||||
|     since some C++ compilers masquerading as C compilers | ||||
|     incorrectly reject 9223372036854775807.  */ | ||||
| #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) | ||||
| #define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) | ||||
|   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 | ||||
| 		       && LARGE_OFF_T % 2147483647 == 1) | ||||
| 		      ? 1 : -1]; | ||||
| @@ -13363,7 +13401,7 @@ else | ||||
|     We can't simply define LARGE_OFF_T to be 9223372036854775807, | ||||
|     since some C++ compilers masquerading as C compilers | ||||
|     incorrectly reject 9223372036854775807.  */ | ||||
| #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) | ||||
| #define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) | ||||
|   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 | ||||
| 		       && LARGE_OFF_T % 2147483647 == 1) | ||||
| 		      ? 1 : -1]; | ||||
| @@ -13387,7 +13425,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | ||||
|     We can't simply define LARGE_OFF_T to be 9223372036854775807, | ||||
|     since some C++ compilers masquerading as C compilers | ||||
|     incorrectly reject 9223372036854775807.  */ | ||||
| #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) | ||||
| #define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) | ||||
|   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 | ||||
| 		       && LARGE_OFF_T % 2147483647 == 1) | ||||
| 		      ? 1 : -1]; | ||||
| @@ -26939,6 +26977,111 @@ fi | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| if test "x${PBX_OPUS}" != "x1" -a "${USE_OPUS}" != "no"; then | ||||
|    pbxlibdir="" | ||||
|    # if --with-OPUS=DIR has been specified, use it. | ||||
|    if test "x${OPUS_DIR}" != "x"; then | ||||
|       if test -d ${OPUS_DIR}/lib; then | ||||
|          pbxlibdir="-L${OPUS_DIR}/lib" | ||||
|       else | ||||
|          pbxlibdir="-L${OPUS_DIR}" | ||||
|       fi | ||||
|    fi | ||||
|    pbxfuncname="opus_encoder_create" | ||||
|    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers | ||||
|       AST_OPUS_FOUND=yes | ||||
|    else | ||||
|       ast_ext_lib_check_save_CFLAGS="${CFLAGS}" | ||||
|       CFLAGS="${CFLAGS} " | ||||
|       as_ac_Lib=`$as_echo "ac_cv_lib_opus_${pbxfuncname}" | $as_tr_sh` | ||||
| { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lopus" >&5 | ||||
| $as_echo_n "checking for ${pbxfuncname} in -lopus... " >&6; } | ||||
| if eval \${$as_ac_Lib+:} false; then : | ||||
|   $as_echo_n "(cached) " >&6 | ||||
| else | ||||
|   ac_check_lib_save_LIBS=$LIBS | ||||
| LIBS="-lopus ${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_OPUS_FOUND=yes | ||||
| else | ||||
|   AST_OPUS_FOUND=no | ||||
| fi | ||||
|  | ||||
|       CFLAGS="${ast_ext_lib_check_save_CFLAGS}" | ||||
|    fi | ||||
|  | ||||
|    # now check for the header. | ||||
|    if test "${AST_OPUS_FOUND}" = "yes"; then | ||||
|       OPUS_LIB="${pbxlibdir} -lopus " | ||||
|       # if --with-OPUS=DIR has been specified, use it. | ||||
|       if test "x${OPUS_DIR}" != "x"; then | ||||
|          OPUS_INCLUDE="-I${OPUS_DIR}/include" | ||||
|       fi | ||||
|       OPUS_INCLUDE="${OPUS_INCLUDE} " | ||||
|       if test "xopus/opus.h" = "x" ; then	# no header, assume found | ||||
|          OPUS_HEADER_FOUND="1" | ||||
|       else				# check for the header | ||||
|          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}" | ||||
|          CPPFLAGS="${CPPFLAGS} ${OPUS_INCLUDE}" | ||||
|          ac_fn_c_check_header_mongrel "$LINENO" "opus/opus.h" "ac_cv_header_opus_opus_h" "$ac_includes_default" | ||||
| if test "x$ac_cv_header_opus_opus_h" = xyes; then : | ||||
|   OPUS_HEADER_FOUND=1 | ||||
| else | ||||
|   OPUS_HEADER_FOUND=0 | ||||
| fi | ||||
|  | ||||
|  | ||||
|          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}" | ||||
|       fi | ||||
|       if test "x${OPUS_HEADER_FOUND}" = "x0" ; then | ||||
|          OPUS_LIB="" | ||||
|          OPUS_INCLUDE="" | ||||
|       else | ||||
|          if test "x${pbxfuncname}" = "x" ; then		# only checking headers -> no library | ||||
|             OPUS_LIB="" | ||||
|          fi | ||||
|          PBX_OPUS=1 | ||||
|          cat >>confdefs.h <<_ACEOF | ||||
| #define HAVE_OPUS 1 | ||||
| _ACEOF | ||||
|  | ||||
|       fi | ||||
|    fi | ||||
| fi | ||||
|  | ||||
|  | ||||
|  | ||||
| if test "${USE_PWLIB}" != "no"; then | ||||
| 	if test -n "${PWLIB_DIR}"; then | ||||
| 		PWLIBDIR="${PWLIB_DIR}" | ||||
|   | ||||
| @@ -448,6 +448,7 @@ AST_EXT_LIB_SETUP([NETSNMP], [Net-SNMP], [netsnmp]) | ||||
| AST_EXT_LIB_SETUP([NEWT], [newt], [newt]) | ||||
| AST_EXT_LIB_SETUP([OGG], [OGG], [ogg]) | ||||
| AST_EXT_LIB_SETUP([OPENR2], [MFR2], [openr2]) | ||||
| AST_EXT_LIB_SETUP([OPUS], [Opus], [opus]) | ||||
| AST_EXT_LIB_SETUP([OSPTK], [OSP Toolkit], [osptk]) | ||||
| AST_EXT_LIB_SETUP([OSS], [Open Sound System], [oss]) | ||||
| AST_EXT_LIB_SETUP([PGSQL], [PostgreSQL], [postgres]) | ||||
| @@ -2127,6 +2128,8 @@ AST_EXT_LIB_CHECK([SS7], [ss7], [ss7_set_isup_timer], [libss7.h]) | ||||
|  | ||||
| AST_EXT_LIB_CHECK([OPENR2], [openr2], [openr2_chan_new], [openr2.h]) | ||||
|  | ||||
| AST_EXT_LIB_CHECK([OPUS], [opus], [opus_encoder_create], [opus/opus.h]) | ||||
|  | ||||
| if test "${USE_PWLIB}" != "no"; then | ||||
| 	if test -n "${PWLIB_DIR}"; then | ||||
| 		PWLIBDIR="${PWLIB_DIR}" | ||||
|   | ||||
| @@ -551,6 +551,9 @@ | ||||
| /* Define to 1 if CRYPTO has the OpenSSL SRTP Extension Support feature. */ | ||||
| #undef HAVE_OPENSSL_SRTP | ||||
|  | ||||
| /* Define to 1 if you have the Opus library. */ | ||||
| #undef HAVE_OPUS | ||||
|  | ||||
| /* Define this to indicate the ${OSPTK_DESCRIP} library */ | ||||
| #undef HAVE_OSPTK | ||||
|  | ||||
|   | ||||
| @@ -211,6 +211,9 @@ NEWT_LIB=@NEWT_LIB@ | ||||
| OGG_INCLUDE=@OGG_INCLUDE@ | ||||
| OGG_LIB=@OGG_LIB@ | ||||
|  | ||||
| OPUS_INCLUDE=@OPUS_INCLUDE@ | ||||
| OPUS_LIB=@OPUS_LIB@ | ||||
|  | ||||
| OSPTK_INCLUDE=@OSPTK_INCLUDE@ | ||||
| OSPTK_LIB=@OSPTK_LIB@ | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user