3481856c902035a47df65266582bceb3261a92d6
[elisp/starttls.git] / acinclude.m4
1 dnl @(#) $Header: /opt/backups/cvs.m17n.org/root/starttls/Attic/acinclude.m4,v 1.2 2002-01-22 08:33:12 ueno Exp $ (LBL)
2 dnl
3 dnl Copyright (c) 1995, 1996, 1997, 1998
4 dnl     The Regents of the University of California.  All rights reserved.
5 dnl
6 dnl Redistribution and use in source and binary forms, with or without
7 dnl modification, are permitted provided that: (1) source code distributions
8 dnl retain the above copyright notice and this paragraph in its entirety, (2)
9 dnl distributions including binary code include the above copyright notice and
10 dnl this paragraph in its entirety in the documentation or other materials
11 dnl provided with the distribution, and (3) all advertising materials mentioning
12 dnl features or use of this software display the following acknowledgement:
13 dnl ``This product includes software developed by the University of California,
14 dnl Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
15 dnl the University nor the names of its contributors may be used to endorse
16 dnl or promote products derived from this software without specific prior
17 dnl written permission.
18 dnl THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
19 dnl WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
20 dnl MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 dnl
22 dnl LBL autoconf macros
23 dnl
24
25 dnl Copyright (c) 1999 WIDE Project. All rights reserved.
26 dnl
27 dnl Redistribution and use in source and binary forms, with or without
28 dnl modification, are permitted provided that the following conditions
29 dnl are met:
30 dnl 1. Redistributions of source code must retain the above copyright
31 dnl    notice, this list of conditions and the following disclaimer.
32 dnl 2. Redistributions in binary form must reproduce the above copyright
33 dnl    notice, this list of conditions and the following disclaimer in the
34 dnl    documentation and/or other materials provided with the distribution.
35 dnl 3. Neither the name of the project nor the names of its contributors
36 dnl    may be used to endorse or promote products derived from this software
37 dnl    without specific prior written permission.
38 dnl 
39 dnl THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
40 dnl ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 dnl IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
42 dnl ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
43 dnl FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
44 dnl DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
45 dnl OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
46 dnl HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
47 dnl LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
48 dnl OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
49 dnl SUCH DAMAGE.
50
51 dnl
52 dnl Checks to see if AF_INET6 is defined
53 AC_DEFUN(AC_CHECK_AF_INET6, [
54         AC_MSG_CHECKING(for AF_INET6)
55         AC_CACHE_VAL($1,
56         AC_TRY_COMPILE([
57 #               include <sys/types.h>
58 #               include <sys/socket.h>],
59                 [int a = AF_INET6],
60                 $1=yes,
61                 $1=no))
62         AC_MSG_RESULT($$1)
63                 if test $$1 = yes ; then
64                         AC_DEFINE(HAVE_AF_INET6)
65         fi
66 ])
67
68 dnl
69 dnl Checks to see if the sockaddr struct has the 4.4 BSD sa_len member
70 dnl borrowed from LBL libpcap
71 AC_DEFUN(AC_CHECK_SA_LEN, [
72         AC_MSG_CHECKING(if sockaddr struct has sa_len member)
73         AC_CACHE_VAL($1,
74         AC_TRY_COMPILE([
75 #               include <sys/types.h>
76 #               include <sys/socket.h>],
77                 [u_int i = sizeof(((struct sockaddr *)0)->sa_len)],
78                 $1=yes,
79                 $1=no))
80         AC_MSG_RESULT($$1)
81                 if test $$1 = yes ; then
82                         AC_DEFINE(HAVE_SOCKADDR_SA_LEN)
83         fi
84 ])
85
86 dnl
87 dnl Checks for portable prototype declaration macro
88 AC_DEFUN(AC_CHECK_PORTABLE_PROTO,  [
89         AC_MSG_CHECKING(for __P)
90         AC_CACHE_VAL($1,
91         AC_TRY_COMPILE([
92 #               include <unistd.h>],
93                 [int f __P(())],
94                 $1=yes,
95                 $1=no))
96         AC_MSG_RESULT($$1)
97         if test $$1 = yes; then
98                 AC_DEFINE(HAVE_PORTABLE_PROTOTYPE)
99         fi
100 ])
101
102 dnl checks for u_intXX_t
103 AC_DEFUN(AC_CHECK_BITTYPES, [
104         $1=yes
105 dnl check for u_int8_t
106         AC_MSG_CHECKING(for u_int8_t)
107         AC_CACHE_VAL(ac_cv_u_int8_t,
108         AC_TRY_COMPILE([
109 #               include <sys/types.h>],
110                 [u_int8_t i],
111                 ac_cv_u_int8_t=yes,
112                 ac_cv_u_int8_t=no))
113         AC_MSG_RESULT($ac_cv_u_int8_t)
114         if test $ac_cv_u_int8_t = yes; then
115                 AC_DEFINE(HAVE_U_INT8_T)
116         else
117                 $1=no
118         fi
119 dnl check for u_int16_t
120         AC_MSG_CHECKING(for u_int16_t)
121         AC_CACHE_VAL(ac_cv_u_int16_t,
122         AC_TRY_COMPILE([
123 #               include <sys/types.h>],
124                 [u_int16_t i],
125                 ac_cv_u_int16_t=yes,
126                 ac_cv_u_int16_t=no))
127         AC_MSG_RESULT($ac_cv_u_int16_t)
128         if test $ac_cv_u_int16_t = yes; then
129                 AC_DEFINE(HAVE_U_INT16_T)
130         else
131                 $1=no
132         fi
133 dnl check for u_int32_t
134         AC_MSG_CHECKING(for u_int32_t)
135         AC_CACHE_VAL(ac_cv_u_int32_t,
136         AC_TRY_COMPILE([
137 #               include <sys/types.h>],
138                 [u_int32_t i],
139                 ac_cv_u_int32_t=yes,
140                 ac_cv_u_int32_t=no))
141         AC_MSG_RESULT($ac_cv_u_int32_t)
142         if test $ac_cv_u_int32_t = yes; then
143                 AC_DEFINE(HAVE_U_INT32_T)
144         else
145                 $1=no
146         fi
147 ])
148
149 dnl
150 dnl Checks for addrinfo structure
151 AC_DEFUN(AC_STRUCT_ADDRINFO, [
152         AC_MSG_CHECKING(for addrinfo)
153         AC_CACHE_VAL($1,
154         AC_TRY_COMPILE([
155 #               include <netdb.h>],
156                 [struct addrinfo a],
157                 $1=yes,
158                 $1=no))
159         AC_MSG_RESULT($$1)
160         if test $$1 = yes; then
161                 AC_DEFINE(HAVE_ADDRINFO)
162         else
163                 AC_DEFINE(NEED_ADDRINFO_H)
164         fi
165 ])
166
167 dnl
168 dnl Checks for NI_MAXSERV
169 AC_DEFUN(AC_NI_MAXSERV, [
170         AC_MSG_CHECKING(for NI_MAXSERV)
171         AC_CACHE_VAL($1,
172         AC_EGREP_CPP(yes, [#include <netdb.h>
173 #ifdef NI_MAXSERV
174 yes
175 #endif],
176                 $1=yes,
177                 $1=no))
178         AC_MSG_RESULT($$1)
179         if test $$1 != yes; then
180                 AC_DEFINE(NEED_ADDRINFO_H)
181         fi
182 ])
183
184 dnl
185 dnl Checks for NI_NAMEREQD
186 AC_DEFUN(AC_NI_NAMEREQD, [
187         AC_MSG_CHECKING(for NI_NAMEREQD)
188         AC_CACHE_VAL($1,
189         AC_EGREP_CPP(yes, [#include <netdb.h>
190 #ifdef NI_NOFQDN
191 yes
192 #endif],
193                 $1=yes,
194                 $1=no))
195         AC_MSG_RESULT($$1)
196         if test $$1 != yes; then
197                 AC_DEFINE(NEED_ADDRINFO_H)
198         fi
199 ])
200
201 dnl
202 dnl Checks for sockaddr_storage structure
203 AC_DEFUN(AC_STRUCT_SA_STORAGE, [
204         AC_MSG_CHECKING(for sockaddr_storage)
205         AC_CACHE_VAL($1,
206         AC_TRY_COMPILE([
207 #               include <sys/types.h>
208 #               include <sys/socket.h>],
209                 [struct sockaddr_storage s],
210                 $1=yes,
211                 $1=no))
212         AC_MSG_RESULT($$1)
213         if test $$1 = yes; then
214                 AC_DEFINE(HAVE_SOCKADDR_STORAGE)
215         fi
216 ])
217
218 dnl
219 dnl Checks for macro of IP address size
220 AC_DEFUN(AC_CHECK_ADDRSZ, [
221         $1=yes
222 dnl check for INADDRSZ
223         AC_MSG_CHECKING(for INADDRSZ)
224         AC_CACHE_VAL(ac_cv_inaddrsz,
225         AC_TRY_COMPILE([
226 #               include <arpa/nameser.h>],
227                 [int a = INADDRSZ],
228                 ac_cv_inaddrsz=yes,
229                 ac_cv_inaddrsz=no))
230         AC_MSG_RESULT($ac_cv_inaddrsz)
231         if test $ac_cv_inaddrsz = yes; then
232                 AC_DEFINE(HAVE_INADDRSZ)
233         else
234                 $1=no
235         fi
236 dnl check for IN6ADDRSZ
237         AC_MSG_CHECKING(for IN6ADDRSZ)
238         AC_CACHE_VAL(ac_cv_in6addrsz,
239         AC_TRY_COMPILE([
240 #               include <arpa/nameser.h>],
241                 [int a = IN6ADDRSZ],
242                 ac_cv_in6addrsz=yes,
243                 ac_cv_in6addrsz=no))
244         AC_MSG_RESULT($ac_cv_in6addrsz)
245         if test $ac_cv_in6addrsz = yes; then
246                 AC_DEFINE(HAVE_IN6ADDRSZ)
247         else
248                 $1=no
249         fi
250 ])
251
252 dnl
253 dnl check for RES_USE_INET6
254 AC_DEFUN(AC_CHECK_RES_USE_INET6, [
255         AC_MSG_CHECKING(for RES_USE_INET6)
256         AC_CACHE_VAL($1,
257         AC_TRY_COMPILE([
258 #               include <sys/types.h>
259 #               include <netinet/in.h>
260 #               include <resolv.h>],
261                 [int a = RES_USE_INET6],
262                 $1=yes,
263                 $1=no))
264         AC_MSG_RESULT($$1)
265         if test $$1 = yes; then
266                 AC_DEFINE(HAVE_RES_USE_INET6)
267         fi
268 ])
269
270 dnl
271 dnl check for AAAA
272 AC_DEFUN(AC_CHECK_AAAA, [
273         AC_MSG_CHECKING(for AAAA)
274         AC_CACHE_VAL($1,
275         AC_TRY_COMPILE([
276 #               include <sys/types.h>
277 #               include <arpa/nameser.h>],
278                 [int a = T_AAAA],
279                 $1=yes,
280                 $1=no))
281         AC_MSG_RESULT($$1)
282         if test $$1 = yes; then
283                 AC_DEFINE(HAVE_AAAA)
284         fi
285 ])
286
287 dnl
288 dnl check for struct res_state_ext
289 AC_DEFUN(AC_STRUCT_RES_STATE_EXT, [
290         AC_MSG_CHECKING(for res_state_ext)
291         AC_CACHE_VAL($1,
292         AC_TRY_COMPILE([
293 #               include <sys/types.h>
294 #               include <netinet/in.h>
295 #               include <netinet6/in6.h>
296 #               include <resolv.h>],
297                 [struct __res_state_ext e],
298                 $1=yes,
299                 $1=no))
300         AC_MSG_RESULT($$1)
301         if test $$1 = yes; then
302                 AC_DEFINE(HAVE_RES_STATE_EXT)
303         fi
304 ])
305
306 dnl
307 dnl check for struct res_state_ext
308 AC_DEFUN(AC_STRUCT_RES_STATE, [
309         AC_MSG_CHECKING(for nsort in res_state)
310         AC_CACHE_VAL($1,
311         AC_TRY_COMPILE([
312 #               include <sys/types.h>
313 #               include <netinet/in.h>
314 #               include <netinet6/in6.h>
315 #               include <resolv.h>],
316                 [struct __res_state e; e.nsort = 0],
317                 $1=yes,
318                 $1=no))
319         AC_MSG_RESULT($$1)
320         if test $$1 = yes; then
321                 AC_DEFINE(HAVE_NEW_RES_STATE)
322         fi
323 ])
324
325 dnl
326 dnl check for h_errno
327 AC_DEFUN(AC_VAR_H_ERRNO, [
328         AC_MSG_CHECKING(for h_errno)
329         AC_CACHE_VAL(ac_cv_var_h_errno,
330         AC_TRY_COMPILE([
331 #               include <sys/types.h>
332 #               include <netdb.h>],
333                 [int foo = h_errno;],
334                 ac_cv_var_h_errno=yes,
335                 ac_cv_var_h_errno=no))
336         AC_MSG_RESULT($ac_cv_var_h_errno)
337         if test "$ac_cv_var_h_errno" = "yes"; then
338                 AC_DEFINE(HAVE_H_ERRNO)
339         fi
340 ])
341
342 dnl
343 dnl Test for __attribute__
344 dnl
345
346 AC_DEFUN(AC_C___ATTRIBUTE__, [
347 AC_MSG_CHECKING(for __attribute__)
348 AC_CACHE_VAL(ac_cv___attribute__, [
349 AC_TRY_COMPILE([
350 #include <stdlib.h>
351 ],
352 [
353 static void foo(void) __attribute__ ((noreturn));
354
355 static void
356 foo(void)
357 {
358   exit(1);
359 }
360 ],
361 ac_cv___attribute__=yes,
362 ac_cv___attribute__=no)])
363 if test "$ac_cv___attribute__" = "yes"; then
364   AC_DEFINE(HAVE___ATTRIBUTE__, 1, [define if your compiler has __attribute__])
365 fi
366 AC_MSG_RESULT($ac_cv___attribute__)
367 ])