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])
99 AC_HAVE_TYPE([uintptr_t],[#ifdef HAVE_STDINT_H
103 dnl Sunpro 5.2 has a vis.h which is something different.
104 AC_CHECK_HEADERS(vis.h, , , [
110 AC_CHECK_HEADERS(netdb.h, , , [AC_INCLUDES_DEFAULT
111 #ifdef HAVE_SYS_TYPES_H
112 #include <sys/types.h>
116 AC_CHECK_HEADERS(sys/socket.h, , , [AC_INCLUDES_DEFAULT
117 #ifdef HAVE_SYS_TYPES_H
118 #include <sys/types.h>
122 AC_CHECK_HEADERS(net/if.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>
130 AC_CHECK_HEADERS(netinet6/in6_var.h, , , [AC_INCLUDES_DEFAULT
131 #ifdef HAVE_SYS_TYPES_H
132 #include <sys/types.h>
134 #if HAVE_SYS_SOCKET_H
135 #include <sys/socket.h>
137 #ifdef HAVE_NETINET6_IN6_H
138 #include <netinet6/in6.h>
142 AC_CHECK_HEADERS(sys/sysctl.h, , , [AC_INCLUDES_DEFAULT
143 #ifdef HAVE_SYS_PARAM_H
144 #include <sys/param.h>
148 AC_CHECK_HEADERS(sys/proc.h, , , [AC_INCLUDES_DEFAULT
149 #ifdef HAVE_SYS_PARAM_H
150 #include <sys/param.h>
154 AC_REQUIRE([CHECK_NETINET_IP_AND_TCP])
156 AM_CONDITIONAL(have_err_h, test "$ac_cv_header_err_h" = yes)
157 AM_CONDITIONAL(have_ifaddrs_h, test "$ac_cv_header_ifaddrs_h" = yes)
158 AM_CONDITIONAL(have_search_h, test "$ac_cv_header_search_h" = yes)
159 AM_CONDITIONAL(have_vis_h, test "$ac_cv_header_vis_h" = yes)
161 dnl Check for functions and libraries
163 AC_FIND_FUNC(socket, socket)
164 AC_FIND_FUNC(gethostbyname, nsl)
165 AC_FIND_FUNC(syslog, syslog)
169 AC_FIND_FUNC(gethostbyname2, inet6 ip6)
177 if test "$ac_cv_func_glob_working" != yes; then
180 AM_CONDITIONAL(have_glob_h, test "$ac_cv_func_glob_working" = yes)
216 if test "$ac_cv_func_cgetent" = no; then
219 AM_CONDITIONAL(have_cgetent, test "$ac_cv_func_cgetent" = yes)
221 AC_REQUIRE([AC_FUNC_GETLOGIN])
223 AC_REQUIRE([AC_FUNC_MMAP])
225 AC_FIND_FUNC_NO_LIBS(getsockopt,,
226 [#ifdef HAVE_SYS_TYPES_H
227 #include <sys/types.h>
229 #ifdef HAVE_SYS_SOCKET_H
230 #include <sys/socket.h>
233 AC_FIND_FUNC_NO_LIBS(setsockopt,,
234 [#ifdef HAVE_SYS_TYPES_H
235 #include <sys/types.h>
237 #ifdef HAVE_SYS_SOCKET_H
238 #include <sys/socket.h>
242 AC_FIND_IF_NOT_BROKEN(hstrerror, resolv,
253 AC_FOREACH([rk_func], [asprintf vasprintf asnprintf vasnprintf],
256 #include <string.h>],
259 AC_FIND_FUNC_NO_LIBS(bswap16,,
260 [#ifdef HAVE_SYS_TYPES_H
261 #include <sys/types.h>
263 #ifdef HAVE_SYS_BSWAP_H
264 #include <sys/bswap.h>
267 AC_FIND_FUNC_NO_LIBS(bswap32,,
268 [#ifdef HAVE_SYS_TYPES_H
269 #include <sys/types.h>
271 #ifdef HAVE_SYS_BSWAP_H
272 #include <sys/bswap.h>
275 AC_FIND_FUNC_NO_LIBS(bswap64,,
276 [#ifdef HAVE_SYS_TYPES_H
277 #include <sys/types.h>
279 #ifdef HAVE_SYS_BSWAP_H
280 #include <sys/bswap.h>
283 AC_FIND_FUNC_NO_LIBS(pidfile,util,
288 AC_FIND_IF_NOT_BROKEN(getaddrinfo,,
292 #ifdef HAVE_WS2TCPIP_H
293 #include <ws2tcpip.h>
296 AC_FIND_IF_NOT_BROKEN(getnameinfo,,
300 #ifdef HAVE_WS2TCPIP_H
301 #include <ws2tcpip.h>
302 #endif],[0,0,0,0,0,0,0])
304 AC_FIND_IF_NOT_BROKEN(freeaddrinfo,,
308 #ifdef HAVE_WS2TCPIP_H
309 #include <ws2tcpip.h>
312 AC_FIND_IF_NOT_BROKEN(gai_strerror,,
316 #ifdef HAVE_WS2TCPIP_H
317 #include <ws2tcpip.h>
320 AC_CHECK_LIB(util, emalloc)
326 AC_BROKEN([daemon]) ;;
403 AM_CONDITIONAL(have_fnmatch_h,
404 test "$ac_cv_header_fnmatch_h" = yes -a "$ac_cv_func_fnmatch" = yes)
406 AC_FOREACH([rk_func], [strndup strsep strtok_r],
407 [AC_NEED_PROTO([#include <string.h>], rk_func)])
409 AC_CHECK_FUNC([strtoll],
410 [AC_DEFINE_UNQUOTED(HAVE_STRTOLL, 1,
411 [Define if you have the function strtoll.])])
413 AC_CHECK_FUNC([strtoull],
414 [AC_DEFINE_UNQUOTED(HAVE_STRTOULL, 1,
415 [Define if you have the function strtoull.])])
417 AC_FOREACH([rk_func], [strsvis strsvisx strunvis strvis strvisx svis unvis vis],
418 [AC_NEED_PROTO([#ifdef HAVE_VIS_H
422 AC_MSG_CHECKING([checking for dirfd])
423 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
428 [[DIR *d = 0; dirfd(d);]])],
429 [ac_rk_have_dirfd=yes], [ac_rk_have_dirfd=no])
430 if test "$ac_rk_have_dirfd" = "yes" ; then
431 AC_DEFINE_UNQUOTED(HAVE_DIRFD, 1, [have a dirfd function/macro])
433 AC_MSG_RESULT($ac_rk_have_dirfd)
435 AC_HAVE_STRUCT_FIELD(DIR, dd_fd, [#include <sys/types.h>
441 AC_BROKEN2(inet_aton,
442 [#ifdef HAVE_SYS_TYPES_H
443 #include <sys/types.h>
445 #ifdef HAVE_SYS_SOCKET_H
446 #include <sys/socket.h>
448 #ifdef HAVE_NETINET_IN_H
449 #include <netinet/in.h>
451 #ifdef HAVE_ARPA_INET_H
452 #include <arpa/inet.h>
456 AC_BROKEN2(inet_ntop,
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_BROKEN2(inet_pton,
472 [#ifdef HAVE_SYS_TYPES_H
473 #include <sys/types.h>
475 #ifdef HAVE_SYS_SOCKET_H
476 #include <sys/socket.h>
478 #ifdef HAVE_NETINET_IN_H
479 #include <netinet/in.h>
481 #ifdef HAVE_ARPA_INET_H
482 #include <arpa/inet.h>
487 dnl Check for sa_len in struct sockaddr,
488 dnl needs to come before the getnameinfo test
490 AC_HAVE_STRUCT_FIELD(struct sockaddr, sa_len, [#include <sys/types.h>
491 #include <sys/socket.h>])
493 if test "$ac_cv_func_getaddrinfo" = "yes"; then
494 rk_BROKEN_GETADDRINFO
495 if test "$ac_cv_func_getaddrinfo_numserv" = no; then
496 AC_LIBOBJ(getaddrinfo)
497 AC_LIBOBJ(freeaddrinfo)
501 AC_NEED_PROTO([#include <stdlib.h>], setenv)
502 AC_NEED_PROTO([#include <stdlib.h>], unsetenv)
503 AC_NEED_PROTO([#include <unistd.h>], gethostname)
504 AC_NEED_PROTO([#include <unistd.h>], mkstemp)
505 AC_NEED_PROTO([#include <unistd.h>], getusershell)
506 AC_NEED_PROTO([#include <unistd.h>], daemon)
508 #ifdef HAVE_SYS_TYPES_H
509 #include <sys/types.h>
511 #ifdef HAVE_SYS_SOCKET_H
512 #include <sys/socket.h>
514 #ifdef HAVE_NETINET_IN_H
515 #include <netinet/in.h>
517 #ifdef HAVE_ARPA_INET_H
518 #include <arpa/inet.h>
529 #ifdef HAVE_SYS_TYPES_H
530 #include <sys/types.h>
532 #ifdef HAVE_SYS_SOCKET_H
533 #include <sys/socket.h>
535 #ifdef HAVE_NETINET_IN_H
536 #include <netinet/in.h>
538 #ifdef HAVE_ARPA_INET_H
539 #include <arpa/inet.h>
543 AC_FIND_FUNC_NO_LIBS(crypt, crypt)dnl
545 AC_REQUIRE([rk_BROKEN_REALLOC])dnl
547 dnl AC_KRB_FUNC_GETCWD_BROKEN
549 dnl strerror_r is great fun, on linux it exists before sus catched up,
550 dnl so the return type is diffrent, lets check for both
556 strerror_r, int strerror_r(int, char *, size_t))
558 AC_CHECK_FUNC([strerror_r],
559 [AC_DEFINE_UNQUOTED(HAVE_STRERROR_R, 1,
560 [Define if you have the function strerror_r.])])
563 dnl Checks for prototypes and declarations
567 #ifdef HAVE_SYS_TYPES_H
568 #include <sys/types.h>
570 #ifdef HAVE_SYS_SOCKET_H
571 #include <sys/socket.h>
573 #ifdef HAVE_NETINET_IN_H
574 #include <netinet/in.h>
576 #ifdef HAVE_ARPA_INET_H
577 #include <arpa/inet.h>
583 gethostbyname, struct hostent *gethostbyname(const char *))
586 #ifdef HAVE_SYS_TYPES_H
587 #include <sys/types.h>
589 #ifdef HAVE_SYS_SOCKET_H
590 #include <sys/socket.h>
592 #ifdef HAVE_NETINET_IN_H
593 #include <netinet/in.h>
595 #ifdef HAVE_ARPA_INET_H
596 #include <arpa/inet.h>
602 gethostbyaddr, struct hostent *gethostbyaddr(const void *, size_t, int))
605 #ifdef HAVE_SYS_TYPES_H
606 #include <sys/types.h>
608 #ifdef HAVE_SYS_SOCKET_H
609 #include <sys/socket.h>
611 #ifdef HAVE_NETINET_IN_H
612 #include <netinet/in.h>
614 #ifdef HAVE_ARPA_INET_H
615 #include <arpa/inet.h>
621 getservbyname, struct servent *getservbyname(const char *, const char *))
624 #ifdef HAVE_SYS_TYPES_H
625 #include <sys/types.h>
627 #ifdef HAVE_SYS_SOCKET_H
628 #include <sys/socket.h>
631 getsockname, int getsockname(int, struct sockaddr*, socklen_t*))
638 openlog, void openlog(const char *, int, int))
652 rk_CHECK_VAR(h_errno,
653 [#ifdef HAVE_SYS_TYPES_H
654 #include <sys/types.h>
659 #ifdef HAVE_WS2TCPIP_H
660 #include <ws2tcpip.h>
664 rk_CHECK_VAR(h_errlist,
668 #ifdef HAVE_WS2TCPIP_H
669 #include <ws2tcpip.h>
676 #ifdef HAVE_WS2TCPIP_H
677 #include <ws2tcpip.h>
680 rk_CHECK_VAR([__progname],
685 AC_CHECK_DECLS([optarg, optind, opterr, optopt, environ],[],[],[
692 dnl Check for fields in struct tm
695 AC_HAVE_STRUCT_FIELD(struct tm, tm_gmtoff, [#include <time.h>])
696 AC_HAVE_STRUCT_FIELD(struct tm, tm_zone, [#include <time.h>])
699 dnl or do we have a variable `timezone' ?
702 rk_CHECK_VAR(timezone,[#include <time.h>])
703 rk_CHECK_VAR(altzone,[#include <time.h>])
705 AC_HAVE_TYPE([sa_family_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([socklen_t],[
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], [
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 sockaddr_storage], [
730 #include <sys/types.h>
731 #ifdef HAVE_SYS_SOCKET_H
732 #include <sys/socket.h>
734 #ifdef HAVE_WS2TCPIP_H
735 #include <ws2tcpip.h>
737 AC_HAVE_TYPE([struct addrinfo], [
738 #include <sys/types.h>
742 #ifdef HAVE_WS2TCPIP_H
743 #include <ws2tcpip.h>
745 AC_HAVE_TYPE([struct ifaddrs], [#include <ifaddrs.h>])
746 AC_HAVE_TYPE([struct iovec],[
747 #include <sys/types.h>
750 AC_HAVE_TYPE([struct msghdr],[
751 #include <sys/types.h>
752 #ifdef HAVE_SYS_SOCKET_H
753 #include <sys/socket.h>
755 #ifdef HAVE_WS2TCPIP_H
756 #include <ws2tcpip.h>
760 dnl Check for struct winsize
763 AC_KRB_STRUCT_WINSIZE
766 dnl Check for struct spwd
772 # Check if we want samba's socket wrapper
777 dnl won't work with automake
778 dnl moved to AC_OUTPUT in configure.in
779 dnl AC_CONFIG_FILES($1/Makefile)
781 LIB_roken="${LIB_roken} \$(LIB_crypt) \$(LIB_dbopen)"
783 AC_SUBST(DIR_roken)dnl
784 AC_SUBST(LIB_roken)dnl
785 AC_SUBST(INCLUDES_roken)dnl