]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Support NAT-PMP on Windows
authorSteven Murdoch <Steven.Murdoch@cl.cam.ac.uk>
Wed, 30 Nov 2011 19:37:17 +0000 (19:37 +0000)
committerSteven Murdoch <Steven Murdoch@cl.cam.ac.uk>
Wed, 30 Nov 2011 19:46:38 +0000 (19:46 +0000)
- Link in libws32 and libiphlpapi, needed for libnatpmp (both in
  ./configure and when compiling tor-fw-helper-natpmp.c)
- Define STATICLIB under Windows, to allow tor-fw-helper-natpmp.c to link
- Don't include arpa/inet.h which isn't present in Mingw32 and doesn't
  appear to be needed on either Windows or MacOS X

configure.in
src/tools/tor-fw-helper/Makefile.am
src/tools/tor-fw-helper/tor-fw-helper-natpmp.c

index 64d9d6db7b052ea993308f735ffa9443eb147d68..0de15b4b5afe94c87ec4e082260aa80c8c9d1ef9 100644 (file)
@@ -548,9 +548,12 @@ dnl There are no packages for Debian or Redhat as of this patch
 
 if test "$natpmp" = "true"; then
     AC_DEFINE(NAT_PMP, 1, [Define to 1 if we are building with nat-pmp.])
-    TOR_SEARCH_LIBRARY(libnatpmp, $trylibnatpmpdir, [-lnatpmp],
-        [#include <natpmp.h>],
+    TOR_SEARCH_LIBRARY(libnatpmp, $trylibnatpmpdir, [-lnatpmp $TOR_LIB_WS32 $TOR_LIB_IPHLPAPI],
         [#include <natpmp.h>],
+        [#ifdef MS_WINDOWS
+         #define STATICLIB
+         #endif
+         #include <natpmp.h>],
         [   int r;
             natpmp_t natpmp;
             natpmpresp_t response;
index 8f64ad2ba3f0aa876ff045f8af7fa16fbbfb7321..393562db034ea846f1e4ecfdc6560d3f12d8815d 100644 (file)
@@ -15,7 +15,7 @@ noinst_HEADERS = \
 
 if NAT_PMP
 nat_pmp_ldflags = @TOR_LDFLAGS_libnatpmp@
-nat_pmp_ldadd  = -lnatpmp
+nat_pmp_ldadd  = -lnatpmp @TOR_LIB_IPHLPAPI@
 nat_pmp_cppflags = @TOR_CPPFLAGS_libnatpmp@
 else
 nat_pmp_ldflags =
index f9d5d0d5869bcb160a34f5b67fcc44516c6a90c3..a8cdbbf24a6842054dbac02bd296fb3c71b9bfaf 100644 (file)
@@ -9,11 +9,13 @@
 
 #include "orconfig.h"
 #ifdef NAT_PMP
+#ifdef MS_WINDOWS
+#define STATICLIB
+#endif
 #include <stdint.h>
 #include <stdio.h>
 #include <string.h>
 #include <errno.h>
-#include <arpa/inet.h>
 
 // debugging stuff
 #include <assert.h>