Better integration of libevent in build system.
authorGuus Sliepen <guus@sliepen.eu.org>
Sat, 7 Nov 2009 13:35:48 +0000 (14:35 +0100)
committerGuus Sliepen <guus@sliepen.eu.org>
Sat, 7 Nov 2009 13:35:48 +0000 (14:35 +0100)
Since event.h is not part of tinc, we include it in have.h were all other
system header files are included.  We also ensure -levent comes before -lgdi32
when compiling with MinGW, apparently it doesn't work when the order is
reversed.

have.h
m4/libevent.m4
src/net.h
src/node.h

diff --git a/have.h b/have.h
index 682fd2b7c21f6c75bab7824f65ba8455c7915591..92914ea010e11e0dfcac60c715e58b267b5eaab0 100644 (file)
--- a/have.h
+++ b/have.h
@@ -37,6 +37,7 @@
 #else
 #define WINVER WindowsXP
 #endif
+#define WIN32_LEAN_AND_MEAN
 #include <w32api.h>
 #include <windows.h>
 #include <ws2tcpip.h>
 #include <netinet/if_ether.h>
 #endif
 
+#ifdef HAVE_EVENT_H
+#include <event.h>
+#endif
+
 #endif /* __TINC_SYSTEM_H__ */
index 9bc9ae1564e8aea2a8be35f746c5afc1730b7871..34bdef705d2a01e05ce727c697ee765eaeeb8c13 100644 (file)
@@ -27,7 +27,7 @@ AC_DEFUN([tinc_LIBEVENT],
   )
 
   AC_CHECK_LIB(event, event_init,
-    [LIBS="$LIBS -levent"],
+    [LIBS="-levent $LIBS"],
     [AC_MSG_ERROR("libevent libraries not found.")]
   )
 ])
index f50b2bec40f62326dde4b468fe51a016981b6a94..634e9e75d3447eca5a0bcd158b8f0984954f9f5b 100644 (file)
--- a/src/net.h
+++ b/src/net.h
@@ -21,8 +21,6 @@
 #ifndef __TINC_NET_H__
 #define __TINC_NET_H__
 
-#include <event.h>
-
 #include "ipv6.h"
 #include "cipher.h"
 #include "digest.h"
index 1e08c7ec11c05fab4d774a860247b2fe2978d479..02e16c6c464be1a39be258054192de2a68967290 100644 (file)
@@ -21,8 +21,6 @@
 #ifndef __TINC_NODE_H__
 #define __TINC_NODE_H__
 
-#include <event.h>
-
 #include "splay_tree.h"
 #include "cipher.h"
 #include "connection.h"