summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy T. Bouse <undrgrid@users.sourceforge.net>2003-03-12 17:11:20 +0000
committerJeremy T. Bouse <undrgrid@users.sourceforge.net>2003-03-12 17:11:20 +0000
commit48442b777389cfecb95f07b800d69dbac24130f0 (patch)
tree89503205708962a022c89c26fc0f5159ec3b9f62
parent46b0e78076a4c712f9c58b4f7804ba50b5895f46 (diff)
downloadmonitoring-plugins-48442b777389cfecb95f07b800d69dbac24130f0.tar.gz
Added autogen.sh script that rebuilds using autotools and runs configure
Modified configure.in to include some debug build option info at the end of the scripts execution. Can be removed by release time. Modified configure.in to include a --with-ipv6 option Default build is without IPv6 support now to enable you need to use the --with-ipv6 command line option to configure. Modified plugins/utils.* to use USE_IPV6 git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@410 f882894a-f735-0410-b71e-b25c423dba1c
-rwxr-xr-xautogen.sh58
-rw-r--r--configure.in51
-rw-r--r--plugins/utils.c12
-rw-r--r--plugins/utils.h.in2
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
9MAKE=$(which gnumake)
10if test ! -x "$MAKE" ; then MAKE=$(which gmake) ; fi
11if test ! -x "$MAKE" ; then MAKE=$(which make) ; fi
12HAVE_GNU_MAKE=$($MAKE --version|grep -c "Free Software Foundation")
13
14if test "$HAVE_GNU_MAKE" != "1"; then
15 echo Could not find GNU make on this system, can not proceed with build.
16 exit 1
17else
18 echo Found GNU Make at $MAKE ... good.
19fi
20
21# Refresh GNU autotools toolchain.
22for 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}
28done
29
30aclocal -I lib
31autoheader
32automake -c -a
33autoconf
34
35# For the Debian build
36test -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
58exit 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
303AC_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
309dnl Check for AF_INET6 support
310AC_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
322if test x"$ac_cv_sys_use_ipv6" != xno ; then
323 AC_DEFINE(USE_IPV6,1,[Enable IPv6 support])
324fi
325
303dnl ######################################################################### 326dnl #########################################################################
304dnl Check if Posix getaddrinfo() is available. It is also possible to use 327dnl Check if Posix getaddrinfo() is available. It is also possible to use
305dnl the version from the lwres library distributed with BIND. 328dnl 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
416fi 424fi
417 425
418AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no) 426AC_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
1058if test x"$ac_cv_sys_use_ipv6" != xno ; then
1050AC_MSG_CHECKING(for ICMPv6 ping syntax) 1059AC_MSG_CHECKING(for ICMPv6 ping syntax)
1051ac_cv_ping6_packets_first=no 1060ac_cv_ping6_packets_first=no
1052if test -n "$ac_cv_ping6_command" 1061if 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])
1198fi 1207fi
1208fi
1199 1209
1200AC_PATH_PROG(PATH_TO_NSLOOKUP,nslookup) 1210AC_PATH_PROG(PATH_TO_NSLOOKUP,nslookup)
1201 1211
@@ -1453,3 +1463,14 @@ AC_SUBST(DEPLIBS)
1453AC_DEFINE_UNQUOTED(PACKAGE_VERSION,"${VERSION}",[package version]) 1463AC_DEFINE_UNQUOTED(PACKAGE_VERSION,"${VERSION}",[package version])
1454 1464
1455AC_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) 1465AC_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
1467ACX_FEATURE([with],[cgiurl],[$cgiurl])
1468ACX_FEATURE([with],[nagios-user],[$nagios_usr])
1469ACX_FEATURE([with],[nagios-group],[$nagios_grp])
1470ACX_FEATURE([with],[trusted-path],[$trusted_path])
1471ACX_FEATURE([with],[df-command],[$ac_cv_df_command])
1472ACX_FEATURE([with],[ping-command],[$ac_cv_ping_command])
1473ACX_FEATURE([with],[ping6-command],[$ac_cv_ping6_command])
1474ACX_FEATURE([with],[lwres])
1475ACX_FEATURE([with],[ipv6],[$ac_cv_sys_use_ipv6])
1476ACX_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 *);
32int is_addr (char *); 32int is_addr (char *);
33int resolve_host_or_addr (char *, int); 33int resolve_host_or_addr (char *, int);
34int is_inet_addr (char *); 34int is_inet_addr (char *);
35#ifdef USE_IPV6
35int is_inet6_addr (char *); 36int is_inet6_addr (char *);
37#endif
36int is_hostname (char *); 38int is_hostname (char *);
37 39
38int is_integer (char *); 40int is_integer (char *);
@@ -181,7 +183,11 @@ is_host (char *address)
181int 183int
182is_addr (char *address) 184is_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
215int 222int
216is_inet6_addr (char *address) 223is_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)
228int 236int
229is_hostname (char *s1) 237is_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
234int 246int
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;
30int is_host (char *); 30int is_host (char *);
31int is_addr (char *); 31int is_addr (char *);
32int is_inet_addr (char *); 32int is_inet_addr (char *);
33#ifdef USE_IPV6
33int is_inet6_addr (char *); 34int is_inet6_addr (char *);
35#endif
34int is_hostname (char *); 36int is_hostname (char *);
35 37
36int is_integer (char *); 38int is_integer (char *);