Opened 8 years ago

Last modified 8 years ago

#5826 new Bug

automake zlib configuration check is broken in FreeBSD

Reported by: missionsix Owned by:
Priority: High Milestone: None Set
Component: Transmission Version: 2.84+
Severity: Critical Keywords: configure freebsd


The following configure error happens on trunk.

build% ../Transmission/ --disable-nls
creating libtransmission/version.h
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
Creating aclocal.m4 ...
Running glib-gettextize...  Ignore non-fatal messages.
Copying file po/


checking pkg-config is at least version 0.9.0... yes
checking for OPENSSL... no
checking for OpenSSL... /usr
checking for LIBCURL... yes
checking for LIBEVENT... yes

checking for ZLIB... configure: error: Package requirements (zlib >= 1.2.3) were not met:

Package zlib was not found in the pkg-config search path.
Perhaps you should add the directory containing `zlib.pc'
to the PKG_CONFIG_PATH environment variable
Package 'zlib', required by 'world', not found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables ZLIB_CFLAGS
and ZLIB_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

zlib is not part of pkg-config on FreeBSD.

It's part of the base distribution, and as such, CHECK_MODULES will fail to find zlib.


The proposed solution is to failback to a lib check if the zlib module is not found in pkg-config.

Checking for libz and zlib.h check will be sufficient in making sure the system has zlib.

Some care was taken to preserve the version check with in the failback case.

Attachments (1)

ticket.5826.diff (1021 bytes) - added by missionsix 8 years ago.
Patch file to failback to lib check if pkg-config fails

Download all attachments as: .zip

Change History (4)

comment:1 Changed 8 years ago by missionsix

Proposed patch:

--- a/
+++ b/
@@ -115,7 +115,24 @@ AC_SEARCH_LIBS([quotacursor_skipidtype], [quota])
+PKG_CHECK_MODULES(ZLIB, [zlib >= $ZLIB_MINIMUM], [found_zlib=yes], [found_zlib=no])
+if test "x$found_zlib" = "xno" ; then
+   AC_CHECK_LIB(z, inflate,
+       [AC_CHECK_HEADER([zlib.h],
+           [AC_LANG_PROGRAM([[
+               #include <zlib.h>
+               #if !defined(ZLIB_VERNUM) || (ZLIB_VERNUM < 0x1230)
+               // compile error
+               #endif
+          ]],[])],
+          [found_zlib=yes])])])
+   if test "x$found_zlib" = "xno" ; then
+      AC_MSG_ERROR([Working zlib library and headers not found])
+   fi
+   ZLIBS_LIBS='-z'

Changed 8 years ago by missionsix

Patch file to failback to lib check if pkg-config fails

comment:2 Changed 8 years ago by missionsix

The issue was introduced by this well intentioned commit:

comment:3 Changed 8 years ago by mike.dld

Should it be ZLIBS_LIBS='-lz' instead?

Note: See TracTickets for help on using tickets.