[build] substitution for use of LIBPOSTAL_DATA_DIR in Makefile.am

This commit is contained in:
Al
2015-10-26 18:35:23 -04:00
parent f6b6a17335
commit 83c6a87ab1
3 changed files with 12 additions and 5 deletions

View File

@@ -57,6 +57,9 @@ AC_CHECK_PROG([FOUND_GSHUF], [gshuf], [yes])
AS_IF([test "x$FOUND_SHUF" = xyes], [AC_DEFINE([HAVE_SHUF], [1], [shuf available])])
AS_IF([test "x$FOUND_GSHUF" = xyes], [AC_DEFINE([HAVE_GSHUF], [1], [gshuf available])])
AC_DEFINE_UNQUOTED([LIBPOSTAL_DATA_DIR], ["$datadir/libpostal"], [Data directory for libpostsal])
LIBPOSTAL_DATA_DIR=$datadir/libpostal
AC_DEFINE_UNQUOTED([LIBPOSTAL_DATA_DIR], ["$LIBPOSTAL_DATA_DIR"], [Data directory for libpostsal])
AC_SUBST(LIBPOSTAL_DATA_DIR)
AC_OUTPUT

View File

@@ -7,7 +7,7 @@ CFLAGS_O2 = $(CFLAGS_BASE) -O2
CFLAGS_O3 = $(CFLAGS_BASE) -O3
DEFAULT_INCLUDES=-I..
CFLAGS = $(CFLAGS_BASE)
AM_CFLAGS = $(CFLAGS_BASE)
lib_LTLIBRARIES = libpostal.la
libpostal_la_SOURCES = libpostal.c address_dictionary.c transliterate.c tokens.c trie.c trie_search.c string_utils.c file_utils.c numex.c utf8proc/utf8proc.c cmp/cmp.c geodb.c geo_disambiguation.c normalize.c bloom.c features.c geonames.c geohash/geohash.c unicode_scripts.c msgpack_utils.c
@@ -41,10 +41,10 @@ build_trans_table_CFLAGS = $(CFLAGS_O3)
pkginclude_HEADERS = libpostal.h
all-local:
./libpostal_data download base $(LIBPOSTAL_DATA_DIR)
./libpostal_data download base @LIBPOSTAL_DATA_DIR@
download_geodb:
./libpostal_data download geodb $(LIBPOSTAL_DATA_DIR)
./libpostal_data download geodb @LIBPOSTAL_DATA_DIR@
lexer: scanner.re
re2c -F -s -b -8 -o scanner.c scanner.re

View File

@@ -539,7 +539,11 @@ bool address_dictionary_save(char *path) {
}
inline bool address_dictionary_module_setup(char *filename) {
return address_dictionary_load(filename == NULL ? DEFAULT_ADDRESS_EXPANSION_PATH: filename);
if (address_dict == NULL) {
return address_dictionary_load(filename == NULL ? DEFAULT_ADDRESS_EXPANSION_PATH: filename);
}
return true;
}
void address_dictionary_module_teardown(void) {