shithub: sox

Download patch

ref: 592ed220b384f2ee3c3edc5d7bba93669cf0a0c0
parent: 80f14e7cf6af8911e97e9313c4e53761a58799de
author: cbagwell <cbagwell>
date: Wed Feb 16 19:19:10 EST 2011

Look png.h in libpng to help OpenBSD packaging.

--- a/ChangeLog
+++ b/ChangeLog
@@ -56,7 +56,8 @@
     (Doug Cook)
   o cmake now compiles waveaudio driver under windows environment. (cbagwell)
     [3072672]
-
+  o Optionally look for png.h in libpng directory to support OpenBSD
+    packaging.
 
 sox-14.3.1	2010-04-11
 ----------
--- a/configure.ac
+++ b/configure.ac
@@ -256,10 +256,13 @@
         [Don't try to use png]))
 using_png=no
 if test "$with_png" != "no"; then
-    using_png=yes
-    AC_CHECK_HEADER(png.h,
-        [AC_CHECK_LIB(png, png_set_rows, PNG_LIBS="$PNG_LIBS -lpng -lz" ,[AC_CHECK_LIB(png12, png_set_rows, PNG_LIBS="$PNG_LIBS -lpng12 -lz" ,using_png=no, -lz)], -lz)],
-        using_png=no)
+    AC_CHECK_HEADERS(png.h libpng/png.h,using_png=yes)
+    if test "$using_png" = "yes"; then
+        AC_CHECK_LIB(png, png_set_rows, PNG_LIBS="$PNG_LIBS -lpng -lz", 
+		     [AC_CHECK_LIB(png12, png_set_rows, 
+		      PNG_LIBS="$PNG_LIBS -lpng12 -lz", 
+		      using_png=no, -lz)], -lz)
+    fi
     if test "$with_png" = "yes" -a "$using_png" = "no"; then
         AC_MSG_FAILURE([cannot find png])
     fi
--- a/src/spectrogram.c
+++ b/src/spectrogram.c
@@ -24,7 +24,11 @@
 #include "sgetopt.h"
 #include <assert.h>
 #include <math.h>
+#ifdef HAVE_LIBPNG_PNG_H
+#include <libpng/png.h>
+#else
 #include <png.h>
+#endif
 
 #define MAX_FFT_SIZE 4096
 #define is_p2(x) !(x & (x - 1))