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)
212 if test "$ac_cv_func_cgetent" = no; then
215 AM_CONDITIONAL(have_cgetent, test "$ac_cv_func_cgetent" = yes)
217 AC_REQUIRE([AC_FUNC_GETLOGIN])
219 AC_REQUIRE([AC_FUNC_MMAP])
221 AC_FIND_FUNC_NO_LIBS(getsockopt,,
222 [#ifdef HAVE_SYS_TYPES_H
223 #include <sys/types.h>
225 #ifdef HAVE_SYS_SOCKET_H
226 #include <sys/socket.h>
229 AC_FIND_FUNC_NO_LIBS(setsockopt,,
230 [#ifdef HAVE_SYS_TYPES_H
231 #include <sys/types.h>
233 #ifdef HAVE_SYS_SOCKET_H
234 #include <sys/socket.h>
238 AC_FIND_IF_NOT_BROKEN(hstrerror, resolv,
249 AC_FOREACH([rk_func], [asprintf vasprintf asnprintf vasnprintf],
252 #include <string.h>],
255 AC_FIND_FUNC_NO_LIBS(bswap16,,
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(bswap32,,
264 [#ifdef HAVE_SYS_TYPES_H
265 #include <sys/types.h>
267 #ifdef HAVE_SYS_BSWAP_H
268 #include <sys/bswap.h>
271 AC_FIND_FUNC_NO_LIBS(pidfile,util,
276 AC_FIND_IF_NOT_BROKEN(getaddrinfo,,
280 #ifdef HAVE_WS2TCPIP_H
281 #include <ws2tcpip.h>
284 AC_FIND_IF_NOT_BROKEN(getnameinfo,,
288 #ifdef HAVE_WS2TCPIP_H
289 #include <ws2tcpip.h>
290 #endif],[0,0,0,0,0,0,0])
292 AC_FIND_IF_NOT_BROKEN(freeaddrinfo,,
296 #ifdef HAVE_WS2TCPIP_H
297 #include <ws2tcpip.h>
300 AC_FIND_IF_NOT_BROKEN(gai_strerror,,
304 #ifdef HAVE_WS2TCPIP_H
305 #include <ws2tcpip.h>
308 dnl Darwin is weird, and in some senses not unix, launchd doesn't want
309 dnl servers to use daemon(), so its deprecated.
314 AC_DEFINE([SUPPORT_DETACH], 1,
315 [Define if os support want to detach is daemonens.])
316 AC_BROKEN([daemon]) ;;
390 AM_CONDITIONAL(have_fnmatch_h,
391 test "$ac_cv_header_fnmatch_h" = yes -a "$ac_cv_func_fnmatch" = yes)
393 AC_FOREACH([rk_func], [strndup strsep strtok_r],
394 [AC_NEED_PROTO([#include <string.h>], rk_func)])
396 AC_FOREACH([rk_func], [strsvis strsvisx strunvis strvis strvisx svis unvis vis],
397 [AC_NEED_PROTO([#ifdef HAVE_VIS_H
401 AC_MSG_CHECKING([checking for dirfd])
402 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
407 [[DIR *d = 0; dirfd(d);]])],
408 [ac_rk_have_dirfd=yes], [ac_rk_have_dirfd=no])
409 if test "$ac_rk_have_dirfd" = "yes" ; then
410 AC_DEFINE_UNQUOTED(HAVE_DIRFD, 1, [have a dirfd function/macro])
412 AC_MSG_RESULT($ac_rk_have_dirfd)
414 AC_HAVE_STRUCT_FIELD(DIR, dd_fd, [#include <sys/types.h>
420 AC_BROKEN2(inet_aton,
421 [#ifdef HAVE_SYS_TYPES_H
422 #include <sys/types.h>
424 #ifdef HAVE_SYS_SOCKET_H
425 #include <sys/socket.h>
427 #ifdef HAVE_NETINET_IN_H
428 #include <netinet/in.h>
430 #ifdef HAVE_ARPA_INET_H
431 #include <arpa/inet.h>
435 AC_BROKEN2(inet_ntop,
436 [#ifdef HAVE_SYS_TYPES_H
437 #include <sys/types.h>
439 #ifdef HAVE_SYS_SOCKET_H
440 #include <sys/socket.h>
442 #ifdef HAVE_NETINET_IN_H
443 #include <netinet/in.h>
445 #ifdef HAVE_ARPA_INET_H
446 #include <arpa/inet.h>
450 AC_BROKEN2(inet_pton,
451 [#ifdef HAVE_SYS_TYPES_H
452 #include <sys/types.h>
454 #ifdef HAVE_SYS_SOCKET_H
455 #include <sys/socket.h>
457 #ifdef HAVE_NETINET_IN_H
458 #include <netinet/in.h>
460 #ifdef HAVE_ARPA_INET_H
461 #include <arpa/inet.h>
466 dnl Check for sa_len in struct sockaddr,
467 dnl needs to come before the getnameinfo test
469 AC_HAVE_STRUCT_FIELD(struct sockaddr, sa_len, [#include <sys/types.h>
470 #include <sys/socket.h>])
472 if test "$ac_cv_func_getaddrinfo" = "yes"; then
473 rk_BROKEN_GETADDRINFO
474 if test "$ac_cv_func_getaddrinfo_numserv" = no; then
475 AC_LIBOBJ(getaddrinfo)
476 AC_LIBOBJ(freeaddrinfo)
480 AC_NEED_PROTO([#include <stdlib.h>], setenv)
481 AC_NEED_PROTO([#include <stdlib.h>], unsetenv)
482 AC_NEED_PROTO([#include <unistd.h>], gethostname)
483 AC_NEED_PROTO([#include <unistd.h>], mkstemp)
484 AC_NEED_PROTO([#include <unistd.h>], getusershell)
485 AC_NEED_PROTO([#include <unistd.h>], daemon)
487 #ifdef HAVE_SYS_TYPES_H
488 #include <sys/types.h>
490 #ifdef HAVE_SYS_SOCKET_H
491 #include <sys/socket.h>
493 #ifdef HAVE_NETINET_IN_H
494 #include <netinet/in.h>
496 #ifdef HAVE_ARPA_INET_H
497 #include <arpa/inet.h>
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>
522 AC_FIND_FUNC_NO_LIBS(crypt, crypt)dnl
524 AC_REQUIRE([rk_BROKEN_REALLOC])dnl
526 dnl AC_KRB_FUNC_GETCWD_BROKEN
528 dnl strerror_r is great fun, on linux it exists before sus catched up,
529 dnl so the return type is diffrent, lets check for both
535 strerror_r, int strerror_r(int, char *, size_t))
537 AC_CHECK_FUNC([strerror_r],
538 [AC_DEFINE_UNQUOTED(HAVE_STRERROR_R, 1,
539 [Define if you have the function strerror_r.])])
542 dnl Checks for prototypes and declarations
546 #ifdef HAVE_SYS_TYPES_H
547 #include <sys/types.h>
549 #ifdef HAVE_SYS_SOCKET_H
550 #include <sys/socket.h>
552 #ifdef HAVE_NETINET_IN_H
553 #include <netinet/in.h>
555 #ifdef HAVE_ARPA_INET_H
556 #include <arpa/inet.h>
562 gethostbyname, struct hostent *gethostbyname(const char *))
565 #ifdef HAVE_SYS_TYPES_H
566 #include <sys/types.h>
568 #ifdef HAVE_SYS_SOCKET_H
569 #include <sys/socket.h>
571 #ifdef HAVE_NETINET_IN_H
572 #include <netinet/in.h>
574 #ifdef HAVE_ARPA_INET_H
575 #include <arpa/inet.h>
581 gethostbyaddr, struct hostent *gethostbyaddr(const void *, size_t, int))
584 #ifdef HAVE_SYS_TYPES_H
585 #include <sys/types.h>
587 #ifdef HAVE_SYS_SOCKET_H
588 #include <sys/socket.h>
590 #ifdef HAVE_NETINET_IN_H
591 #include <netinet/in.h>
593 #ifdef HAVE_ARPA_INET_H
594 #include <arpa/inet.h>
600 getservbyname, struct servent *getservbyname(const char *, const char *))
603 #ifdef HAVE_SYS_TYPES_H
604 #include <sys/types.h>
606 #ifdef HAVE_SYS_SOCKET_H
607 #include <sys/socket.h>
610 getsockname, int getsockname(int, struct sockaddr*, socklen_t*))
617 openlog, void openlog(const char *, int, int))
631 rk_CHECK_VAR(h_errno,
632 [#ifdef HAVE_SYS_TYPES_H
633 #include <sys/types.h>
638 #ifdef HAVE_WS2TCPIP_H
639 #include <ws2tcpip.h>
643 rk_CHECK_VAR(h_errlist,
647 #ifdef HAVE_WS2TCPIP_H
648 #include <ws2tcpip.h>
655 #ifdef HAVE_WS2TCPIP_H
656 #include <ws2tcpip.h>
659 rk_CHECK_VAR([__progname],
664 AC_CHECK_DECLS([optarg, optind, opterr, optopt, environ],[],[],[
671 dnl Check for fields in struct tm
674 AC_HAVE_STRUCT_FIELD(struct tm, tm_gmtoff, [#include <time.h>])
675 AC_HAVE_STRUCT_FIELD(struct tm, tm_zone, [#include <time.h>])
678 dnl or do we have a variable `timezone' ?
681 rk_CHECK_VAR(timezone,[#include <time.h>])
682 rk_CHECK_VAR(altzone,[#include <time.h>])
684 AC_HAVE_TYPE([sa_family_t],[
685 #include <sys/types.h>
686 #ifdef HAVE_SYS_SOCKET_H
687 #include <sys/socket.h>
689 #ifdef HAVE_WS2TCPIP_H
690 #include <ws2tcpip.h>
692 AC_HAVE_TYPE([socklen_t],[
693 #include <sys/types.h>
694 #ifdef HAVE_SYS_SOCKET_H
695 #include <sys/socket.h>
697 #ifdef HAVE_WS2TCPIP_H
698 #include <ws2tcpip.h>
700 AC_HAVE_TYPE([struct sockaddr], [
701 #include <sys/types.h>
702 #ifdef HAVE_SYS_SOCKET_H
703 #include <sys/socket.h>
705 #ifdef HAVE_WS2TCPIP_H
706 #include <ws2tcpip.h>
708 AC_HAVE_TYPE([struct sockaddr_storage], [
709 #include <sys/types.h>
710 #ifdef HAVE_SYS_SOCKET_H
711 #include <sys/socket.h>
713 #ifdef HAVE_WS2TCPIP_H
714 #include <ws2tcpip.h>
716 AC_HAVE_TYPE([struct addrinfo], [
717 #include <sys/types.h>
721 #ifdef HAVE_WS2TCPIP_H
722 #include <ws2tcpip.h>
724 AC_HAVE_TYPE([struct ifaddrs], [#include <ifaddrs.h>])
725 AC_HAVE_TYPE([struct iovec],[
726 #include <sys/types.h>
729 AC_HAVE_TYPE([struct msghdr],[
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>
739 dnl Check for struct winsize
742 AC_KRB_STRUCT_WINSIZE
745 dnl Check for struct spwd
751 # Check if we want samba's socket wrapper
756 dnl won't work with automake
757 dnl moved to AC_OUTPUT in configure.in
758 dnl AC_CONFIG_FILES($1/Makefile)
760 LIB_roken="${LIB_roken} \$(LIB_crypt) \$(LIB_dbopen)"
762 AC_SUBST(DIR_roken)dnl
763 AC_SUBST(LIB_roken)dnl
764 AC_SUBST(INCLUDES_roken)dnl