Source: csync2
Version: 2.0-42-g83b3644-1
Tags: upstream patch
User: [email protected]
Usertags: ftcbfs

csync2 fails to cross build from source, because its configure.ac hard
codes the build architecture pkg-config in a number of places. I'm
attaching a patch to fix that for your convenience.

Helmut
--- csync2-2.0-42-g83b3644.orig/configure.ac
+++ csync2-2.0-42-g83b3644/configure.ac
@@ -126,10 +126,10 @@
 		[enable/disable Postgres support (default is disabled)])],
 	[], [ enable_postgres=no ])
 
-if test "$enable_mysql" == yes
-then
+AS_IF([test "$enable_mysql" == yes],[
+	PKG_CHECK_MODULES([MYSQL],[mysqlclient])
 	# Check for mysql.
-	CFLAGS="$CFLAGS `pkg-config --cflags mysqlclient`"
+	CFLAGS="$CFLAGS $MYSQL_CFLAGS"
 
 	# Check MySQL development header
 	AC_CHECK_HEADERS([mysql.h], , [AC_MSG_ERROR([[mysql header not found; install mysql-devel and dependencies for MySQL Support]])])
@@ -137,24 +137,26 @@
 	AC_DEFINE([HAVE_MYSQL], 1, [Define if mysql support is wanted])
 
 	# [] quotes, or autofoo will strip the character class [] in sed, breaking the regex.
-	[LIBMYSQLCLIENT_SO=$( readlink $(pkg-config --variable=libdir mysqlclient)/libmysqlclient.so | sed -e 's,^.*/,,;s/\(\.so\.[0-9]*\)\..*$/\1/')]
+	[LIBMYSQLCLIENT_SO=$( readlink $($PKG_CONFIG --variable=libdir mysqlclient)/libmysqlclient.so | sed -e 's,^.*/,,;s/\(\.so\.[0-9]*\)\..*$/\1/')]
 	test -n "$LIBMYSQLCLIENT_SO" || AC_MSG_ERROR([Could not determine library name to be used in dlopen for mysql support])
-fi
+])
 AC_DEFINE_UNQUOTED([LIBMYSQLCLIENT_SO], ["$LIBMYSQLCLIENT_SO"], [library name to be used in dlopen for mysql support])
 
-if test "$enable_postgres" == yes
-then
-	CFLAGS="$CFLAGS `pkg-config --cflags libpq`"
+AS_IF([test "$enable_postgres" == yes],[
+	PKG_CHECK_MODULES([LIBPQ],[libpq])
+	CFLAGS="$CFLAGS $LIBPQ_CFLAGS"
         AC_CHECK_HEADERS([libpq-fe.h], , [AC_MSG_ERROR([[postgres header not found; install libpq-dev and dependencies for Postgres support]])])
 
 	AC_DEFINE([HAVE_POSTGRES], 1, [Define if postgres support is wanted])
 
-	# Hmpf. libdir not included in libpq.pc; use pg_config
-	# LIBPQ_SO=$( readlink $(pkg-config --variable=libdir libpq)/libpq.so | sed -e 's,^.*/,,;s/\(\.so\.[0-9]*\)\..*$/\1/')
+	LIBPQ_LIBDIR=`$PKG_CONFIG --variable=libdir libpq`
+	if test -z "$LIBPQ_LIBDIR"; then
+		LIBPQ_LIBDIR=`pg_config --libdir`
+	fi
 	# [] quotes, or autofoo will strip the character class [] in sed, breaking the regex.
-	[LIBPQ_SO=$( readlink $(pg_config --libdir)/libpq.so | sed -e 's,^.*/,,;s/\(\.so\.[0-9]*\)\..*$/\1/')]
+	[LIBPQ_SO=$( readlink $LIBPQ_LIBDIR/libpq.so | sed -e 's,^.*/,,;s/\(\.so\.[0-9]*\)\..*$/\1/')]
 	test -n "$LIBPQ_SO" || AC_MSG_ERROR([Could not determine library name to be used in dlopen for postgres support])
-fi
+])
 AC_DEFINE_UNQUOTED([LIBPQ_SO], ["$LIBPQ_SO"], [library name to be used in dlopen for postgres support])
 
 # at least one db backend must be configured.

Reply via email to