git-notify: Ignore "empty" commits
[monitoring-plugins.git] / acinclude.m4
blobacee3e17c3df6f714894b9b7866ae48c06b224a4
1 dnl @synopsis ACX_WHICH_GETHOSTBYNAME_R
2 dnl
3 dnl Provides a test to determine the correct way to call gethostbyname_r
4 dnl
5 dnl defines HAVE_GETHOSTBYNAME_R to the number of arguments required
6 dnl
7 dnl e.g. 6 arguments (linux)
8 dnl e.g. 5 arguments (solaris)
9 dnl e.g. 3 arguments (osf/1)
10 dnl
11 dnl @author Brian Stafford <brian@stafford.uklinux.net>
12 dnl
13 dnl based on version by Caolan McNamara <caolan@skynet.ie>
14 dnl based on David Arnold's autoconf suggestion in the threads faq
15 dnl
16 AC_DEFUN([ACX_WHICH_GETHOSTBYNAME_R],
17 [AC_CACHE_CHECK(number of arguments to gethostbyname_r,
18                 acx_which_gethostbyname_r, [
19         AC_TRY_COMPILE([
20 #               include <netdb.h> 
21         ],      [
23         char *name;
24         struct hostent *he;
25         struct hostent_data data;
26         (void) gethostbyname_r(name, he, &data);
28                 ],acx_which_gethostbyname_r=3, 
29                         [
30 dnl                     acx_which_gethostbyname_r=0
31   AC_TRY_COMPILE([
32 #   include <netdb.h>
33   ], [
34         char *name;
35         struct hostent *he, *res;
36         char *buffer = NULL;
37         int buflen = 2048;
38         int h_errnop;
39         (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
40   ],acx_which_gethostbyname_r=6,
41   
42   [
43 dnl  acx_which_gethostbyname_r=0
44   AC_TRY_COMPILE([
45 #   include <netdb.h>
46   ], [
47                         char *name;
48                         struct hostent *he;
49                         char *buffer = NULL;
50                         int buflen = 2048;
51                         int h_errnop;
52                         (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
53   ],acx_which_gethostbyname_r=5,acx_which_gethostbyname_r=0)
55   ]
56   
57   )
58                         ]
59                 )
60         ])
62 if test $acx_which_gethostbyname_r -gt 0 ; then
63     AC_DEFINE_UNQUOTED([HAVE_GETHOSTBYNAME_R], $acx_which_gethostbyname_r,
64                        [Number of parameters to gethostbyname_r or 0 if not available])
69 dnl @synopsis ACX_HELP_STRING(OPTION,DESCRIPTION)
70 AC_DEFUN([ACX_HELP_STRING],
71          [  $1 builtin([substr],[                       ],len($1))[$2]])
74 dnl @synopsis ACX_FEATURE(ENABLE_OR_WITH,NAME[,VALUE])
75 AC_DEFUN([ACX_FEATURE],
76          [echo "builtin([substr],[                                  ],len(--$1-$2))--$1-$2: ifelse($3,,[$]translit($1-$2,-,_),$3)"])