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