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?= <x...@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

Reply via email to