Opened 4 years ago

Last modified 4 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
Cc:

Description

The following configure error happens on trunk.

build% ../Transmission/autogen.sh --disable-nls
creating libtransmission/version.h
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
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/Makefile.in.in

...

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.

PKG_CHECK_MODULES(ZLIB, [zlib >= $ZLIB_MINIMUM])

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 4 years ago.
Patch file to failback to lib check if pkg-config fails

Download all attachments as: .zip

Change History (4)

comment:1 Changed 4 years ago by missionsix

Proposed patch:

--- a/configure.ac
+++ b/configure.ac
@@ -115,7 +115,24 @@ AC_SEARCH_LIBS([quotacursor_skipidtype], [quota])
 PKG_CHECK_MODULES(OPENSSL, [openssl >= $OPENSSL_MINIMUM], , [CHECK_SSL()])
 PKG_CHECK_MODULES(LIBCURL, [libcurl >= $CURL_MINIMUM])
 PKG_CHECK_MODULES(LIBEVENT, [libevent >= $LIBEVENT_MINIMUM])
-PKG_CHECK_MODULES(ZLIB, [zlib >= $ZLIB_MINIMUM])
+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_COMPILE_IFELSE(
+           [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'
+   AC_SUBST(ZLIB_LIBS)
+fi

Changed 4 years ago by missionsix

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

comment:2 Changed 4 years ago by missionsix

The issue was introduced by this well intentioned commit:

https://trac.transmissionbt.com/changeset/14323/

comment:3 Changed 4 years ago by mike.dld

Should it be ZLIBS_LIBS='-lz' instead?

Note: See TracTickets for help on using tickets.