moved raspberry and router gpio to pi_as_powerwitch on github
[svn42.git] / door_daemon / configure
1 #!/bin/sh
2 #
3 #
4 #  door_daemon
5 #
6 #  Copyright (C) 2009 Christian Pointner <equinox@spreadspace.org>
7 #
8 #  This file is part of door_daemon.
9 #
10 #  door_daemon is free software: you can redistribute it and/or modify
11 #  it under the terms of the GNU General Public License as published by
12 #  the Free Software Foundation, either version 3 of the License, or
13 #  any later version.
14 #
15 #  door_daemon is distributed in the hope that it will be useful,
16 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
17 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 #  GNU General Public License for more details.
19 #
20 #  You should have received a copy of the GNU General Public License
21 #  along with door_daemon. If not, see <http://www.gnu.org/licenses/>.
22 #
23
24 TARGET=`uname -s`
25
26 CFLAGS='-g -O2'
27 LDFLAGS='-g -Wall -O2'
28
29 PREFIX='/usr/local'
30 USERNAME='uanytun'
31 USERHOME='/var/run/uanytun'
32
33 print_usage() {
34   echo "configure --help                    print this"
35   echo "          --target=<TARGET>         build target i.e. Linux (default: autodetect)"
36   echo "          --prefix=<PREFIX>         the installation prefix (default: /usr/local)"
37   echo "          --username=<USERNAME>     create this user when installing (default: uanytun)"
38   echo "          --userhome=<PATH>         the home directory of the user to be created  (default: /var/run/uanytun)"
39 }
40
41 for arg
42 do
43   case $arg in
44   --target=*)
45     TARGET=${arg#--target=}
46   ;;
47   --prefix=*)
48     PREFIX=${arg#--prefix=}
49   ;;
50   --username=*)
51     USERNAME=${arg#--username=}
52   ;;
53   --userhome=*)
54     USERHOME=${arg#--userhome=}
55   ;;
56   --help)
57     print_usage
58     exit 0
59   ;;
60   *)
61     echo "Unknown argument: $arg"
62     print_usage
63     exit 1
64   ;;
65   esac
66 done
67
68 rm -f include.mk
69 case $TARGET in 
70   Linux)
71     echo "Linux specific build options"
72   ;;
73   OpenBSD|FreeBSD|NetBSD)
74     echo "BSD specific build options"
75     CFLAGS=$CFLAGS' -I/usr/local/include'
76     LDFLAGS=$LDFLAGS' -L/usr/local/lib'
77   ;;
78   *)
79     echo "Plattform not supported"
80     exit 1;
81   ;;
82 esac
83
84 if [ "x$PREFIX" = "x/usr" ]; then
85  ETCDIR=/etc
86 else
87  ETCDIR=$PREFIX/etc
88 fi
89
90 cat >> include.mk <<EOF
91 # this file was created automatically
92 # do not edit this file directly 
93 # use ./configure instead
94
95 TARGET := $TARGET
96 CC := gcc
97 CFLAGS := $CFLAGS
98 LDFLAGS := $LDFLAGS
99
100 SBINDIR := $PREFIX/sbin
101 MANDIR := $PREFIX/share/man
102 ETCDIR := $ETCDIR
103 USERNAME := $USERNAME
104 USERHOME := $USERHOME
105 EOF
106
107 exit 0