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.
69 SYSTEMDGENERATORDIR=''
79 echo "configure --help print this"
80 echo " --target=<TARGET> build target i.e. Linux (default: autodetect)"
81 echo " --prefix=<PREFIX> the installation prefix (default: /usr/local)"
82 echo " --bindir=<DIR> the path to the bin directory (default: $PREFIX/bin)"
83 echo " --sbindir=<DIR> the path to the sbin directory (default: $PREFIX/sbin)"
84 echo " --libdir=<DIR> the path to the lib directory (default: $PREFIX/lib)"
85 echo " --sysconfdir=<DIR> the path to the system configuration directory (default: $PREFIX/etc"
86 echo " --mandir=<DIR> the path to the system man pages (default: $PREFIX/share/man)"
87 echo " --no-manpage don't install manpages"
88 echo " --examplesdir=<DIR> the path to the examples files (default: $PREFIX/share/examples)"
89 echo " --no-examples don't install example files"
90 echo " --systemddir=<DIR> the path to the systemd service unit directory (default: from pkg-config)"
91 echo " --systemdgeneratordir=<DIR> the path to the systemd generator directory (default: from pkg-config)"
92 echo " --tmpfilesddir=<DIR> the path to the systemd tmpfiles.d configuration file (default: from pkg-config)"
93 echo " --no-systemd don't install systemd units"
94 echo " --use-gcrypt use libgcrypt (this is the default)"
95 echo " --use-nettle use libnettle instead of libgcrypt"
96 echo " --use-ssl-crypto use openssl crypto library instead of libgcrypt"
97 echo " --no-crypto disable crypto at all (only NULL cipher)"
98 echo " --disable-passphrase disable master key and salt passphrase"
99 echo " --enable-passphrase enable master key and salt passphrase"
100 echo " --disable-routing disable built-in routing capability"
101 echo " --enable-routing enable built-in routing capability"
102 echo " --cross-prefix=<PREFIX> add PREFIX to compiler calls"
103 echo " --with-boost=<PREFIX> don't use systemwide boost"
104 echo " --with-gcrypt=<PREFIX> don't use systemwide gcrypt"
105 echo " --with-nettle=<PREFIX> don't use systemwide nettle"
106 echo " --with-openssl=<PREFIX> don't use systemwide openssl"
107 echo " --use-clang use clang/llvm as compiler/linker"
114 TARGET=${arg#--target=}
120 PREFIX=${arg#--prefix=}
123 SBINDIR=${arg#--bindir=}
126 SBINDIR=${arg#--sbindir=}
129 LIBDIR=${arg#--libdir=}
132 ETCDIR=${arg#--sysconfdir=}
135 MANDIR=${arg#--mandir=}
141 EXAMPLESDIR=${arg#--examplesdir=}
147 SYSTEMDDIR=${arg#--systemddir=}
149 --systemdgeneratordir=*)
150 SYSTEMDGENERATORDIR=${arg#--systemdgeneratordir=}
153 TMPFILESDDIR=${arg#--tmpfilesddir=}
173 --disable-passphrase)
186 CROSS_PREFIX=${arg#--cross-prefix=}
189 BOOST_PREFIX=${arg#--with-boost=}
192 GCRYPT_PREFIX=${arg#--with-gcrypt=}
195 NETTLE_PREFIX=${arg#--with-nettle=}
198 OPENSSL_PREFIX=${arg#--with-openssl=}
205 ERRORS="$ERRORS $arg"
210 if [ -n "$ERRORS" ] && [ $EBUILD_COMPAT -ne 1 ]; then
211 for error in $ERRORS; do
212 echo "Unknown argument: $error"
219 if [ $USE_CLANG -eq 0 ]; then
220 CXXFLAGS='-g -Wall -Werror -Wno-error=unused-variable -O2'
221 LDFLAGS='-g -Wall -Werror -O2'
234 ln -sf linux/tunDevice.cpp
235 rm -f signalHandler.hpp
236 ln -sf posix/signalHandler.hpp
238 ln -sf posix/sysExec.hpp
239 rm -f daemonService.h daemonService.cpp
240 ln -sf posix/posixDaemon.h daemonService.h
241 ln -sf posix/posixDaemon.cpp daemonService.cpp
242 echo "loading Linux specific TUN Device"
243 LDFLAGS=$LDFLAGS' -lboost_thread -lboost_serialization -lboost_system -lboost_date_time -lpthread'
244 LOG_TARGETS='-DLOG_SYSLOG -DLOG_FILE -DLOG_STDOUT'
246 OpenBSD|FreeBSD|NetBSD|GNU/kFreeBSD)
248 ln -sf bsd/tunDevice.cpp
249 rm -f signalHandler.hpp
250 ln -sf posix/signalHandler.hpp
252 ln -sf posix/sysExec.hpp
253 rm -f daemonService.h daemonService.cpp
254 ln -sf posix/posixDaemon.h daemonService.h
255 ln -sf posix/posixDaemon.cpp daemonService.cpp
256 echo "loading BSD specific TUN Device"
257 CXXFLAGS=$CXXFLAGS' -I/usr/local/include'
258 LDFLAGS=$LDFLAGS' -L/usr/local/lib -lboost_thread -lboost_serialization -lboost_system -lboost_date_time -lpthread'
259 LOG_TARGETS='-DLOG_SYSLOG -DLOG_FILE -DLOG_STDOUT'
264 rm -f signalHandler.hpp
266 rm -f daemonService.h daemonService.cpp
267 echo "loading Windows specific TUN Device"
268 CXXFLAGS=$CXXFLAGS' -DMINGW -D_WIN32_WINNT=0x0501 -DWIN32_LEAN_AND_MEAN -DBOOST_WINDOWS -fno-strict-aliasing -DBOOST_THREAD_USE_LIB'
269 LDFLAGS=$LDFLAGS' -lboost_thread_win32 -lboost_serialization -lboost_system -lboost_date_time -lwsock32 -lws2_32'
270 LOG_TARGETS='-DWIN_EVENTLOG -DLOG_FILE -DLOG_STDOUT'
274 echo "platform not supported"
279 CXXFLAGS="$CXXFLAGS $LOG_TARGETS"
281 if [ -n "$BOOST_PREFIX" ]; then
282 CXXFLAGS="$CXXFLAGS -I\"$BOOST_PREFIX/include\""
283 LDFLAGS="$LDFLAGS -L\"$BOOST_PREFIX/lib\""
288 CXXFLAGS=$CXXFLAGS' -DUSE_GCRYPT'
289 LDFLAGS=$LDFLAGS' -lgcrypt -lgpg-error'
290 if [ -n "$GCRYPT_PREFIX" ]; then
291 CXXFLAGS="$CXXFLAGS -I\"$GCRYPT_PREFIX/include\""
292 LDFLAGS="$LDFLAGS -L\"$GCRYPT_PREFIX/lib\""
294 echo "using gcrypt library"
297 CXXFLAGS=$CXXFLAGS' -DUSE_NETTLE'
298 LDFLAGS=$LDFLAGS' -lnettle'
299 if [ -n "$NETTLE_PREFIX" ]; then
300 CXXFLAGS="$CXXFLAGS -I\"$NETTLE_PREFIX/include\""
301 LDFLAGS="$LDFLAGS -L\"$NETTLE_PREFIX/lib\""
303 echo "using nettle library"
306 CXXFLAGS=$CXXFLAGS' -DUSE_SSL_CRYPTO'
307 LDFLAGS=$LDFLAGS' -lcrypto'
308 if [ -n "$OPENSSL_PREFIX" ]; then
309 CXXFLAGS="$CXXFLAGS -I\"$OPENSSL_PREFIX/include\""
310 LDFLAGS="$LDFLAGS -L\"$OPENSSL_PREFIX/lib\""
312 echo "using openssl crypto library"
315 CXXFLAGS=$CXXFLAGS' -DNO_CRYPT'
316 echo "disabling crypto"
320 if [ $PASSPHRASE -eq 0 ]; then
321 CXXFLAGS=$CXXFLAGS' -DNO_PASSPHRASE'
322 echo "disabling master key and salt passphrase"
325 if [ $ROUTING -eq 0 ]; then
326 CXXFLAGS=$CXXFLAGS' -DNO_ROUTING'
327 echo "disabling built-in routing capability"
330 if [ -z "$BINDIR" ]; then
334 if [ -z "$SBINDIR" ]; then
338 if [ -z "$LIBDIR" ]; then
342 if [ -z "$ETCDIR" ]; then
346 if [ -z "$MANDIR" ]; then
347 MANDIR=$PREFIX/share/man
350 if [ -z "$EXAMPLESDIR" ]; then
351 EXAMPLESDIR=$PREFIX/share/examples
354 if [ $INSTALLSYSTEMD -eq 1 ]; then
355 if [ -z "$SYSTEMDDIR" ]; then
356 SYSTEMDDIR=`pkg-config systemd --variable=systemdsystemunitdir`
358 if [ -z "$SYSTEMDGENERATORDIR" ]; then
359 SYSTEMDGENERATORDIR=`pkg-config systemd --variable=systemdsystemgeneratordir`
361 if [ -z "$TMPFILESDDIR" ]; then
362 TMPFILESDDIR=`pkg-config systemd --variable=tmpfilesdir`
366 cat > include.mk <<EOF
367 # this file was created automatically
368 # do not edit this file directly
369 # use ./configure instead
372 CXX = ${CROSS_PREFIX}$COMPILER
374 LD = ${CROSS_PREFIX}$COMPILER
376 STRIP = ${CROSS_PREFIX}strip
386 if [ $CRYPTO_LIB = "none" ]; then
387 echo "NO_CRYPT_OBJ = 1" >> include.mk
390 if [ $INSTALLMANPAGE -eq 1 ]; then
391 echo "MANDIR := $MANDIR" >> include.mk
392 echo "installing manpage"
394 echo "not installing manpage"
397 if [ $INSTALLEXAMPLES -eq 1 ]; then
398 echo "EXAMPLESDIR := $EXAMPLESDIR" >> include.mk
399 echo "installing example files"
401 echo "not installing example files"
404 if [ $INSTALLSYSTEMD -eq 1 ]; then
405 echo "SYSTEMDDIR := $SYSTEMDDIR" >> include.mk
406 echo "SYSTEMDGENERATORDIR := $SYSTEMDGENERATORDIR" >> include.mk
407 echo "TMPFILESDDIR := $TMPFILESDDIR" >> include.mk
408 echo "installing systemd units"
410 echo "not installing systemd units"
413 VERSION=`cat ../version`
414 if which git >/dev/null; then
415 GIT_HASH=`git rev-parse HEAD 2> /dev/null`
416 if [ -n "$GIT_HASH" ]; then
417 VERSION="$VERSION (git $GIT_HASH)"
421 DATE=`date +"%d.%m.%Y %H:%M:%S %Z"`
423 cat > version.h <<EOF
425 * anytun version info
427 * this file was created automatically
428 * do not edit this file directly
429 * use ./configure instead
432 #ifndef ANYTUN_version_h_INCLUDED
433 #define ANYTUN_version_h_INCLUDED
435 #define VERSION_STRING_0 " version $VERSION"
436 #define VERSION_STRING_1 "built on $HOSTNAME, $DATE"