From c349964887901848fb4cd5db53a5bcb6dae27aaa Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date: Sun, 23 Nov 2014 10:16:33 +0100
Subject: [PATCH] Add minimal support for --{enable,disable}-{shared,static}
mpdecimal uses autoconf, but not automake or libtool, so this commit
adds some basic handling of --{enable,disable}-{shared,static}, so
that building the shared library can be disabled in pure static
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
configure.ac | 13 +++++++++++++
libmpdec/Makefile.in | 11 ++++++++++-
3 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/Makefile.in b/Makefile.in
index 2c91891..0c44f36 100644
@@ -9,6 +9,8 @@ LIBSTATIC = @LIBSTATIC@
+BUILD_SHARED = @BUILD_SHARED@
+BUILD_STATIC = @BUILD_STATIC@
exec_prefix = @exec_prefix@
@@ -32,9 +34,13 @@ install: FORCE
$(INSTALL) -d -m 755 $(DESTDIR)$(includedir)
$(INSTALL) -m 644 libmpdec/mpdecimal.h $(DESTDIR)$(includedir)
$(INSTALL) -d -m 755 $(DESTDIR)$(libdir)
+ifeq ($(BUILD_STATIC),yes)
$(INSTALL) -m 644 libmpdec/$(LIBSTATIC) $(DESTDIR)$(libdir)
+ifeq ($(BUILD_SHARED),yes)
$(INSTALL) -m 755 libmpdec/$(LIBSHARED) $(DESTDIR)$(libdir)
cd $(DESTDIR)$(libdir) && ln -sf $(LIBSHARED) $(LIBSONAME) && ln -sf $(LIBSHARED) libmpdec.so
$(INSTALL) -d -m 755 $(DESTDIR)$(docdir)
cp -R doc/* $(DESTDIR)$(docdir)
diff --git a/configure.ac b/configure.ac
index 7ee8f86..2b3e505 100644
@@ -88,6 +88,19 @@ CFLAGS="$saved_cflags"
+ [AS_HELP_STRING([--enable-shared], [build shared library])],
+ [BUILD_SHARED=$enableval],
+ [AS_HELP_STRING([--enable-static], [build static library])],
+ [BUILD_STATIC=$enableval],