Imported Upstream version 0.3.4
[anytun.git] / src / configure
index 5381010..76b1017 100755 (executable)
@@ -12,7 +12,7 @@
 #  tunneling and relaying of packets of any protocol.
 #
 #
-#  Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, 
+#  Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl,
 #                          Christian Pointner <satp@wirdorange.org>
 #
 #  This file is part of Anytun.
@@ -36,7 +36,7 @@ TARGET=`uname -s`
 EBUILD_COMPAT=0
 
 CXXFLAGS='-g -Wall -O2 -DLOG_SYSLOG -DLOG_FILE -DLOG_STDOUT'
-LDFLAGS='-g -Wall -O2 -lboost_thread -lboost_serialization -lboost_system -lboost_date_time'
+LDFLAGS='-g -Wall -O2 -lboost_thread -lboost_serialization -lboost_system -lboost_date_time -lpthread'
 
 CRYPTO_LIB='gcrypt'
 PASSPHRASE=1
@@ -105,7 +105,7 @@ do
   ;;
   --no-crypto)
     CRYPTO_LIB='none'
-  ;; 
+  ;;
   --enable-passphrase)
     PASSPHRASE=1
   ;;
@@ -142,23 +142,38 @@ fi
 
 
 rm -f include.mk
-case $TARGET in 
-       Linux)
-               rm -rf tunDevice.cpp
-               ln -sf linux/tunDevice.cpp 
+rm -f version.h
+case $TARGET in
+  Linux)
+    rm -f tunDevice.cpp
+    ln -sf linux/tunDevice.cpp
+    rm -f signalHandler.hpp
+    ln -sf posix/signalHandler.hpp
+    rm -f sysExec.hpp
+    ln -sf posix/sysExec.hpp
+    rm -f daemonService.h daemonService.cpp
+    ln -sf posix/posixDaemon.h daemonService.h
+    ln -sf posix/posixDaemon.cpp daemonService.cpp
     echo "loading Linux specific TUN Device"
-       ;;
-       OpenBSD|FreeBSD|NetBSD)
-               rm -rf tunDevice.cpp
-               ln -sf bsd/tunDevice.cpp 
+  ;;
+  OpenBSD|FreeBSD|NetBSD|GNU/kFreeBSD)
+    rm -f tunDevice.cpp
+    ln -sf bsd/tunDevice.cpp
+    rm -f signalHandler.hpp
+    ln -sf posix/signalHandler.hpp
+    rm -f sysExec.hpp
+    ln -sf posix/sysExec.hpp
+    rm -f daemonService.h daemonService.cpp
+    ln -sf posix/posixDaemon.h daemonService.h
+    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'
-       ;;
-       *)
-               echo "Plattform not supported"
+  ;;
+  *)
+    echo "platform not supported"
     exit 1
-       ;;
+  ;;
 esac
 
 case $CRYPTO_LIB in
@@ -173,7 +188,6 @@ case $CRYPTO_LIB in
   ;;
   none)
     CXXFLAGS=$CXXFLAGS' -DNO_CRYPT'
-    echo "NO_CRYPT_OBJ = 1" >> include.mk
     echo "disabling crypto"
   ;;
 esac
@@ -208,15 +222,15 @@ if [ -z "$EXAMPLESDIR" ]; then
   EXAMPLESDIR=$PREFIX/share/examples
 fi
 
-cat >> include.mk <<EOF
+cat > include.mk <<EOF
 # this file was created automatically
-# do not edit this file directly 
+# do not edit this file directly
 # use ./configure instead
 
 TARGET = $TARGET
-CXX = gcc
+CXX = g++
 CXXFLAGS = $CXXFLAGS
-LD = gcc
+LD = g++
 LDFLAGS = $LDFLAGS
 STRIP = strip
 INSTALL = install
@@ -227,6 +241,10 @@ SBINDIR := $SBINDIR
 ETCDIR := $ETCDIR
 EOF
 
+if [ $CRYPTO_LIB = "none" ]; then
+  echo "NO_CRYPT_OBJ = 1" >> include.mk
+fi
+
 if [ $INSTALLMANPAGE -eq 1 ]; then
   echo "MANDIR := $MANDIR" >> include.mk
   echo "installing manpage"
@@ -241,4 +259,33 @@ else
   echo "not installing example files"
 fi
 
+VERSION=`cat ../version`
+if which svn >/dev/null; then
+  SVN_REV=`svn info 2> /dev/null | grep "^Revision: " | awk '{print($2)}'`
+  if [ -n "$SVN_REV" ]; then
+    VERSION="$VERSION (svn$SVN_REV)"
+  fi
+fi
+HOSTNAME=`hostname`
+DATE=`date +"%d.%m.%Y %H:%M:%S %Z"`
+
+cat > version.h <<EOF
+/*
+ * anytun version info
+ *
+ * this file was created automatically
+ * do not edit this file directly
+ * use ./configure instead
+ */
+
+#ifndef ANYTUN_version_h_INCLUDED
+#define ANYTUN_version_h_INCLUDED
+
+#define VERSION_STRING_0 " version $VERSION"
+#define VERSION_STRING_1 "built on $HOSTNAME, $DATE"
+
+#endif
+
+EOF
+
 exit 0