Index: nDPI-1.8/configure.ac =================================================================== --- nDPI-1.8/configure.ac +++ nDPI-1.8/configure.ac 2018-01-31 13:36:53.600491650 +0100 @@ -84,9 +84,13 @@ [], [] ) LIBS=$OLD_LIBS - AC_CHECK_LIB(pthread, pthread_setaffinity_np, AC_DEFINE_UNQUOTED(HAVE_PTHREAD_SETAFFINITY_NP, 1, [libc has pthread_setaffinity_np])) +AC_ARG_ENABLE([examples-dynamic-linking], + [AS_HELP_STRING([--enable-examples-dynamic-linking], + [dynamically link examples against libndpi (default is no)])]) +AM_CONDITIONAL(EXAMPLES_DYNAMIC_LINK, [test "x$enable_examples_dynamic_linking" = "xyes"]) + AC_CONFIG_FILES([Makefile src/lib/Makefile example/Makefile libndpi.pc]) AC_CONFIG_HEADERS(config.h) AC_SUBST(GIT_RELEASE) Index: nDPI-1.8/example/Makefile.am =================================================================== --- nDPI-1.8/example/Makefile.am +++ nDPI-1.8/example/Makefile.am 2018-01-31 13:37:37.556305112 +0100 @@ -4,7 +4,9 @@ AM_CFLAGS = @PTHREAD_CFLAGS@ LDADD = $(top_builddir)/src/lib/libndpi.la @JSON_C_LIB@ @PTHREAD_LIBS@ @PCAP_LIB@ +if !EXAMPLES_DYNAMIC_LINK AM_LDFLAGS = -static +endif ndpiReader_SOURCES = ndpiReader.c ndpi_util.c