From b7f8ed4b2d4582dda0874166712763d8ff89c384 Mon Sep 17 00:00:00 2001
From: Boris Kolpackov <boris@codesynthesis.com>
Date: Thu, 28 Nov 2013 09:00:13 +0200
Subject: Add support for using external libcutl

---
 README                                                          | 5 +++++
 libxsd-frontend/build/import/libcutl/configuration-dynamic.make | 4 ++++
 makefile                                                        | 7 +++++--
 xsd/build/import/libcutl/configuration-dynamic.make             | 4 ++++
 4 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/README b/README
index 2cfbe98..b7cced1 100644
--- a/README
+++ b/README
@@ -31,6 +31,7 @@ LDFLAGS
 LIBS
 BOOST_LIB_SUFFIX
 BOOST_LINK_SYSTEM
+EXTERNAL_LIBCUTL
 
 For example:
 
@@ -46,6 +47,10 @@ Boost system library should be explicitly linked to which may be
 required by newer linkers. The valid values are 'y' (default) and
 'n'.
 
+The EXTERNAL_LIBCUTL variable allows you to use an external build
+of libcutl, for example, if you already have this library installed.
+The valid values are 'n' (default) and 'y'.
+
 If you would like to see the full compiler/linker/etc., command lines,
 you can add verbose=1 to the make command line:
 
diff --git a/libxsd-frontend/build/import/libcutl/configuration-dynamic.make b/libxsd-frontend/build/import/libcutl/configuration-dynamic.make
index f8b049e..4e4bb83 100644
--- a/libxsd-frontend/build/import/libcutl/configuration-dynamic.make
+++ b/libxsd-frontend/build/import/libcutl/configuration-dynamic.make
@@ -1,4 +1,8 @@
+ifeq ($(EXTERNAL_LIBCUTL),y)
+libcutl_installed := y
+else
 libcutl_installed := n
 src_root := $(abspath $(src_root)/../libcutl)
 scf_root := $(src_root)/build
 out_root := $(src_root)
+endif
diff --git a/makefile b/makefile
index f6493d3..2564fdb 100644
--- a/makefile
+++ b/makefile
@@ -28,15 +28,18 @@ dist-win: $(out_base)/xsd/.dist-win
 
 # Clean.
 #
-clean: $(out_base)/libcutl/.clean              \
-       $(out_base)/libxsd-frontend/.clean      \
+clean: $(out_base)/libxsd-frontend/.clean      \
        $(out_base)/xsd/.clean
 
+ifneq ($(EXTERNAL_LIBCUTL),y)
 src_root := $(src_base)/libcutl
 scf_root := $(src_root)/build
 out_root := $(src_root)
 $(call import,$(src_base)/libcutl/makefile)
 
+clean: $(out_base)/libcutl/.clean
+endif
+
 src_root := $(src_base)/libxsd-frontend
 scf_root := $(src_root)/build
 out_root := $(src_root)
diff --git a/xsd/build/import/libcutl/configuration-dynamic.make b/xsd/build/import/libcutl/configuration-dynamic.make
index f8b049e..4e4bb83 100644
--- a/xsd/build/import/libcutl/configuration-dynamic.make
+++ b/xsd/build/import/libcutl/configuration-dynamic.make
@@ -1,4 +1,8 @@
+ifeq ($(EXTERNAL_LIBCUTL),y)
+libcutl_installed := y
+else
 libcutl_installed := n
 src_root := $(abspath $(src_root)/../libcutl)
 scf_root := $(src_root)/build
 out_root := $(src_root)
+endif
-- 
cgit v1.1