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])
24 AC_DEFINE(rk_PATH_DELIM, '/', [Path name delimiter])
28 AC_REQUIRE([AC_C___ATTRIBUTE__])
29 AC_REQUIRE([AC_C_INLINE])
30 AC_REQUIRE([AC_C_CONST])
31 rk_WFLAGS(-Wall -Wmissing-prototypes -Wpointer-arith -Wbad-function-cast -Wmissing-declarations -Wnested-externs)
37 AC_REQUIRE([AC_TYPE_SIZE_T])
38 AC_HAVE_TYPE([ssize_t],[#include <unistd.h>])
39 AC_REQUIRE([AC_TYPE_PID_T])
40 AC_REQUIRE([AC_TYPE_UID_T])
41 AC_HAVE_TYPE([long long])
43 AC_REQUIRE([rk_RETSIGTYPE])
45 dnl Checks for header files.
46 AC_REQUIRE([AC_HEADER_STDC])
47 AC_REQUIRE([AC_HEADER_TIME])
93 AC_HAVE_TYPE([uintptr_t],[#ifdef HAVE_STDINT_H
97 dnl Sunpro 5.2 has a vis.h which is something different.
98 AC_CHECK_HEADERS(vis.h, , , [
104 AC_CHECK_HEADERS(netdb.h, , , [AC_INCLUDES_DEFAULT
105 #ifdef HAVE_SYS_TYPES_H
106 #include <sys/types.h>
110 AC_CHECK_HEADERS(sys/socket.h, , , [AC_INCLUDES_DEFAULT
111 #ifdef HAVE_SYS_TYPES_H
112 #include <sys/types.h>
116 AC_CHECK_HEADERS(net/if.h, , , [AC_INCLUDES_DEFAULT
117 #ifdef HAVE_SYS_TYPES_H
118 #include <sys/types.h>
120 #if HAVE_SYS_SOCKET_H
121 #include <sys/socket.h>
124 AC_CHECK_HEADERS(netinet6/in6_var.h, , , [AC_INCLUDES_DEFAULT
125 #ifdef HAVE_SYS_TYPES_H
126 #include <sys/types.h>
128 #if HAVE_SYS_SOCKET_H
129 #include <sys/socket.h>
131 #ifdef HAVE_NETINET6_IN6_H
132 #include <netinet6/in6.h>
136 AC_CHECK_HEADERS(sys/sysctl.h, , , [AC_INCLUDES_DEFAULT
137 #ifdef HAVE_SYS_PARAM_H
138 #include <sys/param.h>
142 AC_CHECK_HEADERS(sys/proc.h, , , [AC_INCLUDES_DEFAULT
143 #ifdef HAVE_SYS_PARAM_H
144 #include <sys/param.h>
148 AC_REQUIRE([CHECK_NETINET_IP_AND_TCP])
150 AM_CONDITIONAL(have_err_h, test "$ac_cv_header_err_h" = yes)
151 AM_CONDITIONAL(have_ifaddrs_h, test "$ac_cv_header_ifaddrs_h" = yes)
152 AM_CONDITIONAL(have_vis_h, test "$ac_cv_header_vis_h" = yes)
154 dnl Check for functions and libraries
156 AC_FIND_FUNC(socket, socket)
157 AC_FIND_FUNC(gethostbyname, nsl)
158 AC_FIND_FUNC(syslog, syslog)
162 AC_FIND_FUNC(gethostbyname2, inet6 ip6)
170 if test "$ac_cv_func_glob_working" != yes; then
173 AM_CONDITIONAL(have_glob_h, test "$ac_cv_func_glob_working" = yes)
207 if test "$ac_cv_func_cgetent" = no; then
210 AM_CONDITIONAL(have_cgetent, test "$ac_cv_func_cgetent" = yes)
212 AC_REQUIRE([AC_FUNC_GETLOGIN])
214 AC_REQUIRE([AC_FUNC_MMAP])
216 AC_FIND_FUNC_NO_LIBS(getsockopt,,
217 [#ifdef HAVE_SYS_TYPES_H
218 #include <sys/types.h>
220 #ifdef HAVE_SYS_SOCKET_H
221 #include <sys/socket.h>
224 AC_FIND_FUNC_NO_LIBS(setsockopt,,
225 [#ifdef HAVE_SYS_TYPES_H
226 #include <sys/types.h>
228 #ifdef HAVE_SYS_SOCKET_H
229 #include <sys/socket.h>
233 AC_FIND_IF_NOT_BROKEN(hstrerror, resolv,
244 AC_FOREACH([rk_func], [asprintf vasprintf asnprintf vasnprintf],
247 #include <string.h>],
250 AC_FIND_FUNC_NO_LIBS(bswap16,,
251 [#ifdef HAVE_SYS_TYPES_H
252 #include <sys/types.h>
254 #ifdef HAVE_SYS_BSWAP_H
255 #include <sys/bswap.h>
258 AC_FIND_FUNC_NO_LIBS(bswap32,,
259 [#ifdef HAVE_SYS_TYPES_H
260 #include <sys/types.h>
262 #ifdef HAVE_SYS_BSWAP_H
263 #include <sys/bswap.h>
266 AC_FIND_FUNC_NO_LIBS(pidfile,util,
271 AC_FIND_IF_NOT_BROKEN(getaddrinfo,,
275 #ifdef HAVE_WS2TCPIP_H
276 #include <ws2tcpip.h>
279 AC_FIND_IF_NOT_BROKEN(getnameinfo,,
283 #ifdef HAVE_WS2TCPIP_H
284 #include <ws2tcpip.h>
285 #endif],[0,0,0,0,0,0,0])
287 AC_FIND_IF_NOT_BROKEN(freeaddrinfo,,
291 #ifdef HAVE_WS2TCPIP_H
292 #include <ws2tcpip.h>
295 AC_FIND_IF_NOT_BROKEN(gai_strerror,,
299 #ifdef HAVE_WS2TCPIP_H
300 #include <ws2tcpip.h>
303 dnl Darwin is weird, and in some senses not unix, launchd doesn't want
304 dnl servers to use daemon(), so its deprecated.
309 AC_DEFINE([SUPPORT_DETACH], 1,
310 [Define if os support want to detach is daemonens.])
311 AC_BROKEN([daemon]) ;;
384 AM_CONDITIONAL(have_fnmatch_h,
385 test "$ac_cv_header_fnmatch_h" = yes -a "$ac_cv_func_fnmatch" = yes)
387 AC_FOREACH([rk_func], [strndup strsep strtok_r],
388 [AC_NEED_PROTO([#include <string.h>], rk_func)])
390 AC_FOREACH([rk_func], [strsvis strsvisx strunvis strvis strvisx svis unvis vis],
391 [AC_NEED_PROTO([#ifdef HAVE_VIS_H
395 AC_MSG_CHECKING([checking for dirfd])
396 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
401 [[DIR *d = 0; dirfd(d);]])],
402 [ac_rk_have_dirfd=yes], [ac_rk_have_dirfd=no])
403 if test "$ac_rk_have_dirfd" = "yes" ; then
404 AC_DEFINE_UNQUOTED(HAVE_DIRFD, 1, [have a dirfd function/macro])
406 AC_MSG_RESULT($ac_rk_have_dirfd)
408 AC_HAVE_STRUCT_FIELD(DIR, dd_fd, [#include <sys/types.h>
414 AC_BROKEN2(inet_aton,
415 [#ifdef HAVE_SYS_TYPES_H
416 #include <sys/types.h>
418 #ifdef HAVE_SYS_SOCKET_H
419 #include <sys/socket.h>
421 #ifdef HAVE_NETINET_IN_H
422 #include <netinet/in.h>
424 #ifdef HAVE_ARPA_INET_H
425 #include <arpa/inet.h>
429 AC_BROKEN2(inet_ntop,
430 [#ifdef HAVE_SYS_TYPES_H
431 #include <sys/types.h>
433 #ifdef HAVE_SYS_SOCKET_H
434 #include <sys/socket.h>
436 #ifdef HAVE_NETINET_IN_H
437 #include <netinet/in.h>
439 #ifdef HAVE_ARPA_INET_H
440 #include <arpa/inet.h>
444 AC_BROKEN2(inet_pton,
445 [#ifdef HAVE_SYS_TYPES_H
446 #include <sys/types.h>
448 #ifdef HAVE_SYS_SOCKET_H
449 #include <sys/socket.h>
451 #ifdef HAVE_NETINET_IN_H
452 #include <netinet/in.h>
454 #ifdef HAVE_ARPA_INET_H
455 #include <arpa/inet.h>
460 dnl Check for sa_len in struct sockaddr,
461 dnl needs to come before the getnameinfo test
463 AC_HAVE_STRUCT_FIELD(struct sockaddr, sa_len, [#include <sys/types.h>
464 #include <sys/socket.h>])
466 if test "$ac_cv_func_getaddrinfo" = "yes"; then
467 rk_BROKEN_GETADDRINFO
468 if test "$ac_cv_func_getaddrinfo_numserv" = no; then
469 AC_LIBOBJ(getaddrinfo)
470 AC_LIBOBJ(freeaddrinfo)
474 AC_NEED_PROTO([#include <stdlib.h>], setenv)
475 AC_NEED_PROTO([#include <stdlib.h>], unsetenv)
476 AC_NEED_PROTO([#include <unistd.h>], gethostname)
477 AC_NEED_PROTO([#include <unistd.h>], mkstemp)
478 AC_NEED_PROTO([#include <unistd.h>], getusershell)
479 AC_NEED_PROTO([#include <unistd.h>], daemon)
481 #ifdef HAVE_SYS_TYPES_H
482 #include <sys/types.h>
484 #ifdef HAVE_SYS_SOCKET_H
485 #include <sys/socket.h>
487 #ifdef HAVE_NETINET_IN_H
488 #include <netinet/in.h>
490 #ifdef HAVE_ARPA_INET_H
491 #include <arpa/inet.h>
502 #ifdef HAVE_SYS_TYPES_H
503 #include <sys/types.h>
505 #ifdef HAVE_SYS_SOCKET_H
506 #include <sys/socket.h>
508 #ifdef HAVE_NETINET_IN_H
509 #include <netinet/in.h>
511 #ifdef HAVE_ARPA_INET_H
512 #include <arpa/inet.h>
516 AC_FIND_FUNC_NO_LIBS(crypt, crypt)dnl
518 AC_REQUIRE([rk_BROKEN_REALLOC])dnl
520 dnl AC_KRB_FUNC_GETCWD_BROKEN
522 dnl strerror_r is great fun, on linux it exists before sus catched up,
523 dnl so the return type is diffrent, lets check for both
529 strerror_r, int strerror_r(int, char *, size_t))
531 AC_CHECK_FUNC([strerror_r],
532 [AC_DEFINE_UNQUOTED(HAVE_STRERROR_R, 1,
533 [Define if you have the function strerror_r.])])
536 dnl Checks for prototypes and declarations
540 #ifdef HAVE_SYS_TYPES_H
541 #include <sys/types.h>
543 #ifdef HAVE_SYS_SOCKET_H
544 #include <sys/socket.h>
546 #ifdef HAVE_NETINET_IN_H
547 #include <netinet/in.h>
549 #ifdef HAVE_ARPA_INET_H
550 #include <arpa/inet.h>
556 gethostbyname, struct hostent *gethostbyname(const char *))
559 #ifdef HAVE_SYS_TYPES_H
560 #include <sys/types.h>
562 #ifdef HAVE_SYS_SOCKET_H
563 #include <sys/socket.h>
565 #ifdef HAVE_NETINET_IN_H
566 #include <netinet/in.h>
568 #ifdef HAVE_ARPA_INET_H
569 #include <arpa/inet.h>
575 gethostbyaddr, struct hostent *gethostbyaddr(const void *, size_t, int))
578 #ifdef HAVE_SYS_TYPES_H
579 #include <sys/types.h>
581 #ifdef HAVE_SYS_SOCKET_H
582 #include <sys/socket.h>
584 #ifdef HAVE_NETINET_IN_H
585 #include <netinet/in.h>
587 #ifdef HAVE_ARPA_INET_H
588 #include <arpa/inet.h>
594 getservbyname, struct servent *getservbyname(const char *, const char *))
597 #ifdef HAVE_SYS_TYPES_H
598 #include <sys/types.h>
600 #ifdef HAVE_SYS_SOCKET_H
601 #include <sys/socket.h>
604 getsockname, int getsockname(int, struct sockaddr*, socklen_t*))
611 openlog, void openlog(const char *, int, int))
625 rk_CHECK_VAR(h_errno,
626 [#ifdef HAVE_SYS_TYPES_H
627 #include <sys/types.h>
632 #ifdef HAVE_WS2TCPIP_H
633 #include <ws2tcpip.h>
637 rk_CHECK_VAR(h_errlist,
641 #ifdef HAVE_WS2TCPIP_H
642 #include <ws2tcpip.h>
649 #ifdef HAVE_WS2TCPIP_H
650 #include <ws2tcpip.h>
653 rk_CHECK_VAR([__progname],
658 AC_CHECK_DECLS([optarg, optind, opterr, optopt, environ],[],[],[
665 dnl Check for fields in struct tm
668 AC_HAVE_STRUCT_FIELD(struct tm, tm_gmtoff, [#include <time.h>])
669 AC_HAVE_STRUCT_FIELD(struct tm, tm_zone, [#include <time.h>])
672 dnl or do we have a variable `timezone' ?
675 rk_CHECK_VAR(timezone,[#include <time.h>])
676 rk_CHECK_VAR(altzone,[#include <time.h>])
678 AC_HAVE_TYPE([sa_family_t],[
679 #include <sys/types.h>
680 #ifdef HAVE_SYS_SOCKET_H
681 #include <sys/socket.h>
683 #ifdef HAVE_WS2TCPIP_H
684 #include <ws2tcpip.h>
686 AC_HAVE_TYPE([socklen_t],[
687 #include <sys/types.h>
688 #ifdef HAVE_SYS_SOCKET_H
689 #include <sys/socket.h>
691 #ifdef HAVE_WS2TCPIP_H
692 #include <ws2tcpip.h>
694 AC_HAVE_TYPE([struct sockaddr], [
695 #include <sys/types.h>
696 #ifdef HAVE_SYS_SOCKET_H
697 #include <sys/socket.h>
699 #ifdef HAVE_WS2TCPIP_H
700 #include <ws2tcpip.h>
702 AC_HAVE_TYPE([struct sockaddr_storage], [
703 #include <sys/types.h>
704 #ifdef HAVE_SYS_SOCKET_H
705 #include <sys/socket.h>
707 #ifdef HAVE_WS2TCPIP_H
708 #include <ws2tcpip.h>
710 AC_HAVE_TYPE([struct addrinfo], [
711 #include <sys/types.h>
715 #ifdef HAVE_WS2TCPIP_H
716 #include <ws2tcpip.h>
718 AC_HAVE_TYPE([struct ifaddrs], [#include <ifaddrs.h>])
719 AC_HAVE_TYPE([struct iovec],[
720 #include <sys/types.h>
723 AC_HAVE_TYPE([struct msghdr],[
724 #include <sys/types.h>
725 #ifdef HAVE_SYS_SOCKET_H
726 #include <sys/socket.h>
728 #ifdef HAVE_WS2TCPIP_H
729 #include <ws2tcpip.h>
733 dnl Check for struct winsize
736 AC_KRB_STRUCT_WINSIZE
739 dnl Check for struct spwd
745 # Check if we want samba's socket wrapper
750 dnl won't work with automake
751 dnl moved to AC_OUTPUT in configure.in
752 dnl AC_CONFIG_FILES($1/Makefile)
754 LIB_roken="${LIB_roken} \$(LIB_crypt) \$(LIB_dbopen)"
756 AC_SUBST(DIR_roken)dnl
757 AC_SUBST(LIB_roken)dnl
758 AC_SUBST(INCLUDES_roken)dnl