Imported Upstream version 3.2.0
[debian/amanda] / config / amanda / net.m4
1 # OVERVIEW
2 #
3 #   Networking-related macros
4
5 # SYNOPSIS
6 #
7 #   AMANDA_WITH_FQDN
8 #
9 # OVERVIEW
10 #
11 #   Check for --with-fqdn, and DEFINE USE_FQDN if given.
12 #
13 AC_DEFUN([AMANDA_WITH_FQDN], [
14     AC_ARG_WITH(fqdn,
15         AS_HELP_STRING([--with-fqdn],
16                        [use FQDN's to backup multiple networks]),
17         [ USE_FQDN=$withval ], [ USE_FQDN=no ])
18
19     case "$USE_FQDN" in
20     n | no) : ;;
21     y |  ye | yes) 
22         AC_DEFINE(USE_FQDN,1,
23             [Define for backups being done on a multiple networks and FQDNs are used. ])
24       ;;
25     *) AC_MSG_ERROR([You must not supply an argument to --with-fqdn option.])
26       ;;
27     esac
28 ])
29
30 # SYNOPSIS
31 #
32 #   AMANDA_WITH_REUSEPORTS
33 #
34 # OVERVIEW
35 #
36 #   Check for --with-reuseports, and DEFINE USE_REUSEADDR if given.
37 #
38 AC_DEFUN([AMANDA_WITH_REUSEPORTS], [
39     AC_ARG_WITH(reuseports,
40         AS_HELP_STRING([--without-reuseaddr],
41                        [Don't reuse network connections until full timeout period]),
42         [ case "$withval" in
43             y | ye | yes) USE_REUSEADDR=no;;
44             n | no) USE_REUSEADDR=yes;;
45             *) AC_MSG_ERROR([You must not supply an argument to --without-reuseports]);;
46           esac
47         ],
48         [ USE_REUSEADDR=yes; ])
49     if test x"$USE_REUSEADDR" = x"yes"; then
50         AC_DEFINE(USE_REUSEADDR,1,
51                 [Define to set SO_REUSEADDR on network connections.])
52     fi
53 ])
54
55 # SYNOPSIS
56 #
57 #   AMANDA_WITH_PORTRANGES
58 #
59 # OVERVIEW
60 #
61 #   Implement --with-low-tcpportrange, --with-tcpportrange, and --with-udpportrange.
62 #   Results are DEFINED and substituted in LOW_TCPPORTRANGE, TCPPORTRANGE, and 
63 #   UDPPORTRANGE, respectively.
64 #
65 AC_DEFUN([AMANDA_WITH_PORTRANGES], [
66     AC_ARG_WITH(low-tcpportrange,
67 [  --with-low-tcpportrange=low,high
68                           bind reserved TCP server sockets to ports within],
69         [ LOW_TCPPORTRANGE="$withval" ],
70         [ LOW_TCPPORTRANGE=unlimited ])
71      
72     if test x"$LOW_TCPPORTRANGE" != x"unlimited"; then
73         if test x`echo "$LOW_TCPPORTRANGE" | sed 's/[[0-9]][[0-9]]*,[[0-9]][[0-9]]*//'` != x""; then
74             AC_MSG_ERROR([--with-low-tcpportrange requires two comma-separated positive numbers])
75         fi
76         min_low_tcp_port=`echo "$LOW_TCPPORTRANGE" | sed 's/,.*//'`
77         max_low_tcp_port=`echo "$LOW_TCPPORTRANGE" | sed 's/.*,//'`
78         if test $min_low_tcp_port -gt $max_low_tcp_port; then
79             AC_MSG_ERROR([the second TCP port number must be greater than the first in --with-low-tcpportrange])
80         fi
81         if test $min_low_tcp_port -lt 512; then
82             AMANDA_MSG_WARN([the low TCP port range should be 512 or greater in --with-low-tcpportrange])
83         fi
84         if test $max_low_tcp_port -ge 1024; then
85             AMANDA_MSG_WARN([the low TCP port range should be less than 1024 in --with-low-tcpportrange])
86         fi
87         AC_DEFINE_UNQUOTED(LOW_TCPPORTRANGE,$LOW_TCPPORTRANGE,
88    [A comma-separated list of two integers, determining the minimum and maximum
89  * reserved TCP port numbers sockets should be bound to. (mainly for amrecover) ])
90     fi
91
92     dnl note that AS_HELP_STRING cannot handle commas in its argument..
93     AC_ARG_WITH(tcpportrange,
94 [  --with-tcpportrange=low,high
95                           bind unreserved TCP server sockets to ports within],
96         [ TCPPORTRANGE="$withval" ],
97         [ TCPPORTRANGE="unlimited" ])
98
99     if test x"$TCPPORTRANGE" != x"unlimited"; then
100         if test x`echo "$TCPPORTRANGE" | sed 's/[[0-9]][[0-9]]*,[[0-9]][[0-9]]*//'` != x""; then
101             AC_MSG_ERROR([--with-tcpportrange requires two comma-separated positive numbers])
102         fi
103         min_tcp_port=`echo "$TCPPORTRANGE" | sed 's/,.*//'`
104         max_tcp_port=`echo "$TCPPORTRANGE" | sed 's/.*,//'`
105         if test $min_tcp_port -gt $max_tcp_port; then
106             AC_MSG_ERROR([the second TCP port number must be greater than the first in --with-tcpportrange])
107         fi
108         if test $min_tcp_port -lt 1024; then
109             AMANDA_MSG_WARN([the TCP port range should be 1024 or greater in --with-tcpportrange])
110         fi
111         if test $max_tcp_port -ge 65536; then
112             AMANDA_MSG_WARN([the TCP port range should be less than 65536 in --with-tcpportrange])
113         fi
114         AC_DEFINE_UNQUOTED(TCPPORTRANGE,$TCPPORTRANGE,
115   [A comma-separated list of two integers, determining the minimum and
116  * maximum unreserved TCP port numbers sockets should be bound to. ])
117     fi
118
119     AC_ARG_WITH(udpportrange,
120 [  --with-udpportrange=low,high
121                           bind reserved UDP server sockets to ports within],
122         [ UDPPORTRANGE="$withval" ],
123         [ UDPPORTRANGE="unlimited" ])
124     if test x"$UDPPORTRANGE" != x"unlimited"; then
125         if test x`echo "$UDPPORTRANGE" | sed 's/[[0-9]][[0-9]]*,[[0-9]][[0-9]]*//'` != x""; then
126             AC_MSG_ERROR([--with-udpportrange requires two comma-separated positive numbers])
127         fi
128         min_udp_port=`echo "$UDPPORTRANGE" | sed 's/,.*//'`
129         max_udp_port=`echo "$UDPPORTRANGE" | sed 's/.*,//'`
130         if test $min_udp_port -gt $max_udp_port; then
131             AC_MSG_ERROR([the second UDP port number must be greater than the first in --with-udpportrange])
132         fi
133         if test $max_udp_port -ge 1024; then
134             AMANDA_MSG_WARN([the UDP port range should be less than 1025 in --with-udpportrange])
135         fi
136         if test $min_udp_port -le 0; then
137             AMANDA_MSG_WARN([the UDP port range should be greater than 0 in --with-udpportrange])
138         fi
139         AC_DEFINE_UNQUOTED(UDPPORTRANGE,$UDPPORTRANGE,
140   [A comma-separated list of two integers, determining the minimum and
141  * maximum reserved UDP port numbers sockets should be bound to. ])
142     fi
143     AC_SUBST(UDPPORTRANGE)
144     AC_SUBST(TCPPORTRANGE)
145     AC_SUBST(LOW_TCPPORTRANGE)
146 ])
147
148 # SYNOPSIS
149 #
150 #   AMANDA_WITH_BUFFERED_DUMP
151 #
152 # OVERVIEW
153 #
154 #   Implement --with-buffered-dump, and DEFINEs DUMPER_SOCKET_BUFFERING if the option
155 #   is given.
156 #
157 AC_DEFUN([AMANDA_WITH_BUFFERED_DUMP], [
158     AC_ARG_WITH(buffered-dump,
159         AS_HELP_STRING([--with-buffered-dump],
160             [buffer the dumping sockets on the server for speed]),
161         [ DUMPER_SOCKET_BUFFERING=$withval ],
162         [ DUMPER_SOCKET_BUFFERING=no ])
163     case "$DUMPER_SOCKET_BUFFERING" in
164     n | no) ;;
165     y | ye | yes)
166         AC_DEFINE(DUMPER_SOCKET_BUFFERING,1,
167             [Define if dumper should buffer the sockets for faster throughput. ])
168       ;;
169     *) AC_MSG_ERROR([You must not supply an argument to --with-buffered-dump.]) ;;
170     esac
171 ])