4
0
Эх сурвалжийг харах

A better way of checking for rfc931_timeout existance in libwrap

John C. Frickson 9 жил өмнө
parent
commit
17146671dd
4 өөрчлөгдсөн 22 нэмэгдсэн , 1 устгасан
  1. 18 0
      configure
  2. 2 0
      configure.ac
  3. 1 0
      include/config.h.in
  4. 1 1
      src/nrpe.c

+ 18 - 0
configure

@@ -7102,6 +7102,24 @@ if test "x$ac_cv_lib_wrap_main" = xyes; then :
 
 $as_echo "#define HAVE_LIBWRAP 1" >>confdefs.h
 
+	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <tcpd.h>
+
+int
+main ()
+{
+int a = rfc931_timeout;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  $as_echo "#define HAVE_RFC931_TIMEOUT 1" >>confdefs.h
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
 fi
 

+ 2 - 0
configure.ac

@@ -261,6 +261,8 @@ AC_CHECK_LIB(socket,socket,SOCKETLIBS="$SOCKETLIBS -lsocket")
 AC_CHECK_LIB(wrap,main,[
 	LIBWRAPLIBS="$LIBWRAPLIBS -lwrap"
 	AC_DEFINE(HAVE_LIBWRAP,[1],[Have the TCP wrappers library])
+	AC_TRY_LINK([#include <tcpd.h>
+		],[int a = rfc931_timeout;],AC_DEFINE(HAVE_RFC931_TIMEOUT))
 	])
 AC_CHECK_FUNCS(strdup strstr strtoul strtok_r initgroups closesocket sigaction)
 

+ 1 - 0
include/config.h.in

@@ -45,6 +45,7 @@
 #undef HAVE_INITGROUPS
 #undef HAVE_CLOSESOCKET
 #undef HAVE_SIGACTION
+#undef HAVE_RFC931_TIMEOUT
 
 #undef SIZEOF_INT
 #undef SIZEOF_SHORT

+ 1 - 1
src/nrpe.c

@@ -43,7 +43,7 @@ extern int asprintf(char **ptr, const char *format, ...);
 #ifdef HAVE_LIBWRAP
 int       allow_severity = LOG_INFO;
 int       deny_severity = LOG_WARNING;
-# ifdef __hpux
+# ifndef HAVE_RFC931_TIMEOUT
 int       rfc931_timeout=15;
 # endif
 #endif