forked from troglobit/pimd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure
executable file
·212 lines (185 loc) · 7.26 KB
/
configure
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
#!/bin/sh
#
# --enable-broken-crc:
# If your RP is buggy cisco PIM-SMv2 implementation that computes
# the PIM-Register checksum over the whole pkt instead only over
# the header, you need to define this. Otherwise, all your PIM-Register
# may be dropped by the cisco-RP.
#DEFS += -DBROKEN_CISCO_CHECKSUM
#
# --enable-kernel-encap:
# Register kernel encapsulation. Your kernel must support registers
# kernel encapsulation to be able to use it.
#DEFS += -DPIM_REG_KERNEL_ENCAP
#
# --enable-kernel-mfc:
# (*,G) kernel MFC support. Use it ONLY with (*,G) capable kernel
#DEFS += -DKERNEL_MFC_WC_G
#
# --enable-memory-save:
# Saves 4 bytes per unconfigured interface per routing entry. If set,
# configuring such interface will restart the daemon and will flush
# the routing table.
#DEFS += -DSAVE_MEMORY
#
# --enable-scoped-acls:
# Scoped access control list support in pimd.conf. If you want to
# install NUL OIF for the "scoped groups", use the following syntax:
# "phyint IFNAME [scoped <MCAST_ADDR> masklen <PREFIX_LEN>]", e.g.
# phyint fxp0 scoped "addr" masklen "len"
# Support contributed by Marian Stagarescu <marian@cidera.com>
#DEFS += -DSCOPED_ACL
#
OS=`uname`
CFG=config.mk
TMP=`mktemp`
heading()
{
echo "# This makefile snippet is generated by the pimd configure script." > $CFG
echo >> $CFG
echo "# Initial definitions ..." >> $CFG
echo "# -D_GNU_SOURCE Use GNU extensions, where possible" >> $CFG
echo "# -D_BSD_SOURCE Use functions derived from 4.3 BSD Unix rather than POSIX.1" >> $CFG
echo "# -DPIM Enable PIM extensions in RSRR" >> $CFG
echo "DEFS = -D_BSD_SOURCE -D_GNU_SOURCE -DPIM" >> $CFG
echo "# EXTRA_OBJS = For locally provided objects missing on some platforms, e.g., strlcpy.o" >> $CFG
echo "# EXTRA_LIBS = For platform specific libraries, e.g., -lutil" >> $CFG
echo >> $CFG
echo "# $OS specific settings ..." >> $CFG
}
usage()
{
echo "Run this script to configure pimd for your operating system."
echo
echo "Usage: $0 [ARG]"
echo
echo " --enable-broken-crc Interop with older broken Cisco firmware that did the"
echo " checksum in PIM Register messages slightly wrong."
echo " Should not be needed anymore."
echo " --enable-kernel-encap Some kernels can do the PIM Register encapsulation by"
echo " themselves, this speeds up processing considerably."
echo " Only enable this if your kernel supports it."
echo " --enable-kernel-mfc Some specialized kernels may have (*,G) MFC support."
echo " Only enable this if your kernel supports it."
echo " --enable-memory-save Save 4 bytes per unconfigured interface per routing"
echo " entry. Must restart pimd and cause routing table to"
echo " be flushed when configuring new interfaces."
echo " --enable-scoped-acls Scoped access control list support in pimd.conf, as"
echo " phyint IFNAME [scoped <MCGROUP> masklen <LEN>], e.g."
echo " phyint fxp0 scoped 239.0.0.0 masklen 8"
echo " --enable-rsrr Routing Support for Resource Reservations, currently"
echo " used by RSVP. EXPERIMENTAL"
echo " --with-includes=PATH Use this if the multicast header files are not in the"
echo " standard location on your system. E.g., /sys"
echo
echo "Report any bugs to https://github.com/troglobit/pimd/issues"
echo
exit 1
}
echo > $TMP
echo "# Enabled features ..." >> $TMP
while [ "$*" != "" ]; do
opt=`expr "$1" : "--\([^=]*\)=.*"`
arg=`expr "$1" : "--[^=]*=\(.*\)"`
if [ -z "$opt" ]; then
opt=`expr "$1" : "--\(.*\)"`
fi
shift
case $opt in
enable-broken-crc)
echo "DEFS += -DBROKEN_CISCO_CHECKSUM" >> $TMP
;;
enable-kernel-encap)
echo "DEFS += -DPIM_REG_KERNEL_ENCAP" >> $TMP
;;
enable-kernel-mfc)
echo "DEFS += -DKERNEL_MFC_WC_G" >> $TMP
;;
enable-memory-save)
echo "DEFS += -DSAVE_MEMORY" >> $TMP
;;
enable-scoped-acls)
echo "DEFS += -DSCOPED_ACL" >> $TMP
;;
enable-rsrr)
echo "DEFS += -DRSRR" >> $TMP
echo "EXTRA_OBJS += rsrr.o" >> $TMP
;;
with-includes)
echo "INCLUDES += -I$arg" >> $TMP
;;
help)
usage
;;
*)
echo "Unknown option: $opt"
usage
;;
esac
done
## BSDI -D__bsdi__ is defined by the OS
#INCLUDES = -Iinclude
#DEFS +=
#EXTRA_OBJS = strlcpy.o pidfile.o
## SunOS, OSF1, gcc
#INCLUDES = -Iinclude -Iinclude/sunos-gcc
#DEFS += -DSunOS=43
#EXTRA_OBJS = strlcpy.o pidfile.o
## SunOS, OSF1, cc
#INCLUDES = -Iinclude -Iinclude/sunos-cc
#DEFS += -DSunOS=43
#EXTRA_OBJS = strlcpy.o pidfile.o
## IRIX
#INCLUDES = -Iinclude
#DEFS += -D_BSD_SIGNALS -DIRIX
#EXTRA_OBJS = strlcpy.o pidfile.o
## Solaris 2.5, gcc
#INCLUDES = -Iinclude
#DEFS += -DSYSV -DSunOS=55
## Solaris 2.5, cc
#INCLUDES = -Iinclude
#DEFS += -DSYSV -DSunOS=55
## Solaris 2.6
#INCLUDES = -Iinclude
#DEFS += -DSYSV -DSunOS=56
## Solaris 2.x
#EXTRA_OBJS = strlcpy.o pidfile.o
#EXTRA_LIBS = -L/usr/ucblib -lucb -L/usr/lib -lsocket -lnsl
case $OS in
Linux)
heading
echo "INCLUDES = -Iinclude" >> $CFG
echo "DEFS += -DRAW_OUTPUT_IS_RAW -DIOCTL_OK_ON_RAW_SOCKET" >> $CFG
echo "EXTRA_OBJS = strlcpy.o pidfile.o" >> $CFG
echo "EXTRA_LIBS =" >> $CFG
;;
FreeBSD)
heading
echo "INCLUDES =" >> $CFG
echo "DEFS += -DHAVE_STRTONUM -DHAVE_STRLCPY" >> $CFG
echo "EXTRA_OBJS = pidfile.o" >> $CFG
echo "EXTRA_LIBS =" >> $CFG
;;
NetBSD)
heading
echo "INCLUDES =" >> $CFG
echo "DEFS += -DHAVE_STRTONUM -DHAVE_STRLCPY -DHAVE_PIDFILE" >> $CFG
echo "EXTRA_OBJS =" >> $CFG
echo "EXTRA_LIBS = -lutil" >> $CFG
;;
OpenBSD)
heading
echo "INCLUDES =" >> $CFG
echo "DEFS += -DHAVE_STRTONUM -DHAVE_STRLCPY -DHAVE_PIDFILE" >> $CFG
echo "EXTRA_OBJS =" >> $CFG
echo "EXTRA_LIBS = -lutil" >> $CFG
;;
*)
rm $CFG
echo "$OS is currently unsupported. Help out at https://github.com/troglobit/pimd/"
exit 1
;;
esac
cat $TMP >> $CFG
rm $TMP
exit 0