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