]> git.saurik.com Git - wxWidgets.git/blob - build/aclocal/ac_raf_func_which_getservbyname_r.m4
wxAnimationCtrl cleanup
[wxWidgets.git] / build / aclocal / ac_raf_func_which_getservbyname_r.m4
1 dnl @synopsis AC_raf_FUNC_WHICH_GETSERVBYNAME_R
2 dnl
3 dnl Provides a test to determine the correct way to call
4 dnl getservbyname_r:
5 dnl
6 dnl - defines HAVE_FUNC_GETSERVBYNAME_R_6 if it needs 6 arguments (e.g linux)
7 dnl - defines HAVE_FUNC_GETSERVBYNAME_R_5 if it needs 5 arguments (e.g. solaris)
8 dnl - defines HAVE_FUNC_GETSERVBYNAME_R_4 if it needs 4 arguments (e.g. osf/1)
9 dnl
10 dnl An example use can be found at
11 dnl http://raf.org/autoconf/net_getservbyname.c
12 dnl
13 dnl Based on Caolan McNamara's gethostbyname_r macro. Based on David
14 dnl Arnold's autoconf suggestion in the threads faq.
15 dnl
16 dnl @category Misc
17 dnl @author raf <raf@raf.org>
18 dnl @version 2001-08-20
19 dnl @license GPLWithACException
20
21 AC_DEFUN([AC_raf_FUNC_WHICH_GETSERVBYNAME_R],
22 [
23 AC_CACHE_CHECK(how many arguments getservbyname_r() takes,
24 ac_cv_func_which_getservbyname_r,
25 [
26 AC_TRY_COMPILE([#include <netdb.h>],
27 [
28 char *name;
29 char *proto;
30 struct servent *se, *res;
31 char buffer[2048];
32 int buflen = 2048;
33 (void) getservbyname_r(name, proto, se, buffer, buflen, &res)
34 ],
35 ac_cv_func_which_getservbyname_r=six,
36 [
37 AC_TRY_COMPILE([#include <netdb.h>],
38 [
39 char *name;
40 char *proto;
41 struct servent *se;
42 char buffer[2048];
43 int buflen = 2048;
44 (void) getservbyname_r(name, proto, se, buffer, buflen)
45 ],
46 ac_cv_func_which_getservbyname_r=five,
47 [
48 AC_TRY_COMPILE([#include <netdb.h>],
49 [
50 char *name;
51 char *proto;
52 struct servent *se;
53 struct servent_data data;
54 (void) getservbyname_r(name, proto, se, &data);
55 ],
56 ac_cv_func_which_getservbyname_r=four,
57 ac_cv_func_which_getservbyname_r=no
58 )
59 ]
60 )
61 ]
62 )
63 ]
64 )
65
66 if test $ac_cv_func_which_getservbyname_r = six; then
67 AC_DEFINE(HAVE_FUNC_GETSERVBYNAME_R_6)
68 elif test $ac_cv_func_which_getservbyname_r = five; then
69 AC_DEFINE(HAVE_FUNC_GETSERVBYNAME_R_5)
70 elif test $ac_cv_func_which_getservbyname_r = four; then
71 AC_DEFINE(HAVE_FUNC_GETSERVBYNAME_R_4)
72 fi
73
74 ])