summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Makefile38
-rw-r--r--src/anytun-config.cpp1
-rw-r--r--src/anytun-controld.cpp11
-rw-r--r--src/anytun.cpp1
-rwxr-xr-xsrc/configure11
-rw-r--r--src/win32/sysExec.hpp2
6 files changed, 43 insertions, 21 deletions
diff --git a/src/Makefile b/src/Makefile
index b402912..45f1fad 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -67,10 +67,12 @@ ANYTUNOBJS := $(ANYTUNOBJS) \
else
ANYTUNOBJS := $(ANYTUNOBJS) \
win32/tunDevice.o \
+ nullDaemon.o \
win32/winService.o \
win32/registryKey.o
endif
+
ANYSHOWOBJS := buffer.o \
syncBuffer.o \
keyDerivation.o \
@@ -88,6 +90,7 @@ ANYSHOWOBJS := buffer.o \
nullOptions.o \
resolver.o
+
SYNCOBJS := syncServer.o \
syncClient.o \
syncQueue.o \
@@ -96,8 +99,8 @@ SYNCOBJS := syncServer.o \
syncConnectionCommand.o \
syncTcpConnection.o
+
ANYCTROBJS := signalController.o \
- daemonService.o \
anyCtrOptions.o \
buffer.o \
log.o \
@@ -107,6 +110,15 @@ ANYCTROBJS := signalController.o \
syncServer.o \
resolver.o
+ifneq ($(TARGET),mingw)
+ANYCTROBJS := $(ANYCTROBJS) \
+ daemonService.o
+else
+ANYCTROBJS := $(ANYCTROBJS) \
+ nullDaemon.o
+endif
+
+
ANYCONFOBJS := log.o \
logTargets.o \
anytunError.o \
@@ -130,7 +142,13 @@ ANYCONFOBJS := log.o \
syncConnectionCommand.o \
resolver.o
-EXECUTABLES := anytun anytun-config anytun-controld anytun-showtables anytun-nosync
+ifneq ($(TARGET),mingw)
+ EXE :=
+else
+ EXE := .exe
+endif
+
+EXECUTABLES := anytun$(EXE) anytun-config$(EXE) anytun-controld$(EXE) anytun-showtables$(EXE) anytun-nosync$(EXE)
EXEOBJS := anytun.o anytun-config.o anytun-controld.o anytun-showtables.o
ANYTUNSRCS := $(ANYTUNOBJS:%.o=%.cpp)
@@ -157,26 +175,26 @@ endif
strip: $(EXECUTABLES)
$(STRIP) -s $(EXECUTABLES)
-anytun: $(ANYTUNOBJS) $(SYNCOBJS) anytun.o
+anytun$(EXE): $(ANYTUNOBJS) $(SYNCOBJS) anytun.o
$(LD) $(ANYTUNOBJS) $(SYNCOBJS) anytun.o -o $@ $(LDFLAGS)
anytun-static: $(ANYTUNOBJS) $(SYNCOBJS) anytun-noprivdrop.o
$(LD) $(ANYTUNOBJS) $(SYNCOBJS) anytun-noprivdrop.o -o $@ -Bstatic -lstdc++ -static $(LDFLAGS) -lpthread
$(STRIP) -s anytun-static
-anytun-nosync: $(ANYTUNOBJS) anytun-nosync.o
+anytun-nosync$(EXE): $(ANYTUNOBJS) anytun-nosync.o
$(LD) $(ANYTUNOBJS) anytun-nosync.o -o $@ $(LDFLAGS)
anytun-nosync.o: anytun.cpp
$(CXX) $(CXXFLAGS) -DANYTUN_NOSYNC $< -c -o anytun-nosync.o
-anytun-showtables: $(ANYSHOWOBJS) $(SYNCOBJS) anytun-showtables.o
+anytun-showtables$(EXE): $(ANYSHOWOBJS) $(SYNCOBJS) anytun-showtables.o
$(LD) $(ANYSHOWOBJS) $(SYNCOBJS) anytun-showtables.o -o $@ $(LDFLAGS)
-anytun-config: $(ANYCONFOBJS) anytun-config.o
+anytun-config$(EXE): $(ANYCONFOBJS) anytun-config.o
$(LD) $(ANYCONFOBJS) anytun-config.o -o $@ $(LDFLAGS)
-anytun-controld: $(ANYCTROBJS) anytun-controld.o
+anytun-controld$(EXE): $(ANYCTROBJS) anytun-controld.o
$(LD) $(ANYCTROBJS) anytun-controld.o -o $@ $(LDFLAGS)
@@ -193,7 +211,7 @@ nullOptions.o: options.cpp
$(CXX) $(CXXFLAGS) $< -c -o $@
%.o: %.cpp
- $(CXX) $(CXXFLAGS) $< -c
+ $(CXX) $(CXXFLAGS) $< -c -o $@
libAnysync.a: $(OBJS)
@@ -222,7 +240,11 @@ clean:
rm -f *.o
rm -f *.d
rm -f *.d.*
+ rm -f win32/*.o
+ rm -f win32/*.d
+ rm -f win32/*.d.*
rm -f $(EXECUTABLES)
+ rm -f *.exe
rm -f anytun-nosync
rm -f -r doc/html/*
rm -f -r doc/latex/*
diff --git a/src/anytun-config.cpp b/src/anytun-config.cpp
index 4f61353..e0b6d87 100644
--- a/src/anytun-config.cpp
+++ b/src/anytun-config.cpp
@@ -31,7 +31,6 @@
*/
#include <iostream>
-#include <poll.h>
#include "datatypes.h"
diff --git a/src/anytun-controld.cpp b/src/anytun-controld.cpp
index c4813ca..884be7f 100644
--- a/src/anytun-controld.cpp
+++ b/src/anytun-controld.cpp
@@ -32,10 +32,6 @@
#include <iostream>
#include <fstream>
-#include <poll.h>
-#include <fcntl.h>
-#include <pwd.h>
-#include <grp.h>
#include <string>
#include "datatypes.h"
@@ -46,7 +42,11 @@
#include "resolver.h"
#include "syncServer.h"
-#include "daemonService.h"
+#if !defined(_MSC_VER) && !defined(MINGW)
+# include "daemonService.h"
+#else
+# include "nullDaemon.h"
+#endif
#include <vector>
std::list<std::string> config_;
@@ -122,6 +122,7 @@ int main(int argc, char* argv[])
boost::thread* syncListenerThread;
syncListenerThread = new boost::thread(boost::bind(syncListener));
+ if(syncListenerThread) syncListenerThread->detach();
int ret = gSignalController.run();
diff --git a/src/anytun.cpp b/src/anytun.cpp
index 4d367f1..16021a2 100644
--- a/src/anytun.cpp
+++ b/src/anytun.cpp
@@ -442,6 +442,7 @@ int main(int argc, char* argv[])
boost::thread* syncListenerThread = NULL;
if(gOpt.getLocalSyncPort() != "") {
syncListenerThread = new boost::thread(boost::bind(syncListener));
+ if(syncListenerThread) syncListenerThread->detach();
}
boost::thread_group connectThreads;
diff --git a/src/configure b/src/configure
index 28b5fe5..2a3aad1 100755
--- a/src/configure
+++ b/src/configure
@@ -36,7 +36,7 @@ TARGET=`uname -s`
EBUILD_COMPAT=0
CXXFLAGS='-g -Wall -O2'
-LDFLAGS='-g -Wall -O2 -lboost_thread -lboost_serialization -lboost_system -lboost_date_time'
+LDFLAGS='-g -Wall -O2'
CROSS_PREFIX=''
CRYPTO_LIB='gcrypt'
@@ -161,7 +161,6 @@ if [ -n "$ERRORS" ] && [ $EBUILD_COMPAT -ne 1 ]; then
exit 1
fi
-
rm -f include.mk
rm -f version.h
case $TARGET in
@@ -176,7 +175,7 @@ case $TARGET in
ln -sf posix/posixDaemon.h daemonService.h
ln -sf posix/posixDaemon.cpp daemonService.cpp
echo "loading Linux specific TUN Device"
- LDFLAGS=$LDFLAGS' -lpthread'
+ LDFLAGS=$LDFLAGS' -lboost_thread -lboost_serialization -lboost_system -lboost_date_time -lpthread'
LOG_TARGETS='-DLOG_SYSLOG -DLOG_FILE -DLOG_STDOUT'
;;
OpenBSD|FreeBSD|NetBSD|GNU/kFreeBSD)
@@ -191,7 +190,7 @@ case $TARGET in
ln -sf posix/posixDaemon.cpp daemonService.cpp
echo "loading BSD specific TUN Device"
CXXFLAGS=$CXXFLAGS' -I/usr/local/include'
- LDFLAGS=$LDFLAGS' -L/usr/local/lib -lpthread'
+ LDFLAGS=$LDFLAGS' -L/usr/local/lib -lboost_thread -lboost_serialization -lboost_system -lboost_date_time -lpthread'
LOG_TARGETS='-DLOG_SYSLOG -DLOG_FILE -DLOG_STDOUT'
;;
mingw)
@@ -200,8 +199,8 @@ case $TARGET in
rm -f sysExec.hpp
rm -f daemonService.h daemonService.cpp
echo "loading Windows specific TUN Device"
- CXXFLAGS=$CXXFLAGS' -DMINGW -D_WIN32_WINNT=0x0501 -DWIN32_LEAN_AND_MEAN -DBOOST_WINDOWS'
- LDFLAGS=$LDFLAGS' -static'
+ CXXFLAGS=$CXXFLAGS' -DMINGW -D_WIN32_WINNT=0x0501 -DWIN32_LEAN_AND_MEAN -DBOOST_WINDOWS -fno-strict-aliasing -DBOOST_THREAD_USE_LIB'
+ LDFLAGS=$LDFLAGS' -lboost_thread_win32 -lboost_serialization -lboost_system -lboost_date_time -lwsock32 -lws2_32'
LOG_TARGETS='-DWIN_EVENTLOG -DLOG_FILE -DLOG_STDOUT'
;;
*)
diff --git a/src/win32/sysExec.hpp b/src/win32/sysExec.hpp
index 0fe10f3..5c7ea9e 100644
--- a/src/win32/sysExec.hpp
+++ b/src/win32/sysExec.hpp
@@ -121,7 +121,7 @@ void SysExec::doExec(StringVector args, StringList env_param)
NULL,
NULL,
false,
- NULL,
+ 0,
&env[0],
NULL,
&startup_info,