diff options
-rwxr-xr-x | autogen.sh | 58 | ||||
-rw-r--r-- | configure.in | 51 | ||||
-rw-r--r-- | plugins/utils.c | 12 | ||||
-rw-r--r-- | plugins/utils.h.in | 2 |
4 files changed, 108 insertions, 15 deletions
diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 00000000..0357d93a --- /dev/null +++ b/autogen.sh | |||
@@ -0,0 +1,58 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # autogen.sh glue for CMU Cyrus IMAP | ||
4 | # $Id$ | ||
5 | # | ||
6 | # Requires: automake, autoconf, dpkg-dev | ||
7 | # set -e | ||
8 | |||
9 | MAKE=$(which gnumake) | ||
10 | if test ! -x "$MAKE" ; then MAKE=$(which gmake) ; fi | ||
11 | if test ! -x "$MAKE" ; then MAKE=$(which make) ; fi | ||
12 | HAVE_GNU_MAKE=$($MAKE --version|grep -c "Free Software Foundation") | ||
13 | |||
14 | if test "$HAVE_GNU_MAKE" != "1"; then | ||
15 | echo Could not find GNU make on this system, can not proceed with build. | ||
16 | exit 1 | ||
17 | else | ||
18 | echo Found GNU Make at $MAKE ... good. | ||
19 | fi | ||
20 | |||
21 | # Refresh GNU autotools toolchain. | ||
22 | for i in config.guess config.sub missing install-sh mkinstalldirs ; do | ||
23 | test -r /usr/share/automake/${i} && { | ||
24 | rm -f ${i} | ||
25 | cp /usr/share/automake/${i} . | ||
26 | } | ||
27 | chmod 755 ${i} | ||
28 | done | ||
29 | |||
30 | aclocal -I lib | ||
31 | autoheader | ||
32 | automake -c -a | ||
33 | autoconf | ||
34 | |||
35 | # For the Debian build | ||
36 | test -d debian && { | ||
37 | # Kill executable list first | ||
38 | rm -f debian/executable.files | ||
39 | |||
40 | # Make sure our executable and removable lists won't be screwed up | ||
41 | debclean && echo Cleaned buildtree just in case... | ||
42 | |||
43 | # refresh list of executable scripts, to avoid possible breakage if | ||
44 | # upstream tarball does not include the file or if it is mispackaged | ||
45 | # for whatever reason. | ||
46 | echo Generating list of executable files... | ||
47 | rm -f debian/executable.files | ||
48 | find -type f -perm +111 ! -name '.*' -fprint debian/executable.files | ||
49 | |||
50 | # link these in Debian builds | ||
51 | rm -f config.sub config.guess | ||
52 | ln -s /usr/share/misc/config.sub . | ||
53 | ln -s /usr/share/misc/config.guess . | ||
54 | } | ||
55 | |||
56 | ./configure $* | ||
57 | |||
58 | exit 0 | ||
diff --git a/configure.in b/configure.in index 48e45067..529b7bbc 100644 --- a/configure.in +++ b/configure.in | |||
@@ -300,6 +300,29 @@ AC_ARG_WITH(openssl, | |||
300 | [sets path to openssl installation]), | 300 | [sets path to openssl installation]), |
301 | OPENSSL=$withval,) | 301 | OPENSSL=$withval,) |
302 | 302 | ||
303 | AC_ARG_WITH([ipv6], | ||
304 | ACX_HELP_STRING([--with-ipv6], | ||
305 | [enable IPv6 support (default=no)]), | ||
306 | ac_cv_sys_use_ipv6=$withval, | ||
307 | ac_cv_sys_use_ipv6=no) | ||
308 | |||
309 | dnl Check for AF_INET6 support | ||
310 | AC_CACHE_CHECK([for IPv6 support], ac_cv_sys_use_ipv6, [ | ||
311 | AC_TRY_COMPILE([#include <netinet/in.h>], | ||
312 | [struct sockaddr_in6 sin6; | ||
313 | void *p; | ||
314 | |||
315 | sin6.sin6_family = AF_INET6; | ||
316 | sin6.sin6_port = 587; | ||
317 | p = &sin6.sin6_addr;], | ||
318 | [ac_cv_sys_use_ipv6=yes], | ||
319 | [ac_cv_sys_use_ipv6=no]) | ||
320 | ]) | ||
321 | |||
322 | if test x"$ac_cv_sys_use_ipv6" != xno ; then | ||
323 | AC_DEFINE(USE_IPV6,1,[Enable IPv6 support]) | ||
324 | fi | ||
325 | |||
303 | dnl ######################################################################### | 326 | dnl ######################################################################### |
304 | dnl Check if Posix getaddrinfo() is available. It is also possible to use | 327 | dnl Check if Posix getaddrinfo() is available. It is also possible to use |
305 | dnl the version from the lwres library distributed with BIND. | 328 | dnl the version from the lwres library distributed with BIND. |
@@ -398,21 +421,6 @@ if test x"$enable_emulate_getaddrinfo" != xno ; then | |||
398 | fi | 421 | fi |
399 | LIBOBJS="$LIBOBJS gethostbyname.o" | 422 | LIBOBJS="$LIBOBJS gethostbyname.o" |
400 | 423 | ||
401 | AC_CACHE_CHECK([for IPv6 support], acx_cv_sys_use_ipv6, [ | ||
402 | AC_TRY_COMPILE([ | ||
403 | # include <netinet/in.h> | ||
404 | ], [ | ||
405 | struct sockaddr_in6 sin6; | ||
406 | void *p; | ||
407 | |||
408 | sin6.sin6_family = AF_INET6; | ||
409 | sin6.sin6_port = 587; | ||
410 | p = &sin6.sin6_addr; | ||
411 | ], [acx_cv_sys_use_ipv6=yes], [acx_cv_sys_use_ipv6=no]) | ||
412 | ]) | ||
413 | if test x"$acx_cv_sys_use_ipv6" != xno ; then | ||
414 | AC_DEFINE(USE_IPV6,1,[Enable IPv6 support]) | ||
415 | fi | ||
416 | fi | 424 | fi |
417 | 425 | ||
418 | AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no) | 426 | AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no) |
@@ -1047,6 +1055,7 @@ AC_ARG_WITH(ping6_command, | |||
1047 | [sets syntax for ICMPv6 ping]), | 1055 | [sets syntax for ICMPv6 ping]), |
1048 | ac_cv_ping6_command=$withval,) | 1056 | ac_cv_ping6_command=$withval,) |
1049 | 1057 | ||
1058 | if test x"$ac_cv_sys_use_ipv6" != xno ; then | ||
1050 | AC_MSG_CHECKING(for ICMPv6 ping syntax) | 1059 | AC_MSG_CHECKING(for ICMPv6 ping syntax) |
1051 | ac_cv_ping6_packets_first=no | 1060 | ac_cv_ping6_packets_first=no |
1052 | if test -n "$ac_cv_ping6_command" | 1061 | if test -n "$ac_cv_ping6_command" |
@@ -1196,6 +1205,7 @@ if test "x$ac_cv_ping6_packets_first" != "xno"; then | |||
1196 | AC_DEFINE(PING6_PACKETS_FIRST,1, | 1205 | AC_DEFINE(PING6_PACKETS_FIRST,1, |
1197 | [Define if packet count must precede host]) | 1206 | [Define if packet count must precede host]) |
1198 | fi | 1207 | fi |
1208 | fi | ||
1199 | 1209 | ||
1200 | AC_PATH_PROG(PATH_TO_NSLOOKUP,nslookup) | 1210 | AC_PATH_PROG(PATH_TO_NSLOOKUP,nslookup) |
1201 | 1211 | ||
@@ -1453,3 +1463,14 @@ AC_SUBST(DEPLIBS) | |||
1453 | AC_DEFINE_UNQUOTED(PACKAGE_VERSION,"${VERSION}",[package version]) | 1463 | AC_DEFINE_UNQUOTED(PACKAGE_VERSION,"${VERSION}",[package version]) |
1454 | 1464 | ||
1455 | AC_OUTPUT(Makefile subst lib/Makefile plugins/Makefile plugins-scripts/Makefile plugins-scripts/subst plugins-scripts/utils.pm plugins-scripts/utils.sh command.cfg test.pl,echo timestamp > plugins/stamp-h1;echo timestamp > plugins/stamp-h2;echo timestamp > plugins/stamp-h3;echo timestamp > plugins/stamp-h4;echo timestamp > plugins/stamp-h5;echo timestamp > plugins/stamp-h6;PATH=.:..:$PATH subst.sh command.cfg) | 1465 | AC_OUTPUT(Makefile subst lib/Makefile plugins/Makefile plugins-scripts/Makefile plugins-scripts/subst plugins-scripts/utils.pm plugins-scripts/utils.sh command.cfg test.pl,echo timestamp > plugins/stamp-h1;echo timestamp > plugins/stamp-h2;echo timestamp > plugins/stamp-h3;echo timestamp > plugins/stamp-h4;echo timestamp > plugins/stamp-h5;echo timestamp > plugins/stamp-h6;PATH=.:..:$PATH subst.sh command.cfg) |
1466 | |||
1467 | ACX_FEATURE([with],[cgiurl],[$cgiurl]) | ||
1468 | ACX_FEATURE([with],[nagios-user],[$nagios_usr]) | ||
1469 | ACX_FEATURE([with],[nagios-group],[$nagios_grp]) | ||
1470 | ACX_FEATURE([with],[trusted-path],[$trusted_path]) | ||
1471 | ACX_FEATURE([with],[df-command],[$ac_cv_df_command]) | ||
1472 | ACX_FEATURE([with],[ping-command],[$ac_cv_ping_command]) | ||
1473 | ACX_FEATURE([with],[ping6-command],[$ac_cv_ping6_command]) | ||
1474 | ACX_FEATURE([with],[lwres]) | ||
1475 | ACX_FEATURE([with],[ipv6],[$ac_cv_sys_use_ipv6]) | ||
1476 | ACX_FEATURE([enable],[emulate-getaddrinfo]) | ||
diff --git a/plugins/utils.c b/plugins/utils.c index 0d250677..9ac5596e 100644 --- a/plugins/utils.c +++ b/plugins/utils.c | |||
@@ -32,7 +32,9 @@ int is_host (char *); | |||
32 | int is_addr (char *); | 32 | int is_addr (char *); |
33 | int resolve_host_or_addr (char *, int); | 33 | int resolve_host_or_addr (char *, int); |
34 | int is_inet_addr (char *); | 34 | int is_inet_addr (char *); |
35 | #ifdef USE_IPV6 | ||
35 | int is_inet6_addr (char *); | 36 | int is_inet6_addr (char *); |
37 | #endif | ||
36 | int is_hostname (char *); | 38 | int is_hostname (char *); |
37 | 39 | ||
38 | int is_integer (char *); | 40 | int is_integer (char *); |
@@ -181,7 +183,11 @@ is_host (char *address) | |||
181 | int | 183 | int |
182 | is_addr (char *address) | 184 | is_addr (char *address) |
183 | { | 185 | { |
186 | #ifdef USE_IPV6 | ||
184 | if (is_inet_addr (address) || is_inet6_addr (address)) | 187 | if (is_inet_addr (address) || is_inet6_addr (address)) |
188 | #else | ||
189 | if (is_inet_addr (address)) | ||
190 | #endif | ||
185 | return (TRUE); | 191 | return (TRUE); |
186 | 192 | ||
187 | return (FALSE); | 193 | return (FALSE); |
@@ -212,11 +218,13 @@ is_inet_addr (char *address) | |||
212 | return resolve_host_or_addr (address, AF_INET); | 218 | return resolve_host_or_addr (address, AF_INET); |
213 | } | 219 | } |
214 | 220 | ||
221 | #ifdef USE_IPV6 | ||
215 | int | 222 | int |
216 | is_inet6_addr (char *address) | 223 | is_inet6_addr (char *address) |
217 | { | 224 | { |
218 | return resolve_host_or_addr (address, AF_INET6); | 225 | return resolve_host_or_addr (address, AF_INET6); |
219 | } | 226 | } |
227 | #endif | ||
220 | 228 | ||
221 | /* from RFC-1035 | 229 | /* from RFC-1035 |
222 | * | 230 | * |
@@ -228,7 +236,11 @@ is_inet6_addr (char *address) | |||
228 | int | 236 | int |
229 | is_hostname (char *s1) | 237 | is_hostname (char *s1) |
230 | { | 238 | { |
239 | #ifdef USE_IPV6 | ||
231 | return resolve_host_or_addr (s1, AF_UNSPEC); | 240 | return resolve_host_or_addr (s1, AF_UNSPEC); |
241 | #else | ||
242 | return resolve_host_or_addr (s1, AF_INET); | ||
243 | #endif | ||
232 | } | 244 | } |
233 | 245 | ||
234 | int | 246 | int |
diff --git a/plugins/utils.h.in b/plugins/utils.h.in index 0d947f42..89ada6f0 100644 --- a/plugins/utils.h.in +++ b/plugins/utils.h.in | |||
@@ -30,7 +30,9 @@ int timeout_interval = DEFAULT_SOCKET_TIMEOUT; | |||
30 | int is_host (char *); | 30 | int is_host (char *); |
31 | int is_addr (char *); | 31 | int is_addr (char *); |
32 | int is_inet_addr (char *); | 32 | int is_inet_addr (char *); |
33 | #ifdef USE_IPV6 | ||
33 | int is_inet6_addr (char *); | 34 | int is_inet6_addr (char *); |
35 | #endif | ||
34 | int is_hostname (char *); | 36 | int is_hostname (char *); |
35 | 37 | ||
36 | int is_integer (char *); | 38 | int is_integer (char *); |