PCRE developers,
Currently, when bzlib/zlib/readline support is enabled, the relevant
libraries are added directly to LIBS, and all targets are linked against
these libraries. This includes libpcre*, even though they never depend
on these external libraries. Since libtool hard-codes link libraries as
dependencies, linking against libpcre*.la requires these other libraries
to be present, and libpcre-devel requires libz-devel, libbz2-devel, and
libreadline-devel.
I am attaching a patch which fixes this situation by only linking
pcregrep and pcretest against these optional dependencies instead. The
patch was made against 7.7, but applies to 7.8 as well.
Yaakov
Cygwin Ports
--- origsrc/pcre-7.7/Makefile.am 2008-01-23 11:58:28.000000000 -0600
+++ src/pcre-7.7/Makefile.am 2008-07-08 14:26:16.390625000 -0500
@@ -245,13 +245,13 @@
EXTRA_DIST += RunTest.bat
bin_PROGRAMS += pcretest
pcretest_SOURCES = pcretest.c
-pcretest_LDADD = libpcreposix.la
+pcretest_LDADD = libpcreposix.la $(LIBREADLINE)
TESTS += RunGrepTest
dist_noinst_SCRIPTS += RunGrepTest
bin_PROGRAMS += pcregrep
pcregrep_SOURCES = pcregrep.c
-pcregrep_LDADD = libpcreposix.la
+pcregrep_LDADD = libpcreposix.la $(LIBZ) $(LIBBZ2)
EXTRA_DIST += \
testdata/grepinput \
--- origsrc/pcre-7.7/configure.ac 2008-05-07 11:22:03.000000000 -0500
+++ src/pcre-7.7/configure.ac 2008-07-08 14:26:16.406250000 -0500
@@ -539,7 +539,7 @@
AC_SUBST(DISTCHECK_CONFIGURE_FLAGS)
# Check that, if --enable-pcregrep-libz or --enable-pcregrep-libbz2 is
-# specified, the relevant library is available. If so, add it to LIBS.
+# specified, the relevant library is available.
if test "$enable_pcregrep_libz" = "yes"; then
if test "$HAVE_ZLIB_H" != "1"; then
@@ -550,8 +550,9 @@
echo "** Cannot --enable-pcregrep-libz because libz was not found"
exit 1
fi
- if test "$LIBS" = ""; then LIBS=-lz; else LIBS="$LIBS -lz"; fi
+ LIBZ="-lz"
fi
+AC_SUBST(LIBZ)
if test "$enable_pcregrep_libbz2" = "yes"; then
if test "$HAVE_BZLIB_H" != "1"; then
@@ -562,8 +563,9 @@
echo "** Cannot --enable-pcregrep-libbz2 because libbz2 was not found"
exit 1
fi
- if test "$LIBS" = ""; then LIBS=-lbz2; else LIBS="$LIBS -lbz2"; fi
+ LIBBZ2="-lbz2"
fi
+AC_SUBST(LIBBZ2)
# Similarly for --enable-pcretest-readline
@@ -576,8 +578,9 @@
echo "** Cannot --enable-pcretest-readline because readline/history.h was not found."
exit 1
fi
- if test "$LIBS" = ""; then LIBS=-lreadline; else LIBS="$LIBS -lreadline"; fi
+ LIBREADLINE="-lreadline"
fi
+AC_SUBST(LIBREADLINE)
# Produce these files, in addition to config.h.
AC_CONFIG_FILES(