diff options
-rw-r--r-- | acinclude.m4 | 78 | ||||
-rw-r--r-- | configure.in | 115 |
2 files changed, 193 insertions, 0 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index e69de29..70d82e4 100644 --- a/acinclude.m4 +++ b/acinclude.m4 | |||
@@ -0,0 +1,78 @@ | |||
1 | dnl @synopsis ACX_WHICH_GETHOSTBYNAME_R | ||
2 | dnl | ||
3 | dnl Provides a test to determine the correct way to call gethostbyname_r | ||
4 | dnl | ||
5 | dnl defines HAVE_GETHOSTBYNAME_R to the number of arguments required | ||
6 | dnl | ||
7 | dnl e.g. 6 arguments (linux) | ||
8 | dnl e.g. 5 arguments (solaris) | ||
9 | dnl e.g. 3 arguments (osf/1) | ||
10 | dnl | ||
11 | dnl @version $Id$ | ||
12 | dnl @author Brian Stafford <brian@stafford.uklinux.net> | ||
13 | dnl | ||
14 | dnl based on version by Caolan McNamara <caolan@skynet.ie> | ||
15 | dnl based on David Arnold's autoconf suggestion in the threads faq | ||
16 | dnl | ||
17 | AC_DEFUN(ACX_WHICH_GETHOSTBYNAME_R, | ||
18 | [AC_CACHE_CHECK(number of arguments to gethostbyname_r, | ||
19 | acx_which_gethostbyname_r, [ | ||
20 | AC_TRY_COMPILE([ | ||
21 | # include <netdb.h> | ||
22 | ], [ | ||
23 | |||
24 | char *name; | ||
25 | struct hostent *he; | ||
26 | struct hostent_data data; | ||
27 | (void) gethostbyname_r(name, he, &data); | ||
28 | |||
29 | ],acx_which_gethostbyname_r=3, | ||
30 | [ | ||
31 | dnl acx_which_gethostbyname_r=0 | ||
32 | AC_TRY_COMPILE([ | ||
33 | # include <netdb.h> | ||
34 | ], [ | ||
35 | char *name; | ||
36 | struct hostent *he, *res; | ||
37 | char *buffer = NULL; | ||
38 | int buflen = 2048; | ||
39 | int h_errnop; | ||
40 | (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop) | ||
41 | ],acx_which_gethostbyname_r=6, | ||
42 | |||
43 | [ | ||
44 | dnl acx_which_gethostbyname_r=0 | ||
45 | AC_TRY_COMPILE([ | ||
46 | # include <netdb.h> | ||
47 | ], [ | ||
48 | char *name; | ||
49 | struct hostent *he; | ||
50 | char *buffer = NULL; | ||
51 | int buflen = 2048; | ||
52 | int h_errnop; | ||
53 | (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop) | ||
54 | ],acx_which_gethostbyname_r=5,acx_which_gethostbyname_r=0) | ||
55 | |||
56 | ] | ||
57 | |||
58 | ) | ||
59 | ] | ||
60 | ) | ||
61 | ]) | ||
62 | |||
63 | if test $acx_which_gethostbyname_r -gt 0 ; then | ||
64 | AC_DEFINE_UNQUOTED([HAVE_GETHOSTBYNAME_R], $acx_which_gethostbyname_r, | ||
65 | [Number of parameters to gethostbyname_r or 0 if not available]) | ||
66 | fi | ||
67 | |||
68 | ]) | ||
69 | |||
70 | dnl @synopsis ACX_HELP_STRING(OPTION,DESCRIPTION) | ||
71 | AC_DEFUN([ACX_HELP_STRING], | ||
72 | [ $1 builtin([substr],[ ],len($1))[$2]]) | ||
73 | |||
74 | |||
75 | dnl @synopsis ACX_FEATURE(ENABLE_OR_WITH,NAME[,VALUE]) | ||
76 | AC_DEFUN([ACX_FEATURE], | ||
77 | [echo "builtin([substr],[ ],len(--$1-$2))--$1-$2: ifelse($3,,[$]translit($1-$2,-,_),$3)"]) | ||
78 | |||
diff --git a/configure.in b/configure.in index 08996c9..ef0d06b 100644 --- a/configure.in +++ b/configure.in | |||
@@ -231,6 +231,121 @@ elif test "$OPENSSL" = "/usr/local/ssl/bin/openssl"; then | |||
231 | fi | 231 | fi |
232 | AC_ARG_WITH(openssl,--with-openssl=<dir> sets path to openssl installation,[OPENSSL=$withval]) | 232 | AC_ARG_WITH(openssl,--with-openssl=<dir> sets path to openssl installation,[OPENSSL=$withval]) |
233 | 233 | ||
234 | dnl ######################################################################### | ||
235 | dnl Check if Posix getaddrinfo() is available. It is also possible to use | ||
236 | dnl the version from the lwres library distributed with BIND. | ||
237 | dnl ######################################################################### | ||
238 | AC_ARG_ENABLE([emulate-getaddrinfo], | ||
239 | ACX_HELP_STRING([--enable-emulate-getaddrinfo], | ||
240 | [enable getaddrinfo emulation (default=no)]), | ||
241 | , | ||
242 | enable_emulate_getaddrinfo=no) | ||
243 | AC_ARG_WITH(lwres, | ||
244 | ACX_HELP_STRING([--with-lwres=DIR], | ||
245 | [use lwres library for getaddrinfo (default=no)]), | ||
246 | , | ||
247 | with_lwres=no) | ||
248 | |||
249 | dnl ## enable force to test getaddrinfo.c | ||
250 | if test x$enable_emulate_getaddrinfo = xforce ; then | ||
251 | enable_emulate_getaddrinfo=yes | ||
252 | have_getaddrinfo=no | ||
253 | else | ||
254 | |||
255 | have_getaddrinfo=no | ||
256 | if test x$with_lwres != xno ; then | ||
257 | if test "$with_lwres" != yes ; then | ||
258 | CPPFLAGS="-I${with_lwres}/include $CPPFLAGS" | ||
259 | LDFLAGS="-L${with_lwres}/lib $LDFLAGS" | ||
260 | fi | ||
261 | AC_CHECK_HEADERS(lwres/netdb.h, , | ||
262 | [AC_MSG_ERROR([cannot find <lwres/netdb.h>])]) | ||
263 | AC_CHECK_LIB(lwres, lwres_getaddrinfo, , | ||
264 | [AC_MSG_ERROR([cannot find the lwres library])], | ||
265 | -lnsl -lpthread) | ||
266 | have_getaddrinfo=yes | ||
267 | fi | ||
268 | |||
269 | if test x$have_getaddrinfo != xyes ; then | ||
270 | AC_SEARCH_LIBS(getaddrinfo, socket resolv bind nsl c_r cr, have_getaddrinfo=yes) | ||
271 | fi | ||
272 | |||
273 | dnl # Special nonsense for systems that actually have getaddrinfo but | ||
274 | dnl # redefine the name to something else, e.g. OSF | ||
275 | if test x$have_getaddrinfo != xyes ; then | ||
276 | AC_MSG_CHECKING(if getaddrinfo is redefined in netdb.h) | ||
277 | AC_TRY_LINK([ | ||
278 | # include <netdb.h> | ||
279 | ], [ | ||
280 | struct addrinfo hints, *res; | ||
281 | int err; | ||
282 | |||
283 | err = getaddrinfo ("host", "service", &hints, &res); | ||
284 | ], [ | ||
285 | have_getaddrinfo=yes | ||
286 | AC_MSG_RESULT(yes) | ||
287 | ], [AC_MSG_RESULT(no)]) | ||
288 | fi | ||
289 | |||
290 | fi | ||
291 | |||
292 | if test x$have_getaddrinfo != xno ; then | ||
293 | if test x$enable_emulate_getaddrinfo != xno ; then | ||
294 | AC_MSG_ERROR([getaddrinfo found but emulate-getaddrinfo was enabled]) | ||
295 | fi | ||
296 | AC_DEFINE(HAVE_GETADDRINFO, 1, | ||
297 | [Does system provide RFC 2553/Posix getaddrinfo?]) | ||
298 | else | ||
299 | if test x$enable_emulate_getaddrinfo != xyes ; then | ||
300 | AC_MSG_ERROR([getaddrinfo not found: try --with-lwres or --enable-emulate-getaddrinfo]) | ||
301 | fi | ||
302 | LIBOBJS="$LIBOBJS getaddrinfo.o" | ||
303 | fi | ||
304 | |||
305 | if test x"$enable_emulate_getaddrinfo" != xno ; then | ||
306 | have_resolver=no | ||
307 | |||
308 | dnl Try for getipnodebyname | ||
309 | AC_SEARCH_LIBS(getipnodebyname, resolv bind nsl c_r cr, have_resolver=yes) | ||
310 | if test x"$have_resolver" != xno ; then | ||
311 | AC_DEFINE(HAVE_GETIPNODEBYNAME, 1, | ||
312 | [Set when getipnodebyname is available]) | ||
313 | fi | ||
314 | |||
315 | dnl Try for gethostbyname_r | ||
316 | if test x"$have_resolver" = xno ; then | ||
317 | AC_SEARCH_LIBS(gethostbyname_r, resolv bind nsl c_r cr, | ||
318 | [have_resolver=yes | ||
319 | ACX_WHICH_GETHOSTBYNAME_R]) | ||
320 | fi | ||
321 | |||
322 | dnl Try for gethostbyname | ||
323 | if test x"$have_resolver" = xno ; then | ||
324 | if test x"$enable_pthreads" != xno ; then | ||
325 | AC_MSG_WARN([using threads but cannot find gethostbyname_r or getipnodebyname]) | ||
326 | fi | ||
327 | AC_SEARCH_LIBS(gethostbyname, resolv bind nsl, , | ||
328 | [AC_MSG_ERROR([cannot find gethostbyname])]) | ||
329 | fi | ||
330 | LIBOBJS="$LIBOBJS gethostbyname.o" | ||
331 | |||
332 | AC_CACHE_CHECK([for IPv6 support], acx_cv_sys_use_ipv6, [ | ||
333 | AC_TRY_COMPILE([ | ||
334 | # include <netinet/in.h> | ||
335 | ], [ | ||
336 | struct sockaddr_in6 sin6; | ||
337 | void *p; | ||
338 | |||
339 | sin6.sin6_family = AF_INET6; | ||
340 | sin6.sin6_port = 587; | ||
341 | p = &sin6.sin6_addr; | ||
342 | ], [acx_cv_sys_use_ipv6=yes], [acx_cv_sys_use_ipv6=no]) | ||
343 | ]) | ||
344 | if test x"$acx_cv_sys_use_ipv6" != xno ; then | ||
345 | AC_DEFINE(USE_IPV6,1,[Enable IPv6 support]) | ||
346 | fi | ||
347 | fi | ||
348 | |||
234 | AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no) | 349 | AC_CHECK_HEADERS(krb5.h,FOUNDINCLUDE=yes,FOUNDINCLUDE=no) |
235 | if test "$FOUNDINCLUDE" = "no"; then | 350 | if test "$FOUNDINCLUDE" = "no"; then |
236 | _SAVEDCPPFLAGS="$CPPFLAGS" | 351 | _SAVEDCPPFLAGS="$CPPFLAGS" |