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])
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 -Wextra -Wno-sign-compare -Wno-unused-parameter -Wmissing-prototypes -Wpointer-arith -Wbad-function-cast -Wmissing-declarations -Wnested-externs -Wshadow)
33 dnl -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wstrict-prototypes
34 dnl -Wcast-qual -Wswitch -Wformat=2 -Wwrite-strings
40 AC_REQUIRE([AC_TYPE_SIZE_T])
41 AC_HAVE_TYPE([ssize_t],[#include <unistd.h>])
42 AC_REQUIRE([AC_TYPE_PID_T])
43 AC_REQUIRE([AC_TYPE_UID_T])
44 AC_HAVE_TYPE([long long])
46 AC_REQUIRE([rk_RETSIGTYPE])
48 dnl Checks for header files.
49 AC_REQUIRE([AC_HEADER_STDC])
50 AC_REQUIRE([AC_HEADER_TIME])
98 AC_HAVE_TYPE([uintptr_t],[#ifdef HAVE_STDINT_H
102 dnl Sunpro 5.2 has a vis.h which is something different.
103 AC_CHECK_HEADERS(vis.h, , , [
109 AC_CHECK_HEADERS(netdb.h, , , [AC_INCLUDES_DEFAULT
110 #ifdef HAVE_SYS_TYPES_H
111 #include <sys/types.h>
115 AC_CHECK_HEADERS(sys/socket.h, , , [AC_INCLUDES_DEFAULT
116 #ifdef HAVE_SYS_TYPES_H
117 #include <sys/types.h>
121 AC_CHECK_HEADERS(net/if.h, , , [AC_INCLUDES_DEFAULT
122 #ifdef HAVE_SYS_TYPES_H
123 #include <sys/types.h>
125 #if HAVE_SYS_SOCKET_H
126 #include <sys/socket.h>
129 AC_CHECK_HEADERS(netinet6/in6_var.h, , , [AC_INCLUDES_DEFAULT
130 #ifdef HAVE_SYS_TYPES_H
131 #include <sys/types.h>
133 #if HAVE_SYS_SOCKET_H
134 #include <sys/socket.h>
136 #ifdef HAVE_NETINET6_IN6_H
137 #include <netinet6/in6.h>
141 AC_CHECK_HEADERS(sys/sysctl.h, , , [AC_INCLUDES_DEFAULT
142 #ifdef HAVE_SYS_PARAM_H
143 #include <sys/param.h>
147 AC_CHECK_HEADERS(sys/proc.h, , , [AC_INCLUDES_DEFAULT
148 #ifdef HAVE_SYS_PARAM_H
149 #include <sys/param.h>
153 AC_REQUIRE([CHECK_NETINET_IP_AND_TCP])
155 AM_CONDITIONAL(have_err_h, test "$ac_cv_header_err_h" = yes)
156 AM_CONDITIONAL(have_ifaddrs_h, test "$ac_cv_header_ifaddrs_h" = yes)
157 AM_CONDITIONAL(have_search_h, test "$ac_cv_header_search_h" = yes)
158 AM_CONDITIONAL(have_vis_h, test "$ac_cv_header_vis_h" = yes)
160 dnl Check for functions and libraries
162 AC_FIND_FUNC(socket, socket)
163 AC_FIND_FUNC(gethostbyname, nsl)
164 AC_FIND_FUNC(syslog, syslog)
168 AC_FIND_FUNC(gethostbyname2, inet6 ip6)
176 if test "$ac_cv_func_glob_working" != yes; then
179 AM_CONDITIONAL(have_glob_h, test "$ac_cv_func_glob_working" = yes)
214 if test "$ac_cv_func_cgetent" = no; then
217 AM_CONDITIONAL(have_cgetent, test "$ac_cv_func_cgetent" = yes)
219 AC_REQUIRE([AC_FUNC_GETLOGIN])
221 AC_REQUIRE([AC_FUNC_MMAP])
223 AC_FIND_FUNC_NO_LIBS(getsockopt,,
224 [#ifdef HAVE_SYS_TYPES_H
225 #include <sys/types.h>
227 #ifdef HAVE_SYS_SOCKET_H
228 #include <sys/socket.h>
231 AC_FIND_FUNC_NO_LIBS(setsockopt,,
232 [#ifdef HAVE_SYS_TYPES_H
233 #include <sys/types.h>
235 #ifdef HAVE_SYS_SOCKET_H
236 #include <sys/socket.h>
240 AC_FIND_IF_NOT_BROKEN(hstrerror, resolv,
251 AC_FOREACH([rk_func], [asprintf vasprintf asnprintf vasnprintf],
254 #include <string.h>],
257 AC_FIND_FUNC_NO_LIBS(bswap16,,
258 [#ifdef HAVE_SYS_TYPES_H
259 #include <sys/types.h>
261 #ifdef HAVE_SYS_BSWAP_H
262 #include <sys/bswap.h>
265 AC_FIND_FUNC_NO_LIBS(bswap32,,
266 [#ifdef HAVE_SYS_TYPES_H
267 #include <sys/types.h>
269 #ifdef HAVE_SYS_BSWAP_H
270 #include <sys/bswap.h>
273 AC_FIND_FUNC_NO_LIBS(pidfile,util,
278 AC_FIND_IF_NOT_BROKEN(getaddrinfo,,
282 #ifdef HAVE_WS2TCPIP_H
283 #include <ws2tcpip.h>
286 AC_FIND_IF_NOT_BROKEN(getnameinfo,,
290 #ifdef HAVE_WS2TCPIP_H
291 #include <ws2tcpip.h>
292 #endif],[0,0,0,0,0,0,0])
294 AC_FIND_IF_NOT_BROKEN(freeaddrinfo,,
298 #ifdef HAVE_WS2TCPIP_H
299 #include <ws2tcpip.h>
302 AC_FIND_IF_NOT_BROKEN(gai_strerror,,
306 #ifdef HAVE_WS2TCPIP_H
307 #include <ws2tcpip.h>
310 dnl Darwin is weird, and in some senses not unix, launchd doesn't want
311 dnl servers to use daemon(), so its deprecated.
316 AC_DEFINE([SUPPORT_DETACH], 1,
317 [Define if os support want to detach is daemonens.])
318 AC_BROKEN([daemon]) ;;
395 AM_CONDITIONAL(have_fnmatch_h,
396 test "$ac_cv_header_fnmatch_h" = yes -a "$ac_cv_func_fnmatch" = yes)
398 AC_FOREACH([rk_func], [strndup strsep strtok_r],
399 [AC_NEED_PROTO([#include <string.h>], rk_func)])
401 AC_CHECK_FUNC([strtoll],
402 [AC_DEFINE_UNQUOTED(HAVE_STRTOLL, 1,
403 [Define if you have the function strtoll.])])
405 AC_CHECK_FUNC([strtoull],
406 [AC_DEFINE_UNQUOTED(HAVE_STRTOULL, 1,
407 [Define if you have the function strtoull.])])
409 AC_FOREACH([rk_func], [strsvis strsvisx strunvis strvis strvisx svis unvis vis],
410 [AC_NEED_PROTO([#ifdef HAVE_VIS_H
414 AC_MSG_CHECKING([checking for dirfd])
415 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
420 [[DIR *d = 0; dirfd(d);]])],
421 [ac_rk_have_dirfd=yes], [ac_rk_have_dirfd=no])
422 if test "$ac_rk_have_dirfd" = "yes" ; then
423 AC_DEFINE_UNQUOTED(HAVE_DIRFD, 1, [have a dirfd function/macro])
425 AC_MSG_RESULT($ac_rk_have_dirfd)
427 AC_HAVE_STRUCT_FIELD(DIR, dd_fd, [#include <sys/types.h>
433 AC_BROKEN2(inet_aton,
434 [#ifdef HAVE_SYS_TYPES_H
435 #include <sys/types.h>
437 #ifdef HAVE_SYS_SOCKET_H
438 #include <sys/socket.h>
440 #ifdef HAVE_NETINET_IN_H
441 #include <netinet/in.h>
443 #ifdef HAVE_ARPA_INET_H
444 #include <arpa/inet.h>
448 AC_BROKEN2(inet_ntop,
449 [#ifdef HAVE_SYS_TYPES_H
450 #include <sys/types.h>
452 #ifdef HAVE_SYS_SOCKET_H
453 #include <sys/socket.h>
455 #ifdef HAVE_NETINET_IN_H
456 #include <netinet/in.h>
458 #ifdef HAVE_ARPA_INET_H
459 #include <arpa/inet.h>
463 AC_BROKEN2(inet_pton,
464 [#ifdef HAVE_SYS_TYPES_H
465 #include <sys/types.h>
467 #ifdef HAVE_SYS_SOCKET_H
468 #include <sys/socket.h>
470 #ifdef HAVE_NETINET_IN_H
471 #include <netinet/in.h>
473 #ifdef HAVE_ARPA_INET_H
474 #include <arpa/inet.h>
479 dnl Check for sa_len in struct sockaddr,
480 dnl needs to come before the getnameinfo test
482 AC_HAVE_STRUCT_FIELD(struct sockaddr, sa_len, [#include <sys/types.h>
483 #include <sys/socket.h>])
485 if test "$ac_cv_func_getaddrinfo" = "yes"; then
486 rk_BROKEN_GETADDRINFO
487 if test "$ac_cv_func_getaddrinfo_numserv" = no; then
488 AC_LIBOBJ(getaddrinfo)
489 AC_LIBOBJ(freeaddrinfo)
493 AC_NEED_PROTO([#include <stdlib.h>], setenv)
494 AC_NEED_PROTO([#include <stdlib.h>], unsetenv)
495 AC_NEED_PROTO([#include <unistd.h>], gethostname)
496 AC_NEED_PROTO([#include <unistd.h>], mkstemp)
497 AC_NEED_PROTO([#include <unistd.h>], getusershell)
498 AC_NEED_PROTO([#include <unistd.h>], daemon)
500 #ifdef HAVE_SYS_TYPES_H
501 #include <sys/types.h>
503 #ifdef HAVE_SYS_SOCKET_H
504 #include <sys/socket.h>
506 #ifdef HAVE_NETINET_IN_H
507 #include <netinet/in.h>
509 #ifdef HAVE_ARPA_INET_H
510 #include <arpa/inet.h>
521 #ifdef HAVE_SYS_TYPES_H
522 #include <sys/types.h>
524 #ifdef HAVE_SYS_SOCKET_H
525 #include <sys/socket.h>
527 #ifdef HAVE_NETINET_IN_H
528 #include <netinet/in.h>
530 #ifdef HAVE_ARPA_INET_H
531 #include <arpa/inet.h>
535 AC_FIND_FUNC_NO_LIBS(crypt, crypt)dnl
537 AC_REQUIRE([rk_BROKEN_REALLOC])dnl
539 dnl AC_KRB_FUNC_GETCWD_BROKEN
541 dnl strerror_r is great fun, on linux it exists before sus catched up,
542 dnl so the return type is diffrent, lets check for both
548 strerror_r, int strerror_r(int, char *, size_t))
550 AC_CHECK_FUNC([strerror_r],
551 [AC_DEFINE_UNQUOTED(HAVE_STRERROR_R, 1,
552 [Define if you have the function strerror_r.])])
555 dnl Checks for prototypes and declarations
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 gethostbyname, struct hostent *gethostbyname(const char *))
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 gethostbyaddr, struct hostent *gethostbyaddr(const void *, size_t, int))
597 #ifdef HAVE_SYS_TYPES_H
598 #include <sys/types.h>
600 #ifdef HAVE_SYS_SOCKET_H
601 #include <sys/socket.h>
603 #ifdef HAVE_NETINET_IN_H
604 #include <netinet/in.h>
606 #ifdef HAVE_ARPA_INET_H
607 #include <arpa/inet.h>
613 getservbyname, struct servent *getservbyname(const char *, const char *))
616 #ifdef HAVE_SYS_TYPES_H
617 #include <sys/types.h>
619 #ifdef HAVE_SYS_SOCKET_H
620 #include <sys/socket.h>
623 getsockname, int getsockname(int, struct sockaddr*, socklen_t*))
630 openlog, void openlog(const char *, int, int))
644 rk_CHECK_VAR(h_errno,
645 [#ifdef HAVE_SYS_TYPES_H
646 #include <sys/types.h>
651 #ifdef HAVE_WS2TCPIP_H
652 #include <ws2tcpip.h>
656 rk_CHECK_VAR(h_errlist,
660 #ifdef HAVE_WS2TCPIP_H
661 #include <ws2tcpip.h>
668 #ifdef HAVE_WS2TCPIP_H
669 #include <ws2tcpip.h>
672 rk_CHECK_VAR([__progname],
677 AC_CHECK_DECLS([optarg, optind, opterr, optopt, environ],[],[],[
684 dnl Check for fields in struct tm
687 AC_HAVE_STRUCT_FIELD(struct tm, tm_gmtoff, [#include <time.h>])
688 AC_HAVE_STRUCT_FIELD(struct tm, tm_zone, [#include <time.h>])
691 dnl or do we have a variable `timezone' ?
694 rk_CHECK_VAR(timezone,[#include <time.h>])
695 rk_CHECK_VAR(altzone,[#include <time.h>])
697 AC_HAVE_TYPE([sa_family_t],[
698 #include <sys/types.h>
699 #ifdef HAVE_SYS_SOCKET_H
700 #include <sys/socket.h>
702 #ifdef HAVE_WS2TCPIP_H
703 #include <ws2tcpip.h>
705 AC_HAVE_TYPE([socklen_t],[
706 #include <sys/types.h>
707 #ifdef HAVE_SYS_SOCKET_H
708 #include <sys/socket.h>
710 #ifdef HAVE_WS2TCPIP_H
711 #include <ws2tcpip.h>
713 AC_HAVE_TYPE([struct sockaddr], [
714 #include <sys/types.h>
715 #ifdef HAVE_SYS_SOCKET_H
716 #include <sys/socket.h>
718 #ifdef HAVE_WS2TCPIP_H
719 #include <ws2tcpip.h>
721 AC_HAVE_TYPE([struct sockaddr_storage], [
722 #include <sys/types.h>
723 #ifdef HAVE_SYS_SOCKET_H
724 #include <sys/socket.h>
726 #ifdef HAVE_WS2TCPIP_H
727 #include <ws2tcpip.h>
729 AC_HAVE_TYPE([struct addrinfo], [
730 #include <sys/types.h>
734 #ifdef HAVE_WS2TCPIP_H
735 #include <ws2tcpip.h>
737 AC_HAVE_TYPE([struct ifaddrs], [#include <ifaddrs.h>])
738 AC_HAVE_TYPE([struct iovec],[
739 #include <sys/types.h>
742 AC_HAVE_TYPE([struct msghdr],[
743 #include <sys/types.h>
744 #ifdef HAVE_SYS_SOCKET_H
745 #include <sys/socket.h>
747 #ifdef HAVE_WS2TCPIP_H
748 #include <ws2tcpip.h>
752 dnl Check for struct winsize
755 AC_KRB_STRUCT_WINSIZE
758 dnl Check for struct spwd
764 # Check if we want samba's socket wrapper
769 dnl won't work with automake
770 dnl moved to AC_OUTPUT in configure.in
771 dnl AC_CONFIG_FILES($1/Makefile)
773 LIB_roken="${LIB_roken} \$(LIB_crypt) \$(LIB_dbopen)"
775 AC_SUBST(DIR_roken)dnl
776 AC_SUBST(LIB_roken)dnl
777 AC_SUBST(INCLUDES_roken)dnl