summaryrefslogtreecommitdiffstats
path: root/configure
blob: 84cccfcb822d1cc997e94e43f01914536bdcdc86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh

usage() {
    cat <<EOF
configure help for eurephia

          --help               | -h        -- This help screen
          --openvpn-src <path> | -s <path> -- OpenVPN source directory (needed for building)
          --debug              | -D        -- Enable verbose debug logging
          --show-secrets       | -S        -- Log passwords as clear text in log files

EOF
}

PARAMS=""
export OPENVPN_SRC_DIR=""
while [ ! -z "$1" ]; do
      case $1 in 
          -h|--help)
              usage
              exit 0
              ;;
          -s|--openvpn-src)
              export OPENVPN_SRC_DIR="$2"
              shift
              ;;
          -D|--debug)
              PARAMS="${PARAMS} -DDEBUG=ON"
              ;;
          -S|--show-secrets)
              PARAMS="${PARAMS} -DSHOW_SECRETS=ON"
              ;;
          *)
              echo "Unkown option: $1"
              exit 2
              ;;
      esac
      shift
done

if [ -z $(which cmake) ]; then
    echo "To build eurephia, you need to install cmake (at least version 2.6)"
    exit 1;
fi

if [ -z ${OPENVPN_SRC_DIR} ]; then
    echo "You need to give the --openvpn-src <path> option"
    exit 1;
fi

rm -f CMakeCache.txt
cmake . ${PARAMS}
exit $?