~ubuntu-branches/ubuntu/hardy/autoconf-archive/hardy

« back to all changes in this revision

Viewing changes to m4source/ac_caolan_func_which_gethostbyname_r.m4

  • Committer: Bazaar Package Importer
  • Author(s): Martin A. Godisch
  • Date: 2004-06-26 09:43:57 UTC
  • Revision ID: james.westby@ubuntu.com-20040626094357-3be3jwcz1vcdhpe8
Tags: upstream-20040616
ImportĀ upstreamĀ versionĀ 20040616

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl Available from the GNU Autoconf Macro Archive at:
 
2
dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_caolan_func_which_gethostbyname_r.html
 
3
dnl
 
4
AC_DEFUN([AC_caolan_FUNC_WHICH_GETHOSTBYNAME_R],
 
5
[AC_CACHE_CHECK(for which type of gethostbyname_r, ac_cv_func_which_gethostname_r, [
 
6
AC_CHECK_FUNC(gethostbyname_r, [
 
7
        AC_TRY_COMPILE([
 
8
#               include <netdb.h>
 
9
        ],      [
 
10
 
 
11
        char *name;
 
12
        struct hostent *he;
 
13
        struct hostent_data data;
 
14
        (void) gethostbyname_r(name, he, &data);
 
15
 
 
16
                ],ac_cv_func_which_gethostname_r=three,
 
17
                        [
 
18
dnl                     ac_cv_func_which_gethostname_r=no
 
19
  AC_TRY_COMPILE([
 
20
#   include <netdb.h>
 
21
  ], [
 
22
        char *name;
 
23
        struct hostent *he, *res;
 
24
        char buffer[2048];
 
25
        int buflen = 2048;
 
26
        int h_errnop;
 
27
        (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
 
28
  ],ac_cv_func_which_gethostname_r=six,
 
29
 
 
30
  [
 
31
dnl  ac_cv_func_which_gethostname_r=no
 
32
  AC_TRY_COMPILE([
 
33
#   include <netdb.h>
 
34
  ], [
 
35
                        char *name;
 
36
                        struct hostent *he;
 
37
                        char buffer[2048];
 
38
                        int buflen = 2048;
 
39
                        int h_errnop;
 
40
                        (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
 
41
  ],ac_cv_func_which_gethostname_r=five,ac_cv_func_which_gethostname_r=no)
 
42
 
 
43
  ]
 
44
 
 
45
  )
 
46
                        ]
 
47
                )]
 
48
        ,ac_cv_func_which_gethostname_r=no)])
 
49
 
 
50
if test $ac_cv_func_which_gethostname_r = six; then
 
51
  AC_DEFINE(HAVE_FUNC_GETHOSTBYNAME_R_6)
 
52
elif test $ac_cv_func_which_gethostname_r = five; then
 
53
  AC_DEFINE(HAVE_FUNC_GETHOSTBYNAME_R_5)
 
54
elif test $ac_cv_func_which_gethostname_r = three; then
 
55
  AC_DEFINE(HAVE_FUNC_GETHOSTBYNAME_R_3)
 
56
 
 
57
fi
 
58
 
 
59
])