Bug 629666 — libfolks should not hard autodetect libxml
authorPhilip Withnall <philip.withnall@collabora.co.uk>
Tue, 14 Sep 2010 16:25:03 +0000 (17:25 +0100)
committerPhilip Withnall <philip.withnall@collabora.co.uk>
Sat, 18 Sep 2010 15:45:09 +0000 (16:45 +0100)
Add an --enable-import-tool configure option which requires libxml2 when
passed, doesn't require it when --disable-import-tool is passed, and builds
the tool if possible (but doesn't require libxml2)  when nothing's passed.
Closes: bgo#629666

configure.ac
tools/Makefile.am

index daa886b..f56a847 100644 (file)
@@ -124,8 +124,17 @@ AC_SUBST([BACKEND_DIR])
 # Tools
 # -----------------------------------------------------------
 
-PKG_CHECK_MODULES(LIBXML, libxml-2.0, [have_libxml=yes], [have_libxml=no])
-AM_CONDITIONAL([HAVE_LIBXML], [test "$have_libxml" = "yes"])
+AC_ARG_ENABLE([import-tool],
+              AS_HELP_STRING([--enable-import-tool],
+                             [Enable building the meta-contact import tool]),
+              [enable_import_tool=$enableval with_import_tool=$enableval],
+              [enable_import_tool=maybe with_import_tool=no])
+AS_IF([test "$enable_import_tool" != "no"],
+      [PKG_CHECK_MODULES([LIBXML], [libxml-2.0],
+                         [with_import_tool=yes], [with_import_tool=no])])
+AS_IF([test "$enable_import_tool" = "yes" -a "$with_import_tool" = "no"],
+      [AC_MSG_ERROR([Import tool explicitly enabled, but libxml2 not found])])
+AM_CONDITIONAL([ENABLE_IMPORT_TOOL], [test "$with_import_tool" = "yes"])
 
 # -----------------------------------------------------------
 # Documentation
@@ -227,7 +236,7 @@ Configure summary:
         Bugreporting URL............:  ${PACKAGE_BUGREPORT}
         Documentation...............:  ${enable_docs}
         Tests.......................:  ${have_tp_glib_for_tests}
-        Import tool.................:  ${have_libxml}
+        Import tool.................:  ${with_import_tool}
 
 
 "
index 5c38564..a538a99 100644 (file)
@@ -1,4 +1,4 @@
-if HAVE_LIBXML
+if ENABLE_IMPORT_TOOL
 bin_PROGRAMS = folks-import
 endif