Hi,

Here is fix to replace configure.in attempt to exec host pcre-config by
a pkg-config method. "Previous" method was not really adapted if you try
to cross-compile grep. If host have pcre-config, it contain host cflags
and ldflags which make linker not happy :

i586-geode-linux-uclibc-gcc  -Os -pipe -march=k6-2 -fomit-frame-pointer
-I/usr/i586-geode-linux-uclibc/usr/include/
-I/usr/i586-geode-linux-uclibc/include/    -o grep  grep.o dfa.o kwset.o
search.o grepmat.o ../lib/libgreputils.a -L/usr/lib64 -Wl,-Bstatic
-lpcre -Wl,-Bdynamic
/usr/libexec/gcc/i586-geode-linux-uclibc/ld: skipping incompatible
/usr/lib64/libpcre.a when searching for -lpcre
/usr/libexec/gcc/i586-geode-linux-uclibc/ld: cannot find -lpcre
collect2: ld returned 1 exit status
make[2]: *** [grep] Error 1

The attached patch are for grep 2.5.1a and 2.5.4.

Thanks,
Bertrand

-- 
Beber
--- configure.in.ori	2002-03-26 16:48:16.000000000 +0100
+++ configure.in	2009-05-13 20:36:31.000000000 +0200
@@ -27,6 +27,7 @@
 AC_PROG_CC
 AC_PROG_INSTALL
 AC_PROG_RANLIB
+PKG_PROG_PKG_CONFIG
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_SYS_LARGEFILE
@@ -134,10 +135,10 @@
 
 # support for pcre
 if test x"$testpcre" = x"yes"; then
-	if pcre-config --cflags >/dev/null 2>&1; then
-		CFLAGS="$CFLAGS `pcre-config --cflags`"
-		LIBS="$LIBS `pcre-config --libs`"
-	fi
+	PKG_CHECK_MODULES(pcre, [libpcre])
+	CFLAGS="$CFLAGS $pcre_CFLAGS"
+	LIBS="$LIBS $pcre_LIBS"
+
 	AC_CHECK_LIB(pcre, pcre_exec)
 fi
 
--- configure.ac.ori	2009-02-10 05:35:21.000000000 +0100
+++ configure.ac	2009-05-13 20:42:46.000000000 +0200
@@ -43,6 +43,7 @@
 AC_PROG_CC
 AC_PROG_INSTALL
 AC_PROG_RANLIB
+PKG_PROG_PKG_CONFIG
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_SYS_LARGEFILE
@@ -153,10 +154,10 @@
 
 # support for pcre
 if test x"$testpcre" = x"yes"; then
-	if pcre-config --cflags >/dev/null 2>&1; then
-		CPPFLAGS="$CPPFLAGS `pcre-config --cflags`"
-		LIBS="$LIBS `pcre-config --libs`"
-	fi
+	PKG_CHECK_MODULES(pcre, [libpcre])
+	CFLAGS="$CFLAGS $pcre_CFLAGS"
+	LIBS="$LIBS $pcre_LIBS"
+
 	AC_CHECK_LIB(pcre, pcre_exec)
 fi
 

Attachment: signature.asc
Description: Digital signature

Reply via email to