[PATCH 1/2] configure: add a fallback check for zlib

2014-05-10 Thread Xīcò
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 000..abaeedd
--- /dev/null
+++ b/compat/have_zlib.c
@@ -0,0 +1,6 @@
+#include 
+
+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

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 1/2] configure: add a fallback check for zlib

2014-05-10 Thread Xīcò
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 000..abaeedd
--- /dev/null
+++ b/compat/have_zlib.c
@@ -0,0 +1,6 @@
+#include 
+
+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



[PATCH] configure: add a fallback check for zlib

2014-05-10 Thread Xīcò
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 000..abaeedd
--- /dev/null
+++ b/compat/have_zlib.c
@@ -0,0 +1,6 @@
+#include 
+
+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

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] configure: add a fallback check for zlib

2014-05-10 Thread Xīcò
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 000..abaeedd
--- /dev/null
+++ b/compat/have_zlib.c
@@ -0,0 +1,6 @@
+#include 
+
+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



[PATCH] Fallback check for zlib.

2014-05-09 Thread Xīcò
---
 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 000..998c697
--- /dev/null
+++ b/compat/have_zlib.c
@@ -0,0 +1,6 @@
+#include 
+
+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

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] Fallback check for zlib

2014-05-09 Thread Xīcò
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

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] Fallback check for zlib.

2014-05-09 Thread Xīcò
---
 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 000..998c697
--- /dev/null
+++ b/compat/have_zlib.c
@@ -0,0 +1,6 @@
+#include 
+
+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



[PATCH] Fallback check for zlib

2014-05-09 Thread Xīcò
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



Re: pkg-config zlib check in 3c13bc

2014-05-09 Thread Xīcò
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...
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


pkg-config zlib check in 3c13bc

2014-05-09 Thread Xīcò
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...


Linux-only fdatasync() in 3c13bc

2014-05-06 Thread Xīcò
Also, commit 3c13bc introduced a call to fdatasync() which is not
available on FreeBSD, and probably not either on MacOS at least.

Best,

--
Xīcò
>From e2b9520e69e52b35348d07eb53a6a88d1397fa3f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?X=C4=ABc=C3=B2?= 
Date: Tue, 6 May 2014 12:56:03 -0700
Subject: [PATCH 1/1] =?UTF-8?q?Compatibility=20for=20Linux=E2=80=99s=20fda?=
 =?UTF-8?q?tasync().?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 configure  | 7 +++
 notmuch-dump.c | 4 
 2 files changed, 11 insertions(+)

diff --git a/configure b/configure
index 7204812..7bc602d 100755
--- a/configure
+++ b/configure
@@ -271,6 +271,7 @@ EOF
 errors=0
 
 libdir_in_ldconfig=0
+have_fdatasync=0
 
 printf "Checking which platform we are on... "
 uname=`uname`
@@ -294,6 +295,7 @@ elif [ $uname = "Linux" ] || [ $uname = "GNU" ] ; then
 printf "$uname\n"
 platform="$uname"
 linker_resolves_library_dependencies=1
+have_fdatasync=1
 
 printf "Checking for $libdir_expanded in ldconfig... "
 ldconfig_paths=$(/sbin/ldconfig -N -X -v 2>/dev/null | sed -n -e 's,^\(/.*\):\( (.*)\)\?$,\1,p')
@@ -859,6 +861,9 @@ HAVE_D_TYPE = ${have_d_type}
 # Whether the Xapian version in use supports compaction
 HAVE_XAPIAN_COMPACT = ${have_xapian_compact}
 
+# Optimized fsync() on Linux
+HAVE_FDATASYNC = ${have_fdatasync}
+
 # Whether the getpwuid_r function is standards-compliant
 # (if not, then notmuch will #define _POSIX_PTHREAD_SEMANTICS
 # to enable the standards-compliant version -- needed for Solaris)
@@ -926,6 +931,7 @@ CONFIGURE_CFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS)  \\
 		   -DSTD_GETPWUID=\$(STD_GETPWUID)   \\
 		   -DSTD_ASCTIME=\$(STD_ASCTIME) \\
 		   -DHAVE_XAPIAN_COMPACT=\$(HAVE_XAPIAN_COMPACT)	 \\
+		   -DHAVE_FDATASYNC=\$(HAVE_FDATASYNC)	 \\
 		   -DUTIL_BYTE_ORDER=\$(UTIL_BYTE_ORDER)
 
 CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS)\\
@@ -939,6 +945,7 @@ CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS)\\
 		 -DSTD_GETPWUID=\$(STD_GETPWUID) \\
 		 -DSTD_ASCTIME=\$(STD_ASCTIME)   \\
 		 -DHAVE_XAPIAN_COMPACT=\$(HAVE_XAPIAN_COMPACT)   \\
+		 -DHAVE_FDATASYNC=\$(HAVE_FDATASYNC)	 \\
 		 -DUTIL_BYTE_ORDER=\$(UTIL_BYTE_ORDER)
 
 CONFIGURE_LDFLAGS =  \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(ZLIB_LDFLAGS) \$(XAPIAN_LDFLAGS)
diff --git a/notmuch-dump.c b/notmuch-dump.c
index 2849eab..86b275a 100644
--- a/notmuch-dump.c
+++ b/notmuch-dump.c
@@ -169,7 +169,11 @@ notmuch_database_dump (notmuch_database_t *notmuch,
 }
 
 if (output_file_name) {
+#if HAVE_FDATASYNC
 	ret = fdatasync (outfd);
+#else
+	ret = fsync (outfd);
+#endif
 	if (ret) {
 	fprintf (stderr, "Error syncing %s to disk: %s\n",
 		 name_for_error, strerror (errno));
-- 
1.9.2

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Linux-only fdatasync() in 3c13bc

2014-05-06 Thread Xīcò
Also, commit 3c13bc introduced a call to fdatasync() which is not
available on FreeBSD, and probably not either on MacOS at least.

Best,

--
X?c?
-- next part --
A non-text attachment was scrubbed...
Name: 0002-Compatibility-for-Linux-s-fdatasync.patch
Type: text/x-diff
Size: 2827 bytes
Desc: not available
URL: 



pkg-config zlib check in 3c13bc

2014-05-06 Thread Xīcò
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ò
>From ca0b168ac01391b4137de504bea2845d39d0fff9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?X=C4=ABc=C3=B2?= 
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 < /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 th

pkg-config zlib check in 3c13bc

2014-05-06 Thread Xīcò
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?
-- next part --
A non-text attachment was scrubbed...
Name: 0001-FreeBSD-check-for-zlib-version.patch
Type: text/x-diff
Size: 4774 bytes
Desc: not available
URL: