OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [classpath/] [m4/] [ax_func_which_gethostbyname_r.m4] - Blame information for rev 777

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 773 jeremybenn
# m4/ax_func_which_gethostbyname_r.m4
2
 
3
# Copyright © 2005 Caolan McNamara <caolan@skynet.ie>
4
# Copyright © 2005 Daniel Richard G. <skunk@iskunk.org>
5
 
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 2 of the License, or
9
# (at your option) any later version.
10
 
11
# This program is distributed in the hope that it will be useful, but
12
# WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
# General Public License for more details.
15
 
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19
# 02111-1307, USA.
20
 
21
# As a special exception, the respective Autoconf Macro's copyright
22
# owner gives unlimited permission to copy, distribute and modify the
23
# configure scripts that are the output of Autoconf when processing
24
# the Macro. You need not follow the terms of the GNU General Public
25
# License when using or distributing such scripts, even though
26
# portions of the text of the Macro appear in them. The GNU General
27
# Public License (GPL) does govern all other use of the material that
28
# constitutes the Autoconf Macro.
29
 
30
# This special exception to the GPL applies to versions of the
31
# Autoconf Macro released by the Autoconf Macro Archive. When you make
32
# and distribute a modified version of the Autoconf Macro, you may
33
# extend this special exception to the GPL to apply to your modified
34
# version as well.
35
 
36
 
37
AC_DEFUN([AX_FUNC_WHICH_GETHOSTBYNAME_R], [
38
 
39
    AC_LANG_PUSH(C)
40
    AC_MSG_CHECKING([how many arguments gethostbyname_r() takes])
41
 
42
    AC_CACHE_VAL(ac_cv_func_which_gethostbyname_r, [
43
 
44
################################################################
45
 
46
ac_cv_func_which_gethostbyname_r=unknown
47
 
48
#
49
# ONE ARGUMENT (sanity check)
50
#
51
 
52
# This should fail, as there is no variant of gethostbyname_r() that takes
53
# a single argument. If it actually compiles, then we can assume that
54
# netdb.h is not declaring the function, and the compiler is thereby
55
# assuming an implicit prototype. In which case, we're out of luck.
56
#
57
AC_COMPILE_IFELSE(
58
    AC_LANG_PROGRAM(
59
        [[#include <netdb.h>]],
60
        [[
61
            char *name = "www.gnu.org";
62
            (void)gethostbyname_r(name) /* ; */
63
        ]]),
64
    ac_cv_func_which_gethostbyname_r=no)
65
 
66
#
67
# SIX ARGUMENTS
68
# (e.g. Linux)
69
#
70
 
71
if test "$ac_cv_func_which_gethostbyname_r" = "unknown"; then
72
 
73
AC_COMPILE_IFELSE(
74
    AC_LANG_PROGRAM(
75
        [[#include <netdb.h>]],
76
        [[
77
            char *name = "www.gnu.org";
78
            struct hostent ret, *retp;
79
            char buf@<:@1024@:>@;
80
            int buflen = 1024;
81
            int my_h_errno;
82
            (void)gethostbyname_r(name, &ret, buf, buflen, &retp, &my_h_errno) /* ; */
83
        ]]),
84
    ac_cv_func_which_gethostbyname_r=six)
85
 
86
fi
87
 
88
#
89
# FIVE ARGUMENTS
90
# (e.g. Solaris)
91
#
92
 
93
if test "$ac_cv_func_which_gethostbyname_r" = "unknown"; then
94
 
95
AC_COMPILE_IFELSE(
96
    AC_LANG_PROGRAM(
97
        [[#include <netdb.h>]],
98
        [[
99
            char *name = "www.gnu.org";
100
            struct hostent ret;
101
            char buf@<:@1024@:>@;
102
            int buflen = 1024;
103
            int my_h_errno;
104
            (void)gethostbyname_r(name, &ret, buf, buflen, &my_h_errno) /* ; */
105
        ]]),
106
    ac_cv_func_which_gethostbyname_r=five)
107
 
108
fi
109
 
110
#
111
# THREE ARGUMENTS
112
# (e.g. AIX, HP-UX, Tru64)
113
#
114
 
115
if test "$ac_cv_func_which_gethostbyname_r" = "unknown"; then
116
 
117
AC_COMPILE_IFELSE(
118
    AC_LANG_PROGRAM(
119
        [[#include <netdb.h>]],
120
        [[
121
            char *name = "www.gnu.org";
122
            struct hostent ret;
123
            struct hostent_data data;
124
            (void)gethostbyname_r(name, &ret, &data) /* ; */
125
        ]]),
126
    ac_cv_func_which_gethostbyname_r=three)
127
 
128
fi
129
 
130
################################################################
131
 
132
]) dnl end AC_CACHE_VAL
133
 
134
case "$ac_cv_func_which_gethostbyname_r" in
135
    three)
136
    AC_MSG_RESULT([three])
137
    AC_DEFINE([HAVE_FUNC_GETHOSTBYNAME_R_3], 1, [three-argument gethostbyname_r])
138
    ;;
139
 
140
    five)
141
    AC_MSG_RESULT([five])
142
    AC_DEFINE([HAVE_FUNC_GETHOSTBYNAME_R_5], 1, [five-argument gethostbyname_r])
143
    ;;
144
 
145
    six)
146
    AC_MSG_RESULT([six])
147
    AC_DEFINE([HAVE_FUNC_GETHOSTBYNAME_R_6], 1, [six-argument gethostbyname_r])
148
    ;;
149
 
150
    no)
151
    AC_MSG_RESULT([cannot find function declaration in netdb.h])
152
    ;;
153
 
154
    unknown)
155
    AC_MSG_RESULT([can't tell])
156
    ;;
157
 
158
    *)
159
    AC_MSG_ERROR([internal error])
160
    ;;
161
esac
162
 
163
AC_LANG_POP(C)
164
 
165
]) dnl end AC_DEFUN

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.