From c85f34c1421810d873c61409ff5ad72a2ee0123e Mon Sep 17 00:00:00 2001 From: Tomi Ollila Date: Mon, 12 May 2014 18:21:51 +0300 Subject: [PATCH] Re: [PATCH] configure: add workaround for systems without zlib.pc --- 1b/a863899ba125dc4eddcc59de2c11d624787ba1 | 140 ++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 1b/a863899ba125dc4eddcc59de2c11d624787ba1 diff --git a/1b/a863899ba125dc4eddcc59de2c11d624787ba1 b/1b/a863899ba125dc4eddcc59de2c11d624787ba1 new file mode 100644 index 000000000..cbcadba33 --- /dev/null +++ b/1b/a863899ba125dc4eddcc59de2c11d624787ba1 @@ -0,0 +1,140 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 4EB93431FC7 + for ; Mon, 12 May 2014 08:22:06 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id RYGYR-0vovMt for ; + Mon, 12 May 2014 08:22:01 -0700 (PDT) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id 75477431FC2 + for ; Mon, 12 May 2014 08:22:01 -0700 (PDT) +Received: from guru.guru-group.fi (localhost [IPv6:::1]) + by guru.guru-group.fi (Postfix) with ESMTP id 47FE2100051; + Mon, 12 May 2014 18:21:52 +0300 (EEST) +From: Tomi Ollila +To: Felipe Contreras , notmuch@notmuchmail.org +Subject: Re: [PATCH] configure: add workaround for systems without zlib.pc +In-Reply-To: <1399864172-28227-1-git-send-email-felipe.contreras@gmail.com> +References: <1399864172-28227-1-git-send-email-felipe.contreras@gmail.com> +User-Agent: Notmuch/0.18+11~gb21401f (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Mon, 12 May 2014 15:22:06 -0000 + +On Mon, May 12 2014, Felipe Contreras wrote: + +> Some systems (e.g. FreeBSD) might not have installed the appropriate +> pkg-config file as they should. We can workaround the issue by creating +> the .pc file they should have distributed. + +I agree with David that this is easier to follow (and don't have those +sneaky zv? -variables ;D + +2 comments inline. + +> +> Signed-off-by: Felipe Contreras +> --- +> compat/.gitignore | 1 + +> compat/gen_zlib_pc.c | 18 ++++++++++++++++++ +> configure | 9 +++++++++ +> 3 files changed, 28 insertions(+) +> create mode 100644 compat/.gitignore +> create mode 100644 compat/gen_zlib_pc.c +> +> diff --git a/compat/.gitignore b/compat/.gitignore +> new file mode 100644 +> index 0000000..107ba17 +> --- /dev/null +> +++ b/compat/.gitignore +> @@ -0,0 +1 @@ +> +zlib.pc +> diff --git a/compat/gen_zlib_pc.c b/compat/gen_zlib_pc.c +> new file mode 100644 +> index 0000000..198a727 +> --- /dev/null +> +++ b/compat/gen_zlib_pc.c +> @@ -0,0 +1,18 @@ +> +#include +> +#include +> + +> +static const char *template = +> + "prefix=/usr\n" +> + "exec_prefix=${prefix}\n" +> + "libdir=${exec_prefix}/lib\n" +> + "\n" +> + "Name: zlib\n" +> + "Description: zlib compression library\n" +> + "Version: %s\n" +> + "Libs: -lz\n"; + +The above is bit different what zlib.pc files have in e.g. Fedora 20 and +Ubuntu 14.04 machines: those have 'Requires: before Libs: (and Cflags:)' +But probably that is unnecessary (and just some sugar coating...?). + + +> +int main(void) +> +{ +> + printf(template, ZLIB_VERSION); +> + return 0; +> +} +> diff --git a/configure b/configure +> index 9bde2eb..35dd21f 100755 +> --- a/configure +> +++ b/configure +> @@ -340,6 +340,15 @@ else +> errors=$((errors + 1)) +> fi +> +> +if ! pkg-config --exists zlib; then +> + ${CC} ${zlib_cflags} -o compat/gen_zlib_pc \ +> + "$srcdir"/compat/gen_zlib_pc.c ${zlib_ldflags} > /dev/null 2>&1 && +> + compat/gen_zlib_pc > compat/zlib.pc && +> + PKG_CONFIG_PATH="$PKG_CONFIG_PATH":compat && + +To be consistent what we do elsewhere: + + PKG_CONFIG_PATH=${PKG_CONFIG_PATH:+$PKG_CONFIG_PATH:}compat && + +i.e. don't add ':' in case $PKG_CONFIG_PATH is not defined or is empty string. + + +Tomi + + +> + export PKG_CONFIG_PATH +> + rm -f compat/gen_zlib_pc +> +fi +> + +> printf "Checking for zlib (>= 1.2.5.2)... " +> have_zlib=0 +> if pkg-config --atleast-version=1.2.5.2 zlib; then +> -- +> 1.9.2+fc1~45~g3953d93 -- 2.26.2