unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] configure: add workaround for systems without zlib.pc
@ 2014-05-12  3:09 Felipe Contreras
  2014-05-12  4:39 ` David Bremner
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Felipe Contreras @ 2014-05-12  3:09 UTC (permalink / raw)
  To: notmuch; +Cc: Tomi Ollila

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.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 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 <stdio.h>
+#include <zlib.h>
+
+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";
+
+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 &&
+  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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] configure: add workaround for systems without zlib.pc
  2014-05-12  3:09 [PATCH] configure: add workaround for systems without zlib.pc Felipe Contreras
@ 2014-05-12  4:39 ` David Bremner
  2014-05-12 15:21 ` Tomi Ollila
  2014-06-22  9:58 ` David Bremner
  2 siblings, 0 replies; 5+ messages in thread
From: David Bremner @ 2014-05-12  4:39 UTC (permalink / raw)
  To: Felipe Contreras, notmuch; +Cc: Tomi Ollila

Felipe Contreras <felipe.contreras@gmail.com> writes:

> 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 think I agree with Felipe here, this version seems a little easier to
follow. 

d

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] configure: add workaround for systems without zlib.pc
  2014-05-12  3:09 [PATCH] configure: add workaround for systems without zlib.pc Felipe Contreras
  2014-05-12  4:39 ` David Bremner
@ 2014-05-12 15:21 ` Tomi Ollila
  2014-06-14  1:47   ` David Bremner
  2014-06-22  9:58 ` David Bremner
  2 siblings, 1 reply; 5+ messages in thread
From: Tomi Ollila @ 2014-05-12 15:21 UTC (permalink / raw)
  To: Felipe Contreras, notmuch

On Mon, May 12 2014, Felipe Contreras <felipe.contreras@gmail.com> 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 <felipe.contreras@gmail.com>
> ---
>  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 <stdio.h>
> +#include <zlib.h>
> +
> +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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] configure: add workaround for systems without zlib.pc
  2014-05-12 15:21 ` Tomi Ollila
@ 2014-06-14  1:47   ` David Bremner
  0 siblings, 0 replies; 5+ messages in thread
From: David Bremner @ 2014-06-14  1:47 UTC (permalink / raw)
  To: Tomi Ollila, Felipe Contreras, notmuch

Tomi Ollila <tomi.ollila@iki.fi> writes:

>> +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...?).
>

it seems consistent with the 'foo' example at

   http://people.freedesktop.org/~dbn/pkg-config-guide.html#writing

>
> 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.

What Tomi writes here sounds correct to me. I guess empty PKG_CONFIG_PATH is
probably the most common case.

d

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] configure: add workaround for systems without zlib.pc
  2014-05-12  3:09 [PATCH] configure: add workaround for systems without zlib.pc Felipe Contreras
  2014-05-12  4:39 ` David Bremner
  2014-05-12 15:21 ` Tomi Ollila
@ 2014-06-22  9:58 ` David Bremner
  2 siblings, 0 replies; 5+ messages in thread
From: David Bremner @ 2014-06-22  9:58 UTC (permalink / raw)
  To: Felipe Contreras, notmuch; +Cc: Tomi Ollila, Xīcò

Felipe Contreras <felipe.contreras@gmail.com> writes:

> 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.
>
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>

pushed to release and master

d

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-06-22  9:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-12  3:09 [PATCH] configure: add workaround for systems without zlib.pc Felipe Contreras
2014-05-12  4:39 ` David Bremner
2014-05-12 15:21 ` Tomi Ollila
2014-06-14  1:47   ` David Bremner
2014-06-22  9:58 ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).