[Nagiosplug-checkins] CVS: nagiosplug acinclude.m4,1.3,1.4 configure.in,1.47,1.48

Jeremy T. Bouse undrgrid at users.sourceforge.net
Wed Mar 5 22:41:17 CET 2003


Update of /cvsroot/nagiosplug/nagiosplug
In directory sc8-pr-cvs1:/tmp/cvs-serv20616

Modified Files:
	acinclude.m4 configure.in 
Log Message:
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 !!!


Index: acinclude.m4
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/acinclude.m4,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** acinclude.m4	16 Oct 2002 22:17:00 -0000	1.3
--- acinclude.m4	6 Mar 2003 06:40:45 -0000	1.4
***************
*** 0 ****
--- 1,78 ----
+ dnl @synopsis ACX_WHICH_GETHOSTBYNAME_R
+ dnl
+ dnl Provides a test to determine the correct way to call gethostbyname_r
+ dnl
+ dnl defines HAVE_GETHOSTBYNAME_R to the number of arguments required
+ dnl
+ dnl e.g. 6 arguments (linux)
+ dnl e.g. 5 arguments (solaris)
+ dnl e.g. 3 arguments (osf/1)
+ dnl
+ dnl @version $Id$
+ dnl @author Brian Stafford <brian at stafford.uklinux.net>
+ dnl
+ dnl based on version by Caolan McNamara <caolan at skynet.ie>
+ dnl based on David Arnold's autoconf suggestion in the threads faq
+ dnl
+ AC_DEFUN(ACX_WHICH_GETHOSTBYNAME_R,
+ [AC_CACHE_CHECK(number of arguments to gethostbyname_r,
+                 acx_which_gethostbyname_r, [
+         AC_TRY_COMPILE([
+ #               include <netdb.h> 
+         ],      [
+ 
+         char *name;
+         struct hostent *he;
+         struct hostent_data data;
+         (void) gethostbyname_r(name, he, &data);
+ 
+                 ],acx_which_gethostbyname_r=3, 
+                         [
+ dnl                     acx_which_gethostbyname_r=0
+   AC_TRY_COMPILE([
+ #   include <netdb.h>
+   ], [
+         char *name;
+         struct hostent *he, *res;
+         char *buffer = NULL;
+         int buflen = 2048;
+         int h_errnop;
+         (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
+   ],acx_which_gethostbyname_r=6,
+   
+   [
+ dnl  acx_which_gethostbyname_r=0
+   AC_TRY_COMPILE([
+ #   include <netdb.h>
+   ], [
+                         char *name;
+                         struct hostent *he;
+                         char *buffer = NULL;
+                         int buflen = 2048;
+                         int h_errnop;
+                         (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
+   ],acx_which_gethostbyname_r=5,acx_which_gethostbyname_r=0)
+ 
+   ]
+   
+   )
+                         ]
+                 )
+         ])
+ 
+ if test $acx_which_gethostbyname_r -gt 0 ; then
+     AC_DEFINE_UNQUOTED([HAVE_GETHOSTBYNAME_R], $acx_which_gethostbyname_r,
+                        [Number of parameters to gethostbyname_r or 0 if not available])
+ fi
+ 
+ ])
+ 
+ dnl @synopsis ACX_HELP_STRING(OPTION,DESCRIPTION)
+ AC_DEFUN([ACX_HELP_STRING],
+          [  $1 builtin([substr],[                       ],len($1))[$2]])
+ 
+ 
+ dnl @synopsis ACX_FEATURE(ENABLE_OR_WITH,NAME[,VALUE])
+ AC_DEFUN([ACX_FEATURE],
+          [echo "builtin([substr],[                                  ],len(--$1-$2))--$1-$2: ifelse($3,,[$]translit($1-$2,-,_),$3)"])
+ 

Index: configure.in
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/configure.in,v
retrieving revision 1.47
retrieving revision 1.48
diff -C2 -r1.47 -r1.48
*** configure.in	2 Mar 2003 04:58:12 -0000	1.47
--- configure.in	6 Mar 2003 06:40:46 -0000	1.48
***************
*** 232,235 ****
--- 232,350 ----
  AC_ARG_WITH(openssl,--with-openssl=<dir> sets path to openssl installation,[OPENSSL=$withval])
  
+ dnl #########################################################################
+ dnl Check if Posix getaddrinfo() is available.  It is also possible to use
+ dnl the version from the lwres library distributed with BIND.
+ dnl #########################################################################
+ AC_ARG_ENABLE([emulate-getaddrinfo],
+               ACX_HELP_STRING([--enable-emulate-getaddrinfo],
+                              [enable getaddrinfo emulation (default=no)]),
+               ,
+               enable_emulate_getaddrinfo=no)
+ AC_ARG_WITH(lwres,
+             ACX_HELP_STRING([--with-lwres=DIR],
+                            [use lwres library for getaddrinfo (default=no)]),
+             ,
+             with_lwres=no)
+ 
+ dnl ## enable force to test getaddrinfo.c
+ if test x$enable_emulate_getaddrinfo = xforce ; then
+         enable_emulate_getaddrinfo=yes
+         have_getaddrinfo=no
+ else
+ 
+ have_getaddrinfo=no
+ if test x$with_lwres != xno ; then
+         if test "$with_lwres" != yes ; then
+                    CPPFLAGS="-I${with_lwres}/include $CPPFLAGS"
+                    LDFLAGS="-L${with_lwres}/lib $LDFLAGS"
+         fi
+         AC_CHECK_HEADERS(lwres/netdb.h, ,
+                         [AC_MSG_ERROR([cannot find <lwres/netdb.h>])])
+         AC_CHECK_LIB(lwres, lwres_getaddrinfo, ,
+                      [AC_MSG_ERROR([cannot find the lwres library])],
+                      -lnsl -lpthread)
+         have_getaddrinfo=yes
+ fi
+ 
+ if test x$have_getaddrinfo != xyes ; then
+         AC_SEARCH_LIBS(getaddrinfo, socket resolv bind nsl c_r cr, have_getaddrinfo=yes)
+ fi
+ 
+ dnl # Special nonsense for systems that actually have getaddrinfo but
+ dnl # redefine the name to something else, e.g. OSF
+ if test x$have_getaddrinfo != xyes ; then
+         AC_MSG_CHECKING(if getaddrinfo is redefined in netdb.h)
+         AC_TRY_LINK([
+ #               include <netdb.h>
+         ], [
+                 struct addrinfo hints, *res;
+                 int err;
+ 
+                 err = getaddrinfo ("host", "service", &hints, &res);
+         ], [
+                 have_getaddrinfo=yes
+                 AC_MSG_RESULT(yes)
+         ], [AC_MSG_RESULT(no)])
+ fi
+ 
+ fi
+ 
+ if test x$have_getaddrinfo != xno ; then
+         if test x$enable_emulate_getaddrinfo != xno ; then
+                 AC_MSG_ERROR([getaddrinfo found but emulate-getaddrinfo was enabled])
+         fi
+         AC_DEFINE(HAVE_GETADDRINFO, 1,
+                   [Does system provide RFC 2553/Posix getaddrinfo?])
+ else
+         if test x$enable_emulate_getaddrinfo != xyes ; then
+                 AC_MSG_ERROR([getaddrinfo not found: try --with-lwres or --enable-emulate-getaddrinfo])
+         fi
+         LIBOBJS="$LIBOBJS getaddrinfo.o"
+ fi
+ 
+ if test x"$enable_emulate_getaddrinfo" != xno ; then
+     have_resolver=no
+ 
+   dnl  Try for getipnodebyname
+     AC_SEARCH_LIBS(getipnodebyname, resolv bind nsl c_r cr, have_resolver=yes)
+     if test x"$have_resolver" != xno ; then
+          AC_DEFINE(HAVE_GETIPNODEBYNAME, 1,
+                    [Set when getipnodebyname is available])
+     fi
+ 
+   dnl  Try for gethostbyname_r
+     if test x"$have_resolver" = xno ; then
+         AC_SEARCH_LIBS(gethostbyname_r, resolv bind nsl c_r cr,
+                        [have_resolver=yes
+                         ACX_WHICH_GETHOSTBYNAME_R])
+     fi
+ 
+   dnl  Try for gethostbyname
+     if test x"$have_resolver" = xno ; then
+         if test x"$enable_pthreads" != xno ; then
+             AC_MSG_WARN([using threads but cannot find gethostbyname_r or getipnodebyname])
+         fi
+         AC_SEARCH_LIBS(gethostbyname, resolv bind nsl, ,
+                        [AC_MSG_ERROR([cannot find gethostbyname])])
+     fi
+     LIBOBJS="$LIBOBJS gethostbyname.o"
+ 
+     AC_CACHE_CHECK([for IPv6 support], acx_cv_sys_use_ipv6, [
+             AC_TRY_COMPILE([
+ #               include <netinet/in.h>
+             ], [
+                 struct sockaddr_in6 sin6;
+                 void *p;
+ 
+                 sin6.sin6_family = AF_INET6;
+                 sin6.sin6_port = 587;
+                 p = &sin6.sin6_addr;
+             ], [acx_cv_sys_use_ipv6=yes], [acx_cv_sys_use_ipv6=no])
+     ])
+     if test x"$acx_cv_sys_use_ipv6" != xno ; then
+             AC_DEFINE(USE_IPV6,1,[Enable IPv6 support])
+     fi
+ fi
+ 
  AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no)
  if test "$FOUNDINCLUDE" = "no"; then





More information about the Commits mailing list