From 8fe7958969cce2234b609122219bbc495d79d1f7 Mon Sep 17 00:00:00 2001 From: Al Date: Thu, 22 Dec 2016 12:24:40 -0500 Subject: [PATCH] [build] allowing --disable-data-download option to configure. N.B. this is mostly for people building Docker images. The data files are NOT optional. --- configure.ac | 10 ++++++++++ src/Makefile.am | 2 ++ 2 files changed, 12 insertions(+) diff --git a/configure.ac b/configure.ac index ae44cbfd..f7cbc42d 100644 --- a/configure.ac +++ b/configure.ac @@ -60,4 +60,14 @@ AC_CHECK_PROG([FOUND_SHUF], [shuf], [yes]) AS_IF([test "x$FOUND_SHUF" = xyes], [AC_DEFINE([HAVE_SHUF], [1], [shuf available])]) +AC_ARG_ENABLE([data-download], + [ --disable-data-download Disable downloading data], + [case "${enableval}" in + yes) DOWNLOAD_DATA=true ;; + no) DOWNLOAD_DATA=false ;; + *) AC_MSG_ERROR([bad value ${enableval} for --disable-data-download]) ;; + esac], [DOWNLOAD_DATA=true]) + +AM_CONDITIONAL([DOWNLOAD_DATA], [test "x$DOWNLOAD_DATA" = "xtrue"]) + AC_OUTPUT diff --git a/src/Makefile.am b/src/Makefile.am index 79f2fd0f..82c9cecc 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -64,8 +64,10 @@ language_classifier_test_CFLAGS = $(CFLAGS_O3) pkginclude_HEADERS = libpostal.h +if DOWNLOAD_DATA all-local: ${srcdir}/libpostal_data download all $(datadir)/libpostal +endif lexer: scanner.re re2c -F -s -b -8 -o scanner.c scanner.re