summaryrefslogtreecommitdiff
path: root/src/configure
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2016-07-07 22:48:58 +0200
committerChristian Pointner <equinox@anytun.org>2016-07-07 22:48:58 +0200
commit2c3c2955a29135ecc2a7920c9816bc8ccd0f9086 (patch)
tree34c537ad3da97a302bd41362c4e8179879ea8fcb /src/configure
parentadded some privilege limitations to sample systemd services (diff)
streamlined systemd integration/installation
Diffstat (limited to 'src/configure')
-rwxr-xr-xsrc/configure53
1 files changed, 36 insertions, 17 deletions
diff --git a/src/configure b/src/configure
index 3b6e57d..0ba56b5 100755
--- a/src/configure
+++ b/src/configure
@@ -64,6 +64,9 @@ MANDIR=''
INSTALLMANPAGE=1
EXAMPLESDIR=''
INSTALLEXAMPLES=1
+SYSTEMDDIR=''
+TMPFILESDDIR=''
+INSTALLSYSTEMD=1
BOOST_PREFIX=''
GCRYPT_PREFIX=''
@@ -78,9 +81,12 @@ print_usage() {
echo " --sbindir=<DIR> the path to the sbin directory (default: $PREFIX/sbin)"
echo " --sysconfdir=<DIR> the path to the system configuration directory (default: $PREFIX/etc"
echo " --mandir=<DIR> the path to the system man pages (default: $PREFIX/share/man)"
- echo " --no-manpage dont't install manpages"
+ echo " --no-manpage don't install manpages"
echo " --examplesdir=<DIR> the path to the examples files (default: $PREFIX/share/examples)"
- echo " --no-examples dont't install example files"
+ echo " --no-examples don't install example files"
+ echo " --systemddir=<DIR> the path to the systemd service unit directory (default: from pkg-config)"
+ echo " --tmpfilesddir=<DIR> the path to the systemd tmpfiles.d configuration file (default: from pkg-config)"
+ echo " --no-systemd don't install systemd units"
echo " --use-gcrypt use libgcrypt (this is the default)"
echo " --use-nettle use libnettle instead of libgcrypt"
echo " --use-ssl-crypto use openssl crypto library instead of libgcrypt"
@@ -95,9 +101,6 @@ print_usage() {
echo " --with-nettle=<PREFIX> don't use systemwide nettle"
echo " --with-openssl=<PREFIX> don't use systemwide openssl"
echo " --use-clang use clang/llvm as compiler/linker"
- echo " --with-systemd install systemd unit descriptions"
- echo " --with-systemdsystemunitdir=<DIR> target for unit files"
- echo " --with-systemdtmpfilesdir=<DIR> target for tmpfile creation info"
}
for arg
@@ -133,6 +136,15 @@ do
--no-examples)
INSTALLEXAMPLES=0
;;
+ --systemddir=*)
+ SYSTEMDDIR=${arg#--systemddir=}
+ ;;
+ --tmpfilesddir=*)
+ TMPFILESDDIR=${arg#--tmpfilesddir=}
+ ;;
+ --no-systemd)
+ INSTALLSYSTEMD=0
+ ;;
--use-gcrypt)
CRYPTO_LIB='gcrypt'
;;
@@ -175,17 +187,6 @@ do
--with-openssl=*)
OPENSSL_PREFIX=${arg#--with-openssl=}
;;
- --with-systemd)
- SYSTEMD=1
- [[ -z $SYSTEMD_SYSTEMUNITDIR ]] && SYSTEMD_SYSTEMUNITDIR="$(pkg-config systemd --variable=systemdsystemconfdir)"
- [[ -z $SYSTEMD_TMPFILESDIR ]] && SYSTEMD_TMPFILESDIR="$(pkg-config systemd --variable=tmpfilesdir)"
- ;;
- --with-systemdsystemunitdir=*)
- SYSTEMD_SYSTEMUNITDIR=${arg#--with-systemdsystemunitdir=}
- ;;
- --with-tmpfilesdir=*)
- SYSTEMD_TMPFILESDIR=${arg#--with-tmpfilesdir=}
- ;;
--help)
print_usage
exit 0
@@ -246,6 +247,7 @@ case $TARGET in
CXXFLAGS=$CXXFLAGS' -I/usr/local/include'
LDFLAGS=$LDFLAGS' -L/usr/local/lib -lboost_thread -lboost_serialization -lboost_system -lboost_date_time -lpthread'
LOG_TARGETS='-DLOG_SYSLOG -DLOG_FILE -DLOG_STDOUT'
+ INSTALLSYSTEMD=0
;;
mingw)
rm -f tunDevice.cpp
@@ -256,6 +258,7 @@ case $TARGET in
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'
+ INSTALLSYSTEMD=0
;;
*)
echo "platform not supported"
@@ -334,6 +337,15 @@ if [ -z "$EXAMPLESDIR" ]; then
EXAMPLESDIR=$PREFIX/share/examples
fi
+if [ $INSTALLSYSTEMD -eq 1 ]; then
+ if [ -z "$SYSTEMDDIR" ]; then
+ SYSTEMDDIR=`pkg-config systemd --variable=systemdsystemunitdir`
+ fi
+ if [ -z "$TMPFILESDDIR" ]; then
+ TMPFILESDDIR=`pkg-config systemd --variable=tmpfilesdir`
+ fi
+fi
+
cat > include.mk <<EOF
# this file was created automatically
# do not edit this file directly
@@ -371,6 +383,14 @@ else
echo "not installing example files"
fi
+if [ $INSTALLSYSTEMD -eq 1 ]; then
+ echo "SYSTEMDDIR := $SYSTEMDDIR" >> include.mk
+ echo "TMPFILESDDIR := $TMPFILESDDIR" >> include.mk
+ echo "installing systemd units"
+else
+ echo "not installing systemd units"
+fi
+
VERSION=`cat ../version`
if which git >/dev/null; then
GIT_HASH=`git rev-parse HEAD 2> /dev/null`
@@ -397,7 +417,6 @@ cat > version.h <<EOF
#define VERSION_STRING_1 "built on $HOSTNAME, $DATE"
#endif
-
EOF
exit 0