summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy T. Bouse <undrgrid@users.sourceforge.net>2003-03-06 06:40:46 (GMT)
committerJeremy T. Bouse <undrgrid@users.sourceforge.net>2003-03-06 06:40:46 (GMT)
commit2e641a086800444de7f80ed6cb973290d6b84ec0 (patch)
treebe9dcb76e9238142c914e92592389678b35d0151
parent1fdb0658c8c5637c0b6eb2c6847eb2fcb2e5650a (diff)
downloadmonitoring-plugins-2e641a086800444de7f80ed6cb973290d6b84ec0.tar.gz
Adds --with-lwres and --enable-emulate-getaddrinfo but are not used in any of
the code at this time. Has a check for IPv6 support but only runs if using the emulate-getaddrinfo routines, this needs to be modified. !!! I need input from results of this run on various platforms to see what results are seen in plugins/config.h so please help test !!! git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@371 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r--acinclude.m478
-rw-r--r--configure.in115
2 files changed, 193 insertions, 0 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index e69de29..70d82e4 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -0,0 +1,78 @@
1dnl @synopsis ACX_WHICH_GETHOSTBYNAME_R
2dnl
3dnl Provides a test to determine the correct way to call gethostbyname_r
4dnl
5dnl defines HAVE_GETHOSTBYNAME_R to the number of arguments required
6dnl
7dnl e.g. 6 arguments (linux)
8dnl e.g. 5 arguments (solaris)
9dnl e.g. 3 arguments (osf/1)
10dnl
11dnl @version $Id$
12dnl @author Brian Stafford <brian@stafford.uklinux.net>
13dnl
14dnl based on version by Caolan McNamara <caolan@skynet.ie>
15dnl based on David Arnold's autoconf suggestion in the threads faq
16dnl
17AC_DEFUN(ACX_WHICH_GETHOSTBYNAME_R,
18[AC_CACHE_CHECK(number of arguments to gethostbyname_r,
19 acx_which_gethostbyname_r, [
20 AC_TRY_COMPILE([
21# include <netdb.h>
22 ], [
23
24 char *name;
25 struct hostent *he;
26 struct hostent_data data;
27 (void) gethostbyname_r(name, he, &data);
28
29 ],acx_which_gethostbyname_r=3,
30 [
31dnl acx_which_gethostbyname_r=0
32 AC_TRY_COMPILE([
33# include <netdb.h>
34 ], [
35 char *name;
36 struct hostent *he, *res;
37 char *buffer = NULL;
38 int buflen = 2048;
39 int h_errnop;
40 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
41 ],acx_which_gethostbyname_r=6,
42
43 [
44dnl acx_which_gethostbyname_r=0
45 AC_TRY_COMPILE([
46# include <netdb.h>
47 ], [
48 char *name;
49 struct hostent *he;
50 char *buffer = NULL;
51 int buflen = 2048;
52 int h_errnop;
53 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
54 ],acx_which_gethostbyname_r=5,acx_which_gethostbyname_r=0)
55
56 ]
57
58 )
59 ]
60 )
61 ])
62
63if test $acx_which_gethostbyname_r -gt 0 ; then
64 AC_DEFINE_UNQUOTED([HAVE_GETHOSTBYNAME_R], $acx_which_gethostbyname_r,
65 [Number of parameters to gethostbyname_r or 0 if not available])
66fi
67
68])
69
70dnl @synopsis ACX_HELP_STRING(OPTION,DESCRIPTION)
71AC_DEFUN([ACX_HELP_STRING],
72 [ $1 builtin([substr],[ ],len($1))[$2]])
73
74
75dnl @synopsis ACX_FEATURE(ENABLE_OR_WITH,NAME[,VALUE])
76AC_DEFUN([ACX_FEATURE],
77 [echo "builtin([substr],[ ],len(--$1-$2))--$1-$2: ifelse($3,,[$]translit($1-$2,-,_),$3)"])
78
diff --git a/configure.in b/configure.in
index 08996c9..ef0d06b 100644
--- a/configure.in
+++ b/configure.in
@@ -231,6 +231,121 @@ elif test "$OPENSSL" = "/usr/local/ssl/bin/openssl"; then
231fi 231fi
232AC_ARG_WITH(openssl,--with-openssl=<dir> sets path to openssl installation,[OPENSSL=$withval]) 232AC_ARG_WITH(openssl,--with-openssl=<dir> sets path to openssl installation,[OPENSSL=$withval])
233 233
234dnl #########################################################################
235dnl Check if Posix getaddrinfo() is available. It is also possible to use
236dnl the version from the lwres library distributed with BIND.
237dnl #########################################################################
238AC_ARG_ENABLE([emulate-getaddrinfo],
239 ACX_HELP_STRING([--enable-emulate-getaddrinfo],
240 [enable getaddrinfo emulation (default=no)]),
241 ,
242 enable_emulate_getaddrinfo=no)
243AC_ARG_WITH(lwres,
244 ACX_HELP_STRING([--with-lwres=DIR],
245 [use lwres library for getaddrinfo (default=no)]),
246 ,
247 with_lwres=no)
248
249dnl ## enable force to test getaddrinfo.c
250if test x$enable_emulate_getaddrinfo = xforce ; then
251 enable_emulate_getaddrinfo=yes
252 have_getaddrinfo=no
253else
254
255have_getaddrinfo=no
256if test x$with_lwres != xno ; then
257 if test "$with_lwres" != yes ; then
258 CPPFLAGS="-I${with_lwres}/include $CPPFLAGS"
259 LDFLAGS="-L${with_lwres}/lib $LDFLAGS"
260 fi
261 AC_CHECK_HEADERS(lwres/netdb.h, ,
262 [AC_MSG_ERROR([cannot find <lwres/netdb.h>])])
263 AC_CHECK_LIB(lwres, lwres_getaddrinfo, ,
264 [AC_MSG_ERROR([cannot find the lwres library])],
265 -lnsl -lpthread)
266 have_getaddrinfo=yes
267fi
268
269if test x$have_getaddrinfo != xyes ; then
270 AC_SEARCH_LIBS(getaddrinfo, socket resolv bind nsl c_r cr, have_getaddrinfo=yes)
271fi
272
273dnl # Special nonsense for systems that actually have getaddrinfo but
274dnl # redefine the name to something else, e.g. OSF
275if test x$have_getaddrinfo != xyes ; then
276 AC_MSG_CHECKING(if getaddrinfo is redefined in netdb.h)
277 AC_TRY_LINK([
278# include <netdb.h>
279 ], [
280 struct addrinfo hints, *res;
281 int err;
282
283 err = getaddrinfo ("host", "service", &hints, &res);
284 ], [
285 have_getaddrinfo=yes
286 AC_MSG_RESULT(yes)
287 ], [AC_MSG_RESULT(no)])
288fi
289
290fi
291
292if test x$have_getaddrinfo != xno ; then
293 if test x$enable_emulate_getaddrinfo != xno ; then
294 AC_MSG_ERROR([getaddrinfo found but emulate-getaddrinfo was enabled])
295 fi
296 AC_DEFINE(HAVE_GETADDRINFO, 1,
297 [Does system provide RFC 2553/Posix getaddrinfo?])
298else
299 if test x$enable_emulate_getaddrinfo != xyes ; then
300 AC_MSG_ERROR([getaddrinfo not found: try --with-lwres or --enable-emulate-getaddrinfo])
301 fi
302 LIBOBJS="$LIBOBJS getaddrinfo.o"
303fi
304
305if test x"$enable_emulate_getaddrinfo" != xno ; then
306 have_resolver=no
307
308 dnl Try for getipnodebyname
309 AC_SEARCH_LIBS(getipnodebyname, resolv bind nsl c_r cr, have_resolver=yes)
310 if test x"$have_resolver" != xno ; then
311 AC_DEFINE(HAVE_GETIPNODEBYNAME, 1,
312 [Set when getipnodebyname is available])
313 fi
314
315 dnl Try for gethostbyname_r
316 if test x"$have_resolver" = xno ; then
317 AC_SEARCH_LIBS(gethostbyname_r, resolv bind nsl c_r cr,
318 [have_resolver=yes
319 ACX_WHICH_GETHOSTBYNAME_R])
320 fi
321
322 dnl Try for gethostbyname
323 if test x"$have_resolver" = xno ; then
324 if test x"$enable_pthreads" != xno ; then
325 AC_MSG_WARN([using threads but cannot find gethostbyname_r or getipnodebyname])
326 fi
327 AC_SEARCH_LIBS(gethostbyname, resolv bind nsl, ,
328 [AC_MSG_ERROR([cannot find gethostbyname])])
329 fi
330 LIBOBJS="$LIBOBJS gethostbyname.o"
331
332 AC_CACHE_CHECK([for IPv6 support], acx_cv_sys_use_ipv6, [
333 AC_TRY_COMPILE([
334# include <netinet/in.h>
335 ], [
336 struct sockaddr_in6 sin6;
337 void *p;
338
339 sin6.sin6_family = AF_INET6;
340 sin6.sin6_port = 587;
341 p = &sin6.sin6_addr;
342 ], [acx_cv_sys_use_ipv6=yes], [acx_cv_sys_use_ipv6=no])
343 ])
344 if test x"$acx_cv_sys_use_ipv6" != xno ; then
345 AC_DEFINE(USE_IPV6,1,[Enable IPv6 support])
346 fi
347fi
348
234AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no) 349AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no)
235if test "$FOUNDINCLUDE" = "no"; then 350if test "$FOUNDINCLUDE" = "no"; then
236 _SAVEDCPPFLAGS="$CPPFLAGS" 351 _SAVEDCPPFLAGS="$CPPFLAGS"