3 dnl some code to get roken working
9 AC_REQUIRE([rk_CONFIG_HEADER])
12 LIB_roken='$(top_builddir)/$1/libroken.la'
13 INCLUDES_roken='-I$(top_builddir)/$1 -I$(top_srcdir)/$1'
15 dnl Checks for programs
16 AC_REQUIRE([AC_PROG_CC])
17 AC_REQUIRE([AC_PROG_AWK])
18 AC_REQUIRE([AC_OBJEXT])
19 AC_REQUIRE([AC_EXEEXT])
20 AC_REQUIRE([AC_PROG_LIBTOOL])
22 AC_REQUIRE([AC_MIPS_ABI])
26 AC_REQUIRE([AC_C___ATTRIBUTE__])
27 AC_REQUIRE([AC_C_INLINE])
28 AC_REQUIRE([AC_C_CONST])
29 AC_WFLAGS(-Wall -Wmissing-prototypes -Wpointer-arith -Wbad-function-cast -Wmissing-declarations -Wnested-externs)
35 AC_REQUIRE([AC_TYPE_SIZE_T])
36 AC_HAVE_TYPE([ssize_t],[#include <unistd.h>])
37 AC_REQUIRE([AC_TYPE_PID_T])
38 AC_REQUIRE([AC_TYPE_UID_T])
39 AC_HAVE_TYPE([long long])
41 AC_REQUIRE([rk_RETSIGTYPE])
43 dnl Checks for header files.
44 AC_REQUIRE([AC_HEADER_STDC])
45 AC_REQUIRE([AC_HEADER_TIME])
94 AC_CHECK_HEADERS([sys/sysctl.h], , , [AC_INCLUDES_DEFAULT
96 #include <sys/types.h>
99 #include <sys/param.h>
103 AC_REQUIRE([CHECK_NETINET_IP_AND_TCP])
105 AM_CONDITIONAL(have_err_h, test "$ac_cv_header_err_h" = yes)
106 AM_CONDITIONAL(have_fnmatch_h, test "$ac_cv_header_fnmatch_h" = yes)
107 AM_CONDITIONAL(have_ifaddrs_h, test "$ac_cv_header_ifaddrs_h" = yes)
108 AM_CONDITIONAL(have_vis_h, test "$ac_cv_header_vis_h" = yes)
110 dnl Check for functions and libraries
112 AC_FIND_FUNC(socket, socket)
113 AC_FIND_FUNC(gethostbyname, nsl)
114 AC_FIND_FUNC(syslog, syslog)
118 AC_FIND_FUNC(gethostbyname2, inet6 ip6)
120 AC_FIND_FUNC(res_search, resolv,
123 #ifdef HAVE_SYS_TYPES_H
124 #include <sys/types.h>
126 #ifdef HAVE_NETINET_IN_H
127 #include <netinet/in.h>
129 #ifdef HAVE_ARPA_NAMESER_H
130 #include <arpa/nameser.h>
138 AC_FIND_FUNC(res_nsearch, resolv,
141 #ifdef HAVE_SYS_TYPES_H
142 #include <sys/types.h>
144 #ifdef HAVE_NETINET_IN_H
145 #include <netinet/in.h>
147 #ifdef HAVE_ARPA_NAMESER_H
148 #include <arpa/nameser.h>
156 AC_FIND_FUNC(dn_expand, resolv,
159 #ifdef HAVE_SYS_TYPES_H
160 #include <sys/types.h>
162 #ifdef HAVE_NETINET_IN_H
163 #include <netinet/in.h>
165 #ifdef HAVE_ARPA_NAMESER_H
166 #include <arpa/nameser.h>
176 #ifdef HAVE_SYS_TYPES_H
177 #include <sys/types.h>
179 #ifdef HAVE_NETINET_IN_H
180 #include <netinet/in.h>
182 #ifdef HAVE_ARPA_NAMESER_H
183 #include <arpa/nameser.h>
194 if test "$ac_cv_func_glob_working" != yes; then
197 AM_CONDITIONAL(have_glob_h, test "$ac_cv_func_glob_working" = yes)
229 if test "$ac_cv_func_cgetent" = no; then
233 AC_REQUIRE([AC_FUNC_GETLOGIN])
235 AC_REQUIRE([AC_FUNC_MMAP])
237 AC_FIND_FUNC_NO_LIBS(getsockopt,,
238 [#ifdef HAVE_SYS_TYPES_H
239 #include <sys/types.h>
241 #ifdef HAVE_SYS_SOCKET_H
242 #include <sys/socket.h>
245 AC_FIND_FUNC_NO_LIBS(setsockopt,,
246 [#ifdef HAVE_SYS_TYPES_H
247 #include <sys/types.h>
249 #ifdef HAVE_SYS_SOCKET_H
250 #include <sys/socket.h>
254 AC_FIND_IF_NOT_BROKEN(hstrerror, resolv,
265 AC_FOREACH([rk_func], [asprintf vasprintf asnprintf vasnprintf],
268 #include <string.h>],
271 AC_FIND_FUNC_NO_LIBS(bswap16,,
272 [#ifdef HAVE_SYS_BSWAP_H
273 #include <sys/bswap.h>
276 AC_FIND_FUNC_NO_LIBS(bswap32,,
277 [#ifdef HAVE_SYS_BSWAP_H
278 #include <sys/bswap.h>
281 AC_FIND_FUNC_NO_LIBS(pidfile,util,
286 AC_FIND_IF_NOT_BROKEN(getaddrinfo,,
291 AC_FIND_IF_NOT_BROKEN(getnameinfo,,
294 #endif],[0,0,0,0,0,0,0])
296 AC_FIND_IF_NOT_BROKEN(freeaddrinfo,,
301 AC_FIND_IF_NOT_BROKEN(gai_strerror,,
375 AC_FOREACH([rk_func], [strndup strsep strtok_r],
376 [AC_NEED_PROTO([#include <string.h>], rk_func)])
378 AC_FOREACH([rk_func], [strsvis strunvis strvis strvisx svis unvis vis],
379 [AC_NEED_PROTO([#ifdef HAVE_VIS_H
383 AC_BROKEN2(inet_aton,
384 [#ifdef HAVE_SYS_TYPES_H
385 #include <sys/types.h>
387 #ifdef HAVE_SYS_SOCKET_H
388 #include <sys/socket.h>
390 #ifdef HAVE_NETINET_IN_H
391 #include <netinet/in.h>
393 #ifdef HAVE_ARPA_INET_H
394 #include <arpa/inet.h>
398 AC_BROKEN2(inet_ntop,
399 [#ifdef HAVE_SYS_TYPES_H
400 #include <sys/types.h>
402 #ifdef HAVE_SYS_SOCKET_H
403 #include <sys/socket.h>
405 #ifdef HAVE_NETINET_IN_H
406 #include <netinet/in.h>
408 #ifdef HAVE_ARPA_INET_H
409 #include <arpa/inet.h>
413 AC_BROKEN2(inet_pton,
414 [#ifdef HAVE_SYS_TYPES_H
415 #include <sys/types.h>
417 #ifdef HAVE_SYS_SOCKET_H
418 #include <sys/socket.h>
420 #ifdef HAVE_NETINET_IN_H
421 #include <netinet/in.h>
423 #ifdef HAVE_ARPA_INET_H
424 #include <arpa/inet.h>
429 dnl Check for sa_len in struct sockaddr,
430 dnl needs to come before the getnameinfo test
432 AC_HAVE_STRUCT_FIELD(struct sockaddr, sa_len, [#include <sys/types.h>
433 #include <sys/socket.h>])
435 if test "$ac_cv_func_getnameinfo" = "yes"; then
436 rk_BROKEN_GETNAMEINFO
437 if test "$ac_cv_func_getnameinfo_broken" = yes; then
438 AC_LIBOBJ(getnameinfo)
442 if test "$ac_cv_func_getaddrinfo" = "yes"; then
443 rk_BROKEN_GETADDRINFO
444 if test "$ac_cv_func_getaddrinfo_numserv" = no; then
445 AC_LIBOBJ(getaddrinfo)
446 AC_LIBOBJ(freeaddrinfo)
450 AC_NEED_PROTO([#include <stdlib.h>], setenv)
451 AC_NEED_PROTO([#include <stdlib.h>], unsetenv)
452 AC_NEED_PROTO([#include <unistd.h>], gethostname)
453 AC_NEED_PROTO([#include <unistd.h>], mkstemp)
454 AC_NEED_PROTO([#include <unistd.h>], getusershell)
457 #ifdef HAVE_SYS_TYPES_H
458 #include <sys/types.h>
460 #ifdef HAVE_SYS_SOCKET_H
461 #include <sys/socket.h>
463 #ifdef HAVE_NETINET_IN_H
464 #include <netinet/in.h>
466 #ifdef HAVE_ARPA_INET_H
467 #include <arpa/inet.h>
471 AC_FIND_FUNC_NO_LIBS(crypt, crypt)dnl
473 AC_REQUIRE([rk_BROKEN_REALLOC])dnl
475 dnl AC_KRB_FUNC_GETCWD_BROKEN
478 dnl Checks for prototypes and declarations
482 #ifdef HAVE_SYS_TYPES_H
483 #include <sys/types.h>
485 #ifdef HAVE_SYS_SOCKET_H
486 #include <sys/socket.h>
488 #ifdef HAVE_NETINET_IN_H
489 #include <netinet/in.h>
491 #ifdef HAVE_ARPA_INET_H
492 #include <arpa/inet.h>
498 gethostbyname, struct hostent *gethostbyname(const char *))
501 #ifdef HAVE_SYS_TYPES_H
502 #include <sys/types.h>
504 #ifdef HAVE_SYS_SOCKET_H
505 #include <sys/socket.h>
507 #ifdef HAVE_NETINET_IN_H
508 #include <netinet/in.h>
510 #ifdef HAVE_ARPA_INET_H
511 #include <arpa/inet.h>
517 gethostbyaddr, struct hostent *gethostbyaddr(const void *, size_t, int))
520 #ifdef HAVE_SYS_TYPES_H
521 #include <sys/types.h>
523 #ifdef HAVE_SYS_SOCKET_H
524 #include <sys/socket.h>
526 #ifdef HAVE_NETINET_IN_H
527 #include <netinet/in.h>
529 #ifdef HAVE_ARPA_INET_H
530 #include <arpa/inet.h>
536 getservbyname, struct servent *getservbyname(const char *, const char *))
539 #ifdef HAVE_SYS_TYPES_H
540 #include <sys/types.h>
542 #ifdef HAVE_SYS_SOCKET_H
543 #include <sys/socket.h>
546 getsockname, int getsockname(int, struct sockaddr*, socklen_t*))
553 openlog, void openlog(const char *, int, int))
567 rk_CHECK_VAR(h_errno,
568 [#ifdef HAVE_SYS_TYPES_H
569 #include <sys/types.h>
575 rk_CHECK_VAR(h_errlist,
585 rk_CHECK_VAR([__progname],
590 AC_CHECK_DECLARATION([#include <stdlib.h>
594 AC_CHECK_DECLARATION([#include <stdlib.h>
598 AC_CHECK_DECLARATION([#include <stdlib.h>
602 AC_CHECK_DECLARATION([#include <stdlib.h>
607 AC_CHECK_DECLARATION([#include <stdlib.h>], environ)
610 dnl Check for fields in struct tm
613 AC_HAVE_STRUCT_FIELD(struct tm, tm_gmtoff, [#include <time.h>])
614 AC_HAVE_STRUCT_FIELD(struct tm, tm_zone, [#include <time.h>])
617 dnl or do we have a variable `timezone' ?
620 rk_CHECK_VAR(timezone,[#include <time.h>])
621 rk_CHECK_VAR(altzone,[#include <time.h>])
623 AC_HAVE_TYPE([sa_family_t],[#include <sys/socket.h>])
624 AC_HAVE_TYPE([socklen_t],[#include <sys/socket.h>])
625 AC_HAVE_TYPE([struct sockaddr], [#include <sys/socket.h>])
626 AC_HAVE_TYPE([struct sockaddr_storage], [#include <sys/socket.h>])
627 AC_HAVE_TYPE([struct addrinfo], [#include <netdb.h>])
628 AC_HAVE_TYPE([struct ifaddrs], [#include <ifaddrs.h>])
629 AC_HAVE_TYPE([struct iovec],[
630 #include <sys/types.h>
633 AC_HAVE_TYPE([struct msghdr],[
634 #include <sys/types.h>
635 #include <sys/socket.h>
639 dnl Check for struct winsize
642 AC_KRB_STRUCT_WINSIZE
645 dnl Check for struct spwd
650 dnl won't work with automake
651 dnl moved to AC_OUTPUT in configure.in
652 dnl AC_CONFIG_FILES($1/Makefile)
654 LIB_roken="${LIB_roken} \$(LIB_crypt) \$(LIB_dbopen)"
656 AC_SUBST(DIR_roken)dnl
657 AC_SUBST(LIB_roken)dnl
658 AC_SUBST(INCLUDES_roken)dnl