From 969b00197fc41087f9eb808a7ebba293966f90de Mon Sep 17 00:00:00 2001 From: mjdenkowski Date: Thu, 7 Aug 2014 16:39:19 -0400 Subject: Option for static linking (./configure --with-static). Currently limited to a few binaries. --- configure.ac | 7 +++++++ decoder/Makefile.am | 2 +- utils/Makefile.am | 1 + word-aligner/Makefile.am | 1 + 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index d7ced0ea..eae2f32e 100644 --- a/configure.ac +++ b/configure.ac @@ -177,6 +177,13 @@ then AM_CONDITIONAL([HAVE_GTEST], true) fi +# Enable static linking +AC_ARG_WITH( + [static], + AS_HELP_STRING([--with-static], [Statically link binaries when possible]), + AC_SUBST(AS_TR_CPP([STATIC_FLAGS]), ["-all-static"]), +) + #BOOST_THREADS CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" LDFLAGS="$LDFLAGS $BOOST_PROGRAM_OPTIONS_LDFLAGS $BOOST_REGEX_LDFLAGS $BOOST_SERIALIZATION_LDFLAGS $BOOST_SYSTEM_LDFLAGS $BOOST_FILESYSTEM_LDFLAGS" diff --git a/decoder/Makefile.am b/decoder/Makefile.am index c85f17ed..02e58479 100644 --- a/decoder/Makefile.am +++ b/decoder/Makefile.am @@ -20,7 +20,7 @@ trule_test_SOURCES = trule_test.cc trule_test_LDADD = $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS) libcdec.a ../mteval/libmteval.a ../utils/libutils.a cdec_SOURCES = cdec.cc -cdec_LDFLAGS= -rdynamic +cdec_LDFLAGS= -rdynamic $(STATIC_FLAGS) cdec_LDADD = libcdec.a ../mteval/libmteval.a ../utils/libutils.a ../klm/search/libksearch.a ../klm/lm/libklm.a ../klm/util/libklm_util.a ../klm/util/double-conversion/libklm_util_double.a AM_CPPFLAGS = -DTEST_DATA=\"$(top_srcdir)/decoder/test_data\" -DBOOST_TEST_DYN_LINK -W -Wno-sign-compare -I$(top_srcdir) -I$(top_srcdir)/mteval -I$(top_srcdir)/utils -I$(top_srcdir)/klm diff --git a/utils/Makefile.am b/utils/Makefile.am index 18495c3a..727fa8a5 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -92,6 +92,7 @@ reconstruct_weights_SOURCES = reconstruct_weights.cc reconstruct_weights_LDADD = libutils.a atools_SOURCES = atools.cc atools_LDADD = libutils.a +atools_LDFLAGS = $(STATIC_FLAGS) phmt_SOURCES = phmt.cc phmt_LDADD = libutils.a $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS) diff --git a/word-aligner/Makefile.am b/word-aligner/Makefile.am index 075ad009..071e4977 100644 --- a/word-aligner/Makefile.am +++ b/word-aligner/Makefile.am @@ -2,6 +2,7 @@ bin_PROGRAMS = fast_align binderiv fast_align_SOURCES = fast_align.cc ttables.cc da.h ttables.h fast_align_LDADD = ../utils/libutils.a +fast_align_LDFLAGS = $(STATIC_FLAGS) binderiv_SOURCES = binderiv.cc binderiv_LDADD = ../utils/libutils.a -- cgit v1.2.3