summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2012-02-16 19:51:15 +0000
committerRichard Mudgett <rmudgett@digium.com>2012-02-16 19:51:15 +0000
commit7093cf278ca023a3b43959f15202c7eabd3f9856 (patch)
treec6a7eecd35168f23d3cbb521594a2c628e1f9e9e
parent7879cccafd1749e2670039f9ddf3a786f59f5429 (diff)
Fix compile problem when old version of libvorbisfile v1.1.2 is used.
The principle difference between libvorbisfile v1.1.2 and newer (at least v1.2.0) is the addition of the predefined callbacks OV_CALLBACKS_xxx in vorbis/vorbisfile.h used for ov_open_callbacks(). * Updated the configure script to detect if libvorbisfile.h declares OV_CALLBACKS_NOCLOSE. * Copied the declaration of OV_CALLBACKS_NOCLOSE from v1.2.0 to allow v1.1.2 to compile. (closes issue ASTERISK-19370) Reported by: Jonn Taylor ........ Merged revisions 355608 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 355620 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@355621 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--autoconf/ast_c_declare_check.m431
-rwxr-xr-xconfigure72
-rw-r--r--configure.ac1
-rw-r--r--formats/format_ogg_vorbis.c21
-rw-r--r--include/asterisk/autoconfig.h.in16
5 files changed, 132 insertions, 9 deletions
diff --git a/autoconf/ast_c_declare_check.m4 b/autoconf/ast_c_declare_check.m4
new file mode 100644
index 000000000..89fb8063d
--- /dev/null
+++ b/autoconf/ast_c_declare_check.m4
@@ -0,0 +1,31 @@
+# Check if a given symbol is declared using a certain header.
+# Check whether SYMBOL (a function, variable, or constant) is declared.
+
+# AST_C_DECLARE_CHECK([package], [symbol], [header file], [version])
+AC_DEFUN([AST_C_DECLARE_CHECK],
+[
+ if test "x${PBX_$1}" != "x1" -a "${USE_$1}" != "no"; then
+ AC_MSG_CHECKING([for $2 declared in $3])
+ saved_cppflags="${CPPFLAGS}"
+ if test "x${$1_DIR}" != "x"; then
+ $1_INCLUDE="-I${$1_DIR}/include"
+ fi
+ CPPFLAGS="${CPPFLAGS} ${$1_INCLUDE}"
+
+ AC_COMPILE_IFELSE(
+ [ AC_LANG_PROGRAM( [#include <$3>],
+ [#if !defined($2)
+ (void) $2;
+ #endif
+ ])],
+ [ AC_MSG_RESULT(yes)
+ PBX_$1=1
+ AC_DEFINE([HAVE_$1], 1, [Define if your system has $2 declared.])
+ m4_ifval([$4], [AC_DEFINE([HAVE_$1_VERSION], $4, [Define $1 headers version])])
+ ],
+ [ AC_MSG_RESULT(no) ]
+ )
+
+ CPPFLAGS="${saved_cppflags}"
+ fi
+])
diff --git a/configure b/configure
index 64f5bbfb7..f67175113 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.ac Revision: 354046 .
+# From configure.ac Revision: 355376 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.63 for asterisk trunk.
#
@@ -53343,6 +53343,76 @@ fi
fi
+ if test "x${PBX_VORBIS_OPEN_CALLBACKS}" != "x1" -a "${USE_VORBIS_OPEN_CALLBACKS}" != "no"; then
+ { $as_echo "$as_me:$LINENO: checking for OV_CALLBACKS_NOCLOSE declared in vorbis/vorbisfile.h" >&5
+$as_echo_n "checking for OV_CALLBACKS_NOCLOSE declared in vorbis/vorbisfile.h... " >&6; }
+ saved_cppflags="${CPPFLAGS}"
+ if test "x${VORBIS_OPEN_CALLBACKS_DIR}" != "x"; then
+ VORBIS_OPEN_CALLBACKS_INCLUDE="-I${VORBIS_OPEN_CALLBACKS_DIR}/include"
+ fi
+ CPPFLAGS="${CPPFLAGS} ${VORBIS_OPEN_CALLBACKS_INCLUDE}"
+
+ cat >conftest.$ac_ext <<_ACEOF
+ /* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <vorbis/vorbisfile.h>
+int
+main ()
+{
+#if !defined(OV_CALLBACKS_NOCLOSE)
+ (void) OV_CALLBACKS_NOCLOSE;
+ #endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+ PBX_VORBIS_OPEN_CALLBACKS=1
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_VORBIS_OPEN_CALLBACKS 1
+_ACEOF
+
+
+
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+ CPPFLAGS="${saved_cppflags}"
+ fi
+
+
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
diff --git a/configure.ac b/configure.ac
index 10516091f..73288ab1c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2099,6 +2099,7 @@ then
else
AST_EXT_LIB_CHECK([VORBIS], [vorbis], [vorbis_info_init], [vorbis/codec.h], [-lm -lvorbisenc -lvorbisfile])
fi
+AST_C_DECLARE_CHECK([VORBIS_OPEN_CALLBACKS], [OV_CALLBACKS_NOCLOSE], [vorbis/vorbisfile.h])
AC_LANG_PUSH(C++)
diff --git a/formats/format_ogg_vorbis.c b/formats/format_ogg_vorbis.c
index e316d7780..bbd053e98 100644
--- a/formats/format_ogg_vorbis.c
+++ b/formats/format_ogg_vorbis.c
@@ -80,6 +80,27 @@ struct ogg_vorbis_desc { /* format specific parameters */
int eos;
};
+#if !defined(HAVE_VORBIS_OPEN_CALLBACKS)
+/*
+ * Declared for backward compatibility with vorbisfile v1.1.2.
+ * Code taken from vorbisfile.h v1.2.0.
+ */
+static int _ov_header_fseek_wrap(FILE *f, ogg_int64_t off, int whence)
+{
+ if (f == NULL) {
+ return -1;
+ }
+ return fseek(f, off, whence);
+}
+
+static ov_callbacks OV_CALLBACKS_NOCLOSE = {
+ (size_t (*)(void *, size_t, size_t, void *)) fread,
+ (int (*)(void *, ogg_int64_t, int)) _ov_header_fseek_wrap,
+ (int (*)(void *)) NULL,
+ (long (*)(void *)) ftell
+};
+#endif /* !defined(HAVE_VORBIS_OPEN_CALLBACKS) */
+
/*!
* \brief Create a new OGG/Vorbis filestream and set it up for reading.
* \param s File that points to on disk storage of the OGG/Vorbis data.
diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in
index 0ba8ebaf7..816159082 100644
--- a/include/asterisk/autoconfig.h.in
+++ b/include/asterisk/autoconfig.h.in
@@ -836,19 +836,19 @@
/* Define to 1 if you have the `strtoq' function. */
#undef HAVE_STRTOQ
-/* Define to 1 if `ifr_ifru.ifru_hwaddr' is a member of `struct ifreq'. */
+/* Define to 1 if `ifr_ifru.ifru_hwaddr' is member of `struct ifreq'. */
#undef HAVE_STRUCT_IFREQ_IFR_IFRU_IFRU_HWADDR
-/* Define to 1 if `uid' is a member of `struct sockpeercred'. */
+/* Define to 1 if `uid' is member of `struct sockpeercred'. */
#undef HAVE_STRUCT_SOCKPEERCRED_UID
-/* Define to 1 if `st_blksize' is a member of `struct stat'. */
+/* Define to 1 if `st_blksize' is member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_BLKSIZE
-/* Define to 1 if `cr_uid' is a member of `struct ucred'. */
+/* Define to 1 if `cr_uid' is member of `struct ucred'. */
#undef HAVE_STRUCT_UCRED_CR_UID
-/* Define to 1 if `uid' is a member of `struct ucred'. */
+/* Define to 1 if `uid' is member of `struct ucred'. */
#undef HAVE_STRUCT_UCRED_UID
/* Define to 1 if you have the mISDN Supplemental Services library. */
@@ -1023,6 +1023,9 @@
/* Define to 1 if you have the Vorbis library. */
#undef HAVE_VORBIS
+/* Define if your system has OV_CALLBACKS_NOCLOSE declared. */
+#undef HAVE_VORBIS_OPEN_CALLBACKS
+
/* Define if your system has the VoiceTronix API libraries. */
#undef HAVE_VPB
@@ -1126,9 +1129,6 @@
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
-/* Define to the home page for this package. */
-#undef PACKAGE_URL
-
/* Define to the version of this package. */
#undef PACKAGE_VERSION