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