summaryrefslogtreecommitdiffstats
path: root/acinclude.m4
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 11:48:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 11:48:22 +0000
commit7373ce3d6988706388f136e1c06afd20a3e8d5be (patch)
treee9ae5af7d102667e5706187646db45de8238e8c4 /acinclude.m4
parentInitial commit. (diff)
downloadmonitoring-plugins-7373ce3d6988706388f136e1c06afd20a3e8d5be.tar.xz
monitoring-plugins-7373ce3d6988706388f136e1c06afd20a3e8d5be.zip
Adding upstream version 2.3.5.upstream/2.3.5upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'acinclude.m4')
-rw-r--r--acinclude.m477
1 files changed, 77 insertions, 0 deletions
diff --git a/acinclude.m4 b/acinclude.m4
new file mode 100644
index 0000000..acee3e1
--- /dev/null
+++ b/acinclude.m4
@@ -0,0 +1,77 @@
+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 @author Brian Stafford <brian@stafford.uklinux.net>
+dnl
+dnl based on version by Caolan McNamara <caolan@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)"])
+