changeset 20153:3b3579ad7e46 stable

Check for a modern version of sndfile in configure scripts (bug #44976). * configure.ac: Call OCTAVE_CHECK_LIB_SNDFILE_OK after first determining that sndfile library exists. * m4/acinclude.m4 (OCTAVE_CHECK_LIB_SNDFILE_OK): New macro to check for a modern version of lib sndfile with Ogg support.
author Rik <rik@octave.org>
date Fri, 01 May 2015 21:39:09 -0700
parents 8187a66039e4
children 7503499a252b
files configure.ac m4/acinclude.m4
diffstat 2 files changed, 24 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Fri May 01 13:37:26 2015 -0700
+++ b/configure.ac	Fri May 01 21:39:09 2015 -0700
@@ -1020,7 +1020,7 @@
     SNDFILE_CPPFLAGS=`$PKG_CONFIG --cflags-only-I sndfile`
     SNDFILE_LDFLAGS=`$PKG_CONFIG --libs-only-L sndfile`
     SNDFILE_LIBS=`$PKG_CONFIG --libs-only-l sndfile`
-    warn_sndfile=
+    OCTAVE_CHECK_LIB_SNDFILE_OK([warn_sndfile=])
   ])
 fi
 
@@ -1031,6 +1031,7 @@
   SNDFILE_LDFLAGS=
   SNDFILE_LIBS=
 fi
+
 AC_SUBST(SNDFILE_CPPFLAGS)
 AC_SUBST(SNDFILE_LDFLAGS)
 AC_SUBST(SNDFILE_LIBS)
--- a/m4/acinclude.m4	Fri May 01 13:37:26 2015 -0700
+++ b/m4/acinclude.m4	Fri May 01 21:39:09 2015 -0700
@@ -1059,6 +1059,28 @@
     :
   fi
 ])
+dnl 
+dnl Check whether sndfile library is modern enough to include things like Ogg
+dnl
+AC_DEFUN([OCTAVE_CHECK_LIB_SNDFILE_OK], [
+  AC_CACHE_CHECK([whether sndfile library is modern enough],
+    [octave_cv_lib_sndfile_ok],
+    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+        #include <sndfile.h>
+        ]], [[
+        int x = SF_FORMAT_OGG;
+      ]])],
+      octave_cv_lib_sndfile_ok=yes,
+      octave_cv_lib_sndfile_ok=no)
+  ])
+  if test $octave_cv_lib_sndfile_ok = yes; then
+    $1
+    :
+  else
+    $2
+    :
+  fi
+])
 dnl
 dnl Find a suitable termlib to use.
 dnl