Source: xchat
Version: 2.8.8-21
Tags: patch
User: debian-cr...@lists.debian.org
Usertags: ftcbfs

xchat fails to cross build from source, because it hard codes the build
architecture pkg-config in configure.in. Please consider applying the
attached patch to make it use standard macros such as
PKG_PROG_PKG_CONFIG and PKG_CHECK_MODULES (the latter is already used in
some places, but not universally). Doing so makes xchat cross buildable.

Helmut
--- xchat-2.8.8.orig/configure.in
+++ xchat-2.8.8/configure.in
@@ -17,6 +17,7 @@
 AM_PROG_AS
 AM_DISABLE_STATIC
 AC_PROG_LIBTOOL
+PKG_PROG_PKG_CONFIG
 
 dnl -----------------------------------------------------------
 dnl Language Support
@@ -187,15 +188,14 @@
 
 gnome=no
 #if test "$gnome" = yes; then
-#	AC_PATH_PROG(pkgconfigpath, pkg-config)
 #	AC_MSG_CHECKING(Gnome2 compile flags)
-#	GNOME_CFLAGS="`$pkgconfigpath libgnome-2.0 --cflags 2>/dev/null`"
+#	GNOME_CFLAGS="`$PKG_CONFIG libgnome-2.0 --cflags 2>/dev/null`"
 #	if test "_$GNOME_CFLAGS" = _ ; then
 #		gnome=no
 #		AC_MSG_RESULT([Gnome not found, building without it.])
 #	else
-#		GNOME_VER="`$pkgconfigpath libgnome-2.0 --modversion`"
-#		GUI_LIBS="$GUI_LIBS `$pkgconfigpath libgnome-2.0 --libs`"
+#		GNOME_VER="`$PKG_CONFIG libgnome-2.0 --modversion`"
+#		GUI_LIBS="$GUI_LIBS `$PKG_CONFIG libgnome-2.0 --libs`"
 #		GUI_CFLAGS="$GUI_CFLAGS $GNOME_CFLAGS"
 #		AC_DEFINE(USE_GNOME)
 #		AC_MSG_RESULT(ok)
@@ -209,22 +209,21 @@
 dnl ** XFT **************************************************************
 dnl *********************************************************************
 
-if test "$xft" = yes; then
-	AC_PATH_PROG(pkgconfigpath, pkg-config)
-	if $pkgconfigpath xft --exists; then
-		GUI_CFLAGS="$GUI_CFLAGS `$pkgconfigpath xft --cflags`"
-		GUI_LIBS="$GUI_LIBS `$pkgconfigpath xft --libs`"
-	else
+AS_IF([test "$xft" = yes],[
+	PKG_CHECK_MODULES([XFT],[xft],[
+		GUI_CFLAGS="$GUI_CFLAGS $XFT_CFLAGS"
+		GUI_LIBS="$GUI_LIBS $XFT_LIBS"
+	],[
 		xft=no
 		oldCPPFLAGS=$CPPFLAGS
 		CPPFLAGS="$CPPFLAGS $GTK_CFLAGS"
 		AC_CHECK_HEADERS(X11/Xft/Xft.h, xft=yes)
 		CPPFLAGS=$oldCPPFLAGS
-	fi
+	])
 	if test "$xft" = yes; then
 		AC_DEFINE(USE_XFT)
 	fi
-fi
+])
 
 dnl *********************************************************************
 dnl ** XLIB *************************************************************
@@ -383,20 +382,18 @@
 dnl *********************************************************************
 
 retry=no
-if test "$openssl" != no; then
-	AC_PATH_PROG(pkgconfigpath, pkg-config)
-	AC_MSG_CHECKING(for openssl through pkg-config)
-	if $pkgconfigpath openssl --exists; then
-		CPPFLAGS="$CPPFLAGS `$pkgconfigpath openssl --cflags`"
-		LIBS="$LIBS `$pkgconfigpath openssl --libs`"
+AS_IF([test "$openssl" != no],[
+	PKG_CHECK_MODULES([OPENSSL],[openssl],[
+		CPPFLAGS="$CPPFLAGS $OPENSSL_CFLAGS"
+		LIBS="$LIBS $OPENSSL_LIBS"
 		AC_DEFINE(USE_OPENSSL)
 		AC_MSG_RESULT(yes)
 		openssl=yes
-	else
+	],[
 		AC_MSG_RESULT(no)
 		retry=yes
-	fi
-fi
+	])
+])
 
 if test "$retry" = "yes"; then
 	unset openssl_path ac_cv_lib_ssl_SSL_new ac_cv_header_openssl_ssl_h
@@ -444,8 +441,7 @@
 	fi
 	if test "$have_dl" = yes; then
 		AC_DEFINE(USE_PLUGIN)
-		AC_PATH_PROG(pkgconfigpath, pkg-config)
-		RDYNAMIC_FLAGS="`$pkgconfigpath gmodule-2.0 --libs`"
+		RDYNAMIC_FLAGS="`$PKG_CONFIG gmodule-2.0 --libs`"
 		LIBS="$LIBS $RDYNAMIC_FLAGS"
 		if test "$LD" = ""; then
 			VS="`ld --help | grep version-script 2> /dev/null`"
@@ -570,8 +566,8 @@
 if test "$shm" = yes; then
 	oldl=$LIBS
 	oldc=$CPPFLAGS
-	LIBS="$LIBS `$pkgconfigpath --libs-only-L xft`"
-	CPPFLAGS="$CPPFLAGS `$pkgconfigpath --cflags-only-I xft`"
+	LIBS="$LIBS `$PKG_CONFIG --libs-only-L xft`"
+	CPPFLAGS="$CPPFLAGS `$PKG_CONFIG --cflags-only-I xft`"
 	shm=no
 	AC_CHECK_LIB(Xext, XShmAttach, shm=yes)
 	if test "$shm" = yes; then
@@ -585,7 +581,7 @@
 
 	LIBS=$oldl
 	if test "$shm" = yes; then
-		GUI_LIBS="$GUI_LIBS `$pkgconfigpath --libs-only-L xft` -lX11 -lXext"
+		GUI_LIBS="$GUI_LIBS `$PKG_CONFIG --libs-only-L xft` -lX11 -lXext"
 		AC_DEFINE(USE_SHM)
 	else
 		CPPFLAGS=$oldc

Reply via email to