diff --git a/CreateOnDisk/src/Makefile.am b/CreateOnDisk/src/Makefile.am index a3e0ec7f..59ac19bf 100644 --- a/CreateOnDisk/src/Makefile.am +++ b/CreateOnDisk/src/Makefile.am @@ -2,8 +2,8 @@ bin_PROGRAMS = CreateOnDiskPt CreateOnDiskPt_SOURCES = Main.cpp AM_CPPFLAGS = -W -Wall -ffor-scope -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DUSE_HYPO_POOL -I$(top_srcdir)/moses/src $(BOOST_CPPFLAGS) -CreateOnDiskPt_LDADD = -L$(top_srcdir)/OnDiskPt/src -L$(top_srcdir)/moses/src -lOnDiskPt -lmoses -CreateOnDiskPt_DEPENDENCIES = $(top_srcdir)/OnDiskPt/src/libOnDiskPt.a $(top_srcdir)/moses/src/libmoses.la +CreateOnDiskPt_LDADD = -L$(top_srcdir)/OnDiskPt/src -L$(top_srcdir)/moses/src -lOnDiskPt -lmoses @KENLM_LDFLAGS@ +CreateOnDiskPt_DEPENDENCIES = $(top_srcdir)/OnDiskPt/src/libOnDiskPt.a $(top_srcdir)/moses/src/libmoses.la @KENLM_DEPS@ diff --git a/Makefile.am b/Makefile.am index 2e45f6b4..d4207a43 100644 --- a/Makefile.am +++ b/Makefile.am @@ -11,4 +11,4 @@ endif if WITH_SERVER SERVER = server endif -SUBDIRS = moses/src moses-chart/src OnDiskPt/src kenlm moses-cmd/src misc moses-chart-cmd/src CreateOnDisk/src $(MERT) $(SERVER) +SUBDIRS = kenlm moses/src moses-chart/src OnDiskPt/src moses-cmd/src misc moses-chart-cmd/src CreateOnDisk/src $(MERT) $(SERVER) diff --git a/configure.in b/configure.in index c84f7c57..02404a7d 100644 --- a/configure.in +++ b/configure.in @@ -197,12 +197,16 @@ then [AC_DEFINE([HAVE_KENLM], [], [flag for KENLM])], [AC_MSG_ERROR([Cannot find KEN-LM in ${PWD}/kenlm])]) - LIB_KENLM="-lkenlm" - LDFLAGS="$LDFLAGS -L${PWD}/kenlm" - LIBS="$LIBS $LIB_KENLM" - FMTLIBS="$FMTLIBS libkenlm.a" + KENLM_LDFLAGS="-L\$(top_srcdir)/kenlm -lkenlm -lz" + KENLM_DEPS="\$(top_srcdir)/kenlm/libkenlm.la" + FMTLIBS="$FMTLIBS libkenlm.la" AM_CONDITIONAL([KEN_LM], true) +else + KENLM_LDFLAGS="" + KENLM_DEPS="" fi +AC_SUBST(KENLM_LDFLAGS) +AC_SUBST(KENLM_DEPS) if test "x$with_randlm" != 'xno' then diff --git a/kenlm/Makefile.am b/kenlm/Makefile.am index 0e76cd1f..c7376e2f 100644 --- a/kenlm/Makefile.am +++ b/kenlm/Makefile.am @@ -1,8 +1,8 @@ -lib_LIBRARIES = libkenlm.a +lib_LTLIBRARIES = libkenlm.la bin_PROGRAMS = query build_binary AM_CPPFLAGS = -W -Wall -ffor-scope -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES $(BOOST_CPPFLAGS) -libkenlm_a_SOURCES = \ +libkenlm_la_SOURCES = \ lm/lm_exception.cc \ lm/config.cc \ lm/model.cc \ @@ -24,10 +24,8 @@ libkenlm_a_SOURCES = \ util/bit_packing.cc query_SOURCES = lm/ngram_query.cc -query_DEPENDENCIES = libkenlm.a -query_LDADD = -L$(top_srcdir)/kenlm -lkenlm -lz +query_LDADD = libkenlm.la build_binary_SOURCES = lm/build_binary.cc -build_binary_DEPENDENCIES = libkenlm.a -build_binary_LDADD = -L$(top_srcdir)/kenlm -lkenlm -lz +build_binary_LDADD = libkenlm.la diff --git a/kenlm/util/string_piece.cc b/kenlm/util/string_piece.cc index 5b4e98f5..71b47cd3 100644 --- a/kenlm/util/string_piece.cc +++ b/kenlm/util/string_piece.cc @@ -35,17 +35,11 @@ #endif #include -#include #ifdef HAVE_ICU U_NAMESPACE_BEGIN #endif -std::ostream& operator<<(std::ostream& o, const StringPiece& piece) { - o.write(piece.data(), static_cast(piece.size())); - return o; -} - #ifdef HAVE_BOOST size_t hash_value(const StringPiece &str) { return boost::hash_range(str.data(), str.data() + str.length()); diff --git a/kenlm/util/string_piece.hh b/kenlm/util/string_piece.hh index 3ac2f8a7..40c3bbc1 100644 --- a/kenlm/util/string_piece.hh +++ b/kenlm/util/string_piece.hh @@ -56,13 +56,14 @@ #include #include +#include + #ifdef HAVE_ICU #include U_NAMESPACE_BEGIN #else #include -#include #include #include @@ -228,7 +229,9 @@ inline bool operator>=(const StringPiece& x, const StringPiece& y) { } // allow StringPiece to be logged (needed for unit testing). -extern std::ostream& operator<<(std::ostream& o, const StringPiece& piece); +inline std::ostream& operator<<(std::ostream& o, const StringPiece& piece) { + return o.write(piece.data(), static_cast(piece.size())); +} #ifdef HAVE_BOOST size_t hash_value(const StringPiece &str); diff --git a/misc/Makefile.am b/misc/Makefile.am index 0bc9501a..153e9b73 100644 --- a/misc/Makefile.am +++ b/misc/Makefile.am @@ -7,10 +7,10 @@ queryPhraseTable_SOURCES = queryPhraseTable.cpp AM_CPPFLAGS = -W -Wall -ffor-scope -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -I$(top_srcdir)/moses/src $(BOOST_CPPFLAGS) -processPhraseTable_LDADD = $(top_builddir)/moses/src/libmoses.la $(BOOST_LDFLAGS) $(BOOST_THREAD_LIB) -L$(top_srcdir)/moses/src -L$(top_srcdir)/OnDiskPt/src -lmoses -lOnDiskPt +processPhraseTable_LDADD = $(top_builddir)/moses/src/libmoses.la $(BOOST_LDFLAGS) $(BOOST_THREAD_LIB) -L$(top_srcdir)/moses/src -L$(top_srcdir)/OnDiskPt/src -lmoses -lOnDiskPt @KENLM_LDFLAGS@ -processLexicalTable_LDADD = $(top_builddir)/moses/src/libmoses.la $(BOOST_LDFLAGS) $(BOOST_THREAD_LIB) -L$(top_srcdir)/moses/src -L$(top_srcdir)/OnDiskPt/src -lmoses -lOnDiskPt +processLexicalTable_LDADD = $(top_builddir)/moses/src/libmoses.la $(BOOST_LDFLAGS) $(BOOST_THREAD_LIB) -L$(top_srcdir)/moses/src -L$(top_srcdir)/OnDiskPt/src -lmoses -lOnDiskPt @KENLM_LDFLAGS@ -queryLexicalTable_LDADD = $(top_builddir)/moses/src/libmoses.la $(BOOST_LDFLAGS) $(BOOST_THREAD_LIB) -L$(top_srcdir)/moses/src -L$(top_srcdir)/OnDiskPt/src -lmoses -lOnDiskPt +queryLexicalTable_LDADD = $(top_builddir)/moses/src/libmoses.la $(BOOST_LDFLAGS) $(BOOST_THREAD_LIB) -L$(top_srcdir)/moses/src -L$(top_srcdir)/OnDiskPt/src -lmoses -lOnDiskPt @KENLM_LDFLAGS@ -queryPhraseTable_LDADD = $(top_builddir)/moses/src/libmoses.la $(BOOST_LDFLAGS) $(BOOST_THREAD_LIB) -L$(top_srcdir)/moses/src -L$(top_srcdir)/OnDiskPt/src -lmoses -lOnDiskPt +queryPhraseTable_LDADD = $(top_builddir)/moses/src/libmoses.la $(BOOST_LDFLAGS) $(BOOST_THREAD_LIB) -L$(top_srcdir)/moses/src -L$(top_srcdir)/OnDiskPt/src -lmoses -lOnDiskPt @KENLM_LDFLAGS@ diff --git a/moses-chart-cmd/src/Makefile.am b/moses-chart-cmd/src/Makefile.am index 68f652fc..d49d3100 100644 --- a/moses-chart-cmd/src/Makefile.am +++ b/moses-chart-cmd/src/Makefile.am @@ -2,8 +2,8 @@ bin_PROGRAMS = moses_chart moses_chart_SOURCES = Main.cpp mbr.cpp IOWrapper.cpp TranslationAnalysis.cpp AM_CPPFLAGS = -W -Wall -ffor-scope -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DUSE_HYPO_POOL -I$(top_srcdir)/moses/src $(BOOST_CPPFLAGS) -moses_chart_LDADD = -L$(top_srcdir)/moses/src -L$(top_srcdir)/moses-chart/src -L$(top_srcdir)/OnDiskPt/src -lmoses -lmoses-chart -lOnDiskPt $(BOOST_LDFLAGS) $(BOOST_THREAD_LIB) -moses_chart_DEPENDENCIES = $(top_srcdir)/moses/src/libmoses.la $(top_srcdir)/moses-chart/src/libmoses-chart.a $(top_srcdir)/OnDiskPt/src/libOnDiskPt.a +moses_chart_LDADD = -L$(top_srcdir)/moses/src -L$(top_srcdir)/moses-chart/src -L$(top_srcdir)/OnDiskPt/src -lmoses -lmoses-chart -lOnDiskPt $(BOOST_LDFLAGS) $(BOOST_THREAD_LIB) @KENLM_LDFLAGS@ +moses_chart_DEPENDENCIES = $(top_srcdir)/moses/src/libmoses.la $(top_srcdir)/moses-chart/src/libmoses-chart.a $(top_srcdir)/OnDiskPt/src/libOnDiskPt.a @KENLM_DEPS@ diff --git a/moses-cmd/src/Makefile.am b/moses-cmd/src/Makefile.am index 350b4faf..e7cb0f12 100644 --- a/moses-cmd/src/Makefile.am +++ b/moses-cmd/src/Makefile.am @@ -3,11 +3,11 @@ bin_PROGRAMS = moses lmbrgrid checkplf AM_CPPFLAGS = -W -Wall -ffor-scope -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DUSE_HYPO_POOL -I$(top_srcdir)/moses/src $(BOOST_CPPFLAGS) checkplf_SOURCES = checkplf.cpp -checkplf_LDADD = $(top_builddir)/moses/src/libmoses.la +checkplf_LDADD = $(top_builddir)/moses/src/libmoses.la $(BOOST_LDFLAGS) $(BOOST_THREAD_LIB) -L$(top_srcdir)/OnDiskPt/src -lOnDiskPt @KENLM_LDFLAGS@ moses_SOURCES = Main.cpp mbr.cpp IOWrapper.cpp TranslationAnalysis.cpp LatticeMBR.cpp ThreadPool.cpp -moses_LDADD = $(top_builddir)/moses/src/libmoses.la $(BOOST_LDFLAGS) $(BOOST_THREAD_LIB) -L$(top_srcdir)/OnDiskPt/src -lOnDiskPt +moses_LDADD = $(top_builddir)/moses/src/libmoses.la $(BOOST_LDFLAGS) $(BOOST_THREAD_LIB) -L$(top_srcdir)/OnDiskPt/src -lOnDiskPt @KENLM_LDFLAGS@ lmbrgrid_SOURCES = LatticeMBRGrid.cpp LatticeMBR.cpp IOWrapper.cpp -lmbrgrid_LDADD = $(top_builddir)/moses/src/libmoses.la $(BOOST_LDFLAGS) $(BOOST_THREAD_LIB) -L$(top_srcdir)/OnDiskPt/src -lOnDiskPt +lmbrgrid_LDADD = $(top_builddir)/moses/src/libmoses.la $(BOOST_LDFLAGS) $(BOOST_THREAD_LIB) -L$(top_srcdir)/OnDiskPt/src -lOnDiskPt @KENLM_LDFLAGS@ diff --git a/server/Makefile.am b/server/Makefile.am index 3fad3d80..c2380276 100644 --- a/server/Makefile.am +++ b/server/Makefile.am @@ -1,5 +1,5 @@ bin_PROGRAMS = mosesserver mosesserver_SOURCES = mosesserver.cpp mosesserver_CPPFLAGS = -W -Wall -I$(top_srcdir)/moses/src $(XMLRPC_C_CPPFLAGS) $(BOOST_CPPFLAGS) -mosesserver_LDADD = -L$(top_srcdir)/moses/src -lmoses $(BOOST_LDFLAGS) $(XMLRPC_C_LIBS) $(BOOST_THREAD_LIB) -L$(top_srcdir)/OnDiskPt/src -lOnDiskPt -mosesserver_DEPENDENCIES = $(top_srcdir)/moses/src/libmoses.la $(top_srcdir)/OnDiskPt/src/libOnDiskPt.a +mosesserver_LDADD = -L$(top_srcdir)/moses/src -lmoses $(BOOST_LDFLAGS) $(XMLRPC_C_LIBS) $(BOOST_THREAD_LIB) -L$(top_srcdir)/OnDiskPt/src -lOnDiskPt @KENLM_LDFLAGS@ +mosesserver_DEPENDENCIES = $(top_srcdir)/moses/src/libmoses.la $(top_srcdir)/OnDiskPt/src/libOnDiskPt.a @KENLM_DEPS@