* pkg-config zlib check in 3c13bc
@ 2014-05-06 19:40 Xīcò
2014-05-06 20:31 ` Tomi Ollila
0 siblings, 1 reply; 14+ messages in thread
From: Xīcò @ 2014-05-06 19:40 UTC (permalink / raw)
To: notmuch
[-- Attachment #1: Type: text/plain, Size: 493 bytes --]
Dear notmuch,
Although notmuch was configuring fine on FreeBSD before 3c13bc, the pkg-config
check introduced for zlib does not work. Indeed, zlib is part of the
base system, and always assumed to be present.
Proposed patch puts platform test before pkg-config checks, and add a
special case for zlib on FreeBSD. uname -U is used to get (numeric) OS version,
and compared to lowest release where at least zlib 1.2.5.2 was available
(that’s FreeBSD 9.1, with zlib 1.2.7).
Best,
--
Xīcò
[-- Attachment #2: 0001-FreeBSD-check-for-zlib-version.patch --]
[-- Type: text/x-diff, Size: 4773 bytes --]
From ca0b168ac01391b4137de504bea2845d39d0fff9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?X=C4=ABc=C3=B2?= <xico@atelo.org>
Date: Tue, 6 May 2014 12:37:32 -0700
Subject: [PATCH 1/1] FreeBSD check for zlib version.
---
configure | 130 +++++++++++++++++++++++++++++++++-----------------------------
1 file changed, 69 insertions(+), 61 deletions(-)
diff --git a/configure b/configure
index 9bde2eb..7204812 100755
--- a/configure
+++ b/configure
@@ -270,6 +270,62 @@ EOF
errors=0
+libdir_in_ldconfig=0
+
+printf "Checking which platform we are on... "
+uname=`uname`
+if [ $uname = "Darwin" ] ; then
+ printf "Mac OS X.\n"
+ platform=MACOSX
+ linker_resolves_library_dependencies=0
+elif [ $uname = "SunOS" ] ; then
+ printf "Solaris.\n"
+ platform=SOLARIS
+ linker_resolves_library_dependencies=0
+elif [ $uname = "FreeBSD" ] ; then
+ printf "FreeBSD.\n"
+ platform=FREEBSD
+ linker_resolves_library_dependencies=0
+elif [ $uname = "OpenBSD" ] ; then
+ printf "OpenBSD.\n"
+ platform=OPENBSD
+ linker_resolves_library_dependencies=0
+elif [ $uname = "Linux" ] || [ $uname = "GNU" ] ; then
+ printf "$uname\n"
+ platform="$uname"
+ linker_resolves_library_dependencies=1
+
+ printf "Checking for $libdir_expanded in ldconfig... "
+ ldconfig_paths=$(/sbin/ldconfig -N -X -v 2>/dev/null | sed -n -e 's,^\(/.*\):\( (.*)\)\?$,\1,p')
+ # Separate ldconfig_paths only on newline (not on any potential
+ # embedded space characters in any filenames). Note, we use a
+ # literal newline in the source here rather than something like:
+ #
+ # IFS=$(printf '\n')
+ #
+ # because the shell's command substitution deletes any trailing newlines.
+ IFS="
+"
+ for path in $ldconfig_paths; do
+ if [ "$path" = "$libdir_expanded" ]; then
+ libdir_in_ldconfig=1
+ fi
+ done
+ IFS=$DEFAULT_IFS
+ if [ "$libdir_in_ldconfig" = '0' ]; then
+ printf "No (will set RPATH)\n"
+ else
+ printf "Yes\n"
+ fi
+else
+ printf "Unknown.\n"
+ cat <<EOF
+
+*** Warning: Unknown platform. Notmuch might or might not build correctly.
+
+EOF
+fi
+
if pkg-config --version > /dev/null 2>&1; then
have_pkg_config=1
else
@@ -342,14 +398,22 @@ fi
printf "Checking for zlib (>= 1.2.5.2)... "
have_zlib=0
-if pkg-config --atleast-version=1.2.5.2 zlib; then
+# zlib is part of base in FreeBSD. version 9.1 included 1.2.7
+if [ $platform = FREEBSD -a `uname -U` -ge 901000 ] ; then
printf "Yes.\n"
have_zlib=1
- zlib_cflags=$(pkg-config --cflags zlib)
- zlib_ldflags=$(pkg-config --libs zlib)
+ zlib_cflags=
+ zlib_ldflags=-lz
else
- printf "No.\n"
- errors=$((errors + 1))
+ if pkg-config --atleast-version=1.2.5.2 zlib; then
+ printf "Yes.\n"
+ have_zlib=1
+ zlib_cflags=$(pkg-config --cflags zlib)
+ zlib_ldflags=$(pkg-config --libs zlib)
+ else
+ printf "No.\n"
+ errors=$((errors + 1))
+ fi
fi
printf "Checking for talloc development files... "
@@ -427,62 +491,6 @@ else
fi
fi
-libdir_in_ldconfig=0
-
-printf "Checking which platform we are on... "
-uname=`uname`
-if [ $uname = "Darwin" ] ; then
- printf "Mac OS X.\n"
- platform=MACOSX
- linker_resolves_library_dependencies=0
-elif [ $uname = "SunOS" ] ; then
- printf "Solaris.\n"
- platform=SOLARIS
- linker_resolves_library_dependencies=0
-elif [ $uname = "FreeBSD" ] ; then
- printf "FreeBSD.\n"
- platform=FREEBSD
- linker_resolves_library_dependencies=0
-elif [ $uname = "OpenBSD" ] ; then
- printf "OpenBSD.\n"
- platform=OPENBSD
- linker_resolves_library_dependencies=0
-elif [ $uname = "Linux" ] || [ $uname = "GNU" ] ; then
- printf "$uname\n"
- platform="$uname"
- linker_resolves_library_dependencies=1
-
- printf "Checking for $libdir_expanded in ldconfig... "
- ldconfig_paths=$(/sbin/ldconfig -N -X -v 2>/dev/null | sed -n -e 's,^\(/.*\):\( (.*)\)\?$,\1,p')
- # Separate ldconfig_paths only on newline (not on any potential
- # embedded space characters in any filenames). Note, we use a
- # literal newline in the source here rather than something like:
- #
- # IFS=$(printf '\n')
- #
- # because the shell's command substitution deletes any trailing newlines.
- IFS="
-"
- for path in $ldconfig_paths; do
- if [ "$path" = "$libdir_expanded" ]; then
- libdir_in_ldconfig=1
- fi
- done
- IFS=$DEFAULT_IFS
- if [ "$libdir_in_ldconfig" = '0' ]; then
- printf "No (will set RPATH)\n"
- else
- printf "Yes\n"
- fi
-else
- printf "Unknown.\n"
- cat <<EOF
-
-*** Warning: Unknown platform. Notmuch might or might not build correctly.
-
-EOF
-fi
-
printf "Checking byte order... "
cat> _byteorder.c <<EOF
#include <stdio.h>
--
1.9.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: pkg-config zlib check in 3c13bc
2014-05-06 19:40 pkg-config zlib check in 3c13bc Xīcò
@ 2014-05-06 20:31 ` Tomi Ollila
2014-05-08 12:11 ` David Bremner
0 siblings, 1 reply; 14+ messages in thread
From: Tomi Ollila @ 2014-05-06 20:31 UTC (permalink / raw)
To: Xīcò, notmuch
On Tue, May 06 2014, Xīcò <xico@atelo.org> wrote:
> Dear notmuch,
>
> Although notmuch was configuring fine on FreeBSD before 3c13bc, the pkg-config
> check introduced for zlib does not work. Indeed, zlib is part of the
> base system, and always assumed to be present.
>
> Proposed patch puts platform test before pkg-config checks, and add a
> special case for zlib on FreeBSD. uname -U is used to get (numeric) OS version,
> and compared to lowest release where at least zlib 1.2.5.2 was available
> (that’s FreeBSD 9.1, with zlib 1.2.7).
>
> Best,
This line:
if [ $platform = FREEBSD -a `uname -U` -ge 901000 ] ; then
fails on systems where uname does not have -U option
as `uname -U` is executed always...
if [ $platform = FREEBSD ] && [ "`uname -U`" -ge 901000 ] ; then
would work better there...
But, I'd like suggest alternate option to create a test c program
and test whether it compiles (analogous to what there is already
done with many other checks) -- this same would apply to fdatasync()
case too.
If we cared about cross-compilability one could also do
zlib_vernum=$(printf '#include <zlib.h>\nZLIB_VERNUM' | gcc -E - | sed -n '$ s/^0x/0x/p')
if [ $((${zlib_vernum:-0})) -ge 4690 ]; then # 4690 == 0x1252
printf "Yes\n"
...
But that would be sooooo inconsistent what we have now
(and possibly fragile?)
> --
> Xīcò
Tomi
>From ca0b168ac01391b4137de504bea2845d39d0fff9 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?X=C4=ABc=C3=B2?= <xico@atelo.org>
> Date: Tue, 6 May 2014 12:37:32 -0700
> Subject: [PATCH 1/1] FreeBSD check for zlib version.
>
> ---
> configure | 130 +++++++++++++++++++++++++++++++++-----------------------------
> 1 file changed, 69 insertions(+), 61 deletions(-)
>
> diff --git a/configure b/configure
> index 9bde2eb..7204812 100755
> --- a/configure
> +++ b/configure
> @@ -270,6 +270,62 @@ EOF
>
> errors=0
>
> +libdir_in_ldconfig=0
> +
> +printf "Checking which platform we are on... "
> +uname=`uname`
> +if [ $uname = "Darwin" ] ; then
> + printf "Mac OS X.\n"
> + platform=MACOSX
> + linker_resolves_library_dependencies=0
> +elif [ $uname = "SunOS" ] ; then
> + printf "Solaris.\n"
> + platform=SOLARIS
> + linker_resolves_library_dependencies=0
> +elif [ $uname = "FreeBSD" ] ; then
> + printf "FreeBSD.\n"
> + platform=FREEBSD
> + linker_resolves_library_dependencies=0
> +elif [ $uname = "OpenBSD" ] ; then
> + printf "OpenBSD.\n"
> + platform=OPENBSD
> + linker_resolves_library_dependencies=0
> +elif [ $uname = "Linux" ] || [ $uname = "GNU" ] ; then
> + printf "$uname\n"
> + platform="$uname"
> + linker_resolves_library_dependencies=1
> +
> + printf "Checking for $libdir_expanded in ldconfig... "
> + ldconfig_paths=$(/sbin/ldconfig -N -X -v 2>/dev/null | sed -n -e 's,^\(/.*\):\( (.*)\)\?$,\1,p')
> + # Separate ldconfig_paths only on newline (not on any potential
> + # embedded space characters in any filenames). Note, we use a
> + # literal newline in the source here rather than something like:
> + #
> + # IFS=$(printf '\n')
> + #
> + # because the shell's command substitution deletes any trailing newlines.
> + IFS="
> +"
> + for path in $ldconfig_paths; do
> + if [ "$path" = "$libdir_expanded" ]; then
> + libdir_in_ldconfig=1
> + fi
> + done
> + IFS=$DEFAULT_IFS
> + if [ "$libdir_in_ldconfig" = '0' ]; then
> + printf "No (will set RPATH)\n"
> + else
> + printf "Yes\n"
> + fi
> +else
> + printf "Unknown.\n"
> + cat <<EOF
> +
> +*** Warning: Unknown platform. Notmuch might or might not build correctly.
> +
> +EOF
> +fi
> +
> if pkg-config --version > /dev/null 2>&1; then
> have_pkg_config=1
> else
> @@ -342,14 +398,22 @@ fi
>
> printf "Checking for zlib (>= 1.2.5.2)... "
> have_zlib=0
> -if pkg-config --atleast-version=1.2.5.2 zlib; then
> +# zlib is part of base in FreeBSD. version 9.1 included 1.2.7
> +if [ $platform = FREEBSD -a `uname -U` -ge 901000 ] ; then
> printf "Yes.\n"
> have_zlib=1
> - zlib_cflags=$(pkg-config --cflags zlib)
> - zlib_ldflags=$(pkg-config --libs zlib)
> + zlib_cflags=
> + zlib_ldflags=-lz
> else
> - printf "No.\n"
> - errors=$((errors + 1))
> + if pkg-config --atleast-version=1.2.5.2 zlib; then
> + printf "Yes.\n"
> + have_zlib=1
> + zlib_cflags=$(pkg-config --cflags zlib)
> + zlib_ldflags=$(pkg-config --libs zlib)
> + else
> + printf "No.\n"
> + errors=$((errors + 1))
> + fi
> fi
>
> printf "Checking for talloc development files... "
> @@ -427,62 +491,6 @@ else
> fi
> fi
>
> -libdir_in_ldconfig=0
> -
> -printf "Checking which platform we are on... "
> -uname=`uname`
> -if [ $uname = "Darwin" ] ; then
> - printf "Mac OS X.\n"
> - platform=MACOSX
> - linker_resolves_library_dependencies=0
> -elif [ $uname = "SunOS" ] ; then
> - printf "Solaris.\n"
> - platform=SOLARIS
> - linker_resolves_library_dependencies=0
> -elif [ $uname = "FreeBSD" ] ; then
> - printf "FreeBSD.\n"
> - platform=FREEBSD
> - linker_resolves_library_dependencies=0
> -elif [ $uname = "OpenBSD" ] ; then
> - printf "OpenBSD.\n"
> - platform=OPENBSD
> - linker_resolves_library_dependencies=0
> -elif [ $uname = "Linux" ] || [ $uname = "GNU" ] ; then
> - printf "$uname\n"
> - platform="$uname"
> - linker_resolves_library_dependencies=1
> -
> - printf "Checking for $libdir_expanded in ldconfig... "
> - ldconfig_paths=$(/sbin/ldconfig -N -X -v 2>/dev/null | sed -n -e 's,^\(/.*\):\( (.*)\)\?$,\1,p')
> - # Separate ldconfig_paths only on newline (not on any potential
> - # embedded space characters in any filenames). Note, we use a
> - # literal newline in the source here rather than something like:
> - #
> - # IFS=$(printf '\n')
> - #
> - # because the shell's command substitution deletes any trailing newlines.
> - IFS="
> -"
> - for path in $ldconfig_paths; do
> - if [ "$path" = "$libdir_expanded" ]; then
> - libdir_in_ldconfig=1
> - fi
> - done
> - IFS=$DEFAULT_IFS
> - if [ "$libdir_in_ldconfig" = '0' ]; then
> - printf "No (will set RPATH)\n"
> - else
> - printf "Yes\n"
> - fi
> -else
> - printf "Unknown.\n"
> - cat <<EOF
> -
> -*** Warning: Unknown platform. Notmuch might or might not build correctly.
> -
> -EOF
> -fi
> -
> printf "Checking byte order... "
> cat> _byteorder.c <<EOF
> #include <stdio.h>
> --
> 1.9.2
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: pkg-config zlib check in 3c13bc
2014-05-06 20:31 ` Tomi Ollila
@ 2014-05-08 12:11 ` David Bremner
2014-05-09 20:01 ` Tomi Ollila
0 siblings, 1 reply; 14+ messages in thread
From: David Bremner @ 2014-05-08 12:11 UTC (permalink / raw)
To: Tomi Ollila, Xīcò, notmuch
Tomi Ollila <tomi.ollila@iki.fi> writes:
>
> But, I'd like suggest alternate option to create a test c program
> and test whether it compiles (analogous to what there is already
> done with many other checks) -- this same would apply to fdatasync()
> case too.
>
I agree in principle, but I'm not sure it's detectable at compile time,
since the option we need is passed as a string (boo!).
I guess the ZLIB_VERNUM hack would be preferable to adding platform
specific checks to configure. But note you'd need somehow to find
zlib.h.
See my other patch for fdatasync.
d
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: pkg-config zlib check in 3c13bc
2014-05-08 12:11 ` David Bremner
@ 2014-05-09 20:01 ` Tomi Ollila
2014-05-10 0:46 ` David Bremner
0 siblings, 1 reply; 14+ messages in thread
From: Tomi Ollila @ 2014-05-09 20:01 UTC (permalink / raw)
To: David Bremner, Xīcò, notmuch
On Thu, May 08 2014, David Bremner <david@tethera.net> wrote:
> Tomi Ollila <tomi.ollila@iki.fi> writes:
>
>>
>> But, I'd like suggest alternate option to create a test c program
>> and test whether it compiles (analogous to what there is already
>> done with many other checks) -- this same would apply to fdatasync()
>> case too.
>>
>
> I agree in principle, but I'm not sure it's detectable at compile time,
> since the option we need is passed as a string (boo!).
>
> I guess the ZLIB_VERNUM hack would be preferable to adding platform
> specific checks to configure. But note you'd need somehow to find
> zlib.h.
Actually my suggestion would be that if that pkg-config line for
zlib does not work (btw why does it not work) try an option
where zlib_cflags is expected to be empty and and zlib_ldflags -lz
-- and try compile and run test program with those options
then the test program is something like
int main(void)
{
return(ZLIB_VERNUM >= 0x1252);
}
(perhaps we could manage the same value in slightly different
formats in 2 tests and remember to update those in sync ..
or we could try:
zv1=1 zv2=2 zv3=5 zv4=
if pkg-config --atleast-version=$zv1.$zv2.$zv3.$zv4 zlib; then
and
return(ZLIB_VERNUM >= 0x$zv1$zv2$zv3$zv4);
>
> d
Tomi
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: pkg-config zlib check in 3c13bc
2014-05-09 20:01 ` Tomi Ollila
@ 2014-05-10 0:46 ` David Bremner
2014-05-10 1:53 ` Xīcò
0 siblings, 1 reply; 14+ messages in thread
From: David Bremner @ 2014-05-10 0:46 UTC (permalink / raw)
To: Tomi Ollila, Xīcò, notmuch
Tomi Ollila <tomi.ollila@iki.fi> writes:
>
> Actually my suggestion would be that if that pkg-config line for
> zlib does not work (btw why does it not work)
I guess because FreeBSD (and maybe other systems) have a distinction
between the "base system" and "add on packages" and pkg-config only
works for the latter
> try an option
> where zlib_cflags is expected to be empty and and zlib_ldflags -lz
> -- and try compile and run test program with those options
> then the test program is something like
>
> int main(void)
> {
> return(ZLIB_VERNUM >= 0x1252);
> }
OK, that sounds like it could work. Ideally, somebody on FreeBSD could
check...
d
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: pkg-config zlib check in 3c13bc
2014-05-10 0:46 ` David Bremner
@ 2014-05-10 1:53 ` Xīcò
2014-05-10 2:11 ` David Bremner
0 siblings, 1 reply; 14+ messages in thread
From: Xīcò @ 2014-05-10 1:53 UTC (permalink / raw)
To: David Bremner; +Cc: Tomi Ollila, notmuch
On Sat, May 10, 2014 at 09:46:00AM +0900, David Bremner wrote:
> > int main(void)
> > {
> > return(ZLIB_VERNUM >= 0x1252);
> > }
>
> OK, that sounds like it could work. Ideally, somebody on FreeBSD could
> check...
>
> d
Such check will work on FreeBSD, and would be great!
As a side note, is there any rationale for the hand-made configure? Not
that I am a big fan of autoconf/cmake/whatever either...
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: pkg-config zlib check in 3c13bc
2014-05-10 1:53 ` Xīcò
@ 2014-05-10 2:11 ` David Bremner
2014-05-10 4:01 ` Felipe Contreras
2014-05-10 5:33 ` [PATCH] Fallback check for zlib Xīcò
0 siblings, 2 replies; 14+ messages in thread
From: David Bremner @ 2014-05-10 2:11 UTC (permalink / raw)
To: Xīcò; +Cc: Tomi Ollila, notmuch
Xīcò <xico@atelo.org> writes:
> On Sat, May 10, 2014 at 09:46:00AM +0900, David Bremner wrote:
>> > int main(void)
>> > {
>> > return(ZLIB_VERNUM >= 0x1252);
>> > }
>>
>> OK, that sounds like it could work. Ideally, somebody on FreeBSD could
>> check...
>>
>> d
>
> Such check will work on FreeBSD, and would be great!
>
Great. Now somebody just needs to make it.
> As a side note, is there any rationale for the hand-made configure? Not
> that I am a big fan of autoconf/cmake/whatever either...
Carl Worth had a lot of (negative) experience with autoconf when he
started the project, which motivated him to roll his own. Personally I
don't really think any of the alternatives are convincingly better than
autoconf. Of course it's one of those very subjective things.
d
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: pkg-config zlib check in 3c13bc
2014-05-10 2:11 ` David Bremner
@ 2014-05-10 4:01 ` Felipe Contreras
2014-05-10 5:33 ` [PATCH] Fallback check for zlib Xīcò
1 sibling, 0 replies; 14+ messages in thread
From: Felipe Contreras @ 2014-05-10 4:01 UTC (permalink / raw)
To: David Bremner, Xīcò; +Cc: Tomi Ollila, notmuch
David Bremner wrote:
> Xīcò <xico@atelo.org> writes:
> > As a side note, is there any rationale for the hand-made configure? Not
> > that I am a big fan of autoconf/cmake/whatever either...
>
> Carl Worth had a lot of (negative) experience with autoconf when he
> started the project, which motivated him to roll his own. Personally I
> don't really think any of the alternatives are convincingly better than
> autoconf. Of course it's one of those very subjective things.
I think Makefiles are superior to autoconf. What we have is fine.
--
Felipe Contreras
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH] Fallback check for zlib
2014-05-10 2:11 ` David Bremner
2014-05-10 4:01 ` Felipe Contreras
@ 2014-05-10 5:33 ` Xīcò
2014-05-10 5:33 ` Xīcò
1 sibling, 1 reply; 14+ messages in thread
From: Xīcò @ 2014-05-10 5:33 UTC (permalink / raw)
To: notmuch; +Cc: Tomi Ollila
Added the fallback check for zlib. Tested on FreeBSD stable/10.
C test checks for major zlib compatibility (see zlib doc/examples).
Xīcò (1):
Fallback check for zlib.
compat/have_zlib.c | 6 ++++++
configure | 21 ++++++++++++++++-----
2 files changed, 22 insertions(+), 5 deletions(-)
create mode 100644 compat/have_zlib.c
--
1.9.2
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH] Fallback check for zlib.
2014-05-10 5:33 ` [PATCH] Fallback check for zlib Xīcò
@ 2014-05-10 5:33 ` Xīcò
2014-05-10 7:58 ` Tomi Ollila
2014-05-10 9:37 ` David Bremner
0 siblings, 2 replies; 14+ messages in thread
From: Xīcò @ 2014-05-10 5:33 UTC (permalink / raw)
To: notmuch; +Cc: Tomi Ollila
---
compat/have_zlib.c | 6 ++++++
configure | 21 ++++++++++++++++-----
2 files changed, 22 insertions(+), 5 deletions(-)
create mode 100644 compat/have_zlib.c
diff --git a/compat/have_zlib.c b/compat/have_zlib.c
new file mode 100644
index 0000000..998c697
--- /dev/null
+++ b/compat/have_zlib.c
@@ -0,0 +1,6 @@
+#include <zlib.h>
+
+int main(void)
+{
+ return zlibVersion()[0] != ZLIB_VERSION[0] || ZLIB_VERNUM < MINVER;
+}
diff --git a/configure b/configure
index 9bde2eb..7a11ded 100755
--- a/configure
+++ b/configure
@@ -340,16 +340,27 @@ else
errors=$((errors + 1))
fi
-printf "Checking for zlib (>= 1.2.5.2)... "
+zv1=1 zv2=2 zv3=5 zv4=1
+printf "Checking for zlib (>= $zv1.$zv2.$zv3.$zv4)... "
have_zlib=0
-if pkg-config --atleast-version=1.2.5.2 zlib; then
+if pkg-config --atleast-version=$zv1.$zv2.$zv3.$zv4 zlib; then
printf "Yes.\n"
have_zlib=1
zlib_cflags=$(pkg-config --cflags zlib)
zlib_ldflags=$(pkg-config --libs zlib)
else
- printf "No.\n"
- errors=$((errors + 1))
+ # Try finding zlib directly (e.g. on FreeBSD)
+ zlib_cflags=
+ zlib_ldflags=-lz
+ if ${CC} ${zlib_cflags} -DMINVER=0x$zv1$zv2$zv3$zv4 -o compat/have_zlib "$srcdir"/compat/have_zlib.c ${zlib_ldflags} > /dev/null 2>&1 && ./compat/have_zlib
+ then
+ printf "Yes.\n"
+ have_zlib=1
+ else
+ printf "No.\n"
+ errors=$((errors + 1))
+ fi
+ rm -f compat/have_zlib
fi
printf "Checking for talloc development files... "
@@ -509,7 +520,7 @@ EOF
echo " http://xapian.org/"
fi
if [ $have_zlib -eq 0 ]; then
- echo " zlib library (>= version 1.2.5.2, including development files such as headers)"
+ echo " zlib library (>= version $zv1.$zv2.$zv3.$zv4, including development files such as headers)"
echo " http://zlib.net/"
echo
fi
--
1.9.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH] Fallback check for zlib.
2014-05-10 5:33 ` Xīcò
@ 2014-05-10 7:58 ` Tomi Ollila
2014-05-10 9:37 ` David Bremner
1 sibling, 0 replies; 14+ messages in thread
From: Tomi Ollila @ 2014-05-10 7:58 UTC (permalink / raw)
To: Xīcò, notmuch
On Sat, May 10 2014, Xīcò <xico@atelo.org> wrote:
> ---
I must say I like the patch. One thing I would change:
+ return (ZLIB_VERNUM) < (MINVER) || zlibVersion()[0] != (ZLIB_VERSION)[0];
i.e. short-circuiting potential failure before executing zlibVersion()...
(parenthesising macros is just extra fanciness I thought just before
sending this email ;D)
Tomi
> compat/have_zlib.c | 6 ++++++
> configure | 21 ++++++++++++++++-----
> 2 files changed, 22 insertions(+), 5 deletions(-)
> create mode 100644 compat/have_zlib.c
>
> diff --git a/compat/have_zlib.c b/compat/have_zlib.c
> new file mode 100644
> index 0000000..998c697
> --- /dev/null
> +++ b/compat/have_zlib.c
> @@ -0,0 +1,6 @@
> +#include <zlib.h>
> +
> +int main(void)
> +{
> + return zlibVersion()[0] != ZLIB_VERSION[0] || ZLIB_VERNUM < MINVER;
> +}
> diff --git a/configure b/configure
> index 9bde2eb..7a11ded 100755
> --- a/configure
> +++ b/configure
> @@ -340,16 +340,27 @@ else
> errors=$((errors + 1))
> fi
>
> -printf "Checking for zlib (>= 1.2.5.2)... "
> +zv1=1 zv2=2 zv3=5 zv4=1
> +printf "Checking for zlib (>= $zv1.$zv2.$zv3.$zv4)... "
> have_zlib=0
> -if pkg-config --atleast-version=1.2.5.2 zlib; then
> +if pkg-config --atleast-version=$zv1.$zv2.$zv3.$zv4 zlib; then
> printf "Yes.\n"
> have_zlib=1
> zlib_cflags=$(pkg-config --cflags zlib)
> zlib_ldflags=$(pkg-config --libs zlib)
> else
> - printf "No.\n"
> - errors=$((errors + 1))
> + # Try finding zlib directly (e.g. on FreeBSD)
> + zlib_cflags=
> + zlib_ldflags=-lz
> + if ${CC} ${zlib_cflags} -DMINVER=0x$zv1$zv2$zv3$zv4 -o compat/have_zlib "$srcdir"/compat/have_zlib.c ${zlib_ldflags} > /dev/null 2>&1 && ./compat/have_zlib
> + then
> + printf "Yes.\n"
> + have_zlib=1
> + else
> + printf "No.\n"
> + errors=$((errors + 1))
> + fi
> + rm -f compat/have_zlib
> fi
>
> printf "Checking for talloc development files... "
> @@ -509,7 +520,7 @@ EOF
> echo " http://xapian.org/"
> fi
> if [ $have_zlib -eq 0 ]; then
> - echo " zlib library (>= version 1.2.5.2, including development files such as headers)"
> + echo " zlib library (>= version $zv1.$zv2.$zv3.$zv4, including development files such as headers)"
> echo " http://zlib.net/"
> echo
> fi
> --
> 1.9.2
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Fallback check for zlib.
2014-05-10 5:33 ` Xīcò
2014-05-10 7:58 ` Tomi Ollila
@ 2014-05-10 9:37 ` David Bremner
2014-05-10 10:41 ` Tomi Ollila
1 sibling, 1 reply; 14+ messages in thread
From: David Bremner @ 2014-05-10 9:37 UTC (permalink / raw)
To: Xīcò, notmuch; +Cc: Tomi Ollila
Xīcò <xico@atelo.org> writes:
> ---
> compat/have_zlib.c | 6 ++++++
> configure | 21 ++++++++++++++++-----
> 2 files changed, 22 insertions(+), 5 deletions(-)
> create mode 100644 compat/have_zlib.c
If you're doing a second version for Tomi's comments, please put roughly
the comments from the cover letter in the commit message of the actual
patch; or at least be more verbose there.
Cheers,
d
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Fallback check for zlib.
2014-05-10 9:37 ` David Bremner
@ 2014-05-10 10:41 ` Tomi Ollila
2014-05-10 18:44 ` [PATCH] configure: add a fallback " Xīcò
0 siblings, 1 reply; 14+ messages in thread
From: Tomi Ollila @ 2014-05-10 10:41 UTC (permalink / raw)
To: Xīcò, notmuch
On Sat, May 10 2014, David Bremner <david@tethera.net> wrote:
> Xīcò <xico@atelo.org> writes:
>
>> ---
>> compat/have_zlib.c | 6 ++++++
>> configure | 21 ++++++++++++++++-----
>> 2 files changed, 22 insertions(+), 5 deletions(-)
>> create mode 100644 compat/have_zlib.c
>
> If you're doing a second version for Tomi's comments, please put roughly
> the comments from the cover letter in the commit message of the actual
> patch; or at least be more verbose there.
True, I failed to notice lack of commit message as the patch was so shiny ;)
> Cheers,
>
> d
Tomi
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH] configure: add a fallback check for zlib
2014-05-10 10:41 ` Tomi Ollila
@ 2014-05-10 18:44 ` Xīcò
0 siblings, 0 replies; 14+ messages in thread
From: Xīcò @ 2014-05-10 18:44 UTC (permalink / raw)
To: notmuch; +Cc: Tomi Ollila
Since zlib is part of the base system, FreeBSD chose not to register it
in pkg-config through zlib.pc. As a fallback test, configure will build
and run a zlib version check and make sure the header and library
versions are compatible.
---
compat/have_zlib.c | 6 ++++++
configure | 21 ++++++++++++++++-----
2 files changed, 22 insertions(+), 5 deletions(-)
create mode 100644 compat/have_zlib.c
diff --git a/compat/have_zlib.c b/compat/have_zlib.c
new file mode 100644
index 0000000..abaeedd
--- /dev/null
+++ b/compat/have_zlib.c
@@ -0,0 +1,6 @@
+#include <zlib.h>
+
+int main(void)
+{
+ return (ZLIB_VERNUM) < (MINVER) || zlibVersion()[0] != (ZLIB_VERSION)[0];
+}
diff --git a/configure b/configure
index 9bde2eb..7a11ded 100755
--- a/configure
+++ b/configure
@@ -340,16 +340,27 @@ else
errors=$((errors + 1))
fi
-printf "Checking for zlib (>= 1.2.5.2)... "
+zv1=1 zv2=2 zv3=5 zv4=1
+printf "Checking for zlib (>= $zv1.$zv2.$zv3.$zv4)... "
have_zlib=0
-if pkg-config --atleast-version=1.2.5.2 zlib; then
+if pkg-config --atleast-version=$zv1.$zv2.$zv3.$zv4 zlib; then
printf "Yes.\n"
have_zlib=1
zlib_cflags=$(pkg-config --cflags zlib)
zlib_ldflags=$(pkg-config --libs zlib)
else
- printf "No.\n"
- errors=$((errors + 1))
+ # Try finding zlib directly (e.g. on FreeBSD)
+ zlib_cflags=
+ zlib_ldflags=-lz
+ if ${CC} ${zlib_cflags} -DMINVER=0x$zv1$zv2$zv3$zv4 -o compat/have_zlib "$srcdir"/compat/have_zlib.c ${zlib_ldflags} > /dev/null 2>&1 && ./compat/have_zlib
+ then
+ printf "Yes.\n"
+ have_zlib=1
+ else
+ printf "No.\n"
+ errors=$((errors + 1))
+ fi
+ rm -f compat/have_zlib
fi
printf "Checking for talloc development files... "
@@ -509,7 +520,7 @@ EOF
echo " http://xapian.org/"
fi
if [ $have_zlib -eq 0 ]; then
- echo " zlib library (>= version 1.2.5.2, including development files such as headers)"
+ echo " zlib library (>= version $zv1.$zv2.$zv3.$zv4, including development files such as headers)"
echo " http://zlib.net/"
echo
fi
--
1.9.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
end of thread, other threads:[~2014-05-10 18:44 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-06 19:40 pkg-config zlib check in 3c13bc Xīcò
2014-05-06 20:31 ` Tomi Ollila
2014-05-08 12:11 ` David Bremner
2014-05-09 20:01 ` Tomi Ollila
2014-05-10 0:46 ` David Bremner
2014-05-10 1:53 ` Xīcò
2014-05-10 2:11 ` David Bremner
2014-05-10 4:01 ` Felipe Contreras
2014-05-10 5:33 ` [PATCH] Fallback check for zlib Xīcò
2014-05-10 5:33 ` Xīcò
2014-05-10 7:58 ` Tomi Ollila
2014-05-10 9:37 ` David Bremner
2014-05-10 10:41 ` Tomi Ollila
2014-05-10 18:44 ` [PATCH] configure: add a fallback " Xīcò
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).