From c6a2620f5de7aeea4e9c20ff4e6d1befb4b2e935 Mon Sep 17 00:00:00 2001 From: Thanos Makatos Date: Wed, 9 Mar 2016 13:26:13 +0300 Subject: [PATCH] add configure option to enable static linking --- Makefile.in | 4 ++++ configure.ac | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/Makefile.in b/Makefile.in index 30b0c1a..add456e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -119,6 +119,10 @@ else CXXLIB+=-lstdc++ endif +ifeq ("@STATIC@", "yes") +LDFLAGS+=-static +endif + INSTALL:=@INSTALL@ PREFIX:=@prefix@ BINDIR:=$(DESTDIR)$(PREFIX)/sbin diff --git a/configure.ac b/configure.ac index 1161145..0eef6ab 100644 --- a/configure.ac +++ b/configure.ac @@ -145,6 +145,14 @@ AC_ARG_ENABLE(static_cxx, STATIC_CXX=$enableval, STATIC_CXX=no) AC_MSG_RESULT($STATIC_CXX) +################################################################################ +dnl -- Enable static linking. +AC_MSG_CHECKING(whether to statically link) +AC_ARG_ENABLE(static, + AC_HELP_STRING(--enable-static, [enable static link]), + STATIC=$enableval, STATIC=no) +AC_MSG_RESULT($STATIC) + ################################################################################ dnl -- Check for getopt AC_CHECK_HEADERS(getopt.h, AC_DEFINE([HAVE_GETOPTLONG], 1, [Define to 1 if getopt_long is available.])) @@ -173,6 +181,7 @@ AC_SUBST(RELEASE_DATE) AC_SUBST(TESTING) AC_SUBST(THIN_PROVISIONING_TOOLS_VERSION) AC_SUBST(STATIC_CXX) +AC_SUBST(STATIC) ################################################################################ dnl -- First and last lines should not contain files to generate in order to