1 From fd12fa91aa8e35dbd3ffa5bfe055baf6bde0cd63 Mon Sep 17 00:00:00 2001
2 From: Rodrigo Rebello <rprebello@gmail.com>
3 Date: Thu, 22 Oct 2015 15:28:11 -0200
4 Subject: [PATCH] configure: fix --with-PACKAGE option checks
6 Options of the form --with-PACKAGE[=yes] (e.g. --with-libpng), when
7 passed to configure, were being treated as though --without-PACKAGE had
10 Although the intention is to have configure check and use PACKAGE by
11 default if it's available, thus requiring the user to pass an option
12 only if PACKAGE must NOT be used, there are times when the opposite
13 might be desired (i.e. the user wants to indicate PACKAGE MUST be used).
14 Moreover, allowing --with-PACKAGE and behaving as if --without-PACKAGE
15 had been specified is in itself quite confusing.
17 Fix that by testing the result of 'with_PACKAGE' in configure.ac and
18 acting accordingly instead of blindly assuming a 'no'.
20 Upstream-status: accepted, not yet released.
21 https://github.com/chocolate-doom/chocolate-doom/pull/630
23 Signed-off-by: Rodrigo Rebello <rprebello@gmail.com>
25 configure.ac | 18 ++++++++++++++++--
26 1 file changed, 16 insertions(+), 2 deletions(-)
28 diff --git a/configure.ac b/configure.ac
29 index ee97fe2..7b03485 100644
32 @@ -80,7 +80,14 @@ AC_SDL_MAIN_WORKAROUND([
33 [Build without libsamplerate @<:@default=check@:>@]),
36 - AC_CHECK_LIB(samplerate, src_new)
37 + [with_libsamplerate=check]
39 + AS_IF([test "x$with_libsamplerate" != xno], [
40 + AC_CHECK_LIB(samplerate, src_new, [], [
41 + AS_IF([test "x$with_libsamplerate" != xcheck], [AC_MSG_FAILURE(
42 + [--with-libsamplerate was given, but test for libsamplerate failed])
48 @@ -88,8 +95,15 @@ AC_SDL_MAIN_WORKAROUND([
49 [Build without libpng @<:@default=check@:>@]),
54 + AS_IF([test "x$with_libpng" != xno], [
55 AC_CHECK_LIB(z, zlibVersion)
56 - AC_CHECK_LIB(png, png_get_io_ptr)
57 + AC_CHECK_LIB(png, png_get_io_ptr, [], [
58 + AS_IF([test "x$with_libpng" != xcheck], [AC_MSG_FAILURE(
59 + [--with-libpng was given, but test for libpng failed])