From 675e3b497bdc87f5a4dfdef7508cd2070850e69e Mon Sep 17 00:00:00 2001 From: Etienne Dechamps Date: Sun, 15 Nov 2015 15:30:01 +0000 Subject: [PATCH] Allow tinc to be built with miniupnpc on Windows. Contrary to what I expected, it so happens that modern versions of MinGW include an implementation of pthread natively by default, so there is no need to introduce Win32-specific threading code. This means the only changes required to make UPnP work on Windows are just build parameter tuning. This commit forces MinGW to be built statically. This makes linking against miniupnpc simpler (otherwise we would have to handle the mess of dllimport & co.) and it also prevents libwinpthread from being linked dynamically (which it is by default), as this would require additional DLLs to be distributed. Since static linking is how tinc is traditionally built on Windows, I don't expect this to be a big deal. --- configure.ac | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 4fe415e9..005a24a4 100644 --- a/configure.ac +++ b/configure.ac @@ -67,7 +67,9 @@ case $host_os in *mingw*) mingw=true AC_DEFINE(HAVE_MINGW, 1, [MinGW]) - LIBS="$LIBS -lws2_32 -lgdi32 -lcrypt32" + LIBS="$LIBS -lws2_32 -lgdi32 -lcrypt32 -liphlpapi" + LDFLAGS="$LDFLAGS -static" + CPPFLAGS="$CPPFLAGS -DMINIUPNP_STATICLIB" ;; *) AC_MSG_ERROR("Unknown operating system.") -- 2.20.1