From 71eefcd38e76a7e57e1430c45324816de6bde9f0 Mon Sep 17 00:00:00 2001 From: Ton Voon Date: Thu, 23 Dec 2004 09:30:55 +0000 Subject: Another attempt at fixing check_http compile on Redhat EL3. Fixed check_icmp compile (Lynne Lawrence - 1087171) - still some code changes to check_icmp outstanding. Fixed compile of check_dhcp (complaining about socklen_t). Added acknowledgements for Coreutils and curl git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1054 f882894a-f735-0410-b71e-b25c423dba1c diff --git a/ACKNOWLEDGEMENTS b/ACKNOWLEDGEMENTS index a070a54..7eea869 100644 --- a/ACKNOWLEDGEMENTS +++ b/ACKNOWLEDGEMENTS @@ -17,5 +17,13 @@ Kompf, Martin 200-2003 Copyright the author http://cplus.kompf.de/macaddr.html Using the DLPI support on SysV systems to get the host MAC address in check_dhcp.c - +Stenberg, Daniel +Copyright (c) 1996 - 2004, Daniel Stenberg, +http://curl.haxx.se/ +Use of duplication of macros in m4/np_curl.m4 + +Coreutils team +Copyright (C) 91, 1995-2004 Free Software Foundation, Inc. +http://www.gnu.org/software/coreutils/ +Use of macros and lib files in m4/np_coreutils.m4 and lib/ diff --git a/configure.in b/configure.in index 0cced59..30e4261 100644 --- a/configure.in +++ b/configure.in @@ -255,87 +255,6 @@ fi CPPFLAGS="$_SAVEDCPPFLAGS $MYSQLINCLUDE" LIBS="$_SAVEDLIBS" -dnl Check for OpenSSL location -AC_PATH_PROG(OPENSSL,openssl) -if test "$OPENSSL" = "/usr/bin/openssl"; then - OPENSSL=/usr -elif test "$OPENSSL" = "/usr/sbin/openssl"; then - OPENSSL=/usr -elif test "$OPENSSL" = "/opt/bin/openssl"; then - OPENSSL=/opt -elif test "$OPENSSL" = "/opt/openssl/bin/openssl"; then - OPENSSL=/opt/openssl -elif test "$OPENSSL" = "/usr/slocal/bin/openssl"; then - OPENSSL=/usr/slocal -elif test "$OPENSSL" = "/usr/local/bin/openssl"; then - OPENSSL=/usr/local -elif test "$OPENSSL" = "/usr/local/ssl/bin/openssl"; then - OPENSSL=/usr/local/ssl -fi -AC_ARG_WITH(openssl, -AC_HELP_STRING([--with-openssl=DIR], [sets path to openssl installation]) -AC_HELP_STRING([--without-openssl], [disable openssl]), -OPENSSL=$withval) - -if test X"$OPENSSL" = "Xno"; then - AC_MSG_WARN([openssl disabled, you will not be able to use ssl options in some plugins]) - FOUNDSSL="dontbother" -else - dnl Check for OpenSSL header files - unset FOUNDINCLUDE - _SAVEDCPPFLAGS="$CPPFLAGS" - if test "$OPENSSL" != "/usr"; then - CPPFLAGS="$CPPFLAGS -I$OPENSSL/include" - fi - AC_CHECK_HEADERS(openssl/ssl.h openssl/x509.h openssl/rsa.h openssl/pem.h openssl/crypto.h openssl/err.h, - SSLINCLUDE="-I$OPENSSL/include" - FOUNDINCLUDE=yes, - FOUNDINCLUDE=no) - if test "$FOUNDINCLUDE" = "no"; then - AC_CHECK_HEADERS(ssl.h x509.h rsa.h pem.h crypto.h err.h, - SSLINCLUDE="-I$OPENSSL/include" - FOUNDINCLUDE=yes, - FOUNDINCLUDE=no) - fi - AC_SUBST(SSLINCLUDE) - if test "$FOUNDINCLUDE" = "no"; then - CPPFLAGS="$_SAVEDCPPFLAGS" - fi - - dnl Check for crypto lib - _SAVEDLIBS="$LIBS" - AC_CHECK_LIB(crypto,CRYPTO_lock,,,-L$OPENSSL/lib) - if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then - dnl Check for SSL lib - AC_CHECK_LIB(ssl,main,LDFLAGS="$LDFLAGS -L$OPENSSL/lib" SSLLIBS="-lssl -lcrypto",AC_CHECK_LIB(ssl,main,LDFLAGS="$LDFLAGS -L$OPENSSL/lib" SSLLIBS="-lssl -lcrypto"),-L$OPENSSL/lib -lcrypto) - fi - LIBS="$_SAVEDLIBS" - - FOUNDSSL="no" - dnl test headers and libs to decide whether check_http should use SSL - if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then - if test "$ac_cv_lib_ssl_main" = "yes"; then - if test "$FOUNDINCLUDE" = "yes"; then - FOUNDSSL="yes" - fi - fi - fi -fi - -if test "$FOUNDSSL" = "yes"; then - check_tcp_ssl="check_simap check_spop check_jabber check_nntps" - AC_SUBST(check_tcp_ssl) - AC_SUBST(SSLLIBS) - AC_DEFINE(HAVE_SSL,1,[Define if SSL libraries are found]) - with_openssl="yes" -elif test "$FOUNDSSL" = "no"; then - AC_MSG_WARN([OpenSSL libs could not be found]) - with_openssl="no" -else - with_openssl="no" -fi -CPPFLAGS="$_SAVEDCPPFLAGS" - AC_CHECK_HEADERS(unistd.h) dnl Check for AF_INET6 support - unistd.h required for Darwin @@ -462,6 +381,7 @@ if test x"$enable_emulate_getaddrinfo" != xno ; then fi +dnl Checks for Kerberos. Must come before openssl checks for Redhat EL 3 AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no) if test "$FOUNDINCLUDE" = "no"; then _SAVEDCPPFLAGS="$CPPFLAGS" @@ -477,6 +397,87 @@ if test "$FOUNDINCLUDE" = "no"; then CPPFLAGS="$_SAVEDCPPFLAGS" fi +dnl Check for OpenSSL location +AC_PATH_PROG(OPENSSL,openssl) +if test "$OPENSSL" = "/usr/bin/openssl"; then + OPENSSL=/usr +elif test "$OPENSSL" = "/usr/sbin/openssl"; then + OPENSSL=/usr +elif test "$OPENSSL" = "/opt/bin/openssl"; then + OPENSSL=/opt +elif test "$OPENSSL" = "/opt/openssl/bin/openssl"; then + OPENSSL=/opt/openssl +elif test "$OPENSSL" = "/usr/slocal/bin/openssl"; then + OPENSSL=/usr/slocal +elif test "$OPENSSL" = "/usr/local/bin/openssl"; then + OPENSSL=/usr/local +elif test "$OPENSSL" = "/usr/local/ssl/bin/openssl"; then + OPENSSL=/usr/local/ssl +fi +AC_ARG_WITH(openssl, +AC_HELP_STRING([--with-openssl=DIR], [sets path to openssl installation]) +AC_HELP_STRING([--without-openssl], [disable openssl]), +OPENSSL=$withval) + +if test X"$OPENSSL" = "Xno"; then + AC_MSG_WARN([openssl disabled, you will not be able to use ssl options in some plugins]) + FOUNDSSL="dontbother" +else + dnl Check for OpenSSL header files + unset FOUNDINCLUDE + _SAVEDCPPFLAGS="$CPPFLAGS" + if test "$OPENSSL" != "/usr"; then + CPPFLAGS="$CPPFLAGS -I$OPENSSL/include" + fi + AC_CHECK_HEADERS(openssl/ssl.h openssl/x509.h openssl/rsa.h openssl/pem.h openssl/crypto.h openssl/err.h, + SSLINCLUDE="-I$OPENSSL/include" + FOUNDINCLUDE=yes, + FOUNDINCLUDE=no) + if test "$FOUNDINCLUDE" = "no"; then + AC_CHECK_HEADERS(ssl.h x509.h rsa.h pem.h crypto.h err.h, + SSLINCLUDE="-I$OPENSSL/include" + FOUNDINCLUDE=yes, + FOUNDINCLUDE=no) + fi + AC_SUBST(SSLINCLUDE) + if test "$FOUNDINCLUDE" = "no"; then + CPPFLAGS="$_SAVEDCPPFLAGS" + fi + + dnl Check for crypto lib + _SAVEDLIBS="$LIBS" + AC_CHECK_LIB(crypto,CRYPTO_lock,,,-L$OPENSSL/lib) + if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then + dnl Check for SSL lib + AC_CHECK_LIB(ssl,main,LDFLAGS="$LDFLAGS -L$OPENSSL/lib" SSLLIBS="-lssl -lcrypto",AC_CHECK_LIB(ssl,main,LDFLAGS="$LDFLAGS -L$OPENSSL/lib" SSLLIBS="-lssl -lcrypto"),-L$OPENSSL/lib -lcrypto) + fi + LIBS="$_SAVEDLIBS" + + FOUNDSSL="no" + dnl test headers and libs to decide whether check_http should use SSL + if test "$ac_cv_lib_crypto_CRYPTO_lock" = "yes"; then + if test "$ac_cv_lib_ssl_main" = "yes"; then + if test "$FOUNDINCLUDE" = "yes"; then + FOUNDSSL="yes" + fi + fi + fi +fi + +if test "$FOUNDSSL" = "yes"; then + check_tcp_ssl="check_simap check_spop check_jabber check_nntps" + AC_SUBST(check_tcp_ssl) + AC_SUBST(SSLLIBS) + AC_DEFINE(HAVE_SSL,1,[Define if SSL libraries are found]) + with_openssl="yes" +elif test "$FOUNDSSL" = "no"; then + AC_MSG_WARN([OpenSSL libs could not be found]) + with_openssl="no" +else + with_openssl="no" +fi +CPPFLAGS="$_SAVEDCPPFLAGS" + dnl dnl Checks for header files. dnl @@ -1455,8 +1456,9 @@ AC_SUBST(DEPLIBS) AM_GNU_GETTEXT([no-libtool], [need-ngettext]) AM_GNU_GETTEXT_VERSION(0.11.5) -dnl External libraries +dnl External libraries - see ACKNOWLEDGEMENTS np_COREUTILS +np_CURL AC_OUTPUT( Makefile diff --git a/m4/np_curl.m4 b/m4/np_curl.m4 new file mode 100644 index 0000000..64c3db5 --- /dev/null +++ b/m4/np_curl.m4 @@ -0,0 +1,60 @@ +dnl These are for the libs and macros from curl +dnl Currently utilising v7.12.3 + +dnl We use jm_ for non Autoconf macros. +dnl m4_pattern_forbid([^np_[ABCDEFGHIJKLMNOPQRSTUVXYZ]])dnl +dnl m4_pattern_forbid([^jm_[ABCDEFGHIJKLMNOPQRSTUVXYZ]])dnl +dnl m4_pattern_forbid([^gl_[ABCDEFGHIJKLMNOPQRSTUVXYZ]])dnl + +dnl These are all m4 things that need to be called +dnl Usually in coreutils' prereq.m4, but this is a subset that we need +AC_DEFUN([np_CURL], +[ + AC_REQUIRE([TYPE_SOCKLEN_T]) +]) + +dnl Check for socklen_t: historically on BSD it is an int, and in +dnl POSIX 1g it is a type of its own, but some platforms use different +dnl types for the argument to getsockopt, getpeername, etc. So we +dnl have to test to find something that will work. +AC_DEFUN([TYPE_SOCKLEN_T], +[ + AC_CHECK_TYPE([socklen_t], ,[ + AC_MSG_CHECKING([for socklen_t equivalent]) + AC_CACHE_VAL([curl_cv_socklen_t_equiv], + [ + # Systems have either "struct sockaddr *" or + # "void *" as the second argument to getpeername + curl_cv_socklen_t_equiv= + for arg2 in "struct sockaddr" void; do + for t in int size_t unsigned long "unsigned long"; do + AC_TRY_COMPILE([ + #ifdef HAVE_SYS_TYPES_H + #include + #endif + #ifdef HAVE_SYS_SOCKET_H + #include + #endif + + int getpeername (int, $arg2 *, $t *); + ],[ + $t len; + getpeername(0,0,&len); + ],[ + curl_cv_socklen_t_equiv="$t" + break + ]) + done + done + + if test "x$curl_cv_socklen_t_equiv" = x; then + AC_MSG_ERROR([Cannot find a type to use in place of socklen_t]) + fi + ]) + AC_MSG_RESULT($curl_cv_socklen_t_equiv) + AC_DEFINE_UNQUOTED(socklen_t, $curl_cv_socklen_t_equiv, + [type to use in place of socklen_t if not defined])], + [#include +#include ]) +]) + diff --git a/plugins/Makefile.am b/plugins/Makefile.am index 7075201..538f905 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -53,6 +53,7 @@ check_fping_LDADD = $(NETLIBS) popen.o check_game_LDADD = $(BASEOBJS) popen.o check_http_LDADD = $(NETLIBS) $(SSLLIBS) check_hpjd_LDADD = $(NETLIBS) popen.o +check_icmp_LDADD = $(NETLIBS) check_ldap_LDADD = $(NETLIBS) $(LDAPLIBS) check_load_LDADD = $(BASEOBJS) popen.o check_mrtg_LDADD = $(BASEOBJS) -- cgit v0.10-9-g596f