5 # The secure anycast tunneling protocol (satp) defines a protocol used
6 # for communication between any combination of unicast and anycast
7 # tunnel endpoints. It has less protocol overhead than IPSec in Tunnel
8 # mode and allows tunneling of every ETHER TYPE protocol (e.g.
9 # ethernet, ip, arp ...). satp directly includes cryptography and
10 # message authentication based on the methods used by SRTP. It is
11 # intended to deliver a generic, scaleable and secure solution for
12 # tunneling and relaying of packets of any protocol.
15 # Copyright (C) 2007-2014 Markus Grüneis, Othmar Gsenger, Erwin Nindl,
16 # Christian Pointner <satp@wirdorange.org>
18 # This file is part of Anytun.
20 # Anytun is free software: you can redistribute it and/or modify
21 # it under the terms of the GNU General Public License as published by
22 # the Free Software Foundation, either version 3 of the License, or
25 # Anytun is distributed in the hope that it will be useful,
26 # but WITHOUT ANY WARRANTY; without even the implied warranty of
27 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 # GNU General Public License for more details.
30 # You should have received a copy of the GNU General Public License
31 # along with Anytun. If not, see <http://www.gnu.org/licenses/>.
33 # In addition, as a special exception, the copyright holders give
34 # permission to link the code of portions of this program with the
35 # OpenSSL library under certain conditions as described in each
36 # individual source file, and distribute linked combinations
38 # You must obey the GNU General Public License in all respects
39 # for all of the code used other than OpenSSL. If you modify
40 # file(s) with this exception, you may extend this exception to your
41 # version of the file(s), but you are not obligated to do so. If you
42 # do not wish to do so, delete this exception statement from your
43 # version. If you delete this exception statement from all source
44 # files in the program, then also delete it here.
74 echo "configure --help print this"
75 echo " --target=<TARGET> build target i.e. Linux (default: autodetect)"
76 echo " --prefix=<PREFIX> the installation prefix (default: /usr/local)"
77 echo " --bindir=<DIR> the path to the bin directory (default: $PREFIX/bin)"
78 echo " --sbindir=<DIR> the path to the sbin directory (default: $PREFIX/sbin)"
79 echo " --sysconfdir=<DIR> the path to the system configuration directory (default: $PREFIX/etc"
80 echo " --mandir=<DIR> the path to the system man pages (default: $PREFIX/share/man)"
81 echo " --no-manpage dont't install manpages"
82 echo " --examplesdir=<DIR> the path to the examples files (default: $PREFIX/share/examples)"
83 echo " --no-examples dont't install example files"
84 echo " --use-gcrypt use libgcrypt (this is the default)"
85 echo " --use-nettle use libnettle instead of libgcrypt"
86 echo " --use-ssl-crypto use openssl crypto library instead of libgcrypt"
87 echo " --no-crypto disable crypto at all (only NULL cipher)"
88 echo " --disable-passphrase disable master key and salt passphrase"
89 echo " --enable-passphrase enable master key and salt passphrase"
90 echo " --disable-routing disable built-in routing capability"
91 echo " --enable-routing enable built-in routing capability"
92 echo " --cross-prefix=<PREFIX> add PREFIX to compiler calls"
93 echo " --with-boost=<PREFIX> don't use systemwide boost"
94 echo " --with-gcrypt=<PREFIX> don't use systemwide gcrypt"
95 echo " --with-nettle=<PREFIX> don't use systemwide nettle"
96 echo " --with-openssl=<PREFIX> don't use systemwide openssl"
97 echo " --use-clang use clang/llvm as compiler/linker"
104 TARGET=${arg#--target=}
110 PREFIX=${arg#--prefix=}
113 SBINDIR=${arg#--bindir=}
116 SBINDIR=${arg#--sbindir=}
119 ETCDIR=${arg#--sysconfdir=}
122 MANDIR=${arg#--mandir=}
128 EXAMPLESDIR=${arg#--examplesdir=}
148 --disable-passphrase)
161 CROSS_PREFIX=${arg#--cross-prefix=}
164 BOOST_PREFIX=${arg#--with-boost=}
167 GCRYPT_PREFIX=${arg#--with-gcrypt=}
170 NETTLE_PREFIX=${arg#--with-nettle=}
173 OPENSSL_PREFIX=${arg#--with-openssl=}
180 ERRORS="$ERRORS $arg"
185 if [ -n "$ERRORS" ] && [ $EBUILD_COMPAT -ne 1 ]; then
186 for error in $ERRORS; do
187 echo "Unknown argument: $error"
194 if [ $USE_CLANG -eq 0 ]; then
195 CXXFLAGS='-g -Wall -O2'
196 LDFLAGS='-g -Wall -O2'
209 ln -sf linux/tunDevice.cpp
210 rm -f signalHandler.hpp
211 ln -sf posix/signalHandler.hpp
213 ln -sf posix/sysExec.hpp
214 rm -f daemonService.h daemonService.cpp
215 ln -sf posix/posixDaemon.h daemonService.h
216 ln -sf posix/posixDaemon.cpp daemonService.cpp
217 echo "loading Linux specific TUN Device"
218 LDFLAGS=$LDFLAGS' -lboost_thread -lboost_serialization -lboost_system -lboost_date_time -lpthread'
219 LOG_TARGETS='-DLOG_SYSLOG -DLOG_FILE -DLOG_STDOUT'
221 OpenBSD|FreeBSD|NetBSD|GNU/kFreeBSD)
223 ln -sf bsd/tunDevice.cpp
224 rm -f signalHandler.hpp
225 ln -sf posix/signalHandler.hpp
227 ln -sf posix/sysExec.hpp
228 rm -f daemonService.h daemonService.cpp
229 ln -sf posix/posixDaemon.h daemonService.h
230 ln -sf posix/posixDaemon.cpp daemonService.cpp
231 echo "loading BSD specific TUN Device"
232 CXXFLAGS=$CXXFLAGS' -I/usr/local/include'
233 LDFLAGS=$LDFLAGS' -L/usr/local/lib -lboost_thread -lboost_serialization -lboost_system -lboost_date_time -lpthread'
234 LOG_TARGETS='-DLOG_SYSLOG -DLOG_FILE -DLOG_STDOUT'
238 rm -f signalHandler.hpp
240 rm -f daemonService.h daemonService.cpp
241 echo "loading Windows specific TUN Device"
242 CXXFLAGS=$CXXFLAGS' -DMINGW -D_WIN32_WINNT=0x0501 -DWIN32_LEAN_AND_MEAN -DBOOST_WINDOWS -fno-strict-aliasing -DBOOST_THREAD_USE_LIB'
243 LDFLAGS=$LDFLAGS' -lboost_thread_win32 -lboost_serialization -lboost_system -lboost_date_time -lwsock32 -lws2_32'
244 LOG_TARGETS='-DWIN_EVENTLOG -DLOG_FILE -DLOG_STDOUT'
247 echo "platform not supported"
252 CXXFLAGS="$CXXFLAGS $LOG_TARGETS"
254 if [ -n "$BOOST_PREFIX" ]; then
255 CXXFLAGS="$CXXFLAGS -I\"$BOOST_PREFIX/include\""
256 LDFLAGS="$LDFLAGS -L\"$BOOST_PREFIX/lib\""
261 CXXFLAGS=$CXXFLAGS' -DUSE_GCRYPT'
262 LDFLAGS=$LDFLAGS' -lgcrypt -lgpg-error'
263 if [ -n "$GCRYPT_PREFIX" ]; then
264 CXXFLAGS="$CXXFLAGS -I\"$GCRYPT_PREFIX/include\""
265 LDFLAGS="$LDFLAGS -L\"$GCRYPT_PREFIX/lib\""
267 echo "using gcrypt library"
270 CXXFLAGS=$CXXFLAGS' -DUSE_NETTLE'
271 LDFLAGS=$LDFLAGS' -lnettle'
272 if [ -n "$NETTLE_PREFIX" ]; then
273 CXXFLAGS="$CXXFLAGS -I\"$NETTLE_PREFIX/include\""
274 LDFLAGS="$LDFLAGS -L\"$NETTLE_PREFIX/lib\""
276 echo "using nettle library"
279 CXXFLAGS=$CXXFLAGS' -DUSE_SSL_CRYPTO'
280 LDFLAGS=$LDFLAGS' -lcrypto'
281 if [ -n "$OPENSSL_PREFIX" ]; then
282 CXXFLAGS="$CXXFLAGS -I\"$OPENSSL_PREFIX/include\""
283 LDFLAGS="$LDFLAGS -L\"$OPENSSL_PREFIX/lib\""
285 echo "using openssl crypto library"
288 CXXFLAGS=$CXXFLAGS' -DNO_CRYPT'
289 echo "disabling crypto"
293 if [ $PASSPHRASE -eq 0 ]; then
294 CXXFLAGS=$CXXFLAGS' -DNO_PASSPHRASE'
295 echo "disabling master key and salt passphrase"
298 if [ $ROUTING -eq 0 ]; then
299 CXXFLAGS=$CXXFLAGS' -DNO_ROUTING'
300 echo "disabling built-in routing capability"
303 if [ -z "$BINDIR" ]; then
307 if [ -z "$SBINDIR" ]; then
311 if [ -z "$ETCDIR" ]; then
315 if [ -z "$MANDIR" ]; then
316 MANDIR=$PREFIX/share/man
319 if [ -z "$EXAMPLESDIR" ]; then
320 EXAMPLESDIR=$PREFIX/share/examples
323 cat > include.mk <<EOF
324 # this file was created automatically
325 # do not edit this file directly
326 # use ./configure instead
329 CXX = ${CROSS_PREFIX}$COMPILER
331 LD = ${CROSS_PREFIX}$COMPILER
333 STRIP = ${CROSS_PREFIX}strip
342 if [ $CRYPTO_LIB = "none" ]; then
343 echo "NO_CRYPT_OBJ = 1" >> include.mk
346 if [ $INSTALLMANPAGE -eq 1 ]; then
347 echo "MANDIR := $MANDIR" >> include.mk
348 echo "installing manpage"
350 echo "not installing manpage"
353 if [ $INSTALLEXAMPLES -eq 1 ]; then
354 echo "EXAMPLESDIR := $EXAMPLESDIR" >> include.mk
355 echo "installing example files"
357 echo "not installing example files"
360 VERSION=`cat ../version`
361 if which svn >/dev/null; then
362 SVN_REV=`svn info 2> /dev/null | grep "^Revision: " | awk '{print($2)}'`
363 if [ -n "$SVN_REV" ]; then
364 VERSION="$VERSION (svn$SVN_REV)"
368 DATE=`date +"%d.%m.%Y %H:%M:%S %Z"`
370 cat > version.h <<EOF
372 * anytun version info
374 * this file was created automatically
375 * do not edit this file directly
376 * use ./configure instead
379 #ifndef ANYTUN_version_h_INCLUDED
380 #define ANYTUN_version_h_INCLUDED
382 #define VERSION_STRING_0 " version $VERSION"
383 #define VERSION_STRING_1 "built on $HOSTNAME, $DATE"