@@ -172,6 +172,16 @@ AS_IF([test "${with_platform}" = "linux-generic"],
AC_DEFINE_UNQUOTED([IMPLEMENTATION_NAME], ["$IMPLEMENTATION_NAME"],
[Define to the name of the implementation])
+##########################################################################
+# Build examples/tests dynamically
+##########################################################################
+AC_ARG_ENABLE([static-link],
+ [AS_HELP_STRING([--disable-static-link],
+ [disable static linking of examples and tests])],
+ [static_link=$enableval],
+ [static_link=yes])
+AM_CONDITIONAL([STATIC_LINK], [test "x$static_link" != "xno"])
+
##########################################################################
# Include m4 files
##########################################################################
@@ -13,4 +13,8 @@ AM_CFLAGS = \
-I$(top_srcdir)/platform/@with_platform@/arch/@ARCH_DIR@ \
-I$(top_builddir)/include
+if STATIC_LINK
AM_LDFLAGS = -L$(LIB) -static
+else
+AM_LDFLAGS =
+endif
@@ -18,7 +18,11 @@ INCFLAGS = \
AM_CPPFLAGS = $(INCFLAGS)
AM_CFLAGS = $(CUNIT_CFLAGS)
+if STATIC_LINK
AM_LDFLAGS = -L$(LIB) -static
+else
+AM_LDFLAGS =
+endif
@VALGRIND_CHECK_RULES@