917903b074cad82c48869ab914a0bab371f02ae8
[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         AS_HELP_STRING([--with-low-tcpportrange=low/high],
68             [bind reserved TCP server sockets to ports within this range (default: unlimited)]),
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     AC_ARG_WITH(tcpportrange,
93         AS_HELP_STRING([--with-tcpportrange=low/high],
94             [bind unreserved TCP server sockets to ports within this range (default: unlimited)]),
95         [ TCPPORTRANGE="$withval" ],
96         [ TCPPORTRANGE="unlimited" ])
97
98     if test x"$TCPPORTRANGE" != x"unlimited"; then
99         if test x`echo "$TCPPORTRANGE" | sed 's/[[0-9]][[0-9]]*,[[0-9]][[0-9]]*//'` != x""; then
100             AC_MSG_ERROR([--with-tcpportrange requires two comma-separated positive numbers])
101         fi
102         min_tcp_port=`echo "$TCPPORTRANGE" | sed 's/,.*//'`
103         max_tcp_port=`echo "$TCPPORTRANGE" | sed 's/.*,//'`
104         if test $min_tcp_port -gt $max_tcp_port; then
105             AC_MSG_ERROR([the second TCP port number must be greater than the first in --with-tcpportrange])
106         fi
107         if test $min_tcp_port -lt 1024; then
108             AMANDA_MSG_WARN([the TCP port range should be 1024 or greater in --with-tcpportrange])
109         fi
110         if test $max_tcp_port -ge 65536; then
111             AMANDA_MSG_WARN([the TCP port range should be less than 65536 in --with-tcpportrange])
112         fi
113         AC_DEFINE_UNQUOTED(TCPPORTRANGE,$TCPPORTRANGE,
114   [A comma-separated list of two integers, determining the minimum and
115  * maximum unreserved TCP port numbers sockets should be bound to. ])
116     fi
117
118     AC_ARG_WITH(udpportrange,
119         AS_HELP_STRING([--with-udpportrange=low/high],
120             [bind reserved UDP server sockets to ports within this range (default: unlimited)]),
121         [ UDPPORTRANGE="$withval" ],
122         [ UDPPORTRANGE="unlimited" ])
123     if test x"$UDPPORTRANGE" != x"unlimited"; then
124         if test x`echo "$UDPPORTRANGE" | sed 's/[[0-9]][[0-9]]*,[[0-9]][[0-9]]*//'` != x""; then
125             AC_MSG_ERROR([--with-udpportrange requires two comma-separated positive numbers])
126         fi
127         min_udp_port=`echo "$UDPPORTRANGE" | sed 's/,.*//'`
128         max_udp_port=`echo "$UDPPORTRANGE" | sed 's/.*,//'`
129         if test $min_udp_port -gt $max_udp_port; then
130             AC_MSG_ERROR([the second UDP port number must be greater than the first in --with-udpportrange])
131         fi
132         if test $max_udp_port -ge 1024; then
133             AMANDA_MSG_WARN([the UDP port range should be less than 1025 in --with-udpportrange])
134         fi
135         if test $min_udp_port -le 0; then
136             AMANDA_MSG_WARN([the UDP port range should be greater than 0 in --with-udpportrange])
137         fi
138         AC_DEFINE_UNQUOTED(UDPPORTRANGE,$UDPPORTRANGE,
139   [A comma-separated list of two integers, determining the minimum and
140  * maximum reserved UDP port numbers sockets should be bound to. ])
141     fi
142     AC_SUBST(UDPPORTRANGE)
143     AC_SUBST(TCPPORTRANGE)
144     AC_SUBST(LOW_TCPPORTRANGE)
145 ])
146
147 # SYNOPSIS
148 #
149 #   AMANDA_WITH_BUFFERED_DUMP
150 #
151 # OVERVIEW
152 #
153 #   Implement --with-buffered-dump, and DEFINEs DUMPER_SOCKET_BUFFERING if the option
154 #   is given.
155 #
156 AC_DEFUN([AMANDA_WITH_BUFFERED_DUMP], [
157     AC_ARG_WITH(buffered-dump,
158         AS_HELP_STRING([--with-buffered-dump],
159             [buffer the dumping sockets on the server for speed]),
160         [ DUMPER_SOCKET_BUFFERING=$withval ],
161         [ DUMPER_SOCKET_BUFFERING=no ])
162     case "$DUMPER_SOCKET_BUFFERING" in
163     n | no) ;;
164     y | ye | yes)
165         AC_DEFINE(DUMPER_SOCKET_BUFFERING,1,
166             [Define if dumper should buffer the sockets for faster throughput. ])
167       ;;
168     *) AC_MSG_ERROR([You must not supply an argument to --with-buffered-dump.]) ;;
169     esac
170 ])