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])
94 AC_HAVE_TYPE([uintptr_t],[#ifdef HAVE_STDINT_H
98 dnl Sunpro 5.2 has a vis.h which is something different.
99 AC_CHECK_HEADERS(vis.h, , , [
105 AC_CHECK_HEADERS(netdb.h, , , [AC_INCLUDES_DEFAULT
106 #ifdef HAVE_SYS_TYPES_H
107 #include <sys/types.h>
111 AC_CHECK_HEADERS(sys/socket.h, , , [AC_INCLUDES_DEFAULT
112 #ifdef HAVE_SYS_TYPES_H
113 #include <sys/types.h>
117 AC_CHECK_HEADERS(net/if.h, , , [AC_INCLUDES_DEFAULT
118 #ifdef HAVE_SYS_TYPES_H
119 #include <sys/types.h>
121 #if HAVE_SYS_SOCKET_H
122 #include <sys/socket.h>
125 AC_CHECK_HEADERS(netinet6/in6_var.h, , , [AC_INCLUDES_DEFAULT
126 #ifdef HAVE_SYS_TYPES_H
127 #include <sys/types.h>
129 #if HAVE_SYS_SOCKET_H
130 #include <sys/socket.h>
132 #ifdef HAVE_NETINET6_IN6_H
133 #include <netinet6/in6.h>
137 AC_CHECK_HEADERS(sys/sysctl.h, , , [AC_INCLUDES_DEFAULT
138 #ifdef HAVE_SYS_PARAM_H
139 #include <sys/param.h>
143 AC_CHECK_HEADERS(sys/proc.h, , , [AC_INCLUDES_DEFAULT
144 #ifdef HAVE_SYS_PARAM_H
145 #include <sys/param.h>
149 AC_REQUIRE([CHECK_NETINET_IP_AND_TCP])
151 AM_CONDITIONAL(have_err_h, test "$ac_cv_header_err_h" = yes)
152 AM_CONDITIONAL(have_ifaddrs_h, test "$ac_cv_header_ifaddrs_h" = yes)
153 AM_CONDITIONAL(have_search_h, test "$ac_cv_header_search_h" = yes)
154 AM_CONDITIONAL(have_vis_h, test "$ac_cv_header_vis_h" = yes)
156 dnl Check for functions and libraries
158 AC_FIND_FUNC(socket, socket)
159 AC_FIND_FUNC(gethostbyname, nsl)
160 AC_FIND_FUNC(syslog, syslog)
164 AC_FIND_FUNC(gethostbyname2, inet6 ip6)
172 if test "$ac_cv_func_glob_working" != yes; then
175 AM_CONDITIONAL(have_glob_h, test "$ac_cv_func_glob_working" = yes)
210 if test "$ac_cv_func_cgetent" = no; then
213 AM_CONDITIONAL(have_cgetent, test "$ac_cv_func_cgetent" = yes)
215 AC_REQUIRE([AC_FUNC_GETLOGIN])
217 AC_REQUIRE([AC_FUNC_MMAP])
219 AC_FIND_FUNC_NO_LIBS(getsockopt,,
220 [#ifdef HAVE_SYS_TYPES_H
221 #include <sys/types.h>
223 #ifdef HAVE_SYS_SOCKET_H
224 #include <sys/socket.h>
227 AC_FIND_FUNC_NO_LIBS(setsockopt,,
228 [#ifdef HAVE_SYS_TYPES_H
229 #include <sys/types.h>
231 #ifdef HAVE_SYS_SOCKET_H
232 #include <sys/socket.h>
236 AC_FIND_IF_NOT_BROKEN(hstrerror, resolv,
247 AC_FOREACH([rk_func], [asprintf vasprintf asnprintf vasnprintf],
250 #include <string.h>],
253 AC_FIND_FUNC_NO_LIBS(bswap16,,
254 [#ifdef HAVE_SYS_TYPES_H
255 #include <sys/types.h>
257 #ifdef HAVE_SYS_BSWAP_H
258 #include <sys/bswap.h>
261 AC_FIND_FUNC_NO_LIBS(bswap32,,
262 [#ifdef HAVE_SYS_TYPES_H
263 #include <sys/types.h>
265 #ifdef HAVE_SYS_BSWAP_H
266 #include <sys/bswap.h>
269 AC_FIND_FUNC_NO_LIBS(pidfile,util,
274 AC_FIND_IF_NOT_BROKEN(getaddrinfo,,
278 #ifdef HAVE_WS2TCPIP_H
279 #include <ws2tcpip.h>
282 AC_FIND_IF_NOT_BROKEN(getnameinfo,,
286 #ifdef HAVE_WS2TCPIP_H
287 #include <ws2tcpip.h>
288 #endif],[0,0,0,0,0,0,0])
290 AC_FIND_IF_NOT_BROKEN(freeaddrinfo,,
294 #ifdef HAVE_WS2TCPIP_H
295 #include <ws2tcpip.h>
298 AC_FIND_IF_NOT_BROKEN(gai_strerror,,
302 #ifdef HAVE_WS2TCPIP_H
303 #include <ws2tcpip.h>
306 dnl Darwin is weird, and in some senses not unix, launchd doesn't want
307 dnl servers to use daemon(), so its deprecated.
312 AC_DEFINE([SUPPORT_DETACH], 1,
313 [Define if os support want to detach is daemonens.])
314 AC_BROKEN([daemon]) ;;
388 AM_CONDITIONAL(have_fnmatch_h,
389 test "$ac_cv_header_fnmatch_h" = yes -a "$ac_cv_func_fnmatch" = yes)
391 AC_FOREACH([rk_func], [strndup strsep strtok_r],
392 [AC_NEED_PROTO([#include <string.h>], rk_func)])
394 AC_FOREACH([rk_func], [strsvis strsvisx strunvis strvis strvisx svis unvis vis],
395 [AC_NEED_PROTO([#ifdef HAVE_VIS_H
399 AC_MSG_CHECKING([checking for dirfd])
400 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
405 [[DIR *d = 0; dirfd(d);]])],
406 [ac_rk_have_dirfd=yes], [ac_rk_have_dirfd=no])
407 if test "$ac_rk_have_dirfd" = "yes" ; then
408 AC_DEFINE_UNQUOTED(HAVE_DIRFD, 1, [have a dirfd function/macro])
410 AC_MSG_RESULT($ac_rk_have_dirfd)
412 AC_HAVE_STRUCT_FIELD(DIR, dd_fd, [#include <sys/types.h>
418 AC_BROKEN2(inet_aton,
419 [#ifdef HAVE_SYS_TYPES_H
420 #include <sys/types.h>
422 #ifdef HAVE_SYS_SOCKET_H
423 #include <sys/socket.h>
425 #ifdef HAVE_NETINET_IN_H
426 #include <netinet/in.h>
428 #ifdef HAVE_ARPA_INET_H
429 #include <arpa/inet.h>
433 AC_BROKEN2(inet_ntop,
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_pton,
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>
464 dnl Check for sa_len in struct sockaddr,
465 dnl needs to come before the getnameinfo test
467 AC_HAVE_STRUCT_FIELD(struct sockaddr, sa_len, [#include <sys/types.h>
468 #include <sys/socket.h>])
470 if test "$ac_cv_func_getaddrinfo" = "yes"; then
471 rk_BROKEN_GETADDRINFO
472 if test "$ac_cv_func_getaddrinfo_numserv" = no; then
473 AC_LIBOBJ(getaddrinfo)
474 AC_LIBOBJ(freeaddrinfo)
478 AC_NEED_PROTO([#include <stdlib.h>], setenv)
479 AC_NEED_PROTO([#include <stdlib.h>], unsetenv)
480 AC_NEED_PROTO([#include <unistd.h>], gethostname)
481 AC_NEED_PROTO([#include <unistd.h>], mkstemp)
482 AC_NEED_PROTO([#include <unistd.h>], getusershell)
483 AC_NEED_PROTO([#include <unistd.h>], daemon)
485 #ifdef HAVE_SYS_TYPES_H
486 #include <sys/types.h>
488 #ifdef HAVE_SYS_SOCKET_H
489 #include <sys/socket.h>
491 #ifdef HAVE_NETINET_IN_H
492 #include <netinet/in.h>
494 #ifdef HAVE_ARPA_INET_H
495 #include <arpa/inet.h>
506 #ifdef HAVE_SYS_TYPES_H
507 #include <sys/types.h>
509 #ifdef HAVE_SYS_SOCKET_H
510 #include <sys/socket.h>
512 #ifdef HAVE_NETINET_IN_H
513 #include <netinet/in.h>
515 #ifdef HAVE_ARPA_INET_H
516 #include <arpa/inet.h>
520 AC_FIND_FUNC_NO_LIBS(crypt, crypt)dnl
522 AC_REQUIRE([rk_BROKEN_REALLOC])dnl
524 dnl AC_KRB_FUNC_GETCWD_BROKEN
526 dnl strerror_r is great fun, on linux it exists before sus catched up,
527 dnl so the return type is diffrent, lets check for both
533 strerror_r, int strerror_r(int, char *, size_t))
535 AC_CHECK_FUNC([strerror_r],
536 [AC_DEFINE_UNQUOTED(HAVE_STRERROR_R, 1,
537 [Define if you have the function strerror_r.])])
540 dnl Checks for prototypes and declarations
544 #ifdef HAVE_SYS_TYPES_H
545 #include <sys/types.h>
547 #ifdef HAVE_SYS_SOCKET_H
548 #include <sys/socket.h>
550 #ifdef HAVE_NETINET_IN_H
551 #include <netinet/in.h>
553 #ifdef HAVE_ARPA_INET_H
554 #include <arpa/inet.h>
560 gethostbyname, struct hostent *gethostbyname(const char *))
563 #ifdef HAVE_SYS_TYPES_H
564 #include <sys/types.h>
566 #ifdef HAVE_SYS_SOCKET_H
567 #include <sys/socket.h>
569 #ifdef HAVE_NETINET_IN_H
570 #include <netinet/in.h>
572 #ifdef HAVE_ARPA_INET_H
573 #include <arpa/inet.h>
579 gethostbyaddr, struct hostent *gethostbyaddr(const void *, size_t, int))
582 #ifdef HAVE_SYS_TYPES_H
583 #include <sys/types.h>
585 #ifdef HAVE_SYS_SOCKET_H
586 #include <sys/socket.h>
588 #ifdef HAVE_NETINET_IN_H
589 #include <netinet/in.h>
591 #ifdef HAVE_ARPA_INET_H
592 #include <arpa/inet.h>
598 getservbyname, struct servent *getservbyname(const char *, const char *))
601 #ifdef HAVE_SYS_TYPES_H
602 #include <sys/types.h>
604 #ifdef HAVE_SYS_SOCKET_H
605 #include <sys/socket.h>
608 getsockname, int getsockname(int, struct sockaddr*, socklen_t*))
615 openlog, void openlog(const char *, int, int))
629 rk_CHECK_VAR(h_errno,
630 [#ifdef HAVE_SYS_TYPES_H
631 #include <sys/types.h>
636 #ifdef HAVE_WS2TCPIP_H
637 #include <ws2tcpip.h>
641 rk_CHECK_VAR(h_errlist,
645 #ifdef HAVE_WS2TCPIP_H
646 #include <ws2tcpip.h>
653 #ifdef HAVE_WS2TCPIP_H
654 #include <ws2tcpip.h>
657 rk_CHECK_VAR([__progname],
662 AC_CHECK_DECLS([optarg, optind, opterr, optopt, environ],[],[],[
669 dnl Check for fields in struct tm
672 AC_HAVE_STRUCT_FIELD(struct tm, tm_gmtoff, [#include <time.h>])
673 AC_HAVE_STRUCT_FIELD(struct tm, tm_zone, [#include <time.h>])
676 dnl or do we have a variable `timezone' ?
679 rk_CHECK_VAR(timezone,[#include <time.h>])
680 rk_CHECK_VAR(altzone,[#include <time.h>])
682 AC_HAVE_TYPE([sa_family_t],[
683 #include <sys/types.h>
684 #ifdef HAVE_SYS_SOCKET_H
685 #include <sys/socket.h>
687 #ifdef HAVE_WS2TCPIP_H
688 #include <ws2tcpip.h>
690 AC_HAVE_TYPE([socklen_t],[
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>
698 AC_HAVE_TYPE([struct sockaddr], [
699 #include <sys/types.h>
700 #ifdef HAVE_SYS_SOCKET_H
701 #include <sys/socket.h>
703 #ifdef HAVE_WS2TCPIP_H
704 #include <ws2tcpip.h>
706 AC_HAVE_TYPE([struct sockaddr_storage], [
707 #include <sys/types.h>
708 #ifdef HAVE_SYS_SOCKET_H
709 #include <sys/socket.h>
711 #ifdef HAVE_WS2TCPIP_H
712 #include <ws2tcpip.h>
714 AC_HAVE_TYPE([struct addrinfo], [
715 #include <sys/types.h>
719 #ifdef HAVE_WS2TCPIP_H
720 #include <ws2tcpip.h>
722 AC_HAVE_TYPE([struct ifaddrs], [#include <ifaddrs.h>])
723 AC_HAVE_TYPE([struct iovec],[
724 #include <sys/types.h>
727 AC_HAVE_TYPE([struct msghdr],[
728 #include <sys/types.h>
729 #ifdef HAVE_SYS_SOCKET_H
730 #include <sys/socket.h>
732 #ifdef HAVE_WS2TCPIP_H
733 #include <ws2tcpip.h>
737 dnl Check for struct winsize
740 AC_KRB_STRUCT_WINSIZE
743 dnl Check for struct spwd
749 # Check if we want samba's socket wrapper
754 dnl won't work with automake
755 dnl moved to AC_OUTPUT in configure.in
756 dnl AC_CONFIG_FILES($1/Makefile)
758 LIB_roken="${LIB_roken} \$(LIB_crypt) \$(LIB_dbopen)"
760 AC_SUBST(DIR_roken)dnl
761 AC_SUBST(LIB_roken)dnl
762 AC_SUBST(INCLUDES_roken)dnl