[PATCH v2 1/1] configure.ac: use pkg-config to find expat

Andrew Oakley aoakley at espial.com
Tue Jan 27 09:18:13 PST 2015


This is now done in the same way as the libffi dependency and still
allows the library to be installed in a non-standard location (with
PKG_CONFIG_PATH).
---
 Makefile.am  |  1 +
 configure.ac | 11 +----------
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 1551762..443fe08 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -65,6 +65,7 @@ if ENABLE_SCANNER
 wayland_scanner = $(top_builddir)/wayland-scanner
 bin_PROGRAMS = wayland-scanner
 wayland_scanner_SOURCES = src/scanner.c
+wayland_scanner_CFLAGS = $(EXPAT_CFLAGS) $(AM_CFLAGS)
 wayland_scanner_LDADD = $(EXPAT_LIBS) libwayland-util.la
 $(BUILT_SOURCES) : wayland-scanner
 pkgconfig_DATA += src/wayland-scanner.pc
diff --git a/configure.ac b/configure.ac
index 0249002..b518ce1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -71,17 +71,8 @@ AC_ARG_WITH(icondir, [  --with-icondir=<dir>    Look for cursor icons here],
 		     [  ICONDIR=${datadir}/icons])
 AC_SUBST([ICONDIR])
 
-EXPAT_LIB=""
-AC_ARG_WITH(expat, [  --with-expat=<dir>      Use expat from here],
-		   [ expat=$withval
-		     CPPFLAGS="$CPPFLAGS -I$withval/include"
-		     LDFLAGS="$LDFLAGS -L$withval/lib" ] )
 if test "x$enable_scanner" = "xyes"; then
-	AC_CHECK_HEADERS(expat.h, [AC_DEFINE(HAVE_EXPAT_H)],
-			 [AC_MSG_ERROR([Can't find expat.h. Please install expat.])])
-	AC_CHECK_LIB(expat, XML_ParserCreate, [EXPAT_LIBS="-lexpat"],
-		     [AC_MSG_ERROR([Can't find expat library. Please install expat.])])
-	AC_SUBST(EXPAT_LIBS)
+	PKG_CHECK_MODULES(EXPAT, [expat])
 fi
 
 AC_PATH_PROG(XSLTPROC, xsltproc)
-- 
2.0.5



More information about the wayland-devel mailing list