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 rk_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])
91 AC_HAVE_TYPE([uintptr_t],[#ifdef HAVE_STDINT_H
95 dnl Sunpro 5.2 has a vis.h which is something different.
96 AC_CHECK_HEADERS(vis.h, , , [
102 AC_CHECK_HEADERS(netdb.h, , , [AC_INCLUDES_DEFAULT
103 #ifdef HAVE_SYS_TYPES_H
104 #include <sys/types.h>
108 AC_CHECK_HEADERS(sys/socket.h, , , [AC_INCLUDES_DEFAULT
109 #ifdef HAVE_SYS_TYPES_H
110 #include <sys/types.h>
114 AC_CHECK_HEADERS(net/if.h, , , [AC_INCLUDES_DEFAULT
115 #ifdef HAVE_SYS_TYPES_H
116 #include <sys/types.h>
118 #if HAVE_SYS_SOCKET_H
119 #include <sys/socket.h>
122 AC_CHECK_HEADERS(netinet6/in6_var.h, , , [AC_INCLUDES_DEFAULT
123 #ifdef HAVE_SYS_TYPES_H
124 #include <sys/types.h>
126 #if HAVE_SYS_SOCKET_H
127 #include <sys/socket.h>
129 #ifdef HAVE_NETINET6_IN6_H
130 #include <netinet6/in6.h>
134 AC_CHECK_HEADERS(sys/sysctl.h, , , [AC_INCLUDES_DEFAULT
135 #ifdef HAVE_SYS_PARAM_H
136 #include <sys/param.h>
140 AC_CHECK_HEADERS(sys/proc.h, , , [AC_INCLUDES_DEFAULT
141 #ifdef HAVE_SYS_PARAM_H
142 #include <sys/param.h>
146 AC_REQUIRE([CHECK_NETINET_IP_AND_TCP])
148 AM_CONDITIONAL(have_err_h, test "$ac_cv_header_err_h" = yes)
149 AM_CONDITIONAL(have_ifaddrs_h, test "$ac_cv_header_ifaddrs_h" = yes)
150 AM_CONDITIONAL(have_vis_h, test "$ac_cv_header_vis_h" = yes)
152 dnl Check for functions and libraries
154 AC_FIND_FUNC(socket, socket)
155 AC_FIND_FUNC(gethostbyname, nsl)
156 AC_FIND_FUNC(syslog, syslog)
160 AC_FIND_FUNC(gethostbyname2, inet6 ip6)
168 if test "$ac_cv_func_glob_working" != yes; then
171 AM_CONDITIONAL(have_glob_h, test "$ac_cv_func_glob_working" = yes)
204 if test "$ac_cv_func_cgetent" = no; then
207 AM_CONDITIONAL(have_cgetent, test "$ac_cv_func_cgetent" = yes)
209 AC_REQUIRE([AC_FUNC_GETLOGIN])
211 AC_REQUIRE([AC_FUNC_MMAP])
213 AC_FIND_FUNC_NO_LIBS(getsockopt,,
214 [#ifdef HAVE_SYS_TYPES_H
215 #include <sys/types.h>
217 #ifdef HAVE_SYS_SOCKET_H
218 #include <sys/socket.h>
221 AC_FIND_FUNC_NO_LIBS(setsockopt,,
222 [#ifdef HAVE_SYS_TYPES_H
223 #include <sys/types.h>
225 #ifdef HAVE_SYS_SOCKET_H
226 #include <sys/socket.h>
230 AC_FIND_IF_NOT_BROKEN(hstrerror, resolv,
241 AC_FOREACH([rk_func], [asprintf vasprintf asnprintf vasnprintf],
244 #include <string.h>],
247 AC_FIND_FUNC_NO_LIBS(bswap16,,
248 [#ifdef HAVE_SYS_TYPES_H
249 #include <sys/types.h>
251 #ifdef HAVE_SYS_BSWAP_H
252 #include <sys/bswap.h>
255 AC_FIND_FUNC_NO_LIBS(bswap32,,
256 [#ifdef HAVE_SYS_TYPES_H
257 #include <sys/types.h>
259 #ifdef HAVE_SYS_BSWAP_H
260 #include <sys/bswap.h>
263 AC_FIND_FUNC_NO_LIBS(pidfile,util,
268 AC_FIND_IF_NOT_BROKEN(getaddrinfo,,
272 #ifdef HAVE_WS2TCPIP_H
273 #include <ws2tcpip.h>
276 AC_FIND_IF_NOT_BROKEN(getnameinfo,,
280 #ifdef HAVE_WS2TCPIP_H
281 #include <ws2tcpip.h>
282 #endif],[0,0,0,0,0,0,0])
284 AC_FIND_IF_NOT_BROKEN(freeaddrinfo,,
288 #ifdef HAVE_WS2TCPIP_H
289 #include <ws2tcpip.h>
292 AC_FIND_IF_NOT_BROKEN(gai_strerror,,
296 #ifdef HAVE_WS2TCPIP_H
297 #include <ws2tcpip.h>
300 dnl Darwin is weird, and in some senses not unix, launchd doesn't want
301 dnl servers to use daemon(), so its deprecated.
306 AC_DEFINE([SUPPORT_DETACH], 1,
307 [Define if os support want to detach is daemonens.])
308 AC_BROKEN([daemon]) ;;
383 AM_CONDITIONAL(have_fnmatch_h,
384 test "$ac_cv_header_fnmatch_h" = yes -a "$ac_cv_func_fnmatch" = yes)
386 AC_FOREACH([rk_func], [strndup strsep strtok_r],
387 [AC_NEED_PROTO([#include <string.h>], rk_func)])
389 AC_FOREACH([rk_func], [strsvis strunvis strvis strvisx svis unvis vis],
390 [AC_NEED_PROTO([#ifdef HAVE_VIS_H
394 AC_BROKEN2(inet_aton,
395 [#ifdef HAVE_SYS_TYPES_H
396 #include <sys/types.h>
398 #ifdef HAVE_SYS_SOCKET_H
399 #include <sys/socket.h>
401 #ifdef HAVE_NETINET_IN_H
402 #include <netinet/in.h>
404 #ifdef HAVE_ARPA_INET_H
405 #include <arpa/inet.h>
409 AC_BROKEN2(inet_ntop,
410 [#ifdef HAVE_SYS_TYPES_H
411 #include <sys/types.h>
413 #ifdef HAVE_SYS_SOCKET_H
414 #include <sys/socket.h>
416 #ifdef HAVE_NETINET_IN_H
417 #include <netinet/in.h>
419 #ifdef HAVE_ARPA_INET_H
420 #include <arpa/inet.h>
424 AC_BROKEN2(inet_pton,
425 [#ifdef HAVE_SYS_TYPES_H
426 #include <sys/types.h>
428 #ifdef HAVE_SYS_SOCKET_H
429 #include <sys/socket.h>
431 #ifdef HAVE_NETINET_IN_H
432 #include <netinet/in.h>
434 #ifdef HAVE_ARPA_INET_H
435 #include <arpa/inet.h>
440 dnl Check for sa_len in struct sockaddr,
441 dnl needs to come before the getnameinfo test
443 AC_HAVE_STRUCT_FIELD(struct sockaddr, sa_len, [#include <sys/types.h>
444 #include <sys/socket.h>])
446 if test "$ac_cv_func_getaddrinfo" = "yes"; then
447 rk_BROKEN_GETADDRINFO
448 if test "$ac_cv_func_getaddrinfo_numserv" = no; then
449 AC_LIBOBJ(getaddrinfo)
450 AC_LIBOBJ(freeaddrinfo)
454 AC_NEED_PROTO([#include <stdlib.h>], setenv)
455 AC_NEED_PROTO([#include <stdlib.h>], unsetenv)
456 AC_NEED_PROTO([#include <unistd.h>], gethostname)
457 AC_NEED_PROTO([#include <unistd.h>], mkstemp)
458 AC_NEED_PROTO([#include <unistd.h>], getusershell)
459 AC_NEED_PROTO([#include <unistd.h>], daemon)
461 #ifdef HAVE_SYS_TYPES_H
462 #include <sys/types.h>
464 #ifdef HAVE_SYS_SOCKET_H
465 #include <sys/socket.h>
467 #ifdef HAVE_NETINET_IN_H
468 #include <netinet/in.h>
470 #ifdef HAVE_ARPA_INET_H
471 #include <arpa/inet.h>
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>
496 AC_FIND_FUNC_NO_LIBS(crypt, crypt)dnl
498 AC_REQUIRE([rk_BROKEN_REALLOC])dnl
500 dnl AC_KRB_FUNC_GETCWD_BROKEN
503 dnl Checks for prototypes and declarations
507 #ifdef HAVE_SYS_TYPES_H
508 #include <sys/types.h>
510 #ifdef HAVE_SYS_SOCKET_H
511 #include <sys/socket.h>
513 #ifdef HAVE_NETINET_IN_H
514 #include <netinet/in.h>
516 #ifdef HAVE_ARPA_INET_H
517 #include <arpa/inet.h>
523 gethostbyname, struct hostent *gethostbyname(const char *))
526 #ifdef HAVE_SYS_TYPES_H
527 #include <sys/types.h>
529 #ifdef HAVE_SYS_SOCKET_H
530 #include <sys/socket.h>
532 #ifdef HAVE_NETINET_IN_H
533 #include <netinet/in.h>
535 #ifdef HAVE_ARPA_INET_H
536 #include <arpa/inet.h>
542 gethostbyaddr, struct hostent *gethostbyaddr(const void *, size_t, int))
545 #ifdef HAVE_SYS_TYPES_H
546 #include <sys/types.h>
548 #ifdef HAVE_SYS_SOCKET_H
549 #include <sys/socket.h>
551 #ifdef HAVE_NETINET_IN_H
552 #include <netinet/in.h>
554 #ifdef HAVE_ARPA_INET_H
555 #include <arpa/inet.h>
561 getservbyname, struct servent *getservbyname(const char *, const char *))
564 #ifdef HAVE_SYS_TYPES_H
565 #include <sys/types.h>
567 #ifdef HAVE_SYS_SOCKET_H
568 #include <sys/socket.h>
571 getsockname, int getsockname(int, struct sockaddr*, socklen_t*))
578 openlog, void openlog(const char *, int, int))
592 rk_CHECK_VAR(h_errno,
593 [#ifdef HAVE_SYS_TYPES_H
594 #include <sys/types.h>
599 #ifdef HAVE_WS2TCPIP_H
600 #include <ws2tcpip.h>
604 rk_CHECK_VAR(h_errlist,
608 #ifdef HAVE_WS2TCPIP_H
609 #include <ws2tcpip.h>
616 #ifdef HAVE_WS2TCPIP_H
617 #include <ws2tcpip.h>
620 rk_CHECK_VAR([__progname],
625 AC_CHECK_DECLS([optarg, optind, opterr, optopt, environ],[],[],[
632 dnl Check for fields in struct tm
635 AC_HAVE_STRUCT_FIELD(struct tm, tm_gmtoff, [#include <time.h>])
636 AC_HAVE_STRUCT_FIELD(struct tm, tm_zone, [#include <time.h>])
639 dnl or do we have a variable `timezone' ?
642 rk_CHECK_VAR(timezone,[#include <time.h>])
643 rk_CHECK_VAR(altzone,[#include <time.h>])
645 AC_HAVE_TYPE([sa_family_t],[
646 #include <sys/types.h>
647 #ifdef HAVE_SYS_SOCKET_H
648 #include <sys/socket.h>
650 #ifdef HAVE_WS2TCPIP_H
651 #include <ws2tcpip.h>
653 AC_HAVE_TYPE([socklen_t],[
654 #include <sys/types.h>
655 #ifdef HAVE_SYS_SOCKET_H
656 #include <sys/socket.h>
658 #ifdef HAVE_WS2TCPIP_H
659 #include <ws2tcpip.h>
661 AC_HAVE_TYPE([struct sockaddr], [
662 #include <sys/types.h>
663 #ifdef HAVE_SYS_SOCKET_H
664 #include <sys/socket.h>
666 #ifdef HAVE_WS2TCPIP_H
667 #include <ws2tcpip.h>
669 AC_HAVE_TYPE([struct sockaddr_storage], [
670 #include <sys/types.h>
671 #ifdef HAVE_SYS_SOCKET_H
672 #include <sys/socket.h>
674 #ifdef HAVE_WS2TCPIP_H
675 #include <ws2tcpip.h>
677 AC_HAVE_TYPE([struct addrinfo], [
678 #include <sys/types.h>
682 #ifdef HAVE_WS2TCPIP_H
683 #include <ws2tcpip.h>
685 AC_HAVE_TYPE([struct ifaddrs], [#include <ifaddrs.h>])
686 AC_HAVE_TYPE([struct iovec],[
687 #include <sys/types.h>
690 AC_HAVE_TYPE([struct msghdr],[
691 #include <sys/types.h>
692 #ifdef HAVE_SYS_SOCKET_H
693 #include <sys/socket.h>
695 #ifdef HAVE_WS2TCPIP_H
696 #include <ws2tcpip.h>
700 dnl Check for struct winsize
703 AC_KRB_STRUCT_WINSIZE
706 dnl Check for struct spwd
712 # Check if we want samba's socket wrapper
717 dnl won't work with automake
718 dnl moved to AC_OUTPUT in configure.in
719 dnl AC_CONFIG_FILES($1/Makefile)
721 LIB_roken="${LIB_roken} \$(LIB_crypt) \$(LIB_dbopen)"
723 AC_SUBST(DIR_roken)dnl
724 AC_SUBST(LIB_roken)dnl
725 AC_SUBST(INCLUDES_roken)dnl