build: use pkgconfig to detect zlib

build: explicitly call PKG_PROG_PKG_CONFIG

Per the manual page, PKG_PROG_PKG_CONFIG needs to be invoked
explicitly if PKG_CHECK_MODULES might not happen (it is indeed stowed
in an AS_IF in kmod). Without this, funny failures can occur.
(As it did.)
This commit is contained in:
Jan Engelhardt 2011-12-24 04:45:22 +01:00
parent bb417099e4
commit 7b3a74fc67
3 changed files with 10 additions and 18 deletions

View File

@ -8,7 +8,8 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/libkmod \
-DROOTPREFIX=\""$(rootprefix)"\" \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
-DLIBEXECDIR=\""$(libexecdir)"\"
-DLIBEXECDIR=\""$(libexecdir)"\" \
${zlib_CFLAGS}
AM_CFLAGS = \
-fvisibility=hidden \
@ -26,7 +27,8 @@ SED_PROCESS = \
-e 's,@exec_prefix\@,$(exec_prefix),g' \
-e 's,@libdir\@,$(libdir),g' \
-e 's,@includedir\@,$(includedir),g' \
-e 's,@required_private_libs\@,$(required_private_libs),g' \
-e 's,@zlib_CFLAGS\@,${zlib_CFLAGS},g' \
-e 's,@zlib_LIBS\@,${zlib_LIBS},g' \
< $< > $@ || rm $@
%.pc: %.pc.in Makefile
@ -61,7 +63,7 @@ libkmod_libkmod_la_LDFLAGS = $(AM_LDFLAGS) \
-version-info $(LIBKMOD_CURRENT):$(LIBKMOD_REVISION):$(LIBKMOD_AGE) \
-Wl,--version-script=$(top_srcdir)/libkmod/libkmod.sym
libkmod_libkmod_la_DEPENDENCIES = ${top_srcdir}/libkmod/libkmod.sym
libkmod_libkmod_la_LIBADD = @zlib_libs@
libkmod_libkmod_la_LIBADD = ${zlib_LIBS}
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libkmod/libkmod.pc

View File

@ -27,8 +27,7 @@ AC_C_BIGENDIAN
AC_PROG_SED
AC_PROG_MKDIR_P
required_private_libs=""
PKG_PROG_PKG_CONFIG
AC_ARG_WITH([rootprefix],
AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for config files and kernel modules]),
@ -56,17 +55,10 @@ AC_ARG_ENABLE([zlib],
AS_HELP_STRING([--enable-zlib], [handle gzipped modules @<:@default=disabled@:>@]),
[], enable_zlib=no)
AS_IF([test "x$enable_zlib" != "xno"], [
AC_CHECK_LIB([z], [gzopen], [
zlib_libs="-lz"
required_private_libs="${required_private_libs} ${zlib_libs}"
AC_DEFINE(ENABLE_ZLIB, [1], [Enable zlib for modules.])
AC_SUBST(zlib_libs)
],
[AC_MSG_ERROR([zlib is not present])
])
PKG_CHECK_MODULES([zlib], [zlib])
AC_DEFINE([ENABLE_ZLIB], [1], [Enable zlib for modules.])
], [
AC_MSG_NOTICE([zlib support not requested])
zlib_libs=""
])
AC_ARG_ENABLE([debug],
@ -123,8 +115,6 @@ CC_CHECK_CFLAGS_APPEND([ \
-Wl,--gc-sections])
AC_SUBST(required_private_libs)
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_FILES([
Makefile

View File

@ -7,5 +7,5 @@ Name: libkmod
Description: Library to deal with kernel modules
Version: @VERSION@
Libs: -L${libdir} -lkmod
Libs.private: @required_private_libs@
Cflags: -I${includedir}
Libs.private: @zlib_LIBS@
Cflags: -I${includedir} @zlib_CFLAGS@