shithub: choc

Download patch

ref: 0dfe43f1b632fe8c47045b413407db2316a79008
parent: 8993063b126c65e572944ca487f5b980abfcf60d
parent: 61a6af25d221bf790ac8f67ebfd88948f92babe4
author: Simon Howard <fraggle+github@gmail.com>
date: Mon Oct 26 07:49:14 EDT 2015

Merge pull request #630 from rrebello/configure-option-fix

configure: fix --with-PACKAGE option checks

--- a/configure.ac
+++ b/configure.ac
@@ -80,8 +80,15 @@
         [Build without libsamplerate @<:@default=check@:>@]),
     [],
     [
-        AC_CHECK_LIB(samplerate, src_new)
+        [with_libsamplerate=check]
     ])
+    AS_IF([test "x$with_libsamplerate" != xno], [
+        AC_CHECK_LIB(samplerate, src_new, [], [
+            AS_IF([test "x$with_libsamplerate" != xcheck], [AC_MSG_FAILURE(
+                [--with-libsamplerate was given, but test for libsamplerate failed])
+            ])
+        ])
+    ])
     # Check for libpng.
     AC_ARG_WITH([libpng],
     AS_HELP_STRING([--without-libpng],
@@ -88,8 +95,15 @@
         [Build without libpng @<:@default=check@:>@]),
     [],
     [
+        [with_libpng=check]
+    ])
+    AS_IF([test "x$with_libpng" != xno], [
         AC_CHECK_LIB(z, zlibVersion)
-        AC_CHECK_LIB(png, png_get_io_ptr)
+        AC_CHECK_LIB(png, png_get_io_ptr, [], [
+            AS_IF([test "x$with_libpng" != xcheck], [AC_MSG_FAILURE(
+                [--with-libpng was given, but test for libpng failed])
+            ])
+        ])
     ])
     AC_CHECK_LIB(m, log)